mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-10 03:17:07 +01:00
Some unary ops and coarse grid support
This commit is contained in:
@ -35,6 +35,14 @@ namespace Grid {
|
||||
}
|
||||
};
|
||||
|
||||
template<class scalar> struct ModIntFunctor {
|
||||
Integer y;
|
||||
ModIntFunctor(Integer _y) : y(_y) {};
|
||||
scalar operator()(const scalar &a) const {
|
||||
return Integer(a)%y;
|
||||
}
|
||||
};
|
||||
|
||||
template < class S, class V >
|
||||
inline Grid_simd<S,V> sqrt(const Grid_simd<S,V> &r) {
|
||||
return SimdApply(SqrtRealFunctor<S>(),r);
|
||||
@ -55,6 +63,10 @@ namespace Grid {
|
||||
inline Grid_simd<S,V> pow(const Grid_simd<S,V> &r,double y) {
|
||||
return SimdApply(PowRealFunctor<S>(y),r);
|
||||
}
|
||||
template < class S, class V >
|
||||
inline Grid_simd<S,V> mod(const Grid_simd<S,V> &r,Integer y) {
|
||||
return SimdApply(ModIntFunctor<S>(y),r);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user