Caribou
|
This class can be use to represent any Eigen matrix within SOFA.
It implements (and overloads) the BaseMatrix class of Sofa. This class hence allows to either to create a new Eigen matrix or copy/map an existing one and use it in Sofa's components or visitors.
Example:
Example:
#include <EigenMatrix.h>
Public Types | |
using | EigenType = std::remove_cv_t< std::remove_reference_t< Derived > > |
using | Base = sofa::defaulttype::BaseMatrix |
using | Index = Base::Index |
using | Real = SReal |
Public Member Functions | |
EigenMatrix (std::remove_reference_t< Derived > &eigen_matrix) | |
Construct the class using another Eigen matrix. More... | |
EigenMatrix (Eigen::Index rows, Eigen::Index cols) | |
Construct a new rows x cols Eigen matrix of type Derived. More... | |
Index | rowSize () const final |
Index | colSize () const final |
Real | element (Index i, Index j) const final |
void | resize (Index nbRow, Index nbCol) final |
Resize the matrix to nbRow x nbCol dimensions. More... | |
void | clear () override |
Set all entries to zero. More... | |
void | set (Index i, Index j, double v) final |
Set this value of the matrix entry (i, j) to the value of v. | |
void | add (Index i, Index j, double v) final |
Adds v to the value of the matrix entry (i, j). | |
void | add (Index i, Index j, const sofa::defaulttype::Mat3x3d &m) override |
void | add (Index i, Index j, const sofa::defaulttype::Mat3x3f &m) override |
void | add (Index i, Index j, const sofa::defaulttype::Mat2x2d &m) override |
void | add (Index i, Index j, const sofa::defaulttype::Mat2x2f &m) override |
void | clearRow (Index i) final |
Sets the entire row i to zero. | |
void | clearRows (Index imin, Index imax) final |
Sets the rows from index imin to index imax (inclusively) to zero. | |
void | clearCol (Index i) final |
Sets the entire columns i to zero. | |
void | clearCols (Index imin, Index imax) final |
Sets the columns from index imin to index imax (inclusively) to zero. | |
const EigenType & | matrix () const |
Get a const reference to the underlying Eigen matrix | |
|
inlineexplicit |
Construct the class using another Eigen matrix.
Depending on the template parameter used for the class, this constructor will either create a new Eigen matrix and copy its content from the parameter eigen_matrix, or it will simply store a reference to this external matrix.
eigen_matrix | The external matrix |
|
inline |
Construct a new rows x cols Eigen matrix of type Derived.
rows | Number of rows. |
cols | Number of columns. |
|
inlineoverride |
Set all entries to zero.
Keeps the current matrix dimensions.
|
inlinefinal |
Resize the matrix to nbRow x nbCol dimensions.
This method resets to zero all entries.