for: replace * by () in position calculation

This commit is contained in:
Christian Zimmermann 2023-01-29 23:42:12 +01:00
parent 792c3bd84e
commit 65e7539666
2 changed files with 15 additions and 16 deletions

View file

@ -167,8 +167,7 @@ namespace CNORXZ
template <class Xpr, class F> template <class Xpr, class F>
decltype(auto) PIndex<Index>::ifor(const Xpr& xpr, F&& f) const decltype(auto) PIndex<Index>::ifor(const Xpr& xpr, F&& f) const
{ {
/*return For<0,Xpr,F>(this->pmax().val(), this->id(), xpr, std::forward<F>(f));*/ return For<0,Xpr,F>(this->pmax().val(), this->id(), xpr, std::forward<F>(f));
/*!!!!!*/
} }
template <class Index> template <class Index>

View file

@ -28,16 +28,16 @@ namespace CNORXZ
{ {
if constexpr(std::is_same<typename std::remove_reference<F>::type,NoF>::value){ if constexpr(std::is_same<typename std::remove_reference<F>::type,NoF>::value){
for(SizeT i = 0; i != mSize; ++i){ for(SizeT i = 0; i != mSize; ++i){
const auto pos = last + mExt * UPos(i); const auto pos = last + mExt( UPos(i) );
mXpr(pos); mXpr(pos);
} }
} }
else { else {
typedef typename typedef typename
std::remove_reference<decltype(mXpr(last + mExt * UPos(0)))>::type OutT; std::remove_reference<decltype(mXpr(last + mExt( UPos(0) )))>::type OutT;
auto o = OutT(); auto o = OutT();
for(SizeT i = 0; i != mSize; ++i){ for(SizeT i = 0; i != mSize; ++i){
const auto pos = last + mExt * UPos(i); const auto pos = last + mExt( UPos(i) );
mF(o, mXpr(pos)); mF(o, mXpr(pos));
} }
return o; return o;
@ -49,15 +49,15 @@ namespace CNORXZ
{ {
if constexpr(std::is_same<typename std::remove_reference<F>::type,NoF>::value){ if constexpr(std::is_same<typename std::remove_reference<F>::type,NoF>::value){
for(SizeT i = 0; i != mSize; ++i){ for(SizeT i = 0; i != mSize; ++i){
const auto pos = mExt * UPos(i); const auto pos = mExt( UPos(i) );
mXpr(pos); mXpr(pos);
} }
} }
else { else {
typedef typename std::remove_reference<decltype(mXpr(mExt * UPos(0)))>::type OutT; typedef typename std::remove_reference<decltype(mXpr(mExt( UPos(0) )))>::type OutT;
auto o = OutT(); auto o = OutT();
for(SizeT i = 0; i != mSize; ++i){ for(SizeT i = 0; i != mSize; ++i){
const auto pos = mExt * UPos(i); const auto pos = mExt( UPos(i) );
mF(o, mXpr(pos)); mF(o, mXpr(pos));
} }
return o; return o;
@ -136,7 +136,7 @@ namespace CNORXZ
constexpr decltype(auto) SFor<N,L,Xpr,F>::exec(const PosT& last) const constexpr decltype(auto) SFor<N,L,Xpr,F>::exec(const PosT& last) const
{ {
constexpr SPos<I> i; constexpr SPos<I> i;
const auto pos = last + mExt * i; const auto pos = last + mExt( i );
if constexpr(I < N-1){ if constexpr(I < N-1){
return mF(mXpr(pos),exec<I+1>(last)); return mF(mXpr(pos),exec<I+1>(last));
} }
@ -150,7 +150,7 @@ namespace CNORXZ
constexpr decltype(auto) SFor<N,L,Xpr,F>::exec() const constexpr decltype(auto) SFor<N,L,Xpr,F>::exec() const
{ {
constexpr SPos<I> i; constexpr SPos<I> i;
const auto pos = mExt * i; const auto pos = mExt( i );
if constexpr(I < N-1){ if constexpr(I < N-1){
return mF(mXpr(pos),exec<I+1>()); return mF(mXpr(pos),exec<I+1>());
} }
@ -164,7 +164,7 @@ namespace CNORXZ
inline void SFor<N,L,Xpr,F>::exec2(const PosT& last) const inline void SFor<N,L,Xpr,F>::exec2(const PosT& last) const
{ {
constexpr SPos<I> i; constexpr SPos<I> i;
const auto pos = last + mExt * i; const auto pos = last + mExt( i );
if constexpr(I < N-1){ if constexpr(I < N-1){
mXpr(pos); mXpr(pos);
exec2<I+1>(last); exec2<I+1>(last);
@ -180,7 +180,7 @@ namespace CNORXZ
inline void SFor<N,L,Xpr,F>::exec2() const inline void SFor<N,L,Xpr,F>::exec2() const
{ {
constexpr SPos<I> i; constexpr SPos<I> i;
const auto pos = mExt * i; const auto pos = mExt( i );
if constexpr(I < N-1){ if constexpr(I < N-1){
mXpr(pos); mXpr(pos);
exec2<I+1>(); exec2<I+1>();
@ -232,7 +232,7 @@ namespace CNORXZ
template <class PosT> template <class PosT>
inline decltype(auto) TFor<L,Xpr,F>::operator()(const PosT& last) const inline decltype(auto) TFor<L,Xpr,F>::operator()(const PosT& last) const
{ {
typedef typename std::remove_reference<decltype(mXpr(last + mExt * UPos(0)))>::type OutT; typedef typename std::remove_reference<decltype(mXpr(last + mExt( UPos(0) )))>::type OutT;
int i = 0; int i = 0;
const int size = static_cast<int>(mSize); const int size = static_cast<int>(mSize);
Vector<OutT> ov; Vector<OutT> ov;
@ -245,7 +245,7 @@ namespace CNORXZ
auto xpr = mXpr; auto xpr = mXpr;
#pragma omp for #pragma omp for
for(i = 0; i < size; i++){ for(i = 0; i < size; i++){
const auto pos = last + mExt * UPos(i); const auto pos = last + mExt( UPos(i) );
xpr(pos); xpr(pos);
} }
} }
@ -262,7 +262,7 @@ namespace CNORXZ
template <SizeT L, class Xpr, class F> template <SizeT L, class Xpr, class F>
inline decltype(auto) TFor<L,Xpr,F>::operator()() const inline decltype(auto) TFor<L,Xpr,F>::operator()() const
{ {
typedef typename std::remove_reference<decltype(mXpr(mExt * UPos(0)))>::type OutT; typedef typename std::remove_reference<decltype(mXpr(mExt( UPos(0) )))>::type OutT;
int i = 0; int i = 0;
const int size = static_cast<int>(mSize); const int size = static_cast<int>(mSize);
Vector<OutT> ov; Vector<OutT> ov;
@ -275,7 +275,7 @@ namespace CNORXZ
auto xpr = mXpr; auto xpr = mXpr;
#pragma omp for #pragma omp for
for(i = 0; i < size; i++){ for(i = 0; i < size; i++){
const auto pos = mExt * UPos(i); const auto pos = mExt( UPos(i) );
xpr(pos); xpr(pos);
} }
} }