Commit a16d4530 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed access to constant SparseRow in CSR and Ellpack matrices

parent 092a025d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ class CSR : public Sparse< Real, Device, Index >
   typedef CSR< Real, Devices::Cuda, Index > CudaType;
   typedef Sparse< Real, Device, Index > BaseType;
   typedef typename BaseType::MatrixRow MatrixRow;
   typedef SparseRow< const RealType, const IndexType > ConstMatrixRow;


   enum SPMVCudaKernel { scalar, vector, hybrid };
@@ -125,7 +126,7 @@ class CSR : public Sparse< Real, Device, Index >
   MatrixRow getRow( const IndexType rowIndex );

   __cuda_callable__
   const MatrixRow getRow( const IndexType rowIndex ) const;
   ConstMatrixRow getRow( const IndexType rowIndex ) const;

   template< typename Vector >
   __cuda_callable__
+5 −5
Original line number Diff line number Diff line
@@ -406,13 +406,13 @@ template< typename Real,
          typename Device,
          typename Index >
__cuda_callable__
const typename CSR< Real, Device, Index >::MatrixRow
typename CSR< Real, Device, Index >::ConstMatrixRow
CSR< Real, Device, Index >::
getRow( const IndexType rowIndex ) const
{
   const IndexType rowOffset = this->rowPointers[ rowIndex ];
   const IndexType rowLength = this->rowPointers[ rowIndex + 1 ] - rowOffset;
   return MatrixRow( &this->columnIndexes[ rowOffset ],
   return ConstMatrixRow( &this->columnIndexes[ rowOffset ],
                          &this->values[ rowOffset ],
                          rowLength,
                          1 );
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ class Ellpack : public Sparse< Real, Device, Index >
   typedef Ellpack< Real, Devices::Cuda, Index > CudaType;
   typedef Sparse< Real, Device, Index > BaseType;
   typedef typename BaseType::MatrixRow MatrixRow;
   typedef SparseRow< const RealType, const IndexType > ConstMatrixRow;

   Ellpack();

@@ -128,7 +129,7 @@ class Ellpack : public Sparse< Real, Device, Index >
   MatrixRow getRow( const IndexType rowIndex );

   __cuda_callable__
   const MatrixRow getRow( const IndexType rowIndex ) const;
   ConstMatrixRow getRow( const IndexType rowIndex ) const;

   template< typename Vector >
   __cuda_callable__
+5 −5
Original line number Diff line number Diff line
@@ -455,13 +455,13 @@ template< typename Real,
          typename Device,
          typename Index >
__cuda_callable__
const typename Ellpack< Real, Device, Index >::MatrixRow
typename Ellpack< Real, Device, Index >::ConstMatrixRow
Ellpack< Real, Device, Index >::
getRow( const IndexType rowIndex ) const
{
   //printf( "this->rowLengths = %d this = %p \n", this->rowLengths, this );
   IndexType rowBegin = DeviceDependentCode::getRowBegin( *this, rowIndex );
   return MatrixRow( &this->columnIndexes[ rowBegin ],
   return ConstMatrixRow( &this->columnIndexes[ rowBegin ],
                          &this->values[ rowBegin ],
                          this->rowLengths,
                          DeviceDependentCode::getElementStep( *this ) );