123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- #ifndef CERES_PUBLIC_GRADIENT_CHECKER_H_
- #define CERES_PUBLIC_GRADIENT_CHECKER_H_
- #include <memory>
- #include <string>
- #include <vector>
- #include "ceres/cost_function.h"
- #include "ceres/dynamic_numeric_diff_cost_function.h"
- #include "ceres/internal/disable_warnings.h"
- #include "ceres/internal/eigen.h"
- #include "ceres/internal/export.h"
- #include "ceres/internal/fixed_array.h"
- #include "ceres/manifold.h"
- #include "glog/logging.h"
- namespace ceres {
- class CERES_EXPORT GradientChecker {
- public:
-
-
-
-
-
-
-
-
-
- GradientChecker(const CostFunction* function,
- const std::vector<const Manifold*>* manifolds,
- const NumericDiffOptions& options);
-
- struct CERES_EXPORT ProbeResults {
-
- bool return_value;
-
- Vector residuals;
-
-
-
-
-
-
-
- std::vector<Matrix> jacobians;
-
- std::vector<Matrix> local_jacobians;
-
- std::vector<Matrix> numeric_jacobians;
-
- std::vector<Matrix> local_numeric_jacobians;
-
- double maximum_relative_error;
-
-
- std::string error_log;
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- bool Probe(double const* const* parameters,
- double relative_precision,
- ProbeResults* results) const;
- private:
- GradientChecker() = delete;
- GradientChecker(const GradientChecker&) = delete;
- void operator=(const GradientChecker&) = delete;
- std::vector<const Manifold*> manifolds_;
- const CostFunction* function_;
- std::unique_ptr<CostFunction> finite_diff_cost_function_;
- };
- }
- #include "ceres/internal/reenable_warnings.h"
- #endif
|