HDK
|
#include <UT_SparseMatrix.h>
Public Types | |
typedef UT_SparseMatrixCSRT< T > | SparseMatrixType |
Public Member Functions | |
UT_SparseMatrixBuilderT () | |
Construct an uninitialized sparse matrix builder. More... | |
UT_SparseMatrixBuilderT (SparseMatrixType &matrix) | |
Construct a sparse matrix builder for the given matrix. More... | |
void | init (SparseMatrixType &matrix) |
Initializes the builder to start building the given matrix. More... | |
void | setCapacity (exint capacity) |
void | startRow (exint row) |
void | addToColumn (exint col, T value) |
void | finish () |
Completes the remaining rows and finalizes the matrix. More... | |
Simple helper class to construct a SparseMatrixCSRT. This operates on the matrix data in-place and is generally much more performant than constructing via triplets, but the builder has the limitation of only being able to add to rows sequentially; i.e. each call to startRow must start the construction of a row greater than the last, while addToColumn can be called with any column ordering.
Definition at line 1035 of file UT_SparseMatrix.h.
typedef UT_SparseMatrixCSRT<T> UT_SparseMatrixBuilderT< T >::SparseMatrixType |
Definition at line 1038 of file UT_SparseMatrix.h.
|
inline |
Construct an uninitialized sparse matrix builder.
Definition at line 1041 of file UT_SparseMatrix.h.
|
inline |
Construct a sparse matrix builder for the given matrix.
Definition at line 1044 of file UT_SparseMatrix.h.
void UT_SparseMatrixBuilderT< T >::addToColumn | ( | exint | col, |
T | value | ||
) |
Adds the given value at the given column to the current row. If a cell is already present for the given column, the given value is added to it.
void UT_SparseMatrixBuilderT< T >::finish | ( | ) |
Completes the remaining rows and finalizes the matrix.
void UT_SparseMatrixBuilderT< T >::init | ( | SparseMatrixType & | matrix | ) |
Initializes the builder to start building the given matrix.
void UT_SparseMatrixBuilderT< T >::setCapacity | ( | exint | capacity | ) |
Sets the minimum capacity of non-zero elements for the given matrix. This is used to preallocate memory for the matrix to avoid excessive reallocation as elements are added.
void UT_SparseMatrixBuilderT< T >::startRow | ( | exint | row | ) |
Advances the current row to the given row. The row must be greater than the current row.