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,9 +451,27 @@ namespace CNORXZ
template <class FormatT, class... Indices> template <class FormatT, class... Indices>
bool GMIndex<FormatT,Indices...>::formatIsTrivial() const bool GMIndex<FormatT,Indices...>::formatIsTrivial() const
{ {
CXZ_ERROR("IMPLEMENT!!!"); if constexpr(std::is_same<FormatT,None>::value){
return true; 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> template <class FormatT, class... Indices>
GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator()(const Sptr<MIndex<Indices...>>& mi) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator()(const Sptr<MIndex<Indices...>>& mi)

View file

@ -403,7 +403,19 @@ namespace CNORXZ
bool YIndex::formatIsTrivial() const 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; return true;
} }