WIP: index format
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Christian Zimmermann 2023-12-28 21:57:05 +01:00
parent c72fbc329d
commit ab4cb78258
2 changed files with 35 additions and 23 deletions

View file

@ -562,25 +562,23 @@ namespace CNORXZ
// s: input sizes // s: input sizes
SizeT j = 0; SizeT j = 0;
SizeT j0 = 0; SizeT j0 = 0;
SizeT xi = 1;
typename FormatT::InputType nformat; typename FormatT::InputType nformat;
auto mkFv = [&]() {
Vector<SizeT> o(NI);
SizeT i = 0;
for(const auto& y:mFormat.all()) { o[i++] = y.val(); }
return o;
};
iter<0,NI>( [&](auto i) { iter<0,NI>( [&](auto i) {
SizeT si = 1; CXZ_ASSERT(j != s.size(), "incompatible format");
if(mIPack[i]->lmax().val() != 1){ xi *= mIPack[i]->lmax().val();
// CHECK!!! SizeT xj = s[j];
for(; si < mIPack[i]->lmax().val(); ++j){ if(xi >= xj){
si *= s[i]; j0 = j;
CXZ_ASSERT(j < f.size(), "incompatible index formats"); while(xj < xi){
++j;
CXZ_ASSERT(j != s.size(), "incompatible format");
xj *= s[j];
} }
CXZ_ASSERT(si == mIPack[i]->lmax().val(), CXZ_ASSERT(xj == xi, "incompatible format");
"incompatible index formats: " << toString(f) << " vs " xi = 1;
<< toString(mkFv()) << " ( " << si << " != " ++j;
<< mIPack[i]->lmax().val() << " ) ");
Vector<SizeT> nf(j-j0); Vector<SizeT> nf(j-j0);
Vector<SizeT> ns(j-j0); Vector<SizeT> ns(j-j0);
std::copy(f.begin()+j0,f.begin()+j,nf.begin()); std::copy(f.begin()+j0,f.begin()+j,nf.begin());
@ -591,6 +589,11 @@ namespace CNORXZ
std::copy(s.begin()+j0,s.begin()+j,ns.begin()); std::copy(s.begin()+j0,s.begin()+j,ns.begin());
mIPack[i]->reformat(nf,ns); mIPack[i]->reformat(nf,ns);
} }
else {
//!!!
// check that format is trivial in this partition
CXZ_ERROR("...");
}
}, NoF {}); }, NoF {});
mFormat = FormatT(nformat); mFormat = FormatT(nformat);
return *this; return *this;

View file

@ -420,18 +420,27 @@ namespace CNORXZ
// s: input sizes // s: input sizes
SizeT j = 0; SizeT j = 0;
SizeT j0 = 0; SizeT j0 = 0;
SizeT xi = 1;
Vector<UPos> nformat; Vector<UPos> nformat;
for(SizeT i = 0; i != dim(); ++i){ for(SizeT i = 0; i != dim(); ++i){
SizeT si = 1; CXZ_ASSERT(j != s.size(), "incompatible index formats");
if(mIs[i]->lmax().val() == 1){ xi *= mIs[i]->lmax().val();
SizeT xj = s[j];
if(xi < xj) {
// check trivial format in this partition
CXZ_ERROR("...");
continue; continue;
} }
for(; si < mIs[i]->lmax().val(); ++j){ j0 = j;
si *= s[i]; while(xj < xi){
CXZ_ASSERT(j < f.size(), "incompatible index formats"); ++j;
CXZ_ASSERT(j != s.size(), "incompatible index formats");
xj *= s[j];
} }
CXZ_ASSERT(si == mIs[i]->lmax().val(), CXZ_ASSERT(xj == xi, "incompatible index formats");
"incompatible index formats: " << toString(s) << " vs " /*!!!*/); xi = 1;
++j;
Vector<SizeT> nf(j-j0); Vector<SizeT> nf(j-j0);
Vector<SizeT> ns(j-j0); Vector<SizeT> ns(j-j0);
std::copy(f.begin()+j0,f.begin()+j,nf.begin()); std::copy(f.begin()+j0,f.begin()+j,nf.begin());