MRPT  2.0.4
Vectors, matrices, linear Algebra

Dynamic and fixed-size vectors and matrices, basic linear Algebra

Design rationale

Unlike in older MRPT 1.x versions, matrices and vectors since MRPT v2.0.0 do no longer inherit from Eigen classes. Instead, they are now thin wrappers around static/dynamic memory containers, which can be casted to Eigen-compatible classes, but which allow most common operations to be done without Eigen.

The reason for this scheme is two-fold:

Important facts

Example: matrix sum (MRPT methods, no explicit call to Eigen)

#include <iostream>
// ...
M1.setDiagonal(4,0.1);
//M1.loadFromTextFile("M1.txt");
// Sum:
std::cout << "R:\n" << R << "\n";
R.saveToTextFile("R.txt");

Example: QR-based linear system solving (With explicit call to Eigen)

#include <Eigen/Dense> // Must add this one to use .asEigen()
#include <iostream>
// ...
A.setDiagonal(3,0.2);
b.fill(0.1);;
// Solve Ax=b
x.asEigen() = A.asEigen().fullPivHouseholderQr().solve(x);
std::cout << "x:\n" << x.asString() << "\n";

See list of classes below.

Collaboration diagram for Vectors, matrices, linear Algebra:
mrpt::math::MatrixVectorBase::fill
void fill(const Scalar &val)
Definition: MatrixVectorBase.h:70
R
const float R
Definition: CKinematicChain.cpp:137
mrpt::math::MatrixBase< double, CMatrixDynamic< double > >::Identity
static CMatrixDynamic< double > Identity()
Definition: MatrixBase.h:64
mrpt::math::CMatrixFixed< double, 3, 3 >
mrpt::math::MatrixBase::setDiagonal
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
Definition: MatrixBase.h:34
A
Definition: is_defined_unittest.cpp:13
CMatrixDynamic.h
mrpt::math::CVectorDynamic< double >
mrpt::math::CVectorDynamic::asEigen
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object
Definition: CVectorDynamic.h:284
mrpt::math::MatrixVectorBase::asString
std::string asString() const
Returns a string representation of the vector/matrix, using Eigen's default settings.
Definition: MatrixVectorBase_impl.h:337
mrpt::math::CMatrixDynamic< double >



Page generated by Doxygen 1.8.17 for MRPT 2.0.4 at Fri Jul 17 08:43:33 UTC 2020