diff --git a/docs/source/nnls_solving.rst b/docs/source/nnls_solving.rst index 713d54d52..fde62b905 100644 --- a/docs/source/nnls_solving.rst +++ b/docs/source/nnls_solving.rst @@ -992,6 +992,11 @@ elimination group [LiSaad]_. search, if a step size satisfying the search conditions cannot be found within this number of trials, the line search will stop. + The minimum allowed value is 0 for trust region minimizer and 1 + otherwise. If 0 is specified for the trust region minimizer, then + line search will not be used when solving constrained optimization + problems. + As this is an 'artificial' constraint (one imposed by the user, not the underlying math), if ``WOLFE`` line search is being used, *and* points satisfying the Armijo sufficient (function) decrease diff --git a/include/ceres/solver.h b/include/ceres/solver.h index 2141cc4ec..f0efeb48e 100644 --- a/include/ceres/solver.h +++ b/include/ceres/solver.h @@ -188,14 +188,15 @@ class CERES_EXPORT Solver { // double min_line_search_step_contraction = 0.6; - // Maximum number of trial step size iterations during each line search, - // if a step size satisfying the search conditions cannot be found within - // this number of trials, the line search will terminate. - // + // Maximum number of trial step size iterations during each line + // search, if a step size satisfying the search conditions cannot + // be found within this number of trials, the line search will + // terminate. + // The minimum allowed value is 0 for trust region minimizer and 1 // otherwise. If 0 is specified for the trust region minimizer, - // the line search use when solving constrained optimization - // problems will be disabled. + // then line search will not be used when solving constrained + // optimization problems. int max_num_line_search_step_size_iterations = 20; // Maximum number of restarts of the line search direction algorithm before diff --git a/internal/ceres/invert_psd_matrix.h b/internal/ceres/invert_psd_matrix.h index bbf52fe30..2a61c60e4 100644 --- a/internal/ceres/invert_psd_matrix.h +++ b/internal/ceres/invert_psd_matrix.h @@ -54,7 +54,7 @@ typename EigenTypes::Matrix InvertPSDMatrix( using MType = typename EigenTypes::Matrix; const int size = m.rows(); - // If the matrix can be assumed to be full rank, then if its small + // If the matrix can be assumed to be full rank, then if it is small // (< 5) and fixed size, use Eigen's optimized inverse() // implementation. // diff --git a/internal/ceres/invert_psd_matrix_benchmark.cc b/internal/ceres/invert_psd_matrix_benchmark.cc index 5aab6b613..02a19f3f9 100644 --- a/internal/ceres/invert_psd_matrix_benchmark.cc +++ b/internal/ceres/invert_psd_matrix_benchmark.cc @@ -62,9 +62,9 @@ BENCHMARK_TEMPLATE(BenchmarkFixedSizedInvertPSDMatrix, 10); BENCHMARK_TEMPLATE(BenchmarkFixedSizedInvertPSDMatrix, 11); BENCHMARK_TEMPLATE(BenchmarkFixedSizedInvertPSDMatrix, 12); - void BenchmarkDynamicallyInvertPSDMatrix(benchmark::State& state) { - using MatrixType = typename EigenTypes::Matrix; + using MatrixType = + typename EigenTypes::Matrix; const int size = state.range(0); MatrixType input = MatrixType::Random(size, size); input += input.transpose() + MatrixType::Identity(size, size); diff --git a/internal/ceres/invert_psd_matrix_test.cc b/internal/ceres/invert_psd_matrix_test.cc index 0078e2144..9ca38e399 100644 --- a/internal/ceres/invert_psd_matrix_test.cc +++ b/internal/ceres/invert_psd_matrix_test.cc @@ -42,7 +42,8 @@ static const bool kRankDeficient = false; template typename EigenTypes::Matrix RandomPSDMatrixWithEigenValues( const typename EigenTypes::Vector& eigenvalues) { - typename EigenTypes::Matrix m(eigenvalues.rows(), eigenvalues.rows()); + typename EigenTypes::Matrix m(eigenvalues.rows(), + eigenvalues.rows()); m.setRandom(); Eigen::SelfAdjointEigenSolver::Matrix> es( m); @@ -64,7 +65,8 @@ TEST(InvertPSDMatrix, FullRank5x5) { eigenvalues = eigenvalues.array().abs().matrix(); const Matrix m = RandomPSDMatrixWithEigenValues<5>(eigenvalues); const Matrix inverse_m = InvertPSDMatrix<5>(kFullRank, m); - EXPECT_NEAR((m * inverse_m - Matrix::Identity(5,5)).norm() / 5.0, 0.0, + EXPECT_NEAR((m * inverse_m - Matrix::Identity(5, 5)).norm() / 5.0, + 0.0, 10 * std::numeric_limits::epsilon()); } @@ -88,7 +90,8 @@ TEST(InvertPSDMatrix, DynamicFullRank5x5) { eigenvalues = eigenvalues.array().abs().matrix(); const Matrix m = RandomPSDMatrixWithEigenValues(eigenvalues); const Matrix inverse_m = InvertPSDMatrix(kFullRank, m); - EXPECT_NEAR((m * inverse_m - Matrix::Identity(5,5)).norm() / 5.0, 0.0, + EXPECT_NEAR((m * inverse_m - Matrix::Identity(5, 5)).norm() / 5.0, + 0.0, 10 * std::numeric_limits::epsilon()); }