All Bundles

Matrix2D

2D matrix operations

Operations

Add

Adds a constant to a matrix

function : native : Add(c:Float, m:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
cFloatconstant
mFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

Adds a constant to a matrix

function : native : Add(m:Float[,], c:Float) ~ Float[,]
Parameters
NameTypeDescription
mFloat[,]matrix
cFloatconstant

Return
TypeDescription
Float[,]updated matrix

Adds two matrices

function : native : Add(m1:Float[,], m2:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
m1Float[,]left matrix
m2Float[,]right matrix

Return
TypeDescription
Float[,]updated matrix

AverageColumn

Average of the given column

function : native : AverageColumn(c:Int, matrix:Float[,]) ~ Float
Parameters
NameTypeDescription
cIntcolumn index
matrixFloat[,]matrix

Return
TypeDescription
Floataverage of the column

AverageRow

Average of the given row

function : native : AverageRow(r:Int, matrix:Float[,]) ~ Float
Parameters
NameTypeDescription
rIntrow index
matrixFloat[,]matrix

Return
TypeDescription
Floataverage of the row

Concatenate

Concatenates two matrix

function : Concatenate(a:Float[,], b:Float[,], is_row:Bool) ~ Float[,]
Parameters
NameTypeDescription
aFloat[,]left matrix
bFloat[,]right matrix
is_rowBooltrue concatenate by rows, false for columns

Return
TypeDescription
Float[,]concatenated matrix

Divide

Divides a constant by a matrix

function : native : Divide(c:Float, m:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
cFloatconstant
mFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

Divides a constant by a matrix

function : native : Divide(m:Float[,], c:Float) ~ Float[,]
Parameters
NameTypeDescription
mFloat[,]matrix
cFloatconstant

Return
TypeDescription
Float[,]updated matrix

DotProduct

Calculates the dot product.

function : native : DotProduct(m1:Float[,], m2:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
m1Float[,]left matrix
m2Float[,]right matrix

Return
TypeDescription
Float[,]updated matrix

DotSigmoid

Calculates the Dot Product applying while applying the Sigmoid function to all elements

function : native : DotSigmoid(a:Float[,], b:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
aFloat[,]matrix
bFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

EuclideanDistance

Calculates the Euclidean Distance between the two vectors

function : native : EuclideanDistance(m1:Float[,]) ~ Float
Parameters
NameTypeDescription
m1Float[,]data matrix

Return
TypeDescription
FloatEuclidean Distance between the two vectors

GetColumn

Get the column from a matrix

function : native : GetColumn(c:Int, matrix:Float[,]) ~ Float[]
Parameters
NameTypeDescription
cIntcolumn index
matrixFloat[,]matrix

Return
TypeDescription
Float[]column from matrix

GetRow

Get the row from a matrix

function : native : GetRow(r:Int, matrix:Float[,]) ~ Float[]
Parameters
NameTypeDescription
rIntrow index
matrixFloat[,]matrix

Return
TypeDescription
Float[]row from matrix

HadamardDivide

Divides two matrices using the Hadamard rule

function : native : HadamardDivide(m1:Float[,], m2:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
m1Float[,]left matrix
m2Float[,]right matrix

Return
TypeDescription
Float[,]updated matrix

HadamardProduct

Multiplies two matrices using the Hadamard rule

function : native : HadamardProduct(m1:Float[,], m2:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
m1Float[,]left matrix
m2Float[,]right matrix

Return
TypeDescription
Float[,]updated matrix

Identity

Creates an identity a matrix

function : native : Identity(s:Int) ~ Float[,]
Parameters
NameTypeDescription
sIntsize of matrix

Return
TypeDescription
Float[,]row from matrix

Inverse

Inverse of matrix

function : native : Inverse(a:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
aFloat[,]matrix

Return
TypeDescription
Float[,]inverted matrix

Multiple

Multiplies a constant by a matrix

function : native : Multiple(c:Float, m:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
cFloatconstant
mFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

Multiplies a constant by a matrix

function : native : Multiple(m:Float[,], c:Float) ~ Float[,]
Parameters
NameTypeDescription
mFloat[,]matrix
cFloatconstant

Return
TypeDescription
Float[,]updated matrix

Random

Generates a random 2D array of values from 0.0 to 1.0

function : Random(rows:Int, cols:Int) ~ Float[,]
Parameters
NameTypeDescription
rowsIntrows
colsIntcolumns

Return
TypeDescription
Float[,]updated matrix

RandomNormal

Generates a random normal distribution of values

function : RandomNormal(mean:Float, variance:Float, rows:Int, cols:Int) ~ Float[,]
Parameters
NameTypeDescription
meanFloatcenter of values
varianceFloatvariance in values
rowsIntrows
colsIntcolumns

Return
TypeDescription
Float[,]updated matrix

Generates a random normal value

function : RandomNormal(mean:Float, variance:Float) ~ Float
Parameters
NameTypeDescription
meanFloatcenter of values
varianceFloatvariance in values

Return
TypeDescription
Floatupdated matrix

Sigmoid

Sigmoid 'S' function

function : native : Sigmoid(x:Float) ~ Float
Parameters
NameTypeDescription
xFloatinput value

Return
TypeDescription
FloatSigmoid value

Applies the Sigmoid function to all elements

function : native : Sigmoid(b:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
bFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

Solve

Solves a unit of equations

function : native : Solve(m1:Float[,], m2:Float[,]) ~ Float[]
Parameters
NameTypeDescription
m1Float[,]data matrix
m2Float[,]result matrix

Return
TypeDescription
Float[]least squares

Split

Splits a matrix

function : native : Split(b:Float[,], offset:Int, count:Int, is_row:Bool) ~ Float[,]
Parameters
NameTypeDescription
bFloat[,]matrix
offsetIntoffset index
countIntnumber of rows to split
is_rowBooltrue for row split, false for column

Return
TypeDescription
Float[,]copied matrix

Subtract

Subtracts a constant from a matrix

function : native : Subtract(c:Float, m:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
cFloatconstant
mFloat[,]matrix

Return
TypeDescription
Float[,]updated matrix

Adds a constant to a matrix

function : native : Subtract(m:Float[,], c:Float) ~ Float[,]
Parameters
NameTypeDescription
mFloat[,]matrix
cFloatconstant

Return
TypeDescription
Float[,]updated matrix

Subtracts two matrices

function : native : Subtract(m1:Float[,], m2:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
m1Float[,]left matrix
m2Float[,]right matrix

Return
TypeDescription
Float[,]updated matrix

SumColumn

Sum of the given column

function : native : SumColumn(c:Int, matrix:Float[,]) ~ Float
Parameters
NameTypeDescription
cIntcolumn index
matrixFloat[,]matrix

Return
TypeDescription
Floatsum of the column

SumRow

Sum of the given row

function : native : SumRow(r:Int, matrix:Float[,]) ~ Float
Parameters
NameTypeDescription
rIntrow index
matrixFloat[,]matrix

Return
TypeDescription
Floatsum of the row

ToBool

Parsers a boolean value

function : ToBool(m:Float[,]) ~ Bool
Parameters
NameTypeDescription
mFloat[,]matrix

Return
TypeDescription
Boolboolean value

ToFloat

Parsers a decimal value

function : ToFloat(m:Float[,]) ~ Float
Parameters
NameTypeDescription
mFloat[,]matrix

Return
TypeDescription
Floatdecimal value

ToInt

Parsers an integer value

function : ToInt(m:Float[,]) ~ Int
Parameters
NameTypeDescription
mFloat[,]matrix

Return
TypeDescription
Intinteger value

Transpose

Transpose of matrix

function : native : Transpose(a:Float[,]) ~ Float[,]
Parameters
NameTypeDescription
aFloat[,]matrix

Return
TypeDescription
Float[,]transposed matrix