123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #ifndef CERES_INTERNAL_EIGENSPARSE_H_
- #define CERES_INTERNAL_EIGENSPARSE_H_
- #include "ceres/internal/config.h"
- #ifdef CERES_USE_EIGEN_SPARSE
- #include <memory>
- #include <string>
- #include "Eigen/SparseCore"
- #include "ceres/internal/export.h"
- #include "ceres/linear_solver.h"
- #include "ceres/sparse_cholesky.h"
- namespace ceres::internal {
- class EigenSparse {
- public:
- static constexpr bool IsNestedDissectionAvailable() noexcept {
- #ifdef CERES_NO_EIGEN_METIS
- return false;
- #else
- return true;
- #endif
- }
- };
- class CERES_NO_EXPORT EigenSparseCholesky : public SparseCholesky {
- public:
-
- static std::unique_ptr<SparseCholesky> Create(
- const OrderingType ordering_type);
-
- ~EigenSparseCholesky() override;
- LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
- std::string* message) override = 0;
- CompressedRowSparseMatrix::StorageType StorageType() const override = 0;
- LinearSolverTerminationType Solve(const double* rhs,
- double* solution,
- std::string* message) override = 0;
- };
- class CERES_NO_EXPORT FloatEigenSparseCholesky : public SparseCholesky {
- public:
-
- static std::unique_ptr<SparseCholesky> Create(
- const OrderingType ordering_type);
-
- ~FloatEigenSparseCholesky() override;
- LinearSolverTerminationType Factorize(CompressedRowSparseMatrix* lhs,
- std::string* message) override = 0;
- CompressedRowSparseMatrix::StorageType StorageType() const override = 0;
- LinearSolverTerminationType Solve(const double* rhs,
- double* solution,
- std::string* message) override = 0;
- };
- }
- #else
- namespace ceres::internal {
- class EigenSparse {
- public:
- static constexpr bool IsNestedDissectionAvailable() noexcept { return false; }
- };
- }
- #endif
- #endif
|