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
|
||||
// Cols is always known at compile time
|
||||
template<typename SomeMatrix>
|
||||
void reverseAD4(const SomeMatrix & dFdT,
|
||||
JacobianMap& jacobians) const {
|
||||
void reverseAD4(const SomeMatrix & dFdT, JacobianMap& jacobians) const {
|
||||
Base::Record::reverseAD4(dFdT, jacobians);
|
||||
This::trace.reverseAD1(dFdT * This::dTdA, jacobians);
|
||||
}
|
||||
|
|
@ -669,10 +668,12 @@ struct FunctionalNode {
|
|||
template<class T, class A1>
|
||||
class UnaryExpression: public FunctionalNode<T, boost::mpl::vector<A1> >::type {
|
||||
|
||||
typedef typename MakeOptionalJacobian<T, A1>::type OJ1;
|
||||
|
||||
public:
|
||||
|
||||
typedef boost::function<
|
||||
T(const A1&, typename MakeOptionalJacobian<T, A1>::type)> Function;
|
||||
typedef T (A1::*Method)(OJ1) const;
|
||||
typedef boost::function<T(const A1&, OJ1)> Function;
|
||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1> >::type Base;
|
||||
typedef typename Base::Record Record;
|
||||
|
||||
|
|
@ -712,13 +713,16 @@ public:
|
|||
/// Binary Expression
|
||||
|
||||
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:
|
||||
|
||||
typedef boost::function<
|
||||
T(const A1&, const A2&, typename MakeOptionalJacobian<T, A1>::type,
|
||||
typename MakeOptionalJacobian<T, A2>::type)> Function;
|
||||
typedef T (A1::*Method)(const A2&, OJ1, OJ2) const;
|
||||
typedef boost::function<T(const A1&, const A2&, OJ1, OJ2)> Function;
|
||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2> >::type Base;
|
||||
typedef typename Base::Record Record;
|
||||
|
||||
|
|
@ -766,15 +770,17 @@ public:
|
|||
/// Ternary Expression
|
||||
|
||||
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:
|
||||
|
||||
typedef boost::function<
|
||||
T(const A1&, const A2&, const A3&,
|
||||
typename MakeOptionalJacobian<T, A1>::type,
|
||||
typename MakeOptionalJacobian<T, A2>::type,
|
||||
typename MakeOptionalJacobian<T, A3>::type)> Function;
|
||||
typedef T (A1::*Method)(const A2&, const A3&, OJ1, OJ2, OJ3) const;
|
||||
typedef boost::function<T(const A1&, const A2&, const A3&, OJ1, OJ2, OJ3)> Function;
|
||||
typedef typename FunctionalNode<T, boost::mpl::vector<A1, A2, A3> >::type Base;
|
||||
typedef typename Base::Record Record;
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
/// Construct a nullary method expression
|
||||
template<typename A>
|
||||
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)) {
|
||||
}
|
||||
|
||||
|
|
@ -89,8 +89,7 @@ public:
|
|||
/// Construct a unary method expression
|
||||
template<typename A1, typename A2>
|
||||
Expression(const Expression<A1>& expression1,
|
||||
T (A1::*method)(const A2&, typename MakeOptionalJacobian<T, A1>::type,
|
||||
typename MakeOptionalJacobian<T, A2>::type) const,
|
||||
typename BinaryExpression<T, A1, A2>::Method method,
|
||||
const Expression<A2>& expression2) :
|
||||
root_(
|
||||
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)) {
|
||||
}
|
||||
|
||||
/// 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
|
||||
template<typename A1, typename A2, typename A3>
|
||||
Expression(typename TernaryExpression<T, A1, A2, A3>::Function function,
|
||||
|
|
|
|||
Loading…
Reference in New Issue