Commit 51040db2 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added operator() to the dense matrix

parent 0375005c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -87,6 +87,14 @@ public:

   void setValue( const RealType& v );

   __cuda_callable__
   Real& operator()( const IndexType row,
                     const IndexType column );

   __cuda_callable__
   const Real& operator()( const IndexType row,
                           const IndexType column ) const;

   __cuda_callable__
   bool setElementFast( const IndexType row,
                        const IndexType column,
+28 −1
Original line number Diff line number Diff line
@@ -151,6 +151,33 @@ void Dense< Real, Device, Index >::setValue( const Real& value )
}


template< typename Real,
          typename Device,
          typename Index >
__cuda_callable__
Real& Dense< Real, Device, Index >::operator()( const IndexType row,
                                                const IndexType column )
{
   TNL_ASSERT( row >= 0 && row < this->getRows() &&
              column >= 0 && column < this->getColumns(),
              printf( " row = %d, column = %d, this->getRows = %d, this->getColumns() = %d \n", row, column, this->getRows(), this->getColumns() ) );
   return this->values.operator[]( this->getElementIndex( row, column ) );
}

template< typename Real,
          typename Device,
          typename Index >
__cuda_callable__
const Real& Dense< Real, Device, Index >::operator()( const IndexType row,
                                                      const IndexType column ) const
{
   TNL_ASSERT( row >= 0 && row < this->getRows() &&
              column >= 0 && column < this->getColumns(),
              printf( " row = %d, column = %d, this->getRows = %d, this->getColumns() = %d \n", row, column, this->getRows(), this->getColumns() ) );
   return this->values.operator[]( this->getElementIndex( row, column ) );
}


template< typename Real,
          typename Device,
          typename Index >