some fixes in new fma routine

This commit is contained in:
Christian Zimmermann 2018-11-26 18:23:38 +01:00
parent 8ff7b32b47
commit 354c7d92fe
5 changed files with 17 additions and 5 deletions

View file

@ -264,7 +264,7 @@ namespace MultiArrayTools
template <class Range>
MetaOperationRoot<Range>::
MetaOperationRoot(const std::shared_ptr<IndexType>& ind) :
mIndex( ind ) { }
mWorkIndex(*ind), mIndex( ind ) { }
template <class Range>
@ -275,7 +275,7 @@ namespace MultiArrayTools
//VCHECK(pos.val());
//VCHECK(mDataPtr);
//VCHECK(mDataPtr[pos.val()])
return mIndex->range()->get( pos.val() );
return (mWorkIndex = pos.val()).meta();
}
template <class Range>

View file

@ -246,6 +246,7 @@ namespace MultiArrayTools
//MultiArrayBase<T,Ranges...> const& mArrayRef;
//const T* mDataPtr;
mutable IndexType mWorkIndex;
std::shared_ptr<IndexType> mIndex;
};

View file

@ -161,6 +161,7 @@ namespace MultiArrayTools
typedef RangeBase RB;
typedef std::tuple<std::shared_ptr<Ranges>...> Space;
typedef MultiIndex<typename Ranges::IndexType...> IndexType;
typedef std::tuple<typename Ranges::IndexType::MetaType...> MetaType;
typedef MultiRange RangeType;
typedef MultiRangeFactory<Ranges...> FType;
//typedef typename RangeInterface<MultiIndex<typename Ranges::IndexType...> >::IndexType IndexType;

View file

@ -380,7 +380,7 @@ namespace MultiArrayTools
template <typename U, SpaceType TYPE>
std::shared_ptr<typename SingleIndex<U,TYPE>::RangeType> SingleIndex<U,TYPE>::range()
{
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr );
return mExplicitRangePtr;
}
template <typename U, SpaceType TYPE>

View file

@ -114,6 +114,8 @@ namespace MultiArrayTools
virtual std::string stringMeta(size_t pos) const final;
virtual std::vector<char> data() const final;
U get(size_t pos) const;
virtual IndexType begin() const final;
virtual IndexType end() const final;
@ -131,7 +133,7 @@ namespace MultiArrayTools
}
protected:
mutable U const* mMeta;
ValueRange() = default;
};
@ -256,7 +258,7 @@ namespace MultiArrayTools
template <typename U>
std::shared_ptr<typename ValueIndex<U>::RangeType> ValueIndex<U>::range()
{
return std::dynamic_pointer_cast<RangeType>( IB::mRangePtr );
return mExplicitRangePtr;
}
template <typename U>
@ -352,6 +354,12 @@ namespace MultiArrayTools
return "";
}
template <typename U>
U ValueRange<U>::get(size_t pos) const
{
return *mMeta;
}
template <typename U>
std::vector<char> ValueRange<U>::data() const
{
@ -384,6 +392,7 @@ namespace MultiArrayTools
ValueIndex<U> i( std::dynamic_pointer_cast<ValueRange<U> >
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
i = 0;
mMeta = &i.meta();
return i;
}
@ -393,6 +402,7 @@ namespace MultiArrayTools
ValueIndex<U> i( std::dynamic_pointer_cast<ValueRange<U> >
( std::shared_ptr<RangeBase>( RB::mThis ) ) );
i = size();
mMeta = &i.meta();
return i;
}