27 #ifndef MPBLOCKS_CUDA_POLYNOMIAL_DIFFERENTIATE_H_
28 #define MPBLOCKS_CUDA_POLYNOMIAL_DIFFERENTIATE_H_
33 namespace polynomial {
36 template <
class Spec,
int n >
39 template<
int Head,
class Tail,
int n>
50 template<
int Head,
int n>
62 namespace derivative_detail
64 template<
int n,
class Exp1,
class Exp2,
class Spec>
67 template<
int n,
class Exp1,
class Exp2,
int Head,
class Tail >
71 static void copy(
const Exp1& in, Exp2& out )
73 set<Head>(out) = get<Head+n>(in);
78 template<
int n,
class Exp1,
class Exp2,
int Head >
82 static void copy(
const Exp1& in, Exp2& out )
84 set<Head>(out) = get<Head+n>(in);
88 template<
bool B,
class Exp,
int j,
int i >
95 template<
class Exp,
int j,
int i >
106 template<
class Exp,
class Spec,
int j,
int i,
int size2>
110 static void go( Exp& out )
118 template<
class Exp,
class Spec,
int i,
int size2>
122 static void go( Exp& out ){}
126 template<
class Exp,
class Spec,
int i,
int size2>
130 static void go( Exp& out ){}
134 template<
class Exp,
class Spec,
int size2>
135 struct Looper2<Exp, Spec, size2, size2, size2 >
138 static void go( Exp& out ){}
141 template<
int n,
int size1,
class Exp2,
class Spec2,
int i>
145 static void go( Exp2& out )
152 template<
int n,
int size1,
class Exp2,
class Spec2>
156 static void go( Exp2& out ){}
163 template <
int n,
typename Scalar,
class Exp1,
class InSpec,
class Exp2>
175 static_cast<const Exp1&>(in),
176 static_cast<Exp2&>(out) );
183 static_cast<Exp2&>(out) );
194 template <
int n,
typename Scalar,
class Exp,
class Spec>
199 static_cast< const Exp&
>(exp) );
222 #endif // DIFFERENTIATE_H_
__host__ static __device__ void go(Exp2 &out)
__host__ static __device__ void go(Exp2 &out)
__host__ static __device__ void go(Exp &out)
__host__ static __device__ void go(Exp &out)
__host__ __device__ void differentiate(const RValue< Scalar, Exp1, InSpec > &in, LValue< Scalar, Exp2 > &out)
evaluate a polynomial
__host__ static __device__ void copy(const Exp1 &in, Exp2 &out)
__host__ static __device__ void copy(const Exp1 &in, Exp2 &out)
__host__ static __device__ void go(Exp &out)
expression template for rvalues
expression template for lvalues
__host__ __device__ DerivativeSurrogate< n, Scalar, Exp, Spec > d_ds(const RValue< Scalar, Exp, Spec > &exp)
return a surrogate which notifies LValue to call differentiate
intermediate object which allows LValue assignment operator to call differntiate expression template ...
__host__ static __device__ void do_it(Exp &out)
retrieve the max element of the list (linear without short circut so it works with non-sorted arrays ...
__host__ static __device__ void do_it(Exp &out)
Char8_t * copy(const Char8_t *s)
__host__ static __device__ void go(Exp &out)
compile time integer list (because cuda doesn't understand variadic templates )