You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.6 KiB

  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. #include "../../test/sparse_solver.h"
  12. #include <StormEigen/IterativeSolvers>
  13. template<typename T> void test_minres_T()
  14. {
  15. // Identity preconditioner
  16. MINRES<SparseMatrix<T>, Lower, IdentityPreconditioner > minres_colmajor_lower_I;
  17. MINRES<SparseMatrix<T>, Upper, IdentityPreconditioner > minres_colmajor_upper_I;
  18. // Diagonal preconditioner
  19. MINRES<SparseMatrix<T>, Lower, DiagonalPreconditioner<T> > minres_colmajor_lower_diag;
  20. MINRES<SparseMatrix<T>, Upper, DiagonalPreconditioner<T> > minres_colmajor_upper_diag;
  21. MINRES<SparseMatrix<T>, Lower|Upper, DiagonalPreconditioner<T> > minres_colmajor_uplo_diag;
  22. // call tests for SPD matrix
  23. CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) );
  24. CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) );
  25. CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) );
  26. CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) );
  27. CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) );
  28. // TO DO: symmetric semi-definite matrix
  29. // TO DO: symmetric indefinite matrix
  30. }
  31. void test_minres()
  32. {
  33. CALL_SUBTEST_1(test_minres_T<double>());
  34. // CALL_SUBTEST_2(test_minres_T<std::compex<double> >());
  35. }