dev #2

Merged
chizeta merged 32 commits from dev into main 2024-02-02 20:36:53 +01:00
2 changed files with 12 additions and 8 deletions
Showing only changes of commit 0eb505f41b - Show all commits

View file

@ -551,21 +551,21 @@ namespace CNORXZ
GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>&
GMIndex<FormatT,Indices...>::reformat(const Vector<SizeT>& f, const Vector<SizeT>& s) GMIndex<FormatT,Indices...>::reformat(const Vector<SizeT>& f, const Vector<SizeT>& s)
{ {
// f: input format
// s: input sizes
CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()");
if(f.size() == 1){ if(f.size() == 1){
CXZ_ASSERT(s.size() == 1, "f.size() != s.size()");
CXZ_ASSERT(s[0] == lmax().val(), "got inconsistent size; expeected " CXZ_ASSERT(s[0] == lmax().val(), "got inconsistent size; expeected "
<< lmax().val() << ", got " << s[0]); << lmax().val() << ", got " << s[0]);
return *this; return *this;
} }
if constexpr(std::is_same<FormatT,None>::value){ if constexpr(std::is_same<FormatT,None>::value){
CXZ_ASSERT(CNORXZ::formatIsTrivial(f,s), CXZ_ASSERT(CNORXZ::formatIsTrivial(f,s),
"cannot reformat MIndex with format type = None"); "cannot reformat MIndex with format type = None");
return *this; return *this;
} }
else { else {
CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()");
// f: input format
// s: input sizes
SizeT j = 0; SizeT j = 0;
SizeT j0 = 0; SizeT j0 = 0;
SizeT xi = 1; SizeT xi = 1;

View file

@ -415,9 +415,15 @@ namespace CNORXZ
YIndex& YIndex::reformat(const Vector<SizeT>& f, const Vector<SizeT>& s) YIndex& YIndex::reformat(const Vector<SizeT>& f, const Vector<SizeT>& s)
{ {
CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()");
// f: input format // f: input format
// s: input sizes // s: input sizes
CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()");
if(f.size() == 1){
CXZ_ASSERT(s[0] == lmax().val(), "got inconsistent size; expeected "
<< lmax().val() << ", got " << s[0]);
return *this;
}
SizeT j = 0; SizeT j = 0;
SizeT j0 = 0; SizeT j0 = 0;
SizeT xi = 1; SizeT xi = 1;
@ -427,9 +433,7 @@ namespace CNORXZ
xi *= mIs[i]->lmax().val(); xi *= mIs[i]->lmax().val();
SizeT xj = s[j]; SizeT xj = s[j];
if(xi < xj) { if(xi < xj) {
// TODO: IMPLEMENT!!! CXZ_ERROR("reformating with lower-dimensional formats is not possible; use sub-indices instead");
// check trivial format in this partition
CXZ_ERROR("reformating with lower-dimensional formats has not yet been implemented");
continue; continue;
} }
j0 = j; j0 = j;