22#include <gtsam/nonlinear/internal/JacobianMap.h>
25#include <gtsam/base/VectorSpace.h>
30class ExpressionFactorShallowTest;
38class ScalarExpressionInequalityConstraint;
59 std::shared_ptr<internal::ExpressionNode<T> > root_;
72 typedef std::function<
73 T(
const A1&,
typename MakeOptionalJacobian<T, A1>::type)> type;
76 template<
class A1,
class A2>
78 typedef std::function<
79 T(
const A1&,
const A2&,
typename MakeOptionalJacobian<T, A1>::type,
80 typename MakeOptionalJacobian<T, A2>::type)> type;
83 template<
class A1,
class A2,
class A3>
85 typedef std::function<
86 T(
const A1&,
const A2&,
const A3&,
87 typename MakeOptionalJacobian<T, A1>::type,
88 typename MakeOptionalJacobian<T, A2>::type,
89 typename MakeOptionalJacobian<T, A3>::type)> type;
110 template<
typename A1,
typename A2>
115 template<
typename A1,
typename A2,
typename A3>
116 Expression(
typename TernaryFunction<A1, A2, A3>::type function,
123 T (A::*method)(
typename MakeOptionalJacobian<T, A>::type)
const);
126 template<
typename A1,
typename A2>
128 T (A1::*method)(
const A2&,
typename MakeOptionalJacobian<T, A1>::type,
129 typename MakeOptionalJacobian<T, A2>::type)
const,
133 template<
typename A1,
typename A2,
typename A3>
135 T (A1::*method)(
const A2&,
const A3&,
136 typename MakeOptionalJacobian<T, A1>::type,
137 typename MakeOptionalJacobian<T, A2>::type,
138 typename MakeOptionalJacobian<T, A3>::type)
const,
149 void dims(std::map<Key, int>& map)
const;
152 void print(
const std::string& s)
const;
159 T
value(
const Values& values, std::vector<Matrix>* H =
nullptr)
const;
166 return value(values, &H);
174 virtual std::shared_ptr<Expression>
clone()
const {
175 return std::make_shared<Expression>(*
this);
179 const std::shared_ptr<internal::ExpressionNode<T> >&
root()
const;
202 char* traceStorage)
const;
206 internal::JacobianMap& jacobians)
const;
212 friend class ScalarExpressionInequalityConstraint;
215 friend class ::ExpressionFactorShallowTest;
228 explicit ScalarMultiplyExpression(
double s,
const Expression<T>& e);
250template <
typename T,
typename A>
252 const std::function<T(A)>& f,
const Expression<A>& expression,
256 [=](
const A& value,
typename MakeOptionalJacobian<T, A>::type H) {
290 return e1 + (-1.0) * e2;
299Expression<T>
operator*(
const Expression<T>& e1,
const Expression<T>& e2);
307std::vector<Expression<T> >
createUnknowns(
size_t n,
char c,
size_t start = 0);
Special class for optional Jacobian arguments.
Internals for Expression.h, not for general consumption.
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
FastVector is a type alias to a std::vector with a custom memory allocator.
Definition FastVector.h:33
Global functions in a separate testing namespace.
Definition chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition Key.h:91
Key symbol(unsigned char c, std::uint64_t j)
Create a symbol key from a character and index, i.e.
Definition Symbol.h:139
std::vector< Expression< T > > createUnknowns(size_t n, char c, size_t start)
Construct an array of leaves.
Definition Expression-inl.h:284
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition Point2.h:52
Expression< T > linearExpression(const std::function< T(A)> &f, const Expression< A > &expression, const Eigen::Matrix< double, traits< T >::dimension, traits< A >::dimension > &dTdA)
Create an expression out of a linear function f:T->A with (constant) Jacobian dTdA TODO(frank): creat...
Definition Expression.h:251
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
Errors operator-(const Errors &a, const Errors &b)
Subtraction.
Definition Errors.cpp:74
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Vector Space concept.
Definition VectorSpace.h:564
Character and index key used to refer to variables.
Definition Symbol.h:37
Factor that supports arbitrary expressions via AD.
Definition ExpressionFactor.h:46
Definition Expression.h:37
Definition Expression.h:41
Definition Expression.h:42
Expression class that supports automatic differentiation.
Definition Expression.h:49
Expression(const std::shared_ptr< internal::ExpressionNode< T > > &root)
Construct with a custom root.
Definition Expression.h:62
KeySet keys() const
Return keys that play in this expression.
Definition Expression-inl.h:128
Expression< TangentVector > type
Definition Expression.h:54
Expression()
Default constructor, for serialization.
Definition Expression.h:190
const std::shared_ptr< internal::ExpressionNode< TangentVector > > & root() const
T value(const Values &values, std::vector< Matrix > &H) const
An overload of the value function to accept reference to vector of matrices instead of a pointer to v...
Definition Expression.h:165
virtual ~Expression()
Destructor.
Definition Expression.h:142
Expression(const Expression< A > &expression, T(A::*method)(typename MakeOptionalJacobian< T, A >::type) const)
Construct a nullary method expression.
Definition Expression-inl.h:86
std::pair< KeyVector, FastVector< int > > KeysAndDims
Definition Expression.h:193
T traceExecution(const Values &values, internal::ExecutionTrace< T > &trace, char *traceStorage) const
trace execution, very unsafe
Definition Expression-inl.h:192
Expression(const Key &key)
Construct a leaf expression, with Key.
Definition Expression-inl.h:40
void dims(std::map< Key, int > &map) const
Return dimensions for each argument, as a map.
Definition Expression-inl.h:133
Expression(typename TernaryFunction< A1, A2, A3 >::type function, const Expression< A1 > &expression1, const Expression< A2 > &expression2, const Expression< A3 > &expression3)
Construct a ternary function expression.
Definition Expression-inl.h:75
Expression(unsigned char c, std::uint64_t j)
Construct a leaf expression, creating Symbol.
Definition Expression-inl.h:50
Expression(const Symbol &symbol)
Construct a leaf expression, with Symbol.
Definition Expression-inl.h:45
void print(const std::string &s) const
Print.
Definition Expression-inl.h:138
Expression(const Expression< A1 > &expression1, T(A1::*method)(const A2 &, typename MakeOptionalJacobian< T, A1 >::type, typename MakeOptionalJacobian< T, A2 >::type) const, const Expression< A2 > &expression2)
Construct a unary method expression.
Definition Expression-inl.h:97
T valueAndJacobianMap(const Values &values, internal::JacobianMap &jacobians) const
brief Return value and derivatives, reverse AD version
Definition Expression-inl.h:205
Expression(const Expression< A1 > &expression1, T(A1::*method)(const A2 &, const A3 &, typename MakeOptionalJacobian< T, A1 >::type, typename MakeOptionalJacobian< T, A2 >::type, typename MakeOptionalJacobian< T, A3 >::type) const, const Expression< A2 > &expression2, const Expression< A3 > &expression3)
Construct a binary method expression.
Definition Expression-inl.h:112
Expression(typename UnaryFunction< A >::type function, const Expression< A > &expression)
Construct a unary function expression.
Definition Expression-inl.h:57
TangentVector value(const Values &values, std::vector< Matrix > *H=nullptr) const
T valueAndDerivatives(const Values &values, const KeyVector &keys, const FastVector< int > &dims, std::vector< Matrix > &H) const
private version that takes keys and dimensions, returns derivatives
Definition Expression-inl.h:168
virtual std::shared_ptr< Expression > clone() const
Definition Expression.h:174
Expression(const T &value)
Construct a constant expression.
Definition Expression-inl.h:35
Expression< T > & operator+=(const Expression< T > &e)
Add another expression to this expression.
Definition Expression-inl.h:302
Expression(typename BinaryFunction< A1, A2 >::type function, const Expression< A1 > &expression1, const Expression< A2 > &expression2)
Construct a binary function expression.
Definition Expression-inl.h:65
size_t traceSize() const
Return size needed for memory buffer in traceExecution.
Definition Expression-inl.h:161
Definition Expression.h:71
Definition Expression.h:77
Definition Expression.h:84
A ScalarMultiplyExpression is a specialization of Expression that multiplies with a scalar It optimiz...
Definition Expression.h:223
A BinarySumExpression is a specialization of Expression that adds two expressions together It optimiz...
Definition Expression.h:236
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65