dynamic indices: DXpr<SizeT> -> DXpr<None>
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
09f15408b1
commit
43f5e560fa
7 changed files with 37 additions and 26 deletions
|
@ -22,6 +22,25 @@ namespace CNORXZ
|
|||
IndexInterface<DIndex,DType>(i.pos()),
|
||||
mI(std::make_shared<XIndex<Index,Meta>>(i))
|
||||
{}
|
||||
|
||||
template <class Xpr, class F>
|
||||
decltype(auto) DIndex::ifor(const Xpr& xpr, F&& f) const
|
||||
{
|
||||
typedef typename std::remove_reference<decltype(Xpr()())>::type R;
|
||||
if constexpr(std::is_same<F,NoF>::value) {
|
||||
if constexpr(std::is_same<R,None>::value or std::is_same<R,void>::value){
|
||||
return mI->ifor( DXpr<None>(xpr), std::forward<F>(f) );
|
||||
}
|
||||
else {
|
||||
CXZ_ERROR("IMPLEMENT!!!");
|
||||
return DXpr<R>();
|
||||
}
|
||||
}
|
||||
else {
|
||||
CXZ_ERROR("IMPLEMENT!!!");
|
||||
return DXpr<R>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -58,9 +58,6 @@ namespace CNORXZ
|
|||
RangePtr range() const;
|
||||
|
||||
UPos stepSize(const IndexId<0>& id) const;
|
||||
//Vector<XIndexPtr> pack() const;
|
||||
//Vector<SizeT> format() const;
|
||||
//DIndex& setBlockSizes(const Vector<SizeT>& bs);
|
||||
|
||||
String stringMeta() const;
|
||||
DType meta() const;
|
||||
|
@ -69,7 +66,10 @@ namespace CNORXZ
|
|||
RangePtr prange(const DIndex& end) const;
|
||||
Vector<SizeT> deepFormat() const;
|
||||
|
||||
DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const;
|
||||
//DXpr<None> ifor(const DXpr<None>& xpr, NoF&& f) const;
|
||||
|
||||
template <class Xpr, class F>
|
||||
decltype(auto) ifor(const Xpr& xpr, F&& f) const;
|
||||
|
||||
const XIndexPtr& xptr() const;
|
||||
|
||||
|
|
|
@ -185,10 +185,9 @@ namespace CNORXZ
|
|||
}
|
||||
|
||||
template <class Index, typename Meta>
|
||||
DXpr<SizeT> XIndex<Index,Meta>::ifor(const DXpr<SizeT>& xpr,
|
||||
std::function<SizeT(SizeT,SizeT)>&& f) const
|
||||
DXpr<None> XIndex<Index,Meta>::ifor(const DXpr<None>& xpr, NoF&& f) const
|
||||
{
|
||||
return DXpr<SizeT>(mI->ifor(xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f)));
|
||||
return DXpr<None>(mI->ifor(xpr, std::forward<NoF>(f)));
|
||||
}
|
||||
|
||||
template <class Index, typename Meta>
|
||||
|
|
|
@ -58,8 +58,7 @@ namespace CNORXZ
|
|||
virtual XIndexBase& at(const DType& meta) = 0;
|
||||
virtual DXpr<SizeT> xpr(const XIndexPtr& _this) const = 0;
|
||||
|
||||
virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr,
|
||||
std::function<SizeT(SizeT,SizeT)>&& f) const = 0;
|
||||
virtual DXpr<None> ifor(const DXpr<None>& xpr, NoF&& f) const = 0;
|
||||
|
||||
virtual bool formatIsTrivial() const = 0;
|
||||
};
|
||||
|
@ -112,8 +111,7 @@ namespace CNORXZ
|
|||
virtual XIndexBase& at(const DType& meta) override final;
|
||||
virtual DXpr<SizeT> xpr(const XIndexPtr& _this) const override final;
|
||||
|
||||
virtual DXpr<SizeT> ifor(const DXpr<SizeT>& xpr,
|
||||
std::function<SizeT(SizeT,SizeT)>&& f) const override final;
|
||||
virtual DXpr<None> ifor(const DXpr<None>& xpr, NoF&& f) const override final;
|
||||
|
||||
virtual bool formatIsTrivial() const override final;
|
||||
|
||||
|
|
|
@ -64,15 +64,12 @@ namespace CNORXZ
|
|||
Sptr<YRange> range() const;
|
||||
UPos stepSize(const IndexId<0> id) const;
|
||||
|
||||
//template <class Index>
|
||||
//YIndex formatFrom(const Index& ind) const;
|
||||
|
||||
String stringMeta() const;
|
||||
Vector<DType> meta() const;
|
||||
YIndex& at(const Vector<DType>& meta);
|
||||
DXpr<SizeT> xpr(const Sptr<YIndex>& _this) const;
|
||||
|
||||
DXpr<SizeT> ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const;
|
||||
DXpr<None> ifor(const DXpr<None>& xpr, NoF&& f) const;
|
||||
|
||||
YIndex& operator()(const Sptr<YIndex>& i);
|
||||
YIndex& operator()();
|
||||
|
@ -95,8 +92,7 @@ namespace CNORXZ
|
|||
inline DPack mkIndices() const;
|
||||
inline void up(SizeT i);
|
||||
inline void down(SizeT i);
|
||||
inline decltype(auto) mkIFor(SizeT i, const DXpr<SizeT>& xpr,
|
||||
std::function<SizeT(SizeT,SizeT)>&& f) const;
|
||||
inline decltype(auto) mkIFor(SizeT i, const DXpr<None>& xpr, NoF&& f) const;
|
||||
|
||||
inline SizeT mkPMax() const;
|
||||
inline SizeT mkLMax() const;
|
||||
|
|
|
@ -186,12 +186,12 @@ namespace CNORXZ
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
DXpr<SizeT> DIndex::ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const
|
||||
/*
|
||||
DXpr<None> DIndex::ifor(const DXpr<None>& xpr, NoF&& f) const
|
||||
{
|
||||
return DXpr<SizeT>(mI->ifor(xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f)) );
|
||||
return mI->ifor(xpr, std::forward<NoF>(f));
|
||||
}
|
||||
|
||||
*/
|
||||
const XIndexPtr& DIndex::xptr() const
|
||||
{
|
||||
return mI;
|
||||
|
|
|
@ -92,11 +92,10 @@ namespace CNORXZ
|
|||
--(*idx);
|
||||
}
|
||||
|
||||
inline decltype(auto) YIndex::mkIFor(SizeT i, const DXpr<SizeT>& xpr,
|
||||
std::function<SizeT(SizeT,SizeT)>&& f) const
|
||||
inline decltype(auto) YIndex::mkIFor(SizeT i, const DXpr<None>& xpr, NoF&& f) const
|
||||
{
|
||||
if(i == mIs.size()-1){
|
||||
return mIs[i]->ifor( xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f) );
|
||||
return mIs[i]->ifor( xpr, std::forward<NoF>(f) );
|
||||
}
|
||||
else {
|
||||
auto f1 = f;
|
||||
|
@ -350,9 +349,9 @@ namespace CNORXZ
|
|||
return DXpr<SizeT>();
|
||||
}
|
||||
|
||||
DXpr<SizeT> YIndex::ifor(const DXpr<SizeT>& xpr, std::function<SizeT(SizeT,SizeT)>&& f) const
|
||||
DXpr<None> YIndex::ifor(const DXpr<None>& xpr, NoF&& f) const
|
||||
{
|
||||
return mkIFor(0, xpr, std::forward<std::function<SizeT(SizeT,SizeT)>>(f));
|
||||
return mkIFor(0, xpr, std::forward<NoF>(f));
|
||||
}
|
||||
|
||||
YIndex& YIndex::operator()(const Sptr<YIndex>& i)
|
||||
|
|
Loading…
Reference in a new issue