blob: 538d01ab5223fb0c4cfb0703e4ff8cf0123c08b9 [file] [log] [blame]
Brian Silverman72890c22015-09-19 14:37:37 -04001// 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//
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
10#include "sparse_solver.h"
11
Austin Schuhc55b0172022-02-20 17:52:35 -080012template<typename T, typename I_, int flag> void test_simplicial_cholesky_T()
Brian Silverman72890c22015-09-19 14:37:37 -040013{
Austin Schuhc55b0172022-02-20 17:52:35 -080014 typedef SparseMatrix<T,flag,I_> SparseMatrixType;
Austin Schuh189376f2018-12-20 22:11:15 +110015 SimplicialCholesky<SparseMatrixType, Lower> chol_colmajor_lower_amd;
16 SimplicialCholesky<SparseMatrixType, Upper> chol_colmajor_upper_amd;
17 SimplicialLLT< SparseMatrixType, Lower> llt_colmajor_lower_amd;
18 SimplicialLLT< SparseMatrixType, Upper> llt_colmajor_upper_amd;
19 SimplicialLDLT< SparseMatrixType, Lower> ldlt_colmajor_lower_amd;
20 SimplicialLDLT< SparseMatrixType, Upper> ldlt_colmajor_upper_amd;
Austin Schuhc55b0172022-02-20 17:52:35 -080021 SimplicialLDLT< SparseMatrixType, Lower, NaturalOrdering<I_> > ldlt_colmajor_lower_nat;
22 SimplicialLDLT< SparseMatrixType, Upper, NaturalOrdering<I_> > ldlt_colmajor_upper_nat;
Brian Silverman72890c22015-09-19 14:37:37 -040023
24 check_sparse_spd_solving(chol_colmajor_lower_amd);
25 check_sparse_spd_solving(chol_colmajor_upper_amd);
26 check_sparse_spd_solving(llt_colmajor_lower_amd);
27 check_sparse_spd_solving(llt_colmajor_upper_amd);
28 check_sparse_spd_solving(ldlt_colmajor_lower_amd);
29 check_sparse_spd_solving(ldlt_colmajor_upper_amd);
30
31 check_sparse_spd_determinant(chol_colmajor_lower_amd);
32 check_sparse_spd_determinant(chol_colmajor_upper_amd);
33 check_sparse_spd_determinant(llt_colmajor_lower_amd);
34 check_sparse_spd_determinant(llt_colmajor_upper_amd);
35 check_sparse_spd_determinant(ldlt_colmajor_lower_amd);
36 check_sparse_spd_determinant(ldlt_colmajor_upper_amd);
37
Austin Schuhc55b0172022-02-20 17:52:35 -080038 check_sparse_spd_solving(ldlt_colmajor_lower_nat, (std::min)(300,EIGEN_TEST_MAX_SIZE), 1000);
39 check_sparse_spd_solving(ldlt_colmajor_upper_nat, (std::min)(300,EIGEN_TEST_MAX_SIZE), 1000);
Brian Silverman72890c22015-09-19 14:37:37 -040040}
41
Austin Schuhc55b0172022-02-20 17:52:35 -080042EIGEN_DECLARE_TEST(simplicial_cholesky)
Brian Silverman72890c22015-09-19 14:37:37 -040043{
Austin Schuhc55b0172022-02-20 17:52:35 -080044 CALL_SUBTEST_11(( test_simplicial_cholesky_T<double, int, ColMajor>() ));
45 CALL_SUBTEST_12(( test_simplicial_cholesky_T<std::complex<double>, int, ColMajor>() ));
46 CALL_SUBTEST_13(( test_simplicial_cholesky_T<double, long int, ColMajor>() ));
47 CALL_SUBTEST_21(( test_simplicial_cholesky_T<double, int, RowMajor>() ));
48 CALL_SUBTEST_22(( test_simplicial_cholesky_T<std::complex<double>, int, RowMajor>() ));
49 CALL_SUBTEST_23(( test_simplicial_cholesky_T<double, long int, RowMajor>() ));
Brian Silverman72890c22015-09-19 14:37:37 -040050}