fixed some mr comments: use auto, change comment style

release/4.3a0
kartik arcot 2023-01-11 11:27:27 -08:00
parent 319342ab89
commit 7efc411aa1
3 changed files with 12 additions and 12 deletions

View File

@ -102,8 +102,8 @@ TEST( Pose3AttitudeFactor, Constructor ) {
Matrix actualH1; Matrix actualH1;
std::function<Vector(const Pose3&)> err_fn = [&factor](const Pose3& p){ auto err_fn = [&factor](const Pose3& p){
return factor.evaluateError(p, OptionalNone); return factor.evaluateError(p, OptionalNone);
}; };
// Calculate numerical derivatives // Calculate numerical derivatives
Matrix expectedH = numericalDerivative11<Vector,Pose3>(err_fn, T); Matrix expectedH = numericalDerivative11<Vector,Pose3>(err_fn, T);

View File

@ -43,7 +43,7 @@ Vector CustomFactor::unwhitenedError(const Values& x, OptionalMatrixVecType H) c
* return error * return error
* ``` * ```
*/ */
return this->error_function_(*this, x, &(*H)); return this->error_function_(*this, x, H);
} else { } else {
/* /*
* In this case, we pass the a `nullptr` to pybind, and it will translate to `None` in Python. * In this case, we pass the a `nullptr` to pybind, and it will translate to `None` in Python.

View File

@ -35,7 +35,7 @@ namespace gtsam {
/* ************************************************************************* */ /* ************************************************************************* */
/* These typedefs and aliases will help with making the evaluateError interface /** These typedefs and aliases will help with making the evaluateError interface
* independent of boost * independent of boost
* TODO(kartikarcot): Change this to OptionalMatrixNone * TODO(kartikarcot): Change this to OptionalMatrixNone
* This typedef is used to indicate that the Jacobian is not required * This typedef is used to indicate that the Jacobian is not required
@ -45,13 +45,13 @@ namespace gtsam {
*/ */
#define OptionalNone static_cast<Matrix*>(nullptr) #define OptionalNone static_cast<Matrix*>(nullptr)
/* This typedef will be used everywhere boost::optional<Matrix&> reference was used /** This typedef will be used everywhere boost::optional<Matrix&> reference was used
* previously. This is used to indicate that the Jacobian is optional. In the future * previously. This is used to indicate that the Jacobian is optional. In the future
* we will change this to OptionalJacobian * we will change this to OptionalJacobian
*/ */
using OptionalMatrixType = Matrix*; using OptionalMatrixType = Matrix*;
/* The OptionalMatrixVecType is a pointer to a vector of matrices. It will /** The OptionalMatrixVecType is a pointer to a vector of matrices. It will
* be used in situations where a vector of matrices is optional, like in * be used in situations where a vector of matrices is optional, like in
* unwhitenedError. */ * unwhitenedError. */
using OptionalMatrixVecType = std::vector<Matrix>*; using OptionalMatrixVecType = std::vector<Matrix>*;
@ -253,11 +253,11 @@ public:
*/ */
virtual Vector unwhitenedError(const Values& x, OptionalMatrixVecType H = nullptr) const = 0; virtual Vector unwhitenedError(const Values& x, OptionalMatrixVecType H = nullptr) const = 0;
// support taking in the actual vector instead of the pointer as well /** support taking in the actual vector instead of the pointer as well
// to get access to this version of the function from derived classes * to get access to this version of the function from derived classes
// one will need to use the "using" keyword and specify that like this: * one will need to use the "using" keyword and specify that like this:
// public: * public:
// using NoiseModelFactor::unwhitenedError; * using NoiseModelFactor::unwhitenedError; */
Vector unwhitenedError(const Values& x, std::vector<Matrix>& H) const { Vector unwhitenedError(const Values& x, std::vector<Matrix>& H) const {
return unwhitenedError(x, &H); return unwhitenedError(x, &H);
} }
@ -652,7 +652,7 @@ protected:
static_assert((are_all_mat || are_all_ptrs), static_assert((are_all_mat || are_all_ptrs),
"Arguments that are passed to the evaluateError function can only be of following the types: Matrix, " "Arguments that are passed to the evaluateError function can only be of following the types: Matrix, "
"or Matrix*"); "or Matrix*");
// if they pass all matrices then we want to pass their pointers instead // If they pass all matrices then we want to pass their pointers instead
if constexpr (are_all_mat) { if constexpr (are_all_mat) {
return evaluateError(x..., (&H)...); return evaluateError(x..., (&H)...);
} else { } else {