Made JacobianMap internal
parent
b213e6419a
commit
69c31d20e1
|
@ -164,7 +164,7 @@ T Expression<T>::value(const Values& values, const FastVector<Key>& keys,
|
||||||
static const int Dim = traits<T>::dimension;
|
static const int Dim = traits<T>::dimension;
|
||||||
VerticalBlockMatrix Ab(dims, Dim);
|
VerticalBlockMatrix Ab(dims, Dim);
|
||||||
Ab.matrix().setZero();
|
Ab.matrix().setZero();
|
||||||
JacobianMap jacobianMap(keys, Ab);
|
internal::JacobianMap jacobianMap(keys, Ab);
|
||||||
|
|
||||||
// Call unsafe version
|
// Call unsafe version
|
||||||
T result = value(values, jacobianMap);
|
T result = value(values, jacobianMap);
|
||||||
|
@ -184,7 +184,7 @@ T Expression<T>::traceExecution(const Values& values,
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T Expression<T>::value(const Values& values, JacobianMap& jacobians) const {
|
T Expression<T>::value(const Values& values, internal::JacobianMap& jacobians) const {
|
||||||
// The following piece of code is absolutely crucial for performance.
|
// The following piece of code is absolutely crucial for performance.
|
||||||
// We allocate a block of memory on the stack, which can be done at runtime
|
// We allocate a block of memory on the stack, which can be done at runtime
|
||||||
// with modern C++ compilers. The traceExecution then fills this memory
|
// with modern C++ compilers. The traceExecution then fills this memory
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtsam/nonlinear/JacobianMap.h>
|
#include <gtsam/nonlinear/internal/JacobianMap.h>
|
||||||
#include <gtsam/inference/Symbol.h>
|
#include <gtsam/inference/Symbol.h>
|
||||||
#include <gtsam/base/OptionalJacobian.h>
|
#include <gtsam/base/OptionalJacobian.h>
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ private:
|
||||||
void* traceStorage) const;
|
void* traceStorage) const;
|
||||||
|
|
||||||
/// brief Return value and derivatives, reverse AD version
|
/// brief Return value and derivatives, reverse AD version
|
||||||
T value(const Values& values, JacobianMap& jacobians) const;
|
T value(const Values& values, internal::JacobianMap& jacobians) const;
|
||||||
|
|
||||||
// be very selective on who can access these private methods:
|
// be very selective on who can access these private methods:
|
||||||
friend class ExpressionFactor<T>;
|
friend class ExpressionFactor<T>;
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
|
|
||||||
// Wrap keys and VerticalBlockMatrix into structure passed to expression_
|
// Wrap keys and VerticalBlockMatrix into structure passed to expression_
|
||||||
VerticalBlockMatrix& Ab = factor->matrixObject();
|
VerticalBlockMatrix& Ab = factor->matrixObject();
|
||||||
JacobianMap jacobianMap(keys_, Ab);
|
internal::JacobianMap jacobianMap(keys_, Ab);
|
||||||
|
|
||||||
// Zero out Jacobian so we can simply add to it
|
// Zero out Jacobian so we can simply add to it
|
||||||
Ab.matrix().setZero();
|
Ab.matrix().setZero();
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtsam/nonlinear/JacobianMap.h>
|
#include <gtsam/nonlinear/internal/JacobianMap.h>
|
||||||
#include <boost/mpl/transform.hpp>
|
#include <boost/mpl/transform.hpp>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtsam/nonlinear/JacobianMap.h>
|
#include <gtsam/nonlinear/internal/JacobianMap.h>
|
||||||
#include <gtsam/inference/Key.h>
|
#include <gtsam/inference/Key.h>
|
||||||
#include <gtsam/base/Manifold.h>
|
#include <gtsam/base/Manifold.h>
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <gtsam/base/VerticalBlockMatrix.h>
|
#include <gtsam/base/VerticalBlockMatrix.h>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
// A JacobianMap is the primary mechanism by which derivatives are returned.
|
// A JacobianMap is the primary mechanism by which derivatives are returned.
|
||||||
// Expressions are designed to write their derivatives into an already allocated
|
// Expressions are designed to write their derivatives into an already allocated
|
||||||
|
@ -48,5 +49,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
} // namespace gtsam
|
} // namespace gtsam
|
||||||
|
|
|
@ -80,13 +80,13 @@ struct Record: public internal::CallRecordImplementor<Record, Cols> {
|
||||||
}
|
}
|
||||||
void print(const std::string& indent) const {
|
void print(const std::string& indent) const {
|
||||||
}
|
}
|
||||||
void startReverseAD4(JacobianMap& jacobians) const {
|
void startReverseAD4(internal::JacobianMap& jacobians) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
mutable CallConfig cc;
|
mutable CallConfig cc;
|
||||||
private:
|
private:
|
||||||
template<typename SomeMatrix>
|
template<typename SomeMatrix>
|
||||||
void reverseAD4(const SomeMatrix & dFdT, JacobianMap& jacobians) const {
|
void reverseAD4(const SomeMatrix & dFdT, internal::JacobianMap& jacobians) const {
|
||||||
cc.compTimeRows = SomeMatrix::RowsAtCompileTime;
|
cc.compTimeRows = SomeMatrix::RowsAtCompileTime;
|
||||||
cc.compTimeCols = SomeMatrix::ColsAtCompileTime;
|
cc.compTimeCols = SomeMatrix::ColsAtCompileTime;
|
||||||
cc.runTimeRows = dFdT.rows();
|
cc.runTimeRows = dFdT.rows();
|
||||||
|
@ -97,7 +97,7 @@ struct Record: public internal::CallRecordImplementor<Record, Cols> {
|
||||||
friend struct internal::CallRecordImplementor;
|
friend struct internal::CallRecordImplementor;
|
||||||
};
|
};
|
||||||
|
|
||||||
JacobianMap & NJM= *static_cast<JacobianMap *>(NULL);
|
internal::JacobianMap & NJM= *static_cast<internal::JacobianMap *>(NULL);
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
typedef Eigen::Matrix<double, Eigen::Dynamic, Cols> DynRowMat;
|
typedef Eigen::Matrix<double, Eigen::Dynamic, Cols> DynRowMat;
|
||||||
|
|
Loading…
Reference in New Issue