Commit 60958e9a authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Writting documentation on LambdaMatrix.

parent eb12d705
Loading
Loading
Loading
Loading
+60 −273
Original line number Diff line number Diff line
IF( BUILD_CUDA )
#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_Constructor_init_list_cuda SparseMatrixExample_Constructor_init_list.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_Constructor_init_list_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_Constructor_init_list.out
#                       OUTPUT SparseMatrixExample_Constructor_init_list.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_setElements_cuda SparseMatrixExample_setElements.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_setElements_cuda > 
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_setElements.out
#                       OUTPUT SparseMatrixExample_setElements.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_getCompressedRowLengths_cuda SparseMatrixExample_getCompressedRowLengths.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getCompressedRowLengths_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getCompressedRowLengths.out
#                       OUTPUT SparseMatrixExample_getCompressedRowLengths.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_getElementsCount_cuda SparseMatrixExample_getElementsCount.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getElementsCount_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getElementsCount.out
#                       OUTPUT SparseMatrixExample_getElementsCount.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_getConstRow_cuda SparseMatrixExample_getConstRow.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getConstRow_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getConstRow.out
#                       OUTPUT SparseMatrixExample_getConstRow.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_getRow_cuda SparseMatrixExample_getRow.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getRow_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getRow.out
#                       OUTPUT SparseMatrixExample_getRow.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_setElement_cuda SparseMatrixExample_setElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_setElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_setElement.out
#                       OUTPUT SparseMatrixExample_setElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_addElement_cuda SparseMatrixExample_addElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_addElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_addElement.out
#                       OUTPUT SparseMatrixExample_addElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_getElement_cuda SparseMatrixExample_getElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getElement.out
#                       OUTPUT SparseMatrixExample_getElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_rowsReduction_cuda SparseMatrixExample_rowsReduction.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_rowsReduction_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_rowsReduction.out
#                       OUTPUT SparseMatrixExample_rowsReduction.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_allRowsReduction_cuda SparseMatrixExample_allRowsReduction.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_allRowsReduction_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_allRowsReduction.out
#                       OUTPUT SparseMatrixExample_allRowsReduction.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_forRows_cuda SparseMatrixExample_forRows.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_forRows_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_forRows.out
#                       OUTPUT SparseMatrixExample_forRows.out )
ADD_EXECUTABLE( LambdaMatrixExample_Constructor LambdaMatrixExample_Constructor.cpp )
ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_Constructor >
                     ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_Constructor.out
                    OUTPUT LambdaMatrixExample_Constructor.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixExample_forAllRows_cuda SparseMatrixExample_forAllRows.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_forAllRows_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_forAllRows.out
#                       OUTPUT SparseMatrixExample_forAllRows.out )
ADD_EXECUTABLE( LambdaMatrixExample_getCompressedRowLengths LambdaMatrixExample_getCompressedRowLengths.cpp )
ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_getCompressedRowLengths >
                     ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_getCompressedRowLengths.out
                    OUTPUT LambdaMatrixExample_getCompressedRowLengths.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_constructor_cuda SparseMatrixViewExample_constructor.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_constructor_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_constructor.out
#                       OUTPUT SparseMatrixViewExample_constructor.out )
ADD_EXECUTABLE( LambdaMatrixExample_getNonzeroElementsCount LambdaMatrixExample_getNonzeroElementsCount.cpp )
ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_getNonzeroElementsCount >
                     ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_getNonzeroElementsCount.out
                    OUTPUT LambdaMatrixExample_getNonzeroElementsCount.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_getCompressedRowLengths_cuda SparseMatrixViewExample_getCompressedRowLengths.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getCompressedRowLengths_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getCompressedRowLengths.out
#                       OUTPUT SparseMatrixViewExample_getCompressedRowLengths.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_getElementsCount_cuda SparseMatrixViewExample_getElementsCount.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getElementsCount_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getElementsCount.out
#                       OUTPUT SparseMatrixViewExample_getElementsCount.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_getConstRow_cuda SparseMatrixViewExample_getConstRow.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getConstRow_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getConstRow.out
#                       OUTPUT SparseMatrixViewExample_getConstRow.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_getRow_cuda SparseMatrixViewExample_getRow.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getRow_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getRow.out
#                       OUTPUT SparseMatrixViewExample_getRow.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_setElement_cuda SparseMatrixViewExample_setElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_setElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_setElement.out
#                       OUTPUT SparseMatrixViewExample_setElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_addElement_cuda SparseMatrixViewExample_addElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_addElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_addElement.out
#                       OUTPUT SparseMatrixViewExample_addElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_getElement_cuda SparseMatrixViewExample_getElement.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getElement_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getElement.out
#                       OUTPUT SparseMatrixViewExample_getElement.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_rowsReduction_cuda SparseMatrixViewExample_rowsReduction.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_rowsReduction_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_rowsReduction.out
#                       OUTPUT SparseMatrixViewExample_rowsReduction.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_allRowsReduction_cuda SparseMatrixViewExample_allRowsReduction.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_allRowsReduction_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_allRowsReduction.out
#                       OUTPUT SparseMatrixViewExample_allRowsReduction.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_forRows_cuda SparseMatrixViewExample_forRows.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_forRows_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_forRows.out
#                       OUTPUT SparseMatrixViewExample_forRows.out )

#   CUDA_ADD_EXECUTABLE( SparseMatrixViewExample_forAllRows_cuda SparseMatrixViewExample_forAllRows.cu )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_forAllRows_cuda >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_forAllRows.out
#                       OUTPUT SparseMatrixViewExample_forAllRows.out )
IF( BUILD_CUDA )
   CUDA_ADD_EXECUTABLE( LambdaMatrixExample_rowsReduction_cuda LambdaMatrixExample_rowsReduction.cu )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_rowsReduction_cuda >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_rowsReduction.out
                       OUTPUT LambdaMatrixExample_rowsReduction.out )

   CUDA_ADD_EXECUTABLE( LambdaMatrixExample_allRowsReduction_cuda LambdaMatrixExample_allRowsReduction.cu )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_allRowsReduction_cuda >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_allRowsReduction.out
                       OUTPUT LambdaMatrixExample_allRowsReduction.out )

   CUDA_ADD_EXECUTABLE( LambdaMatrixExample_forRows_cuda LambdaMatrixExample_forRows.cu )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_forRows_cuda >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_forRows.out
                       OUTPUT LambdaMatrixExample_forRows.out )

   CUDA_ADD_EXECUTABLE( LambdaMatrixExample_forAllRows_cuda LambdaMatrixExample_forAllRows.cu )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_forAllRows_cuda >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_forAllRows.out
                       OUTPUT LambdaMatrixExample_forAllRows.out )

ELSE()
#   ADD_EXECUTABLE( SparseMatrixExample_Constructor_init_list SparseMatrixExample_Constructor_init_list.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_Constructor_init_list >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_Constructor_init_list.out
#                       OUTPUT SparseMatrixExample_Constructor_init_list.out )

#   ADD_EXECUTABLE( SparseMatrixExample_setElements SparseMatrixExample_setElements.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_setElements > 
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_setElements.out
#                       OUTPUT SparseMatrixExample_setElements.out )

#   ADD_EXECUTABLE( SparseMatrixExample_getCompressedRowLengths SparseMatrixExample_getCompressedRowLengths.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getCompressedRowLengths >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getCompressedRowLengths.out
#                       OUTPUT SparseMatrixExample_getCompressedRowLengths.out )

#   ADD_EXECUTABLE( SparseMatrixExample_getElementsCount SparseMatrixExample_getElementsCount.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getElementsCount >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getElementsCount.out
#                       OUTPUT SparseMatrixExample_getElementsCount.out )

#   ADD_EXECUTABLE( SparseMatrixExample_getConstRow SparseMatrixExample_getConstRow.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getConstRow >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getConstRow.out
#                       OUTPUT SparseMatrixExample_getConstRow.out )

#   ADD_EXECUTABLE( SparseMatrixExample_getRow SparseMatrixExample_getRow.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getRow >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getRow.out
#                       OUTPUT SparseMatrixExample_getRow.out )

#   ADD_EXECUTABLE( SparseMatrixExample_setElement SparseMatrixExample_setElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_setElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_setElement.out
#                       OUTPUT SparseMatrixExample_setElement.out )

#   ADD_EXECUTABLE( SparseMatrixExample_addElement SparseMatrixExample_addElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_addElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_addElement.out
#                       OUTPUT SparseMatrixExample_addElement.out )

#   ADD_EXECUTABLE( SparseMatrixExample_getElement SparseMatrixExample_getElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_getElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_getElement.out
#                       OUTPUT SparseMatrixExample_getElement.out )

#   ADD_EXECUTABLE( SparseMatrixExample_rowsReduction SparseMatrixExample_rowsReduction.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_rowsReduction >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_rowsReduction.out
#                       OUTPUT SparseMatrixExample_rowsReduction.out )

#   ADD_EXECUTABLE( SparseMatrixExample_allRowsReduction SparseMatrixExample_allRowsReduction.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_allRowsReduction >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_allRowsReduction.out
#                       OUTPUT SparseMatrixExample_allRowsReduction.out )

#   ADD_EXECUTABLE( SparseMatrixExample_forRows SparseMatrixExample_forRows.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_forRows >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_forRows.out
#                       OUTPUT SparseMatrixExample_forRows.out )

#   ADD_EXECUTABLE( SparseMatrixExample_forAllRows SparseMatrixExample_forAllRows.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixExample_forAllRows >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixExample_forAllRows.out
#                       OUTPUT SparseMatrixExample_forAllRows.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_constructor SparseMatrixViewExample_constructor.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_constructor >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_constructor.out
#                       OUTPUT SparseMatrixViewExample_constructor.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_getCompressedRowLengths SparseMatrixViewExample_getCompressedRowLengths.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getCompressedRowLengths >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getCompressedRowLengths.out
#                       OUTPUT SparseMatrixViewExample_getCompressedRowLengths.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_getElementsCount SparseMatrixViewExample_getElementsCount.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getElementsCount >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getElementsCount.out
#                       OUTPUT SparseMatrixViewExample_getElementsCount.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_getConstRow SparseMatrixViewExample_getConstRow.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getConstRow >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getConstRow.out
#                       OUTPUT SparseMatrixViewExample_getConstRow.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_getRow SparseMatrixViewExample_getRow.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getRow >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getRow.out
#                       OUTPUT SparseMatrixViewExample_getRow.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_setElement SparseMatrixViewExample_setElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_setElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_setElement.out
#                       OUTPUT SparseMatrixViewExample_setElement.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_addElement SparseMatrixViewExample_addElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_addElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_addElement.out
#                       OUTPUT SparseMatrixViewExample_addElement.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_getElement SparseMatrixViewExample_getElement.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_getElement >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_getElement.out
#                       OUTPUT SparseMatrixViewExample_getElement.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_rowsReduction SparseMatrixViewExample_rowsReduction.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_rowsReduction >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_rowsReduction.out
#                       OUTPUT SparseMatrixViewExample_rowsReduction.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_allRowsReduction SparseMatrixViewExample_allRowsReduction.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_allRowsReduction >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_allRowsReduction.out
#                       OUTPUT SparseMatrixViewExample_allRowsReduction.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_forRows SparseMatrixViewExample_forRows.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_forRows >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_forRows.out
#                       OUTPUT SparseMatrixViewExample_forRows.out )

#   ADD_EXECUTABLE( SparseMatrixViewExample_forAllRows SparseMatrixViewExample_forAllRows.cpp )
#   ADD_CUSTOM_COMMAND( COMMAND SparseMatrixViewExample_forAllRows >
#                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/SparseMatrixViewExample_forAllRows.out
#                       OUTPUT SparseMatrixViewExample_forAllRows.out )

   ADD_EXECUTABLE( LambdaMatrixExample_rowsReduction LambdaMatrixExample_rowsReduction.cpp )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_rowsReduction >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_rowsReduction.out
                       OUTPUT LambdaMatrixExample_rowsReduction.out )

   ADD_EXECUTABLE( LambdaMatrixExample_allRowsReduction LambdaMatrixExample_allRowsReduction.cpp )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_allRowsReduction >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_allRowsReduction.out
                       OUTPUT LambdaMatrixExample_allRowsReduction.out )

   ADD_EXECUTABLE( LambdaMatrixExample_forRows LambdaMatrixExample_forRows.cpp )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_forRows >
                       ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_forRows.out
                       OUTPUT LambdaMatrixExample_forRows.out )

   ADD_EXECUTABLE( LambdaMatrixExample_forAllRows LambdaMatrixExample_forAllRows.cpp )
   ADD_CUSTOM_COMMAND( COMMAND LambdaMatrixExample_forAllRows >
                        ${TNL_DOCUMENTATION_OUTPUT_SNIPPETS_PATH}/LambdaMatrixExample_forAllRows.out
                       OUTPUT LambdaMatrixExample_forAllRows.out )
ENDIF()

#ADD_CUSTOM_TARGET( RunMatricesExamples ALL DEPENDS
#   SparseMatrixExample_Constructor_init_list.out
#   SparseMatrixExample_setElements.out
#   SparseMatrixExample_getCompressedRowLengths.out
#   SparseMatrixExample_getElementsCount.out
#   SparseMatrixExample_getConstRow.out
#   SparseMatrixExample_getRow.out
#   SparseMatrixExample_setElement.out
#   SparseMatrixExample_addElement.out
#   SparseMatrixExample_getElement.out
#   SparseMatrixExample_rowsReduction.out
#   SparseMatrixExample_allRowsReduction.out
#   SparseMatrixExample_forRows.out
#   SparseMatrixExample_forAllRows.out
#   SparseMatrixViewExample_constructor.out
#   SparseMatrixViewExample_getCompressedRowLengths.out
#   SparseMatrixViewExample_getElementsCount.out
#   SparseMatrixViewExample_getConstRow.out
#   SparseMatrixViewExample_getRow.out
#   SparseMatrixViewExample_setElement.out
#   SparseMatrixViewExample_addElement.out
#   SparseMatrixViewExample_getElement.out
#   SparseMatrixViewExample_rowsReduction.out
#   SparseMatrixViewExample_allRowsReduction.out
#   SparseMatrixViewExample_forRows.out
#   SparseMatrixViewExample_forAllRows.out
#)
ADD_CUSTOM_TARGET( RunLambdaMatricesExamples ALL DEPENDS
   LambdaMatrixExample_Constructor.out
   LambdaMatrixExample_getCompressedRowLengths.out
   LambdaMatrixExample_getNonzeroElementsCount.out
   LambdaMatrixExample_rowsReduction.out
   LambdaMatrixExample_allRowsReduction.out
   LambdaMatrixExample_forRows.out
   LambdaMatrixExample_forAllRows.out
)
+35 −0
Original line number Diff line number Diff line
#include <iostream>
#include <TNL/Matrices/LambdaMatrix.h>

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 matrixElements1 = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) {
         columnIdx = rowIdx;
         value =  1.0;
   };
   auto matrixElements2 = [=] __cuda_callable__ ( const int rows, const int columns, const int rowIdx, const int localIdx, int& columnIdx, double& value ) {
         columnIdx = rowIdx;
         value =  rowIdx;
   };

   const int size = 5;

   /***
    * Matrix construction with explicit type definition.
    */
   using MatrixType = decltype( TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::AnyDevice, int >::create( matrixElements1, rowLengths ) );
   MatrixType m1( size, size, matrixElements1, rowLengths );

   /***
    * Matrix construction using 'auto'.
    */
   auto m2 = TNL::Matrices::LambdaMatrixFactory< double, TNL::Devices::AnyDevice, int >::create( matrixElements2, rowLengths );
   m2.setDimensions( size, size );

   std::cout << "The first lambda matrix: " << std::endl << m1 << std::endl;
   std::cout << "The second lambda matrix: " << std::endl << m2 << std::endl;
}
+72 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
LambdaMatrixExample_allRowsReduction.cpp
 No newline at end of file
+43 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading