Commit 20c656ff authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed handling of begin and end parameters in prefix sum methods

parent 1215b84f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -606,6 +606,7 @@ addVectors( Vector1& v,
   }
}

/*
template< typename Vector >
void
VectorOperations< Devices::MIC >::
@@ -661,6 +662,7 @@ computeExclusivePrefixSum( Vector& v,
      }
   }
}
*/

} // namespace Algorithms
} // namespace Containers
+4 −4
Original line number Diff line number Diff line
@@ -310,20 +310,20 @@ public:
    * \param end Index of the element in this vector which to end with.
    */
   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive >
   void prefixSum( const IndexType begin = 0, const IndexType end = 0 );
   void prefixSum( IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename FlagsArray >
   void segmentedPrefixSum( FlagsArray& flags, const IndexType begin = 0, const IndexType end = 0 );
   void segmentedPrefixSum( FlagsArray& flags, IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename VectorExpression >
   void prefixSum( const VectorExpression& expression, const IndexType begin = 0, const IndexType end = 0 );
   void prefixSum( const VectorExpression& expression, IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename VectorExpression,
             typename FlagsArray >
   void segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin = 0, const IndexType end = 0 );
   void segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, IndexType begin = 0, IndexType end = 0 );
};

} // namespace Containers
+10 −13
Original line number Diff line number Diff line
@@ -362,11 +362,10 @@ template< typename Real,
   template< Algorithms::PrefixSumType Type >
void
Vector< Real, Device, Index >::
prefixSum( const IndexType begin, const IndexType end )
prefixSum( IndexType begin, IndexType end )
{
   if( begin == 0 && end == 0 )
      Algorithms::VectorOperations< Device >::template prefixSum< Type >( *this, 0, this->getSize() );
   else
   if( end == 0 )
      end = this->getSize();
   Algorithms::VectorOperations< Device >::template prefixSum< Type >( *this, begin, end );
}

@@ -377,13 +376,11 @@ template< typename Real,
             typename FlagsArray >
void
Vector< Real, Device, Index >::
segmentedPrefixSum( FlagsArray& flags, const IndexType begin, const IndexType end )
segmentedPrefixSum( FlagsArray& flags, IndexType begin, IndexType end )
{
   if( begin == 0 && end == 0 )
      Algorithms::VectorOperations< Device >::template segmentedPrefixSum< Type >( *this, flags, 0, this->getSize() );
   else
      Algorithms::VectorOperations< Device >::template SegmentedPrefixSum< Type >( *this, flags, begin, end );

   if( end == 0 )
      end = this->getSize();
   Algorithms::VectorOperations< Device >::template segmentedPrefixSum< Type >( *this, flags, begin, end );
}

template< typename Real,
@@ -393,7 +390,7 @@ template< typename Real,
             typename VectorExpression >
void
Vector< Real, Device, Index >::
prefixSum( const VectorExpression& expression, const IndexType begin, const IndexType end )
prefixSum( const VectorExpression& expression, IndexType begin, IndexType end )
{
   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
}
@@ -406,7 +403,7 @@ template< typename Real,
             typename FlagsArray >
void
Vector< Real, Device, Index >::
segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin, const IndexType end )
segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, IndexType begin, IndexType end )
{
   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
}
+6 −6
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ public:
    * however, replaced with the VectorView size.
    */
   __cuda_callable__
   ViewType getView( const IndexType begin = 0, IndexType end = 0 );
   ViewType getView( IndexType begin = 0, IndexType end = 0 );

   /**
    * \brief Returns a non-modifiable view of the vector view.
@@ -93,7 +93,7 @@ public:
    * however, replaced with the VectorView size.
    */
   __cuda_callable__
   ConstViewType getConstView( const IndexType begin = 0, IndexType end = 0 ) const;
   ConstViewType getConstView( IndexType begin = 0, IndexType end = 0 ) const;


   static String getType();
@@ -197,20 +197,20 @@ public:
                    Scalar3 thisMultiplicator = 1.0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive >
   void prefixSum( const IndexType begin = 0, const IndexType end = 0 );
   void prefixSum( IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename FlagsArray >
   void segmentedPrefixSum( FlagsArray& flags, const IndexType begin = 0, const IndexType end = 0 );
   void segmentedPrefixSum( FlagsArray& flags, IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename VectorExpression >
   void prefixSum( const VectorExpression& expression, const IndexType begin = 0, const IndexType end = 0 );
   void prefixSum( const VectorExpression& expression, IndexType begin = 0, IndexType end = 0 );

   template< Algorithms::PrefixSumType Type = Algorithms::PrefixSumType::Inclusive,
             typename VectorExpression,
             typename FlagsArray >
   void segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin = 0, const IndexType end = 0 );
   void segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, IndexType begin = 0, IndexType end = 0 );
};

} // namespace Containers
+12 −14
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ template< typename Real,
__cuda_callable__
typename VectorView< Real, Device, Index >::ViewType
VectorView< Real, Device, Index >::
getView( const IndexType begin, IndexType end )
getView( IndexType begin, IndexType end )
{
   if( end == 0 )
      end = this->getSize();
@@ -60,7 +60,7 @@ template< typename Real,
__cuda_callable__
typename VectorView< Real, Device, Index >::ConstViewType
VectorView< Real, Device, Index >::
getConstView( const IndexType begin, IndexType end ) const
getConstView( IndexType begin, IndexType end ) const
{
   if( end == 0 )
      end = this->getSize();
@@ -380,11 +380,10 @@ template< typename Real,
   template< Algorithms::PrefixSumType Type >
void
VectorView< Real, Device, Index >::
prefixSum( const IndexType begin, const IndexType end )
prefixSum( IndexType begin, IndexType end )
{
   if( begin == 0 && end == 0 )
      Algorithms::VectorOperations< Device >::template prefixSum< Type >( *this, 0, this->getSize() );
   else
   if( end == 0 )
      end = this->getSize();
   Algorithms::VectorOperations< Device >::template prefixSum< Type >( *this, begin, end );
}

@@ -395,11 +394,10 @@ template< typename Real,
             typename FlagsArray >
void
VectorView< Real, Device, Index >::
segmentedPrefixSum( FlagsArray& flags, const IndexType begin, const IndexType end )
segmentedPrefixSum( FlagsArray& flags, IndexType begin, IndexType end )
{
   if( begin == 0 && end == 0 )
      Algorithms::VectorOperations< Device >::template segmentedPrefixSum< Type >( *this, flags, 0, this->getSize() );
   else
   if( end == 0 )
      end = this->getSize();
   Algorithms::VectorOperations< Device >::template segmentedPrefixSum< Type >( *this, flags, begin, end );
}

@@ -410,7 +408,7 @@ template< typename Real,
             typename VectorExpression >
void
VectorView< Real, Device, Index >::
prefixSum( const VectorExpression& expression, const IndexType begin, const IndexType end )
prefixSum( const VectorExpression& expression, IndexType begin, IndexType end )
{
   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
}
@@ -423,7 +421,7 @@ template< typename Real,
             typename FlagsArray >
void
VectorView< Real, Device, Index >::
segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin, const IndexType end )
segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, IndexType begin, IndexType end )
{
   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
}