Loading src/TNL/Matrices/MultidiagonalMatrixRowView.h +84 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,27 @@ namespace TNL { namespace Matrices { /** * \brief RowView is a simple structure for accessing rows of multidiagonal 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. * \tparam DiagonalsOffsetsView_ is a container view holding offsets of * diagonals of multidiagonal matrix. * * See \ref MultidiagonalMatrix and \ref MultidiagonalMatrixView. * * \par Example * \include Matrices/MultidiagonalMatrixExample_getRow.cpp * \par Output * \include MultidiagonalatrixExample_getRow.out * * \par Example * \include Matrices/MultidiagonalMatrixViewExample_getRow.cpp * \par Output * \include MultidiagonalMatrixViewExample_getRow.out */ template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView_ > Loading @@ -20,10 +41,31 @@ class MultidiagonalMatrixRowView { 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 Type of a container view holding offsets of * diagonals of multidiagonal matrix. */ using DiagonalsOffsetsView = DiagonalsOffsetsView_; /** Loading @@ -46,24 +88,64 @@ class MultidiagonalMatrixRowView */ using ConstViewType = MultidiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType, ConstDiagonalsOffsetsViewType >; /** * \brief Constructor with all necessary data. * * \param rowIdx is index of the matrix row this RowView refer to. * \param diagonalsOffsets is a vector view holding offsets of matrix diagonals, * \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__ MultidiagonalMatrixRowView( const IndexType rowIdx, const DiagonalsOffsetsView& diagonalsOffsets, const ValuesViewType& values, const IndexerType& indexer ); /** * \brief Returns number of diagonals of the multidiagonal matrix. * * \return number of diagonals of the multidiagonal matrix. */ __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 ); Loading Loading
src/TNL/Matrices/MultidiagonalMatrixRowView.h +84 −2 Original line number Diff line number Diff line Loading @@ -13,6 +13,27 @@ namespace TNL { namespace Matrices { /** * \brief RowView is a simple structure for accessing rows of multidiagonal 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. * \tparam DiagonalsOffsetsView_ is a container view holding offsets of * diagonals of multidiagonal matrix. * * See \ref MultidiagonalMatrix and \ref MultidiagonalMatrixView. * * \par Example * \include Matrices/MultidiagonalMatrixExample_getRow.cpp * \par Output * \include MultidiagonalatrixExample_getRow.out * * \par Example * \include Matrices/MultidiagonalMatrixViewExample_getRow.cpp * \par Output * \include MultidiagonalMatrixViewExample_getRow.out */ template< typename ValuesView, typename Indexer, typename DiagonalsOffsetsView_ > Loading @@ -20,10 +41,31 @@ class MultidiagonalMatrixRowView { 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 Type of a container view holding offsets of * diagonals of multidiagonal matrix. */ using DiagonalsOffsetsView = DiagonalsOffsetsView_; /** Loading @@ -46,24 +88,64 @@ class MultidiagonalMatrixRowView */ using ConstViewType = MultidiagonalMatrixRowView< ConstValuesViewType, ConstIndexerViewType, ConstDiagonalsOffsetsViewType >; /** * \brief Constructor with all necessary data. * * \param rowIdx is index of the matrix row this RowView refer to. * \param diagonalsOffsets is a vector view holding offsets of matrix diagonals, * \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__ MultidiagonalMatrixRowView( const IndexType rowIdx, const DiagonalsOffsetsView& diagonalsOffsets, const ValuesViewType& values, const IndexerType& indexer ); /** * \brief Returns number of diagonals of the multidiagonal matrix. * * \return number of diagonals of the multidiagonal matrix. */ __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 ); Loading