Loading Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_rowsReduction.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ void rowsReduction() /*** * Reduce lambda return maximum of given values. */ auto reduce = [=] __cuda_callable__ ( double& a, const double& b ) -> double { auto reduce = [=] __cuda_callable__ ( const double& a, const double& b ) -> double { return TNL::max( a, b ); }; Loading Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ void forRowsExample() * Set the following matrix (dots represent zero matrix elements and zeros are * padding zeros for memory alignment): * * 0 / 1 3 . . . \ -> { 0, 1, 3 } * | 2 1 3 . . | -> { 2, 1, 3 } * | . 2 1 3 . | -> { 2, 1, 3 } * | . . 2 1 3 | -> { 2, 1, 3 } * \ . . . 2 1 / 0 -> { 2, 1, 0 } * 0 / 2 1 . . . \ -> { 0, 2, 1 } * | 3 2 1 . . | -> { 3, 2, 1 } * | . 3 2 1 . | -> { 3, 2, 1 } * | . . 3 2 1 | -> { 3, 2, 1 } * \ . . . 3 2 / 0 -> { 3, 2, 0 } */ TNL::Matrices::TridiagonalMatrix< double, Device > matrix( 5, // number of matrix rows Loading @@ -29,11 +29,11 @@ void forRowsExample() * * 0 1 2 <- localIdx values * ------- * 0 / 1 3 . . . \ -> { 0, 1, 3 } * | 2 1 3 . . | -> { 2, 1, 3 } * | . 2 1 3 . | -> { 2, 1, 3 } * | . . 2 1 3 | -> { 2, 1, 3 } * \ . . . 2 1 / 0 -> { 2, 1, 0 } * 0 / 2 1 . . . \ -> { 0, 2, 1 } * | 3 2 1 . . | -> { 3, 2, 1 } * | . 3 2 1 . | -> { 3, 2, 1 } * | . . 3 2 1 | -> { 3, 2, 1 } * \ . . . 3 2 / 0 -> { 3, 2, 0 } * */ value = 3 - localIdx; Loading src/TNL/Matrices/TridiagonalMatrixView.hpp +18 −18 Original line number Diff line number Diff line Loading @@ -98,8 +98,8 @@ getCompressedRowLengths( Vector& rowLengths ) const auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType { return ( value != 0.0 ); }; auto reduce = [] __cuda_callable__ ( IndexType& aux, const IndexType a ) { aux += a; auto reduce = [] __cuda_callable__ ( const IndexType& aux, const IndexType a ) -> IndexType { return aux + a; }; auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable { rowLengths_view[ rowIdx ] = value; Loading Loading @@ -275,23 +275,23 @@ rowsReduction( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Ke Real_ sum( zero ); if( rowIdx == 0 ) { reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); keep( 0, sum ); return; } if( rowIdx + 1 < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); keep( rowIdx, sum ); return; } if( rowIdx < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); keep( rowIdx, sum ); } else Loading Loading @@ -319,23 +319,23 @@ rowsReduction( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Ke Real_ sum( zero ); if( rowIdx == 0 ) { reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); keep( 0, sum ); return; } if( rowIdx + 1 < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); keep( rowIdx, sum ); return; } if( rowIdx < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); keep( rowIdx, sum ); } else Loading Loading @@ -487,8 +487,8 @@ vectorProduct( const InVector& inVector, auto fetch = [=] __cuda_callable__ ( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType { return value * inVectorView[ column ]; }; auto reduction = [] __cuda_callable__ ( RealType& sum, const RealType& value ) { sum += value; auto reduction = [] __cuda_callable__ ( const RealType& sum, const RealType& value ) -> RealType { return sum + value; }; auto keeper1 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable { outVectorView[ row ] = value; Loading Loading
Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixExample_rowsReduction.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,7 @@ void rowsReduction() /*** * Reduce lambda return maximum of given values. */ auto reduce = [=] __cuda_callable__ ( double& a, const double& b ) -> double { auto reduce = [=] __cuda_callable__ ( const double& a, const double& b ) -> double { return TNL::max( a, b ); }; Loading
Documentation/Examples/Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_forRows.cpp +10 −10 Original line number Diff line number Diff line Loading @@ -10,11 +10,11 @@ void forRowsExample() * Set the following matrix (dots represent zero matrix elements and zeros are * padding zeros for memory alignment): * * 0 / 1 3 . . . \ -> { 0, 1, 3 } * | 2 1 3 . . | -> { 2, 1, 3 } * | . 2 1 3 . | -> { 2, 1, 3 } * | . . 2 1 3 | -> { 2, 1, 3 } * \ . . . 2 1 / 0 -> { 2, 1, 0 } * 0 / 2 1 . . . \ -> { 0, 2, 1 } * | 3 2 1 . . | -> { 3, 2, 1 } * | . 3 2 1 . | -> { 3, 2, 1 } * | . . 3 2 1 | -> { 3, 2, 1 } * \ . . . 3 2 / 0 -> { 3, 2, 0 } */ TNL::Matrices::TridiagonalMatrix< double, Device > matrix( 5, // number of matrix rows Loading @@ -29,11 +29,11 @@ void forRowsExample() * * 0 1 2 <- localIdx values * ------- * 0 / 1 3 . . . \ -> { 0, 1, 3 } * | 2 1 3 . . | -> { 2, 1, 3 } * | . 2 1 3 . | -> { 2, 1, 3 } * | . . 2 1 3 | -> { 2, 1, 3 } * \ . . . 2 1 / 0 -> { 2, 1, 0 } * 0 / 2 1 . . . \ -> { 0, 2, 1 } * | 3 2 1 . . | -> { 3, 2, 1 } * | . 3 2 1 . | -> { 3, 2, 1 } * | . . 3 2 1 | -> { 3, 2, 1 } * \ . . . 3 2 / 0 -> { 3, 2, 0 } * */ value = 3 - localIdx; Loading
src/TNL/Matrices/TridiagonalMatrixView.hpp +18 −18 Original line number Diff line number Diff line Loading @@ -98,8 +98,8 @@ getCompressedRowLengths( Vector& rowLengths ) const auto fetch = [] __cuda_callable__ ( IndexType row, IndexType column, const RealType& value ) -> IndexType { return ( value != 0.0 ); }; auto reduce = [] __cuda_callable__ ( IndexType& aux, const IndexType a ) { aux += a; auto reduce = [] __cuda_callable__ ( const IndexType& aux, const IndexType a ) -> IndexType { return aux + a; }; auto keep = [=] __cuda_callable__ ( const IndexType rowIdx, const IndexType value ) mutable { rowLengths_view[ rowIdx ] = value; Loading Loading @@ -275,23 +275,23 @@ rowsReduction( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Ke Real_ sum( zero ); if( rowIdx == 0 ) { reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); keep( 0, sum ); return; } if( rowIdx + 1 < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); keep( rowIdx, sum ); return; } if( rowIdx < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); keep( rowIdx, sum ); } else Loading Loading @@ -319,23 +319,23 @@ rowsReduction( IndexType first, IndexType last, Fetch& fetch, Reduce& reduce, Ke Real_ sum( zero ); if( rowIdx == 0 ) { reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); sum = reduce( sum, fetch( 0, 1, values_view[ indexer.getGlobalIndex( 0, 1 ) ] ) ); sum = reduce( sum, fetch( 0, 2, values_view[ indexer.getGlobalIndex( 0, 2 ) ] ) ); keep( 0, sum ); return; } if( rowIdx + 1 < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx + 1, values_view[ indexer.getGlobalIndex( rowIdx, 2 ) ] ) ); keep( rowIdx, sum ); return; } if( rowIdx < indexer.getColumns() ) { reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx - 1, values_view[ indexer.getGlobalIndex( rowIdx, 0 ) ] ) ); sum = reduce( sum, fetch( rowIdx, rowIdx, values_view[ indexer.getGlobalIndex( rowIdx, 1 ) ] ) ); keep( rowIdx, sum ); } else Loading Loading @@ -487,8 +487,8 @@ vectorProduct( const InVector& inVector, auto fetch = [=] __cuda_callable__ ( const IndexType& row, const IndexType& column, const RealType& value ) -> RealType { return value * inVectorView[ column ]; }; auto reduction = [] __cuda_callable__ ( RealType& sum, const RealType& value ) { sum += value; auto reduction = [] __cuda_callable__ ( const RealType& sum, const RealType& value ) -> RealType { return sum + value; }; auto keeper1 = [=] __cuda_callable__ ( IndexType row, const RealType& value ) mutable { outVectorView[ row ] = value; Loading