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 }
A preconditioner based on the digonal entries.
A minimal residual solver for sparse symmetric problems.
Definition: MINRES.h:147
void test_minres()
Definition: minres.cpp:39
#define CALL_SUBTEST(FUNC)
Definition: main.h:342
void check_sparse_spd_solving(Solver &solver, int maxSize=300, int maxRealWorldSize=100000)
A naive preconditioner which approximates any matrix as the identity matrix.
void test_minres_T()
Definition: minres.cpp:15


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:43:00