op roots: index pos offset (only valid for non-looped indices)

This commit is contained in:
Christian Zimmermann 2023-03-08 02:08:30 +01:00
parent 2864c10056
commit b77955a36e

View file

@ -62,20 +62,20 @@ namespace CNORXZ
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr COpRoot<T,IndexT>::COpRoot(const CArrayBase<T>& a, const Sptr<IndexT>& ind) : constexpr COpRoot<T,IndexT>::COpRoot(const CArrayBase<T>& a, const Sptr<IndexT>& ind) :
mData(a.data()), mData(a.data()+ind->pos()),
mIndex(ind) mIndex(ind)
{} {}
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr COpRoot<T,IndexT>::COpRoot(const T* data, const Sptr<IndexT>& ind) : constexpr COpRoot<T,IndexT>::COpRoot(const T* data, const Sptr<IndexT>& ind) :
mData(data), mData(data+ind->pos()),
mIndex(ind) mIndex(ind)
{} {}
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr COpRoot<T,IndexT>& COpRoot<T,IndexT>::init(const T* data, const Sptr<IndexT>& ind) constexpr COpRoot<T,IndexT>& COpRoot<T,IndexT>::init(const T* data, const Sptr<IndexT>& ind)
{ {
mData = data; mData = data+ind->pos();
mIndex = ind; mIndex = ind;
return *this; return *this;
} }
@ -239,20 +239,20 @@ namespace CNORXZ
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr OpRoot<T,IndexT>::OpRoot(ArrayBase<T>& a, const Sptr<IndexT>& ind) : constexpr OpRoot<T,IndexT>::OpRoot(ArrayBase<T>& a, const Sptr<IndexT>& ind) :
mData(a.data()), mData(a.data()+ind->pos()),
mIndex(ind) mIndex(ind)
{} {}
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr OpRoot<T,IndexT>::OpRoot(T* data, const Sptr<IndexT>& ind) : constexpr OpRoot<T,IndexT>::OpRoot(T* data, const Sptr<IndexT>& ind) :
mData(data), mData(data+ind->pos()),
mIndex(ind) mIndex(ind)
{} {}
template <typename T, class IndexT> template <typename T, class IndexT>
constexpr OpRoot<T,IndexT>& OpRoot<T,IndexT>::init(T* data, const Sptr<IndexT>& ind) constexpr OpRoot<T,IndexT>& OpRoot<T,IndexT>::init(T* data, const Sptr<IndexT>& ind)
{ {
mData = data; mData = data+ind->pos();
mIndex = ind; mIndex = ind;
return *this; return *this;
} }