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

Fixed sequential scan to apply the initial value properly

parent dfe6b1e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -53,13 +53,13 @@ performFirstPhase( Vector& v,
   using ValueType = typename Vector::ValueType;
   using IndexType = typename Vector::IndexType;

   ValueType aux = zero;
   if( Type == ScanType::Inclusive ) {
      for( IndexType i = begin + 1; i < end; i++ )
         v[ i ] = reduction( v[ i ], v[ i - 1 ] );
      for( IndexType i = begin; i < end; i++ )
         v[ i ] = aux = reduction( aux, v[ i ] );
   }
   else // Exclusive scan
   {
      ValueType aux = zero;
      for( IndexType i = begin; i < end; i++ ) {
         const ValueType x = v[ i ];
         v[ i ] = aux;