21#include <gtsam/config.h>
24#ifndef OPTIONALJACOBIAN_NOBOOST
25#include <boost/optional.hpp>
38template<
int Rows,
int Cols>
45 typedef Eigen::Matrix<double, Rows, Cols>
Jacobian;
49 Eigen::Map<Jacobian> map_;
53 void usurp(
double* data) {
54 new (&map_) Eigen::Map<Jacobian>(data);
59 if (data) usurp(data);
62 template<
int M,
int N>
63 friend class OptionalJacobian;
82 usurp(fixedPtr->data());
88 dynamic.resize(Rows, Cols);
89 usurp(dynamic.data());
95 dynamic->resize(Rows, Cols);
96 usurp(dynamic->data());
99#ifndef OPTIONALJACOBIAN_NOBOOST
110 optional->resize(Rows, Cols);
111 usurp(optional->data());
123 operator bool()
const {
124 return map_.data() !=
nullptr;
192#ifndef OPTIONALJACOBIAN_NOBOOST
202 if (optional) pointer_ = &(*optional);
208 operator bool()
const {
209 return pointer_!=
nullptr;
222template <
typename T>
struct traits;
229template <
class T,
class A>
240template<
class T,
class A>
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
OptionalJacobian(const boost::optional< Eigen::MatrixXd & > optional)
Constructor compatible with old-style derivatives.
Definition: OptionalJacobian.h:107
OptionalJacobian(boost::none_t)
Constructor with boost::none just makes empty.
Definition: OptionalJacobian.h:102
OptionalJacobian(Eigen::MatrixXd &dynamic)
Constructor that will resize a dynamic matrix (unless already correct)
Definition: OptionalJacobian.h:86
Eigen::Map< Jacobian > & operator*()
De-reference, like boost optional.
Definition: OptionalJacobian.h:128
OptionalJacobian()
Default constructor acts like boost::none.
Definition: OptionalJacobian.h:68
OptionalJacobian(Jacobian &fixed)
Constructor that will usurp data of a fixed-size matrix.
Definition: OptionalJacobian.h:73
OptionalJacobian(Eigen::MatrixXd *dynamic)
Constructor that will resize a dynamic matrix (unless already correct)
Definition: OptionalJacobian.h:93
Eigen::Map< Jacobian > * operator->()
operator->()
Definition: OptionalJacobian.h:133
Eigen::Matrix< double, Rows, Cols > Jacobian
Jacobian size type TODO(frank): how to enforce RowMajor? Or better, make it work with any storage ord...
Definition: OptionalJacobian.h:45
OptionalJacobian(Jacobian *fixedPtr)
Constructor that will usurp data of a fixed-size matrix, pointer version.
Definition: OptionalJacobian.h:79
OptionalJacobian< Rows, N > cols(int startCol)
Access M*N sub-block if we are allocated, otherwise none TODO(frank): this could work as is below if ...
Definition: OptionalJacobian.h:151
OptionalJacobian()
View on constructor argument, if given.
Definition: OptionalJacobian.h:182
OptionalJacobian(const boost::optional< Eigen::MatrixXd & > optional)
Constructor compatible with old-style derivatives.
Definition: OptionalJacobian.h:200
Eigen::MatrixXd Jacobian
Jacobian size type.
Definition: OptionalJacobian.h:173
Jacobian & operator*()
De-reference, like boost optional.
Definition: OptionalJacobian.h:213
OptionalJacobian(boost::none_t)
Constructor with boost::none just makes empty.
Definition: OptionalJacobian.h:195
OptionalJacobian(Jacobian *pointer)
Construct from pointer to dynamic matrix.
Definition: OptionalJacobian.h:187
OptionalJacobian(Jacobian &dynamic)
Construct from refrence to dynamic matrix.
Definition: OptionalJacobian.h:190
Jacobian * operator->()
TODO: operator->()
Definition: OptionalJacobian.h:218
: meta-function to generate Jacobian
Definition: OptionalJacobian.h:230
: meta-function to generate JacobianTA optional reference Used mainly by Expressions
Definition: OptionalJacobian.h:241