mindex: replace block sizes by format

This commit is contained in:
Christian Zimmermann 2023-01-03 18:11:45 +01:00
parent 53aa87c362
commit 8787ec7590
9 changed files with 212 additions and 316 deletions

View file

@ -46,17 +46,14 @@ namespace CNORXZ
RangePtr range() const; RangePtr range() const;
UPos stepSize(const IndexId<0>& id) const; UPos stepSize(const IndexId<0>& id) const;
Vector<XIndexPtr> pack() const; //Vector<XIndexPtr> pack() const;
Vector<SizeT> blockSizes() const; //Vector<SizeT> format() const;
DIndex& setBlockSizes(const Vector<SizeT>& bs); //DIndex& setBlockSizes(const Vector<SizeT>& bs);
String stringMeta() const; String stringMeta() const;
DType meta() const; DType meta() const;
DIndex& at(const DType& meta); DIndex& at(const DType& meta);
Sptr<DIndex> format(const Sptr<DIndex>& ind) const;
Sptr<DIndex> slice(const Sptr<DIndex>& ind) const;
DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const; DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const;
const XIndexPtr& xptr() const; const XIndexPtr& xptr() const;

View file

@ -54,11 +54,11 @@ namespace CNORXZ
decltype(auto) meta() const { return THIS().meta(); } decltype(auto) meta() const { return THIS().meta(); }
I& at(const MetaType& meta) { return THIS().at(meta); } I& at(const MetaType& meta) { return THIS().at(meta); }
template <class Index> //template <class Index>
decltype(auto) format(const Sptr<Index>& ind) const { return THIS().format(ind); } //decltype(auto) format(const Sptr<Index>& ind) const { return THIS().format(ind); }
template <class Index> //template <class Index>
decltype(auto) slice(const Sptr<Index>& ind) const { return THIS().slice(ind); } //decltype(auto) slice(const Sptr<Index>& ind) const { return THIS().slice(ind); }
template <class Xpr, class F = NoF> template <class Xpr, class F = NoF>
decltype(auto) ifor(const Xpr& xpr, F&& f) const decltype(auto) ifor(const Xpr& xpr, F&& f) const

View file

@ -59,6 +59,11 @@ namespace CNORXZ
mB(b) mB(b)
{} {}
template <class... PosT>
constexpr GMFormat<PosT...>::GMFormat(Tuple<PosT...>&& b) :
mB(std::forward<Tuple<PosT...>>(b))
{}
template <class... PosT> template <class... PosT>
template <class FormatT> template <class FormatT>
constexpr GMFormat<PosT...>::GMFormat(const FormatT& f) constexpr GMFormat<PosT...>::GMFormat(const FormatT& f)
@ -93,6 +98,12 @@ namespace CNORXZ
return get(i); return get(i);
} }
template <class... PosT>
constexpr decltype(auto) gmformat(const PosT&... ps)
{
return GMFormat(std::move(std::make_tuple(ps...)));
}
/*************** /***************
* YFormat * * YFormat *
***************/ ***************/

View file

@ -41,6 +41,7 @@ namespace CNORXZ
public: public:
SP_DEFAULT_MEMBERS(constexpr,GMFormat); SP_DEFAULT_MEMBERS(constexpr,GMFormat);
explicit constexpr GMFormat(const Tuple<PosT...>& b); explicit constexpr GMFormat(const Tuple<PosT...>& b);
explicit constexpr GMFormat(Tuple<PosT...>&& b);
template <class FormatT> template <class FormatT>
constexpr GMFormat(const FormatT& f); constexpr GMFormat(const FormatT& f);
@ -58,6 +59,9 @@ namespace CNORXZ
Tuple<PosT...> mB; Tuple<PosT...> mB;
}; };
template <class... PosT>
constexpr decltype(auto) gmformat(const PosT&... ps);
template <class... PosT> struct is_static_format<GMFormat<PosT...>> { CXZ_CVAL_TRUE; }; template <class... PosT> struct is_static_format<GMFormat<PosT...>> { CXZ_CVAL_TRUE; };
class YFormat class YFormat

View file

@ -10,9 +10,9 @@ namespace CNORXZ
* GMIndex (private) * * GMIndex (private) *
************************/ ************************/
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT... Is> template <SizeT... Is>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::mkIPack(Isq<Is...> is) const constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkIPack(Isq<Is...> is) const
{ {
static_assert(sizeof...(Is) == NI, static_assert(sizeof...(Is) == NI,
"sequence sioze does not match number of indices"); "sequence sioze does not match number of indices");
@ -21,36 +21,36 @@ namespace CNORXZ
return std::make_tuple( std::make_shared<Indices>( mRange->sub(Is) )... ); return std::make_tuple( std::make_shared<Indices>( mRange->sub(Is) )... );
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::mkLMax(const IndexPack& ipack) constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkLMax(const IndexPack& ipack)
{ {
return iter<0,NI>( [&](auto i) { return std::get<i>(ipack)->lmax(); }, return iter<0,NI>( [&](auto i) { return std::get<i>(ipack)->lmax(); },
[](auto... e) { return (e * ...); }); [](auto... e) { return (e * ...); });
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::mkPMax(const IndexPack& ipack, const BlockType& blockSizes) constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkPMax(const IndexPack& ipack, const FormatT& format)
{ {
if constexpr(std::is_same<BlockType,None>::value){ if constexpr(std::is_same<FormatT,None>::value){
return mkLMax(ipack); return mkLMax(ipack);
} }
else { else {
return iter<0,NI> return iter<0,NI>
( [&](auto i) ( [&](auto i)
{ return (std::get<i>(ipack)->pmax() - SPos<1>()) * std::get<i>(blockSizes); }, { return (std::get<i>(ipack)->pmax() - SPos<1>()) * format[i]; },
[](auto... e) { return (e + ...); }) + SPos<1>(); [](auto... e) { return (e + ...); }) + SPos<1>();
} }
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
inline void GMIndex<BlockType,Indices...>::mkPos() inline void GMIndex<FormatT,Indices...>::mkPos()
{ {
mLex = iter<0,NI> mLex = iter<0,NI>
([&](auto i) { return std::get<i>(mIPack)->lex() * std::get<i>(mLexBlockSizes).val(); }, ([&](auto i) { return std::get<i>(mIPack)->lex() * mLexFormat[i].val(); },
[](const auto&... e) { return (e + ...); }); [](const auto&... e) { return (e + ...); });
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
IB::mPos = iter<0,NI> IB::mPos = iter<0,NI>
([&](auto i) { return std::get<i>(mIPack)->pos() * std::get<i>(mBlockSizes).val(); }, ([&](auto i) { return std::get<i>(mIPack)->pos() * mFormat[i].val(); },
[](const auto&... e) { return (e + ...); }); [](const auto&... e) { return (e + ...); });
} }
else { else {
@ -58,66 +58,68 @@ namespace CNORXZ
} }
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT... Is> template <SizeT... Is>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::mkLexBlockSizes(const IndexPack& ipack, Isq<Is...> is) constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkLexFormat(const IndexPack& ipack, Isq<Is...> is)
{ {
return std::make_tuple return gmformat
( iter<Is,NI> ( iter<Is,NI>
( [&](auto i) { return std::get<i>(ipack)->pmax(); }, ( [&](auto i) { return std::get<i>(ipack)->pmax(); },
[](const auto&... as) { return (as * ...); } )..., [](const auto&... as) { return (as * ...); } )...,
SPos<1>() ); SPos<1>() );
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT I> template <SizeT I>
inline void GMIndex<BlockType,Indices...>::up() inline void GMIndex<FormatT,Indices...>::up()
{ {
auto& i = std::get<I>(mIPack); std::integral_constant<SizeT,I> i;
auto& ind = std::get<I>(mIPack);
if constexpr(I != 0){ if constexpr(I != 0){
if(i->lex() == i->lmax().val()-1){ if(ind->lex() == ind->lmax().val()-1){
IB::mPos -= std::get<I>(blockSizes()).val() * i->pos(); IB::mPos -= format()[i].val() * ind->pos();
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
mLex -= std::get<I>(lexBlockSizes()).val() * i->lex(); mLex -= lexFormat()[i].val() * ind->lex();
} }
(*i) = 0; (*ind) = 0;
up<I-1>(); up<I-1>();
return; return;
} }
} }
IB::mPos += std::get<I>(blockSizes()).val(); IB::mPos += format()[i].val();
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
mLex += std::get<I>(lexBlockSizes()).val(); mLex += lexFormat()[i].val();
} }
++(*i); ++(*ind);
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT I> template <SizeT I>
inline void GMIndex<BlockType,Indices...>::down() inline void GMIndex<FormatT,Indices...>::down()
{ {
auto& i = std::get<I>(mIPack); std::integral_constant<SizeT,I> i;
auto& ind = std::get<I>(mIPack);
if constexpr(I != 0){ if constexpr(I != 0){
if(i->lex() == 0){ if(ind->lex() == 0){
(*i) = i->lmax().val()-1; (*ind) = ind->lmax().val()-1;
IB::mPos += std::get<I>(blockSizes()).val() * i->pos(); IB::mPos += format()[i].val() * ind->pos();
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
mLex += std::get<I>(lexBlockSizes()).val() * i->lex(); mLex += lexFormat()[i].val() * ind->lex();
} }
down<I-1>(); down<I-1>();
return; return;
} }
} }
IB::mPos -= std::get<I>(blockSizes()).val(); IB::mPos -= format()[i].val();
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
mLex -= std::get<I>(lexBlockSizes()).val(); mLex -= lexFormat()[i].val();
} }
--(*i); --(*ind);
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT I, class Xpr, class F> template <SizeT I, class Xpr, class F>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::mkIFor(const Xpr& xpr, F&& f) const constexpr decltype(auto) GMIndex<FormatT,Indices...>::mkIFor(const Xpr& xpr, F&& f) const
{ {
if constexpr(I == sizeof...(Indices)-1){ if constexpr(I == sizeof...(Indices)-1){
return std::get<I>(mIPack)->ifor(xpr,std::forward<F>(f)); return std::get<I>(mIPack)->ifor(xpr,std::forward<F>(f));
@ -133,129 +135,129 @@ namespace CNORXZ
* GMIndex * * GMIndex *
***************/ ***************/
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const GMIndex& i) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const GMIndex& i) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(rangeCast<RangeType>(i.range())), mRange(rangeCast<RangeType>(i.range())),
mIPack(mkIPack(Isqr<0,NI>{})), mIPack(mkIPack(Isqr<0,NI>{})),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(i.mBlockSizes), mFormat(i.mFormat),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
*this = i.lex(); *this = i.lex();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator=(const GMIndex& i) constexpr GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator=(const GMIndex& i)
{ {
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>::operator=(0); IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>::operator=(0);
mRange = rangeCast<RangeType>(i.range()); mRange = rangeCast<RangeType>(i.range());
mIPack = mkIPack(Isqr<0,NI>{}); mIPack = mkIPack(Isqr<0,NI>{});
mLexBlockSizes = mkLexBlockSizes(mIPack,Isqr<1,NI>{}); mLexFormat = mkLexFormat(mIPack,Isqr<1,NI>{});
mBlockSizes = i.mBlockSizes; mFormat = i.mFormat;
mLMax = mkLMax(mIPack); mLMax = mkLMax(mIPack);
mPMax = mkPMax(mIPack,mBlockSizes); mPMax = mkPMax(mIPack,mFormat);
return *this = i.lex(); return *this = i.lex();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const Indices&... is) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const Indices&... is) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(std::dynamic_pointer_cast<RangeType>(mrange(is.range()...))), mRange(std::dynamic_pointer_cast<RangeType>(mrange(is.range()...))),
mIPack(std::make_shared<Indices>(is)...), mIPack(std::make_shared<Indices>(is)...),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(), mFormat(),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
mkPos(); mkPos();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const BlockType& bs, const Indices&... is) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const FormatT& bs, const Indices&... is) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(std::dynamic_pointer_cast<RangeType>(mrange(is.range()...))), mRange(std::dynamic_pointer_cast<RangeType>(mrange(is.range()...))),
mIPack(std::make_shared<Indices>(is)...), mIPack(std::make_shared<Indices>(is)...),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(bs), mFormat(bs),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
mkPos(); mkPos();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const Sptr<Indices>&... is) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const Sptr<Indices>&... is) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))), mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))),
mIPack(is...), mIPack(is...),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(), mFormat(),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
mkPos(); mkPos();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const BlockType& bs, constexpr GMIndex<FormatT,Indices...>::GMIndex(const FormatT& bs,
const Sptr<Indices>&... is) : const Sptr<Indices>&... is) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))), mRange(std::dynamic_pointer_cast<RangeType>(mrange(is->range()...))),
mIPack(is...), mIPack(is...),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(bs), mFormat(bs),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
mkPos(); mkPos();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const RangePtr& range, SizeT lexpos) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const RangePtr& range, SizeT lexpos) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(rangeCast<RangeType>(range)), mRange(rangeCast<RangeType>(range)),
mIPack(mkIPack(Isqr<0,NI>{})), mIPack(mkIPack(Isqr<0,NI>{})),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(), mFormat(),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
*this = lexpos; *this = lexpos;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr GMIndex<BlockType,Indices...>::GMIndex(const RangePtr& range, const BlockType& blockSizes, SizeT lexpos) : constexpr GMIndex<FormatT,Indices...>::GMIndex(const RangePtr& range, const FormatT& format, SizeT lexpos) :
IndexInterface<GMIndex<BlockType,Indices...>,Tuple<typename Indices::MetaType...>>(0), IndexInterface<GMIndex<FormatT,Indices...>,Tuple<typename Indices::MetaType...>>(0),
mRange(rangeCast<RangeType>(range)), mRange(rangeCast<RangeType>(range)),
mIPack(mkIPack(Isqr<0,NI>{})), mIPack(mkIPack(Isqr<0,NI>{})),
mLexBlockSizes(mkLexBlockSizes(mIPack,Isqr<1,NI>{})), mLexFormat(mkLexFormat(mIPack,Isqr<1,NI>{})),
mBlockSizes(blockSizes), mFormat(format),
mLMax(mkLMax(mIPack)), mLMax(mkLMax(mIPack)),
mPMax(mkPMax(mIPack,mBlockSizes)) mPMax(mkPMax(mIPack,mFormat))
{ {
*this = lexpos; *this = lexpos;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator=(SizeT lexpos) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator=(SizeT lexpos)
{ {
if(lexpos >= lmax().val()){ if(lexpos >= lmax().val()){
if constexpr(not std::is_same<BlockType,None>::value){ mLex = lmax().val(); } if constexpr(not std::is_same<FormatT,None>::value){ mLex = lmax().val(); }
IB::mPos = pmax().val(); IB::mPos = pmax().val();
return *this; return *this;
} }
if constexpr(not std::is_same<BlockType,None>::value){ mLex = lexpos; } if constexpr(not std::is_same<FormatT,None>::value){ mLex = lexpos; }
IB::mPos = iter<0,NI>( [&](auto i) { IB::mPos = iter<0,NI>( [&](auto i) {
*std::get<i>(mIPack) = (lex() / std::get<i>(lexBlockSizes()).val()) % std::get<i>(mIPack)->lmax().val(); *std::get<i>(mIPack) = (lex() / lexFormat()[i].val()) % std::get<i>(mIPack)->lmax().val();
return std::get<i>(blockSizes()).val() * std::get<i>(mIPack)->pos(); return format()[i].val() * std::get<i>(mIPack)->pos();
}, [](const auto&... e) { return (e + ...); } ); }, [](const auto&... e) { return (e + ...); } );
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator++() GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator++()
{ {
if(lex() == lmax().val()-1){ if(lex() == lmax().val()-1){
return *this = lmax().val(); return *this = lmax().val();
@ -266,8 +268,8 @@ namespace CNORXZ
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator--() GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator--()
{ {
if(lex() == lmax().val()){ if(lex() == lmax().val()){
return *this = lmax().val()-1; return *this = lmax().val()-1;
@ -278,22 +280,22 @@ namespace CNORXZ
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...> GMIndex<BlockType,Indices...>::operator+(Int n) const GMIndex<FormatT,Indices...> GMIndex<FormatT,Indices...>::operator+(Int n) const
{ {
GMIndex o(*this); GMIndex o(*this);
return o += n; return o += n;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...> GMIndex<BlockType,Indices...>::operator-(Int n) const GMIndex<FormatT,Indices...> GMIndex<FormatT,Indices...>::operator-(Int n) const
{ {
GMIndex o(*this); GMIndex o(*this);
return o -= n; return o -= n;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator+=(Int n) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator+=(Int n)
{ {
if(-n > static_cast<long int>(lex())){ if(-n > static_cast<long int>(lex())){
(*this) = 0; (*this) = 0;
@ -306,8 +308,8 @@ namespace CNORXZ
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator-=(Int n) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator-=(Int n)
{ {
if(n > static_cast<long int>(lex())){ if(n > static_cast<long int>(lex())){
(*this) = 0; (*this) = 0;
@ -320,10 +322,10 @@ namespace CNORXZ
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
SizeT GMIndex<BlockType,Indices...>::lex() const SizeT GMIndex<FormatT,Indices...>::lex() const
{ {
if constexpr(std::is_same<BlockType,None>::value){ if constexpr(std::is_same<FormatT,None>::value){
return IB::mPos; return IB::mPos;
} }
else { else {
@ -331,53 +333,53 @@ namespace CNORXZ
} }
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::pmax() const constexpr decltype(auto) GMIndex<FormatT,Indices...>::pmax() const
{ {
return mPMax; return mPMax;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::lmax() const constexpr decltype(auto) GMIndex<FormatT,Indices...>::lmax() const
{ {
return mPMax; return mPMax;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
IndexId<0> GMIndex<BlockType,Indices...>::id() const IndexId<0> GMIndex<FormatT,Indices...>::id() const
{ {
return IndexId<0>(this->ptrId()); return IndexId<0>(this->ptrId());
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
typename GMIndex<BlockType,Indices...>::MetaType GMIndex<BlockType,Indices...>::operator*() const typename GMIndex<FormatT,Indices...>::MetaType GMIndex<FormatT,Indices...>::operator*() const
{ {
return meta(); return meta();
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr SizeT GMIndex<BlockType,Indices...>::dim() const constexpr SizeT GMIndex<FormatT,Indices...>::dim() const
{ {
return NI; return NI;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
Sptr<typename GMIndex<BlockType,Indices...>::RangeType> GMIndex<BlockType,Indices...>::range() const Sptr<typename GMIndex<FormatT,Indices...>::RangeType> GMIndex<FormatT,Indices...>::range() const
{ {
return mRange; return mRange;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <SizeT I> template <SizeT I>
decltype(auto) GMIndex<BlockType,Indices...>::stepSize(const IndexId<I>& id) const decltype(auto) GMIndex<FormatT,Indices...>::stepSize(const IndexId<I>& id) const
{ {
return iter<0,NI> return iter<0,NI>
( [&](auto i) { return std::get<i>(mIPack)->stepSize(id) * std::get<i>(blockSizes()); }, ( [&](auto i) { return std::get<i>(mIPack)->stepSize(id) * format()[i]; },
[](const auto&... ss) { return ( ss + ... ); }); [](const auto&... ss) { return ( ss + ... ); });
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
String GMIndex<BlockType,Indices...>::stringMeta() const String GMIndex<FormatT,Indices...>::stringMeta() const
{ {
const String blim = "("; const String blim = "(";
const String elim = ")"; const String elim = ")";
@ -389,156 +391,79 @@ namespace CNORXZ
} ); } );
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
typename GMIndex<BlockType,Indices...>::MetaType GMIndex<BlockType,Indices...>::meta() const typename GMIndex<FormatT,Indices...>::MetaType GMIndex<FormatT,Indices...>::meta() const
{ {
return iter<0,NI>( [&](auto i) { return std::get<i>(mIPack)->meta(); }, return iter<0,NI>( [&](auto i) { return std::get<i>(mIPack)->meta(); },
[](const auto&... xs) { return std::make_tuple(xs...); } ); [](const auto&... xs) { return std::make_tuple(xs...); } );
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::at(const MetaType& metaPos) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::at(const MetaType& metaPos)
{ {
iter<0,NI>( [&](auto i) { std::get<i>(mIPack)->at( std::get<i>(metaPos) ); }, NoF {} ); iter<0,NI>( [&](auto i) { std::get<i>(mIPack)->at( std::get<i>(metaPos) ); }, NoF {} );
IB::mPos = iter<0,NI> IB::mPos = iter<0,NI>
( [&](auto i) { return std::get<i>(mIPack)->pos()*std::get<i>(blockSizes()).val(); }, ( [&](auto i) { return std::get<i>(mIPack)->pos()*format()[i].val(); },
[](const auto&... xs) { return (xs + ...); }); [](const auto&... xs) { return (xs + ...); });
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
template <class Index>
decltype(auto) GMIndex<BlockType,Indices...>::format(const Sptr<Index>& ind) const
{
static_assert(is_index<Index>::value, "got non-index type");
static_assert(has_sub<Index>::value, "try to format single index");
if constexpr(has_static_sub<Index>::value){
static_assert(index_dim<Index>::value == NI, "got index with conflicting static dimension");
return iter<0,NI>
( [&](auto i) {
return std::get<i>(mIPack)->format(std::get<i>(ind->pack()));
},
[&](const auto&... e) {
return gmindexPtr(mBlockSizes, e... );
} );
}
else {
auto pack = ind->pack();
CXZ_ASSERT(pack.size() == NI, "attempt to format index of dimension " << NI
<< " using index of dimension " << pack.size());
return iter<0,NI>
( [&](auto i) {
return std::get<i>(mIPack)->format(pack[i]);
},
[&](const auto&... e) {
return gmindexPtr(mBlockSizes, e... );
} );
}
}
template <class BlockType, class... Indices>
template <class Index>
decltype(auto) GMIndex<BlockType,Indices...>::slice(const Sptr<Index>& ind) const
{
static_assert(is_index<Index>::value, "got non-index type");
static_assert(has_sub<Index>::value, "try to slice single index");
if constexpr(has_static_sub<Index>::value and
((has_static_sub<Indices>::value and ...) or
(not has_sub<Indices>::value and ...)) ){
static_assert(index_dim<Index>::value == NI, "got index with conflicting static dimension");
const auto bs = iterIf<0,NI>
( [&](auto i) { return std::get<i>(mBlockSizes); },
[](const auto&... e) { std::make_tuple(e...); },
[](auto i) {
return std::is_same<typename TupleElem<i>::type,NIndex>::value;
});
return iterIf<0,NI>
( [&](auto i) { return std::get<i>(mIPack)->slice(std::get<i>(ind->pack())); },
[&](const auto&... e) { return gmindex(bs, e... ); },
[](auto i) {
return std::is_same<typename TupleElem<i>::type,NIndex>::value;
} );
}
else {
Vector<SizeT> bs;
Vector<XIndexPtr> ivec;
bs.reserve(NI);
ivec.reserve(NI);
auto pack = ind->pack();
CXZ_ASSERT(pack.size() == NI, "attempt to slice index of dimension " << NI
<< " using index of dimension " << pack.size());
iter<0,NI>
( [&](auto i) {
if(std::get<i>(mIPack)->dim() == 0){
bs.push_back(std::get<i>(mBlockSizes).val());
if constexpr(has_static_sub<Index>::value){
ivec.push_back( xindexPtr( std::get<i>(ind->pack()) ) );
}
else {
ivec.push_back( xindexPtr( ind->pack()[i] ) );
}
}
}, NoF {});
return yindexPtr(bs, ivec);
}
}
template <class BlockType, class... Indices>
template <class Xpr, class F> template <class Xpr, class F>
constexpr decltype(auto) GMIndex<BlockType,Indices...>::ifor(const Xpr& xpr, F&& f) const constexpr decltype(auto) GMIndex<FormatT,Indices...>::ifor(const Xpr& xpr, F&& f) const
{ {
return mkIFor<0>(xpr, std::forward<F>(f)); return mkIFor<0>(xpr, std::forward<F>(f));
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator()(const Sptr<MIndex<Indices...>>& mi) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator()(const Sptr<MIndex<Indices...>>& mi)
{ {
mIPack = mi.pack(); mIPack = mi.pack();
mkPos(); mkPos();
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::operator()() GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::operator()()
{ {
mkPos(); mkPos();
return *this; return *this;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
const typename GMIndex<BlockType,Indices...>::IndexPack& GMIndex<BlockType,Indices...>::pack() const const typename GMIndex<FormatT,Indices...>::IndexPack& GMIndex<FormatT,Indices...>::pack() const
{ {
return mIPack; return mIPack;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
const auto& GMIndex<BlockType,Indices...>::blockSizes() const const auto& GMIndex<FormatT,Indices...>::format() const
{ {
if constexpr(std::is_same<BlockType,None>::value){ if constexpr(std::is_same<FormatT,None>::value){
return mLexBlockSizes; return mLexFormat;
} }
else { else {
return mBlockSizes; return mFormat;
} }
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
const auto& GMIndex<BlockType,Indices...>::lexBlockSizes() const const auto& GMIndex<FormatT,Indices...>::lexFormat() const
{ {
return mLexBlockSizes; return mLexFormat;
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
GMIndex<BlockType,Indices...>& GMIndex<BlockType,Indices...>::setBlockSizes(const BlockType& bs) GMIndex<FormatT,Indices...>& GMIndex<FormatT,Indices...>::setFormat(const FormatT& bs)
{ {
if constexpr(not std::is_same<BlockType,None>::value){ if constexpr(not std::is_same<FormatT,None>::value){
mBlockSizes = bs; mFormat = bs;
} }
return *this; return *this;
} }
template <class BT1, class BT2, class... Indices> template <class BT1, class BT2, class... Indices>
decltype(auto) replaceBlockSizes(const BT1& bs1, const Sptr<GMIndex<BT2,Indices...>>& gmi) decltype(auto) replaceFormat(const BT1& bs1, const Sptr<GMIndex<BT2,Indices...>>& gmi)
{ {
return iter<0,sizeof...(Indices)> return iter<0,sizeof...(Indices)>
( [&](auto i) { return std::get<i>(gmi->pack()); }, ( [&](auto i) { return std::get<i>(gmi->pack()); },
@ -558,10 +483,10 @@ namespace CNORXZ
return MIndex<Indices...>(is...); return MIndex<Indices...>(is...);
} }
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) gmindexPtr(const BlockType& bs, const Sptr<Indices>&... is) constexpr decltype(auto) gmindexPtr(const FormatT& bs, const Sptr<Indices>&... is)
{ {
return std::make_shared<GMIndex<BlockType,Indices...>>(bs, is...); return std::make_shared<GMIndex<FormatT,Indices...>>(bs, is...);
} }
/********************* /*********************

View file

@ -6,19 +6,21 @@
#include "base/base.h" #include "base/base.h"
#include "range_base.h" #include "range_base.h"
#include "index_base.h" #include "index_base.h"
#include "index_format.h"
#include "index_pack.h"
#include "xpr/xpr.h" #include "xpr/xpr.h"
namespace CNORXZ namespace CNORXZ
{ {
// template <class FormatT, class... Indices> // template <class FormatT, class... Indices>
// -> Format + IndexTuple // -> Format + IndexTuple
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
class GMIndex : public IndexInterface<GMIndex<BlockType,Indices...>, class GMIndex : public IndexInterface<GMIndex<FormatT,Indices...>,
Tuple<typename Indices::MetaType...> > Tuple<typename Indices::MetaType...> >
{ {
public: public:
typedef IndexInterface<GMIndex<BlockType,Indices...>, typedef IndexInterface<GMIndex<FormatT,Indices...>,
Tuple<typename Indices::MetaType...>> IB; Tuple<typename Indices::MetaType...>> IB;
typedef Tuple<Sptr<Indices>...> IndexPack; typedef Tuple<Sptr<Indices>...> IndexPack;
typedef Tuple<typename Indices::MetaType...> MetaType; typedef Tuple<typename Indices::MetaType...> MetaType;
@ -35,11 +37,11 @@ namespace CNORXZ
//constexpr GMIndex(const SPack<Indices...>& is); //constexpr GMIndex(const SPack<Indices...>& is);
//constexpr GMIndex(const FormatT& format, const SPack<Indices...>& is); //constexpr GMIndex(const FormatT& format, const SPack<Indices...>& is);
constexpr GMIndex(const Indices&... is); constexpr GMIndex(const Indices&... is);
constexpr GMIndex(const BlockType& blockSizes, const Indices&... is); constexpr GMIndex(const FormatT& format, const Indices&... is);
constexpr GMIndex(const Sptr<Indices>&... is); constexpr GMIndex(const Sptr<Indices>&... is);
constexpr GMIndex(const BlockType& blockSizes, const Sptr<Indices>&... is); constexpr GMIndex(const FormatT& format, const Sptr<Indices>&... is);
constexpr GMIndex(const RangePtr& range, SizeT lexpos = 0); constexpr GMIndex(const RangePtr& range, SizeT lexpos = 0);
constexpr GMIndex(const RangePtr& range, const BlockType& blockSizes, SizeT lexpos = 0); constexpr GMIndex(const RangePtr& range, const FormatT& format, SizeT lexpos = 0);
GMIndex& operator=(SizeT pos); GMIndex& operator=(SizeT pos);
GMIndex& operator++(); GMIndex& operator++();
@ -66,18 +68,6 @@ namespace CNORXZ
MetaType meta() const; MetaType meta() const;
GMIndex& at(const MetaType& metaPos); GMIndex& at(const MetaType& metaPos);
template <class Index>
decltype(auto) format(const Sptr<Index>& ind) const;
// -> IndexInterface;
// replace index instances xor replace blockSizes of ind by that of *this
// return result as new instance
template <class Index>
decltype(auto) slice(const Sptr<Index>& ind) const;
// -> IndexInterface;
// drop index instance or drop blockSize of ind if that of *this is not Null
// return result as new instance
template <class Xpr, class F> template <class Xpr, class F>
constexpr decltype(auto) ifor(const Xpr& xpr, F&& f) const; constexpr decltype(auto) ifor(const Xpr& xpr, F&& f) const;
@ -86,17 +76,17 @@ namespace CNORXZ
GMIndex& operator()(); GMIndex& operator()();
const IndexPack& pack() const; const IndexPack& pack() const;
const auto& blockSizes() const; const auto& format() const;
const auto& lexBlockSizes() const; const auto& lexFormat() const;
GMIndex& setBlockSizes(const BlockType& bs); GMIndex& setFormat(const FormatT& bs);
private: private:
template <SizeT... Is> template <SizeT... Is>
static constexpr decltype(auto) mkLexBlockSizes(const IndexPack& ipack, Isq<Is...> is); static constexpr decltype(auto) mkLexFormat(const IndexPack& ipack, Isq<Is...> is);
static constexpr decltype(auto) mkLMax(const IndexPack& ipack); static constexpr decltype(auto) mkLMax(const IndexPack& ipack);
static constexpr decltype(auto) mkPMax(const IndexPack& ipack, const BlockType& blockSizes); static constexpr decltype(auto) mkPMax(const IndexPack& ipack, const FormatT& format);
inline void mkPos(); inline void mkPos();
@ -114,18 +104,19 @@ namespace CNORXZ
Sptr<RangeType> mRange; Sptr<RangeType> mRange;
IndexPack mIPack; IndexPack mIPack;
typedef RemoveRef<decltype(mkLexBlockSizes(mIPack,Isqr<0,NI-1>{}))> LexBlockType; typedef RemoveRef<decltype(mkLexFormat(mIPack,Isqr<0,NI-1>{}))> LexFormatT;
LexBlockType mLexBlockSizes; LexFormatT mLexFormat;
BlockType mBlockSizes; // -> FormatT FormatT mFormat;
//BlockType mFormat; // -> FormatT
SizeT mLex; SizeT mLex;
typedef RemoveRef<decltype(mkLMax(mIPack))> LMaxT; typedef RemoveRef<decltype(mkLMax(mIPack))> LMaxT;
LMaxT mLMax; LMaxT mLMax;
typedef RemoveRef<decltype(mkPMax(mIPack,mBlockSizes))> PMaxT; typedef RemoveRef<decltype(mkPMax(mIPack,mFormat))> PMaxT;
PMaxT mPMax; PMaxT mPMax;
}; };
template <class BT1, class BT2, class... Indices> template <class BT1, class BT2, class... Indices>
decltype(auto) replaceBlockSizes(const BT1& bs1, const Sptr<GMIndex<BT2,Indices...>>& gmi); decltype(auto) replaceFormat(const BT1& bs1, const Sptr<GMIndex<BT2,Indices...>>& gmi);
template <class BT1, class... Is1, class BT2, class... Is2> template <class BT1, class... Is1, class BT2, class... Is2>
decltype(auto) operator*(const Sptr<GMIndex<BT1,Is1...>>& a, const Sptr<GMIndex<BT2,Is2...>>& b); decltype(auto) operator*(const Sptr<GMIndex<BT1,Is1...>>& a, const Sptr<GMIndex<BT2,Is2...>>& b);
@ -155,8 +146,8 @@ namespace CNORXZ
template <class... Indices> template <class... Indices>
constexpr decltype(auto) mindex(const Sptr<Indices>&... is); constexpr decltype(auto) mindex(const Sptr<Indices>&... is);
template <class BlockType, class... Indices> template <class FormatT, class... Indices>
constexpr decltype(auto) gmindexPtr(const BlockType& bs, const Sptr<Indices>&... is); constexpr decltype(auto) gmindexPtr(const FormatT& bs, const Sptr<Indices>&... is);
template <class... Ranges> template <class... Ranges>
class MRangeFactory : public RangeFactoryBase class MRangeFactory : public RangeFactoryBase

View file

@ -126,7 +126,7 @@ namespace CNORXZ
{ {
return mI->stepSize(id); return mI->stepSize(id);
} }
/*
template <class Index, typename Meta> template <class Index, typename Meta>
Vector<XIndexPtr> XIndex<Index,Meta>::pack() const Vector<XIndexPtr> XIndex<Index,Meta>::pack() const
{ {
@ -188,7 +188,7 @@ namespace CNORXZ
return nullptr; return nullptr;
} }
} }
*/
template <class Index, typename Meta> template <class Index, typename Meta>
String XIndex<Index,Meta>::stringMeta() const String XIndex<Index,Meta>::stringMeta() const
{ {
@ -209,22 +209,6 @@ namespace CNORXZ
return *this; return *this;
} }
template <class Index, typename Meta>
Sptr<DIndex> XIndex<Index,Meta>::format(const Sptr<DIndex>& ind) const
{
CXZ_ERROR("IMPLEMENT!!!");
return nullptr;
//return std::make_shared<DIndex>(xindexPtr(mI->format(ind)));
}
template <class Index, typename Meta>
Sptr<DIndex> XIndex<Index,Meta>::slice(const Sptr<DIndex>& ind) const
{
CXZ_ERROR("IMPLEMENT!!!");
return nullptr;
//return std::make_shared<DIndex>(xindexPtr(mI->slice(ind)));
}
template <class Index, typename Meta> template <class Index, typename Meta>
DXpr<SizeT> XIndex<Index,Meta>::ifor(const DXpr<SizeT>& xpr, DXpr<SizeT> XIndex<Index,Meta>::ifor(const DXpr<SizeT>& xpr,
std::function<SizeT(SizeT,SizeT)>&& f) const std::function<SizeT(SizeT,SizeT)>&& f) const

View file

@ -38,17 +38,14 @@ namespace CNORXZ
virtual SizeT dim() const = 0; virtual SizeT dim() const = 0;
virtual RangePtr range() const = 0; virtual RangePtr range() const = 0;
virtual UPos stepSize(const IndexId<0>& id) const = 0; virtual UPos stepSize(const IndexId<0>& id) const = 0;
virtual Vector<XIndexPtr> pack() const = 0; //virtual Vector<XIndexPtr> pack() const = 0;
virtual Vector<SizeT> blockSizes() const = 0; //virtual Vector<SizeT> format() const = 0;
virtual XIndexPtr setBlockSizes(const Vector<SizeT>& bs) = 0; //virtual XIndexPtr setBlockSizes(const Vector<SizeT>& bs) = 0;
virtual String stringMeta() const = 0; virtual String stringMeta() const = 0;
virtual DType meta() const = 0; virtual DType meta() const = 0;
virtual XIndexBase& at(const DType& meta) = 0; virtual XIndexBase& at(const DType& meta) = 0;
virtual Sptr<DIndex> format(const Sptr<DIndex>& ind) const = 0;
virtual Sptr<DIndex> slice(const Sptr<DIndex>& ind) const = 0;
virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr,
std::function<SizeT(SizeT,SizeT)>&& f) const = 0; std::function<SizeT(SizeT,SizeT)>&& f) const = 0;
@ -93,17 +90,14 @@ namespace CNORXZ
virtual SizeT dim() const override final; virtual SizeT dim() const override final;
virtual RangePtr range() const override final; virtual RangePtr range() const override final;
virtual UPos stepSize(const IndexId<0>& id) const override final; virtual UPos stepSize(const IndexId<0>& id) const override final;
virtual Vector<XIndexPtr> pack() const override final; //virtual Vector<XIndexPtr> pack() const override final;
virtual Vector<SizeT> blockSizes() const override final; //virtual Vector<SizeT> format() const override final;
virtual XIndexPtr setBlockSizes(const Vector<SizeT>& bs) override final; //virtual XIndexPtr setBlockSizes(const Vector<SizeT>& bs) override final;
virtual String stringMeta() const override final; virtual String stringMeta() const override final;
virtual DType meta() const override final; virtual DType meta() const override final;
virtual XIndexBase& at(const DType& meta) override final; virtual XIndexBase& at(const DType& meta) override final;
virtual Sptr<DIndex> format(const Sptr<DIndex>& ind) const override final;
virtual Sptr<DIndex> slice(const Sptr<DIndex>& ind) const override final;
virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr,
std::function<SizeT(SizeT,SizeT)>&& f) const override final; std::function<SizeT(SizeT,SizeT)>&& f) const override final;

View file

@ -128,7 +128,7 @@ namespace CNORXZ
{ {
return mI->stepSize(id); return mI->stepSize(id);
} }
/*
Vector<XIndexPtr> DIndex::pack() const Vector<XIndexPtr> DIndex::pack() const
{ {
return mI->pack(); return mI->pack();
@ -144,7 +144,7 @@ namespace CNORXZ
mI->setBlockSizes(bs); mI->setBlockSizes(bs);
return *this; return *this;
} }
*/
String DIndex::stringMeta() const String DIndex::stringMeta() const
{ {
return mI->stringMeta(); return mI->stringMeta();
@ -162,16 +162,6 @@ namespace CNORXZ
return *this; return *this;
} }
Sptr<DIndex> DIndex::format(const Sptr<DIndex>& ind) const
{
return mI->format(ind);
}
Sptr<DIndex> DIndex::slice(const Sptr<DIndex>& ind) const
{
return mI->slice(ind);
}
DXpr<SizeT> DIndex::ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const DXpr<SizeT> DIndex::ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const
{ {
return DXpr<SizeT>(mI->ifor(xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f)) ); return DXpr<SizeT>(mI->ifor(xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f)) );