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.

35 lines
1.6 KiB

  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla
  7. // Public License v. 2.0. If a copy of the MPL was not distributed
  8. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. // #define EIGEN_DONT_VECTORIZE
  10. // #define EIGEN_MAX_ALIGN_BYTES 0
  11. #include "sparse_solver.h"
  12. #include <Eigen/IterativeLinearSolvers>
  13. #include <unsupported/Eigen/IterativeSolvers>
  14. template<typename T, typename I> void test_incomplete_cholesky_T()
  15. {
  16. typedef SparseMatrix<T,0,I> SparseMatrixType;
  17. ConjugateGradient<SparseMatrixType, Lower, IncompleteCholesky<T, Lower, AMDOrdering<I> > > cg_illt_lower_amd;
  18. ConjugateGradient<SparseMatrixType, Lower, IncompleteCholesky<T, Lower, NaturalOrdering<I> > > cg_illt_lower_nat;
  19. ConjugateGradient<SparseMatrixType, Upper, IncompleteCholesky<T, Upper, AMDOrdering<I> > > cg_illt_upper_amd;
  20. ConjugateGradient<SparseMatrixType, Upper, IncompleteCholesky<T, Upper, NaturalOrdering<I> > > cg_illt_upper_nat;
  21. CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_amd) );
  22. CALL_SUBTEST( check_sparse_spd_solving(cg_illt_lower_nat) );
  23. CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_amd) );
  24. CALL_SUBTEST( check_sparse_spd_solving(cg_illt_upper_nat) );
  25. }
  26. void test_incomplete_cholesky()
  27. {
  28. CALL_SUBTEST_1(( test_incomplete_cholesky_T<double,int>() ));
  29. CALL_SUBTEST_2(( test_incomplete_cholesky_T<std::complex<double>, int>() ));
  30. CALL_SUBTEST_3(( test_incomplete_cholesky_T<double,long int>() ));
  31. }