123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- #ifndef CERES_INTERNAL_EVALUATOR_H_
- #define CERES_INTERNAL_EVALUATOR_H_
- #include <map>
- #include <memory>
- #include <string>
- #include <vector>
- #include "ceres/context_impl.h"
- #include "ceres/execution_summary.h"
- #include "ceres/internal/disable_warnings.h"
- #include "ceres/internal/export.h"
- #include "ceres/types.h"
- namespace ceres {
- struct CRSMatrix;
- class EvaluationCallback;
- namespace internal {
- class Program;
- class SparseMatrix;
- class CERES_NO_EXPORT Evaluator {
- public:
- virtual ~Evaluator();
- struct Options {
- int num_threads = 1;
- int num_eliminate_blocks = -1;
- LinearSolverType linear_solver_type = DENSE_QR;
- SparseLinearAlgebraLibraryType sparse_linear_algebra_library_type =
- NO_SPARSE;
- bool dynamic_sparsity = false;
- ContextImpl* context = nullptr;
- EvaluationCallback* evaluation_callback = nullptr;
- };
- static std::unique_ptr<Evaluator> Create(const Options& options,
- Program* program,
- std::string* error);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- virtual std::unique_ptr<SparseMatrix> CreateJacobian() const = 0;
-
- struct EvaluateOptions {
-
-
- bool apply_loss_function = true;
-
- bool new_evaluation_point = true;
- };
-
-
-
-
-
-
-
-
-
- virtual bool Evaluate(const EvaluateOptions& evaluate_options,
- const double* state,
- double* cost,
- double* residuals,
- double* gradient,
- SparseMatrix* jacobian) = 0;
-
-
-
- bool Evaluate(const double* state,
- double* cost,
- double* residuals,
- double* gradient,
- SparseMatrix* jacobian) {
- return Evaluate(
- EvaluateOptions(), state, cost, residuals, gradient, jacobian);
- }
-
-
-
-
-
-
-
-
-
-
-
- virtual bool Plus(const double* state,
- const double* delta,
- double* state_plus_delta) const = 0;
-
- virtual int NumParameters() const = 0;
-
-
- virtual int NumEffectiveParameters() const = 0;
-
- virtual int NumResiduals() const = 0;
-
-
-
-
- virtual std::map<std::string, CallStatistics> Statistics() const {
- return {};
- }
- };
- }
- }
- #include "ceres/internal/reenable_warnings.h"
- #endif
|