Loading src/TNL/Matrices/Matrix.h +2 −2 Original line number Diff line number Diff line Loading @@ -76,11 +76,11 @@ public: __cuda_callable__ IndexType getColumns() const; virtual bool setElement( const IndexType row, virtual void setElement( const IndexType row, const IndexType column, const RealType& value ) = 0; virtual bool addElement( const IndexType row, virtual void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ) = 0; Loading src/TNL/Matrices/MatrixView.h +2 −2 Original line number Diff line number Diff line Loading @@ -73,11 +73,11 @@ public: * in the future and it does not slow down, declare them as virtual here. */ virtual bool setElement( const IndexType row, virtual void setElement( const IndexType row, const IndexType column, const RealType& value ) = 0; virtual bool addElement( const IndexType row, virtual void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ) = 0; Loading src/TNL/Matrices/Multidiagonal.h +5 −5 Original line number Diff line number Diff line Loading @@ -38,12 +38,12 @@ class Multidiagonal : public Matrix< Real, Device, Index, RealAllocator > using ValuesType = typename BaseType::ValuesVector; using ValuesViewType = typename ValuesType::ViewType; using IndexerType = details::MultidiagonalMatrixIndexer< IndexType, RowMajorOrder >; using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType >; using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType >; using DiagonalsShiftsView = typename DiagonalsShiftsType::ViewType; using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsShiftsView >; using ViewType = MultidiagonalMatrixView< Real, Device, Index, RowMajorOrder >; using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, RowMajorOrder >; using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType >; using DiagonalsShiftsView = typename DiagonalsShiftsType::ViewType; using HostDiagonalsShiftsType = Containers::Vector< IndexType, Devices::Host, IndexType >; using HostDiagonalsShiftsView = typename HostDiagonalsShiftsType::ViewType; Loading Loading @@ -119,11 +119,11 @@ class Multidiagonal : public Matrix< Real, Device, Index, RealAllocator > void setValue( const RealType& v ); bool setElement( const IndexType row, void setElement( const IndexType row, const IndexType column, const RealType& value ); bool addElement( const IndexType row, void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ); Loading src/TNL/Matrices/Multidiagonal.hpp +7 −12 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ Multidiagonal( const IndexType rows, const IndexType columns, const Vector& diagonalsShifts ) { TNL_ASSERT_GT( diagonalsShifts.getSize(), 0, "Cannot construct mutltidiagonal matrix with no diagonals shifts." ); this->setDimensions( rows, columns, diagonalsShifts ); } Loading @@ -60,6 +61,7 @@ getView() const -> ViewType // TODO: fix when getConstView works return ViewType( const_cast< Multidiagonal* >( this )->values.getView(), const_cast< Multidiagonal* >( this )->diagonalsShifts.getView(), const_cast< Multidiagonal* >( this )->hostDiagonalsShifts.getView(), indexer ); } Loading Loading @@ -358,11 +360,11 @@ template< typename Real, bool RowMajorOrder, typename RealAllocator, typename IndexAllocator > bool void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: setElement( const IndexType row, const IndexType column, const RealType& value ) { return this->view.setElement( row, column, value ); this->view.setElement( row, column, value ); } template< typename Real, Loading @@ -371,14 +373,14 @@ template< typename Real, bool RowMajorOrder, typename RealAllocator, typename IndexAllocator > bool void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator ) { return this->view.addElement( row, column, value, thisElementMultiplicator ); this->view.addElement( row, column, value, thisElementMultiplicator ); } template< typename Real, Loading Loading @@ -745,14 +747,7 @@ void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: print( std::ostream& str ) const { for( IndexType row = 0; row < this->getRows(); row++ ) { str <<"Row: " << row << " -> "; for( IndexType column = row - 1; column < row + 2; column++ ) if( column >= 0 && column < this->columns ) str << " Col:" << column << "->" << this->getElement( row, column ) << "\t"; str << std::endl; } this->view.print( str ); } template< typename Real, Loading src/TNL/Matrices/MultidiagonalMatrixRowView.h +8 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ namespace TNL { namespace Matrices { template< typename ValuesView, typename Indexer > typename Indexer, typename DiagonalsShiftsView_ > class MultidiagonalMatrixRowView { public: Loading @@ -23,9 +24,11 @@ class MultidiagonalMatrixRowView using IndexType = typename ValuesView::IndexType; using ValuesViewType = ValuesView; using IndexerType = Indexer; using DiagonalsShiftsView = DiagonalsShiftsView_; __cuda_callable__ MultidiagonalMatrixRowView( const IndexType rowIdx, const DiagonalsShiftsView& diagonalsShifts, const ValuesViewType& values, const IndexerType& indexer); Loading @@ -48,6 +51,8 @@ class MultidiagonalMatrixRowView IndexType rowIdx; DiagonalsShiftsView diagonalsShifts; ValuesViewType values; Indexer indexer; Loading Loading
src/TNL/Matrices/Matrix.h +2 −2 Original line number Diff line number Diff line Loading @@ -76,11 +76,11 @@ public: __cuda_callable__ IndexType getColumns() const; virtual bool setElement( const IndexType row, virtual void setElement( const IndexType row, const IndexType column, const RealType& value ) = 0; virtual bool addElement( const IndexType row, virtual void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ) = 0; Loading
src/TNL/Matrices/MatrixView.h +2 −2 Original line number Diff line number Diff line Loading @@ -73,11 +73,11 @@ public: * in the future and it does not slow down, declare them as virtual here. */ virtual bool setElement( const IndexType row, virtual void setElement( const IndexType row, const IndexType column, const RealType& value ) = 0; virtual bool addElement( const IndexType row, virtual void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ) = 0; Loading
src/TNL/Matrices/Multidiagonal.h +5 −5 Original line number Diff line number Diff line Loading @@ -38,12 +38,12 @@ class Multidiagonal : public Matrix< Real, Device, Index, RealAllocator > using ValuesType = typename BaseType::ValuesVector; using ValuesViewType = typename ValuesType::ViewType; using IndexerType = details::MultidiagonalMatrixIndexer< IndexType, RowMajorOrder >; using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType >; using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType >; using DiagonalsShiftsView = typename DiagonalsShiftsType::ViewType; using RowView = MultidiagonalMatrixRowView< ValuesViewType, IndexerType, DiagonalsShiftsView >; using ViewType = MultidiagonalMatrixView< Real, Device, Index, RowMajorOrder >; using ConstViewType = MultidiagonalMatrixView< typename std::add_const< Real >::type, Device, Index, RowMajorOrder >; using DiagonalsShiftsType = Containers::Vector< IndexType, DeviceType, IndexType, IndexAllocatorType >; using DiagonalsShiftsView = typename DiagonalsShiftsType::ViewType; using HostDiagonalsShiftsType = Containers::Vector< IndexType, Devices::Host, IndexType >; using HostDiagonalsShiftsView = typename HostDiagonalsShiftsType::ViewType; Loading Loading @@ -119,11 +119,11 @@ class Multidiagonal : public Matrix< Real, Device, Index, RealAllocator > void setValue( const RealType& v ); bool setElement( const IndexType row, void setElement( const IndexType row, const IndexType column, const RealType& value ); bool addElement( const IndexType row, void addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator = 1.0 ); Loading
src/TNL/Matrices/Multidiagonal.hpp +7 −12 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ Multidiagonal( const IndexType rows, const IndexType columns, const Vector& diagonalsShifts ) { TNL_ASSERT_GT( diagonalsShifts.getSize(), 0, "Cannot construct mutltidiagonal matrix with no diagonals shifts." ); this->setDimensions( rows, columns, diagonalsShifts ); } Loading @@ -60,6 +61,7 @@ getView() const -> ViewType // TODO: fix when getConstView works return ViewType( const_cast< Multidiagonal* >( this )->values.getView(), const_cast< Multidiagonal* >( this )->diagonalsShifts.getView(), const_cast< Multidiagonal* >( this )->hostDiagonalsShifts.getView(), indexer ); } Loading Loading @@ -358,11 +360,11 @@ template< typename Real, bool RowMajorOrder, typename RealAllocator, typename IndexAllocator > bool void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: setElement( const IndexType row, const IndexType column, const RealType& value ) { return this->view.setElement( row, column, value ); this->view.setElement( row, column, value ); } template< typename Real, Loading @@ -371,14 +373,14 @@ template< typename Real, bool RowMajorOrder, typename RealAllocator, typename IndexAllocator > bool void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: addElement( const IndexType row, const IndexType column, const RealType& value, const RealType& thisElementMultiplicator ) { return this->view.addElement( row, column, value, thisElementMultiplicator ); this->view.addElement( row, column, value, thisElementMultiplicator ); } template< typename Real, Loading Loading @@ -745,14 +747,7 @@ void Multidiagonal< Real, Device, Index, RowMajorOrder, RealAllocator, IndexAllocator >:: print( std::ostream& str ) const { for( IndexType row = 0; row < this->getRows(); row++ ) { str <<"Row: " << row << " -> "; for( IndexType column = row - 1; column < row + 2; column++ ) if( column >= 0 && column < this->columns ) str << " Col:" << column << "->" << this->getElement( row, column ) << "\t"; str << std::endl; } this->view.print( str ); } template< typename Real, Loading
src/TNL/Matrices/MultidiagonalMatrixRowView.h +8 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ namespace TNL { namespace Matrices { template< typename ValuesView, typename Indexer > typename Indexer, typename DiagonalsShiftsView_ > class MultidiagonalMatrixRowView { public: Loading @@ -23,9 +24,11 @@ class MultidiagonalMatrixRowView using IndexType = typename ValuesView::IndexType; using ValuesViewType = ValuesView; using IndexerType = Indexer; using DiagonalsShiftsView = DiagonalsShiftsView_; __cuda_callable__ MultidiagonalMatrixRowView( const IndexType rowIdx, const DiagonalsShiftsView& diagonalsShifts, const ValuesViewType& values, const IndexerType& indexer); Loading @@ -48,6 +51,8 @@ class MultidiagonalMatrixRowView IndexType rowIdx; DiagonalsShiftsView diagonalsShifts; ValuesViewType values; Indexer indexer; Loading