27 #ifndef MPBLOCKS_CUDA_POLYNOMIAL_POLYVAL_H_
28 #define MPBLOCKS_CUDA_POLYNOMIAL_POLYVAL_H_
32 namespace polynomial {
35 namespace polyval_detail
37 template <
class Scalar,
class Exp,
int idx,
int max>
41 static Scalar
eval(
const Exp& exp,
const Scalar&
s, Scalar sn )
43 return get<idx>(exp)*sn
48 template <
class Scalar,
class Exp,
int max>
49 struct Helper< Scalar, Exp, max, max>
52 static Scalar
eval(
const Exp& exp,
const Scalar&
s, Scalar sn )
54 return get<max>(exp)*sn;
60 template <
typename Scalar,
class Exp,
class Spec,
typename Scalar2>
66 static_cast<const Exp&>(exp),Scalar(x),1);
expression template for rvalues
retrieve the max element of the list (linear without short circut so it works with non-sorted arrays ...
__host__ static __device__ Scalar eval(const Exp &exp, const Scalar &s, Scalar sn)
__host__ __device__ Scalar polyval(const RValue< Scalar, Exp, Spec > &exp, Scalar2 x)
evaluate a polynomial
__host__ static __device__ Scalar eval(const Exp &exp, const Scalar &s, Scalar sn)