22 #include <gtsam/nonlinear/internal/JacobianMap.h> 23 #include <gtsam/inference/Symbol.h> 25 #include <gtsam/base/VectorSpace.h> 27 #include <boost/bind.hpp> 28 #include <boost/make_shared.hpp> 32 class ExpressionFactorShallowTest;
59 boost::shared_ptr<internal::ExpressionNode<T> > root_;
72 typedef boost::function<
76 template<
class A1,
class A2>
78 typedef boost::function<
83 template<
class A1,
class A2,
class A3>
85 typedef boost::function<
86 T(
const A1&,
const A2&,
const A3&,
106 Expression(
typename UnaryFunction<A>::type
function,
110 template<
typename A1,
typename A2>
111 Expression(
typename BinaryFunction<A1, A2>::type
function,
115 template<
typename A1,
typename A2,
typename A3>
116 Expression(
typename TernaryFunction<A1, A2, A3>::type
function,
126 template<
typename A1,
typename A2>
133 template<
typename A1,
typename A2,
typename A3>
135 T (A1::*method)(
const A2&,
const A3&,
146 std::set<Key> keys()
const;
149 void dims(std::map<Key, int>& map)
const;
152 void print(
const std::string& s)
const;
159 T value(
const Values& values, boost::optional<std::vector<Matrix>&> H =
167 virtual boost::shared_ptr<Expression>
clone()
const {
168 return boost::make_shared<Expression>(*this);
172 const boost::shared_ptr<internal::ExpressionNode<T> >& root()
const;
175 size_t traceSize()
const;
187 KeysAndDims keysAndDims()
const;
195 void* traceStorage)
const;
198 T valueAndJacobianMap(
const Values& values,
199 internal::JacobianMap& jacobians)
const;
206 friend class ::ExpressionFactorShallowTest;
213 template <
typename T>
226 template <
typename T>
241 template <
typename T,
typename A>
243 const boost::function<T(A)>& f,
const Expression<A>& expression,
261 template <
typename T>
272 template <
typename T>
278 template <
typename T>
281 return e1 + (-1.0) * e2;
298 std::vector<Expression<T> >
createUnknowns(
size_t n,
char c,
size_t start = 0);
Expression class that supports automatic differentiation.
Definition: Expression.h:49
Definition: Expression.h:41
Expression< T > type
Define type so we can apply it as a meta-function.
Definition: Expression.h:54
Internals for Expression.h, not for general consumption.
Character and index key used in VectorValues, GaussianFactorGraph, GaussianFactor, etc.
Definition: Symbol.h:34
std::pair< KeyVector, FastVector< int > > KeysAndDims
Keys and dimensions in same order.
Definition: Expression.h:186
std::vector< Expression< T > > createUnknowns(size_t n, char c, size_t start)
Construct an array of leaves.
Definition: Expression-inl.h:254
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:140
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
Expression(const boost::shared_ptr< internal::ExpressionNode< T > > &root)
Construct with a custom root.
Definition: Expression.h:62
BinarySumExpression< T > operator-(const Expression< T > &e1, const Expression< T > &e2)
Construct an expression that subtracts one expression from another.
Definition: Expression.h:279
A non-templated config holding any types of Manifold-group elements.
Definition: Values.h:70
virtual boost::shared_ptr< Expression > clone() const
Definition: Expression.h:167
BinarySumExpression< T > operator+(const Expression< T > &e1, const Expression< T > &e2)
Construct an expression that sums two input expressions of the same type T The type T must be a vecto...
Definition: Expression.h:273
virtual ~Expression()
Destructor.
Definition: Expression.h:142
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Factor that supports arbitrary expressions via AD.
Definition: Expression.h:38
Expression< T > linearExpression(const boost::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:242
Definition: Expression.h:71
Vector Space concept.
Definition: VectorSpace.h:470
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:170
Definition: Expression.h:84
A BinarySumExpression is a specialization of Expression that adds two expressions together It optimiz...
Definition: Expression.h:227
Definition: Expression.h:77
A ScalarMultiplyExpression is a specialization of Expression that multiplies with a scalar It optimiz...
Definition: Expression.h:214
Special class for optional Jacobian arguments.
Definition: Expression.h:42
Key symbol(unsigned char c, std::uint64_t j)
Create a symbol key from a character and index, i.e.
Definition: Symbol.h:128
Expression()
Default constructor, for serialization.
Definition: Expression.h:183
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Global functions in a separate testing namespace.
Definition: chartTesting.h:28