aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/conjugate_gradient.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-03-09 14:33:15 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-03-09 14:33:15 +0100
commit9e885fb76608c8d90da20151db6459a99be360d6 (patch)
tree16ba2fdbf1488880e5630f3400c2daa303f926bd /test/conjugate_gradient.cpp
parent224a1fe4c6991c863986d8c8bd3d41af5aa4ff80 (diff)
Add unit tests for CG and sparse-LLT for long int as storage-index
Diffstat (limited to 'test/conjugate_gradient.cpp')
-rw-r--r--test/conjugate_gradient.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/conjugate_gradient.cpp b/test/conjugate_gradient.cpp
index 019cc4d64..9622fd86d 100644
--- a/test/conjugate_gradient.cpp
+++ b/test/conjugate_gradient.cpp
@@ -10,13 +10,14 @@
#include "sparse_solver.h"
#include <Eigen/IterativeLinearSolvers>
-template<typename T> void test_conjugate_gradient_T()
+template<typename T, typename I> void test_conjugate_gradient_T()
{
- ConjugateGradient<SparseMatrix<T>, Lower > cg_colmajor_lower_diag;
- ConjugateGradient<SparseMatrix<T>, Upper > cg_colmajor_upper_diag;
- ConjugateGradient<SparseMatrix<T>, Lower|Upper> cg_colmajor_loup_diag;
- ConjugateGradient<SparseMatrix<T>, Lower, IdentityPreconditioner> cg_colmajor_lower_I;
- ConjugateGradient<SparseMatrix<T>, Upper, IdentityPreconditioner> cg_colmajor_upper_I;
+ typedef SparseMatrix<T,0,I> SparseMatrixType;
+ ConjugateGradient<SparseMatrixType, Lower > cg_colmajor_lower_diag;
+ ConjugateGradient<SparseMatrixType, Upper > cg_colmajor_upper_diag;
+ ConjugateGradient<SparseMatrixType, Lower|Upper> cg_colmajor_loup_diag;
+ ConjugateGradient<SparseMatrixType, Lower, IdentityPreconditioner> cg_colmajor_lower_I;
+ ConjugateGradient<SparseMatrixType, Upper, IdentityPreconditioner> cg_colmajor_upper_I;
CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_lower_diag) );
CALL_SUBTEST( check_sparse_spd_solving(cg_colmajor_upper_diag) );
@@ -27,6 +28,7 @@ template<typename T> void test_conjugate_gradient_T()
void test_conjugate_gradient()
{
- CALL_SUBTEST_1(test_conjugate_gradient_T<double>());
- CALL_SUBTEST_2(test_conjugate_gradient_T<std::complex<double> >());
+ CALL_SUBTEST_1(( test_conjugate_gradient_T<double,int>() ));
+ CALL_SUBTEST_2(( test_conjugate_gradient_T<std::complex<double>, int>() ));
+ CALL_SUBTEST_3(( test_conjugate_gradient_T<double,long int>() ));
}