123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- #ifndef CERES_INTERNAL_IMPLICIT_SCHUR_COMPLEMENT_H_
- #define CERES_INTERNAL_IMPLICIT_SCHUR_COMPLEMENT_H_
- #include <memory>
- #include "ceres/internal/disable_warnings.h"
- #include "ceres/internal/eigen.h"
- #include "ceres/internal/export.h"
- #include "ceres/linear_operator.h"
- #include "ceres/linear_solver.h"
- #include "ceres/partitioned_matrix_view.h"
- #include "ceres/types.h"
- namespace ceres::internal {
- class BlockSparseMatrix;
- class CERES_NO_EXPORT ImplicitSchurComplement final : public LinearOperator {
- public:
-
-
-
-
-
-
-
-
-
- explicit ImplicitSchurComplement(const LinearSolver::Options& options);
-
-
-
-
-
-
-
-
-
-
- void Init(const BlockSparseMatrix& A, const double* D, const double* b);
-
- void RightMultiplyAndAccumulate(const double* x, double* y) const final;
-
-
- void LeftMultiplyAndAccumulate(const double* x, double* y) const final {
- RightMultiplyAndAccumulate(x, y);
- }
-
-
-
- void InversePowerSeriesOperatorRightMultiplyAccumulate(const double* x,
- double* y) const;
-
-
-
-
- void BackSubstitute(const double* x, double* y);
- int num_rows() const final { return A_->num_cols_f(); }
- int num_cols() const final { return A_->num_cols_f(); }
- const Vector& rhs() const { return rhs_; }
- const BlockSparseMatrix* block_diagonal_EtE_inverse() const {
- return block_diagonal_EtE_inverse_.get();
- }
- const BlockSparseMatrix* block_diagonal_FtF_inverse() const {
- CHECK(compute_ftf_inverse_);
- return block_diagonal_FtF_inverse_.get();
- }
- private:
- void AddDiagonalAndInvert(const double* D, BlockSparseMatrix* matrix);
- void UpdateRhs();
- const LinearSolver::Options& options_;
- bool compute_ftf_inverse_ = false;
- std::unique_ptr<PartitionedMatrixViewBase> A_;
- const double* D_ = nullptr;
- const double* b_ = nullptr;
- std::unique_ptr<BlockSparseMatrix> block_diagonal_EtE_inverse_;
- std::unique_ptr<BlockSparseMatrix> block_diagonal_FtF_inverse_;
- Vector rhs_;
-
- mutable Vector tmp_rows_;
- mutable Vector tmp_e_cols_;
- mutable Vector tmp_e_cols_2_;
- mutable Vector tmp_f_cols_;
- };
- }
- #include "ceres/internal/reenable_warnings.h"
- #endif
|