27 #ifndef MPBLOCKS_CUDA_POLYNOMIAL_PRODUCT_H_
28 #define MPBLOCKS_CUDA_POLYNOMIAL_PRODUCT_H_
32 namespace polynomial {
35 namespace product_detail
42 template<
int A,
int B >
47 template<
int Key,
class Value,
class Next=Null >
51 template<
class A,
class B >
54 template<
int KeyA,
class ValueA,
class NextA,
55 int KeyB,
class ValueB,
class NextB >
57 Node<KeyB,ValueB,NextB> >
59 enum{ value = (KeyA < KeyB) };
62 template<
int KeyA,
class ValueA,
class NextA >
68 template<
int KeyA,
class ValueA,
class NextA >
71 enum{ value =
false };
77 template<
class NodeA,
class NodeB,
bool ALessThanB >
80 template<
int KeyA,
class ValueA,
class NextA,
class NodeB >
83 typedef Node<KeyA,ValueA,
90 template<
class NodeA,
int KeyB,
class ValueB >
97 template<
class Root,
class Node >
105 template<
class Node >
113 template<
int Coeff1,
class Spec2,
class Map >
116 template<
int Coeff1,
int Head,
class Tail,
class Map >
124 template<
int Coeff1,
int Head,
class Map >
132 template<
class Spec1,
class Spec2,
class Map >
135 template<
int Head,
class Tail,
class Spec2,
class Map >
142 template<
int Head,
class Spec2,
class Map >
150 template<
class Spec1,
class Spec2 >
157 template <
class Spec >
160 static void print( std::ostream& out )
169 static void print( std::ostream& out )
175 template<
int Key,
int ValA,
int ValB,
class Next >
178 static void print( std::ostream& out )
180 out <<
"(" <<
Key <<
"," << ValA <<
"," << ValB <<
"), ";
186 template<
int Key,
int ValA,
int ValB,
class Next >
203 template <
typename Scalar,
204 class Exp1,
class Spec1,
205 class Exp2,
class Spec2 >
207 public RValue< Scalar, Product<Scalar,Exp1,Spec1,Exp2,Spec2>,
208 typename intlist::allpairs_sum<Spec1,Spec2>::result >
223 return m_A.eval(x) * m_B.eval(x);
228 namespace product_detail
231 template <
int i,
typename Scalar,
class Exp1,
class Exp2,
class Spec >
234 template <
int i,
typename Scalar,
class Exp1,
class Exp2,
235 int Key,
int ValA,
int ValB,
class Next >
239 static Scalar
do_it(
const Exp1& exp1,
const Exp2& exp2 )
245 template <
int i,
typename Scalar,
class Exp1,
class Exp2,
246 int ValA,
int ValB,
class Next >
250 static Scalar
do_it(
const Exp1& exp1,
const Exp2& exp2 )
252 return get<ValA>(exp1)*get<ValB>(exp2) +
257 template <
int i,
typename Scalar,
class Exp1,
class Exp2,
258 int Key,
int ValA,
int ValB >
262 static Scalar
do_it(
const Exp1& exp1,
const Exp2& exp2 )
268 template <
int i,
typename Scalar,
class Exp1,
class Exp2,
273 static Scalar
do_it(
const Exp1& exp1,
const Exp2& exp2 )
275 return get<ValA>(exp1)*get<ValB>(exp2);
282 template <
typename Scalar,
283 class Exp1,
class Spec1,
284 class Exp2,
class Spec2 >
290 template <
int i,
typename Scalar,
291 class Exp1,
class Spec1,
292 class Exp2,
class Spec2 >
302 template <
typename Scalar,
303 class Exp1,
class Spec1,
304 class Exp2,
class Spec2 >
311 static_cast<Exp1 const&
>(A),
312 static_cast<Exp2 const&>(B));
Node< Coeff1+Head, IdxPair< Coeff1, Head >, Null > NewNode
__host__ __device__ Polynomial< Scalar, IntList< pow, intlist::Terminal > > operator*(Scalar v, CoefficientKey< pow > c)
__host__ static __device__ Scalar do_it(const Exp1 &exp1, const Exp2 &exp2)
Node< Coeff1+Head, IdxPair< Coeff1, Head >, Null > NewNode
static void print(std::ostream &out)
evaluates ordering on nodes by resolving their keys
pairs one index of the first polynomial with one index of the second polynomial
inner_loop< Head, Spec2, Map >::result result
expression template for rvalues
inner_loop< Coeff1, Tail, NewMap >::result result
__host__ static __device__ Scalar do_it(const Exp1 &exp1, const Exp2 &exp2)
strip_dups< typename merge_sort< typename allpairs_sum_unsorted< IntList1, IntList2 >::result >::result >::result result
__host__ __device__ Product(Exp1 const &A, Exp2 const &B)
insert a new key/value pair into the map
std::ostream & operator<<(std::ostream &out, SpecPrinter< Node< Key, IdxPair< ValA, ValB >, Next > > printer)
static void print(std::ostream &out)
__host__ __device__ Scalar eval(Scalar x)
Node< KeyB, ValueB, NodeA > result
intlist::allpairs_sum< Spec1, Spec2 >::result result
insert_postTest< Root, Node, less_than< Root, Node >::value >::result result
insert< Map, NewNode >::result result
expression template for sum of two matrix expressions
outer_loop< Tail, Spec2, MapA >::result result
Node< KeyA, ValueA, typename insert_postTest< NextA, NodeB, less_than< NextA, NodeB >::value >::result > result
compile time map of output monomial to input monomial pairs that contribute to that coefficient ...
insert< Map, NewNode >::result NewMap
compute product specification
outer_loop< Spec1, Spec2, Null >::result result
__host__ static __device__ Scalar do_it(const Exp1 &exp1, const Exp2 &exp2)
inner_loop< Head, Spec2, Map >::result MapA
if ALessThanB is true, then template recurses, otherwise B is inserted in front of A ...
compile time integer list (because cuda doesn't understand variadic templates )
static void print(std::ostream &out)
__host__ static __device__ Scalar do_it(const Exp1 &exp1, const Exp2 &exp2)