Add a TrustRegionStrategy::Summary object.
Change-Id: I7caee35a3408ee4a0ec16ba407410d822929340d
diff --git a/internal/ceres/trust_region_strategy.h b/internal/ceres/trust_region_strategy.h
index 8d5977e..7d94ca2 100644
--- a/internal/ceres/trust_region_strategy.h
+++ b/internal/ceres/trust_region_strategy.h
@@ -31,11 +31,14 @@
#ifndef CERES_INTERNAL_TRUST_REGION_STRATEGY_H_
#define CERES_INTERNAL_TRUST_REGION_STRATEGY_H_
-#include "ceres/linear_solver.h"
+#include "ceres/types.h"
namespace ceres {
namespace internal {
+class LinearSolver;
+class SparseMatrix;
+
// Interface for classes implementing various trust region strategies
// for nonlinear least squares problems.
//
@@ -79,14 +82,38 @@
double eta;
};
+ struct Summary {
+ Summary()
+ : residual_norm(0.0),
+ num_iterations(-1),
+ termination_type(FAILURE) {
+ }
+
+ // If the trust region problem is,
+ //
+ // 1/2 x'Ax + b'x + c,
+ //
+ // then
+ //
+ // residual_norm = |Ax -b|
+ double residual_norm;
+
+ // Number of iterations used by the linear solver. If a linear
+ // solver was not called (e.g., DogLegStrategy after an
+ // unsuccessful step), then this would be zero.
+ int num_iterations;
+
+ // Status of the linear solver used to solve the Newton system.
+ LinearSolverTerminationType termination_type;
+ };
+
virtual ~TrustRegionStrategy();
// Use the current radius to solve for the trust region step.
- virtual LinearSolver::Summary ComputeStep(
- const PerSolveOptions& per_solve_options,
- SparseMatrix* jacobian,
- const double* residuals,
- double* step) = 0;
+ virtual Summary ComputeStep(const PerSolveOptions& per_solve_options,
+ SparseMatrix* jacobian,
+ const double* residuals,
+ double* step) = 0;
// Inform the strategy that the current step has been accepted, and
// that the ratio of the decrease in the non-linear objective to the