From 3835859a5e27fdc90e244134f67db1abbd1a9025 Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Thu, 4 Jul 2024 19:32:51 +0200 Subject: [PATCH] mindex: setSub --- src/include/ranges/mrange.cc.h | 9 +++++++++ src/include/ranges/mrange.h | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/src/include/ranges/mrange.cc.h b/src/include/ranges/mrange.cc.h index ee29536..2a6d16a 100644 --- a/src/include/ranges/mrange.cc.h +++ b/src/include/ranges/mrange.cc.h @@ -629,6 +629,15 @@ namespace CNORXZ return *this; } + template + template + GMIndex& GMIndex::setSub(CSizeT ind, SizeT lex) + { + mIPack[ind] = lex; + return operator()(); + } + + template constexpr decltype(auto) mindex(const Sptr&... is) { diff --git a/src/include/ranges/mrange.h b/src/include/ranges/mrange.h index 6d59cb9..32f2d7c 100644 --- a/src/include/ranges/mrange.h +++ b/src/include/ranges/mrange.h @@ -182,6 +182,13 @@ namespace CNORXZ /** Assign new index format. */ GMIndex& setFormat(const FormatT& bs); + /** Set position of given sub index and update total index position. + @param ind Sub-index number [0,dim()-1]. + @param lex Lexicographic position to be assigned to the index. + */ + template + GMIndex& setSub(CSizeT ind, SizeT lex); + private: template static constexpr decltype(auto) mkLexFormat(const SPack& ipack, Isq is);