minres.cpp
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2012 Giacomo Po <gpo@ucla.edu>
5 // Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <cmath>
11 
12 #include "../../test/sparse_solver.h"
13 #include <Eigen/IterativeSolvers>
14 
15 template<typename T> void test_minres_T()
16 {
17  // Identity preconditioner
18  MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I;
19  MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I;
20 
21  // Diagonal preconditioner
22  MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag;
23  MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag;
24  MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag;
25 
26  // call tests for SPD matrix
27  CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) );
28  CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) );
29 
30  CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) );
31  CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) );
32  CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) );
33 
34  // TO DO: symmetric semi-definite matrix
35  // TO DO: symmetric indefinite matrix
36 
37 }
38 
40 {
41  CALL_SUBTEST_1(test_minres_T<double>());
42 // CALL_SUBTEST_2(test_minres_T<std::compex<double> >());
43 
44 }
Eigen::Upper
@ Upper
Definition: Constants.h:211
EIGEN_DECLARE_TEST
EIGEN_DECLARE_TEST(minres)
Definition: minres.cpp:39
CALL_SUBTEST_1
#define CALL_SUBTEST_1(FUNC)
Definition: split_test_helper.h:4
Eigen::MINRES
A minimal residual solver for sparse symmetric problems.
Definition: MINRES.h:143
Eigen::Lower
@ Lower
Definition: Constants.h:209
Eigen::IdentityPreconditioner
A naive preconditioner which approximates any matrix as the identity matrix.
Definition: BasicPreconditioners.h:200
check_sparse_spd_solving
void check_sparse_spd_solving(Solver &solver, int maxSize=(std::min)(300, EIGEN_TEST_MAX_SIZE), int maxRealWorldSize=100000)
Definition: sparse_solver.h:404
Eigen::internal::minres
EIGEN_DONT_INLINE void minres(const MatrixType &mat, const Rhs &rhs, Dest &x, const Preconditioner &precond, Index &iters, typename Dest::RealScalar &tol_error)
Definition: MINRES.h:32
Eigen::DiagonalPreconditioner
A preconditioner based on the digonal entries.
Definition: BasicPreconditioners.h:36
test_minres_T
void test_minres_T()
Definition: minres.cpp:15
CALL_SUBTEST
#define CALL_SUBTEST(FUNC)
Definition: main.h:399


gtsam
Author(s):
autogenerated on Tue Jun 25 2024 03:01:43