Commit c799fd4e authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Fixing tridiagonal matrix.

parent 000546f7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public:
   template< typename Matrix_ >
   void setLike( const Matrix_& matrix );

   IndexType getNumberOfMatrixElements() const;
   IndexType getAllocatedElementsCount() const;

   virtual IndexType getNumberOfNonzeroMatrixElements() const = 0;

+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ template< typename Real,
          typename Device,
          typename Index,
          typename RealAllocator >
Index Matrix< Real, Device, Index, RealAllocator >::getNumberOfMatrixElements() const
Index Matrix< Real, Device, Index, RealAllocator >::getAllocatedElementsCount() const
{
   return this->values.getSize();
}
+10 −3
Original line number Diff line number Diff line
@@ -57,12 +57,10 @@ public:

   virtual void getCompressedRowLengths( CompressedRowLengthsVectorView rowLengths ) const;

   IndexType getNumberOfMatrixElements() const;
   IndexType getAllocatedElementsCount() const;

   virtual IndexType getNumberOfNonzeroMatrixElements() const;

   void reset();

   __cuda_callable__
   IndexType getRows() const;

@@ -91,6 +89,15 @@ public:

   ValuesView& getValues();

   /**
    * \brief Shallow copy of the matrix view.
    *
    * @param view
    * @return 
    */
   __cuda_callable__
   MatrixView& operator=( const MatrixView& view );
   
   // TODO: parallelize and optimize for sparse matrices
   template< typename Matrix >
   bool operator == ( const Matrix& matrix ) const;
+8 −6
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void MatrixView< Real, Device, Index >::getCompressedRowLengths( CompressedRowLe
template< typename Real,
          typename Device,
          typename Index >
Index MatrixView< Real, Device, Index >::getNumberOfMatrixElements() const
Index MatrixView< Real, Device, Index >::getAllocatedElementsCount() const
{
   return this->values.getSize();
}
@@ -118,15 +118,17 @@ getValues()
{
   return this->values;
}

template< typename Real,
          typename Device,
          typename Index >
void MatrixView< Real, Device, Index >::reset()
__cuda_callable__
MatrixView< Real, Device, Index >& 
MatrixView< Real, Device, Index >::
operator=( const MatrixView& view )
{
   this->rows = 0;
   this->columns = 0;
   this->values.reset();
   rows = view.rows;
   columns = view.columns;
   values.copy( view.values );
}

template< typename Real,
+2 −4
Original line number Diff line number Diff line
@@ -79,12 +79,8 @@ class Tridiagonal : public Matrix< Real, Device, Index, RealAllocator >
      template< typename Real_, typename Device_, typename Index_, bool RowMajorOrder_, typename RealAllocator_ >
      void setLike( const Tridiagonal< Real_, Device_, Index_, RowMajorOrder_, RealAllocator_ >& m );

      IndexType getNumberOfMatrixElements() const;

      IndexType getNumberOfNonzeroMatrixElements() const;

      IndexType getMaxRowlength() const;

      void reset();

      template< typename Real_, typename Device_, typename Index_, bool RowMajorOrder_, typename RealAllocator_ >
@@ -179,6 +175,8 @@ class Tridiagonal : public Matrix< Real, Device, Index, RealAllocator >
                                 const IndexType localIdx ) const;

      IndexerType indexer;

      ViewType view;
};

} // namespace Matrices
Loading