Commit 16a34926 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Matrices: fixed type of 0 when passed to ParallelFor, reduce etc.

These functions expect all index parameters to have the same type, so we
need to cast 0 to the IndexType, otherwise the function lookup will fail
when IndexType is not int.
parent bdb2b3a4
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -383,7 +383,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
{
   this->reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -396,7 +396,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
{
   this->reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -435,7 +435,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
forAllElements( Function&& function ) const
{
   this->forElements( 0, this->getRows(), function );
   this->forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -448,7 +448,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
forAllElements( Function&& function )
{
   this->forElements( 0, this->getRows(), function );
   this->forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -539,7 +539,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
sequentialForAllRows( Function&& function ) const
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -552,7 +552,7 @@ void
DenseMatrix< Real, Device, Index, Organization, RealAllocator >::
sequentialForAllRows( Function&& function )
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -1179,7 +1179,7 @@ operator=( const DenseMatrixView< RHSReal, RHSDevice, RHSIndex, RHSOrganization
            IndexType bufferIdx = bufferRowIdx * maxRowLength + columnIdx;
            this_view( baseRow + bufferRowIdx, columnIdx ) = thisValuesBuffer_view[ bufferIdx ];
         };
         Algorithms::ParallelFor2D< DeviceType >::exec( ( IndexType ) 0, ( IndexType ) 0, ( IndexType ) maxRowLength, ( IndexType ) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
         Algorithms::ParallelFor2D< DeviceType >::exec( (IndexType) 0, (IndexType) 0, maxRowLength, min( bufferRowsCount, this->getRows() - baseRow ), f2 );
         baseRow += bufferRowsCount;
      }
   }
@@ -1268,7 +1268,7 @@ operator=( const RHSMatrix& matrix )
            if( columnIdx != padding_index )
               this_view( baseRow + bufferRowIdx, columnIdx ) = thisValuesBuffer_view[ bufferIdx ];
         };
         Algorithms::ParallelFor2D< DeviceType >::exec( ( IndexType ) 0, ( IndexType ) 0, ( IndexType ) maxRowLength, ( IndexType ) min( bufferRowsCount, this->getRows() - baseRow ), f2 );
         Algorithms::ParallelFor2D< DeviceType >::exec( (IndexType) 0, (IndexType) 0, maxRowLength, min( bufferRowsCount, this->getRows() - baseRow ), f2 );
         baseRow += bufferRowsCount;
      }
   }
+9 −9
Original line number Diff line number Diff line
@@ -326,7 +326,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity )
{
   this->reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -338,7 +338,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
{
   this->reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -382,7 +382,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
forAllElements( Function&& function ) const
{
   this->forElements( 0, this->getRows(), function );
   this->forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -394,7 +394,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
forAllElements( Function&& function )
{
   this->forElements( 0, this->getRows(), function );
   this->forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -442,7 +442,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
forAllRows( Function&& function )
{
   this->forRows( 0, this->getRows(), function );
   this->forRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -454,7 +454,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
forAllRows( Function&& function ) const
{
   this->forRows( 0, this->getRows(), function );
   this->forRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -492,7 +492,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
sequentialForAllRows( Function&& function ) const
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -504,7 +504,7 @@ void
DenseMatrixView< Real, Device, Index, Organization >::
sequentialForAllRows( Function&& function )
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}


+4 −4
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ void
LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
reduceAllRows( Fetch& fetch, const Reduce& reduce, Keep& keep, const FetchReal& identity ) const
{
   this->reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename MatrixElementsLambda,
@@ -340,7 +340,7 @@ void
LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
forAllElements( Function& function ) const
{
   forElements( 0, this->getRows(), function );
   forElements( (IndexType) 0, this->getRows(), function );
}

template< typename MatrixElementsLambda,
@@ -371,7 +371,7 @@ void
LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
forAllRows( Function&& function ) const
{
   this->forRows( 0, this->getRows(), function );
   this->forRows( (IndexType) 0, this->getRows(), function );
}

template< typename MatrixElementsLambda,
@@ -398,7 +398,7 @@ void
LambdaMatrix< MatrixElementsLambda, CompressedRowLengthsLambda, Real, Device, Index >::
sequentialForAllRows( Function&& function ) const
{
   sequentialForRows( 0, this->getRows(), function );
   sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename MatrixElementsLambda,
+6 −6
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
{
   this->view.reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -521,7 +521,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
{
   this->view.reduceRows( 0, this->getRows(), fetch, reduce, keep, identity );
   this->view.reduceRows( (IndexType) 0, this->getRows(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -563,7 +563,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
forAllElements( Function& function ) const
{
   this->view.forElements( 0, this->getRows(), function );
   this->view.forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -577,7 +577,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
forAllElements( Function& function )
{
   this->view.forElements( 0, this->getRows(), function );
   this->view.forElements( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -675,7 +675,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
sequentialForAllRows( Function& function ) const
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -689,7 +689,7 @@ void
MultidiagonalMatrix< Real, Device, Index, Organization, RealAllocator, IndexAllocator >::
sequentialForAllRows( Function& function )
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
+9 −9
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity ) const
{
   this->reduceRows( 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -426,7 +426,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
reduceAllRows( Fetch& fetch, Reduce& reduce, Keep& keep, const FetchReal& identity )
{
   this->reduceRows( 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
   this->reduceRows( (IndexType) 0, this->indexer.getNonemptyRowsCount(), fetch, reduce, keep, identity );
}

template< typename Real,
@@ -490,7 +490,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
forAllElements( Function& function ) const
{
   this->forElements( 0, this->indxer.getNonEmptyRowsCount(), function );
   this->forElements( (IndexType) 0, this->indxer.getNonEmptyRowsCount(), function );
}

template< typename Real,
@@ -502,7 +502,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
forAllElements( Function& function )
{
   this->forElements( 0, this->indexer.getNonemptyRowsCount(), function );
   this->forElements( (IndexType) 0, this->indexer.getNonemptyRowsCount(), function );
}

template< typename Real,
@@ -548,7 +548,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
forAllRows( Function&& function )
{
   this->forRows( 0, this->getRows(), function );
   this->forRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -560,7 +560,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
forAllRows( Function&& function ) const
{
   this->forRows( 0, this->getRows(), function );
   this->forRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -598,7 +598,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
sequentialForAllRows( Function& function ) const
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
@@ -610,7 +610,7 @@ void
MultidiagonalMatrixView< Real, Device, Index, Organization >::
sequentialForAllRows( Function& function )
{
   this->sequentialForRows( 0, this->getRows(), function );
   this->sequentialForRows( (IndexType) 0, this->getRows(), function );
}

template< typename Real,
Loading