28#ifndef GRID_MATH_ARITH_MUL_H
29#define GRID_MATH_ARITH_MUL_H
37template<
class rtype,
class vtype,
class mtype>
42template<
class rrtype,
class ltype,
class rtype,
int N>
44 for(
int c1=0;c1<N;c1++){
45 for(
int c2=0;c2<N;c2++){
49 for(
int c1=0;c1<N;c1++){
50 for(
int c3=1;c3<N;c3++){
51 for(
int c2=0;c2<N;c2++){
59template<
class rrtype,
class ltype,
class rtype,
int N>
61 for(
int c2=0;c2<N;c2++){
62 for(
int c1=0;c1<N;c1++){
68template<
class rrtype,
class ltype,
class rtype,
int N>
70 for(
int c2=0;c2<N;c2++){
71 for(
int c1=0;c1<N;c1++){
77template<
class rtype,
class vtype,
class mtype,
int N>
80 for(
int c1=0;c1<N;c1++){
82 for(
int c2=1;c2<N;c2++){
88template<
class rtype,
class vtype,
class mtype,
int N>
92 for(
int c1=0;c1<N;c1++){
96template<
class rtype,
class vtype,
class mtype,
int N>
100 for(
int c1=0;c1<N;c1++){
111 mult(&ret,&lhs,&rhs);
119 mult(&ret,&lhs,&rhs);
127 mult(&ret,&lhs,&rhs);
145 for(
int i=0;i<N;i++){
154 for(
int i=0;i<N;i++){
155 for(
int j=0;j<N;j++){
176template<
class l,
class r>
179 typedef iScalar<
decltype(lhs._internal*rhs._internal)> ret_t;
181 mult(&ret,&lhs,&rhs);
187 typedef decltype(lhs._internal[0][0]*rhs._internal[0][0]) ret_t;
189 mult(&ret,&lhs,&rhs);
195 typedef decltype(lhs._internal[0][0]*rhs._internal) ret_t;
198 for(
int c1=0;c1<N;c1++){
199 for(
int c2=0;c2<N;c2++){
200 mult(&ret._internal[c1][c2],&lhs._internal[c1][c2],&rhs._internal);
207 typedef decltype(lhs._internal*rhs._internal[0][0]) ret_t;
209 for(
int c1=0;c1<N;c1++){
210 for(
int c2=0;c2<N;c2++){
211 mult(&ret._internal[c1][c2],&lhs._internal,&rhs._internal[c1][c2]);
218 typedef decltype(lhs._internal[0][0]*rhs._internal[0]) ret_t;
220 for(
int c1=0;c1<N;c1++){
221 mult(&ret._internal[c1],&lhs._internal[c1][0],&rhs._internal[0]);
222 for(
int c2=1;c2<N;c2++){
223 mac(&ret._internal[c1],&lhs._internal[c1][c2],&rhs._internal[c2]);
231 typedef decltype(lhs._internal*rhs._internal[0]) ret_t;
233 for(
int c1=0;c1<N;c1++){
234 mult(&ret._internal[c1],&lhs._internal,&rhs._internal[c1]);
241 typedef decltype(lhs._internal[0]*rhs._internal) ret_t;
243 for(
int c1=0;c1<N;c1++){
244 mult(&ret._internal[c1],&lhs._internal[c1],&rhs._internal);
#define accelerator_inline
void mac(Lattice< obj1 > &ret, const Lattice< obj2 > &lhs, const Lattice< obj3 > &rhs)
#define NAMESPACE_BEGIN(A)
accelerator_inline iScalar< rtype > operator/(const iScalar< rtype > &lhs, const iScalar< vtype > &rhs)
accelerator_inline void mult(iScalar< rtype > *__restrict__ ret, const iScalar< mtype > *__restrict__ lhs, const iScalar< vtype > *__restrict__ rhs)
accelerator_inline iVector< rtype, N > operator*(const iMatrix< mtype, N > &lhs, const iVector< vtype, N > &rhs)