start removing expression collection stuff -> so far compile errors + seg fault...

This commit is contained in:
Christian Zimmermann 2020-07-08 17:55:51 +02:00
parent 9ab27d1e5a
commit f7549a230b
11 changed files with 345 additions and 324 deletions

View file

@ -3,7 +3,7 @@
namespace MultiArrayTools
{
/*
template <class Expr>
inline ExpressionHolder<Expr> Expressions1::ifor(size_t step,
ExpressionHolder<Expr> ex) const
@ -35,5 +35,5 @@ namespace MultiArrayTools
{
return std::make_shared<EC>(i);
}
*/
} // namespace MultiArrayTools

View file

@ -11,7 +11,7 @@
namespace MultiArrayTools
{
/*
//class Expressions1;
template <class EC>
@ -55,7 +55,7 @@ namespace MultiArrayTools
template <class EC, template <class> class OpF>
using AEX_B_CC = AEX<EC,oo<EC,DDMMA<EC>>,OpF,DDMA<EC>,DDMA<EC>>;
*/
/*
template <class EC>
class ECInterface
@ -80,6 +80,7 @@ namespace MultiArrayTools
}
};
*/
/*
template <class EC, class Index>
std::shared_ptr<EC> makeec(const std::shared_ptr<Index>& i);
@ -182,8 +183,7 @@ namespace MultiArrayTools
E1(const std::shared_ptr<Index>& i) : mI(i) {}
};
*/
} // namespace MultiArrayTools
#endif

View file

@ -169,36 +169,36 @@ namespace MultiArrayTools
}
template <class EC, class MArray>
template <class MArray>
auto dynamic(const MArray& ma, bool slice)
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange<EC>>>
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange>>
{
DynamicRangeFactory<EC> drf(ma.range()->space());
DynamicRangeFactory drf(ma.range()->space());
if(slice){
return std::make_shared<ConstSlice<typename MArray::value_type,DynamicRange<EC>>>
( std::dynamic_pointer_cast<DynamicRange<EC>>( drf.create() ),
return std::make_shared<ConstSlice<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.data() );
}
else {
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange<EC>>>
( std::dynamic_pointer_cast<DynamicRange<EC>>( drf.create() ),
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.vdata() );
}
}
template <class EC, class MArray>
template <class MArray>
auto mdynamic(MArray& ma, bool slice)
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange<EC>>>
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange>>
{
DynamicRangeFactory<EC> drf(ma.range()->space());
DynamicRangeFactory drf(ma.range()->space());
if(slice){
return std::make_shared<Slice<typename MArray::value_type,DynamicRange<EC>>>
( std::dynamic_pointer_cast<DynamicRange<EC>>( drf.create() ),
return std::make_shared<Slice<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.data() );
}
else {
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange<EC>>>
( std::dynamic_pointer_cast<DynamicRange<EC>>( drf.create() ),
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.vdata() );
}
}
@ -227,34 +227,34 @@ namespace MultiArrayTools
};
}
template <typename T, class EC, class Range1, class... RangeTypes>
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
DynamicRangeFactory<EC> drf(rptr<LAST>(ma)->orig());
DynamicRangeFactory drf(rptr<LAST>(ma)->orig());
std::tuple<std::shared_ptr<Range1>,std::shared_ptr<RangeTypes>...,
std::shared_ptr<DynamicRange<EC>>> mNSpace;
std::shared_ptr<DynamicRange>> mNSpace;
CopyRanges<LAST-1>::exec(ma.range()->space(),mNSpace);
std::get<LAST>(mNSpace) = createExplicit( drf );
return ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>(mNSpace, ma.data());
return ConstSlice<T,Range1,RangeTypes...,DynamicRange>(mNSpace, ma.data());
}
template <typename T, class EC, class Range1, class... RangeTypes>
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> Slice<T,Range1,RangeTypes...,DynamicRange<EC>>
-> Slice<T,Range1,RangeTypes...,DynamicRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
DynamicRangeFactory<EC> drf(rptr<LAST>(ma)->orig());
DynamicRangeFactory drf(rptr<LAST>(ma)->orig());
std::tuple<std::shared_ptr<Range1>,std::shared_ptr<RangeTypes>...,
std::shared_ptr<DynamicRange<EC>>> mNSpace;
std::shared_ptr<DynamicRange>> mNSpace;
CopyRanges<LAST-1>::exec(ma.range()->space(),mNSpace);
std::get<LAST>(mNSpace) = createExplicit( drf );
return Slice<T,Range1,RangeTypes...,DynamicRange<EC>>(mNSpace, ma.data());
return Slice<T,Range1,RangeTypes...,DynamicRange>(mNSpace, ma.data());
}
template <typename T, class EC, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
template <typename T, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
@ -266,26 +266,26 @@ namespace MultiArrayTools
return ma.format(mNSpace);
}
template <typename T, class EC>
template <typename T>
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
-> ConstSlice<T,DynamicRange<EC>>
-> ConstSlice<T,DynamicRange>
{
DynamicRangeFactory<EC> drf(rptr<0>(ma)->orig());
DynamicRangeFactory drf(rptr<0>(ma)->orig());
auto mNSpace = std::make_tuple( createExplicit( drf ) );
return ConstSlice<T,DynamicRange<EC>>(mNSpace, ma.data());
return ConstSlice<T,DynamicRange>(mNSpace, ma.data());
}
template <typename T, class EC>
template <typename T>
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
-> Slice<T,DynamicRange<EC>>
-> Slice<T,DynamicRange>
{
DynamicRangeFactory<EC> drf(rptr<0>(ma)->orig());
DynamicRangeFactory drf(rptr<0>(ma)->orig());
auto mNSpace = std::make_tuple( createExplicit( drf ) );
return Slice<T,DynamicRange<EC>>(mNSpace, ma.data());
return Slice<T,DynamicRange>(mNSpace, ma.data());
}
template <typename T, class EC>
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
template <typename T>
auto dynToAnonMove(MultiArray<T,DynamicRange>&& ma)
-> MultiArray<T,AnonymousRange>
{
AnonymousRangeFactory arf(rptr<0>(ma)->orig());

View file

@ -98,36 +98,36 @@ namespace MultiArrayTools
return i->template getPtr<I>();
}
template <class EC, class MArray>
template <class MArray>
auto dynamic(const MArray& ma, bool slice = false)
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange<EC>>>;
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange>>;
template <class EC, class MArray>
template <class MArray>
auto mdynamic(MArray& ma, bool slice)
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange<EC>>>;
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange>>;
template <typename T, class EC, class Range1, class... RangeTypes>
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange<EC>>;
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange>;
template <typename T, class EC, class Range1, class... RangeTypes>
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> Slice<T,Range1,RangeTypes...,DynamicRange<EC>>;
-> Slice<T,Range1,RangeTypes...,DynamicRange>;
template <typename T, class EC, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange<EC>>&& ma)
template <typename T, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>;
template <typename T, class EC>
template <typename T>
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
-> ConstSlice<T,DynamicRange<EC>>;
-> ConstSlice<T,DynamicRange>;
template <typename T, class EC>
template <typename T>
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
-> Slice<T,DynamicRange<EC>>;
-> Slice<T,DynamicRange>;
template <typename T, class EC>
auto dynToAnonMove(MultiArray<T,DynamicRange<EC>>&& ma)
template <typename T>
auto dynToAnonMove(MultiArray<T,DynamicRange>&& ma)
-> MultiArray<T,AnonymousRange>;
template <class Range>

View file

@ -191,6 +191,13 @@ namespace MultiArrayTools
mDataPtr[last.val()] += mSec.get(last.next());
//mDataPtr[start] += mSec.template get<ExtType>(last);
}
template <typename T, class Target, class OpClass>
inline void AddExpr<T,Target,OpClass>::operator()(size_t start)
{
ExtType last;
mDataPtr[last.val()] += mSec.get(last.next());
}
template <typename T, class Target, class OpClass>
typename AddExpr<T,Target,OpClass>::ExtType AddExpr<T,Target,OpClass>::rootSteps(std::intptr_t iPtrNum) const
@ -199,6 +206,25 @@ namespace MultiArrayTools
//return mSec.rootSteps(iPtrNum);
}
template <typename T, class Target, class OpClass>
inline void AddExpr<T,Target,OpClass>::operator()(size_t mlast, DExt last)
{
(*this)(mlast, std::dynamic_pointer_cast<ExtT<ExtType>>(last)->ext());
}
template <typename T, class Target, class OpClass>
inline DExt AddExpr<T,Target,OpClass>::dRootSteps(std::intptr_t iPtrNum) const
{
return std::make_shared<ExtT<ExtType>>(rootSteps(iPtrNum));
}
template <typename T, class Target, class OpClass>
inline DExt AddExpr<T,Target,OpClass>::dExtension() const
{
CHECK;
return nullptr; //???!!!
}
/****************************
* ConstOperationRoot *
****************************/

View file

@ -139,7 +139,7 @@ namespace MultiArrayTools
//template <typename T, class OpClass>
template <typename T, class Target, class OpClass>
class AddExpr
class AddExpr : public ExpressionBase
{
private:
AddExpr() = default;
@ -165,6 +165,11 @@ namespace MultiArrayTools
inline void operator()(size_t start = 0);
inline void operator()(size_t start, ExtType last);
auto rootSteps(std::intptr_t iPtrNum = 0) const -> ExtType;
inline void operator()(size_t mlast, DExt last) override final;
inline DExt dRootSteps(std::intptr_t iPtrNum = 0) const override final;
inline DExt dExtension() const override final;
};
template <typename T, class... Ranges>

View file

@ -11,79 +11,43 @@ namespace MultiArrayTools
using namespace MultiArrayHelper;
}
/*************************
* IndexWrapperBase *
*************************/
template <class ExpressionCollection>
template <class Expr>
ExpressionHolder<Expr>
IndexWrapperBase<ExpressionCollection>::ifor(size_t step, ExpressionHolder<Expr> ex) const
template <class Index>
size_t IndexWrapper<Index>::getStepSizeComp(std::intptr_t j) const
{
return mEc->ifor(step, ex);
return MultiArrayHelper::getStepSize(*mI, j);
}
template <class ExpressionCollection>
template <class Expr>
ExpressionHolder<Expr>
IndexWrapperBase<ExpressionCollection>::iforh(size_t step, ExpressionHolder<Expr> ex) const
{
return mEc->iforh(step, ex);
}
template <class ExpressionCollection>
template <class Expr>
ExpressionHolder<Expr>
IndexWrapperBase<ExpressionCollection>::ifori(size_t step, Expr ex) const
{
return mEc->ifori(step, ex);
}
template <class ExpressionCollection>
template <class Expr>
ExpressionHolder<Expr>
IndexWrapperBase<ExpressionCollection>::iforhi(size_t step, Expr ex) const
{
return mEc->iforhi(step, ex);
}
template <class Index, class ExpressionCollection>
size_t IndexWrapper<Index,ExpressionCollection>::getStepSizeComp(std::intptr_t j) const
{
return MultiArrayHelper::getStepSize(*mI, j);
}
/****************************
* DynamicRangeFactory *
****************************/
template <class EC>
template <class... RangeTypes>
DynamicRangeFactory<EC>::DynamicRangeFactory(const std::tuple<std::shared_ptr<RangeTypes>...>& origs)
DynamicRangeFactory::DynamicRangeFactory(const std::tuple<std::shared_ptr<RangeTypes>...>& origs)
{
mProd = std::shared_ptr<oType>( new DynamicRange<EC>( origs ) );
mProd = std::shared_ptr<oType>( new DynamicRange( origs ) );
}
template <class EC>
template <class... RangeTypes>
DynamicRangeFactory<EC>::DynamicRangeFactory(std::shared_ptr<RangeTypes>... origs)
DynamicRangeFactory::DynamicRangeFactory(std::shared_ptr<RangeTypes>... origs)
{
mProd = std::shared_ptr<oType>( new DynamicRange<EC>( origs... ) );
mProd = std::shared_ptr<oType>( new DynamicRange( origs... ) );
}
template <class EC>
DynamicRangeFactory<EC>::DynamicRangeFactory(const vector<std::shared_ptr<RangeBase>>& origs)
DynamicRangeFactory::DynamicRangeFactory(const vector<std::shared_ptr<RangeBase>>& origs)
{
mProd = std::shared_ptr<oType>( new DynamicRange<EC>( origs ) );
mProd = std::shared_ptr<oType>( new DynamicRange( origs ) );
}
template <class EC>
template <class Range>
void DynamicRangeFactory<EC>::append(std::shared_ptr<Range> r)
void DynamicRangeFactory::append(std::shared_ptr<Range> r)
{
if(mProductCreated){
mProd = std::shared_ptr<oType>( new DynamicRange<EC>( *std::dynamic_pointer_cast<oType>(mProd) ) );
mProd = std::shared_ptr<oType>( new DynamicRange( *std::dynamic_pointer_cast<oType>(mProd) ) );
mProductCreated = false;
}
std::dynamic_pointer_cast<oType>(mProd)->mOrig.push_back(r);
@ -91,18 +55,18 @@ namespace MultiArrayTools
std::dynamic_pointer_cast<oType>(mProd)->mEmpty = false;
}
template <class EC>
DynamicRangeFactory<EC>::DynamicRangeFactory()
DynamicRangeFactory::DynamicRangeFactory()
{
mProd = std::shared_ptr<oType>( new DynamicRange<EC>() );
mProd = std::shared_ptr<oType>( new DynamicRange() );
}
// INSTANCIATE IF NEEDED!!
template <class EC>
std::map<std::shared_ptr<RangeBase>,vector<std::intptr_t> > DynamicRangeFactory<EC>::mAleadyCreated;
std::map<std::shared_ptr<RangeBase>,vector<std::intptr_t> > DynamicRangeFactory::mAleadyCreated;
template <class EC>
std::shared_ptr<RangeBase> DynamicRangeFactory<EC>::checkIfCreated(const vector<std::shared_ptr<RangeBase> >& pvec)
std::shared_ptr<RangeBase> DynamicRangeFactory::checkIfCreated(const vector<std::shared_ptr<RangeBase> >& pvec)
{
std::shared_ptr<RangeBase> out;
bool check = false;
@ -133,10 +97,10 @@ namespace MultiArrayTools
}
template <class EC>
std::shared_ptr<RangeBase> DynamicRangeFactory<EC>::create()
std::shared_ptr<RangeBase> DynamicRangeFactory::create()
{
mProd = checkIfCreated(std::dynamic_pointer_cast<DynamicRange<EC>>(mProd)->mOrig);
mProd = checkIfCreated(std::dynamic_pointer_cast<DynamicRange>(mProd)->mOrig);
setSelf();
mProductCreated = true;
return mProd;
@ -147,8 +111,8 @@ namespace MultiArrayTools
* DynamicIndex *
*********************/
template <class EC>
DynamicIndex<EC>::DynamicIndex(const std::shared_ptr<DynamicRange<EC> >& range) :
DynamicIndex::DynamicIndex(const std::shared_ptr<DynamicRange >& range) :
IndexInterface<DynamicIndex,MetaType>(range, 0),
mIVec(range->dim())
{
@ -160,21 +124,21 @@ namespace MultiArrayTools
mIVec[0].second = xx;
}
template <class EC>
IndexType DynamicIndex<EC>::type() const
IndexType DynamicIndex::type() const
{
return IndexType::SINGLE;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::operator=(size_t pos)
DynamicIndex& DynamicIndex::operator=(size_t pos)
{
IB::mPos = pos;
return *this;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::operator++()
DynamicIndex& DynamicIndex::operator++()
{
++IB::mPos;
if(mIvecInit){
@ -190,8 +154,8 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::operator--()
DynamicIndex& DynamicIndex::operator--()
{
--IB::mPos;
if(mIvecInit){
@ -207,8 +171,8 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::sync()
DynamicIndex& DynamicIndex::sync()
{
assert(mIvecInit);
size_t sv = 1;
@ -221,8 +185,8 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::operator()(const IVecT& ivec)
DynamicIndex& DynamicIndex::operator()(const IVecT& ivec)
{
mIvecInit = true;
mIVec = ivec;
@ -230,8 +194,8 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::operator()(const vector<std::shared_ptr<IndexW<EC>>>& ivec)
DynamicIndex& DynamicIndex::operator()(const vector<std::shared_ptr<IndexW>>& ivec)
{
mIvecInit = true;
assert(mIVec.size() == ivec.size());
@ -242,13 +206,13 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
template <class... Indices>
DynamicIndex<EC>& DynamicIndex<EC>::operator()(const std::shared_ptr<Indices>&... is)
DynamicIndex& DynamicIndex::operator()(const std::shared_ptr<Indices>&... is)
{
mIvecInit = true;
vector<std::shared_ptr<IndexW<EC>>> tmp =
{ std::make_shared<IndexWrapper<Indices,EC>>(is)... };
vector<std::shared_ptr<IndexW>> tmp =
{ std::make_shared<IndexWrapper<Indices>>(is)... };
assert(mIVec.size() == tmp.size());
for(size_t i = 0; i != mIVec.size(); ++i){
@ -258,107 +222,107 @@ namespace MultiArrayTools
return *this;
}
template <class EC>
int DynamicIndex<EC>::pp(std::intptr_t idxPtrNum)
int DynamicIndex::pp(std::intptr_t idxPtrNum)
{
++(*this);
return 1;
}
template <class EC>
int DynamicIndex<EC>::mm(std::intptr_t idxPtrNum)
int DynamicIndex::mm(std::intptr_t idxPtrNum)
{
--(*this);
return 1;
}
template <class EC>
std::string DynamicIndex<EC>::stringMeta() const
std::string DynamicIndex::stringMeta() const
{
return std::dynamic_pointer_cast<DynamicRange<EC> const>( IB::mRangePtr )->stringMeta(IB::mPos);
return std::dynamic_pointer_cast<DynamicRange const>( IB::mRangePtr )->stringMeta(IB::mPos);
}
template <class EC>
typename DynamicIndex<EC>::MetaType DynamicIndex<EC>::meta() const
typename DynamicIndex::MetaType DynamicIndex::meta() const
{
return std::dynamic_pointer_cast<DynamicRange<EC> const>( IB::mRangePtr )->get(IB::mPos);
return std::dynamic_pointer_cast<DynamicRange const>( IB::mRangePtr )->get(IB::mPos);
}
template <class EC>
const typename DynamicIndex<EC>::MetaType* DynamicIndex<EC>::metaPtr() const
const typename DynamicIndex::MetaType* DynamicIndex::metaPtr() const
{
return nullptr;
}
/*
bool DynamicIndex<EC>::isMeta(const MetaType& metaPos) const
bool DynamicIndex::isMeta(const MetaType& metaPos) const
{
return mExplicitRangePtr->isMeta(metaPos);
}*/
template <class EC>
DynamicIndex<EC>& DynamicIndex<EC>::at(const MetaType& metaPos)
DynamicIndex& DynamicIndex::at(const MetaType& metaPos)
{
(*this) = std::dynamic_pointer_cast<DynamicRange<EC> const>( IB::mRangePtr )->getMeta( metaPos );
(*this) = std::dynamic_pointer_cast<DynamicRange const>( IB::mRangePtr )->getMeta( metaPos );
return *this;
}
template <class EC>
size_t DynamicIndex<EC>::posAt(const MetaType& metaPos) const
size_t DynamicIndex::posAt(const MetaType& metaPos) const
{
return std::dynamic_pointer_cast<DynamicRange<EC> const>( IB::mRangePtr )->getMeta( metaPos );
return std::dynamic_pointer_cast<DynamicRange const>( IB::mRangePtr )->getMeta( metaPos );
}
template <class EC>
size_t DynamicIndex<EC>::dim() const // = 1
size_t DynamicIndex::dim() const // = 1
{
return mIVec.size();
}
template <class EC>
bool DynamicIndex<EC>::last() const
bool DynamicIndex::last() const
{
return IB::mPos == IB::mMax - 1;
}
template <class EC>
bool DynamicIndex<EC>::first() const
bool DynamicIndex::first() const
{
return IB::mPos == 0;
}
template <class EC>
const IndexW<EC>& DynamicIndex<EC>::get(size_t n) const
const IndexW& DynamicIndex::get(size_t n) const
{
assert(mIvecInit);
return *mIVec[n].first;
}
template <class EC>
std::shared_ptr<typename DynamicIndex<EC>::RangeType> DynamicIndex<EC>::range()
std::shared_ptr<typename DynamicIndex::RangeType> DynamicIndex::range()
{
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr );
}
template <class EC>
template <size_t N>
void DynamicIndex<EC>::getPtr() {}
template <class EC>
size_t DynamicIndex<EC>::getStepSize(size_t n) const
template <size_t N>
void DynamicIndex::getPtr() {}
size_t DynamicIndex::getStepSize(size_t n) const
{
return mIVec[n].second;
}
template <class EC>
std::string DynamicIndex<EC>::id() const
std::string DynamicIndex::id() const
{
return std::string("dyn") + std::to_string(IB::mId);
}
template <class EC>
void DynamicIndex<EC>::print(size_t offset)
void DynamicIndex::print(size_t offset)
{
if(offset == 0){
std::cout << " === " << std::endl;
@ -368,13 +332,12 @@ namespace MultiArrayTools
<< "](" << IB::mRangePtr << "): " /*<< meta().first*/ << std::endl;
}
template <class Expr>
struct ForMaker
{
template <class IVecT>
static inline auto mk(size_t i, size_t step, ExpressionHolder<Expr> ex,
static inline auto mk(size_t i, size_t step, DynamicExpression ex,
const IVecT& ivec, bool hidden = false)
-> ExpressionHolder<Expr>
-> DynamicExpression
{
if(i == 0) {
auto& ii = *ivec[0].first;
@ -393,9 +356,9 @@ namespace MultiArrayTools
};
/*
template <class EC>
template <class Expr>
inline auto DynamicIndex<EC>::mkFor(size_t i, size_t step,
inline auto DynamicIndex::mkFor(size_t i, size_t step,
ExpressionHolder<Expr> ex,
bool hidden) const
-> ExpressionHolder<Expr>
@ -410,35 +373,36 @@ namespace MultiArrayTools
}
}
*/
template <class EC>
template <class Expr>
ExpressionHolder<Expr> DynamicIndex<EC>::ifor(size_t step, Expr ex) const
ExpressionHolder<Expr> DynamicIndex::ifor(size_t step, Expr ex) const
{
if(mIVec.size() == 1){
return mIVec.back().first->ifori(step,ex);
return ExpressionHolder<Expr>(mIVec.back().first->ifor(step,ex));
}
else {
return ForMaker<Expr>::mk(mIVec.size()-2, step, mIVec.back().first->ifori(step,ex),
mIVec);
return ExpressionHolder<Expr>(ForMaker::mk(mIVec.size()-2, step,
mIVec.back().first->ifor(step,ex),mIVec));
}
}
template <class EC>
template <class Expr>
ExpressionHolder<Expr> DynamicIndex<EC>::iforh(size_t step, Expr ex) const
ExpressionHolder<Expr> DynamicIndex::iforh(size_t step, Expr ex) const
{
if(mIVec.size() == 1){
return mIVec.back().first->iforhi(step,ex);
return ExpressionHolder<Expr>(mIVec.back().first->iforh(step,ex));
}
else {
return ForMaker<Expr>::mk(mIVec.size()-2, step, mIVec.back().first->iforhi(step,ex),
mIVec, true);
return ExpressionHolder<Expr>(ForMaker::mk(mIVec.size()-2, step,
mIVec.back().first->iforh(step,ex),
mIVec, true));
}
}
template <class EC>
template <class Expr>
ExpressionHolder<Expr> DynamicIndex<EC>::pifor(size_t step, Expr ex) const
ExpressionHolder<Expr> DynamicIndex::pifor(size_t step, Expr ex) const
{
return ifor(step, ex); // no multithreading here at the moment...
}
@ -447,46 +411,46 @@ namespace MultiArrayTools
* DynamicRange *
***********************/
template <class EC>
typename DynamicRange<EC>::MetaType DynamicRange<EC>::get(size_t pos) const
typename DynamicRange::MetaType DynamicRange::get(size_t pos) const
{
vector<char> out(cmetaSize());
cmeta(out.data(),pos);
return out;
}
template <class EC>
size_t DynamicRange<EC>::getMeta(const MetaType& metaPos) const
size_t DynamicRange::getMeta(const MetaType& metaPos) const
{
return 0; // !!!
}
template <class EC>
size_t DynamicRange<EC>::size() const
size_t DynamicRange::size() const
{
return mSize;
}
template <class EC>
size_t DynamicRange<EC>::dim() const
size_t DynamicRange::dim() const
{
return mOrig.size();
}
template <class EC>
SpaceType DynamicRange<EC>::spaceType() const
SpaceType DynamicRange::spaceType() const
{
return SpaceType::DYN;
}
template <class EC>
bool DynamicRange<EC>::isEmpty() const
bool DynamicRange::isEmpty() const
{
return mEmpty;
}
template <class EC>
vector<size_t> DynamicRange<EC>::typeNum() const
vector<size_t> DynamicRange::typeNum() const
{
vector<size_t> o;
for(auto& x: mOrig){
@ -496,8 +460,8 @@ namespace MultiArrayTools
return o;
}
template <class EC>
size_t DynamicRange<EC>::cmeta(char* target, size_t pos) const
size_t DynamicRange::cmeta(char* target, size_t pos) const
{
size_t out = 0;
size_t off = cmetaSize();
@ -515,8 +479,8 @@ namespace MultiArrayTools
return out;
}
template <class EC>
size_t DynamicRange<EC>::cmetaSize() const
size_t DynamicRange::cmetaSize() const
{
size_t out = 0;
for(size_t i = mOrig.size(); i != 0; --i) {
@ -526,8 +490,8 @@ namespace MultiArrayTools
return out;
}
template <class EC>
std::string DynamicRange<EC>::stringMeta(size_t pos) const
std::string DynamicRange::stringMeta(size_t pos) const
{
std::string out = "";
//size_t xpos = pos;
@ -542,8 +506,8 @@ namespace MultiArrayTools
return out;
}
template <class EC>
vector<char> DynamicRange<EC>::data() const
vector<char> DynamicRange::data() const
{
DataHeader h = dataHeader();
vector<char> out;
@ -556,8 +520,8 @@ namespace MultiArrayTools
return out;
}
template <class EC>
DataHeader DynamicRange<EC>::dataHeader() const
DataHeader DynamicRange::dataHeader() const
{
DataHeader h;
h.spaceType = static_cast<int>( SpaceType::DYN );
@ -566,43 +530,43 @@ namespace MultiArrayTools
return h;
}
template <class EC>
typename DynamicRange<EC>::IndexType DynamicRange<EC>::begin() const
typename DynamicRange::IndexType DynamicRange::begin() const
{
DynamicIndex<EC> i
DynamicIndex i
(std::dynamic_pointer_cast<DynamicRange>
( std::shared_ptr<RangeBase>(RB::mThis) ) );
i = 0;
return i;
}
template <class EC>
typename DynamicRange<EC>::IndexType DynamicRange<EC>::end() const
typename DynamicRange::IndexType DynamicRange::end() const
{
DynamicIndex<EC> i
DynamicIndex i
(std::dynamic_pointer_cast<DynamicRange>
( std::shared_ptr<RangeBase>(RB::mThis) ) );
i = size();
return i;
}
template <class EC>
std::shared_ptr<RangeBase> DynamicRange<EC>::sub(size_t num) const
std::shared_ptr<RangeBase> DynamicRange::sub(size_t num) const
{
return mOrig.at(num);
}
template <class EC>
void DynamicRange<EC>::sreplace(const std::shared_ptr<RangeBase> in, size_t num)
void DynamicRange::sreplace(const std::shared_ptr<RangeBase> in, size_t num)
{
assert(mOrig[num]->size() == in->size());
mOrig[num] = in;
}
template <class EC>
template <class... RangeTypes>
DynamicRange<EC>::DynamicRange(const std::tuple<std::shared_ptr<RangeTypes>...>& origs) :
RangeInterface<DynamicIndex<EC>>()
DynamicRange::DynamicRange(const std::tuple<std::shared_ptr<RangeTypes>...>& origs) :
RangeInterface<DynamicIndex>()
{
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( origs, mOrig );
mSize = RPackNum<sizeof...(RangeTypes)-1>::getSize( origs );
@ -611,10 +575,10 @@ namespace MultiArrayTools
}
}
template <class EC>
template <class... RangeTypes>
DynamicRange<EC>::DynamicRange(std::shared_ptr<RangeTypes>... origs) :
RangeInterface<DynamicIndex<EC>>()
DynamicRange::DynamicRange(std::shared_ptr<RangeTypes>... origs) :
RangeInterface<DynamicIndex>()
{
auto rst = std::make_tuple(origs...);
RPackNum<sizeof...(RangeTypes)-1>::RangesToVec( rst, mOrig );
@ -624,9 +588,9 @@ namespace MultiArrayTools
}
}
template <class EC>
DynamicRange<EC>::DynamicRange(const vector<std::shared_ptr<RangeBase>>& origs) :
RangeInterface<DynamicIndex<EC>>(),
DynamicRange::DynamicRange(const vector<std::shared_ptr<RangeBase>>& origs) :
RangeInterface<DynamicIndex>(),
mOrig(origs)
{
mSize = 1;
@ -638,16 +602,16 @@ namespace MultiArrayTools
}
}
template <class EC>
template <class Range>
std::shared_ptr<Range> DynamicRange<EC>::fullsub(size_t num) const
std::shared_ptr<Range> DynamicRange::fullsub(size_t num) const
{
return std::dynamic_pointer_cast<Range>( mOrig.at(num) );
}
template <class EC>
template <class... Ranges>
std::shared_ptr<MultiRange<Ranges...> > DynamicRange<EC>::scast(SIZET<Ranges>... sizes) const
std::shared_ptr<MultiRange<Ranges...> > DynamicRange::scast(SIZET<Ranges>... sizes) const
{
std::tuple<std::shared_ptr<Ranges>...> rtp;
RPackNum<sizeof...(Ranges)-1>::resolveRangeType(mOrig, rtp, 0, sizes...);
@ -655,8 +619,8 @@ namespace MultiArrayTools
return std::dynamic_pointer_cast<MultiRange<Ranges...> >( mrf.create() );
}
template <class EC>
const vector<std::shared_ptr<RangeBase> >& DynamicRange<EC>::orig() const
const vector<std::shared_ptr<RangeBase> >& DynamicRange::orig() const
{
return mOrig;
}

View file

@ -26,7 +26,7 @@ namespace MultiArrayTools
//using MultiArrayHelper::DynamicExpression;
//using MultiArrayHelper::ExpressionHolder;
/*
class AbstractIW
{
public:
@ -36,11 +36,23 @@ namespace MultiArrayTools
AbstractIW& operator=(const AbstractIW& in) = default;
AbstractIW& operator=(AbstractIW&& in) = default;
};
*/
class IndexWrapperBase
{
public:
IndexWrapperBase() = default;
IndexWrapperBase(const IndexWrapperBase& in) = default;
IndexWrapperBase(IndexWrapperBase&& in) = default;
IndexWrapperBase& operator=(const IndexWrapperBase& in) = default;
IndexWrapperBase& operator=(IndexWrapperBase&& in) = default;
virtual IndexType type() const = 0;
virtual AbstractIW& operator=(size_t pos) = 0;
virtual AbstractIW& operator++() = 0;
virtual AbstractIW& operator--() = 0;
virtual IndexWrapperBase& operator=(size_t pos) = 0;
virtual IndexWrapperBase& operator++() = 0;
virtual IndexWrapperBase& operator--() = 0;
virtual int pp(std::intptr_t idxPtrNum) = 0;
virtual int mm(std::intptr_t idxPtrNum) = 0;
@ -61,7 +73,7 @@ namespace MultiArrayTools
virtual std::intptr_t get() const = 0;
virtual std::intptr_t ptrNum() const = 0;
virtual std::shared_ptr<AbstractIW> duplicate() const = 0;
virtual std::shared_ptr<IndexWrapperBase> duplicate() const = 0;
//virtual DynamicMetaT meta() const = 0;
//virtual const DynamicMetaT* metaPtr() const = 0;
@ -69,7 +81,7 @@ namespace MultiArrayTools
//virtual size_t posAt(const U& metaPos) const = 0;
//virtual bool isMeta(const U& metaPos) const = 0;
inline AbstractIW& at(const std::string smeta)
inline IndexWrapperBase& at(const std::string smeta)
{
for((*this) = 0; this->pos() != this->max(); ++(*this)){
if(this->stringMeta() == smeta){
@ -78,48 +90,22 @@ namespace MultiArrayTools
}
return *this;
}
};
template <class ExpressionCollection>
class IndexWrapperBase : public AbstractIW
{
protected:
std::shared_ptr<ExpressionCollection> mEc;
public:
IndexWrapperBase() = default;
IndexWrapperBase(const IndexWrapperBase& in) = default;
IndexWrapperBase(IndexWrapperBase&& in) = default;
IndexWrapperBase& operator=(const IndexWrapperBase& in) = default;
IndexWrapperBase& operator=(IndexWrapperBase&& in) = default;
using AbstractIW::operator=;
template <class Expr>
ExpressionHolder<Expr> ifor(size_t step, ExpressionHolder<Expr> ex) const;
template <class Expr>
ExpressionHolder<Expr> iforh(size_t step, ExpressionHolder<Expr> ex) const;
template <class Expr>
ExpressionHolder<Expr> ifori(size_t step, Expr ex) const;
template <class Expr>
ExpressionHolder<Expr> iforhi(size_t step, Expr ex) const;
virtual DynamicExpression ifor(size_t step, DynamicExpression ex) const = 0;
virtual DynamicExpression iforh(size_t step, DynamicExpression ex) const = 0;
/*
std::shared_ptr<IndexWrapperBase> duplicateI() const
{ return std::dynamic_pointer_cast<IndexWrapperBase>( this->duplicate() ); }
*/
};
template <class EC>
using IndexW = IndexWrapperBase<EC>;
typedef IndexWrapperBase IndexW;
template <class Index, class ExpressionCollection>
class IndexWrapper : public IndexWrapperBase<ExpressionCollection>
template <class Index>
class IndexWrapper : public IndexWrapperBase
{
public:
typedef IndexWrapperBase<ExpressionCollection> IWB;
typedef IndexWrapperBase IWB;
typedef typename Index::MetaType MetaType;
static constexpr IndexType sType() { return IndexType::SINGLE; }
@ -136,8 +122,7 @@ namespace MultiArrayTools
IndexWrapper& operator=(const IndexWrapper& in) = default;
IndexWrapper& operator=(IndexWrapper&& in) = default;
IndexWrapper(const std::shared_ptr<Index>& i) : mI(i)
{ IWB::mEc = ExpressionCollection::make(mI); }
IndexWrapper(const std::shared_ptr<Index>& i) : mI(i) {}
virtual IndexType type() const final { return mI->type(); }
@ -171,26 +156,30 @@ namespace MultiArrayTools
virtual std::intptr_t get() const override final { return reinterpret_cast<std::intptr_t>(mI.get()); }
virtual std::intptr_t ptrNum() const override final { return mI->ptrNum(); }
virtual std::shared_ptr<AbstractIW> duplicate() const override final
virtual DynamicExpression ifor(size_t step, DynamicExpression ex) const override final
{ return mI->ifor(step, ex); }
virtual DynamicExpression iforh(size_t step, DynamicExpression ex) const override final
{ return mI->iforh(step, ex); }
virtual std::shared_ptr<IndexWrapperBase> duplicate() const override final
{ return std::make_shared<IndexWrapper>( std::make_shared<Index>( *mI ) ); }
};
//typedef SingleRange<size_t,SpaceType::DYN> DynamicRange;
template <class EC>
class DynamicIndex : public IndexInterface<DynamicIndex<EC>,vector<char>>
class DynamicIndex : public IndexInterface<DynamicIndex,vector<char>>
{
private:
typedef vector<std::pair<std::shared_ptr<IndexW<EC>>,size_t>> IVecT;
typedef vector<std::pair<std::shared_ptr<IndexW>,size_t>> IVecT;
IVecT mIVec;
bool mIvecInit = false;
public:
typedef IndexInterface<DynamicIndex<EC>,vector<char>> IB;
typedef IndexInterface<DynamicIndex,vector<char>> IB;
typedef vector<char> MetaType;
typedef DynamicRange<EC> RangeType;
typedef DynamicRange RangeType;
typedef DynamicIndex IType;
DynamicIndex(const std::shared_ptr<RangeType>& range);
@ -208,12 +197,12 @@ namespace MultiArrayTools
DynamicIndex& operator--();
DynamicIndex& operator()(const IVecT& ivec);
DynamicIndex& operator()(const vector<std::shared_ptr<IndexW<EC>>>& ivec);
DynamicIndex& operator()(const vector<std::shared_ptr<IndexW>>& ivec);
template <class... Indices>
DynamicIndex& operator()(const std::shared_ptr<Indices>&... is);
DynamicIndex<EC>& sync();
DynamicIndex& sync();
int pp(std::intptr_t idxPtrNum);
int mm(std::intptr_t idxPtrNum);
@ -230,7 +219,7 @@ namespace MultiArrayTools
bool last() const;
bool first() const;
const IndexW<EC>& get(size_t n) const;
const IndexW& get(size_t n) const;
std::shared_ptr<RangeType> range();
@ -255,12 +244,11 @@ namespace MultiArrayTools
// NOT THREAD SAVE!!
template <class EC>
class DynamicRangeFactory : public RangeFactoryBase
{
public:
typedef DynamicRange<EC> oType;
typedef DynamicRange oType;
DynamicRangeFactory();
@ -286,8 +274,7 @@ namespace MultiArrayTools
bool mProductCreated = false;
};
template <class EC>
class DynamicRange : public RangeInterface<DynamicIndex<EC>>
class DynamicRange : public RangeInterface<DynamicIndex>
{
public:
static constexpr bool defaultable = true;
@ -296,10 +283,10 @@ namespace MultiArrayTools
static constexpr bool HASMETACONT = false;
typedef RangeBase RB;
typedef DynamicIndex<EC> IndexType;
typedef DynamicIndex IndexType;
typedef DynamicRange RangeType;
typedef vector<char> MetaType;
typedef DynamicRangeFactory<EC> FType;
typedef DynamicRangeFactory FType;
private:
DynamicRange() = default;
@ -351,10 +338,10 @@ namespace MultiArrayTools
bool isEmpty() const;
friend DynamicRangeFactory<EC>;
friend DynamicRangeFactory;
static DynamicRangeFactory<EC> factory()
{ return DynamicRangeFactory<EC>(); }
static DynamicRangeFactory factory()
{ return DynamicRangeFactory(); }
};
@ -365,22 +352,20 @@ namespace MultiArrayHelper
{
using namespace MultiArrayTools;
template <class EC>
inline void resolveSetRange(std::shared_ptr<DynamicRange<EC>>& rp,
inline void resolveSetRange(std::shared_ptr<DynamicRange>& rp,
const vector<std::shared_ptr<RangeBase> >& orig,
size_t origpos, size_t size)
{
DynamicRangeFactory<EC> arf;
DynamicRangeFactory arf;
for(size_t op = origpos; op != origpos + size; ++op){
//VCHECK(op);
arf.append(orig[op]);
}
rp = std::dynamic_pointer_cast<DynamicRange<EC>>( arf.create() );
rp = std::dynamic_pointer_cast<DynamicRange>( arf.create() );
}
template <class EC>
inline void setRangeToVec(vector<std::shared_ptr<RangeBase> >& v,
std::shared_ptr<DynamicRange<EC>> r)
std::shared_ptr<DynamicRange> r)
{
if(not r->isEmpty()){
for(size_t i = r->dim(); i != 0; --i){
@ -389,8 +374,7 @@ namespace MultiArrayHelper
}
}
template <class EC>
inline size_t getStepSize(const DynamicIndex<EC>& ii, std::intptr_t j)
inline size_t getStepSize(const DynamicIndex& ii, std::intptr_t j)
{
size_t ss = 0;
size_t sx = 1;

View file

@ -103,18 +103,18 @@ namespace MultiArrayTools
//class AnonymousRange;
// dynamic_range.h
class AbstractIW;
//class AbstractIW;
// dynamic_range.h
template <class EC>
//template <class EC>
class DynamicIndex;
// dynamic_range.h
template <class EC>
//template <class EC>
class DynamicRangeFactory;
// dynamic_range.h
template <class EC>
//template <class EC>
class DynamicRange;
// value_range.h

View file

@ -34,8 +34,12 @@ namespace MultiArrayHelper
virtual size_t size() const = 0;
//virtual size_t rootSteps() const = 0;
virtual std::shared_ptr<ExtBase> operator+(const ExtBase& in) const = 0;
virtual std::shared_ptr<ExtBase> operator*(size_t in) const = 0;
};
typedef std::shared_ptr<ExtBase> DExt;
template <class ExtType>
class ExtT : public ExtBase
{
@ -53,9 +57,35 @@ namespace MultiArrayHelper
virtual size_t size() const override final { return sizeof(ExtType)/sizeof(size_t); }
//virtual size_t rootSteps() const override final;
const ExtType& ext() const { return mExt; }
virtual DExt operator+(const ExtBase& in) const override final
{ return std::make_shared<ExtT>( mExt + dynamic_cast<const ExtT&>(in).mExt ); }
virtual DExt operator*(size_t in) const override final
{ return std::make_shared<ExtT>( mExt * in ); }
};
typedef std::shared_ptr<ExtBase> DExt;
class DExtT
{
private:
DExt mDExt;
public:
DExtT() = default;
DExtT(const DExtT& in) = default;
DExtT(DExtT&& in) = default;
DExtT& operator=(const DExtT& in) = default;
DExtT& operator=(DExtT&& in) = default;
DExtT(const DExt& in) : mDExt(in) {}
virtual size_t size() const { return mDExt->size(); }
inline const DExt& get() const { return mDExt; }
inline DExtT operator+(const DExtT& in) const
{ return DExtT( (*mDExt) + (*in.mDExt) ) ; }
inline DExtT operator*(size_t in) const
{ return DExtT( (*mDExt) * in ) ; }
};
inline MExt<void> mkExt(size_t s) { return MExt<void>(s); }
@ -333,6 +363,9 @@ namespace MultiArrayHelper
public:
static constexpr size_t LAYER = 0;
static constexpr size_t SIZE = 0;
DynamicExpression(const DynamicExpression& in) = default;
DynamicExpression(DynamicExpression&& in) = default;
DynamicExpression& operator=(const DynamicExpression& in) = default;
@ -342,15 +375,24 @@ namespace MultiArrayHelper
mNext(next)
{}
template <class Expr>
DynamicExpression(const ExpressionBase& next) :
mNext(std::make_shared<Expr>(next))
{}
template <class Expr>
DynamicExpression(Expr ex) : mNext( std::make_shared<Expr>(ex) ) {}
inline void operator()(size_t mlast, DExt last) override final;
inline void operator()(size_t mlast, DExtT last) { (*this)(mlast,last.get()); }
inline void operator()(size_t mlast = 0) override final;
inline DExt dRootSteps(std::intptr_t iPtrNum = 0) const override final;
inline DExt dExtension() const override final;
inline DExtT rootSteps(std::intptr_t iPtrNum = 0) const { return dRootSteps(iPtrNum); }
inline DExtT extension() const { return dExtension(); }
};

View file

@ -64,7 +64,7 @@ namespace {
return std::make_tuple(static_cast<size_t>( ts )...);
}
typedef Expressions1 EC1;
//typedef Expressions1 EC1;
template <typename T>
struct Pow
@ -736,17 +736,17 @@ namespace {
TEST_F(OpTest_MDim, ExecDOp)
{
//typedef MultiArray<double,AnonymousRange> AMA;
typedef MultiArray<double,DynamicRange<EC1> > DMA;
typedef MultiArray<double,DynamicRange> DMA;
MultiArray<double,MRange,SRange> ma1(mr1ptr,sr4ptr,v5);
MultiArray<double,SRange> ma2(sr2ptr,v1);
MultiArray<double,SRange,MRange> res(sr4ptr,mr1ptr);
MultiArray<double,MRange,SRange> res2(mr1ptr,sr4ptr);
DMA dma1 = *std::dynamic_pointer_cast<DMA>( dynamic<EC1>( ma1 ) );
DMA dma2 = *std::dynamic_pointer_cast<DMA>( dynamic<EC1>( ma2 ) );
DMA dres = *std::dynamic_pointer_cast<DMA>( dynamic<EC1>( res ) );
DMA dres2 = *std::dynamic_pointer_cast<DMA>( dynamic<EC1>( res2 ) );
DMA dma1 = *std::dynamic_pointer_cast<DMA>( dynamic( ma1 ) );
DMA dma2 = *std::dynamic_pointer_cast<DMA>( dynamic( ma2 ) );
DMA dres = *std::dynamic_pointer_cast<DMA>( dynamic( res ) );
DMA dres2 = *std::dynamic_pointer_cast<DMA>( dynamic( res2 ) );
auto si2 = MAT::getIndex( sr2ptr );
auto si3 = MAT::getIndex( sr3ptr );
@ -782,7 +782,7 @@ namespace {
EXPECT_EQ( xround( res.at( mkt('B',mkt('3','a')) ) ), xround( 13.836 + 0.373 ) );
EXPECT_EQ( xround( res.at( mkt('B',mkt('3','b')) ) ), xround( 41.339 + 0.373 ) );
//dres = *std::dynamic_pointer_cast<DMA>( dynamic<EC1>( res ) );
//dres = *std::dynamic_pointer_cast<DMA>( dynamic( res ) );
dres2(dir2) = dres(dir);
res2 = dres2.format(mr1ptr,sr4ptr);