Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Code Block
languagesql
titleMatrix 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)

Computes Returns the trace of the matrix m.

Det(Matrix m)

Computes Returns the determinant of the matrix m.

Perm(Matrix m)

Returns the permanent of the given matrix m.

Inv(Matrix m)

Computes Returns the inverse of the given matrix m.

Trans(Matrix m)

Computes Returns the transpose of the given matrix m.

Identity(Number

size

n)

Creates a N x N identity matrix

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)

sMin

Min(Matrix|Vector m)

Return Returns the minimum element in the given matrix/vector m.

sMax

Max(Matrix|Vector m)

Returns the maximum element in the given matrix/vector m.

sCount

Count(Matrix|Vector m)

Counts all elements in the given matrix/vector m.

sSum

Sum(Matrix|Vector m)

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

sAVG

AVG(Matrix|Vector m)

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

sMedian

Median(Matrix|Vector m)

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

StdDev(Matrix|Vector m)

Returns the standard deviation of the given matrixall 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).

Table of Contents