22 #include <gtsam/base/DerivedValue.h>
25 #include <boost/serialization/nvp.hpp>
46 template<
int M,
int N>
47 LieMatrix(
const Eigen::Matrix<double, M, N>& v) : Matrix(v) {}
51 LieMatrix(
size_t m,
size_t n,
const double*
const data) :
52 Matrix(Eigen::Map<const Matrix>(data, m, n)) {}
59 GTSAM_EXPORT
void print(
const std::string& name=
"")
const;
72 return static_cast<Matrix
>(*this);
80 inline size_t dim()
const {
return this->size(); }
86 if(v.size() != this->size())
87 throw std::invalid_argument(
"LieMatrix::retract called with Vector of incorrect size");
90 Eigen::Map<
const Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor> >(
91 &v(0), this->rows(), this->cols()));
98 Vector result(this->size());
99 Eigen::Map<Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor> >(
100 &result(0), this->rows(), this->cols()) = t2 - *
this;
110 throw std::runtime_error(
"LieMatrix::identity(): Don't use this function");
120 boost::optional<gtsam::Matrix&> H1=boost::none,
121 boost::optional<gtsam::Matrix&> H2=boost::none)
const {
123 if(H2) *H2 =
eye(p.
dim());
130 boost::optional<gtsam::Matrix&> H1=boost::none,
131 boost::optional<gtsam::Matrix&> H2=boost::none)
const {
133 if(H2) *H2 =
eye(l2.
dim());
150 throw std::runtime_error(
"LieMatrix::Expmap(): Don't use this function");
155 Vector result(p.size());
156 Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >(
157 result.data(), p.rows(), p.cols()) = p;
166 friend class boost::serialization::access;
167 template<
class Archive>
168 void serialize(Archive & ar,
const unsigned int version) {
169 ar & boost::serialization::make_nvp(
"LieMatrix",
170 boost::serialization::base_object<Value>(*
this));
171 ar & boost::serialization::make_nvp(
"Matrix",
172 boost::serialization::base_object<Matrix>(*
this));
Matrix matrix() const
get the underlying vector
Definition: LieMatrix.h:71
Vector localCoordinates(const LieMatrix &t2) const
Definition: LieMatrix.h:97
static Vector Logmap(const LieMatrix &p)
Logmap around identity.
Definition: LieMatrix.h:154
Base class and basic functions for Lie types.
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
size_t dim() const
Returns dimensionality of the tangent space.
Definition: LieMatrix.h:80
bool equals(const LieMatrix &expected, double tol=1e-5) const
equality up to tolerance
Definition: LieMatrix.h:62
GTSAM_EXPORT void print(const std::string &name="") const
print
Definition: LieMatrix.cpp:23
static LieMatrix Expmap(const Vector &v)
Expmap around identity.
Definition: LieMatrix.h:149
LieMatrix inverse(boost::optional< gtsam::Matrix & > H=boost::none) const
invert the object and yield a new one
Definition: LieMatrix.h:138
LieMatrix(size_t m, size_t n, const double *const data)
constructor with size and initial data, row order !
Definition: LieMatrix.h:51
LieVector is a wrapper around vector to allow it to be a Lie type.
Definition: LieMatrix.h:32
LieMatrix between(const LieMatrix &l2, boost::optional< gtsam::Matrix & > H1=boost::none, boost::optional< gtsam::Matrix & > H2=boost::none) const
between operation
Definition: LieMatrix.h:129
static LieMatrix identity()
identity - NOTE: no known size at compile time - so zero length
Definition: LieMatrix.h:109
LieMatrix(const Eigen::Matrix< double, M, N > &v)
initialize from a fixed size normal vector
Definition: LieMatrix.h:47
typedef and functions to augment Eigen's MatrixXd
LieMatrix(const Matrix &v)
initialize from a normal matrix
Definition: LieMatrix.h:41
LieMatrix compose(const LieMatrix &p, boost::optional< gtsam::Matrix & > H1=boost::none, boost::optional< gtsam::Matrix & > H2=boost::none) const
compose with another object
Definition: LieMatrix.h:119
Definition: DerivedValue.h:44
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
equals with an tolerance
Definition: Matrix.h:84
LieMatrix retract(const Vector &v) const
Update the LieMatrix with a tangent space update.
Definition: LieMatrix.h:85
LieMatrix()
default constructor - should be unnecessary
Definition: LieMatrix.h:38