From e2f4ee1c2b0933bd60d169dc328b321f2db40605 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 20 Dec 2016 21:56:21 +0100 Subject: Speed up parsing of sparse Market file. --- unsupported/test/sparse_extra.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'unsupported/test/sparse_extra.cpp') 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 void sparse_extra(const SparseMatrixType& re } +template +void check_marketio() +{ + typedef Matrix DenseMatrix; + Index rows = internal::random(1,100); + Index cols = internal::random(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 >()) ); CALL_SUBTEST_3( (sparse_product >()) ); + + CALL_SUBTEST_4( (check_marketio >()) ); + CALL_SUBTEST_4( (check_marketio >()) ); + CALL_SUBTEST_4( (check_marketio,ColMajor,int> >()) ); + CALL_SUBTEST_4( (check_marketio,ColMajor,int> >()) ); + CALL_SUBTEST_4( (check_marketio >()) ); + CALL_SUBTEST_4( (check_marketio >()) ); + CALL_SUBTEST_4( (check_marketio,ColMajor,long int> >()) ); + CALL_SUBTEST_4( (check_marketio,ColMajor,long int> >()) ); + TEST_SET_BUT_UNUSED_VARIABLE(s); } } -- cgit v1.2.3