1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Added tRotate function and MaddRealPart struct for generic SIMD, bugfix in MultRealPart and minor cosmetic changes.

This commit is contained in:
Lanny91 2017-02-22 14:57:10 +00:00
parent 95625a7bd1
commit c80948411b
2 changed files with 23 additions and 4 deletions

View File

@ -163,13 +163,26 @@ namespace Optimization {
VECTOR_FOR(i, W<T>::c, 1)
{
out.v[2*i] = a[2*i]*b[2*i];
out.v[2*i+1] = a[2*i]*b[2*i+1];
out.v[2*i] = a.v[2*i]*b.v[2*i];
out.v[2*i+1] = a.v[2*i]*b.v[2*i+1];
}
return out;
};
}
};
struct MaddRealPart{
template <typename T>
inline vec<T> operator()(vec<T> a, vec<T> b, vec<T> c){
vec<T> out;
VECTOR_FOR(i, W<T>::c, 1)
{
out.v[2*i] = a.v[2*i]*b.v[2*i] + c.v[2*i];
out.v[2*i+1] = a.v[2*i]*b.v[2*i+1] + c.v[2*i+1];
}
return out;
}
};
struct MultComplex{
// Complex
@ -300,6 +313,11 @@ namespace Optimization {
}
struct Rotate{
template <int n, typename T> static inline vec<T> tRotate(vec<T> in){
return rotate(in, n);
}
template <typename T>
static inline vec<T> rotate(vec<T> in, int n){
vec<T> out;
@ -407,6 +425,7 @@ namespace Optimization {
typedef Optimization::Mult MultSIMD;
typedef Optimization::MultComplex MultComplexSIMD;
typedef Optimization::MultRealPart MultRealPartSIMD;
typedef Optimization::MaddRealPart MaddRealPartSIMD;
typedef Optimization::Conj ConjSIMD;
typedef Optimization::TimesMinusI TimesMinusISIMD;
typedef Optimization::TimesI TimesISIMD;

View File

@ -75,6 +75,6 @@ namespace Optimization {
typedef vec<float> vecf;
typedef vec<double> vecd;
typedef vec<Integer> veci;
typedef vec<Integer> veci;
}}