Loading Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ int main( int argc, char* argv[] ) /*** * Lambda functions defining the matrix. */ auto rowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return 1; }; auto compressedRowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return 1; }; auto matrixElements1 = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) { columnIdx = rowIdx; value = 1.0; Loading @@ -21,13 +21,13 @@ int main( int argc, char* argv[] ) /*** * Matrix construction with explicit type definition. */ using MatrixType = decltype( TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements1, rowLengths ) ); MatrixType m1( size, size, matrixElements1, rowLengths ); using MatrixType = decltype( TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements1, compressedRowLengths ) ); MatrixType m1( size, size, matrixElements1, compressedRowLengths ); /*** * Matrix construction using 'auto'. */ auto m2 = TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements2, rowLengths ); auto m2 = TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements2, compressedRowLengths ); m2.setDimensions( size, size ); std::cout << "The first lambda matrix: " << std::endl << m1 << std::endl; Loading Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllRows.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -10,14 +10,14 @@ void forRowsExample() /*** * Lambda functions defining the matrix. */ auto rowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return columns; }; auto compressedRowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return columns; }; auto matrixElements = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) { columnIdx = localIdx; value = TNL::max( rowIdx - columnIdx + 1, 0 ); }; using MatrixFactory = TNL::Matrices::LambdaMatrixFactory< double, Device, int >; auto matrix = MatrixFactory::create( 5, 5, matrixElements, rowLengths ); auto matrix = MatrixFactory::create( 5, 5, matrixElements, compressedRowLengths ); TNL::Matrices::DenseMatrix< double, Device > denseMatrix( 5, 5 ); auto denseView = denseMatrix.getView(); Loading Loading
Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_Constructor.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ int main( int argc, char* argv[] ) /*** * Lambda functions defining the matrix. */ auto rowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return 1; }; auto compressedRowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return 1; }; auto matrixElements1 = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) { columnIdx = rowIdx; value = 1.0; Loading @@ -21,13 +21,13 @@ int main( int argc, char* argv[] ) /*** * Matrix construction with explicit type definition. */ using MatrixType = decltype( TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements1, rowLengths ) ); MatrixType m1( size, size, matrixElements1, rowLengths ); using MatrixType = decltype( TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements1, compressedRowLengths ) ); MatrixType m1( size, size, matrixElements1, compressedRowLengths ); /*** * Matrix construction using 'auto'. */ auto m2 = TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements2, rowLengths ); auto m2 = TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::Host, int >::create( matrixElements2, compressedRowLengths ); m2.setDimensions( size, size ); std::cout << "The first lambda matrix: " << std::endl << m1 << std::endl; Loading
Documentation/Examples/Matrices/LambdaMatrix/LambdaMatrixExample_forAllRows.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -10,14 +10,14 @@ void forRowsExample() /*** * Lambda functions defining the matrix. */ auto rowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return columns; }; auto compressedRowLengths = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx ) -> int { return columns; }; auto matrixElements = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) { columnIdx = localIdx; value = TNL::max( rowIdx - columnIdx + 1, 0 ); }; using MatrixFactory = TNL::Matrices::LambdaMatrixFactory< double, Device, int >; auto matrix = MatrixFactory::create( 5, 5, matrixElements, rowLengths ); auto matrix = MatrixFactory::create( 5, 5, matrixElements, compressedRowLengths ); TNL::Matrices::DenseMatrix< double, Device > denseMatrix( 5, 5 ); auto denseView = denseMatrix.getView(); Loading