diff --git a/src/include/array/array_base.cc.h b/src/include/array/array_base.cc.h index 8854a2b..0cab6c7 100644 --- a/src/include/array/array_base.cc.h +++ b/src/include/array/array_base.cc.h @@ -222,8 +222,7 @@ namespace CNORXZ OpRoot ArrayBase::operator()(const Sptr& i) { //CXZ_WARNING("FORMAT / BLOCKSIZES!!!"); - auto j = moveToPtr( begin()->formatTo(i) ); // moveToPtr: keep original instance of sub indices - return oproot(*this, j); + return oproot(*this, i); } template @@ -231,16 +230,14 @@ namespace CNORXZ inline decltype(auto) ArrayBase::operator()(const SPack& pack) { //CXZ_WARNING("FORMAT / BLOCKSIZES!!!"); - auto j = moveToPtr( begin()->formatTo(mindexPtr(pack)) ); - return oproot(*this, j); + return oproot(*this, mindexPtr(pack)); } template inline decltype(auto) ArrayBase::operator()(const DPack& pack) { //CXZ_WARNING("FORMAT / BLOCKSIZES!!!"); - auto j = moveToPtr( begin()->formatTo(yindexPtr(pack)) ); - return oproot(*this, j); + return oproot(*this, yindexPtr(pack)); } /***************************** diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index 0419742..3a6801b 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -390,41 +390,6 @@ namespace CNORXZ static_assert(is_index::value, "got non-index"); CXZ_ASSERT(ind.dim() >= dim(), "for formatting index of dimension " << dim() << " need index of at least the same dimension, got " << ind.dim()); - - if constexpr(index_is_multi::value){ - if constexpr(has_static_sub::value){ // static dim (GMIndex) - // assert either same dim, dim == 1, or static sizes - CXZ_WARNING("not implemented!"); - } - else { // YIndex - SizeT j = 0; - iter<0,NI> - ( [&](auto i){ - CXZ_ASSERT(j < ind.dim(), "no sub indices left"); - const auto isize = pack()[i]->size(); - SizeT ssize = 1; - for(; j < ind.dim() and ssize < isize; ++j){ - ssize *= ind.pack()[j]; - } - CXZ_ASSERT(ssize == isize, "incompatible sizes: " << ssize - << " vs " << isize); - }, - - ); - } - } - else { - if(ind.dim() > 1) { // DIndex to YIndex - - } - else { // this->dim() == 1 and ind.dim() == 1 - static_assert - (std::is_same>::type, - "got incompatible static index format types"); - mFormat = ind.format(); - // assert that all lower indices in ind have dim == 1!!! - } - } return *this; } @@ -514,6 +479,13 @@ namespace CNORXZ return mLexFormat; } + template + auto GMIndex::deepFormat() const + { + return iter<0,NI>( [&](auto i) { return std::get(mIPack)->deepFormat(); }, + [&](const auto&... e) { return (e * ...); } ); + } + template GMIndex& GMIndex::setFormat(const FormatT& bs) { diff --git a/src/include/ranges/mrange.h b/src/include/ranges/mrange.h index ec7ec00..1ec4499 100644 --- a/src/include/ranges/mrange.h +++ b/src/include/ranges/mrange.h @@ -81,6 +81,7 @@ namespace CNORXZ const SPack& pack() const; const auto& format() const; const auto& lexFormat() const; + auto deepFormat() const; GMIndex& setFormat(const FormatT& bs); private: