diff --git a/src/TNL/Containers/Segments/CSRView.h b/src/TNL/Containers/Segments/CSRView.h index f7cf815d04eb87e411cd213e0b0ca659c60bbb6c..4e53bd204f35ac301b3382d6e2e43da19095af41 100644 --- a/src/TNL/Containers/Segments/CSRView.h +++ b/src/TNL/Containers/Segments/CSRView.h @@ -33,7 +33,7 @@ class CSRView template< typename Device_, typename Index_ > using ViewTemplate = CSRView< Device_, Index_ >; using ConstViewType = CSRView< Device, std::add_const_t< Index > >; - using SegmentViewType = SegmentView< IndexType >; + using SegmentViewType = SegmentView< IndexType, true >; __cuda_callable__ CSRView(); diff --git a/src/TNL/Containers/Segments/ChunkedEllpack.h b/src/TNL/Containers/Segments/ChunkedEllpack.h index 93580a9cdc7a877a259f84959754b7dd302cab29..c6c7812dba1ae98d9a75618bc5d4df93510c3a30 100644 --- a/src/TNL/Containers/Segments/ChunkedEllpack.h +++ b/src/TNL/Containers/Segments/ChunkedEllpack.h @@ -35,7 +35,7 @@ class ChunkedEllpack template< typename Device_, typename Index_ > using ViewTemplate = ChunkedEllpackView< Device_, Index_, RowMajorOrder >; using ConstViewType = ChunkedEllpackView< Device, std::add_const_t< Index >, RowMajorOrder >; - using SegmentViewType = SegmentView< IndexType, RowMajorOrder >; + using SegmentViewType = ChunkedEllpackSegmentView< IndexType, RowMajorOrder >; using ChunkedEllpackSliceInfoType = details::ChunkedEllpackSliceInfo< IndexType >; //TODO: using ChunkedEllpackSliceInfoAllocator = typename IndexAllocatorType::retype< ChunkedEllpackSliceInfoType >; using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >; diff --git a/src/TNL/Containers/Segments/ChunkedEllpackView.h b/src/TNL/Containers/Segments/ChunkedEllpackView.h index 4b444d08473a2763c2f50a7af5bf8fc70b5fef0e..eaf2450b5e3cd9b70ea632026ba3d7b045da121a 100644 --- a/src/TNL/Containers/Segments/ChunkedEllpackView.h +++ b/src/TNL/Containers/Segments/ChunkedEllpackView.h @@ -36,7 +36,7 @@ class ChunkedEllpackView template< typename Device_, typename Index_ > using ViewTemplate = ChunkedEllpackView< Device_, Index_ >; using ConstViewType = ChunkedEllpackView< Device, std::add_const_t< Index > >; - using SegmentViewType = ChunkedEllpackSegmentView< IndexType >; + using SegmentViewType = ChunkedEllpackSegmentView< IndexType, RowMajorOrder >; using ChunkedEllpackSliceInfoType = details::ChunkedEllpackSliceInfo< IndexType >; using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >; using ChunkedEllpackSliceInfoContainer = Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >; diff --git a/src/TNL/Containers/Segments/details/ChunkedEllpack.h b/src/TNL/Containers/Segments/details/ChunkedEllpack.h index 8807de226cf2d7648a95cc2d788b27a5775767ac..95ae00c88f3e62cfb2e11a3ef8ba55a704bf44a9 100644 --- a/src/TNL/Containers/Segments/details/ChunkedEllpack.h +++ b/src/TNL/Containers/Segments/details/ChunkedEllpack.h @@ -69,7 +69,7 @@ class ChunkedEllpack using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >; using ChunkedEllpackSliceInfoContainer = Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >; using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ViewType; - using SegmentViewType = ChunkedEllpackSegmentView< IndexType >; + using SegmentViewType = ChunkedEllpackSegmentView< IndexType, RowMajorOrder >; __cuda_callable__ static IndexType getSegmentSizeDirect( const OffsetsHolderView& segmentsToSlicesMapping, diff --git a/src/UnitTests/Matrices/SparseMatrixTest.hpp b/src/UnitTests/Matrices/SparseMatrixTest.hpp index d8856547247adacff6923af9bd13c2d767c59e12..8080d45e54553f53a2f02b502d3dee9b7a680426 100644 --- a/src/UnitTests/Matrices/SparseMatrixTest.hpp +++ b/src/UnitTests/Matrices/SparseMatrixTest.hpp @@ -69,6 +69,18 @@ void test_Constructors() EXPECT_EQ( m2.getElement( 3, 3 ), 1 ); EXPECT_EQ( m2.getElement( 4, 4 ), 1 ); // 4th row + if( std::is_same< DeviceType, TNL::Devices::Host >::value ) + { + EXPECT_EQ( m2.getRow( 0 ).getValue( 0 ), 1 ); // 0th row + EXPECT_EQ( m2.getRow( 1 ).getValue( 0 ), 1 ); // 1st row + EXPECT_EQ( m2.getRow( 1 ).getValue( 1 ), 1 ); + EXPECT_EQ( m2.getRow( 2 ).getValue( 0 ), 1 ); // 2nd row + EXPECT_EQ( m2.getRow( 2 ).getValue( 1 ), 1 ); + EXPECT_EQ( m2.getRow( 3 ).getValue( 0 ), 1 ); // 3rd row + EXPECT_EQ( m2.getRow( 3 ).getValue( 1 ), 1 ); + EXPECT_EQ( m2.getRow( 4 ).getValue( 0 ), 1 ); // 4th row + } + m2.getCompressedRowLengths( v1 ); EXPECT_EQ( v1, v2 );