From f0b071bac4d4b5d28f8abfbaa181199e73474cc5 Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Fri, 31 May 2013 13:22:51 -0700 Subject: [PATCH] Lint and other fixes from William Rucklidge Change-Id: Ic18561a5cdadccc75e97818fa4422bb5d9d43df9 --- docs/source/modeling.rst | 8 ++++---- docs/source/solving.rst | 7 +++++-- docs/source/tutorial.rst | 2 +- docs/source/version_history.rst | 2 +- include/ceres/iteration_callback.h | 2 ++ include/ceres/jet.h | 4 ++-- include/ceres/solver.h | 2 ++ internal/ceres/solver.cc | 1 - 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/docs/source/modeling.rst b/docs/source/modeling.rst index 93098f15a..95832b1ae 100644 --- a/docs/source/modeling.rst +++ b/docs/source/modeling.rst @@ -350,10 +350,10 @@ residuals and their derivatives. This is done using : public SizedCostFunction { }; - To get an numerically differentiated :class:`CostFunction`, you - must define a class with a ``operator()`` (a functor) that computes - the residuals. The functor must write the computed value in the - last argument (the only non-``const`` one) and return ``true`` to + To get a numerically differentiated :class:`CostFunction`, you must + define a class with a ``operator()`` (a functor) that computes the + residuals. The functor must write the computed value in the last + argument (the only non-``const`` one) and return ``true`` to indicate success. Please see :class:`CostFunction` for details on how the return value may be used to impose simple constraints on the parameter block. e.g., an object of the form diff --git a/docs/source/solving.rst b/docs/source/solving.rst index c992c5b4f..9b2616668 100644 --- a/docs/source/solving.rst +++ b/docs/source/solving.rst @@ -1022,7 +1022,7 @@ elimination group [LiSaad]_. 1. Compute the Jacobian matrix in some order and then have the factorization algorithm permute the columns of the Jacobian. - 2. Compute the Jacobian with it's columns already permuted. + 2. Compute the Jacobian with its columns already permuted. The first option incurs a significant memory penalty. The factorization algorithm has to make a copy of the permuted Jacobian @@ -1314,7 +1314,8 @@ elimination group [LiSaad]_. .. class:: IterationSummary :class:`IterationSummary` describes the state of the optimizer - after each iteration of the minimization. + after each iteration of the minimization. Note that all times are + wall times. .. code-block:: c++ @@ -1524,6 +1525,8 @@ elimination group [LiSaad]_. .. class:: Solver::Summary + Note that all times reported in this struct are wall times. + .. code-block:: c++ struct Summary { diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 332992787..da63e9e08 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -244,7 +244,7 @@ x`. residuals[0] = 10 - x; // Compute the Jacobian if asked for. - if (jacobians != NULL) { + if (jacobians != NULL && jacobians[0] != NULL) { jacobians[0][0] = -1; } return true; diff --git a/docs/source/version_history.rst b/docs/source/version_history.rst index a83d098e4..11e1e46d6 100644 --- a/docs/source/version_history.rst +++ b/docs/source/version_history.rst @@ -31,7 +31,7 @@ Bug Fixes #. Enabling -O4 (link-time optimization) only if compiler/linker support it. (Alex Stewart) #. Consistent glog path across files. #. ceres-solver.spec: Use cleaner, more conventional Release string (Taylor Braun-Jones) -#. Fix compile bug on RHEL6 due to missing header (Taylor Braun-Jones 3 weeks ago) +#. Fix compile bug on RHEL6 due to missing header (Taylor Braun-Jones) 1.6.0 diff --git a/include/ceres/iteration_callback.h b/include/ceres/iteration_callback.h index 0dc4c96b4..13140c231 100644 --- a/include/ceres/iteration_callback.h +++ b/include/ceres/iteration_callback.h @@ -128,6 +128,8 @@ struct IterationSummary { // Newton step. int linear_solver_iterations; + // All times reported below are wall times. + // Time (in seconds) spent inside the minimizer loop in the current // iteration. double iteration_time_in_seconds; diff --git a/include/ceres/jet.h b/include/ceres/jet.h index 7299a48bc..4d2a857dc 100644 --- a/include/ceres/jet.h +++ b/include/ceres/jet.h @@ -545,8 +545,8 @@ template inline Jet tanh(const Jet& f) { Jet g; g.a = tanh(f.a); - double tanh_fa = tanh(f.a); - const T tmp = 1 - tanh_fa * tanh_fa; + double tanh_a = tanh(f.a); + const T tmp = T(1.0) - tanh_a * tanh_a; g.v = tmp * f.v; return g; } diff --git a/include/ceres/solver.h b/include/ceres/solver.h index 854df2ae5..8bf87f9d2 100644 --- a/include/ceres/solver.h +++ b/include/ceres/solver.h @@ -603,6 +603,8 @@ class Solver { int num_unsuccessful_steps; int num_inner_iteration_steps; + // All times reported below are wall times. + // When the user calls Solve, before the actual optimization // occurs, Ceres performs a number of preprocessing steps. These // include error checks, memory allocations, and reorderings. This diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc index 5acbbfde3..9ff2d1527 100644 --- a/internal/ceres/solver.cc +++ b/internal/ceres/solver.cc @@ -283,7 +283,6 @@ string Solver::Summary::FullReport() const { StringAppendF(&report, "%45s %21s\n", "Given", "Used"); StringAppendF(&report, "Threads % 25d% 25d\n", num_threads_given, num_threads_used); - } if (termination_type == DID_NOT_RUN) {