# Page History

## Key

• 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
language sql 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)

sMin

### Min(Matrix|Vector m)

Returns the minimum element in the matrix/vector m.

sMax

### Max(Matrix|Vector m)

Returns the maximum element in the matrix/vector m.

sCount

### Count(Matrix|Vector m)

Counts all elements in the matrix/vector m.

sSum

### Sum(Matrix|Vector m)

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

sAVG

### AVG(Matrix|Vector m)

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

sMedian

### Median(Matrix|Vector m)

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

sStdDev

### StdDev(Matrix|Vector m)

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

sVar

### Var(Matrix|Vector m)

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