opensurgsim
|
Definitions of useful sparse matrix functions. More...
Go to the source code of this file.
Classes | |
class | SurgSim::Math::Operation< DerivedSub, SparseType, StorageOrder > |
Helper class to run operation a column/row of a matrix to a chunk of memory where the size is dynamically defined. More... | |
class | SurgSim::Math::Operation< DerivedSub, SparseType, Eigen::ColMajor > |
Specialization for column major storage. More... | |
class | SurgSim::Math::Operation< DerivedSub, SparseType, Eigen::RowMajor > |
Specialization for row major storage. More... | |
Namespaces | |
SurgSim | |
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions. | |
Typedefs | |
typedef Eigen::SparseMatrix< double > | SurgSim::Math::SparseMatrix |
A sparse matrix. | |
Functions | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::blockWithSearch (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index rowStart, Eigen::Index columnStart, Eigen::Index n, Eigen::Index m, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix, void(Operation< Matrix, Eigen::SparseMatrix< double, Opt, StorageIndex >>::*op)(double *, StorageIndex, Eigen::Index, Eigen::Index, const Eigen::Ref< const Matrix > &, Eigen::Index)) |
Runs a given operation on a SparseMatrix block(i, j, n, m) from a (n x m) 'subMatrix' with searching for the block 1st element. More... | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::blockOperation (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index rowStart, Eigen::Index columnStart, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix, void(Operation< Matrix, Eigen::SparseMatrix< double, Opt, StorageIndex >>::*op)(double *, const double &)) |
Runs a given operation on a SparseMatrix block(i, j, n, m) from a (n x m) 'subMatrix' with searching for the block 1st element. More... | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::addSubMatrix (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index blockIdRow, Eigen::Index blockIdCol, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix) |
Add a dense sub-matrix into a matrix that may need the memory locations to be initialized. More... | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::addSubMatrixNoInitialize (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index blockIdRow, Eigen::Index blockIdCol, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix) |
Add a dense sub-matrix into a sparse matrix that does not need the memory locations to be initialized. More... | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::assignSubMatrix (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index blockIdRow, Eigen::Index blockIdCol, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix) |
Assign a dense sub-matrix into a matrix that may need the memory locations to be initialized. More... | |
template<int Opt, typename StorageIndex > | |
void | SurgSim::Math::assignSubMatrixNoInitialize (const Eigen::Ref< const Matrix > &subMatrix, Eigen::Index blockIdRow, Eigen::Index blockIdCol, Eigen::SparseMatrix< double, Opt, StorageIndex > *matrix) |
Assign a dense sub-matrix into a sparse matrix that does not need the memory locations to be initialized. More... | |
template<typename T , int Opt, typename StorageIndex > | |
void | SurgSim::Math::zeroRow (Eigen::Index row, Eigen::SparseMatrix< T, Opt, StorageIndex > *matrix) |
Helper method to zero a row of a matrix specialized for Sparse Matrices. More... | |
template<typename T , int Opt, typename StorageIndex > | |
void | SurgSim::Math::zeroColumn (Eigen::Index column, Eigen::SparseMatrix< T, Opt, StorageIndex > *matrix) |
Helper method to zero a column of a matrix specialized for Sparse Matrices. More... | |
template<typename T , int Opt, typename StorageIndex > | |
void | SurgSim::Math::clearMatrix (Eigen::SparseMatrix< T, Opt, StorageIndex > *matrix) |
Helper method to zero all entries of a matrix specialized for Sparse Matrices. More... | |
Definitions of useful sparse matrix functions.
void SurgSim::Math::addSubMatrix | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | blockIdRow, | ||
Eigen::Index | blockIdCol, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix | ||
) |
Add a dense sub-matrix into a matrix that may need the memory locations to be initialized.
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, StorageIndex> |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices in matrix | |
[in,out] | matrix | The matrix to add the sub-matrix into |
void SurgSim::Math::addSubMatrixNoInitialize | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | blockIdRow, | ||
Eigen::Index | blockIdCol, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix | ||
) |
Add a dense sub-matrix into a sparse matrix that does not need the memory locations to be initialized.
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, StorageIndex> |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices in matrix | |
[in,out] | matrix | The matrix to add the sub-matrix into |
void SurgSim::Math::assignSubMatrix | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | blockIdRow, | ||
Eigen::Index | blockIdCol, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix | ||
) |
Assign a dense sub-matrix into a matrix that may need the memory locations to be initialized.
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, Index> |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices in matrix | |
[in,out] | matrix | The matrix to assign the sub-matrix into |
void SurgSim::Math::assignSubMatrixNoInitialize | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | blockIdRow, | ||
Eigen::Index | blockIdCol, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix | ||
) |
Assign a dense sub-matrix into a sparse matrix that does not need the memory locations to be initialized.
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, Index> |
subMatrix | The sub-matrix | |
blockIdRow,blockIdCol | The block indices in matrix | |
[in,out] | matrix | The matrix to assign the sub-matrix into |
void SurgSim::Math::blockOperation | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | rowStart, | ||
Eigen::Index | columnStart, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix, | ||
void(Operation< Matrix, Eigen::SparseMatrix< double, Opt, StorageIndex >>::*)(double *, const double &) | op | ||
) |
Runs a given operation on a SparseMatrix block(i, j, n, m) from a (n x m) 'subMatrix' with searching for the block 1st element.
It supposes:
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, StorageIndex> |
subMatrix | The sub matrix that will be copied into the SparseMatrix block | |
rowStart,columnStart | The row and column indices to indicate where the block in the SparseMatrix starts | |
[in,out] | matrix | The sparse matrix in which the block needs to be set by 'subMatrix' |
op | The operation to run on the block |
SurgSim::Framework::AssertionFailure | If one of the following conditions is met: |
void SurgSim::Math::blockWithSearch | ( | const Eigen::Ref< const Matrix > & | subMatrix, |
Eigen::Index | rowStart, | ||
Eigen::Index | columnStart, | ||
Eigen::Index | n, | ||
Eigen::Index | m, | ||
Eigen::SparseMatrix< double, Opt, StorageIndex > * | matrix, | ||
void(Operation< Matrix, Eigen::SparseMatrix< double, Opt, StorageIndex >>::*)(double *, StorageIndex, Eigen::Index, Eigen::Index, const Eigen::Ref< const Matrix > &, Eigen::Index) | op | ||
) |
Runs a given operation on a SparseMatrix block(i, j, n, m) from a (n x m) 'subMatrix' with searching for the block 1st element.
It supposes:
Opt,StorageIndex | Type parameters defining the output matrix type SparseMatrix<double, Opt, StorageIndex> |
subMatrix | The sub matrix that will be copied into the SparseMatrix block | |
rowStart,columnStart | The row and column indices to indicate where the block in the SparseMatrix starts | |
n,m | The block size (Derived may be bigger but cannot be smaller in both dimension) | |
[in,out] | matrix | The sparse matrix in which the block needs to be set by 'subMatrix' |
op | The operation to run on the block |
SurgSim::Framework::AssertionFailure | If one of the following conditions is met: |
|
inline |
Helper method to zero all entries of a matrix specialized for Sparse Matrices.
This allows the preservation of the the matrix form while still allowing the reset of the matrix entries to zero.
[in,out] | matrix | The matrix to set to zero |
|
inline |
Helper method to zero a column of a matrix specialized for Sparse Matrices.
column | The column to set to zero | |
[in,out] | matrix | The matrix to set the zero column on. |
void SurgSim::Math::zeroRow | ( | Eigen::Index | row, |
Eigen::SparseMatrix< T, Opt, StorageIndex > * | matrix | ||
) |
Helper method to zero a row of a matrix specialized for Sparse Matrices.
row | The row to set to zero | |
[in,out] | matrix | The matrix to set the zero row on. |