MatrixGenerator
This class provides a matrix used e.g. by MatrixCalculate.
If multiple matrices are given the resulting matrix is the sum all
and the size is exandeded to fit all matrices. Before the computation of each submatrix
the variables rowsBefore
and columnsBefore
with current size of the overall matrix
are set. As all matrices can be manipulated before, complex matrix operations are possible.
File
Matrix from file.
Name | Type | Annotation |
---|---|---|
inputfileMatrix | filename | |
factor | double |
Normals file
Matrix from a normal equation file. The symmetric normal matrix, the right hand side vector, the lPl vector, or the observation count $(1\times1)$ can be selected.
Name | Type | Annotation |
---|---|---|
inputfileNormalEquation | filename | |
type | choice | |
normalMatrix | ||
rightHandSide | ||
lPl | ||
observationCount | ||
factor | double |
Expression
Matrix filled by an expression. For each element of the new matrix the variables
row
and column
are set and the expression element is evaluated.
Excample: The element=if(row==column,1,0)
generates an identity matrix.
Name | Type | Annotation |
---|---|---|
rows | expression | (variables: rowsBefore, columnsBefore) |
columns | expression | (variables: rowsBefore, columnsBefore) |
element | expression | for each element of matrix (variables: row, column, rows, columns, rowsBefore, columnsBefore) |
Element manipulation
The elements of a matrix are replaced an expression.
For each element of the matrix the variables data
, row
, column
are set and the expression element is evaluated and replaces the element.
Additionally the standard data variables are available (assigned each row),
see dataVariables.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
element | expression | for each element of matrix (variables: data, row, column, rows, columns, rowsBefore, columnsBefore) |
ElementWiseOperation
Given two matrices $\mathbf{A}$ and $\mathbf{B}$ this class computes $c_{ij} = f(a_{ij}, b_{ij})$,
where $f$ is an expression (for example data0*data1
).
For each element of the matrix the variables data0
, data1
, row
, column
are set and the expression element is evaluated.
Name | Type | Annotation |
---|---|---|
matrix1 | matrixGenerator | |
matrix2 | matrixGenerator | |
expression | expression | for each element of matrix (variables: data0, data1, row, column, rows, columns, rowsBefore, columnsBefore) |
Append
Append matrix to the right (first row) or bottom (first column).
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
side | choice | |
right | ||
bottom | ||
diagonal |
Shift
Shift start row and start column of a matrix. In other words: zero lines and columns are inserted at the beginning of the matrix.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
startRow | expression | start row (variables: rowsBefore, columnsBefore, rows, columns) |
startColumn | expression | start column (variables: rowsBefore, columnsBefore, rows, columns) |
Slice
Slice of a matrix.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
startRow | expression | start row of matrix (variables: rowsBefore, columnsBefore, rows, columns) |
startColumn | expression | start column of matrix (variables: rowsBefore, columnsBefore, rows, columns) |
rows | expression | 0: until end (variables: rowsBefore, columnsBefore, rows, columns) |
columns | expression | 0: until end (variables: rowsBefore, columnsBefore, rows, columns) |
Reshape
Matrix reshaped columnwise to new row and columns.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
rows | expression | 0: auto-determine rows, (variables: rowsBefore, columnsBefore) |
columns | expression | 0: auto-determine columns (variables: rowsBefore, columnsBefore) |
Reorder
Reorder rows or columns of a matrix by an index vectors. The index vector can be created with ParameterSelection2IndexVector.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
inputfileIndexVectorRow | filename | index in input matrix or -1 for new parameter. |
inputfileIndexVectorColumn | filename | index in input matrix or -1 for new parameter. |
Sort
Sort matrix by column in ascending order by default or in descending order.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
column | uint | sort by column, top = highest priority |
descending | boolean |
Transpose
Transposed of a matrix $\M A^T$.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator |
Multiplication
Multiplication of matrices.
Name | Type | Annotation |
---|---|---|
matrix1 | matrixGenerator | |
matrix2 | matrixGenerator | |
factor | double |
Inverse
Inverse of a matrix $\M A^{-1}$.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
pseudoInverse | boolean | compute pseudo inverse instead of regular one |
Cholesky
Upper triangular natrix of the cholesky decomposition of a symmetric matrix $\M A=\M W^T\M W$.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator |
RankKUpdate
Symmetric matrix from rank k update: $\M A^T\M A$.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
factor | double |
EigenValues
Computes the eigenvalues of a square matrix and gives a vector of eigenvalues for symmetric matrices or a matrix with 2 columns with real and imaginary parts in general case.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
eigenVectors | boolean | return eigen vectors instead of eigen values |
Diagonal
Extract the diagonal or subdiagnoal ($n\times 1$ vector) of a matrix. The zero diagonal means the main diagonal, a positive value the superdiagonal, and a negative the subdiagonal.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
diagonal | int | zero: main diagonal, positive: superdiagonal, negative: subdiagonal |
FromDiagonal
Generate a matrix from a diagonal vector.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | (nx1) or (1xn) diagonal vector |
diagonal | int | zero: main diagonal, positive: superdiagonal, negative: subdiagonal |
Set type
Set type (matrix, matrixSymmetricUpper, matrixSymmetricLower, matrixTriangularUpper, matrixTriangularLower) of a matrix. If the type is not matrix, the matrix must be quadratic. Symmetric matrices are filled symmetric and for triangular matrix the other triangle is set to zero.
Name | Type | Annotation |
---|---|---|
matrix | matrixGenerator | |
type | choice | |
matrix | ||
matrixSymmetricUpper | ||
matrixSymmetricLower | ||
matrixTriangularUpper | ||
matrixTriangularLower |