From 7efc411aa1b4b0b845cf09743db5d71a7769c1e4 Mon Sep 17 00:00:00 2001 From: kartik arcot Date: Wed, 11 Jan 2023 11:27:27 -0800 Subject: [PATCH] fixed some mr comments: use auto, change comment style --- gtsam/navigation/tests/testAttitudeFactor.cpp | 4 ++-- gtsam/nonlinear/CustomFactor.cpp | 2 +- gtsam/nonlinear/NonlinearFactor.h | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gtsam/navigation/tests/testAttitudeFactor.cpp b/gtsam/navigation/tests/testAttitudeFactor.cpp index f599e3957..0973fe8ac 100644 --- a/gtsam/navigation/tests/testAttitudeFactor.cpp +++ b/gtsam/navigation/tests/testAttitudeFactor.cpp @@ -102,8 +102,8 @@ TEST( Pose3AttitudeFactor, Constructor ) { Matrix actualH1; - std::function err_fn = [&factor](const Pose3& p){ - return factor.evaluateError(p, OptionalNone); + auto err_fn = [&factor](const Pose3& p){ + return factor.evaluateError(p, OptionalNone); }; // Calculate numerical derivatives Matrix expectedH = numericalDerivative11(err_fn, T); diff --git a/gtsam/nonlinear/CustomFactor.cpp b/gtsam/nonlinear/CustomFactor.cpp index ee5f9eae5..bb0a77078 100644 --- a/gtsam/nonlinear/CustomFactor.cpp +++ b/gtsam/nonlinear/CustomFactor.cpp @@ -43,7 +43,7 @@ Vector CustomFactor::unwhitenedError(const Values& x, OptionalMatrixVecType H) c * return error * ``` */ - return this->error_function_(*this, x, &(*H)); + return this->error_function_(*this, x, H); } else { /* * In this case, we pass the a `nullptr` to pybind, and it will translate to `None` in Python. diff --git a/gtsam/nonlinear/NonlinearFactor.h b/gtsam/nonlinear/NonlinearFactor.h index 0974192a4..4fc98944f 100644 --- a/gtsam/nonlinear/NonlinearFactor.h +++ b/gtsam/nonlinear/NonlinearFactor.h @@ -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 * TODO(kartikarcot): Change this to OptionalMatrixNone * This typedef is used to indicate that the Jacobian is not required @@ -45,13 +45,13 @@ namespace gtsam { */ #define OptionalNone static_cast(nullptr) -/* This typedef will be used everywhere boost::optional reference was used +/** This typedef will be used everywhere boost::optional reference was used * previously. This is used to indicate that the Jacobian is optional. In the future * we will change this to OptionalJacobian */ 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 * unwhitenedError. */ using OptionalMatrixVecType = std::vector*; @@ -253,11 +253,11 @@ public: */ virtual Vector unwhitenedError(const Values& x, OptionalMatrixVecType H = nullptr) const = 0; - // support taking in the actual vector instead of the pointer as well - // 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: - // public: - // using NoiseModelFactor::unwhitenedError; + /** support taking in the actual vector instead of the pointer as well + * 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: + * public: + * using NoiseModelFactor::unwhitenedError; */ Vector unwhitenedError(const Values& x, std::vector& H) const { return unwhitenedError(x, &H); } @@ -652,7 +652,7 @@ protected: static_assert((are_all_mat || are_all_ptrs), "Arguments that are passed to the evaluateError function can only be of following the types: 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) { return evaluateError(x..., (&H)...); } else {