source: pacpussensors/trunk/Vislab/lib3dv/eigen/test/sparselu.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 2.4 KB
Line 
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
5//
6// Eigen is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 3 of the License, or (at your option) any later version.
10//
11// Alternatively, you can redistribute it and/or
12// modify it under the terms of the GNU General Public License as
13// published by the Free Software Foundation; either version 2 of
14// the License, or (at your option) any later version.
15//
16// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
17// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License and a copy of the GNU General Public License along with
23// Eigen. If not, see <http://www.gnu.org/licenses/>.
24
25
26// SparseLU solve does not accept column major matrices for the destination.
27// However, as expected, the generic check_sparse_square_solving routines produces row-major
28// rhs and destination matrices when compiled with EIGEN_DEFAULT_TO_ROW_MAJOR
29
30#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
31#undef EIGEN_DEFAULT_TO_ROW_MAJOR
32#endif
33
34#include "sparse_solver.h"
35#include <Eigen/SparseLU>
36#include <unsupported/Eigen/SparseExtra>
37
38template<typename T> void test_sparselu_T()
39{
40 SparseLU<SparseMatrix<T, ColMajor> /*, COLAMDOrdering<int>*/ > sparselu_colamd; // COLAMDOrdering is the default
41 SparseLU<SparseMatrix<T, ColMajor>, AMDOrdering<int> > sparselu_amd;
42 SparseLU<SparseMatrix<T, ColMajor, long int>, NaturalOrdering<long int> > sparselu_natural;
43
44 check_sparse_square_solving(sparselu_colamd, true);
45 check_sparse_square_solving(sparselu_amd, true);
46 check_sparse_square_solving(sparselu_natural,true);
47
48 check_sparse_square_abs_determinant(sparselu_colamd);
49 check_sparse_square_abs_determinant(sparselu_amd);
50
51 check_sparse_square_determinant(sparselu_colamd);
52 check_sparse_square_determinant(sparselu_amd);
53}
54
55void test_sparselu()
56{
57 CALL_SUBTEST_1(test_sparselu_T<float>());
58 CALL_SUBTEST_2(test_sparselu_T<double>());
59 CALL_SUBTEST_3(test_sparselu_T<std::complex<float> >());
60 CALL_SUBTEST_4(test_sparselu_T<std::complex<double> >());
61}
Note: See TracBrowser for help on using the repository browser.