From 91417e9aa08c28fc32c8dcdbedc1b5bf73e43bcf Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Tue, 21 Mar 2017 23:31:50 +0100 Subject: [PATCH] intermediate commit --- src/multi_array_operation.cc | 6 ++++-- src/multi_array_operation.h | 5 ++--- src/single_range.cc | 10 +++++----- src/single_range.h | 5 ++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/multi_array_operation.cc b/src/multi_array_operation.cc index bf571f5..7df054c 100644 --- a/src/multi_array_operation.cc +++ b/src/multi_array_operation.cc @@ -660,13 +660,14 @@ namespace MultiArrayTools MAOps2...>(op, *this, secs...); } - /* + template template MultiArrayContraction > MultiArrayOperation:: contract(const ContractOperation& cop, const std::string& indexName) const { +#error "HERE" typename Range2::IndexType* ind = dynamic_cast( mIndex.getLinked(indexName) ); //typename Range2::IndexType ind = Range2().begin(); //ind.name(indexName); @@ -674,7 +675,8 @@ namespace MultiArrayTools MultiArrayOperation >(cop, *this, *ind); } - + + /* template template MultiArrayContraction > diff --git a/src/multi_array_operation.h b/src/multi_array_operation.h index 360fee9..be6e6c6 100644 --- a/src/multi_array_operation.h +++ b/src/multi_array_operation.h @@ -258,12 +258,12 @@ namespace MultiArrayTools MultiArrayOperation,MAOps2...> operator()(const Operation2& op, const MAOps2&... secs) const; - /* + template MultiArrayContraction > contract(const ContractOperation& cop, const std::string& indexName) const; - + /* template MultiArrayContraction > 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, diff --git a/src/single_range.cc b/src/single_range.cc index bbe203c..95c3697 100644 --- a/src/single_range.cc +++ b/src/single_range.cc @@ -56,24 +56,24 @@ namespace MultiArrayTools // specializations - SingleRange::SingleRange(int begin, int end) : + SingleRange::SingleRange(size_t ext) : RangeBase >(), - mBegin(begin), mEnd(end) {} + mExt(ext) {} int SingleRange::get(size_t pos) const { - return mBegin + pos; + return (pos <= mExt / 2) ? static_cast( pos ) : static_cast( pos ) - static_cast( mExt ); } size_t SingleRange::getMeta(int metaPos) const { - return metaPos - mBegin; + return (metaPos < 0) ? metaPos + mExt : metaPos; } size_t SingleRange::size() const { - return mEnd - mBegin; + return mExt; } diff --git a/src/single_range.h b/src/single_range.h index ab38d9e..9151dda 100644 --- a/src/single_range.h +++ b/src/single_range.h @@ -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 end() const override; protected: - int mBegin; - int mEnd; + size_t mExt; }; template <>