implement missing trivial format checks
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Christian Zimmermann 2023-11-06 23:21:03 +01:00
parent be44541135
commit 3d08dc530e
2 changed files with 33 additions and 3 deletions

View file

@ -451,8 +451,26 @@ namespace CNORXZ
template <class FormatT, class... Indices>
bool GMIndex<FormatT,Indices...>::formatIsTrivial() const
{
CXZ_ERROR("IMPLEMENT!!!");
return true;
if constexpr(std::is_same<FormatT,None>::value){
return true;
}
else {
const bool ret1 = iter<0,NI>
( [&](auto i) { return mIPack[i]->formatIsTrivial(); },
[](const auto&... x) { return (x and ...); } );
if(not ret1){
return false;
}
const bool ret2 = iter<0,NI-1>
( [&](auto j) { return mFormat[CSizeT<j>{}].val() == mIPack[CSizeT<j+1>{}].lmax().val() * mFormat[CSizeT<j+1>{}].val(); },
[](const auto&... x) { return (x and ...); });
if(ret2 and mFormat[CSizeT<NI-1>{}].val() == 1){
return true;
}
else {
return false;
}
}
}
template <class FormatT, class... Indices>

View file

@ -403,7 +403,19 @@ namespace CNORXZ
bool YIndex::formatIsTrivial() const
{
CXZ_ERROR("IMPLEMENT!!!");
for(SizeT i = 0; i != mIs.size(); ++i){
if(not mIs[i]->formatIsTrivial()){
return false;
}
}
SizeT b = 1;
for(SizeT i = mFormat.size(); i != 0; --i){
const SizeT j = i-1;
if(mFormat[j].val() != b){
return false;
}
b *= mIs[j]->pmax().val();
}
return true;
}