Loading...
Searching...
No Matches
expressionTesting.h
Go to the documentation of this file.
/* ----------------------------------------------------------------------------
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
* See LICENSE for the license information
* -------------------------------------------------------------------------- */
#pragma once
#include <gtsam/nonlinear/ExpressionFactor.h>
#include <gtsam/nonlinear/factorTesting.h>
#include <gtsam/base/Testable.h>
namespace gtsam {
namespace internal {
// CPPUnitLite-style test for linearization of an ExpressionFactor
template<typename T>
bool testExpressionJacobians(const std::string& name_,
const gtsam::Expression<T>& expression, const gtsam::Values& values,
double nd_step, double tolerance) {
// Create factor
size_t size = traits<T>::dimension;
ExpressionFactor<T> f(noiseModel::Unit::Create(size),
expression.value(values), expression);
return testFactorJacobians(name_, f, values, nd_step, tolerance);
}
} // namespace internal
} // namespace gtsam
#define EXPECT_CORRECT_EXPRESSION_JACOBIANS(expression, values, numerical_derivative_step, tolerance) \
{ EXPECT(gtsam::internal::testExpressionJacobians(name_, expression, values, numerical_derivative_step, tolerance)); }
Testable.h
Concept check for values that can be used in unit tests.
factorTesting.h
Evaluate derivatives of a nonlinear factor numerically.
gtsam
Global functions in a separate testing namespace.
Definition chartTesting.h:28
gtsam::noiseModel::Unit::Create
static shared_ptr Create(size_t dim)
Create a unit covariance noise model.
Definition NoiseModel.h:597
gtsam::Expression::value
T value(const Values &values, boost::optional< std::vector< Matrix > & > H=boost::none) const
Return value and optional derivatives, reverse AD version Notes: this is not terribly efficient,...
Definition Expression-inl.h:147