Commit 28880a18 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Writing documentation for tridiagonal matrix row view.

parent 3f5dab9f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,12 +22,12 @@ namespace TNL {
 * See \ref DenseMatrix and \ref DenseMatrixView.
 * 
 * \par Example
 * \include Matrices/DenseMatrixExample_getRow.cpp
 * \include Matrices/DenseMatrix/DenseMatrixExample_getRow.cpp
 * \par Output
 * \include DenseMatrixExample_getRow.out
 * 
 * \par Example
 * \include Matrices/DenseMatrixViewExample_getRow.cpp
 * \include Matrices/DenseMatrix/DenseMatrixViewExample_getRow.cpp
 * \par Output
 * \include DenseMatrixViewExample_getRow.out
 */
+2 −2
Original line number Diff line number Diff line
@@ -25,12 +25,12 @@ namespace Matrices {
 * See \ref MultidiagonalMatrix and \ref MultidiagonalMatrixView.
 * 
 * \par Example
 * \include Matrices/MultidiagonalMatrixExample_getRow.cpp
 * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixExample_getRow.cpp
 * \par Output
 * \include MultidiagonalatrixExample_getRow.out
 * 
 * \par Example
 * \include Matrices/MultidiagonalMatrixViewExample_getRow.cpp
 * \include Matrices/MultidiagonalMatrix/MultidiagonalMatrixViewExample_getRow.cpp
 * \par Output
 * \include MultidiagonalMatrixViewExample_getRow.out
 */
+2 −2
Original line number Diff line number Diff line
@@ -28,12 +28,12 @@ namespace Matrices {
 * See \ref SparseMatrix and \ref SparseMatrixView.
 * 
 * \par Example
 * \include Matrices/SparseMatrixExample_getRow.cpp
 * \include Matrices/SparseMatrix/SparseMatrixExample_getRow.cpp
 * \par Output
 * \include SparseMatrixExample_getRow.out
 * 
 * \par Example
 * \include Matrices/SparseMatrixViewExample_getRow.cpp
 * \include Matrices/SparseMatrix/SparseMatrixViewExample_getRow.cpp
 * \par Output
 * \include SparseMatrixViewExample_getRow.out
 */
+74 −0
Original line number Diff line number Diff line
@@ -13,34 +13,108 @@
namespace TNL {
namespace Matrices {   

/**
 * \brief RowView is a simple structure for accessing rows of tridiagonal matrix.
 * 
 * \tparam ValuesView is a vector view storing the matrix elements values.
 * \tparam Indexer is type of object responsible for indexing and organization of
 *    matrix elements.
 * 
 * See \ref TridiagonalMatrix and \ref TridiagonalMatrixView.
 * 
 * \par Example
 * \include Matrices/TridiagonalMatrix/TridiagonalMatrixExample_getRow.cpp
 * \par Output
 * \include TridiagonalatrixExample_getRow.out
 * 
 * \par Example
 * \include Matrices/TridiagonalMatrix/TridiagonalMatrixViewExample_getRow.cpp
 * \par Output
 * \include TridiagonalMatrixViewExample_getRow.out
 */
template< typename ValuesView,
          typename Indexer >
class TridiagonalMatrixRowView
{
   public:

      /**
       * \brief The type of matrix elements.
       */
      using RealType = typename ValuesView::RealType;

      /**
       * \brief The type used for matrix elements indexing.
       */
      using IndexType = typename ValuesView::IndexType;

      /**
       * \brief Type of container view used for storing the matrix elements values.
       */
      using ValuesViewType = ValuesView;

      /**
       * \brief Type of object responsible for indexing and organization of
       * matrix elements.
       */
      using IndexerType = Indexer;

      /**
       * \brief Constructor with all necessary data.
       * 
       * \param rowIdx is index of the matrix row this RowView refer to.
       * \param values is a vector view holding values of matrix elements.
       * \param indexer is object responsible for indexing and organization of matrix elements
       */
      __cuda_callable__
      TridiagonalMatrixRowView( const IndexType rowIdx,
                                const ValuesViewType& values,
                                const IndexerType& indexer );

      /**
       * \brief Returns number of diagonals of the tridiagonal matrix which is three.
       * 
       * \return number three.
       */
      __cuda_callable__
      IndexType getSize() const;

      /**
       * \brief Computes column index of matrix element on given subdiagonal.
       * 
       * \param localIdx is an index of the subdiagonal.
       * 
       * \return column index of matrix element on given subdiagonal.
       */
      __cuda_callable__
      const IndexType getColumnIndex( const IndexType localIdx ) const;

      /**
       * \brief Returns value of matrix element on given subdiagonal.
       * 
       * \param localIdx is an index of the subdiagonal.
       * 
       * \return constant reference to matrix element value.
       */
      __cuda_callable__
      const RealType& getValue( const IndexType localIdx ) const;

      /**
       * \brief Returns value of matrix element on given subdiagonal.
       * 
       * \param localIdx is an index of the subdiagonal.
       * 
       * \return non-constant reference to matrix element value.
       */
      __cuda_callable__
      RealType& getValue( const IndexType localIdx );

      /**
       * \brief Changes value of matrix element on given subdiagonal.
       * 
       * \param localIdx is an index of the matrix subdiagonal.
       * \param value is the new value of the matrix element.
       */
      __cuda_callable__
      void setElement( const IndexType localIdx,
                       const RealType& value );
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class TridiagonalMatrixIndexer
      __cuda_callable__
      IndexType getRowSize( const IndexType rowIdx ) const
      {
         if( rowIdx == 0 )
         /*if( rowIdx == 0 )
            return 2;
         if( columns <= rows )
         {
@@ -54,7 +54,7 @@ class TridiagonalMatrixIndexer
               return 2;
            if( rowIdx == columns )
               return 1;
         }
         }*/
         return 3;
      };