class
#include <private/InverseKinematicsNLP.h>
SparsityHelper Helper class to manage sparsity.
Public static functions
- static auto NullIndicesVector() -> const std::vector<size_t>&
- The invalid null indices vector.
Constructors, destructors, conversion operators
- SparsityHelper()
- Default constructor.
- SparsityHelper(const SparsityHelper&) deleted
- SparsityHelper(SparsityHelper&&) defaulted
Public functions
- auto operator=(const SparsityHelper&) -> SparsityHelper& deleted
- auto operator=(SparsityHelper&&) -> SparsityHelper& defaulted
- void clear()
- Remove all constraint sparsity patterns.
-
auto addConstraintSparsityPattern(const iDynTree::
MatrixDynSize& newConstraint) -> bool - Adds a constraint sparsity pattern from the specified matrix.
-
template<unsigned int nRows, unsigned int nCols>auto addConstraintSparsityPattern(const iDynTree::
MatrixFixSize<nRows, nCols>& newConstraint) -> bool - Adds a constraint sparsity pattern from the specified matrix.
-
auto addConstraintSparsityPattern(const iDynTree::
MatrixDynSize& newConstraint, const iDynTree:: IndexRange& constraintRange) -> bool - Adds a constraint sparsity pattern from the specified matrix and constraint range.
-
template<unsigned int nRows, unsigned int nCols>auto addConstraintSparsityPattern(const iDynTree::
MatrixFixSize<nRows, nCols>& newConstraint, const iDynTree:: IndexRange& constraintRange) -> bool - Adds a constraint sparsity pattern from the specified matrix and constraint range.
- auto numberOfNonZerosForRow(size_t rowIndex) const -> size_t
- Returns the number of nonzeros in the specified row.
- auto numberOfNonZeros() const -> size_t
- Returns the total number of nonzeros in the sparsity pattern.
- auto totalNumberOfNonZerosBeforeRow(size_t rowIndex) const -> size_t
- Returns the cumulative number of nonzeros in all the rows before the specified one.
- auto nonZeroIndicesForRow(size_t rowIndex) const -> const std::vector<size_t>&
- Returns a vector with the indices of the non zero columns for the specified contraint (row)
-
void assignActualMatrixValues(const iDynTree::
IndexRange& constraintRange, const iDynTree:: MatrixDynSize& fullMatrix, size_t fullMatrixStartingRowIndex, Ipopt::Number* outputBuffer) - Helper function to assign values to a contiguous buffer given the current sparsity pattern.
- auto toString() const -> std::string
- Returns a textual description of the sparsity pattern.
Function documentation
static const std::vector<size_t>& internal:: kinematics:: SparsityHelper:: NullIndicesVector()
The invalid null indices vector.
Returns | The invalid null indices vector |
---|
bool internal:: kinematics:: SparsityHelper:: addConstraintSparsityPattern(const iDynTree:: MatrixDynSize& newConstraint)
Adds a constraint sparsity pattern from the specified matrix.
Parameters | |
---|---|
newConstraint | the matrix containing the pattern (1 for nonzero, 0 otherwise) |
Returns | true on success. False otherwise |
template<unsigned int nRows, unsigned int nCols>
bool internal:: kinematics:: SparsityHelper:: addConstraintSparsityPattern(const iDynTree:: MatrixFixSize<nRows, nCols>& newConstraint)
Adds a constraint sparsity pattern from the specified matrix.
Parameters | |
---|---|
newConstraint | the matrix containing the pattern (1 for nonzero, 0 otherwise) |
Returns | true on success. False otherwise |
bool internal:: kinematics:: SparsityHelper:: addConstraintSparsityPattern(const iDynTree:: MatrixDynSize& newConstraint,
const iDynTree:: IndexRange& constraintRange)
Adds a constraint sparsity pattern from the specified matrix and constraint range.
Parameters | |
---|---|
newConstraint | the matrix containing the pattern (1 for nonzero, 0 otherwise) |
constraintRange | contiguous subset of the newConstraint matrix to be considered |
Returns | true on success. False otherwise |
template<unsigned int nRows, unsigned int nCols>
bool internal:: kinematics:: SparsityHelper:: addConstraintSparsityPattern(const iDynTree:: MatrixFixSize<nRows, nCols>& newConstraint,
const iDynTree:: IndexRange& constraintRange)
Adds a constraint sparsity pattern from the specified matrix and constraint range.
Parameters | |
---|---|
newConstraint | the matrix containing the pattern (1 for nonzero, 0 otherwise) |
constraintRange | contiguous subset of the newConstraint matrix to be considered |
Returns | true on success. False otherwise |
size_t internal:: kinematics:: SparsityHelper:: numberOfNonZerosForRow(size_t rowIndex) const
Returns the number of nonzeros in the specified row.
Parameters | |
---|---|
rowIndex | index of the row |
Returns | number of nonzeros |
size_t internal:: kinematics:: SparsityHelper:: numberOfNonZeros() const
Returns the total number of nonzeros in the sparsity pattern.
Returns | the total number of nonzeros in the sparsity pattern |
---|
size_t internal:: kinematics:: SparsityHelper:: totalNumberOfNonZerosBeforeRow(size_t rowIndex) const
Returns the cumulative number of nonzeros in all the rows before the specified one.
Parameters | |
---|---|
rowIndex | the row (excluded) to compute the cumulative number of nonzeros |
Returns | the cumulative number of nonzeros in all the rows before the specified one |
const std::vector<size_t>& internal:: kinematics:: SparsityHelper:: nonZeroIndicesForRow(size_t rowIndex) const
Returns a vector with the indices of the non zero columns for the specified contraint (row)
Parameters | |
---|---|
rowIndex | the specified constraint |
Returns | a vector with the indices of the non zero columns |
void internal:: kinematics:: SparsityHelper:: assignActualMatrixValues(const iDynTree:: IndexRange& constraintRange,
const iDynTree:: MatrixDynSize& fullMatrix,
size_t fullMatrixStartingRowIndex,
Ipopt::Number* outputBuffer)
Helper function to assign values to a contiguous buffer given the current sparsity pattern.
Parameters | |
---|---|
constraintRange | range of the constraint that should be sparsified |
fullMatrix | matrix specifying the non sparse constraint |
fullMatrixStartingRowIndex | starting row index of the non sparse matrix to be considered. The size is automatically inferred by the constraint size |
outputBuffer | the buffer on which the sparsified values should be written |
std::string internal:: kinematics:: SparsityHelper:: toString() const
Returns a textual description of the sparsity pattern.
Returns | a textual description of the sparsity pattern |
---|
Useful for debug