22 template <
typename Scalar, 
class Derived>
    26     Derived& 
mbDerived() { 
return static_cast<Derived&
>(*this); }
    29         return static_cast<const Derived&
>(*this);
    37         for (
typename Derived::Index r = 0; r < 
mbDerived().rows(); r++)
    38             for (
typename Derived::Index c = 0; c < 
mbDerived().cols(); c++)
    53         const std::size_t N = diags.size();
    55         for (std::size_t i = 0; i < N; i++) 
mbDerived()(i, i) = diags[i];
    67             Derived::RowsAtCompileTime > 0 && Derived::ColsAtCompileTime > 0,
    68             "Identity() without arguments can be used only for fixed-size "    91         internalAssertEigenDefined<Derived>();
    94     auto col(
int colIdx)
 const    96         internalAssertEigenDefined<Derived>();
   102         internalAssertEigenDefined<Derived>();
   103         return mbDerived().asEigen().row(rowIdx);
   105     auto row(
int rowIdx)
 const   107         internalAssertEigenDefined<Derived>();
   108         return mbDerived().asEigen().row(rowIdx);
   111     template <
typename VECTOR_LIKE>
   116         for (
typename Derived::Index i = 0; i < 
mbDerived().cols(); i++)
   119     template <
typename VECTOR_LIKE>
   127     template <
typename VECTOR_LIKE>
   132         for (
typename Derived::Index i = 0; i < 
mbDerived().rows(); i++)
   135     template <
typename VECTOR_LIKE>
   164     bool chol(Derived& U) 
const;
   178         Derived& eVecs, std::vector<Scalar>& eVals, 
bool sorted = 
true) 
const;
   183         Derived& eVecs, std::vector<Scalar>& eVals, 
bool sorted = 
true) 
const;
   198     void removeColumns(
const std::vector<std::size_t>& idxsToRemove);
   205     void removeRows(
const std::vector<std::size_t>& idxsToRemove);
   209     template <
typename OTHERMATVEC>
   211         const int row_start, 
const int col_start, 
const OTHERMATVEC& submat)
   215         for (
int r = 0; r < submat.rows(); r++)
   216             for (
int c = 0; c < submat.cols(); c++)
   217                 mbDerived()(r + row_start, c + col_start) = submat(r, c);
   220     template <
typename OTHERMATVEC>
   222         const int row_start, 
const int col_start, 
const OTHERMATVEC& submat)
   226         for (
int r = 0; r < submat.cols(); r++)
   227             for (
int c = 0; c < submat.rows(); c++)
   228                 mbDerived()(r + row_start, c + col_start) = submat(c, r);
   232     template <
int BLOCK_ROWS, 
int BLOCK_COLS>
   234         int start_row = 0, 
int start_col = 0)
 const   236         return extractMatrix<BLOCK_ROWS, BLOCK_COLS>(start_row, start_col);
   241         int start_row, 
int start_col, 
int BLOCK_ROWS, 
int BLOCK_COLS)
 const   243         return extractMatrix(start_row, start_col, BLOCK_ROWS, BLOCK_COLS);
   246     template <
int BLOCK_ROWS, 
int BLOCK_COLS>
   248         const int start_row = 0, 
const int start_col = 0)
 const   254         for (
int r = 0; r < BLOCK_ROWS; r++)
   255             for (
int c = 0; c < BLOCK_COLS; c++)
   256                 ret(r, c) = 
mbDerived()(r + start_row, c + start_col);
   261         const int BLOCK_ROWS, 
const int BLOCK_COLS, 
const int start_row,
   262         const int start_col)
 const   268         for (
int r = 0; r < BLOCK_ROWS; r++)
   269             for (
int c = 0; c < BLOCK_COLS; c++)
   270                 ret(r, c) = 
mbDerived()(r + start_row, c + start_col);
   275     template <
typename MAT_A>
   278         using Index = 
typename Derived::Index;
   279         const auto N = 
A.rows(), Ninner = 
A.cols();
   281         for (Index r = 0; r < N; r++)
   284             for (Index c = r; c < N; c++)
   287                 for (Index i = 0; i < Ninner; i++) s += 
A(r, i) * 
A(c, i);
   294     template <
typename MAT_A>
   297         using Index = 
typename Derived::Index;
   298         const auto N = 
A.cols(), Ninner = 
A.rows();
   300         for (Index r = 0; r < N; r++)
   303             for (Index c = r; c < N; c++)
   306                 for (Index i = 0; i < Ninner; i++) s += 
A(i, r) * 
A(i, c);
 void matProductOf_AtA(const MAT_A &A)
this = AT * A 
 
bool eig(Derived &eVecs, std::vector< Scalar > &eVals, bool sorted=true) const
Computes the eigenvectors and eigenvalues for a square, general matrix. 
 
CMatrixFixed< Scalar, BLOCK_ROWS, BLOCK_COLS > blockCopy(int start_row=0, int start_col=0) const
const blockCopy(): Returns a copy of the given block 
 
A compile-time fixed-size numeric matrix container. 
 
static Derived Identity()
 
auto col(int colIdx) const
 
void unsafeRemoveColumns(const std::vector< std::size_t > &idxs)
Removes columns of the matrix. 
 
#define ASSERT_BELOW_(__A, __B)
 
bool chol(Derived &U) const
Cholesky M=UT * U decomposition for symmetric matrix (upper-half of the matrix is actually ignored...
 
void insertMatrix(const int row_start, const int col_start, const OTHERMATVEC &submat)
Copies the given input submatrix/vector into this matrix/vector, starting at the given top-left coord...
 
auto row(int rowIdx) const
 
int rank(Scalar threshold=0) const
Finds the rank of the matrix via LU decomposition. 
 
bool eig_symmetric(Derived &eVecs, std::vector< Scalar > &eVals, bool sorted=true) const
Read: eig() 
 
void matProductOf_AAt(const MAT_A &A)
this = A * AT 
 
CMatrixFixed< Scalar, BLOCK_ROWS, BLOCK_COLS > extractMatrix(const int start_row=0, const int start_col=0) const
 
This base provides a set of functions for maths stuff. 
 
Derived inverse() const
Returns the inverse of a general matrix using LU. 
 
Scalar minimumDiagonal() const
Returns the minimum value in the diagonal. 
 
CMatrixDynamic< Scalar > extractMatrix(const int BLOCK_ROWS, const int BLOCK_COLS, const int start_row, const int start_col) const
 
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure. 
 
VECTOR_LIKE extractRow(int rowIdx) const
 
Scalar det() const
Determinant of matrix. 
 
Scalar maximumDiagonal() const
Returns the maximum value in the diagonal. 
 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
 
void extractColumn(int colIdx, VECTOR_LIKE &v) const
 
void matProductOf_AB(const Derived &A, const Derived &B)
this = A*B, with A & B of the same type of this. 
 
Derived inverse_LLt() const
Returns the inverse of a symmetric matrix using LLt. 
 
CMatrixDynamic< Scalar > blockCopy(int start_row, int start_col, int BLOCK_ROWS, int BLOCK_COLS) const
const blockCopy(): Returns a copy of the given block (non templated version, dynamic sizes) ...
 
void removeColumns(const std::vector< std::size_t > &idxsToRemove)
Removes columns of the matrix. 
 
Base CRTP class for all MRPT matrices. 
 
VECTOR_LIKE extractColumn(int colIdx) const
 
void setDiagonal(const std::vector< Scalar > &diags)
Resizes to NxN, with N the length of the input vector, set all entries to zero, except the main diago...
 
void setDiagonal(const Scalar value)
Set all entries to zero, except the main diagonal which is set to value 
 
void unsafeRemoveRows(const std::vector< std::size_t > &idxs)
Removes rows of the matrix. 
 
Scalar trace() const
Returns the trace of the matrix (not necessarily square). 
 
Base CRTP class for all MRPT vectors and matrices. 
 
#define ASSERT_BELOWEQ_(__A, __B)
 
void removeRows(const std::vector< std::size_t > &idxsToRemove)
Removes rows of the matrix. 
 
const Derived & mbDerived() const
 
This template class provides the basic functionality for a general 2D any-size, resizable container o...
 
static Derived Identity(const std::size_t N)
 
void extractRow(int rowIdx, VECTOR_LIKE &v) const
 
void insertMatrixTransposed(const int row_start, const int col_start, const OTHERMATVEC &submat)
Like insertMatrix(), but inserts ‘submat’` (transposed) 
 
void setDiagonal(const std::size_t N, const Scalar value)
Resize to NxN, set all entries to zero, except the main diagonal which is set to value ...
 
void setIdentity(const std::size_t N)