23 #include <gtsam/config.h> 24 #include <Eigen/Dense> 37 template<
int Rows,
int Cols>
58 if (data)
usurp(data);
61 template<
int M,
int N>
94 dynamic.resize(Rows,
Cols);
95 usurp(dynamic.data());
102 dynamic->resize(Rows,
Cols);
103 usurp(dynamic->data());
111 template<
class MATRIX>
114 if (dynamic_ref.rows() == Rows && dynamic_ref.cols() ==
Cols && !dynamic_ref.IsRowMajor) {
115 usurp(dynamic_ref.data());
117 throw std::invalid_argument(
118 std::string(
"OptionalJacobian called with wrong dimensions or " 121 "(" + std::to_string(Rows) +
", " + std::to_string(
Cols) +
")");
134 optional->get().resize(Rows,
Cols);
135 usurp(optional->get().data());
144 operator bool()
const {
145 return map_.data() !=
nullptr;
221 if (optional) pointer_ = &((*optional).get());
225 operator bool()
const {
226 return pointer_!=
nullptr;
239 template <
typename T>
struct traits;
246 template <
class T,
class A>
257 template<
class T,
class A>
void usurp(double *data)
View on constructor argument, if given.
OptionalJacobian< traits< T >::dimension, traits< A >::dimension > type
OptionalJacobian(const std::optional< std::reference_wrapper< Eigen::MatrixXd >> optional)
Constructor compatible with old-style derivatives.
OptionalJacobian(double *data)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
A matrix or vector expression mapping an existing array of data.
: meta-function to generate Jacobian
Namespace containing all symbols from the Eigen library.
OptionalJacobian< Rows, N > cols(int startCol)
Eigen::Matrix< double, traits< T >::dimension, traits< A >::dimension > type
OptionalJacobian(std::nullptr_t)
Eigen::MatrixXd Jacobian
Jacobian size type.
OptionalJacobian()
Default constructor.
A matrix or vector expression mapping an existing expression.
OptionalJacobian(Eigen::MatrixXd *dynamic)
Constructor that will resize a dynamic matrix (unless already correct)
OptionalJacobian(std::nullopt_t)
Constructor with std::nullopt just makes empty.
OptionalJacobian(Jacobian &dynamic)
Construct from refrence to dynamic matrix.
OptionalJacobian(std::nullopt_t)
Constructor with std::nullopt just makes empty.
OptionalJacobian(Jacobian &fixed)
Constructor that will usurp data of a fixed-size matrix.
Jacobian * operator->()
TODO: operator->()
: meta-function to generate JacobianTA optional reference Used mainly by Expressions ...
OptionalJacobian(Jacobian *pointer)
Construct from pointer to dynamic matrix.
Eigen::Map< Jacobian > * operator->()
operator->()
OptionalJacobian()
View on constructor argument, if given.
The matrix class, also used for vectors and row-vectors.
OptionalJacobian(Eigen::MatrixXd &dynamic)
Constructor that will resize a dynamic matrix (unless already correct)
OptionalJacobian(Jacobian *fixedPtr)
Constructor that will usurp data of a fixed-size matrix, pointer version.
Eigen::Matrix< double, Rows, Cols > Jacobian
OptionalJacobian(const std::optional< std::reference_wrapper< Eigen::MatrixXd >> optional)
Constructor for optional matrix reference.
Jacobian & operator*()
De-reference, like boost optional.
Eigen::Map< Jacobian > & operator*()
De-reference, like boost optional.
OptionalJacobian(Eigen::Ref< MATRIX > dynamic_ref)
Constructor from an Eigen::Ref value. Will not usurp if dimension is wrong.
Eigen::Map< Jacobian > map_