From bd721ce1c8ed1111c25d6fc92f82becc91897c3a Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 15 May 2015 11:43:20 +0100 Subject: [PATCH] Force inlining upon icpc --- lib/math/Grid_math_tensors.h | 72 ++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/math/Grid_math_tensors.h b/lib/math/Grid_math_tensors.h index 8b3e4b1b..a0424576 100644 --- a/lib/math/Grid_math_tensors.h +++ b/lib/math/Grid_math_tensors.h @@ -42,46 +42,46 @@ public: zeroit(*this); return *this; } - friend void vstream(iScalar &out,const iScalar &in){ + friend strong_inline void vstream(iScalar &out,const iScalar &in){ vstream(out._internal,in._internal); } - friend void zeroit(iScalar &that){ + friend strong_inline void zeroit(iScalar &that){ zeroit(that._internal); } - friend void prefetch(iScalar &that){ + friend strong_inline void prefetch(iScalar &that){ prefetch(that._internal); } - friend void permute(iScalar &out,const iScalar &in,int permutetype){ + friend strong_inline void permute(iScalar &out,const iScalar &in,int permutetype){ permute(out._internal,in._internal,permutetype); } // Unary negation - friend inline iScalar operator -(const iScalar &r) { + friend strong_inline iScalar operator -(const iScalar &r) { iScalar ret; ret._internal= -r._internal; return ret; } // *=,+=,-= operators inherit from corresponding "*,-,+" behaviour - inline iScalar &operator *=(const iScalar &r) { + strong_inline iScalar &operator *=(const iScalar &r) { *this = (*this)*r; return *this; } - inline iScalar &operator -=(const iScalar &r) { + strong_inline iScalar &operator -=(const iScalar &r) { *this = (*this)-r; return *this; } - inline iScalar &operator +=(const iScalar &r) { + strong_inline iScalar &operator +=(const iScalar &r) { *this = (*this)+r; return *this; } - inline vtype & operator ()(void) { + strong_inline vtype & operator ()(void) { return _internal; } - inline const vtype & operator ()(void) const { + strong_inline const vtype & operator ()(void) const { return _internal; } @@ -89,7 +89,7 @@ public: operator RealD () const { return(real(TensorRemove(_internal))); } // convert from a something to a scalar - template::value, T>::type* = nullptr > inline auto operator = (T arg) -> iScalar + template::value, T>::type* = nullptr > strong_inline auto operator = (T arg) -> iScalar { _internal = vtype(arg); return *this; @@ -103,8 +103,8 @@ public: /////////////////////////////////////////////////////////// // Allows to turn scalar>>> back to double. /////////////////////////////////////////////////////////// -template inline typename std::enable_if::value, T>::type TensorRemove(T arg) { return arg;} -template inline auto TensorRemove(iScalar arg) -> decltype(TensorRemove(arg._internal)) +template strong_inline typename std::enable_if::value, T>::type TensorRemove(T arg) { return arg;} +template strong_inline auto TensorRemove(iScalar arg) -> decltype(TensorRemove(arg._internal)) { return TensorRemove(arg._internal); } @@ -130,48 +130,48 @@ public: zeroit(*this); return *this; } - friend void zeroit(iVector &that){ + friend strong_inline void zeroit(iVector &that){ for(int i=0;i &that){ + friend strong_inline void prefetch(iVector &that){ for(int i=0;i &out,const iVector &in){ + friend strong_inline void vstream(iVector &out,const iVector &in){ for(int i=0;i &out,const iVector &in,int permutetype){ + friend strong_inline void permute(iVector &out,const iVector &in,int permutetype){ for(int i=0;i operator -(const iVector &r) { + friend strong_inline iVector operator -(const iVector &r) { iVector ret; for(int i=0;i &operator *=(const iScalar &r) { + strong_inline iVector &operator *=(const iScalar &r) { *this = (*this)*r; return *this; } - inline iVector &operator -=(const iVector &r) { + strong_inline iVector &operator -=(const iVector &r) { *this = (*this)-r; return *this; } - inline iVector &operator +=(const iVector &r) { + strong_inline iVector &operator +=(const iVector &r) { *this = (*this)+r; return *this; } - inline vtype & operator ()(int i) { + strong_inline vtype & operator ()(int i) { return _internal[i]; } - inline const vtype & operator ()(int i) const { + strong_inline const vtype & operator ()(int i) const { return _internal[i]; } friend std::ostream& operator<< (std::ostream& stream, const iVector &o){ @@ -183,7 +183,7 @@ public: stream<<"}"; return stream; }; - // inline vtype && operator ()(int i) { + // strong_inline vtype && operator ()(int i) { // return _internal[i]; // } }; @@ -211,7 +211,7 @@ public: zeroit(*this); return *this; } - template::value, T>::type* = nullptr > inline auto operator = (T arg) -> iMatrix + template::value, T>::type* = nullptr > strong_inline auto operator = (T arg) -> iMatrix { zeroit(*this); for(int i=0;i &that){ + friend strong_inline void zeroit(iMatrix &that){ for(int i=0;i &that){ + friend strong_inline void prefetch(iMatrix &that){ for(int i=0;i &out,const iMatrix &in){ + friend strong_inline void vstream(iMatrix &out,const iMatrix &in){ for(int i=0;i &out,const iMatrix &in,int permutetype){ + friend strong_inline void permute(iMatrix &out,const iMatrix &in,int permutetype){ for(int i=0;i operator -(const iMatrix &r) { + friend strong_inline iMatrix operator -(const iMatrix &r) { iMatrix ret; for(int i=0;i - inline iMatrix &operator *=(const T &r) { + strong_inline iMatrix &operator *=(const T &r) { *this = (*this)*r; return *this; } template - inline iMatrix &operator -=(const T &r) { + strong_inline iMatrix &operator -=(const T &r) { *this = (*this)-r; return *this; } template - inline iMatrix &operator +=(const T &r) { + strong_inline iMatrix &operator +=(const T &r) { *this = (*this)+r; return *this; } // returns an lvalue reference - inline vtype & operator ()(int i,int j) { + strong_inline vtype & operator ()(int i,int j) { return _internal[i][j]; } - inline const vtype & operator ()(int i,int j) const { + strong_inline const vtype & operator ()(int i,int j) const { return _internal[i][j]; } friend std::ostream& operator<< (std::ostream& stream, const iMatrix &o){ @@ -289,7 +289,7 @@ public: return stream; }; - // inline vtype && operator ()(int i,int j) { + // strong_inline vtype && operator ()(int i,int j) { // return _internal[i][j]; // }