Defined in File DenseMatrix.hpp
Represents a dense matrix. Use this matrix to run LU decompositions and LU solves. Note that most matrices are rather sparse s.t. CSRMatrix might be a better representation.
Public Functions
Default constructor
Constructs the DenseMatrix with size dimension x dimension.
dimension – Defines how many rows and columns this matrix has.
zero – The zero element (default is 0.0).
Constructs the DenseMatrix with size nRows x nCols.
nRows – Number of rows.
nCols – Number of columns.
zero – The zero element (default is 0.0).
Constructs the dimension x dimension DenseMatrix 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.0).
Constructs the nRows x nCols DenseMatrix 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.0).
Constructs an instance of DenseMatrix given the number of rows (nRows) and the number of columns (nCols) and its values (entries).
Note
The size of the entries vector should be equal to nRows * nCols.
nRows – Number of rows.
nCols – Number of columns.
entries – Entries of the matrix.
zero – The zero element (default is 0.0).
Default destructor
Default copy constructor
Default move constructor
Default copy assignment operator
Default move assignment operator
Compares this matrix to other and returns true if the shapes and entries are the same, 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 –
Returns the zero element of the matrix.
Note
This function is linear in the number of columns of the matrix.
i – The row index.
Number of non-zeros in row i.
Note
This function takes nRows * nCols operations.
Number of non-zeros in this matrix.
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 elements of row row in the matrix and call handler(index column, double value)
Iterate in parallel over all elements 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 row row in the matrix and call handler(index column, double value).
Note
This is a DenseMatrix! Therefore this operation needs O(numberOfRows()) time regardless of the number of non-zeros actually present.
Iterate in parallel over all non-zero elements of row row in the matrix and call handler(index column, double value)
Note
This is a DenseMatrix! Therefore this operation needs O(numberOfRows()) sequential time regardless of the number of non-zeros actually present.
Iterate over all non-zero elements of the matrix in row order and call handler (lambda closure).
Note
This is a DenseMatrix! Therefore this operation needs O(numberOfRows() * numberOfColumns()) time regardless of the number of non-zeros actually present.
Iterate in parallel over all rows and call handler (lambda closure) on non-zero elements of the matrix.
Note
This is a DenseMatrix! Therefore this operation needs O(numberOfRows() * numberOfColumns()) sequential time regardless of the number of non-zeros actually present.
Public Static Functions
Returns 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 –
Returns the (weighted) Laplacian matrix of the (weighteD) Graph graph.
graph –
Decomposes the given matrix into lower L and upper U matrix (in-place).
matrix – The matrix to decompose into LU.
Computes the solution vector x to the system LU * x = b where LU is a matrix decomposed into L and U.
LU – Matrix decomposed into lower L and upper U matrix.
b – Right-hand side.
Solution vector x to the linear equation system LU * x = b.
Computes A binaryOp B on the elements of matrix A and matrix B.
Note
A and B must have the same dimensions.
A –
B –
binaryOp – Function handling (double, double) -> double
A binaryOp B.