Page tree
Skip to end of metadata
Go to start of metadata

To use these functions, the Matrix Feature is required.

The matrix feature provides arbitrary functions to work with matrices in a data stream and provides algebraic operator (+, *, -, ^) to perform matrix addition, subtraction, multiplication, and exponentiation. In addition, the algebraic operators can be used for per element operation.

Matrix Example
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]+[1.0,2.0,3.0;4.0,5.0,6.0] FROM stream
=> [2.0,4.0,6.0;8.0,10.0,12.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]-[1.0,1.0,1.0;2.0,2.0,2.0] FROM stream
=> [0.0,1.0,2.0;2.0,3.0,4.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]*[1.0,2.0;3.0,4.0;5.0,6.0] FROM stream
=> [22.0,28.0;49.0,64.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]+2 FROM stream
=> [3.0,4.0,5.0;6.0,7.0,8.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]-2 FROM stream
=> [-1.0,0.0,1.0;2.0,3.0,4.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]*2 FROM stream
=> [2.0,4.0,6.0;8.0,10.0,12.0]
SELECT [1.0,2.0,3.0;4.0,5.0,6.0]/2 FROM stream
=> [0.5,1.0,1.5;2.0,2.5,3.0]
SELECT [1.0,2.0;3.0,4.0]^3 FROM stream
=> [37.0,54.0;81.0,118.0]

Ones(Number n, Number m)

Returns an n-by-m matrix of ones.

Zeros(Number n, Number m)

Returns an n-by-m matrix of zeros.

Tr(Matrix m)

Returns the trace of the matrix m.

Det(Matrix m)

Returns the determinant of the matrix m.

Perm(Matrix m)

Returns the permanent of the matrix m.

Inv(Matrix m)

Returns the inverse of the matrix m.

Trans(Matrix m)

Returns the transpose of the matrix m.

Identity(Number n)

Returns an n-by-n identity matrix.

Eig(Matrix m)

Returns the eigenvalues of the matrix m.

IEig(Matrix m)

Returns the imaginary parts of the eigenvalues of the matrix m.

SVD(Matrix m)

Returns the singular values of the matrix m.

Perms(Vector v)

Returns a matrix containing all permutations of the elements of vector v.

SubMatrix(Matrix m, Number startRow, Number endRow, Number startColumn, Number endColumn)

Returns the submatrix of the given matrix starting at row StartRow and column StartColumn to EndRow and EndColumn (inclusive)

Min(Matrix|Vector m)

Returns the minimum element in the matrix/vector m.

Max(Matrix|Vector m)

Returns the maximum element in the matrix/vector m.

Count(Matrix|Vector m)

Counts all elements in the matrix/vector m.

Sum(Matrix|Vector m)

Returns the sum of all elements in the matrix/vector m.

AVG(Matrix|Vector m)

Returns the average of all elements in the matrix/vector m.

Median(Matrix|Vector m)

Returns the median of all elements in the matrix/vector m.

StdDev(Matrix|Vector m)

Returns the standard deviation of all elements in the matrix/vector m.

Var(Matrix|Vector m)

Returns the variance of all elements in the matrix/vector m.

ReadMatrix(String path)

Reads a matrix from an arbitrary comma separated file.

ReadVector(String path, [int row])

Reads a vector from an arbitrary comma separated file. The optional parameter selects the row (default:0).

  • No labels