From 9ee9e37674d0a4ff7d341f97b7c569b206a55569 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com>
Date: Tue, 4 Feb 2020 21:23:45 +0100
Subject: [PATCH] Added binary sparse matrix unit tests for Ellpack and
 SlicedEllpack.

---
 ...Test.cu => BinarySparseMatrixTest_CSR.cpp} |   4 +-
 ...Test.cpp => BinarySparseMatrixTest_CSR.cu} |   4 +-
 ...rixTest.h => BinarySparseMatrixTest_CSR.h} |  28 ++--
 .../BinarySparseMatrixTest_Ellpack.cpp        |  11 ++
 .../BinarySparseMatrixTest_Ellpack.cu         |  11 ++
 .../Matrices/BinarySparseMatrixTest_Ellpack.h | 146 ++++++++++++++++++
 .../BinarySparseMatrixTest_SlicedEllpack.cpp  |  11 ++
 .../BinarySparseMatrixTest_SlicedEllpack.cu   |  11 ++
 .../BinarySparseMatrixTest_SlicedEllpack.h    | 146 ++++++++++++++++++
 src/UnitTests/Matrices/CMakeLists.txt         |  28 +++-
 .../Matrices/SparseMatrixTest_CSR.cu          |   2 +-
 src/UnitTests/Matrices/SparseMatrixTest_CSR.h |   2 +-
 .../Matrices/SparseMatrixTest_Ellpack.cu      |   2 +-
 .../Matrices/SparseMatrixTest_Ellpack.h       |   2 +-
 .../SparseMatrixTest_SlicedEllpack.cu         |   2 +-
 15 files changed, 381 insertions(+), 29 deletions(-)
 rename src/UnitTests/Matrices/{BinarySparseMatrixTest.cu => BinarySparseMatrixTest_CSR.cpp} (78%)
 rename src/UnitTests/Matrices/{BinarySparseMatrixTest.cpp => BinarySparseMatrixTest_CSR.cu} (78%)
 rename src/UnitTests/Matrices/{BinarySparseMatrixTest.h => BinarySparseMatrixTest_CSR.h} (87%)
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cpp
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cu
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.h
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cpp
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cu
 create mode 100644 src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.h

diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest.cu b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cpp
similarity index 78%
rename from src/UnitTests/Matrices/BinarySparseMatrixTest.cu
rename to src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cpp
index 916f14360e..b1f4891053 100644
--- a/src/UnitTests/Matrices/BinarySparseMatrixTest.cu
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cpp
@@ -1,5 +1,5 @@
 /***************************************************************************
-                          BinarySparseMatrixTest.cu -  description
+                          BinarySparseMatrixTest_CSR.cpp -  description
                              -------------------
     begin                : Jan 30, 2020
     copyright            : (C) 2020 by Tomas Oberhuber et al.
@@ -8,4 +8,4 @@
 
 /* See Copyright Notice in tnl/Copyright */
 
-#include "BinarySparseMatrixTest.h"
\ No newline at end of file
+#include "BinarySparseMatrixTest_CSR.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest.cpp b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cu
similarity index 78%
rename from src/UnitTests/Matrices/BinarySparseMatrixTest.cpp
rename to src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cu
index ea7b8d3c92..496bdde1b3 100644
--- a/src/UnitTests/Matrices/BinarySparseMatrixTest.cpp
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.cu
@@ -1,5 +1,5 @@
 /***************************************************************************
-                          BinarySparseMatrixTest.cpp -  description
+                          BinarySparseMatrixTest_CSR.cu -  description
                              -------------------
     begin                : Jan 30, 2020
     copyright            : (C) 2020 by Tomas Oberhuber et al.
@@ -8,4 +8,4 @@
 
 /* See Copyright Notice in tnl/Copyright */
 
-#include "BinarySparseMatrixTest.h"
\ No newline at end of file
+#include "BinarySparseMatrixTest_CSR.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest.h b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.h
similarity index 87%
rename from src/UnitTests/Matrices/BinarySparseMatrixTest.h
rename to src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.h
index cb0d0bab57..9cd52741a8 100644
--- a/src/UnitTests/Matrices/BinarySparseMatrixTest.h
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_CSR.h
@@ -1,5 +1,5 @@
 /***************************************************************************
-                          BinarySparseMatrixTest.h -  description
+                          BinarySparseMatrixTest_CSR.h -  description
                              -------------------
     begin                : Jan 30, 2020
     copyright            : (C) 2020 by Tomas Oberhuber et al.
@@ -20,7 +20,7 @@
 
 // test fixture for typed tests
 template< typename Matrix >
-class CSRMatrixTest : public ::testing::Test
+class BinaryMatrixTest_CSR : public ::testing::Test
 {
 protected:
    using CSRMatrixType = Matrix;
@@ -57,37 +57,37 @@ using CSRMatrixTypes = ::testing::Types
 #endif
 >;
 
-TYPED_TEST_SUITE( CSRMatrixTest, CSRMatrixTypes);
+TYPED_TEST_SUITE( BinaryMatrixTest_CSR, CSRMatrixTypes);
 
-TYPED_TEST( CSRMatrixTest, setDimensionsTest )
+TYPED_TEST( BinaryMatrixTest_CSR, setDimensionsTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_SetDimensions< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, setCompressedRowLengthsTest )
+TYPED_TEST( BinaryMatrixTest_CSR, setCompressedRowLengthsTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_SetCompressedRowLengths< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, setLikeTest )
+TYPED_TEST( BinaryMatrixTest_CSR, setLikeTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_SetLike< CSRMatrixType, CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, resetTest )
+TYPED_TEST( BinaryMatrixTest_CSR, resetTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_Reset< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, getRowTest )
+TYPED_TEST( BinaryMatrixTest_CSR, getRowTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
@@ -95,35 +95,35 @@ TYPED_TEST( CSRMatrixTest, getRowTest )
 }
 
 
-TYPED_TEST( CSRMatrixTest, setElementTest )
+TYPED_TEST( BinaryMatrixTest_CSR, setElementTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_SetElement< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, vectorProductTest )
+TYPED_TEST( BinaryMatrixTest_CSR, vectorProductTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_VectorProduct< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, rowsReduction )
+TYPED_TEST( BinaryMatrixTest_CSR, rowsReduction )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
     test_RowsReduction< CSRMatrixType >();
 }
 
-TYPED_TEST( CSRMatrixTest, saveAndLoadTest )
+TYPED_TEST( BinaryMatrixTest_CSR, saveAndLoadTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
-    test_SaveAndLoad< CSRMatrixType >( "test_BinarySparseMatrixTest" );
+    test_SaveAndLoad< CSRMatrixType >( "test_BinarySparseMatrixTest_CSR" );
 }
 
-TYPED_TEST( CSRMatrixTest, printTest )
+TYPED_TEST( BinaryMatrixTest_CSR, printTest )
 {
     using CSRMatrixType = typename TestFixture::CSRMatrixType;
 
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cpp b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cpp
new file mode 100644
index 0000000000..b1d5d71cf6
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cpp
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_Ellpack.cpp -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "BinarySparseMatrixTest_Ellpack.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cu b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cu
new file mode 100644
index 0000000000..8d075f1cf4
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.cu
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_Ellpack.cu -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "BinarySparseMatrixTest_Ellpack.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.h b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.h
new file mode 100644
index 0000000000..708bd85f07
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_Ellpack.h
@@ -0,0 +1,146 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_Ellpack.h -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include <TNL/Containers/Segments/Ellpack.h>
+#include <TNL/Matrices/SparseMatrix.h>
+
+
+#include "BinarySparseMatrixTest.hpp"
+#include <iostream>
+
+#ifdef HAVE_GTEST
+#include <gtest/gtest.h>
+
+// test fixture for typed tests
+template< typename Matrix >
+class BinaryMatrixTest_Ellpack : public ::testing::Test
+{
+protected:
+   using EllpackMatrixType = Matrix;
+};
+
+////
+// Row-major format is used for the host system
+template< typename Device, typename Index, typename IndexAlocator >
+using RowMajorEllpack = TNL::Containers::Segments::Ellpack< Device, Index, IndexAlocator, true, 32 >;
+
+
+////
+// Column-major format is used for GPUs
+template< typename Device, typename Index, typename IndexAllocator >
+using ColumnMajorEllpack = TNL::Containers::Segments::Ellpack< Device, Index, IndexAllocator, false, 32 >;
+
+// types for which MatrixTest is instantiated
+using EllpackMatrixTypes = ::testing::Types
+<
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorEllpack >
+#ifdef HAVE_CUDA
+   ,TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorEllpack >
+#endif
+>;
+
+TYPED_TEST_SUITE( BinaryMatrixTest_Ellpack, EllpackMatrixTypes);
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, setDimensionsTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_SetDimensions< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, setCompressedRowLengthsTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_SetCompressedRowLengths< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, setLikeTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_SetLike< EllpackMatrixType, EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, resetTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_Reset< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, getRowTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_GetRow< EllpackMatrixType >();
+}
+
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, setElementTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_SetElement< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, vectorProductTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_VectorProduct< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, rowsReduction )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_RowsReduction< EllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, saveAndLoadTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_SaveAndLoad< EllpackMatrixType >( "test_BinarySparseMatrixTest_Ellpack" );
+}
+
+TYPED_TEST( BinaryMatrixTest_Ellpack, printTest )
+{
+    using EllpackMatrixType = typename TestFixture::EllpackMatrixType;
+
+    test_Print< EllpackMatrixType >();
+}
+
+#endif
+
+#include "../main.h"
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cpp b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cpp
new file mode 100644
index 0000000000..7046d81562
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cpp
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_SlicedEllpack.cpp -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "BinarySparseMatrixTest_SlicedEllpack.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cu b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cu
new file mode 100644
index 0000000000..bb6829310f
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.cu
@@ -0,0 +1,11 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_SlicedEllpack.cu -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include "BinarySparseMatrixTest_SlicedEllpack.h"
\ No newline at end of file
diff --git a/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.h b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.h
new file mode 100644
index 0000000000..7ebc259683
--- /dev/null
+++ b/src/UnitTests/Matrices/BinarySparseMatrixTest_SlicedEllpack.h
@@ -0,0 +1,146 @@
+/***************************************************************************
+                          BinarySparseMatrixTest_SlicedEllpack.h -  description
+                             -------------------
+    begin                : Jan 30, 2020
+    copyright            : (C) 2020 by Tomas Oberhuber et al.
+    email                : tomas.oberhuber@fjfi.cvut.cz
+ ***************************************************************************/
+
+/* See Copyright Notice in tnl/Copyright */
+
+#include <TNL/Containers/Segments/SlicedEllpack.h>
+#include <TNL/Matrices/SparseMatrix.h>
+
+
+#include "BinarySparseMatrixTest.hpp"
+#include <iostream>
+
+#ifdef HAVE_GTEST
+#include <gtest/gtest.h>
+
+// test fixture for typed tests
+template< typename Matrix >
+class BinaryMatrixTest_SlicedEllpack : public ::testing::Test
+{
+protected:
+   using SlicedEllpackMatrixType = Matrix;
+};
+
+////
+// Row-major format is used for the host system
+template< typename Device, typename Index, typename IndexAllocator >
+using RowMajorSlicedEllpack = TNL::Containers::Segments::SlicedEllpack< Device, Index, IndexAllocator, true, 32 >;
+
+
+////
+// Column-major format is used for GPUs
+template< typename Device, typename Index, typename IndexAllocator >
+using ColumnMajorSlicedEllpack = TNL::Containers::Segments::SlicedEllpack< Device, Index, IndexAllocator, false, 32 >;
+
+// types for which MatrixTest is instantiated
+using SlicedEllpackMatrixTypes = ::testing::Types
+<
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, short, TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, int,   TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Host, long,  TNL::Matrices::GeneralMatrix, RowMajorSlicedEllpack >
+#ifdef HAVE_CUDA
+   ,TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, short, TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, int,   TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< int,     TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< long,    TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< float,   TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >,
+    TNL::Matrices::SparseMatrix< double,  TNL::Devices::Cuda, long,  TNL::Matrices::GeneralMatrix, ColumnMajorSlicedEllpack >
+#endif
+>;
+
+TYPED_TEST_SUITE( BinaryMatrixTest_SlicedEllpack, SlicedEllpackMatrixTypes);
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, setDimensionsTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_SetDimensions< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, setCompressedRowLengthsTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_SetCompressedRowLengths< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, setLikeTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_SetLike< SlicedEllpackMatrixType, SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, resetTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_Reset< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, getRowTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_GetRow< SlicedEllpackMatrixType >();
+}
+
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, setElementTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_SetElement< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, vectorProductTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_VectorProduct< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, rowsReduction )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_RowsReduction< SlicedEllpackMatrixType >();
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, saveAndLoadTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_SaveAndLoad< SlicedEllpackMatrixType >( "test_BinarySparseMatrixTest" );
+}
+
+TYPED_TEST( BinaryMatrixTest_SlicedEllpack, printTest )
+{
+    using SlicedEllpackMatrixType = typename TestFixture::SlicedEllpackMatrixType;
+
+    test_Print< SlicedEllpackMatrixType >();
+}
+
+#endif
+
+#include "../main.h"
diff --git a/src/UnitTests/Matrices/CMakeLists.txt b/src/UnitTests/Matrices/CMakeLists.txt
index c4b2fabd39..60a01eaf5e 100644
--- a/src/UnitTests/Matrices/CMakeLists.txt
+++ b/src/UnitTests/Matrices/CMakeLists.txt
@@ -25,8 +25,14 @@ IF( BUILD_CUDA )
    CUDA_ADD_EXECUTABLE( SparseMatrixCopyTest SparseMatrixCopyTest.cu OPTIONS ${CXX_TESTS_FLAGS} )
    TARGET_LINK_LIBRARIES( SparseMatrixCopyTest ${GTEST_BOTH_LIBRARIES} )
 
-   CUDA_ADD_EXECUTABLE( BinarySparseMatrixTest BinarySparseMatrixTest.cu OPTIONS ${CXX_TESTS_FLAGS} )
-   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest ${GTEST_BOTH_LIBRARIES} )
+   CUDA_ADD_EXECUTABLE( BinarySparseMatrixTest_CSR BinarySparseMatrixTest_CSR.cu OPTIONS ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_CSR ${GTEST_BOTH_LIBRARIES} )
+
+   CUDA_ADD_EXECUTABLE( BinarySparseMatrixTest_Ellpack BinarySparseMatrixTest_Ellpack.cu OPTIONS ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_Ellpack ${GTEST_BOTH_LIBRARIES} )
+
+   CUDA_ADD_EXECUTABLE( BinarySparseMatrixTest_SlicedEllpack BinarySparseMatrixTest_SlicedEllpack.cu OPTIONS ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_SlicedEllpack ${GTEST_BOTH_LIBRARIES} )
 
 ELSE(  BUILD_CUDA )
    ADD_EXECUTABLE( DenseMatrixTest DenseMatrixTest.cpp )
@@ -61,9 +67,17 @@ ELSE(  BUILD_CUDA )
    TARGET_COMPILE_OPTIONS( SparseMatrixCopyTest PRIVATE ${CXX_TESTS_FLAGS} )
    TARGET_LINK_LIBRARIES( SparseMatrixCopyTest ${GTEST_BOTH_LIBRARIES} )
 
-   ADD_EXECUTABLE( BinarySparseMatrixTest BinarySparseMatrixTest.cpp )
-   TARGET_COMPILE_OPTIONS( BinarySparseMatrixTest PRIVATE ${CXX_TESTS_FLAGS} )
-   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest ${GTEST_BOTH_LIBRARIES} )
+   ADD_EXECUTABLE( BinarySparseMatrixTest_CSR BinarySparseMatrixTest_CSR.cpp )
+   TARGET_COMPILE_OPTIONS( BinarySparseMatrixTest_CSR PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_CSR ${GTEST_BOTH_LIBRARIES} )
+
+   ADD_EXECUTABLE( BinarySparseMatrixTest_Ellpack BinarySparseMatrixTest_Ellpack.cpp )
+   TARGET_COMPILE_OPTIONS( BinarySparseMatrixTest_Ellpack PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_Ellpack ${GTEST_BOTH_LIBRARIES} )
+
+   ADD_EXECUTABLE( BinarySparseMatrixTest_SlicedEllpack BinarySparseMatrixTest_SlicedEllpack.cpp )
+   TARGET_COMPILE_OPTIONS( BinarySparseMatrixTest_SlicedEllpack PRIVATE ${CXX_TESTS_FLAGS} )
+   TARGET_LINK_LIBRARIES( BinarySparseMatrixTest_SlicedEllpack ${GTEST_BOTH_LIBRARIES} )
 
 ENDIF( BUILD_CUDA )
 
@@ -75,7 +89,9 @@ ADD_TEST( MultidiagonalMatrixTest ${EXECUTABLE_OUTPUT_PATH}/MultidiagonalMatrixT
 ADD_TEST( SparseMatrixTest_CSR ${EXECUTABLE_OUTPUT_PATH}/SparseMatrixTest_CSR${CMAKE_EXECUTABLE_SUFFIX} )
 ADD_TEST( SparseMatrixTest_Ellpack ${EXECUTABLE_OUTPUT_PATH}/SparseMatrixTest_Ellpack${CMAKE_EXECUTABLE_SUFFIX} )
 ADD_TEST( SparseMatrixTest_SlicedEllpack ${EXECUTABLE_OUTPUT_PATH}/SparseMatrixTest_SlicedEllpack${CMAKE_EXECUTABLE_SUFFIX} )
-ADD_TEST( BinarySparseMatrixTest ${EXECUTABLE_OUTPUT_PATH}/BinarySparseMatrixTest${CMAKE_EXECUTABLE_SUFFIX} )
+ADD_TEST( BinarySparseMatrixTest_CSR ${EXECUTABLE_OUTPUT_PATH}/BinarySparseMatrixTest_CSR${CMAKE_EXECUTABLE_SUFFIX} )
+ADD_TEST( BinarySparseMatrixTest_Ellpack ${EXECUTABLE_OUTPUT_PATH}/BinarySparseMatrixTest_Ellpack${CMAKE_EXECUTABLE_SUFFIX} )
+ADD_TEST( BinarySparseMatrixTest_SlicedEllpack ${EXECUTABLE_OUTPUT_PATH}/BinarySparseMatrixTest_SlicedEllpack${CMAKE_EXECUTABLE_SUFFIX} )
 
 if( ${BUILD_MPI} )
    if( BUILD_CUDA )
diff --git a/src/UnitTests/Matrices/SparseMatrixTest_CSR.cu b/src/UnitTests/Matrices/SparseMatrixTest_CSR.cu
index 771c74b9a2..258ad2c538 100644
--- a/src/UnitTests/Matrices/SparseMatrixTest_CSR.cu
+++ b/src/UnitTests/Matrices/SparseMatrixTest_CSR.cu
@@ -1 +1 @@
-#include "SparseMatrixTest_CSR_segments.h"
+#include "SparseMatrixTest_CSR.h"
diff --git a/src/UnitTests/Matrices/SparseMatrixTest_CSR.h b/src/UnitTests/Matrices/SparseMatrixTest_CSR.h
index 1e89d544a7..781735e7f5 100644
--- a/src/UnitTests/Matrices/SparseMatrixTest_CSR.h
+++ b/src/UnitTests/Matrices/SparseMatrixTest_CSR.h
@@ -1,5 +1,5 @@
 /***************************************************************************
-                          SparseMatrixTest_CSR_segments.h -  description
+                          SparseMatrixTest_CSR.h -  description
                              -------------------
     begin                : Dec 2, 2019
     copyright            : (C) 2019 by Tomas Oberhuber et al.
diff --git a/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.cu b/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.cu
index 63219e9b07..c454706f0b 100644
--- a/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.cu
+++ b/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.cu
@@ -1 +1 @@
-#include "SparseMatrixTest_Ellpack_segments.h"
+#include "SparseMatrixTest_Ellpack.h"
diff --git a/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.h b/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.h
index 32678c2b0c..9650105f60 100644
--- a/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.h
+++ b/src/UnitTests/Matrices/SparseMatrixTest_Ellpack.h
@@ -1,5 +1,5 @@
 /***************************************************************************
-                          SparseMatrixTest_Ellpack_segments.h -  description
+                          SparseMatrixTest_Ellpack.h -  description
                              -------------------
     begin                : Dec 3, 2019
     copyright            : (C) 2019 by Tomas Oberhuber et al.
diff --git a/src/UnitTests/Matrices/SparseMatrixTest_SlicedEllpack.cu b/src/UnitTests/Matrices/SparseMatrixTest_SlicedEllpack.cu
index a88301100d..40e2e94b81 100644
--- a/src/UnitTests/Matrices/SparseMatrixTest_SlicedEllpack.cu
+++ b/src/UnitTests/Matrices/SparseMatrixTest_SlicedEllpack.cu
@@ -1 +1 @@
-#include "SparseMatrixTest_SlicedEllpack_segments.h"
+#include "SparseMatrixTest_SlicedEllpack.h"
-- 
GitLab