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 
test_minres_T()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 
test_minres()39 void test_minres()
40 {
41   CALL_SUBTEST_1(test_minres_T<double>());
42 //  CALL_SUBTEST_2(test_minres_T<std::compex<double> >());
43 
44 }
45