map range: take operation as argument
This commit is contained in:
parent
45d25a4d76
commit
fe4275766a
5 changed files with 260 additions and 229 deletions
|
@ -45,26 +45,16 @@ namespace MultiArrayTools
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <SpaceType STYPE, class Func, class... RangeTypes>
|
template <SpaceType STYPE, class Op, class MA, class... RangeTypes>
|
||||||
auto mkGenMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkGenMapR(const std::tuple<Op,MA>& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<GenMapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
-> std::shared_ptr<GenMapRange<Op,STYPE,RangeTypes...> >
|
||||||
STYPE,RangeTypes...> >
|
|
||||||
{
|
{
|
||||||
typedef FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...> FMA;
|
GenMapRangeFactory<Op,STYPE,RangeTypes...> mrf(f, ranges... );
|
||||||
std::shared_ptr<GenMapRangeFactory<FMA,STYPE,RangeTypes...>> mrfptr;
|
return createExplicit( mrf );
|
||||||
if(Func::FISSTATIC){
|
|
||||||
FMA fma(ranges...);
|
|
||||||
mrfptr = std::make_shared<GenMapRangeFactory<FMA,STYPE,RangeTypes...> >( fma, ranges... );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
FMA fma(ranges...,f);
|
|
||||||
mrfptr = std::make_shared<GenMapRangeFactory<FMA,STYPE,RangeTypes...> >( fma, ranges... );
|
|
||||||
}
|
|
||||||
return std::dynamic_pointer_cast<GenMapRange<FMA,STYPE,RangeTypes...> >( mrfptr->create() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <SpaceType STYPE, class Func, class... IndexTypes>
|
template <SpaceType STYPE, class Op, class MA, class... IndexTypes>
|
||||||
auto mkGenMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkGenMapI(const std::tuple<Op,MA>& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) )
|
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) )
|
||||||
{
|
{
|
||||||
auto mi = getIndex( mkGenMapR<STYPE>( f, indices->range()... ) );
|
auto mi = getIndex( mkGenMapR<STYPE>( f, indices->range()... ) );
|
||||||
|
@ -72,15 +62,15 @@ namespace MultiArrayTools
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Func, class... RangeTypes>
|
template <class Op, class MA, class... RangeTypes>
|
||||||
auto mkMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkMapR(const std::tuple<Op,MA>& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) )
|
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) )
|
||||||
{
|
{
|
||||||
return mkGenMapR<SpaceType::ANY>(f, ranges... );
|
return mkGenMapR<SpaceType::ANY>(f, ranges... );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Func, class... IndexTypes>
|
template <class Op, class MA, class... IndexTypes>
|
||||||
auto mkMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkMapI(const std::tuple<Op,MA>& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) )
|
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) )
|
||||||
{
|
{
|
||||||
return mkGenMapI<SpaceType::ANY>(f, indices... );
|
return mkGenMapI<SpaceType::ANY>(f, indices... );
|
||||||
|
|
|
@ -27,21 +27,20 @@ namespace MultiArrayTools
|
||||||
auto mkMulti(std::shared_ptr<RangeTypes>... ranges)
|
auto mkMulti(std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<MultiRange<RangeTypes...> >;
|
-> std::shared_ptr<MultiRange<RangeTypes...> >;
|
||||||
|
|
||||||
template <SpaceType STYPE, class Func, class... RangeTypes>
|
template <SpaceType STYPE, class Op, class MA, class... RangeTypes>
|
||||||
auto mkGenMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkGenMapR(const std::tuple<Op,MA>& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> std::shared_ptr<GenMapRange<FunctionalMultiArray<typename Func::value_type,Func,RangeTypes...>,
|
-> std::shared_ptr<GenMapRange<Op,STYPE,RangeTypes...> >;
|
||||||
STYPE,RangeTypes...> >;
|
|
||||||
|
|
||||||
template <SpaceType STYPE, class Func, class... IndexTypes>
|
template <SpaceType STYPE, class Op, class MA, class... IndexTypes>
|
||||||
auto mkGenMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkGenMapI(const std::tuple<Op,MA>& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) );
|
-> decltype( getIndex( mkGenMapR<STYPE>( f, indices->range()... ) ) );
|
||||||
|
|
||||||
template <class Func, class... RangeTypes>
|
template <class Op, class MA, class... RangeTypes>
|
||||||
auto mkMapR(const std::shared_ptr<Func>& f, std::shared_ptr<RangeTypes>... ranges)
|
auto mkMapR(const std::tuple<Op,MA>& f, std::shared_ptr<RangeTypes>... ranges)
|
||||||
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) );
|
-> decltype( mkGenMapR<SpaceType::ANY>(f, ranges... ) );
|
||||||
|
|
||||||
template <class Func, class... IndexTypes>
|
template <class Op, class MA, class... IndexTypes>
|
||||||
auto mkMapI(const std::shared_ptr<Func>& f, std::shared_ptr<IndexTypes>... indices)
|
auto mkMapI(const std::tuple<Op,MA>& f, std::shared_ptr<IndexTypes>... indices)
|
||||||
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) );
|
-> decltype( mkGenMapI<SpaceType::ANY>(f, indices... ) );
|
||||||
|
|
||||||
template <class... IndexTypes>
|
template <class... IndexTypes>
|
||||||
|
|
|
@ -14,12 +14,12 @@ namespace MultiArrayTools
|
||||||
* OpExpr *
|
* OpExpr *
|
||||||
**************/
|
**************/
|
||||||
|
|
||||||
template <class MapF, class IndexPack, class Expr, SpaceType STYPE>
|
template <class Op, class IndexPack, class Expr, SpaceType STYPE>
|
||||||
OpExpr<MapF,IndexPack,Expr,STYPE>::OpExpr(const MapF& mapf, const IndexPack& ipack,
|
OpExpr<Op,IndexPack,Expr,STYPE>::OpExpr(const Op& mapf, const IndexPack& ipack,
|
||||||
const std::shared_ptr<OIType>& oind, size_t step, Expr ex) :
|
const std::shared_ptr<OIType>& oind, size_t step, Expr ex) :
|
||||||
mIndPtr(oind.get()), mSPos(mIndPtr->pos()), mMax(mIndPtr->max()),
|
mIndPtr(oind.get()), mSPos(mIndPtr->pos()), mMax(mIndPtr->max()),
|
||||||
mStep(step), mExpr( ex ),
|
mStep(step), mExpr( ex ),
|
||||||
mOp(mkMapOp(mapf, ipack)),
|
mOp(mapf),
|
||||||
//mExt(ex.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr )))
|
//mExt(ex.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr )))
|
||||||
mExt( mOp.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr ) ).extend
|
mExt( mOp.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr ) ).extend
|
||||||
( ex.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr ) ) ) )
|
( ex.rootSteps( reinterpret_cast<std::intptr_t>( mIndPtr ) ) ) )
|
||||||
|
@ -27,8 +27,8 @@ namespace MultiArrayTools
|
||||||
assert(mIndPtr != nullptr);
|
assert(mIndPtr != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, class IndexPack, class Expr, SpaceType STYPE>
|
template <class Op, class IndexPack, class Expr, SpaceType STYPE>
|
||||||
inline void OpExpr<MapF,IndexPack,Expr,STYPE>::operator()(size_t mlast,
|
inline void OpExpr<Op,IndexPack,Expr,STYPE>::operator()(size_t mlast,
|
||||||
ExtType last)
|
ExtType last)
|
||||||
{
|
{
|
||||||
constexpr size_t NEXT = Op::SIZE;
|
constexpr size_t NEXT = Op::SIZE;
|
||||||
|
@ -41,8 +41,8 @@ namespace MultiArrayTools
|
||||||
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ) );
|
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, class IndexPack, class Expr, SpaceType STYPE>
|
template <class Op, class IndexPack, class Expr, SpaceType STYPE>
|
||||||
inline void OpExpr<MapF,IndexPack,Expr,STYPE>::operator()(size_t mlast)
|
inline void OpExpr<Op,IndexPack,Expr,STYPE>::operator()(size_t mlast)
|
||||||
{
|
{
|
||||||
const ExtType last;
|
const ExtType last;
|
||||||
constexpr size_t NEXT = Op::SIZE;
|
constexpr size_t NEXT = Op::SIZE;
|
||||||
|
@ -53,8 +53,8 @@ namespace MultiArrayTools
|
||||||
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ));
|
mExpr(mnpos, Getter<NEXT>::template getX<ExtType>( npos ));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, class IndexPack, class Expr, SpaceType STYPE>
|
template <class Op, class IndexPack, class Expr, SpaceType STYPE>
|
||||||
auto OpExpr<MapF,IndexPack,Expr,STYPE>::rootSteps(std::intptr_t iPtrNum) const
|
auto OpExpr<Op,IndexPack,Expr,STYPE>::rootSteps(std::intptr_t iPtrNum) const
|
||||||
-> ExtType
|
-> ExtType
|
||||||
{
|
{
|
||||||
return mOp.rootSteps(iPtrNum).extend( mExpr.rootSteps(iPtrNum) );
|
return mOp.rootSteps(iPtrNum).extend( mExpr.rootSteps(iPtrNum) );
|
||||||
|
@ -88,10 +88,10 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <class MRange>
|
template <class MRange>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>::GenMapIndex(const std::shared_ptr<MRange>& range) :
|
GenMapIndex<Op,XSTYPE,Indices...>::GenMapIndex(const std::shared_ptr<MRange>& range) :
|
||||||
IndexInterface<GenMapIndex<MapF,XSTYPE,Indices...>,std::tuple<typename Indices::MetaType...> >(range, 0)
|
IndexInterface<GenMapIndex<Op,XSTYPE,Indices...>,std::tuple<typename Indices::MetaType...> >(range, 0)
|
||||||
{
|
{
|
||||||
RPackNum<sizeof...(Indices)-1>::construct(mIPack, *range);
|
RPackNum<sizeof...(Indices)-1>::construct(mIPack, *range);
|
||||||
IB::mPos = RPackNum<sizeof...(Indices)-1>::makePos(mIPack);
|
IB::mPos = RPackNum<sizeof...(Indices)-1>::makePos(mIPack);
|
||||||
|
@ -101,9 +101,9 @@ namespace MultiArrayTools
|
||||||
( std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->outRange()->begin() );
|
( std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->outRange()->begin() );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <size_t DIR>
|
template <size_t DIR>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::up()
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::up()
|
||||||
{
|
{
|
||||||
static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices");
|
static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices");
|
||||||
IB::mPos += RPackNum<sizeof...(Indices)-DIR-1>::blockSize( mIPack );
|
IB::mPos += RPackNum<sizeof...(Indices)-DIR-1>::blockSize( mIPack );
|
||||||
|
@ -111,9 +111,9 @@ namespace MultiArrayTools
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <size_t DIR>
|
template <size_t DIR>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::down()
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::down()
|
||||||
{
|
{
|
||||||
static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices");
|
static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices");
|
||||||
IB::mPos -= RPackNum<sizeof...(Indices)-DIR-1>::blockSize( mIPack );
|
IB::mPos -= RPackNum<sizeof...(Indices)-DIR-1>::blockSize( mIPack );
|
||||||
|
@ -121,136 +121,136 @@ namespace MultiArrayTools
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::get() const -> decltype( *std::get<N>( mIPack ) )&
|
auto GenMapIndex<Op,XSTYPE,Indices...>::get() const -> decltype( *std::get<N>( mIPack ) )&
|
||||||
{
|
{
|
||||||
return *std::get<N>(mIPack);
|
return *std::get<N>(mIPack);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::getPtr() const -> decltype( std::get<N>( mIPack ) )&
|
auto GenMapIndex<Op,XSTYPE,Indices...>::getPtr() const -> decltype( std::get<N>( mIPack ) )&
|
||||||
{
|
{
|
||||||
return std::get<N>(mIPack);
|
return std::get<N>(mIPack);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::outIndex() const -> std::shared_ptr<OIType>
|
auto GenMapIndex<Op,XSTYPE,Indices...>::outIndex() const -> std::shared_ptr<OIType>
|
||||||
{
|
{
|
||||||
return mOutIndex;
|
return mOutIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::operator()(std::shared_ptr<Indices>&... indices)
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::operator()(std::shared_ptr<Indices>&... indices)
|
||||||
{
|
{
|
||||||
RPackNum<sizeof...(Indices)-1>::swapIndices(mIPack, indices...);
|
RPackNum<sizeof...(Indices)-1>::swapIndices(mIPack, indices...);
|
||||||
RPackNum<sizeof...(Indices)-1>::setIndexPack(mIPack, IB::mPos);
|
RPackNum<sizeof...(Indices)-1>::setIndexPack(mIPack, IB::mPos);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
IndexType GenMapIndex<MapF,XSTYPE,Indices...>::type() const
|
IndexType GenMapIndex<Op,XSTYPE,Indices...>::type() const
|
||||||
{
|
{
|
||||||
return IndexType::MULTI;
|
return IndexType::MULTI;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::operator=(size_t pos)
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::operator=(size_t pos)
|
||||||
{
|
{
|
||||||
IB::mPos = pos;
|
IB::mPos = pos;
|
||||||
RPackNum<sizeof...(Indices)-1>::setIndexPack(mIPack, pos);
|
RPackNum<sizeof...(Indices)-1>::setIndexPack(mIPack, pos);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::operator++()
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::operator++()
|
||||||
{
|
{
|
||||||
RPackNum<sizeof...(Indices)-1>::pp( mIPack );
|
RPackNum<sizeof...(Indices)-1>::pp( mIPack );
|
||||||
++IB::mPos;
|
++IB::mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::operator--()
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::operator--()
|
||||||
{
|
{
|
||||||
RPackNum<sizeof...(Indices)-1>::mm( mIPack );
|
RPackNum<sizeof...(Indices)-1>::mm( mIPack );
|
||||||
--IB::mPos;
|
--IB::mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
int GenMapIndex<MapF,XSTYPE,Indices...>::pp(std::intptr_t idxPtrNum)
|
int GenMapIndex<Op,XSTYPE,Indices...>::pp(std::intptr_t idxPtrNum)
|
||||||
{
|
{
|
||||||
int tmp = RPackNum<sizeof...(Indices)-1>::pp(mIPack, mBlockSizes, idxPtrNum);
|
int tmp = RPackNum<sizeof...(Indices)-1>::pp(mIPack, mBlockSizes, idxPtrNum);
|
||||||
IB::mPos += tmp;
|
IB::mPos += tmp;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
int GenMapIndex<MapF,XSTYPE,Indices...>::mm(std::intptr_t idxPtrNum)
|
int GenMapIndex<Op,XSTYPE,Indices...>::mm(std::intptr_t idxPtrNum)
|
||||||
{
|
{
|
||||||
int tmp = RPackNum<sizeof...(Indices)-1>::mm(mIPack, mBlockSizes, idxPtrNum);
|
int tmp = RPackNum<sizeof...(Indices)-1>::mm(mIPack, mBlockSizes, idxPtrNum);
|
||||||
IB::mPos -= tmp;
|
IB::mPos -= tmp;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
std::string GenMapIndex<MapF,XSTYPE,Indices...>::stringMeta() const
|
std::string GenMapIndex<Op,XSTYPE,Indices...>::stringMeta() const
|
||||||
{
|
{
|
||||||
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->stringMeta(IB::mPos);
|
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr )->stringMeta(IB::mPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
typename GenMapIndex<MapF,XSTYPE,Indices...>::MetaType GenMapIndex<MapF,XSTYPE,Indices...>::meta() const
|
typename GenMapIndex<Op,XSTYPE,Indices...>::MetaType GenMapIndex<Op,XSTYPE,Indices...>::meta() const
|
||||||
{
|
{
|
||||||
MetaType metaTuple;
|
MetaType metaTuple;
|
||||||
RPackNum<sizeof...(Indices)-1>::getMetaPos(metaTuple, mIPack);
|
RPackNum<sizeof...(Indices)-1>::getMetaPos(metaTuple, mIPack);
|
||||||
return metaTuple;
|
return metaTuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>& GenMapIndex<MapF,XSTYPE,Indices...>::at(const MetaType& metaPos)
|
GenMapIndex<Op,XSTYPE,Indices...>& GenMapIndex<Op,XSTYPE,Indices...>::at(const MetaType& metaPos)
|
||||||
{
|
{
|
||||||
RPackNum<sizeof...(Indices)-1>::setMeta(mIPack, metaPos);
|
RPackNum<sizeof...(Indices)-1>::setMeta(mIPack, metaPos);
|
||||||
IB::mPos = RPackNum<sizeof...(Indices)-1>::makePos(mIPack);
|
IB::mPos = RPackNum<sizeof...(Indices)-1>::makePos(mIPack);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
size_t GenMapIndex<MapF,XSTYPE,Indices...>::dim() const
|
size_t GenMapIndex<Op,XSTYPE,Indices...>::dim() const
|
||||||
{
|
{
|
||||||
return sizeof...(Indices);
|
return sizeof...(Indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
bool GenMapIndex<MapF,XSTYPE,Indices...>::first() const
|
bool GenMapIndex<Op,XSTYPE,Indices...>::first() const
|
||||||
{
|
{
|
||||||
return IB::mPos == 0;
|
return IB::mPos == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
bool GenMapIndex<MapF,XSTYPE,Indices...>::last() const
|
bool GenMapIndex<Op,XSTYPE,Indices...>::last() const
|
||||||
{
|
{
|
||||||
return IB::mPos == IB::mMax - 1;
|
return IB::mPos == IB::mMax - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
std::shared_ptr<typename GenMapIndex<MapF,XSTYPE,Indices...>::RangeType>
|
std::shared_ptr<typename GenMapIndex<Op,XSTYPE,Indices...>::RangeType>
|
||||||
GenMapIndex<MapF,XSTYPE,Indices...>::range() const
|
GenMapIndex<Op,XSTYPE,Indices...>::range() const
|
||||||
{
|
{
|
||||||
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr );
|
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::getPtr() -> decltype( std::get<N>( mIPack ) )&
|
auto GenMapIndex<Op,XSTYPE,Indices...>::getPtr() -> decltype( std::get<N>( mIPack ) )&
|
||||||
{
|
{
|
||||||
return std::get<N>(mIPack);
|
return std::get<N>(mIPack);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
size_t GenMapIndex<MapF,XSTYPE,Indices...>::getStepSize(size_t n) const
|
size_t GenMapIndex<Op,XSTYPE,Indices...>::getStepSize(size_t n) const
|
||||||
{
|
{
|
||||||
if(n >= sizeof...(Indices)){
|
if(n >= sizeof...(Indices)){
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -259,14 +259,14 @@ namespace MultiArrayTools
|
||||||
return mBlockSizes[n+1];
|
return mBlockSizes[n+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
std::string GenMapIndex<MapF,XSTYPE,Indices...>::id() const
|
std::string GenMapIndex<Op,XSTYPE,Indices...>::id() const
|
||||||
{
|
{
|
||||||
return std::string("mul") + std::to_string(IB::mId);
|
return std::string("mul") + std::to_string(IB::mId);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
void GenMapIndex<MapF,XSTYPE,Indices...>::print(size_t offset) const
|
void GenMapIndex<Op,XSTYPE,Indices...>::print(size_t offset) const
|
||||||
{
|
{
|
||||||
if(offset == 0){
|
if(offset == 0){
|
||||||
std::cout << " === " << std::endl;
|
std::cout << " === " << std::endl;
|
||||||
|
@ -277,30 +277,30 @@ namespace MultiArrayTools
|
||||||
RPackNum<sizeof...(Indices)-1>::printIndex(mIPack, offset+1);
|
RPackNum<sizeof...(Indices)-1>::printIndex(mIPack, offset+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <class Exprs>
|
template <class Exprs>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::ifor(size_t step, Exprs exs) const
|
auto GenMapIndex<Op,XSTYPE,Indices...>::ifor(size_t step, Exprs exs) const
|
||||||
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh
|
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh
|
||||||
(step, mIPack, mBlockSizes, OpExpr<MapF,IndexPack,Exprs,XSTYPE>
|
(step, mIPack, mBlockSizes, OpExpr<Op,IndexPack,Exprs,XSTYPE>
|
||||||
( range()->map(), mIPack, mOutIndex, step, exs ) ) )
|
( range()->map(), mIPack, mOutIndex, step, exs ) ) )
|
||||||
{
|
{
|
||||||
return RPackNum<sizeof...(Indices)-1>::mkForh
|
return RPackNum<sizeof...(Indices)-1>::mkForh
|
||||||
(step, mIPack, mBlockSizes, OpExpr<MapF,IndexPack,Exprs,XSTYPE>
|
(step, mIPack, mBlockSizes, OpExpr<Op,IndexPack,Exprs,XSTYPE>
|
||||||
( range()->map(), mIPack, mOutIndex, step, exs ) );
|
( range()->map(), mIPack, mOutIndex, step, exs ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <class Exprs>
|
template <class Exprs>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::pifor(size_t step, Exprs exs) const
|
auto GenMapIndex<Op,XSTYPE,Indices...>::pifor(size_t step, Exprs exs) const
|
||||||
-> decltype(ifor(step, exs))
|
-> decltype(ifor(step, exs))
|
||||||
{
|
{
|
||||||
return ifor(step, exs);
|
return ifor(step, exs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
template <class Exprs>
|
template <class Exprs>
|
||||||
auto GenMapIndex<MapF,XSTYPE,Indices...>::iforh(Exprs exs) const
|
auto GenMapIndex<Op,XSTYPE,Indices...>::iforh(Exprs exs) const
|
||||||
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh(mIPack, exs))
|
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh(mIPack, exs))
|
||||||
{
|
{
|
||||||
return RPackNum<sizeof...(Indices)-1>::mkForh(mIPack, exs);
|
return RPackNum<sizeof...(Indices)-1>::mkForh(mIPack, exs);
|
||||||
|
@ -310,30 +310,34 @@ namespace MultiArrayTools
|
||||||
* MapRangeFactory *
|
* MapRangeFactory *
|
||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
GenMapRangeFactory<MapF,XSTYPE,Ranges...>::GenMapRangeFactory(const MapF& mapf, const std::shared_ptr<Ranges>&... rs)
|
template <class MA>
|
||||||
|
GenMapRangeFactory<Op,XSTYPE,Ranges...>::GenMapRangeFactory(const std::tuple<Op,MA>& mapf,
|
||||||
|
const std::shared_ptr<Ranges>&... rs)
|
||||||
{
|
{
|
||||||
mProd = std::shared_ptr< GenMapRange<MapF,XSTYPE,Ranges...> >
|
mProd = std::shared_ptr< GenMapRange<Op,XSTYPE,Ranges...> >
|
||||||
( new GenMapRange<MapF,XSTYPE,Ranges...>( mapf, rs... ) );
|
( new GenMapRange<Op,XSTYPE,Ranges...>( mapf, rs... ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
GenMapRangeFactory<MapF,XSTYPE,Ranges...>::GenMapRangeFactory(const MapF& mapf, const typename GenMapRange<MapF,XSTYPE,Ranges...>::Space& st)
|
template <class MA>
|
||||||
|
GenMapRangeFactory<Op,XSTYPE,Ranges...>::GenMapRangeFactory(const std::tuple<Op,MA>& mapf,
|
||||||
|
const typename GenMapRange<Op,XSTYPE,Ranges...>::Space& st)
|
||||||
{
|
{
|
||||||
mProd = std::shared_ptr< GenMapRange<MapF,XSTYPE,Ranges...> >
|
mProd = std::shared_ptr< GenMapRange<Op,XSTYPE,Ranges...> >
|
||||||
( new GenMapRange<MapF,XSTYPE,Ranges...>( mapf, st ) );
|
( new GenMapRange<Op,XSTYPE,Ranges...>( mapf, st ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
std::shared_ptr<RangeBase> GenMapRangeFactory<MapF,XSTYPE,Ranges...>::create()
|
std::shared_ptr<RangeBase> GenMapRangeFactory<Op,XSTYPE,Ranges...>::create()
|
||||||
{
|
{
|
||||||
mProd = checkIfCreated( std::dynamic_pointer_cast<oType>( mProd )->mSpace );
|
mProd = checkIfCreated( std::dynamic_pointer_cast<oType>( mProd )->mSpace );
|
||||||
setSelf();
|
setSelf();
|
||||||
return mProd;
|
return mProd;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
std::shared_ptr<RangeBase> GenMapRangeFactory<MapF,XSTYPE,Ranges...>::checkIfCreated(const std::tuple<std::shared_ptr<Ranges>...>& ptp)
|
std::shared_ptr<RangeBase> GenMapRangeFactory<Op,XSTYPE,Ranges...>::checkIfCreated(const std::tuple<std::shared_ptr<Ranges>...>& ptp)
|
||||||
{
|
{
|
||||||
std::shared_ptr<RangeBase> out;
|
std::shared_ptr<RangeBase> out;
|
||||||
bool check = false;
|
bool check = false;
|
||||||
|
@ -421,111 +425,115 @@ namespace MultiArrayTools
|
||||||
mapMult = MultiArray<size_t,ORType>( outRange, outmult );
|
mapMult = MultiArray<size_t,ORType>( outRange, outmult );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//!!!!!
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
void GenMapRange<MapF,XSTYPE,Ranges...>::mkOutRange()
|
template <class MA>
|
||||||
|
void GenMapRange<Op,XSTYPE,Ranges...>::mkOutRange(const MA& mapf)
|
||||||
{
|
{
|
||||||
//FunctionalMultiArray<typename MapF::value_type,MapF,Ranges...> fma(mSpace, mMapf);
|
//FunctionalMultiArray<typename MapF::value_type,MapF,Ranges...> fma(mSpace, mMapf);
|
||||||
OutRangeMaker<XSTYPE>::mk(mOutRange,mMapMult,mMapf);
|
OutRangeMaker<XSTYPE>::mk(mOutRange,mMapMult,mapf);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
GenMapRange<MapF,XSTYPE,Ranges...>::GenMapRange(const MapF& mapf, const std::shared_ptr<Ranges>&... rs) :
|
template <class MA>
|
||||||
|
GenMapRange<Op,XSTYPE,Ranges...>::GenMapRange(const std::tuple<Op,MA>& mapf,
|
||||||
|
const std::shared_ptr<Ranges>&... rs) :
|
||||||
mSpace(std::make_tuple(rs...)),
|
mSpace(std::make_tuple(rs...)),
|
||||||
mMapf(mapf)
|
mMapf(std::get<0>(mapf))
|
||||||
{
|
{
|
||||||
mkOutRange();
|
mkOutRange(std::get<1>(mapf));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
GenMapRange<MapF,XSTYPE,Ranges...>::GenMapRange(const MapF& mapf, const Space& space) :
|
template <class MA>
|
||||||
|
GenMapRange<Op,XSTYPE,Ranges...>::GenMapRange(const std::tuple<Op,MA>& mapf, const Space& space) :
|
||||||
mSpace( space ),
|
mSpace( space ),
|
||||||
mMapf(mapf)
|
mMapf(std::get<0>(mapf))
|
||||||
{
|
{
|
||||||
mkOutRange();
|
mkOutRange(std::get<1>(mapf));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::get() const -> decltype( *std::get<N>( mSpace ) )&
|
auto GenMapRange<Op,XSTYPE,Ranges...>::get() const -> decltype( *std::get<N>( mSpace ) )&
|
||||||
{
|
{
|
||||||
return *std::get<N>(mSpace);
|
return *std::get<N>(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::getPtr() const -> decltype( std::get<N>( mSpace ) )&
|
auto GenMapRange<Op,XSTYPE,Ranges...>::getPtr() const -> decltype( std::get<N>( mSpace ) )&
|
||||||
{
|
{
|
||||||
return std::get<N>(mSpace);
|
return std::get<N>(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::outRange() const -> std::shared_ptr<ORType>
|
auto GenMapRange<Op,XSTYPE,Ranges...>::outRange() const -> std::shared_ptr<ORType>
|
||||||
{
|
{
|
||||||
return mOutRange;
|
return mOutRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
const MapF& GenMapRange<MapF,XSTYPE,Ranges...>::map() const
|
const Op& GenMapRange<Op,XSTYPE,Ranges...>::map() const
|
||||||
{
|
{
|
||||||
return mMapf;
|
return mMapf;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
size_t GenMapRange<MapF,XSTYPE,Ranges...>::dim() const
|
size_t GenMapRange<Op,XSTYPE,Ranges...>::dim() const
|
||||||
{
|
{
|
||||||
return sdim;
|
return sdim;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
size_t GenMapRange<MapF,XSTYPE,Ranges...>::size() const
|
size_t GenMapRange<Op,XSTYPE,Ranges...>::size() const
|
||||||
{
|
{
|
||||||
return mOutRange->size();
|
return mOutRange->size();
|
||||||
//return RPackNum<sizeof...(Ranges)-1>::getSize(mSpace);
|
//return RPackNum<sizeof...(Ranges)-1>::getSize(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
SpaceType GenMapRange<MapF,XSTYPE,Ranges...>::spaceType() const
|
SpaceType GenMapRange<Op,XSTYPE,Ranges...>::spaceType() const
|
||||||
{
|
{
|
||||||
return SpaceType::ANY;
|
return SpaceType::ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
const typename GenMapRange<MapF,XSTYPE,Ranges...>::Space& GenMapRange<MapF,XSTYPE,Ranges...>::space() const
|
const typename GenMapRange<Op,XSTYPE,Ranges...>::Space& GenMapRange<Op,XSTYPE,Ranges...>::space() const
|
||||||
{
|
{
|
||||||
return mSpace;
|
return mSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
vector<size_t> GenMapRange<MapF,XSTYPE,Ranges...>::typeNum() const
|
vector<size_t> GenMapRange<Op,XSTYPE,Ranges...>::typeNum() const
|
||||||
{
|
{
|
||||||
vector<size_t> o;
|
vector<size_t> o;
|
||||||
RPackNum<sizeof...(Ranges)-1>::getTypeNum(o,mSpace);
|
RPackNum<sizeof...(Ranges)-1>::getTypeNum(o,mSpace);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
size_t GenMapRange<MapF,XSTYPE,Ranges...>::cmeta(char* target, size_t pos) const
|
size_t GenMapRange<Op,XSTYPE,Ranges...>::cmeta(char* target, size_t pos) const
|
||||||
{
|
{
|
||||||
return RPackNum<sizeof...(Ranges)-1>::getCMeta(target,pos,mSpace,cmetaSize());
|
return RPackNum<sizeof...(Ranges)-1>::getCMeta(target,pos,mSpace,cmetaSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
size_t GenMapRange<MapF,XSTYPE,Ranges...>::cmetaSize() const
|
size_t GenMapRange<Op,XSTYPE,Ranges...>::cmetaSize() const
|
||||||
{
|
{
|
||||||
return RPackNum<sizeof...(Ranges)-1>::getCMetaSize(mSpace);
|
return RPackNum<sizeof...(Ranges)-1>::getCMetaSize(mSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
std::string GenMapRange<MapF,XSTYPE,Ranges...>::stringMeta(size_t pos) const
|
std::string GenMapRange<Op,XSTYPE,Ranges...>::stringMeta(size_t pos) const
|
||||||
{
|
{
|
||||||
auto i = begin();
|
auto i = begin();
|
||||||
i = pos;
|
i = pos;
|
||||||
return "[ " + RPackNum<sizeof...(Ranges)-1>::getStringMeta(i) + " ]";
|
return "[ " + RPackNum<sizeof...(Ranges)-1>::getStringMeta(i) + " ]";
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
vector<char> GenMapRange<MapF,XSTYPE,Ranges...>::data() const
|
vector<char> GenMapRange<Op,XSTYPE,Ranges...>::data() const
|
||||||
{
|
{
|
||||||
DataHeader h = dataHeader();
|
DataHeader h = dataHeader();
|
||||||
vector<char> out;
|
vector<char> out;
|
||||||
|
@ -536,8 +544,8 @@ namespace MultiArrayTools
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
DataHeader GenMapRange<MapF,XSTYPE,Ranges...>::dataHeader() const
|
DataHeader GenMapRange<Op,XSTYPE,Ranges...>::dataHeader() const
|
||||||
{
|
{
|
||||||
DataHeader h;
|
DataHeader h;
|
||||||
h.spaceType = static_cast<int>( SpaceType::ANY );
|
h.spaceType = static_cast<int>( SpaceType::ANY );
|
||||||
|
@ -546,44 +554,44 @@ namespace MultiArrayTools
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
typename GenMapRange<MapF,XSTYPE,Ranges...>::IndexType GenMapRange<MapF,XSTYPE,Ranges...>::begin() const
|
typename GenMapRange<Op,XSTYPE,Ranges...>::IndexType GenMapRange<Op,XSTYPE,Ranges...>::begin() const
|
||||||
{
|
{
|
||||||
GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...>
|
GenMapIndex<Op,XSTYPE,typename Ranges::IndexType...>
|
||||||
i( std::dynamic_pointer_cast<GenMapRange<MapF,XSTYPE,Ranges...> >
|
i( std::dynamic_pointer_cast<GenMapRange<Op,XSTYPE,Ranges...> >
|
||||||
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
|
||||||
i = 0;
|
i = 0;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
typename GenMapRange<MapF,XSTYPE,Ranges...>::IndexType GenMapRange<MapF,XSTYPE,Ranges...>::end() const
|
typename GenMapRange<Op,XSTYPE,Ranges...>::IndexType GenMapRange<Op,XSTYPE,Ranges...>::end() const
|
||||||
{
|
{
|
||||||
GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...>
|
GenMapIndex<Op,XSTYPE,typename Ranges::IndexType...>
|
||||||
i( std::dynamic_pointer_cast<GenMapRange<MapF,XSTYPE,Ranges...> >
|
i( std::dynamic_pointer_cast<GenMapRange<Op,XSTYPE,Ranges...> >
|
||||||
( std::shared_ptr<RangeBase>( RB::mThis )) );
|
( std::shared_ptr<RangeBase>( RB::mThis )) );
|
||||||
i = size();
|
i = size();
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::mapMultiplicity() const
|
auto GenMapRange<Op,XSTYPE,Ranges...>::mapMultiplicity() const
|
||||||
-> const MultiArray<size_t,ORType>&
|
-> const MultiArray<size_t,ORType>&
|
||||||
{
|
{
|
||||||
return mMapMult;
|
return mMapMult;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::explMapMultiplicity() const
|
auto GenMapRange<Op,XSTYPE,Ranges...>::explMapMultiplicity() const
|
||||||
-> MultiArray<size_t,GenMapRange>
|
-> MultiArray<size_t,GenMapRange>
|
||||||
{
|
{
|
||||||
auto tmp = mMapMult;
|
auto tmp = mMapMult;
|
||||||
return tmp.format( std::dynamic_pointer_cast<GenMapRange<MapF,XSTYPE,Ranges...> >
|
return tmp.format( std::dynamic_pointer_cast<GenMapRange<Op,XSTYPE,Ranges...> >
|
||||||
( std::shared_ptr<RangeBase>( RB::mThis )) );
|
( std::shared_ptr<RangeBase>( RB::mThis )) );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
vector<size_t> GenMapRange<MapF,XSTYPE,Ranges...>::mapPos() const
|
vector<size_t> GenMapRange<Op,XSTYPE,Ranges...>::mapPos() const
|
||||||
{
|
{
|
||||||
auto i = mMapf.begin();
|
auto i = mMapf.begin();
|
||||||
vector<size_t> out(i.max());
|
vector<size_t> out(i.max());
|
||||||
|
@ -594,9 +602,9 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
template <class... ERanges>
|
template <class... ERanges>
|
||||||
auto GenMapRange<MapF,XSTYPE,Ranges...>::cat(const std::shared_ptr<MapRange<ERanges...> >& erange)
|
auto GenMapRange<Op,XSTYPE,Ranges...>::cat(const std::shared_ptr<MapRange<ERanges...> >& erange)
|
||||||
-> std::shared_ptr<GenMapRange<Ranges...,ERanges...> >
|
-> std::shared_ptr<GenMapRange<Ranges...,ERanges...> >
|
||||||
{
|
{
|
||||||
auto crange = std::tuple_cat(mSpace, erange->space());
|
auto crange = std::tuple_cat(mSpace, erange->space());
|
||||||
|
|
|
@ -26,20 +26,35 @@ namespace MultiArrayTools
|
||||||
using namespace MultiArrayHelper;
|
using namespace MultiArrayHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MA, class... Indices>
|
|
||||||
auto mkMapOp(const MA& ma,
|
template <class Func, class... Indices>
|
||||||
const std::tuple<std::shared_ptr<Indices>...>& itp)
|
auto mkMapOp(const std::shared_ptr<Func>& func,
|
||||||
-> decltype(PackNum<sizeof...(Indices)-1>::mkMapOp(ma, itp))
|
const std::shared_ptr<Indices>&... is)
|
||||||
|
-> decltype(std::make_tuple(FunctionalMultiArray<typename Func::value_type,Func,
|
||||||
|
typename Indices::RangeType...>().exec(is...),
|
||||||
|
FunctionalMultiArray<typename Func::value_type,Func,
|
||||||
|
typename Indices::RangeType...>()))
|
||||||
{
|
{
|
||||||
return PackNum<sizeof...(Indices)-1>::mkMapOp(ma, itp);
|
typedef FunctionalMultiArray<typename Func::value_type,Func,typename Indices::RangeType...> FMA;
|
||||||
|
if(Func::FISSTATIC){
|
||||||
|
FMA fma(is->range()...);
|
||||||
|
return std::make_tuple(fma.exec(is...),fma);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
FMA fma(is->range()...,func);
|
||||||
|
return std::make_tuple(fma.exec(is...),fma);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class MapF, class IndexPack, class Expr, SpaceType STYPE = SpaceType::ANY>
|
|
||||||
|
|
||||||
|
template <class Op, class IndexPack, class Expr, SpaceType STYPE = SpaceType::ANY>
|
||||||
|
//template <class MapF, class IndexPack, class Expr, SpaceType STYPE = SpaceType::ANY>
|
||||||
class OpExpr
|
class OpExpr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef decltype(mkMapOp(std::declval<MapF>(), std::declval<IndexPack>())) Op;
|
//typedef decltype(mkMapOp(std::declval<MapF>(), std::declval<IndexPack>())) Op;
|
||||||
typedef SingleIndex<typename MapF::value_type,STYPE> OIType;
|
typedef SingleIndex<typename Op::value_type,STYPE> OIType;
|
||||||
//typedef typename MapF::IndexPack IndexPack;
|
//typedef typename MapF::IndexPack IndexPack;
|
||||||
static constexpr size_t LAYER = Expr::LAYER + 1;
|
static constexpr size_t LAYER = Expr::LAYER + 1;
|
||||||
static constexpr size_t SIZE = Expr::SIZE + Op::SIZE;
|
static constexpr size_t SIZE = Expr::SIZE + Op::SIZE;
|
||||||
|
@ -63,7 +78,8 @@ namespace MultiArrayTools
|
||||||
OpExpr& operator=(const OpExpr& in) = default;
|
OpExpr& operator=(const OpExpr& in) = default;
|
||||||
OpExpr& operator=(OpExpr&& in) = default;
|
OpExpr& operator=(OpExpr&& in) = default;
|
||||||
|
|
||||||
OpExpr(const MapF& mapf, const IndexPack& ipack, const std::shared_ptr<OIType>& oind, size_t step, Expr ex);
|
OpExpr(const Op& mapf, const IndexPack& ipack, const std::shared_ptr<OIType>& oind, size_t step, Expr ex);
|
||||||
|
//OpExpr(const MapF& mapf, const IndexPack& ipack, const std::shared_ptr<OIType>& oind, size_t step, Expr ex);
|
||||||
|
|
||||||
inline void operator()(size_t mlast, ExtType last);
|
inline void operator()(size_t mlast, ExtType last);
|
||||||
inline void operator()(size_t mlast = 0);
|
inline void operator()(size_t mlast = 0);
|
||||||
|
@ -72,19 +88,19 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Indices>
|
template <class Op, SpaceType XSTYPE, class... Indices>
|
||||||
class GenMapIndex : public IndexInterface<GenMapIndex<MapF,XSTYPE,Indices...>,
|
class GenMapIndex : public IndexInterface<GenMapIndex<Op,XSTYPE,Indices...>,
|
||||||
std::tuple<typename Indices::MetaType...> >
|
std::tuple<typename Indices::MetaType...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef IndexInterface<GenMapIndex<MapF,XSTYPE,Indices...>,
|
typedef IndexInterface<GenMapIndex<Op,XSTYPE,Indices...>,
|
||||||
std::tuple<typename Indices::MetaType...> > IB;
|
std::tuple<typename Indices::MetaType...> > IB;
|
||||||
typedef std::tuple<std::shared_ptr<Indices>...> IndexPack;
|
typedef std::tuple<std::shared_ptr<Indices>...> IndexPack;
|
||||||
typedef std::tuple<typename Indices::MetaType...> MetaType;
|
typedef std::tuple<typename Indices::MetaType...> MetaType;
|
||||||
typedef GenMapRange<MapF,XSTYPE,typename Indices::RangeType...> RangeType;
|
typedef GenMapRange<Op,XSTYPE,typename Indices::RangeType...> RangeType;
|
||||||
typedef GenMapIndex IType;
|
typedef GenMapIndex IType;
|
||||||
typedef SingleIndex<typename MapF::value_type,XSTYPE> OIType;
|
typedef SingleIndex<typename Op::value_type,XSTYPE> OIType;
|
||||||
|
|
||||||
static constexpr IndexType sType() { return IndexType::MULTI; }
|
static constexpr IndexType sType() { return IndexType::MULTI; }
|
||||||
static constexpr size_t sDim() { return sizeof...(Indices); }
|
static constexpr size_t sDim() { return sizeof...(Indices); }
|
||||||
|
@ -168,7 +184,7 @@ namespace MultiArrayTools
|
||||||
template <class Exprs>
|
template <class Exprs>
|
||||||
auto ifor(size_t step, Exprs exs) const
|
auto ifor(size_t step, Exprs exs) const
|
||||||
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh
|
-> decltype(RPackNum<sizeof...(Indices)-1>::mkForh
|
||||||
(step, mIPack, mBlockSizes, OpExpr<MapF,IndexPack,Exprs,XSTYPE>( range()->map(), mIPack, mOutIndex, step, exs ) ) );
|
(step, mIPack, mBlockSizes, OpExpr<Op,IndexPack,Exprs,XSTYPE>( range()->map(), mIPack, mOutIndex, step, exs ) ) );
|
||||||
// first step arg not used!
|
// first step arg not used!
|
||||||
|
|
||||||
template <class Exprs>
|
template <class Exprs>
|
||||||
|
@ -188,15 +204,20 @@ namespace MultiArrayTools
|
||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
// NOT THREAD SAVE
|
// NOT THREAD SAVE
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
class GenMapRangeFactory : public RangeFactoryBase
|
class GenMapRangeFactory : public RangeFactoryBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef GenMapRange<MapF,XSTYPE,Ranges...> oType;
|
typedef GenMapRange<Op,XSTYPE,Ranges...> oType;
|
||||||
|
|
||||||
GenMapRangeFactory() = delete;
|
GenMapRangeFactory() = delete;
|
||||||
GenMapRangeFactory(const MapF& mapf, const std::shared_ptr<Ranges>&... rs);
|
|
||||||
GenMapRangeFactory(const MapF& mapf, const typename GenMapRange<MapF,XSTYPE,Ranges...>::Space& space);
|
template <class MA>
|
||||||
|
GenMapRangeFactory(const std::tuple<Op,MA>& mapf, const std::shared_ptr<Ranges>&... rs);
|
||||||
|
|
||||||
|
template <class MA>
|
||||||
|
GenMapRangeFactory(const std::tuple<Op,MA>& mapf,
|
||||||
|
const typename GenMapRange<Op,XSTYPE,Ranges...>::Space& space);
|
||||||
|
|
||||||
virtual std::shared_ptr<RangeBase> create() override;
|
virtual std::shared_ptr<RangeBase> create() override;
|
||||||
|
|
||||||
|
@ -210,16 +231,16 @@ namespace MultiArrayTools
|
||||||
* MapRange *
|
* MapRange *
|
||||||
******************/
|
******************/
|
||||||
|
|
||||||
template <class MapF, SpaceType XSTYPE, class... Ranges>
|
template <class Op, SpaceType XSTYPE, class... Ranges>
|
||||||
class GenMapRange : public RangeInterface<GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...> >
|
class GenMapRange : public RangeInterface<GenMapIndex<Op,XSTYPE,typename Ranges::IndexType...> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef RangeBase RB;
|
typedef RangeBase RB;
|
||||||
typedef std::tuple<std::shared_ptr<Ranges>...> Space;
|
typedef std::tuple<std::shared_ptr<Ranges>...> Space;
|
||||||
typedef GenMapIndex<MapF,XSTYPE,typename Ranges::IndexType...> IndexType;
|
typedef GenMapIndex<Op,XSTYPE,typename Ranges::IndexType...> IndexType;
|
||||||
typedef GenMapRange RangeType;
|
typedef GenMapRange RangeType;
|
||||||
typedef SingleRange<typename MapF::value_type,XSTYPE> ORType;
|
typedef SingleRange<typename Op::value_type,XSTYPE> ORType;
|
||||||
typedef SingleRangeFactory<typename MapF::value_type,XSTYPE> ORFType;
|
typedef SingleRangeFactory<typename Op::value_type,XSTYPE> ORFType;
|
||||||
//typedef typename RangeInterface<MapIndex<typename Ranges::IndexType...> >::IndexType IndexType;
|
//typedef typename RangeInterface<MapIndex<typename Ranges::IndexType...> >::IndexType IndexType;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -227,16 +248,21 @@ namespace MultiArrayTools
|
||||||
GenMapRange(const GenMapRange& in) = delete;
|
GenMapRange(const GenMapRange& in) = delete;
|
||||||
GenMapRange& operator=(const GenMapRange& in) = delete;
|
GenMapRange& operator=(const GenMapRange& in) = delete;
|
||||||
|
|
||||||
GenMapRange(const MapF& mapf, const std::shared_ptr<Ranges>&... rs);
|
template <class MA>
|
||||||
GenMapRange(const MapF& mapf, const Space& space);
|
GenMapRange(const std::tuple<Op,MA>& mapf, const Space& space);
|
||||||
|
|
||||||
|
template <class MA>
|
||||||
|
GenMapRange(const std::tuple<Op,MA>& mapf, const std::shared_ptr<Ranges>&... rs);
|
||||||
|
|
||||||
Space mSpace;
|
Space mSpace;
|
||||||
MapF mMapf;
|
Op mMapf;
|
||||||
|
//Op mMapf;
|
||||||
std::shared_ptr<ORType> mOutRange;
|
std::shared_ptr<ORType> mOutRange;
|
||||||
MultiArray<size_t,ORType> mMapMult;
|
MultiArray<size_t,ORType> mMapMult;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void mkOutRange();
|
template <class MA>
|
||||||
|
void mkOutRange(const MA& mapf);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -249,7 +275,7 @@ namespace MultiArrayTools
|
||||||
auto getPtr() const -> decltype( std::get<N>( mSpace ) )&;
|
auto getPtr() const -> decltype( std::get<N>( mSpace ) )&;
|
||||||
|
|
||||||
std::shared_ptr<ORType> outRange() const;
|
std::shared_ptr<ORType> outRange() const;
|
||||||
const MapF& map() const;
|
const Op& map() const;
|
||||||
|
|
||||||
virtual size_t dim() const final;
|
virtual size_t dim() const final;
|
||||||
virtual size_t size() const final;
|
virtual size_t size() const final;
|
||||||
|
@ -278,31 +304,30 @@ namespace MultiArrayTools
|
||||||
auto cat(const std::shared_ptr<GenMapRange<ERanges...> >& erange)
|
auto cat(const std::shared_ptr<GenMapRange<ERanges...> >& erange)
|
||||||
-> std::shared_ptr<GenMapRange<Ranges...,ERanges...> >;
|
-> std::shared_ptr<GenMapRange<Ranges...,ERanges...> >;
|
||||||
*/
|
*/
|
||||||
friend GenMapRangeFactory<MapF,XSTYPE,Ranges...>;
|
friend GenMapRangeFactory<Op,XSTYPE,Ranges...>;
|
||||||
|
|
||||||
static constexpr bool HASMETACONT = false;
|
static constexpr bool HASMETACONT = false;
|
||||||
static constexpr bool defaultable = false;
|
static constexpr bool defaultable = false;
|
||||||
static constexpr size_t ISSTATIC = SubProp<MapF,Ranges...>::ISSTATIC;
|
static constexpr size_t ISSTATIC = SubProp<Op,Ranges...>::ISSTATIC;
|
||||||
static constexpr size_t SIZE = SubProp<MapF,Ranges...>::SIZE;
|
static constexpr size_t SIZE = SubProp<Op,Ranges...>::SIZE;
|
||||||
};
|
};
|
||||||
|
|
||||||
// for legacy
|
// for legacy
|
||||||
template <class MapF, class... Indices>
|
template <class Op, class... Indices>
|
||||||
using MapIndex = GenMapIndex<MapF,SpaceType::ANY,Indices...>;
|
using MapIndex = GenMapIndex<Op,SpaceType::ANY,Indices...>;
|
||||||
|
|
||||||
template <class MapF, class... Ranges>
|
template <class Op, class... Ranges>
|
||||||
using MapRangeFactory = GenMapRangeFactory<MapF,SpaceType::ANY,Ranges...>;
|
using MapRangeFactory = GenMapRangeFactory<Op,SpaceType::ANY,Ranges...>;
|
||||||
|
|
||||||
template <class MapF, class... Ranges>
|
template <class Op, class... Ranges>
|
||||||
using MapRange = GenMapRange<MapF,SpaceType::ANY,Ranges...>;
|
using MapRange = GenMapRange<Op,SpaceType::ANY,Ranges...>;
|
||||||
|
|
||||||
template <class MapF, class... Indices>
|
template <class Op, class... Indices>
|
||||||
auto mapResult/*<MapIndex<MapF,Indices...> >*/(const std::shared_ptr<MapIndex<MapF,Indices...> >& ind)
|
auto mapResult/*<MapIndex<Op,Indices...> >*/(const std::shared_ptr<MapIndex<Op,Indices...> >& ind)
|
||||||
-> decltype(ind->outIndex())
|
-> decltype(ind->outIndex())
|
||||||
{
|
{
|
||||||
return ind->outIndex();
|
return ind->outIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,13 +197,29 @@ namespace {
|
||||||
|
|
||||||
typedef SingleRangeFactory<size_t,SpaceType::ANY> SRF;
|
typedef SingleRangeFactory<size_t,SpaceType::ANY> SRF;
|
||||||
typedef SRF::oType SRange;
|
typedef SRF::oType SRange;
|
||||||
|
typedef typename SRange::IndexType SIndex;
|
||||||
|
/*
|
||||||
typedef FunctionalMultiArray<size_t,plus<size_t>,SRange,SRange> MapF;
|
typedef FunctionalMultiArray<size_t,plus<size_t>,SRange,SRange> MapF;
|
||||||
|
|
||||||
typedef MapRangeFactory<MapF,SRange,SRange> MpRF;
|
typedef MapRangeFactory<MapF,SRange,SRange> MpRF;
|
||||||
typedef MpRF::oType MpRange;
|
typedef MpRF::oType MpRange;
|
||||||
|
*/
|
||||||
|
|
||||||
typedef MpRange::ORType TRange;
|
|
||||||
|
std::shared_ptr<SRange> sr1ptr;
|
||||||
|
std::shared_ptr<SRange> sr2ptr;
|
||||||
|
std::shared_ptr<SIndex> si1ptr;
|
||||||
|
std::shared_ptr<SIndex> si2ptr;
|
||||||
|
|
||||||
|
//std::shared_ptr<MpRange> mpr1ptr;
|
||||||
|
vector<double> v1 = { -31.71, -77.16, -18.81,
|
||||||
|
-67.06, 72.31, -54.48,
|
||||||
|
-50.91, -11.62, -59.57,
|
||||||
|
-42.53, 80.41, 6.35 };
|
||||||
|
|
||||||
|
typedef std::remove_reference<decltype(*mkMapR( mkMapOp(std::make_shared<plus<size_t>>(),getIndex(sr1ptr),getIndex(sr2ptr)) , sr1ptr, sr2ptr ))>::type MpRange;
|
||||||
|
std::shared_ptr<MpRange> mpr1ptr;
|
||||||
|
typedef MpRange::ORType TRange;
|
||||||
|
|
||||||
MapTest()
|
MapTest()
|
||||||
{
|
{
|
||||||
|
@ -212,20 +228,12 @@ namespace {
|
||||||
|
|
||||||
sr1ptr = std::dynamic_pointer_cast<SRange>( srf1.create() );
|
sr1ptr = std::dynamic_pointer_cast<SRange>( srf1.create() );
|
||||||
sr2ptr = std::dynamic_pointer_cast<SRange>( srf2.create() );
|
sr2ptr = std::dynamic_pointer_cast<SRange>( srf2.create() );
|
||||||
|
si1ptr = getIndex(sr1ptr);
|
||||||
|
si2ptr = getIndex(sr2ptr);
|
||||||
|
|
||||||
MapF map(sr1ptr,sr2ptr);
|
mpr1ptr = mkMapR( mkMapOp(std::make_shared<plus<size_t>>(),si1ptr,si2ptr) , sr1ptr, sr2ptr );
|
||||||
MpRF mprf1( map, sr1ptr, sr2ptr );
|
|
||||||
|
|
||||||
mpr1ptr = std::dynamic_pointer_cast<MpRange>( mprf1.create() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SRange> sr1ptr;
|
|
||||||
std::shared_ptr<SRange> sr2ptr;
|
|
||||||
std::shared_ptr<MpRange> mpr1ptr;
|
|
||||||
vector<double> v1 = { -31.71, -77.16, -18.81,
|
|
||||||
-67.06, 72.31, -54.48,
|
|
||||||
-50.91, -11.62, -59.57,
|
|
||||||
-42.53, 80.41, 6.35 };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpTest_Performance : public ::testing::Test
|
class OpTest_Performance : public ::testing::Test
|
||||||
|
@ -359,7 +367,8 @@ namespace {
|
||||||
auto ii1 = getIndex( rptr<0>( ma1 ) );
|
auto ii1 = getIndex( rptr<0>( ma1 ) );
|
||||||
auto ii2 = getIndex( rptr<1>( ma1 ) );
|
auto ii2 = getIndex( rptr<1>( ma1 ) );
|
||||||
|
|
||||||
auto mr = mkMapR(std::make_shared<plus<size_t>>(),sr1ptr,sr2ptr);
|
auto mr = mkMapR( mkMapOp(std::make_shared<plus<size_t>>(),ii1,ii2) , sr1ptr, sr2ptr );
|
||||||
|
//auto mr = mkMapR(std::make_shared<plus<size_t>>(),sr1ptr,sr2ptr);
|
||||||
MultiArray<double,MpRange> res(mr);
|
MultiArray<double,MpRange> res(mr);
|
||||||
MultiArray<double,MpRange> res2(mr);
|
MultiArray<double,MpRange> res2(mr);
|
||||||
auto jj = getIndex( mr );
|
auto jj = getIndex( mr );
|
||||||
|
|
Loading…
Reference in a new issue