You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

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]

Tr(Matrix m)

Computes the trace of the matrix

Det(Matrix m)

Computes the determinant of the given matrix

Inv(Matrix m)

Computes the inverse of the given matrix

Trans(Matrix m)

Computes the transpose of the given matrix

Identity(Number size)

Creates a N x N identity matrix

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(Matrix|Vector m)

Return the minimum element in the given matrix.

sMax(Matrix|Vector m)

Returns the maximum element in the given matrix.

sCount(Matrix|Vector m)

Counts all elements in the given matrix.

sSum(Matrix|Vector m)

Computes the sum of all elements of the given matrix.

sAVG(Matrix|Vector m)

Compute the average of all elements of the given matrix.

sMedian(Matrix|Vector m)

Compute the median of all elements of the given matrix.

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