mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 13:15:55 +01:00
Merge branch 'master' into hadrons
This commit is contained in:
commit
3ff96c502b
@ -379,6 +379,54 @@ namespace Optimization {
|
|||||||
void permute(vtype &a, vtype b, int perm) {
|
void permute(vtype &a, vtype b, int perm) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Rotate{
|
||||||
|
|
||||||
|
static inline u128f rotate(u128f in,int n){
|
||||||
|
u128f out;
|
||||||
|
switch(n){
|
||||||
|
case 0:
|
||||||
|
out.f[0] = in.f[0];
|
||||||
|
out.f[1] = in.f[1];
|
||||||
|
out.f[2] = in.f[2];
|
||||||
|
out.f[3] = in.f[3];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
out.f[0] = in.f[1];
|
||||||
|
out.f[1] = in.f[2];
|
||||||
|
out.f[2] = in.f[3];
|
||||||
|
out.f[3] = in.f[0];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
out.f[0] = in.f[2];
|
||||||
|
out.f[1] = in.f[3];
|
||||||
|
out.f[2] = in.f[0];
|
||||||
|
out.f[3] = in.f[1];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
out.f[0] = in.f[3];
|
||||||
|
out.f[1] = in.f[0];
|
||||||
|
out.f[2] = in.f[1];
|
||||||
|
out.f[3] = in.f[2];
|
||||||
|
break;
|
||||||
|
default: assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static inline u128d rotate(u128d in,int n){
|
||||||
|
u128d out;
|
||||||
|
switch(n){
|
||||||
|
case 0:
|
||||||
|
out.f[0] = in.f[0];
|
||||||
|
out.f[1] = in.f[1];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
out.f[0] = in.f[1];
|
||||||
|
out.f[1] = in.f[0];
|
||||||
|
break;
|
||||||
|
default: assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//Complex float Reduce
|
//Complex float Reduce
|
||||||
template<>
|
template<>
|
||||||
inline Grid::ComplexF Reduce<Grid::ComplexF, u128f>::operator()(u128f in){ //2 complex
|
inline Grid::ComplexF Reduce<Grid::ComplexF, u128f>::operator()(u128f in){ //2 complex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user