pastix_support.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>
  5. // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.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. #define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS
  11. #include "sparse_solver.h"
  12. #include <Eigen/PaStiXSupport>
  13. #include <unsupported/Eigen/SparseExtra>
  14. template<typename T> void test_pastix_T()
  15. {
  16. PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_llt_lower;
  17. PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_ldlt_lower;
  18. PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_llt_upper;
  19. PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_ldlt_upper;
  20. PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;
  21. check_sparse_spd_solving(pastix_llt_lower);
  22. check_sparse_spd_solving(pastix_ldlt_lower);
  23. check_sparse_spd_solving(pastix_llt_upper);
  24. check_sparse_spd_solving(pastix_ldlt_upper);
  25. check_sparse_square_solving(pastix_lu);
  26. // Some compilation check:
  27. pastix_llt_lower.iparm();
  28. pastix_llt_lower.dparm();
  29. pastix_ldlt_lower.iparm();
  30. pastix_ldlt_lower.dparm();
  31. pastix_lu.iparm();
  32. pastix_lu.dparm();
  33. }
  34. // There is no support for selfadjoint matrices with PaStiX.
  35. // Complex symmetric matrices should pass though
  36. template<typename T> void test_pastix_T_LU()
  37. {
  38. PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;
  39. check_sparse_square_solving(pastix_lu);
  40. }
  41. EIGEN_DECLARE_TEST(pastix_support)
  42. {
  43. CALL_SUBTEST_1(test_pastix_T<float>());
  44. CALL_SUBTEST_2(test_pastix_T<double>());
  45. CALL_SUBTEST_3( (test_pastix_T_LU<std::complex<float> >()) );
  46. CALL_SUBTEST_4(test_pastix_T_LU<std::complex<double> >());
  47. }