yrange: replace index pack type
This commit is contained in:
parent
346f92f267
commit
8469fa9fb2
3 changed files with 17 additions and 16 deletions
|
@ -90,20 +90,21 @@ namespace CNORXZ
|
|||
}
|
||||
else if constexpr(std::is_same<I2,YIndex>::value){
|
||||
auto p = b.THIS().pack();
|
||||
p.insert(0, a.THIS().xptr());
|
||||
return YIndex(p);
|
||||
auto n = p.lmul( a.THIS().xptr() );
|
||||
return YIndex(n.all());
|
||||
}
|
||||
}
|
||||
else if constexpr(std::is_same<I1,YIndex>::value){
|
||||
if constexpr(std::is_same<I2,DIndex>::value){
|
||||
auto p = a.THIS().pack();
|
||||
p.push_back(b.THIS().xptr());
|
||||
return YIndex(p);
|
||||
auto n = p.rmul( b.THIS().xptr() );
|
||||
return YIndex(n.all());
|
||||
}
|
||||
else if constexpr(std::is_same<I2,YIndex>::value){
|
||||
auto p = a.THIS().pack();
|
||||
p.insert(p.end(), b.THIS().pack().begin(), b.THIS().pack().end());
|
||||
return YIndex(p);
|
||||
auto ap = a.THIS().pack().all();
|
||||
const auto& bp = b.THIS().pack();
|
||||
ap.insert(ap.end(), bp.all().begin(), bp.all().end());
|
||||
return YIndex(ap);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace CNORXZ
|
|||
YIndex& operator()(const Sptr<YIndex>& i);
|
||||
YIndex& operator()();
|
||||
|
||||
const Vector<XIndexPtr>& pack() const;
|
||||
const DPack& pack() const;
|
||||
const YFormat& format() const;
|
||||
const YFormat& lexFormat() const;
|
||||
YIndex& setFormat(const YFormat& bs);
|
||||
|
@ -69,7 +69,7 @@ namespace CNORXZ
|
|||
inline Vector<SizeT> mkLexFormat() const;
|
||||
inline Vector<RangePtr> mkRangeVec(const Vector<XIndexPtr>& is) const;
|
||||
inline void mkPos();
|
||||
inline Vector<XIndexPtr> mkIndices() const;
|
||||
inline DPack mkIndices() const;
|
||||
inline void up(SizeT i);
|
||||
inline void down(SizeT i);
|
||||
inline decltype(auto) mkIFor(SizeT i, const DXpr<SizeT>& xpr,
|
||||
|
@ -79,7 +79,7 @@ namespace CNORXZ
|
|||
inline SizeT mkLMax() const;
|
||||
|
||||
Sptr<YRange> mRange;
|
||||
Vector<XIndexPtr> mIs;
|
||||
DPack mIs;
|
||||
YFormat mFormat; // dim() elements only!!!
|
||||
YFormat mLexFormat; // dim() elements only!!!
|
||||
SizeT mLex = 0;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace CNORXZ
|
|||
* YIndex (private) *
|
||||
*************************/
|
||||
|
||||
inline Vector<XIndexPtr> YIndex::mkIndices() const
|
||||
inline DPack YIndex::mkIndices() const
|
||||
{
|
||||
Vector<XIndexPtr> o(mRange->dim(), nullptr);
|
||||
for(SizeT i = 0; i != mRange->dim(); ++i){
|
||||
|
@ -15,7 +15,7 @@ namespace CNORXZ
|
|||
CXZ_ASSERT(rp != nullptr, "subranges not available");
|
||||
o[i] = rp->begin().xptr();
|
||||
}
|
||||
return o;
|
||||
return DPack(std::move(o));
|
||||
}
|
||||
|
||||
inline Vector<SizeT> YIndex::mkFormat() const
|
||||
|
@ -115,7 +115,7 @@ namespace CNORXZ
|
|||
|
||||
inline SizeT YIndex::mkLMax() const
|
||||
{
|
||||
return std::accumulate(mIs.begin(), mIs.end(),1,
|
||||
return std::accumulate(mIs.all().begin(), mIs.all().end(),1,
|
||||
[](const auto& res, const auto& el) { return res * el->lmax().val(); } );
|
||||
}
|
||||
|
||||
|
@ -313,7 +313,7 @@ namespace CNORXZ
|
|||
const String elim = "]";
|
||||
const String dlim = ",";
|
||||
return blim +
|
||||
std::accumulate(std::next(mIs.begin()), mIs.end(), mIs[0]->stringMeta(),
|
||||
std::accumulate(std::next(mIs.all().begin()), mIs.all().end(), mIs[0]->stringMeta(),
|
||||
[&](const auto& s, const auto& e)
|
||||
{ return s + dlim + e->stringMeta(); } ) +
|
||||
elim;
|
||||
|
@ -322,7 +322,7 @@ namespace CNORXZ
|
|||
DType YIndex::meta() const
|
||||
{
|
||||
Vector<DType> v(mIs.size());
|
||||
std::transform(mIs.begin(), mIs.end(), v.begin(),
|
||||
std::transform(mIs.all().begin(), mIs.all().end(), v.begin(),
|
||||
[](const auto& x) { return x->meta(); });
|
||||
return DType(v);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ namespace CNORXZ
|
|||
return *this;
|
||||
}
|
||||
|
||||
const Vector<XIndexPtr>& YIndex::pack() const
|
||||
const DPack& YIndex::pack() const
|
||||
{
|
||||
return mIs;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue