From 0eb505f41b853176fdc0e8a04b5447e3dc41445e Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 3 Jan 2024 19:18:20 +0100 Subject: [PATCH] yrange: solve lower-dim-reformat issue --- src/include/ranges/mrange.cc.h | 8 ++++---- src/lib/ranges/yrange.cc | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index 8891653..b9ea9ac 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -551,21 +551,21 @@ namespace CNORXZ GMIndex& GMIndex::reformat(const Vector& f, const Vector& s) { + // f: input format + // s: input sizes + CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()"); if(f.size() == 1){ - CXZ_ASSERT(s.size() == 1, "f.size() != s.size()"); CXZ_ASSERT(s[0] == lmax().val(), "got inconsistent size; expeected " << lmax().val() << ", got " << s[0]); return *this; } + if constexpr(std::is_same::value){ CXZ_ASSERT(CNORXZ::formatIsTrivial(f,s), "cannot reformat MIndex with format type = None"); return *this; } else { - CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()"); - // f: input format - // s: input sizes SizeT j = 0; SizeT j0 = 0; SizeT xi = 1; diff --git a/src/lib/ranges/yrange.cc b/src/lib/ranges/yrange.cc index f93fdbd..c71a5d7 100644 --- a/src/lib/ranges/yrange.cc +++ b/src/lib/ranges/yrange.cc @@ -415,9 +415,15 @@ namespace CNORXZ YIndex& YIndex::reformat(const Vector& f, const Vector& s) { - CXZ_ASSERT(f.size() == s.size(), "input error: f.size() != s.size()"); // f: input format // 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 j0 = 0; SizeT xi = 1; @@ -427,9 +433,7 @@ namespace CNORXZ xi *= mIs[i]->lmax().val(); SizeT xj = s[j]; if(xi < xj) { - // TODO: IMPLEMENT!!! - // check trivial format in this partition - CXZ_ERROR("reformating with lower-dimensional formats has not yet been implemented"); + CXZ_ERROR("reformating with lower-dimensional formats is not possible; use sub-indices instead"); continue; } j0 = j;