Commit 4a21333e authored by Libor's avatar Libor
Browse files

Symmetric matrices reader

parent 2b51a9c7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -452,6 +452,9 @@ Real tnlBiEllpackSymMatrix< Real, Device, Index, StripSize >::getElement( const
                       << " this->getColumns() = " << this->getColumns()
                       << "this->getName() = " << this->getName() << endl );

    if( row > column )
        return this->getElement( column, row );

    const IndexType strip = row / this->warpSize;
    const IndexType groupBegin = strip * ( this->logWarpSize + 1 );
    const IndexType rowStripPerm = this->rowPermArray.getElement( row ) - strip * this->warpSize;
@@ -642,7 +645,7 @@ void tnlBiEllpackSymMatrix< Real, Device, Index, StripSize >::vectorProductHost(
                    }
                    RealType result = tempStripOutVector.getElement( currentRow % cudaBlockSize );
                    result += inVector[ this->columnIndexes.getElement( elementPtr ) ] * this->values.getElement( elementPtr );
                    outVector[ this->columnIndexes[ elementPtr ] ] += inVector[ this->columnIndexes[ elementPtr ] ] * this->values[ elementPtr ] );
                    outVector[ this->columnIndexes[ elementPtr ] ] += inVector[ this->columnIndexes[ elementPtr ] ] * this->values[ elementPtr ];
                    tempStripOutVector.setElement( currentRow % cudaBlockSize, result );
                    elementPtr += this->warpSize;
                }
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ bool tnlMatrixReader< Matrix >::computeRowLengthsFromMtxFile( std::istream& file
      if( verbose )
         cout << " Counting the matrix elements ... " << numberOfElements / 1000 << " thousands      \r" << flush;
      rowLengths[ row - 1 ]++;
      if( rowLengths[ row - 1 ] >= columns )
      if( rowLengths[ row - 1 ] > columns )
      {
         cerr << "There are more elements than the matrix columns at the row " << row << "." << endl;
         return false;
+10 −10
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ void setupConfig( tnlConfigDescription& config )


template< typename Matrix >
bool testMatrix( const tnlParameterContainer& parameters )
bool testMatrix( const tnlParameterContainer& parameters, bool sym )
{
   Matrix matrix;
   typedef typename Matrix::RealType RealType;
@@ -68,7 +68,7 @@ bool testMatrix( const tnlParameterContainer& parameters )
      cerr << "Cannot open the file " << fileName << endl;
      return false;
   }
   if( ! tnlMatrixReader< Matrix >::readMtxFile( file, matrix, verbose ) )
   if( ! tnlMatrixReader< Matrix >::readMtxFile( file, matrix, verbose, sym ) )
      return false;
   //if( ! tnlMatrixReader< Matrix >::verifyMtxFile( file, matrix, verbose ) )
   //   return false;
@@ -147,43 +147,43 @@ int main( int argc, char* argv[] )
   const tnlString& matrixFormat = parameters.GetParameter< tnlString >( "matrix-format" );
   if( matrixFormat == "dense" )
   {
       if( !testMatrix< tnlDenseMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlDenseMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormat == "ellpack" )
   {
       if( !testMatrix< tnlEllpackMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlEllpackMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormat == "sliced-ellpack" )
   {
       if( !testMatrix< tnlSlicedEllpackMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlSlicedEllpackMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormat == "chunked-ellpack" )
   {
       if( !testMatrix< tnlChunkedEllpackMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlChunkedEllpackMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormat == "csr" )
   {
       if( !testMatrix< tnlCSRMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlCSRMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormat == "bi-ell" )
   {
       if( !testMatrix< tnlBiEllpackMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlBiEllpackMatrix< double, tnlHost, int > >( parameters, false ) )
          return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
   if( matrixFormatt == "bi-ell-sym" )
   if( matrixFormat == "bi-ell-sym" )
   {
       if( !testMatrix< tnlBiEllpackSymMatrix< double, tnlHost, int > >( parameters ) )
       if( !testMatrix< tnlBiEllpackSymMatrix< double, tnlHost, int > >( parameters, true ) )
           return EXIT_FAILURE;
       return EXIT_SUCCESS;
   }
+0 −0

File mode changed from 100644 to 100755.