api / koma

Package koma

Types

Name Summary
UInt8 class ~~UInt8~~
mat object mat
A helper object that allows for quick construction of matrix literals.

Extensions for External Classes

Name Summary
kotlin.Double
kotlin.Int

Properties

Name Summary
E val E:Double
LONG_NUMBER val LONG_NUMBER:String
PI val PI:Double
SCIENTIFIC_LONG_NUMBER val SCIENTIFIC_LONG_NUMBER:String
SCIENTIFIC_NUMBER val SCIENTIFIC_NUMBER:String
SCIENTIFIC_VERY_LONG_NUMBER val SCIENTIFIC_VERY_LONG_NUMBER:String
SHORT_NUMBER val SHORT_NUMBER:String
VERY_LONG_NUMBER val VERY_LONG_NUMBER:String
all val all:IntRange
doubleFactory var ~~doubleFactory~~:MatrixFactory<Matrix<Double>>
end val end:Int
factory var ~~factory~~:MatrixFactory<Matrix<Double>>
floatFactory var ~~floatFactory~~:MatrixFactory<Matrix<Float>>
intFactory var ~~intFactory~~:MatrixFactory<Matrix<Int>>
matFormat var matFormat:String
validateMatrices var validateMatrices:Boolean
Whether to validate the dimensions, symmetry, and values of input matrices. false is faster, and should be used for realtime applications. true gives you much more useful errors when your matrices are shaped differently than your code expects.

Functions

Name Summary
abs fun abs(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the absolute value of each element in the input matrix.fun abs(arr:Double):Double
A convenience function performing the abs operation via the kotlin.math equivalent call.fun abs(arr:Int):Double
A convenience function performing the abs via the kotlin.math equivalent call.
acos fun acos(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the arccos of each element in the input matrix.fun acos(arr:Double):Double
fun acos(arr:Int):Double
A convenience function performing the acos operation via the kotlin.math equivalent call.
allclose fun allclose(arr1:Matrix<Double>, arr2:Matrix<Double>, rtol:Double= 1e-05, atol:Double= 1e-08):Boolean
Returns true if all elements are close to equal, as defined by two tolerance values. The matrices are considered equal if
arange fun arange(start:Double, stop:Double, step:Double):Matrix<Double>
Creates an vector filled in by the given range information. The filled values will start at start and end at stop, with the interval between each value step.fun <T> arange(start:Double, stop:Double, step:Double, dtype:MatrixType<T>):Matrix<T>
argMax fun argMax(arr:Matrix<Double>):Int
Returns the index of the max element in the input matrix
argMin fun argMin(arr:Matrix<Double>):Int
Returns the index of the min element in the input matrix
asin fun asin(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the arcsin of each element in the input matrix.fun asin(arr:Double):Double
fun asin(arr:Int):Double
A convenience function performing the asin operation via the kotlin.math equivalent call.
atan fun atan(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the arctan of each element in the input matrix.fun atan(arr:Double):Double
fun atan(arr:Int):Double
A convenience function performing the atan operation via the kotlin.math equivalent call.
atan2 fun atan2(x:Double, y:Double):Double
fun atan2(x:Int, y:Int):Double
A convenience function performing the atan2 operation via the kotlin.math equivalent call.
ceil fun ceil(arr:Matrix<Double>):Matrix<Double>
Rounds each element to the integer which is nearest to the element and still less than the element (i.e. truncation).fun ceil(num:Double):Int
A convenience function performing the ceil via the kotlin.math equivalent call.fun ceil(num:Int):Double
A convenience function performing the ceil operation via the kotlin.math equivalent call.
cos fun cos(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the cos of each element in the input matrix.fun cos(arr:Double):Double
fun cos(arr:Int):Double
A convenience function performing the cos operation via the kotlin.math equivalent call.
create fun create(data:IntRange):Matrix<Double>
Creates a matrix filled with the given range of values.fun <T> create(data:IntRange, dtype:MatrixType<T>):Matrix<T>
fun <T> create(data:DoubleArray, dtype:MatrixType<T>):Matrix<T>
fun <T> create(data:DoubleArray, numRows:Int, numCols:Int, dtype:MatrixType<T>):Matrix<T>
fun <T> create(data:Array<DoubleArray>, dtype:MatrixType<T>):Matrix<T>``fun create(data:DoubleArray):Matrix<Double>
Creates a matrix filled with the given set of values as a row-vector.fun create(data:DoubleArray, numRows:Int, numCols:Int):Matrix<Double>
Creates a matrix filled with the given set of values in row-major order.fun create(data:Array<DoubleArray>):Matrix<Double>
Creates a matrix filled with the given data, assuming input is row major.
cross fun cross(vec1:Matrix<Double>, vec2:Matrix<Double>):Matrix<Double>
Calculates the cross product of two vectors
cumsum fun cumsum(arr:Matrix<Double>):Matrix<Double>
Calculates the cumulative (ongoing) sum of a matrix's elements. For example, cumsum(mat[1,2,3]) would return mat[1,3,6].
diag fun diag(arr:Matrix<Double>):Matrix<Double>
Extracts the diagonal of the matrix.
dot fun dot(vec1:Matrix<Double>, vec2:Matrix<Double>):Double
Calculates the cross product of two vectors
epow fun epow(arr:Matrix<Double>, num:Double):Matrix<Double>
Returns a matrix consisting of each element in the input matrix raised to the given power.
exp fun exp(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of E.pow(element) for each element in the input matrix.fun exp(arr:Double):Double
fun exp(arr:Int):Double
A convenience function performing the exp operation via the kotlin.math equivalent call.
expm fun expm(A:Matrix<Double>):Matrix<Double>
Calculates the matrix exponential of the input matrix. Note that this is NOT the same thing as the elementwise exponential function.
eye fun eye(size:Int):Matrix<Double>
Creates a square identity matrix with the given sizefun <T> eye(size:Int, dtype:MatrixType<T>):Matrix<T>
fun <T> eye(rows:Int, cols:Int, dtype:MatrixType<T>):Matrix<T>``fun eye(rows:Int, cols:Int):Matrix<Double>
Creates an identity matrix with the given size
fill fun fill(rows:Int, cols:Int, func: (Int,Int) ->Double):Matrix<Double>
Creates a new matrix that fills all the values with the return values of func(row,val)fun <T> fill(rows:Int, cols:Int, dtype:MatrixType<T>, func: (Int,Int) ->T):Matrix<T>
fun <T> fill(rows:Int, cols:Int, value:T, dtype:MatrixType<T>):Matrix<T>``fun fill(rows:Int, cols:Int, value:Double):Matrix<Double>
Creates a new matrix that fills all the values with value
floor fun floor(arr:Matrix<Double>):Matrix<Double>
Rounds each element to the integer which is nearest to the element and still less than the element (i.e. truncation).fun floor(arr:Double):Int
fun floor(arr:Int):Double
A convenience function performing the floor operation via the kotlin.math equivalent call.
format fun format(formatStr:String):Unit
Sets the format for Koma to display numbers in. For example, calling
hstack fun hstack(vararg arrs:Matrix<Double>):Matrix<Double>
ln fun ln(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the natural logarithm of each element in the input matrix.fun ln(arr:Double):Double
fun ln(arr:Int):Double
A convenience function performing the log operation via the kotlin.math equivalent call.
log fun ~~log~~(arr:Matrix<Double>):Matrix<Double>
fun ~~log~~(arr:Double):Double
fun ~~log~~(arr:Int):Double
logb fun logb(base:Int, arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the log-base-b of each element in the input matrixfun logb(base:Double, num:Double):Double
fun logb(base:Int, num:Int):Double
fun logb(base:Int, num:Double):Double
fun logb(base:Double, num:Int):Double
A convenience function performing the logb operation via the kotlin.math equivalent call.
max fun max(arr:Matrix<Double>):Double
Returns the max element in the input matrixfun max(num1:Double, num2:Double):Double
fun max(num1:Int, num2:Int):Int
fun max(num1:Double, num2:Int):Double
fun max(num1:Int, num2:Double):Double
A convenience function performing the max operation via the kotlin.math equivalent call.
mean fun mean(arr:Matrix<Double>):Double
Returns the mean element in the input matrix
min fun min(arr:Matrix<Double>):Double
Returns the min element in the input matrixfun min(num1:Double, num2:Double):Double
fun min(num1:Int, num2:Int):Int
fun min(num1:Int, num2:Double):Double
fun min(num1:Double, num2:Int):Double
A convenience function performing the min operation via the kotlin.math equivalent call.
ones fun ones(rows:Int, columns:Int):Matrix<Double>
Creates a one-filled matrix with the given sizefun <T> ones(rows:Int, columns:Int, dtype:MatrixType<T>):Matrix<T>
pow fun pow(arr:Matrix<Double>, num:Int):Matrix<Double>
Returns a matrix which is the input matrix multiplied by itself num times (NOT elementwise multiplication!!). For elementwise see epow.fun pow(num:Double, exp:Double):Double
fun pow(num:Int, exp:Int):Double
fun pow(num:Double, exp:Int):Double
fun pow(num:Int, exp:Double):Double
A convenience function performing the pow operation via the kotlin.math equivalent call.
rand fun rand(rows:Int, cols:Int):Matrix<Double>
Creates an matrix filled with unit uniform random numbersfun <T> rand(rows:Int, cols:Int, dtype:MatrixType<T>):Matrix<T>
fun <T> ~~rand~~(rows:Int, cols:Int, seed:Long, dtype:MatrixType<T>):Matrix<T>``fun ~~rand~~(rows:Int, cols:Int, seed:Long):Matrix<Double>
Creates an matrix filled with unit normal random numbers, using the given seed for the RNG. Subsequent calls with the same seed will produce identical numbers.
randn fun randn(rows:Int, cols:Int):Matrix<Double>
Creates an matrix filled with unit normal random numbersfun <T> randn(rows:Int, cols:Int, dtype:MatrixType<T>):Matrix<T>
fun <T> ~~randn~~(rows:Int, cols:Int, seed:Long, dtype:MatrixType<T>):Matrix<T>``fun ~~randn~~(rows:Int, cols:Int, seed:Long):Matrix<Double>
Creates an matrix filled with unit normal random numbers, using the given seed for the RNG. Subsequent calls with the same seed will produce identical numbers.
round fun round(arr:Matrix<Double>):Matrix<Double>
Rounds each element to the nearest integer value. For elements exactly between integers, choose the highest value.fun round(arr:Double):Double
fun round(arr:Int):Double
A convenience function performing the round operation via the kotlin.math equivalent call.
setSeed fun setSeed(seed:Long):Unit
sign fun sign(arr:Matrix<Double>):Matrix<Double>
Calculates a matrix consisting of the sign of each element in the input matrix. Returns -1 for positive values, -1 for negative values, 0 for 0.fun sign(arr:Double):Double
fun sign(arr:Int):Double
A convenience function performing the sign operation via the kotlin.math equivalent call.
sin fun sin(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the sin of each element in the input matrixfun sin(arr:Double):Double
fun sin(arr:Int):Double
A convenience function performing the sin operation via the kotlin.math equivalent call.
skew fun skew(angles:Matrix<Double>):Matrix<Double>
Converts a 3x1 or 1x3 vector of angles into the skew symmetric matrix equivalent.
sqrt fun sqrt(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the sqrt of each element in the input matrix. Does not yet support complex numbers.fun sqrt(arr:Double):Double
fun sqrt(arr:Int):Double
A convenience function performing the sqrt operation via the kotlin.math equivalent call.
tan fun tan(arr:Matrix<Double>):Matrix<Double>
Returns a matrix of the tan of each element in the input matrixfun tan(arr:Double):Double
fun tan(arr:Int):Double
A convenience function performing the tan operation via the kotlin.math equivalent call.
vstack fun vstack(vararg arrs:Matrix<Double>):Matrix<Double>
zeros fun zeros(rows:Int, cols:Int):Matrix<Double>
Creates a zero-filled matrix with the given sizefun <T> zeros(rows:Int, cols:Int, dtype:MatrixType<T>):Matrix<T>