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.

NameTypeAnnotation
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.

NameTypeAnnotation
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.

NameTypeAnnotation
rows
expression(variables: rowsBefore, columnsBefore)
columns
expression(variables: rowsBefore, columnsBefore)
element
expressionfor 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.

NameTypeAnnotation
matrix
matrixGenerator
element
expressionfor 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.

NameTypeAnnotation
matrix1
matrixGenerator
matrix2
matrixGenerator
expression
expressionfor 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).

NameTypeAnnotation
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.

NameTypeAnnotation
matrix
matrixGenerator
startRow
expressionstart row (variables: rowsBefore, columnsBefore, rows, columns)
startColumn
expressionstart column (variables: rowsBefore, columnsBefore, rows, columns)

Slice

Slice of a matrix.

NameTypeAnnotation
matrix
matrixGenerator
startRow
expressionstart row of matrix (variables: rowsBefore, columnsBefore, rows, columns)
startColumn
expressionstart column of matrix (variables: rowsBefore, columnsBefore, rows, columns)
rows
expression0: until end (variables: rowsBefore, columnsBefore, rows, columns)
columns
expression0: until end (variables: rowsBefore, columnsBefore, rows, columns)

Reshape

Matrix reshaped columnwise to new row and columns.

NameTypeAnnotation
matrix
matrixGenerator
rows
expression0: auto-determine rows, (variables: rowsBefore, columnsBefore)
columns
expression0: 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.

NameTypeAnnotation
matrix
matrixGenerator
inputfileIndexVectorRow
filenameindex in input matrix or -1 for new parameter.
inputfileIndexVectorColumn
filenameindex in input matrix or -1 for new parameter.

Sort

Sort matrix by column in ascending order by default or in descending order.

NameTypeAnnotation
matrix
matrixGenerator
column
uintsort by column, top = highest priority
descending
boolean

Transpose

Transposed of a matrix $\M A^T$.

NameTypeAnnotation
matrix
matrixGenerator

Multiplication

Multiplication of matrices.

NameTypeAnnotation
matrix1
matrixGenerator
matrix2
matrixGenerator
factor
double

Inverse

Inverse of a matrix $\M A^{-1}$.

NameTypeAnnotation
matrix
matrixGenerator
pseudoInverse
booleancompute 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$.

NameTypeAnnotation
matrix
matrixGenerator

RankKUpdate

Symmetric matrix from rank k update: $\M A^T\M A$.

NameTypeAnnotation
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.

NameTypeAnnotation
matrix
matrixGenerator
eigenVectors
booleanreturn 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.

NameTypeAnnotation
matrix
matrixGenerator
diagonal
intzero: main diagonal, positive: superdiagonal, negative: subdiagonal

FromDiagonal

Generate a matrix from a diagonal vector.

NameTypeAnnotation
matrix
matrixGenerator(nx1) or (1xn) diagonal vector
diagonal
intzero: 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.

NameTypeAnnotation
matrix
matrixGenerator
type
choice
matrix
matrixSymmetricUpper
matrixSymmetricLower
matrixTriangularUpper
matrixTriangularLower