1 | // This file is part of Eigen, a lightweight C++ template library
|
---|
2 | // for linear algebra.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>
|
---|
5 | // Copyright (C) 2012 Giacomo Po <gpo@ucla.edu>
|
---|
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 | MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_diag;
|
---|
18 | MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I;
|
---|
19 | MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I;
|
---|
20 | // MINRES<SparseMatrix<T>, Lower, IncompleteLUT<T> > minres_colmajor_ilut;
|
---|
21 | //minres<SparseMatrix<T>, SSORPreconditioner<T> > minres_colmajor_ssor;
|
---|
22 |
|
---|
23 |
|
---|
24 | // CALL_SUBTEST( check_sparse_square_solving(minres_colmajor_diag) );
|
---|
25 | // CALL_SUBTEST( check_sparse_square_solving(minres_colmajor_ilut) );
|
---|
26 | //CALL_SUBTEST( check_sparse_square_solving(minres_colmajor_ssor) );
|
---|
27 |
|
---|
28 | // Diagonal preconditioner
|
---|
29 | MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag;
|
---|
30 | MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag;
|
---|
31 | MINRES<SparseMatrix<T>, Upper|Lower, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag;
|
---|
32 |
|
---|
33 | // call tests for SPD matrix
|
---|
34 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) );
|
---|
35 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) );
|
---|
36 |
|
---|
37 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) );
|
---|
38 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) );
|
---|
39 | // CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) );
|
---|
40 |
|
---|
41 | // TO DO: symmetric semi-definite matrix
|
---|
42 | // TO DO: symmetric indefinite matrix
|
---|
43 | }
|
---|
44 |
|
---|
45 | void test_minres()
|
---|
46 | {
|
---|
47 | CALL_SUBTEST_1(test_minres_T<double>());
|
---|
48 | // CALL_SUBTEST_2(test_minres_T<std::complex<double> >());
|
---|
49 | }
|
---|