aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/sparse_extra.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-12-20 21:56:21 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-12-20 21:56:21 +0100
commite2f4ee1c2b0933bd60d169dc328b321f2db40605 (patch)
tree1320952159ae5fce08c338f8eb84320ff06b5f75 /unsupported/test/sparse_extra.cpp
parent684cfc762d70e8ab766bc94968d8d5e462c44074 (diff)
Speed up parsing of sparse Market file.
Diffstat (limited to 'unsupported/test/sparse_extra.cpp')
-rw-r--r--unsupported/test/sparse_extra.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/unsupported/test/sparse_extra.cpp b/unsupported/test/sparse_extra.cpp
index a010ceb93..ceec3d8a8 100644
--- a/unsupported/test/sparse_extra.cpp
+++ b/unsupported/test/sparse_extra.cpp
@@ -129,6 +129,19 @@ template<typename SparseMatrixType> void sparse_extra(const SparseMatrixType& re
}
+template<typename SparseMatrixType>
+void check_marketio()
+{
+ typedef Matrix<typename SparseMatrixType::Scalar, Dynamic, Dynamic> DenseMatrix;
+ Index rows = internal::random<Index>(1,100);
+ Index cols = internal::random<Index>(1,100);
+ SparseMatrixType m1, m2;
+ m1 = DenseMatrix::Random(rows, cols).sparseView();
+ saveMarket(m1, "sparse_extra.mtx");
+ loadMarket(m2, "sparse_extra.mtx");
+ VERIFY_IS_APPROX(m1,m2);
+}
+
void test_sparse_extra()
{
for(int i = 0; i < g_repeat; i++) {
@@ -143,5 +156,15 @@ void test_sparse_extra()
CALL_SUBTEST_3( (sparse_product<DynamicSparseMatrix<float, ColMajor> >()) );
CALL_SUBTEST_3( (sparse_product<DynamicSparseMatrix<float, RowMajor> >()) );
+
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<float,ColMajor,int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<double,ColMajor,int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<std::complex<float>,ColMajor,int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<std::complex<double>,ColMajor,int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<float,ColMajor,long int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<double,ColMajor,long int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<std::complex<float>,ColMajor,long int> >()) );
+ CALL_SUBTEST_4( (check_marketio<SparseMatrix<std::complex<double>,ColMajor,long int> >()) );
+ TEST_SET_BUT_UNUSED_VARIABLE(s);
}
}