Defined in File CSRGeneralMatrix.hpp
The CSRGeneralMatrix class represents a sparse matrix stored in CSR-Format (i.e. compressed sparse row). If speed is important, use this CSRGeneralMatrix instead of the Matrix class.
Public Functions
Default constructor
Constructs the CSRGeneralMatrix with size dimension x dimension.
dimension – Defines how many rows and columns this matrix has.
zero – The zero element (default = 0).
Constructs the CSRGeneralMatrix with size nRows x nCols.
nRows – Number of rows.
nCols – Number of columns.
zero – The zero element (default = 0).
Constructs the dimension x dimension Matrix from the elements at position positions with values @values.
dimension – Defines how many rows and columns this matrix has.
triplets – The nonzero elements.
zero – The zero element (default is 0).
isSorted – True, if the triplets are sorted per row. Default is false.
Constructs the nRows x nCols Matrix from the elements at position positions with values @values.
nRows – Defines how many rows this matrix has.
nCols – Defines how many columns this matrix has.
triplets – The nonzero elements.
zero – The zero element (default is 0).
isSorted – True, if the triplets are sorted per row. Default is false.
Constructs the nRows x nCols Matrix from the elements stored in columnIdx and values. columnIdx and values store the colums and values by row.
nRows –
nCols –
columnIdx –
values –
zero – The zero element (default is 0).
isSorted – True if the column indices in columnIdx are sorted in every row.
Constructs the nRows x nCols Matrix from the elements at position positions with values @values.
nRows – Defines how many rows this matrix has.
nCols – Defines how many columns this matrix has.
rowIdx – The rowIdx vector of the CSR format.
columnIdx – The columnIdx vector of the CSR format.
nonZeros – The nonZero vector of the CSR format. Should be as long as the columnIdx vector.
zero – The zero element (default is 0).
isSorted – True, if the triplets are sorted per row. Default is false.
Default copy constructor
Default move constructor
Default destructor
Default move assignment operator
Default copy assignment operator
Compares this matrix to other and returns true if the shape and zero element are the same as well as all entries, otherwise returns false.
other –
Compares this matrix to other and returns true if the shape and zero element are the same as well as all entries are the same (within the absolute error range of eps), otherwise returns false.
other –
eps –
Compares this matrix to other and returns false if the shape and zero element are the same as well as all entries, otherwise returns true.
other –
i – The row index.
Number of non-zeros in row i.
Value at matrix position (i,j).
Set the matrix at position (i, j) to value.
Note
This operation can be linear in the number of non-zeros due to vector element movements
Sorts the column indices in each row for faster access.
True if the matrix is sorted, otherwise false.
Adds this matrix to other and returns the result.
The sum of this matrix and other.
Adds other to this matrix.
Reference to this matrix.
Subtracts other from this matrix and returns the result.
The difference of this matrix and other.
Subtracts other from this matrix.
Reference to this matrix.
Multiplies this matrix with a scalar specified in scalar and returns the result.
The result of multiplying this matrix with scalar.
Multiplies this matrix with a scalar specified in scalar.
Reference to this matrix.
Multiplies this matrix with vector and returns the result.
The result of multiplying this matrix with vector.
Multiplies this matrix with other and returns the result in a new matrix.
The result of multiplying this matrix with other.
Divides this matrix by a divisor specified in divisor and returns the result in a new matrix.
The result of dividing this matrix by divisor.
Divides this matrix by a divisor specified in divisor.
Reference to this matrix.
Transposes this matrix and returns it.
Extracts a matrix with rows and columns specified by rowIndices and columnIndices from this matrix. The order of rows and columns is equal to the order in rowIndices and columnIndices. It is also possible to specify a row or column more than once to get duplicates.
rowIndices –
columnIndices –
Assign the contents of the matrix source to this matrix at rows and columns specified by rowIndices and columnIndices. That is, entry (i,j) of source is assigned to entry (rowIndices[i], columnIndices[j]) of this matrix. Note that the dimensions of @rowIndices and columnIndices must coincide with the number of rows and columns of source.
rowIndices –
columnIndices –
source –
Applies the unary function unaryElementFunction to each value in the matrix. Note that it must hold that the function applied to the zero element of this matrix returns the zero element.
unaryElementFunction –
Iterate over all non-zero elements of row row in the matrix and call handler(index column, ValueType value)
Iterate in parallel over all non-zero elements of row row in the matrix and call handler(index column, ValueType value)
Iterate over all elements in row i in the matrix and call handle(index column, ValueType value)
Iterate in parallel over all elements (including zeros) of row row in the matrix and call handler(index column, double value)
Iterate over all elements of the matrix in row order and call handler (lambda closure).
Iterate in parallel over all rows and call handler (lambda closure) on elements of the matrix.
Iterate over all non-zero elements of the matrix in row order and call handler (lambda closure).
Iterate in parallel over all rows and call handler (lambda closure) on non-zero elements of the matrix.
Public Static Functions
Computes A binaryOp B on the elements of matrix A and matrix B.
Note
A and B must have the same dimensions and must be sorted.
A – Sorted CSRGeneralMatrix.
B – Sorted CSRGeneralMatrix.
binaryOp – Function handling (ValueType, ValueType) -> ValueType
A binaryOp B.
Computes A^T * B.
Note
The number of rows of A must be equal to the number of rows of B.
A –
B –
A^T * B.
Computes A * B^T.
Note
The number of columns of A must be equal to the number of columns of B.
A –
B –
A * B^T.
Computes matrix^T * vector.
Note
The number of rows of matrix must be equal to the dimension of vector.
matrix –
vector –
matrix^T * vector.
Compute the (weighted) adjacency matrix of the (weighted) Graph graph.
graph –
Creates a diagonal matrix with dimension equal to the dimension of the Vector diagonalElements. The values on the diagonal are the ones stored in diagonalElements (i.e. D(i,i) = diagonalElements[i]).
diagonalElements –
Returns the (weighted) incidence matrix of the (weighted) Graph graph.
graph –
Compute the (weighted) Laplacian of the (weighted) Graph graph.
graph –
Returns the (weighted) normalized Laplacian matrix of the (weighted) Graph graph
graph –