Made some more typedefs, added binary method
parent
d37216cde3
commit
88b4795b29
|
|
@ -562,8 +562,7 @@ struct GenerateFunctionalNode: Argument<T, A, Base::N + 1>, Base {
|
||||||
/// Given df/dT, multiply in dT/dA and continue reverse AD process
|
/// Given df/dT, multiply in dT/dA and continue reverse AD process
|
||||||
// Cols is always known at compile time
|
// Cols is always known at compile time
|
||||||
template<typename SomeMatrix>
|
template<typename SomeMatrix>
|
||||||
void reverseAD4(const SomeMatrix & dFdT,
|
void reverseAD4(const SomeMatrix & dFdT, JacobianMap& jacobians) const {
|
||||||
JacobianMap& jacobians) const {
|
|
||||||
Base::Record::reverseAD4(dFdT, jacobians);
|
Base::Record::reverseAD4(dFdT, jacobians);
|
||||||
This::trace.reverseAD1(dFdT * This::dTdA, jacobians);
|
This::trace.reverseAD1(dFdT * This::dTdA, jacobians);
|
||||||
}
|
}
|
||||||
|
|
@ -669,10 +668,12 @@ struct FunctionalNode {
|
||||||
template<class T, class A1>
|
template<class T, class A1>
|
||||||
class UnaryExpression: public FunctionalNode<T, boost::mpl::vector<A1> >::type {
|
class UnaryExpression: public FunctionalNode<T, boost::mpl::vector<A1> >::type {
|
||||||
|
|
||||||
|
typedef typename MakeOptionalJacobian<T, A1>::type OJ1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::function<
|
typedef T (A1::*Method)(OJ1) const;
|
||||||
T(const A1&, typename MakeOptionalJacobian<T, A1>::type)> Function;
|
typedef boost::function<T(const A1&, OJ1)> Function;
|
||||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1> >::type Base;
|
typedef typename FunctionalNode<T, boost::mpl::vector<A1> >::type Base;
|
||||||
typedef typename Base::Record Record;
|
typedef typename Base::Record Record;
|
||||||
|
|
||||||
|
|
@ -712,13 +713,16 @@ public:
|
||||||
/// Binary Expression
|
/// Binary Expression
|
||||||
|
|
||||||
template<class T, class A1, class A2>
|
template<class T, class A1, class A2>
|
||||||
class BinaryExpression: public FunctionalNode<T, boost::mpl::vector<A1, A2> >::type {
|
class BinaryExpression:
|
||||||
|
public FunctionalNode<T, boost::mpl::vector<A1, A2> >::type {
|
||||||
|
|
||||||
|
typedef typename MakeOptionalJacobian<T, A1>::type OJ1;
|
||||||
|
typedef typename MakeOptionalJacobian<T, A2>::type OJ2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::function<
|
typedef T (A1::*Method)(const A2&, OJ1, OJ2) const;
|
||||||
T(const A1&, const A2&, typename MakeOptionalJacobian<T, A1>::type,
|
typedef boost::function<T(const A1&, const A2&, OJ1, OJ2)> Function;
|
||||||
typename MakeOptionalJacobian<T, A2>::type)> Function;
|
|
||||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2> >::type Base;
|
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2> >::type Base;
|
||||||
typedef typename Base::Record Record;
|
typedef typename Base::Record Record;
|
||||||
|
|
||||||
|
|
@ -766,15 +770,17 @@ public:
|
||||||
/// Ternary Expression
|
/// Ternary Expression
|
||||||
|
|
||||||
template<class T, class A1, class A2, class A3>
|
template<class T, class A1, class A2, class A3>
|
||||||
class TernaryExpression: public FunctionalNode<T, boost::mpl::vector<A1, A2, A3> >::type {
|
class TernaryExpression:
|
||||||
|
public FunctionalNode<T, boost::mpl::vector<A1, A2, A3> >::type {
|
||||||
|
|
||||||
|
typedef typename MakeOptionalJacobian<T, A1>::type OJ1;
|
||||||
|
typedef typename MakeOptionalJacobian<T, A2>::type OJ2;
|
||||||
|
typedef typename MakeOptionalJacobian<T, A3>::type OJ3;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef boost::function<
|
typedef T (A1::*Method)(const A2&, const A3&, OJ1, OJ2, OJ3) const;
|
||||||
T(const A1&, const A2&, const A3&,
|
typedef boost::function<T(const A1&, const A2&, const A3&, OJ1, OJ2, OJ3)> Function;
|
||||||
typename MakeOptionalJacobian<T, A1>::type,
|
|
||||||
typename MakeOptionalJacobian<T, A2>::type,
|
|
||||||
typename MakeOptionalJacobian<T, A3>::type)> Function;
|
|
||||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2, A3> >::type Base;
|
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2, A3> >::type Base;
|
||||||
typedef typename Base::Record Record;
|
typedef typename Base::Record Record;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ public:
|
||||||
/// Construct a nullary method expression
|
/// Construct a nullary method expression
|
||||||
template<typename A>
|
template<typename A>
|
||||||
Expression(const Expression<A>& expression,
|
Expression(const Expression<A>& expression,
|
||||||
T (A::*method)(typename MakeOptionalJacobian<T, A>::type) const) :
|
typename UnaryExpression<T, A>::Method method) :
|
||||||
root_(new UnaryExpression<T, A>(boost::bind(method, _1, _2), expression)) {
|
root_(new UnaryExpression<T, A>(boost::bind(method, _1, _2), expression)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,8 +89,7 @@ public:
|
||||||
/// Construct a unary method expression
|
/// Construct a unary method expression
|
||||||
template<typename A1, typename A2>
|
template<typename A1, typename A2>
|
||||||
Expression(const Expression<A1>& expression1,
|
Expression(const Expression<A1>& expression1,
|
||||||
T (A1::*method)(const A2&, typename MakeOptionalJacobian<T, A1>::type,
|
typename BinaryExpression<T, A1, A2>::Method method,
|
||||||
typename MakeOptionalJacobian<T, A2>::type) const,
|
|
||||||
const Expression<A2>& expression2) :
|
const Expression<A2>& expression2) :
|
||||||
root_(
|
root_(
|
||||||
new BinaryExpression<T, A1, A2>(boost::bind(method, _1, _2, _3, _4),
|
new BinaryExpression<T, A1, A2>(boost::bind(method, _1, _2, _3, _4),
|
||||||
|
|
@ -104,6 +103,17 @@ public:
|
||||||
root_(new BinaryExpression<T, A1, A2>(function, expression1, expression2)) {
|
root_(new BinaryExpression<T, A1, A2>(function, expression1, expression2)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Construct a binary method expression
|
||||||
|
template<typename A1, typename A2, typename A3>
|
||||||
|
Expression(const Expression<A1>& expression1,
|
||||||
|
typename TernaryExpression<T, A1, A2, A3>::Method method,
|
||||||
|
const Expression<A2>& expression2, const Expression<A3>& expression3) :
|
||||||
|
root_(
|
||||||
|
new TernaryExpression<T, A1, A2, A3>(
|
||||||
|
boost::bind(method, _1, _2, _3, _4, _5, _6), expression1,
|
||||||
|
expression2, expression3)) {
|
||||||
|
}
|
||||||
|
|
||||||
/// Construct a ternary function expression
|
/// Construct a ternary function expression
|
||||||
template<typename A1, typename A2, typename A3>
|
template<typename A1, typename A2, typename A3>
|
||||||
Expression(typename TernaryExpression<T, A1, A2, A3>::Function function,
|
Expression(typename TernaryExpression<T, A1, A2, A3>::Function function,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue