intermediate commit

This commit is contained in:
Christian Zimmermann 2017-03-21 23:31:50 +01:00
parent 3635cf5091
commit 91417e9aa0
4 changed files with 13 additions and 13 deletions

View file

@ -660,13 +660,14 @@ namespace MultiArrayTools
MAOps2...>(op, *this, secs...);
}
/*
template <typename T, class Operation, class... MAOps>
template <class Range2, class ContractOperation>
MultiArrayContraction<T,ContractOperation,Range2,MultiArrayOperation<T,Operation,MAOps...> >
MultiArrayOperation<T,Operation,MAOps...>::
contract(const ContractOperation& cop, const std::string& indexName) const
{
#error "HERE"
typename Range2::IndexType* ind = dynamic_cast<typename Range2::IndexType*>( mIndex.getLinked(indexName) );
//typename Range2::IndexType ind = Range2().begin();
//ind.name(indexName);
@ -674,7 +675,8 @@ namespace MultiArrayTools
MultiArrayOperation<T,Operation,MAOps...> >(cop, *this, *ind);
}
/*
template <typename T, class Operation, class... MAOps>
template <class Range2, class ContractOperation>
MultiArrayContraction<T,ContractOperation,Range2,MultiArrayOperation<T,Operation,MAOps...> >

View file

@ -258,12 +258,12 @@ namespace MultiArrayTools
MultiArrayOperation<T,Operation2,MultiArrayOperation<T,Operation,MAOps...>,MAOps2...>
operator()(const Operation2& op, const MAOps2&... secs) const;
/*
template <class Range2, class ContractOperation>
MultiArrayContraction<T,ContractOperation,Range2,MultiArrayOperation<T,Operation,MAOps...> >
contract(const ContractOperation& cop, const std::string& indexName) const;
/*
template <class Range2, class ContractOperation>
MultiArrayContraction<T,ContractOperation,Range2,MultiArrayOperation<T,Operation,MAOps...> >
contract(const ContractOperation& cop, const std::string& indexName,
@ -306,7 +306,6 @@ namespace MultiArrayTools
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,
const MAOps&... mao);
MultiArrayContraction(const ContractOperation& cop,
const typename Range::IndexType& runIndex,

View file

@ -56,24 +56,24 @@ namespace MultiArrayTools
// specializations
SingleRange<int,RangeType::SPACE>::SingleRange(int begin, int end) :
SingleRange<int,RangeType::SPACE>::SingleRange(size_t ext) :
RangeBase<SingleIndex<int,RangeType::SPACE> >(),
mBegin(begin), mEnd(end) {}
mExt(ext) {}
int SingleRange<int,RangeType::SPACE>::get(size_t pos) const
{
return mBegin + pos;
return (pos <= mExt / 2) ? static_cast<int>( pos ) : static_cast<int>( pos ) - static_cast<int>( mExt );
}
size_t SingleRange<int,RangeType::SPACE>::getMeta(int metaPos) const
{
return metaPos - mBegin;
return (metaPos < 0) ? metaPos + mExt : metaPos;
}
size_t SingleRange<int,RangeType::SPACE>::size() const
{
return mEnd - mBegin;
return mExt;
}

View file

@ -96,7 +96,7 @@ namespace MultiArrayTools
DEFAULT_MEMBERS(SingleRange);
SingleRange(int begin, int end);
SingleRange(size_t ext);
virtual size_t size() const override;
@ -109,8 +109,7 @@ namespace MultiArrayTools
SingleIndex<int,RangeType::SPACE> end() const override;
protected:
int mBegin;
int mEnd;
size_t mExt;
};
template <>