mindex: setSub

This commit is contained in:
Christian Zimmermann 2024-07-04 19:32:51 +02:00
parent 40fd0251db
commit 3835859a5e
2 changed files with 16 additions and 0 deletions

View file

@ -629,6 +629,15 @@ namespace CNORXZ
return *this; return *this;
} }
template <class FormatT, class... Indices>
template <SizeT I>
GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::setSub(CSizeT<I> ind, SizeT lex)
{
mIPack[ind] = lex;
return operator()();
}
template <class... Indices> template <class... Indices>
constexpr decltype(auto) mindex(const Sptr<Indices>&... is) constexpr decltype(auto) mindex(const Sptr<Indices>&... is)
{ {

View file

@ -182,6 +182,13 @@ namespace CNORXZ
/** Assign new index format. */ /** Assign new index format. */
GMIndex& setFormat(const FormatT& bs); 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 <SizeT I>
GMIndex& setSub(CSizeT<I> ind, SizeT lex);
private: private:
template <SizeT... Is> template <SizeT... Is>
static constexpr decltype(auto) mkLexFormat(const SPack<Indices...>& ipack, Isq<Is...> is); static constexpr decltype(auto) mkLexFormat(const SPack<Indices...>& ipack, Isq<Is...> is);