24#include <gtsam/base/VectorSpace.h>
39 using MatrixType = Eigen::Matrix<double, M, -1>;
45 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47 enum { dimension = Eigen::Dynamic };
62 size_t rows()
const {
return matrix_.rows(); }
65 size_t cols()
const {
return matrix_.cols(); }
68 MatrixType
matrix()
const {
return matrix_; }
71 Eigen::Matrix<double, -1, M>
transpose()
const {
return matrix_.transpose(); }
77 Eigen::Matrix<double, 1, -1>
row(
size_t index)
const {
78 return matrix_.row(index);
85 auto row(
size_t index) -> Eigen::Block<MatrixType, 1, -1,
false> {
86 return matrix_.row(index);
93 Eigen::Matrix<double, M, 1>
col(
size_t index)
const {
94 return matrix_.col(index);
101 auto col(
size_t index) -> Eigen::Block<MatrixType, M, 1, true> {
102 return matrix_.col(index);
123 const Eigen::Matrix<double, -1, 1>& other)
const {
125 Eigen::Map<const MatrixType> other_(other.data(), M,
cols());
142 const Eigen::Matrix<double, -1, 1>& other)
const {
143 Eigen::Map<const MatrixType> other_(other.data(), M,
cols());
152 MatrixType
operator*(
const Eigen::Matrix<double, -1, -1>& other)
const {
153 return matrix_ * other;
163 void print(
const std::string& s =
"")
const {
164 std::cout << (s ==
"" ? s : s +
" ") << matrix_ << std::endl;
177 inline size_t dim()
const {
return matrix_.size(); }
181 using RowMajor = Eigen::Matrix<double, -1, -1, Eigen::RowMajor>;
182 Vector result(matrix_.size());
183 Eigen::Map<RowMajor>(&result(0),
rows(),
cols()) = matrix_;
209inline std::ostream& operator<<(std::ostream& os,
211 os << parameterMatrix.
matrix();
typedef and functions to augment Eigen's MatrixXd
Concept check for values that can be used in unit tests.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
equals with a tolerance
Definition: Matrix.h:84
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
A matrix abstraction of MxN values at the Basis points.
Definition: ParameterMatrix.h:38
MatrixType operator*(const Eigen::Matrix< double, -1, -1 > &other) const
Multiply ParameterMatrix with an Eigen matrix.
Definition: ParameterMatrix.h:152
ParameterMatrix< M > operator-(const Eigen::Matrix< double, -1, 1 > &other) const
Subtract a MxN-sized vector from the ParameterMatrix.
Definition: ParameterMatrix.h:141
Eigen::Matrix< double, 1, -1 > row(size_t index) const
Get the matrix row specified by index.
Definition: ParameterMatrix.h:77
ParameterMatrix(const size_t N)
Create ParameterMatrix using the number of basis points.
Definition: ParameterMatrix.h:53
void setZero()
Set all matrix coefficients to zero.
Definition: ParameterMatrix.h:108
MatrixType matrix() const
Get the underlying matrix.
Definition: ParameterMatrix.h:68
ParameterMatrix(const MatrixType &matrix)
Create ParameterMatrix from an MxN Eigen Matrix.
Definition: ParameterMatrix.h:59
Eigen::Matrix< double, M, 1 > col(size_t index) const
Get the matrix column specified by index.
Definition: ParameterMatrix.h:93
Vector vector() const
Convert to vector form, is done row-wise.
Definition: ParameterMatrix.h:180
bool equals(const ParameterMatrix< M > &other, double tol=1e-8) const
Check for equality up to absolute tolerance.
Definition: ParameterMatrix.h:172
ParameterMatrix< M > operator+(const ParameterMatrix< M > &other) const
Add a ParameterMatrix to another.
Definition: ParameterMatrix.h:114
static ParameterMatrix identity()
Identity function to satisfy VectorSpace traits.
Definition: ParameterMatrix.h:192
size_t rows() const
Get the number of rows.
Definition: ParameterMatrix.h:62
auto row(size_t index) -> Eigen::Block< MatrixType, 1, -1, false >
Set the matrix row specified by index.
Definition: ParameterMatrix.h:85
void print(const std::string &s="") const
Print the ParameterMatrix.
Definition: ParameterMatrix.h:163
auto col(size_t index) -> Eigen::Block< MatrixType, M, 1, true >
Set the matrix column specified by index.
Definition: ParameterMatrix.h:101
ParameterMatrix< M > operator+(const Eigen::Matrix< double, -1, 1 > &other) const
Add a MxN-sized vector to the ParameterMatrix.
Definition: ParameterMatrix.h:122
ParameterMatrix< M > operator-(const ParameterMatrix< M > &other) const
Subtract a ParameterMatrix from another.
Definition: ParameterMatrix.h:133
size_t dim() const
Returns dimensionality of the tangent space.
Definition: ParameterMatrix.h:177
size_t cols() const
Get the number of columns.
Definition: ParameterMatrix.h:65
Eigen::Matrix< double, -1, M > transpose() const
Return the tranpose of the underlying matrix.
Definition: ParameterMatrix.h:71