updating sub indices should be faster now
This commit is contained in:
parent
5318146710
commit
6439542968
2 changed files with 22 additions and 17 deletions
|
@ -44,7 +44,7 @@ namespace MultiArrayTools
|
||||||
std::cout << "assignment: " << endPos << " elements" << std::endl;
|
std::cout << "assignment: " << endPos << " elements" << std::endl;
|
||||||
// assignment loop
|
// assignment loop
|
||||||
for(iref = mArrayRef.beginIndex().pos(); iref != mArrayRef.endIndex(); ++iref){
|
for(iref = mArrayRef.beginIndex().pos(); iref != mArrayRef.endIndex(); ++iref){
|
||||||
std::cout << iref.pos() << '\r' << std::flush;
|
//std::cout << iref.pos() << '\r' << std::flush;
|
||||||
get() = in.get();
|
get() = in.get();
|
||||||
//assert(not std::isnan( get() ));
|
//assert(not std::isnan( get() ));
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace MultiArrayTools
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void plus(MultiIndex& index, int num)
|
static inline void plus(MultiIndex& index, int num)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(DIGIT);
|
auto& si = index.template getIndex<DIGIT>();
|
||||||
si.setPosRel(num);
|
si.setPosRel(num);
|
||||||
size_t oor = si.outOfRange();
|
size_t oor = si.outOfRange();
|
||||||
if(oor > 0){
|
if(oor > 0){
|
||||||
|
@ -96,26 +96,28 @@ namespace MultiArrayTools
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void pp(MultiIndex& index)
|
static inline void pp(MultiIndex& index)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(DIGIT);
|
auto& si = index.template getIndex<DIGIT>();
|
||||||
si.setPosRel(1);
|
//IndefinitIndexBase& si = index.get(DIGIT);
|
||||||
size_t oor = si.outOfRange();
|
if(si.pos() == si.max()-1){
|
||||||
if(oor > 0){
|
si.setPos(0);
|
||||||
SubIteration<DIGIT-1>::pp(index);
|
SubIteration<DIGIT-1>::pp(index);
|
||||||
// set pos to zero ??
|
}
|
||||||
SubIteration<DIGIT>::plus(index, -si.max()); // This can be done faster because we know the pos
|
else {
|
||||||
|
si.setPosRel(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void mm(MultiIndex& index)
|
static inline void mm(MultiIndex& index)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(DIGIT);
|
auto& si = index.template getIndex<DIGIT>();
|
||||||
si.setPosRel(-1);
|
//IndefinitIndexBase& si = index.get(DIGIT);
|
||||||
size_t oor = si.outOfRange();
|
if(si.pos() == si.max()-1){
|
||||||
if(oor < 0){
|
si.setPos(si.max()-1);
|
||||||
SubIteration<DIGIT-1>::mm(index);
|
SubIteration<DIGIT-1>::mm(index);
|
||||||
// or to max here ??
|
}
|
||||||
SubIteration<DIGIT>::plus(index, si.max()); // This can be done faster because we know the pos
|
else {
|
||||||
|
si.setPosRel(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -126,21 +128,24 @@ namespace MultiArrayTools
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void plus(MultiIndex& index, int num)
|
static inline void plus(MultiIndex& index, int num)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(0);
|
auto& si = index.template getIndex<0>();
|
||||||
|
//IndefinitIndexBase& si = index.get(0);
|
||||||
si.setPosRel(num);
|
si.setPosRel(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void pp(MultiIndex& index)
|
static inline void pp(MultiIndex& index)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(0);
|
auto& si = index.template getIndex<0>();
|
||||||
|
//IndefinitIndexBase& si = index.get(0);
|
||||||
si.setPosRel(1);
|
si.setPosRel(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MultiIndex>
|
template <class MultiIndex>
|
||||||
static inline void mm(MultiIndex& index)
|
static inline void mm(MultiIndex& index)
|
||||||
{
|
{
|
||||||
IndefinitIndexBase& si = index.get(0);
|
auto& si = index.template getIndex<0>();
|
||||||
|
//IndefinitIndexBase& si = index.get(0);
|
||||||
si.setPosRel(-1);
|
si.setPosRel(-1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue