Evaluation callback API This adds a callback mechanism to for users to get notified just before jacobian and residual evaluations. This will enable aggressive caching and sharing of compute between cost functions. Change-Id: I67993726920218edf71ab9ae70c34c204756c71a
diff --git a/internal/ceres/evaluator.h b/internal/ceres/evaluator.h index cbb7aa2..532f437 100644 --- a/internal/ceres/evaluator.h +++ b/internal/ceres/evaluator.h
@@ -44,6 +44,7 @@ namespace ceres { struct CRSMatrix; +class EvaluationCallback; namespace internal { @@ -64,13 +65,15 @@ num_eliminate_blocks(-1), linear_solver_type(DENSE_QR), dynamic_sparsity(false), - context(NULL) {} + context(NULL), + evaluation_callback(NULL) {} int num_threads; int num_eliminate_blocks; LinearSolverType linear_solver_type; bool dynamic_sparsity; ContextImpl* context; + EvaluationCallback* evaluation_callback; }; static Evaluator* Create(const Options& options, @@ -98,12 +101,16 @@ // Options struct to control Evaluator::Evaluate; struct EvaluateOptions { EvaluateOptions() - : apply_loss_function(true) { + : apply_loss_function(true), + new_evaluation_point(true) { } // If false, the loss function correction is not applied to the // residual blocks. bool apply_loss_function; + + // If false, this evaluation point is the same as the last one. + bool new_evaluation_point; }; // Evaluate the cost function for the given state. Returns the cost,