fix this funny bug, which was (for some strange reason) not detected within the commits a few weeks ago...
This commit is contained in:
parent
8620c076be
commit
0570a502c0
4 changed files with 28 additions and 28 deletions
|
@ -96,7 +96,7 @@ namespace MultiArrayTools
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void minimizeAppearanceOfType(std::map<std::shared_ptr<IndexBase>, std::vector<BTSS> > mp,
|
void minimizeAppearanceOfType(std::map<std::shared_ptr<IndexBase>, std::vector<BTSS> >& mp,
|
||||||
BlockType bt)
|
BlockType bt)
|
||||||
{
|
{
|
||||||
size_t minNum = getBTNum( mp.begin()->second, bt );
|
size_t minNum = getBTNum( mp.begin()->second, bt );
|
||||||
|
@ -130,10 +130,8 @@ namespace MultiArrayTools
|
||||||
for(auto& xx: ivec){
|
for(auto& xx: ivec){
|
||||||
mp[xx] = second.block(xx);
|
mp[xx] = second.block(xx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// seek minimal number of VALUEs => guarantees absence of conflicting blocks
|
// seek minimal number of VALUEs => guarantees absence of conflicting blocks
|
||||||
minimizeAppearanceOfType(mp, BlockType::VALUE);
|
minimizeAppearanceOfType(mp, BlockType::VALUE);
|
||||||
|
|
||||||
// seek mininmal number of SPLITs => maximal vectorization possible
|
// seek mininmal number of SPLITs => maximal vectorization possible
|
||||||
minimizeAppearanceOfType(mp, BlockType::SPLIT);
|
minimizeAppearanceOfType(mp, BlockType::SPLIT);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
size_t getBTNum(const std::vector<BTSS>& mp, BlockType bt);
|
size_t getBTNum(const std::vector<BTSS>& mp, BlockType bt);
|
||||||
|
|
||||||
void minimizeAppearanceOfType(std::map<std::shared_ptr<IndexBase>, std::vector<BTSS> > mp,
|
void minimizeAppearanceOfType(std::map<std::shared_ptr<IndexBase>, std::vector<BTSS> >& mp,
|
||||||
BlockType bt);
|
BlockType bt);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace {
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'A')) ), xround(2.911 + 8.870 - 1.470) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'A')) ), xround(2.911 + 8.870 - 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 4.790 - 2.210) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 4.790 - 2.210) );
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
TEST_F(OpTest_MDim, ExecOp3)
|
TEST_F(OpTest_MDim, ExecOp3)
|
||||||
{
|
{
|
||||||
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
|
||||||
|
@ -181,21 +181,21 @@ namespace {
|
||||||
|
|
||||||
res(mi,si3) = ma1(mi) + ma2(si1) + ma3(si3);
|
res(mi,si3) = ma1(mi) + ma2(si1) + ma3(si3);
|
||||||
|
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('1','a'),'A')) ), xround(0.353 + 2.917 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('1','a'),'A')) ), xround(0.353 + 2.917 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('1','a'),'B')) ), xround(0.353 + 2.917 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('1','a'),'B')) ), xround(0.353 + 2.917 + 2.210) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('1','b'),'A')) ), xround(4.005 + 2.917 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('1','b'),'A')) ), xround(4.005 + 2.917 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('1','b'),'B')) ), xround(4.005 + 2.917 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('1','b'),'B')) ), xround(4.005 + 2.917 + 2.210) );
|
||||||
|
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('2','a'),'A')) ), xround(1.070 + 9.436 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('2','a'),'A')) ), xround(1.070 + 9.436 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('2','a'),'B')) ), xround(1.070 + 9.436 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('2','a'),'B')) ), xround(1.070 + 9.436 + 2.210) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('2','b'),'A')) ), xround(2.310 + 9.436 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('2','b'),'A')) ), xround(2.310 + 9.436 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('2','b'),'B')) ), xround(2.310 + 9.436 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('2','b'),'B')) ), xround(2.310 + 9.436 + 2.210) );
|
||||||
|
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','a'),'A')) ), xround(9.243 + 0.373 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','a'),'A')) ), xround(9.243 + 0.373 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','a'),'B')) ), xround(9.243 + 0.373 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','a'),'B')) ), xround(9.243 + 0.373 + 2.210) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'A')) ), xround(2.911 + 0.373 + 1.470) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'A')) ), xround(2.911 + 0.373 + 1.470) );
|
||||||
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 0.373 + 2.210) ) );
|
EXPECT_EQ( xround( res.at(mkt(mkt('3','b'),'B')) ), xround(2.911 + 0.373 + 2.210) );
|
||||||
}*/
|
}
|
||||||
|
|
||||||
} // anonymous namspace
|
} // anonymous namspace
|
||||||
|
|
||||||
|
|
|
@ -88,11 +88,12 @@ namespace MultiArrayHelper
|
||||||
std::shared_ptr<IndexBase> idxPtr)
|
std::shared_ptr<IndexBase> idxPtr)
|
||||||
{
|
{
|
||||||
auto& siPtr = std::get<N>(ip);
|
auto& siPtr = std::get<N>(ip);
|
||||||
|
//VCHECK(siPtr.id());
|
||||||
if(siPtr.get() == idxPtr.get()){
|
if(siPtr.get() == idxPtr.get()){
|
||||||
return std::get<N>(bs) + PackNum<N-1>::pp(ip, bs, idxPtr);
|
return PackNum<N-1>::pp(ip, bs, idxPtr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
size_t tmp = siPtr->pp(idxPtr);
|
int tmp = siPtr->pp(idxPtr);
|
||||||
if(siPtr->pos() == siPtr->max()){
|
if(siPtr->pos() == siPtr->max()){
|
||||||
(*siPtr) = 0;
|
(*siPtr) = 0;
|
||||||
return PackNum<N-1>::pp(ip, bs, idxPtr) - siPtr->max() + 1;
|
return PackNum<N-1>::pp(ip, bs, idxPtr) - siPtr->max() + 1;
|
||||||
|
@ -298,7 +299,8 @@ namespace MultiArrayHelper
|
||||||
return std::get<0>(bs);
|
return std::get<0>(bs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return siPtr->pp(idxPtr) * std::get<1>(bs);
|
int tmp = siPtr->pp(idxPtr);
|
||||||
|
return tmp * std::get<1>(bs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue