Commit 5b70df92 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Added DenseMatrixRowView::setElement with localIdx parameter for compatibility...

Added DenseMatrixRowView::setElement with localIdx parameter for compatibility with sparse matrices.
parent 2280d8c9
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
@@ -104,6 +104,20 @@ class DenseMatrixRowView
      __cuda_callable__
      void setElement( const IndexType column,
                       const RealType& value );

      /**
       * \brief Sets value of matrix element with given column index
       *
       * The \e localIdx parameter is here only for compatibility with
       * the sparse matrices and it is omitted.
       *
       * \param column is a column index of the matrix element.
       * \param value is a value the matrix element will be set to.
       */
      __cuda_callable__
      void setElement( const IndexType localIdx,
                       const IndexType column,
                       const RealType& value );
   protected:

      SegmentViewType segmentView;
+13 −1
Original line number Diff line number Diff line
@@ -66,6 +66,18 @@ setElement( const IndexType column,
   values[ globalIdx ] = value;
}

template< typename SegmentView,
          typename ValuesView >
__cuda_callable__ void
DenseMatrixRowView< SegmentView, ValuesView >::
setElement( const IndexType localIdx,
            const IndexType column,
            const RealType& value )
{
   TNL_ASSERT_LT( column, this->getSize(), "Column index exceeds matrix row size." );
   const IndexType globalIdx = segmentView.getGlobalIndex( column );
   values[ globalIdx ] = value;
}

   } // namespace Matrices
} // namespace TNL