Commit 61b5aa8d authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed bug in lpNorm

parent f859baec
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ auto StaticExpressionLpNorm( const Expression& expression, const Real& p )
   }
   auto aux = TNL::pow( expression[ 0 ], p );
   for( int i = 1; i < expression.getSize(); i++ )
      aux += TNL::pow( expression[ i ], p );
      aux += TNL::pow( TNL::abs( expression[ i ] ), p );
   return aux;
}

+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ auto ExpressionLpNorm( const Expression& expression, const Real& p ) ->
      auto volatileReduction = [=] __cuda_callable__ ( volatile ResultType& a, volatile ResultType& b ) { a += b; };
      return Algorithms::Reduction< typename Expression::DeviceType >::reduce( expression.getSize(), reduction, volatileReduction, fetch, ( ResultType ) 0.0 );
   }
   auto fetch = [=] __cuda_callable__ ( IndexType i ) { return  TNL::pow( expression[ i ], p ); };
   auto fetch = [=] __cuda_callable__ ( IndexType i ) { return  TNL::pow( TNL::abs( expression[ i ] ), p ); };
   auto reduction = [=] __cuda_callable__ ( ResultType& a, const ResultType& b ) { a += b; };
   auto volatileReduction = [=] __cuda_callable__ ( volatile ResultType& a, volatile ResultType& b ) { a += b; };
   return Algorithms::Reduction< typename Expression::DeviceType >::reduce( expression.getSize(), reduction, volatileReduction, fetch, ( ResultType ) 0.0 );