1*bf2c3715SXin Li // This file is part of Eigen, a lightweight C++ template library
2*bf2c3715SXin Li // for linear algebra.
3*bf2c3715SXin Li //
4*bf2c3715SXin Li // Copyright (C) 2012 Giacomo Po <[email protected]>
5*bf2c3715SXin Li // Copyright (C) 2011 Gael Guennebaud <[email protected]>
6*bf2c3715SXin Li //
7*bf2c3715SXin Li // This Source Code Form is subject to the terms of the Mozilla
8*bf2c3715SXin Li // Public License v. 2.0. If a copy of the MPL was not distributed
9*bf2c3715SXin Li // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10*bf2c3715SXin Li #include <cmath>
11*bf2c3715SXin Li
12*bf2c3715SXin Li #include "../../test/sparse_solver.h"
13*bf2c3715SXin Li #include <Eigen/IterativeSolvers>
14*bf2c3715SXin Li
test_minres_T()15*bf2c3715SXin Li template<typename T> void test_minres_T()
16*bf2c3715SXin Li {
17*bf2c3715SXin Li // Identity preconditioner
18*bf2c3715SXin Li MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I;
19*bf2c3715SXin Li MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I;
20*bf2c3715SXin Li
21*bf2c3715SXin Li // Diagonal preconditioner
22*bf2c3715SXin Li MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag;
23*bf2c3715SXin Li MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag;
24*bf2c3715SXin Li MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag;
25*bf2c3715SXin Li
26*bf2c3715SXin Li // call tests for SPD matrix
27*bf2c3715SXin Li CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) );
28*bf2c3715SXin Li CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) );
29*bf2c3715SXin Li
30*bf2c3715SXin Li CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) );
31*bf2c3715SXin Li CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) );
32*bf2c3715SXin Li CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) );
33*bf2c3715SXin Li
34*bf2c3715SXin Li // TO DO: symmetric semi-definite matrix
35*bf2c3715SXin Li // TO DO: symmetric indefinite matrix
36*bf2c3715SXin Li
37*bf2c3715SXin Li }
38*bf2c3715SXin Li
EIGEN_DECLARE_TEST(minres)39*bf2c3715SXin Li EIGEN_DECLARE_TEST(minres)
40*bf2c3715SXin Li {
41*bf2c3715SXin Li CALL_SUBTEST_1(test_minres_T<double>());
42*bf2c3715SXin Li // CALL_SUBTEST_2(test_minres_T<std::compex<double> >());
43*bf2c3715SXin Li
44*bf2c3715SXin Li }
45