From 1b2e8b6832b22816832e9d118251ec40cb5ea1cb Mon Sep 17 00:00:00 2001 From: Christian Zimmermann Date: Wed, 14 Feb 2018 16:50:16 +0100 Subject: [PATCH] remove install from repo (mistake in last commit) --- .gitignore | 1 + install/include/arith.h | 46 - install/include/base_def.h | 35 - install/include/helper_tools.h | 72 -- install/include/mbase_def.h | 56 -- install/include/multi_array.h | 872 ------------------ install/include/multi_array_header.h | 60 -- install/include/multi_array_operation.h | 599 ------------ install/include/pack_num.h | 108 --- install/include/ranges/anonymous_range.h | 168 ---- install/include/ranges/container_range.h | 497 ---------- install/include/ranges/index_base.h | 157 ---- install/include/ranges/index_info.h | 103 --- install/include/ranges/index_type.h | 14 - install/include/ranges/multi_range.h | 543 ----------- install/include/ranges/range_base.h | 93 -- install/include/ranges/range_types/header.h | 23 - .../include/ranges/range_types/spin_range.h | 149 --- install/include/ranges/rbase_def.h | 80 -- install/include/ranges/rheader.h | 5 - install/include/ranges/rpack_num.h | 452 --------- install/include/ranges/single_range.h | 367 -------- install/include/ranges/vindex_base.h | 35 - install/include/ranges/vindex_wrapper.h | 43 - install/include/utils.h | 30 - install/include/xfor/exttype.h | 220 ----- install/include/xfor/for_type.h | 18 - install/include/xfor/for_utils.h | 39 - install/include/xfor/xfor.h | 172 ---- install/lib/libmultiarray.a | Bin 32044 -> 0 bytes 30 files changed, 1 insertion(+), 5056 deletions(-) delete mode 100644 install/include/arith.h delete mode 100644 install/include/base_def.h delete mode 100644 install/include/helper_tools.h delete mode 100644 install/include/mbase_def.h delete mode 100644 install/include/multi_array.h delete mode 100644 install/include/multi_array_header.h delete mode 100644 install/include/multi_array_operation.h delete mode 100644 install/include/pack_num.h delete mode 100644 install/include/ranges/anonymous_range.h delete mode 100644 install/include/ranges/container_range.h delete mode 100644 install/include/ranges/index_base.h delete mode 100644 install/include/ranges/index_info.h delete mode 100644 install/include/ranges/index_type.h delete mode 100644 install/include/ranges/multi_range.h delete mode 100644 install/include/ranges/range_base.h delete mode 100644 install/include/ranges/range_types/header.h delete mode 100644 install/include/ranges/range_types/spin_range.h delete mode 100644 install/include/ranges/rbase_def.h delete mode 100644 install/include/ranges/rheader.h delete mode 100644 install/include/ranges/rpack_num.h delete mode 100644 install/include/ranges/single_range.h delete mode 100644 install/include/ranges/vindex_base.h delete mode 100644 install/include/ranges/vindex_wrapper.h delete mode 100644 install/include/utils.h delete mode 100644 install/include/xfor/exttype.h delete mode 100644 install/include/xfor/for_type.h delete mode 100644 install/include/xfor/for_utils.h delete mode 100644 install/include/xfor/xfor.h delete mode 100644 install/lib/libmultiarray.a diff --git a/.gitignore b/.gitignore index 14a35b2..2c62f47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ */src/*~ */src/*# build/ +install/ */build/ */install/ diff --git a/install/include/arith.h b/install/include/arith.h deleted file mode 100644 index 540c071..0000000 --- a/install/include/arith.h +++ /dev/null @@ -1,46 +0,0 @@ - -#ifndef __arith_h__ -#define __arith_h__ - -namespace MultiArrayHelper -{ - // OPERATIONS (STATIC) - template - struct plus - { - static inline T apply(T a1, T a2) - { - return a1 + a2; - } - }; - - template - struct minus - { - static inline T apply(T a1, T a2) - { - return a1 - a2; - } - }; - - template - struct multiplies - { - static inline T apply(T a1, T a2) - { - return a1 * a2; - } - }; - - template - struct divides - { - static inline T apply(T a1, T a2) - { - return a1 / a2; - } - }; - -} // end namespace MultiArrayHelper - -#endif diff --git a/install/include/base_def.h b/install/include/base_def.h deleted file mode 100644 index 10f833b..0000000 --- a/install/include/base_def.h +++ /dev/null @@ -1,35 +0,0 @@ -// -*- C++ -*- - -#ifndef __base_def_h__ -#define __base_def_h__ - -#include - -#define DEBUG_MODE_X - -#ifdef DEBUG_MODE_X - -#include -#define CHECK std::cout << __FILE__ << ": @" << __LINE__ << " in " << __func__ << std::endl; -#define VCHECK(a) std::cout << __FILE__ << ": @" << __LINE__ \ - << " in " << __func__ << ": " << #a << " = " << a << std::endl; - -#else -#define CHECK -#define VCHECK(a) - -#endif - -#define DEFAULT_MEMBERS(__class_name__) __class_name__() = default; \ - __class_name__(const __class_name__& in) = default; \ - __class_name__& operator=(const __class_name__& in) = default; \ - __class_name__(__class_name__&& in) = default; \ - __class_name__& operator=(__class_name__&& in) = default - -#define DEFAULT_MEMBERS_X(__class_name__) __class_name__(const __class_name__& in) = default; \ - __class_name__& operator=(const __class_name__& in) = default; \ - __class_name__(__class_name__&& in) = default; \ - __class_name__& operator=(__class_name__&& in) = default - - -#endif diff --git a/install/include/helper_tools.h b/install/include/helper_tools.h deleted file mode 100644 index 8f53e4e..0000000 --- a/install/include/helper_tools.h +++ /dev/null @@ -1,72 +0,0 @@ - -#ifndef __helper_tools_h__ -#define __helper_tools_h__ - -#include "base_def.h" - -namespace MultiArrayTools -{ - - template - auto getIndex(std::shared_ptr range) - -> std::shared_ptr; - - // only if 'RangeType' is defaultable and unique (Singleton) - template - auto getIndex() -> std::shared_ptr; - - template - auto mkMulti(std::shared_ptr... ranges) - -> std::shared_ptr >; - - template - auto mkMIndex(std::shared_ptr... indices) - -> decltype( getIndex( mkMulti( indices.range()... ) ) ); - - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - template - auto getIndex(std::shared_ptr range) - -> std::shared_ptr - { - return std::dynamic_pointer_cast > - ( range->index() )->get(); - } - - template - auto getIndex() -> std::shared_ptr - { - static_assert( RangeType::defaultable, - /*typeid(typename RangeType).name() + */" is not defaultable" ); - static auto f = RangeType::factory(); - static auto r = std::dynamic_pointer_cast( f.create() ); - return std::dynamic_pointer_cast > - ( r->index() )->get(); - } - - template - auto mkMulti(std::shared_ptr... ranges) - -> std::shared_ptr > - { - MultiRangeFactory mrf( ranges... ); - return std::dynamic_pointer_cast >( mrf.create() ); - } - - template - auto mkMIndex(std::shared_ptr... indices) - -> decltype( getIndex( mkMulti( indices->range()... ) ) ) - { - auto mi = getIndex( mkMulti( indices->range()... ) ); - (*mi)( indices... ); - return mi; - } -} - -#endif diff --git a/install/include/mbase_def.h b/install/include/mbase_def.h deleted file mode 100644 index f3fb0bb..0000000 --- a/install/include/mbase_def.h +++ /dev/null @@ -1,56 +0,0 @@ - -#ifndef __mbase_def_h__ -#define __mbase_def_h__ - -namespace MultiArrayTools -{ - /*********************** - * Provided Types * - ***********************/ - - // multi_array.h - template - class MultiArrayBase; - - // multi_array.h - template - class MutableMultiArrayBase; - - // multi_array.h - template - class MultiArray; - - // multi_array_operation.h - template - class OperationBase; - - // multi_array_operation.h - template - class MutableOperationBase; - - // multi_array_operation.h - template - class OperationTemplate; - - // multi_array_operation.h - template - class OperationMaster; - - // multi_array_operation.h - template - class OperationRoot; - - // multi_array_operation.h - template - class ConstOperationRoot; - - // multi_array_operation.h - template - class Operation; - - // multi_array_operation.h - template - class Contraction; -} - -#endif diff --git a/install/include/multi_array.h b/install/include/multi_array.h deleted file mode 100644 index 7a2fbcf..0000000 --- a/install/include/multi_array.h +++ /dev/null @@ -1,872 +0,0 @@ -// -*- C++ -*- - -#ifndef __multi_array_h__ -#define __multi_array_h__ - -#include -#include -#include -#include -#include - -#include "base_def.h" -#include "mbase_def.h" - -#include "ranges/rheader.h" - -namespace MultiArrayTools -{ - - // Explicitely specify subranges in template argument !!! - template - class MultiArrayBase - { - public: - - typedef T value_type; - typedef ContainerRange CRange; - typedef typename CRange::IndexType IndexType; - - class const_iterator : public std::iterator - { - public: - - DEFAULT_MEMBERS(const_iterator); - - const_iterator(const MultiArrayBase& ma); - const_iterator(const MultiArrayBase& ma, const typename CRange::IndexType& index); - - // Requirements: - bool operator==(const const_iterator& it) const; - bool operator!=(const const_iterator& it) const; - - const T& operator*() const; - T const* operator->() const; - - const_iterator& operator++(); - const_iterator operator++(int); - const_iterator& operator--(); - const_iterator operator--(int); - - const_iterator& operator+=(int diff); - const_iterator& operator-=(int diff); - const_iterator operator+(int num) const; - const_iterator operator-(int num) const; - - int operator-(const const_iterator& it) const; - - const T& operator[](int num) const; - - bool operator<(const const_iterator& it) const; - bool operator>(const const_iterator& it) const; - bool operator<=(const const_iterator& it) const; - bool operator>=(const const_iterator& it) const; - - // Multi Array specific: - typename ContainerRange::IndexType index() const; - - protected: - MultiArrayBase const* mMAPtr = nullptr; - size_t mPos; - }; - - DEFAULT_MEMBERS(MultiArrayBase); - MultiArrayBase(const std::shared_ptr&... ranges); - - virtual ~MultiArrayBase() = default; - - virtual const T& operator[](const IndexType& i) const = 0; - //virtual const T& operator[](const typename CRange::IndexType& i) const = 0; - virtual const T& at(const typename CRange::IndexType::MetaType& meta) const = 0; - - virtual const T* data() const = 0; - virtual const std::vector& datav() const = 0; - - virtual size_t size() const; - virtual bool isSlice() const = 0; - - virtual const_iterator begin() const; - virtual const_iterator end() const; - - virtual IndexType beginIndex() const; - virtual IndexType endIndex() const; - - virtual const std::shared_ptr& range() const; - - virtual bool isConst() const; - - virtual ConstOperationRoot - operator()(std::shared_ptr&... inds) const; - - virtual bool isInit() const; - - protected: - bool mInit = false; - std::shared_ptr mRange; - - }; - - template - class MutableMultiArrayBase : public MultiArrayBase - { - public: - - typedef ContainerRange CRange; - typedef typename MultiArrayBase::const_iterator const_iterator; - typedef MultiArrayBase MAB; - typedef typename CRange::IndexType IndexType; - - class iterator : public std::iterator, - public std::iterator - { - public: - - DEFAULT_MEMBERS(iterator); - - iterator(MutableMultiArrayBase& ma); - iterator(MutableMultiArrayBase& ma, const IndexType& index); - - // Requirements: - bool operator==(const iterator& it) const; - bool operator!=(const iterator& it) const; - - const T& operator*() const; - T const* operator->() const; - T& operator*(); - T* operator->(); - - iterator& operator++(); - iterator operator++(int); - iterator& operator--(); - iterator operator--(int); - - iterator& operator+=(int diff); - iterator& operator-=(int diff); - iterator operator+(int num) const; - iterator operator-(int num) const; - - int operator-(const iterator& it) const; - - const T& operator[](int num) const; - T& operator[](int num); - - bool operator<(const iterator& it) const; - bool operator>(const iterator& it) const; - bool operator<=(const iterator& it) const; - bool operator>=(const iterator& it) const; - - // Multi Array specific: - typename CRange::IndexType index() const; - - protected: - MutableMultiArrayBase* mMAPtr = nullptr; - size_t mPos; - }; - - using MultiArrayBase::operator[]; - using MultiArrayBase::at; - using MultiArrayBase::data; - using MultiArrayBase::datav; - using MultiArrayBase::begin; - using MultiArrayBase::end; - - DEFAULT_MEMBERS(MutableMultiArrayBase); - MutableMultiArrayBase(const std::shared_ptr&... ranges); - - virtual T& operator[](const IndexType& i) = 0; - virtual T& at(const typename CRange::IndexType::MetaType& meta) = 0; - - virtual T* data() = 0; - virtual std::vector& datav() = 0; - - virtual iterator begin(); - virtual iterator end(); - - virtual bool isConst() const override; - - virtual ConstOperationRoot - operator()(std::shared_ptr&... inds) const override; - virtual OperationRoot operator()(std::shared_ptr&... inds); - }; - - template - class MultiArray : public MutableMultiArrayBase - { - public: - - typedef ContainerRange CRange; - typedef MultiArrayBase MAB; - typedef typename MultiArrayBase::const_iterator const_iterator; - typedef typename MutableMultiArrayBase::iterator iterator; - typedef typename CRange::IndexType IndexType; - - DEFAULT_MEMBERS(MultiArray); - MultiArray(const std::shared_ptr&... ranges); - MultiArray(const std::shared_ptr&... ranges, const std::vector& vec); - MultiArray(const std::shared_ptr&... ranges, std::vector&& vec); - - // Only if ALL ranges have default extensions: - //MultiArray(const std::vector& vec); - //MultiArray(std::vector&& vec); - - // template - // MultiArray(const MultiArray,Range3> in); - - // implement contstructor using FunctionalMultiArray as Input !!! - - //template - //MultiArray& operator=(const MultiArray,Range3> in); - - virtual T& operator[](const IndexType& i) override; - virtual const T& operator[](const IndexType& i) const override; - virtual T& at(const typename CRange::IndexType::MetaType& meta) override; - virtual const T& at(const typename CRange::IndexType::MetaType& meta) const override; - - virtual bool isConst() const override; - virtual bool isSlice() const override; - - template - MultiArray format(const std::shared_ptr&... nrs); // reformat array using 'nr' which in - // total must have the same size as mRange - - virtual const T* data() const override; - virtual T* data() override; - - virtual const std::vector& datav() const override; - virtual std::vector& datav() override; - - // virtual void manipulate(ManipulatorBase& mb, - // const typename CRange::IndexType& manBegin, - // const typename CRange::IndexType& manEnd); - - template - friend class MultiArray; - - private: - std::vector mCont; - }; - - template - class FunctionalMultiArray : public MultiArrayBase - { - public: - - typedef ContainerRange CRange; - typedef MultiArrayBase MAB; - typedef typename MultiArrayBase::const_iterator const_iterator; - typedef typename CRange::IndexType IndexType; - - DEFAULT_MEMBERS(FunctionalMultiArray); - //FunctionalMultiArray(const CRange& range); - FunctionalMultiArray(const std::shared_ptr&... ranges, const Function& func); - - virtual const T& operator[](const IndexType& i) const override; - - virtual bool isConst() const override; - virtual bool isSlice() const override; - - protected: - mutable T mVal; - Function mFunc; - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - /************************************** - * MultiArrayBase::const_iterator * - **************************************/ - - template - MultiArrayBase::const_iterator::const_iterator(const MultiArrayBase& ma): - mMAPtr(&ma), mPos(0) { } - - template - MultiArrayBase::const_iterator::const_iterator(const MultiArrayBase& ma, - const typename CRange::IndexType& index): - mMAPtr(&ma), mPos(index.pos()) { } - - template - bool MultiArrayBase::const_iterator::operator==(const const_iterator& it) const - { - return mMAPtr == it.mMAPtr and mPos == it.mPos; - } - - template - bool MultiArrayBase::const_iterator::operator!=(const const_iterator& it) const - { - return mMAPtr != it.mMAPtr or mPos != it.mPos; - } - - template - const T& MultiArrayBase::const_iterator::operator*() const - { - return mMAPtr->data()[mPos]; - } - - template - T const* MultiArrayBase::const_iterator::operator->() const - { - return &mMAPtr->data()[mPos]; - } - - template - typename MultiArrayBase::const_iterator& MultiArrayBase::const_iterator::operator++() - { - ++mPos; - return *this; - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::const_iterator::operator++(int) - { - const_iterator tmp(*this); - ++mPos; - return tmp; - } - - template - typename MultiArrayBase::const_iterator& MultiArrayBase::const_iterator::operator--() - { - --mPos; - return *this; - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::const_iterator::operator--(int) - { - const_iterator tmp(*this); - --mPos; - return tmp; - } - - template - typename MultiArrayBase::const_iterator& MultiArrayBase::const_iterator::operator+=(int diff) - { - mPos += diff; - return *this; - } - - template - typename MultiArrayBase::const_iterator& MultiArrayBase::const_iterator::operator-=(int diff) - { - mPos -= diff; - return *this; - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::const_iterator::operator+(int num) const - { - const_iterator tmp(*this); - tmp += num; - return tmp; - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::const_iterator::operator-(int num) const - { - const_iterator tmp(*this); - tmp -= num; - } - - template - int MultiArrayBase::const_iterator::operator-(const const_iterator& it) const - { - return mPos - it.mPos; - } - - template - const T& MultiArrayBase::const_iterator::operator[](int num) const - { - return *(operator+(num)); - } - - template - bool MultiArrayBase::const_iterator::operator<(const const_iterator& it) const - { - return mPos < it.mPos; - } - - template - bool MultiArrayBase::const_iterator::operator>(const const_iterator& it) const - { - return mPos > it.mPos; - } - - template - bool MultiArrayBase::const_iterator::operator<=(const const_iterator& it) const - { - return mPos <= it.mPos; - } - - template - bool MultiArrayBase::const_iterator::operator>=(const const_iterator& it) const - { - return mPos >= it.mPos; - } - - template - typename MultiArrayBase::IndexType - MultiArrayBase::const_iterator::index() const - { - auto i = mMAPtr->beginIndex(); - i = mPos; - return i; - } - - /********************** - * MultiArrayBase * - **********************/ - - template - MultiArrayBase::MultiArrayBase(const std::shared_ptr&... ranges) - { - ContainerRangeFactory crf(ranges...); - mRange = std::dynamic_pointer_cast >( crf.create() ); - } - - template - size_t MultiArrayBase::size() const - { - return mRange->size(); - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::begin() const - { - return const_iterator(*this, beginIndex()); - } - - template - typename MultiArrayBase::const_iterator MultiArrayBase::end() const - { - return const_iterator(*this, endIndex()); - } - - template - typename MultiArrayBase::IndexType - MultiArrayBase::beginIndex() const - { - return mRange->begin(); - } - - template - typename MultiArrayBase::IndexType - MultiArrayBase::endIndex() const - { - return mRange->end(); - } - - template - const std::shared_ptr::CRange>& - MultiArrayBase::range() const - { - return mRange; - } - - template - bool MultiArrayBase::isConst() const - { - return true; - } - - template - ConstOperationRoot - MultiArrayBase::operator()(std::shared_ptr&... inds) const - { - return ConstOperationRoot(*this, inds...); - } - - template - bool MultiArrayBase::isInit() const - { - return mInit; - } - - /**************************************** - * MutableMultiArrayBase::iterator * - ****************************************/ - - template - MutableMultiArrayBase::iterator::iterator(MutableMultiArrayBase& ma): - mMAPtr(&ma), mPos(0) - { } - - template - MutableMultiArrayBase::iterator::iterator(MutableMultiArrayBase& ma, - const typename CRange::IndexType& index): - mMAPtr(&ma), mPos(index.pos()) - { } - - template - bool MutableMultiArrayBase::iterator::operator==(const iterator& it) const - { - return mMAPtr == it.mMAPtr and mPos == it.mPos; - } - - template - bool MutableMultiArrayBase::iterator::operator!=(const iterator& it) const - { - return mMAPtr != it.mMAPtr or mPos != it.mPos; - } - - template - const T& MutableMultiArrayBase::iterator::operator*() const - { - return mMAPtr->data()[mPos]; - } - - template - T const* MutableMultiArrayBase::iterator::operator->() const - { - return &mMAPtr->data()[mPos]; - } - - template - T& MutableMultiArrayBase::iterator::operator*() - { - return mMAPtr->data()[mPos]; - } - - template - T* MutableMultiArrayBase::iterator::operator->() - { - return &mMAPtr->data()[mPos]; - } - - template - typename MutableMultiArrayBase::iterator& MutableMultiArrayBase::iterator::operator++() - { - ++mPos; - return *this; - } - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::iterator::operator++(int) - { - iterator tmp(*this); - ++mPos; - return tmp; - } - - template - typename MutableMultiArrayBase::iterator& MutableMultiArrayBase::iterator::operator--() - { - --mPos; - return *this; - } - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::iterator::operator--(int) - { - iterator tmp(*this); - --mPos; - return tmp; - } - - template - typename MutableMultiArrayBase::iterator& MutableMultiArrayBase::iterator::operator+=(int diff) - { - mPos += diff; - return *this; - } - - template - typename MutableMultiArrayBase::iterator& MutableMultiArrayBase::iterator::operator-=(int diff) - { - mPos -= diff; - return *this; - } - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::iterator::operator+(int num) const - { - iterator tmp(*this); - tmp += num; - return tmp; - } - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::iterator::operator-(int num) const - { - iterator tmp(*this); - tmp -= num; - } - - template - int MutableMultiArrayBase::iterator::operator-(const iterator& it) const - { - return mPos - it.mPos; - } - - template - const T& MutableMultiArrayBase::iterator::operator[](int num) const - { - return *(operator+(num)); - } - - template - T& MutableMultiArrayBase::iterator::operator[](int num) - { - return *(operator+(num)); - } - - template - bool MutableMultiArrayBase::iterator::operator<(const iterator& it) const - { - return mPos < it.mPos; - } - - template - bool MutableMultiArrayBase::iterator::operator>(const iterator& it) const - { - return mPos > it.mPos; - } - - template - bool MutableMultiArrayBase::iterator::operator<=(const iterator& it) const - { - return mPos <= it.mPos; - } - - template - bool MutableMultiArrayBase::iterator::operator>=(const iterator& it) const - { - return mPos >= it.mPos; - } - - template - typename MutableMultiArrayBase::IndexType - MutableMultiArrayBase::iterator::index() const - { - auto i = mMAPtr->beginIndex(); - i = mPos; - return i; - } - - /****************************** - * MutableMultiArrayBase * - ******************************/ - - template - MutableMultiArrayBase::MutableMultiArrayBase(const std::shared_ptr&... ranges) : - MultiArrayBase(ranges...) {} - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::begin() - { - return iterator(*this, MAB::beginIndex()); - } - - template - typename MutableMultiArrayBase::iterator MutableMultiArrayBase::end() - { - return iterator(*this, MAB::endIndex()); - } - - template - bool MutableMultiArrayBase::isConst() const - { - return false; - } - - template - OperationRoot - MutableMultiArrayBase::operator()(std::shared_ptr&... inds) - { - return OperationRoot(*this, inds...); - } - - template - ConstOperationRoot - MutableMultiArrayBase::operator()(std::shared_ptr&... inds) const - { - return ConstOperationRoot(*this, inds...); - } - - - /******************* - * MultiArray * - *******************/ - - template - MultiArray::MultiArray(const std::shared_ptr&... ranges) : - MutableMultiArrayBase(ranges...), - mCont(MAB::mRange->size()) - { - MAB::mInit = true; - } - - template - MultiArray::MultiArray(const std::shared_ptr&... ranges, const std::vector& vec) : - MutableMultiArrayBase(ranges...), - mCont(vec) - { - MAB::mInit = true; - if(mCont.size() > MAB::mRange->size()){ - mCont.erase(mCont.begin() + MAB::mRange->size(), mCont.end()); - } - } - - template - MultiArray::MultiArray(const std::shared_ptr&... ranges, std::vector&& vec) : - MutableMultiArrayBase(ranges...), - mCont(vec) - { - MAB::mInit = true; - if(mCont.size() > MAB::mRange->size()){ - mCont.erase(mCont.begin() + MAB::mRange->size(), mCont.end()); - } - } - - /* - template - template - MultiArray::MultiArray(const MultiArray,Range3> in) : - MutableMultiArrayBase(merge(in.range(), in[ in.beginIndex() ].range())) - // assert that Range2 has always same extension - { - MAB::mInit = true; - mCont.clear(); - for(auto i = in.beginIndex(); i != in.endIndex(); ++i){ - mCont.insert(mCont.end(), in[i].mCont.begin(), in[i].mCont.end()); - } - assert(mCont.size() == MAB::mRange->size()); - } - */ - /* - template - template - MultiArray& MultiArray::operator=(const MultiArray,Range3> in) - { - MAB::mRange.reset(new Range(merge(in.range(), in[ in.beginIndex() ].range()))); - // assert that Range2 has always same extension - mCont.clear(); - for(auto i = in.beginIndex(); i != in.endIndex(); ++i){ - mCont.insert(mCont.end(), in[i].mCont.begin(), in[i].mCont.end()); - } - assert(mCont.size() == MAB::mRange->size()); - return *this; - } */ - - template - T& MultiArray::operator[](const typename CRange::IndexType& i) - { - return mCont[ i.pos() ]; - } - - template - const T& MultiArray::operator[](const typename CRange::IndexType& i) const - { - return mCont[ i.pos() ]; - } - - template - T& MultiArray::at(const typename CRange::IndexType::MetaType& meta) - { - return mCont[ MAB::beginIndex().at(meta).pos() ]; - } - - template - const T& MultiArray::at(const typename CRange::IndexType::MetaType& meta) const - { - return mCont[ MAB::beginIndex().at(meta).pos() ]; - } - - template - bool MultiArray::isConst() const - { - return false; - } - - template - bool MultiArray::isSlice() const - { - return false; - } - - template - template - MultiArray MultiArray::format(const std::shared_ptr&... nrs) - { - return MultiArray( nrs... , std::move(mCont) ); - } - - template - const T* MultiArray::data() const - { - return mCont.data(); - } - - template - T* MultiArray::data() - { - return mCont.data(); - } - - template - const std::vector& MultiArray::datav() const - { - return mCont; - } - - template - std::vector& MultiArray::datav() - { - return mCont; - } - - - /* - template - void MultiArray::manipulate(ManipulatorBase& mb, - const typename Range::IndexType& manBegin, - const typename Range::IndexType& manEnd) - { - mb.setup(mCont, manBegin.pos(), manEnd.pos()); - mb.execute(); - } - */ - - - /**************************** - * FunctionalMultiArray * - ****************************/ - - /* - template - FunctionalMultiArray::FunctionalMultiArray(const Range& range) : - MultiArrayBase(range), mFunc() {} - */ - template - FunctionalMultiArray::FunctionalMultiArray(const std::shared_ptr&... ranges, - const Function& func) : - MultiArrayBase(ranges...), mFunc(func) {} - - template - const T& FunctionalMultiArray::operator[](const typename CRange::IndexType& i) const - { - mVal = mFunc(i); - return mVal; - } - - template - bool FunctionalMultiArray::isConst() const - { - return true; - } - - template - bool FunctionalMultiArray::isSlice() const - { - return false; - } - -} - -#endif diff --git a/install/include/multi_array_header.h b/install/include/multi_array_header.h deleted file mode 100644 index 9dd1e2b..0000000 --- a/install/include/multi_array_header.h +++ /dev/null @@ -1,60 +0,0 @@ -// -*- C++ -*- - -#ifndef __multi_array_header_h__ -#define __multi_array_header_h__ - -#include -//#include "base_def.h" -//#include "range_base.h" -//#include "index_base.h" -//#include "single_range.h" -//#include "multi_range.h" -//#include "container_range.h" -//#include "block.h" -#include "multi_array_operation.h" -#include "multi_array.h" -#include "helper_tools.h" -//#include "slice.h" -//#include "manipulator.h" -//#include "range_transformer.h" -//#include "ma_functional.h" - -namespace MultiArrayTools -{ - - /********************************* - * Some standard definitions * - *********************************/ - /* - // ===== Index Types ===== - - typedef SingleIndex GenericNI; - typedef SingleIndex GenericFI; - typedef SingleIndex LorentzI; - typedef SingleIndex Space1dNI; - typedef SingleIndex Mom1dNI; - typedef SingleIndex EnsI; - typedef SingleIndex, RangeType::MOMENTUM> LinMomI; - typedef SingleIndex, RangeType::MOMENTUM> LinMom4dI; - // ... - - // ===== Range Types ===== - - typedef SingleRange GenericNR; - typedef SingleRange GenericFR; - typedef SingleRange LorentzR; - typedef SingleRange Space1dNR; - typedef SingleRange DistanceNR; - typedef SingleRange Mom1dNR; - typedef SingleRange EnsR; - typedef MultiRange Space3dNR; - typedef MultiRange Mom3dNR; - typedef SingleRange ValErrR; - typedef SingleRange, RangeType::MOMENTUM> LinMomR; - typedef SingleRange, RangeType::MOMENTUM> LinMom4dR; - // ... - */ - -} - -#endif diff --git a/install/include/multi_array_operation.h b/install/include/multi_array_operation.h deleted file mode 100644 index 38bc5f3..0000000 --- a/install/include/multi_array_operation.h +++ /dev/null @@ -1,599 +0,0 @@ -// -*- C++ -*- - -#ifndef __multi_array_operation_h__ -#define __multi_array_operation_h__ - -#include -#include -#include -#include -#include - -#include "base_def.h" -#include "mbase_def.h" - -//#include "block/block.h" -//#include "operation_utils.h" -#include "ranges/rheader.h" -#include "pack_num.h" - -#include "ranges/index_info.h" -#include "arith.h" - -namespace MultiArrayTools -{ - - namespace - { - using namespace MultiArrayHelper; - } - - template - class OperationTemplate - { - public: - - OperationClass& THIS() { return static_cast(*this); } - const OperationClass& THIS() const { return static_cast(*this); } - - template - auto operator+(const Second& in) const - -> Operation,OperationClass,Second>; - - template - auto operator-(const Second& in) const - -> Operation,OperationClass,Second>; - - template - auto operator*(const Second& in) const - -> Operation,OperationClass,Second>; - - template - auto operator/(const Second& in) const - -> Operation,OperationClass,Second>; - - template - auto c(std::shared_ptr& ind) const - -> Contraction; - - private: - friend OperationClass; - OperationTemplate() = default; - }; - - template - class OperationMaster - { - public: - - class AssignmentExpr - { - private: - AssignmentExpr() = default; - - OperationMaster& mM; - const OpClass& mSec; - - public: - - static constexpr size_t LAYER = 0; - static constexpr size_t SIZE = OpClass::SIZE; - typedef decltype(mSec.rootSteps()) ExtType; - - AssignmentExpr(OperationMaster& m, const OpClass& sec); - - AssignmentExpr(const AssignmentExpr& in) = default; - AssignmentExpr(AssignmentExpr&& in) = default; - - inline void operator()(size_t start = 0) const; - inline void operator()(size_t start, ExtType last) const; - - auto rootSteps(std::intptr_t iPtrNum = 0) const -> ExtType; - - }; - - typedef T value_type; - typedef OperationBase OB; - typedef ContainerRange CRange; - typedef typename MultiRange::IndexType IndexType; - - OperationMaster(MutableMultiArrayBase& ma, const OpClass& second, - std::shared_ptr& index); - - OperationMaster(MutableMultiArrayBase& ma, const OpClass& second, - std::shared_ptr& index, - const IndexInfo* blockIndex); - - inline void set(size_t pos, T val) { mDataPtr[pos] = val; } - inline void add(size_t pos, T val) { mDataPtr[pos] += val; } - inline T get(size_t pos) const; - - private: - - std::shared_ptr mkIndex(std::shared_ptr& index); - void performAssignment(std::intptr_t blockIndexNum); - OpClass const& mSecond; - MutableMultiArrayBase& mArrayRef; - T* mDataPtr; - std::shared_ptr mIndex; - IndexInfo mIInfo; - }; - - - template - class ConstOperationRoot : /*public OperationBase,*/ - public OperationTemplate > - { - public: - - typedef T value_type; - typedef OperationBase OB; - typedef OperationTemplate > OT; - typedef ContainerRange CRange; - typedef typename CRange::IndexType IndexType; - - static constexpr size_t SIZE = 1; - - ConstOperationRoot(const MultiArrayBase& ma, - const std::shared_ptr&... indices); - - template - inline T get(ET pos) const; - - MExt rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype - - template - Expr loop(Expr exp) const; - - private: - - std::shared_ptr - mkIndex(const MultiArrayBase& ma, - const std::shared_ptr&... indices); - - MultiArrayBase const& mArrayRef; - const T* mDataPtr; - std::shared_ptr mIndex; - IndexInfo mIInfo; - }; - - template - class OperationRoot : public OperationTemplate > - { - public: - - typedef T value_type; - typedef OperationBase OB; - typedef OperationTemplate > OT; - typedef ContainerRange CRange; - typedef typename CRange::IndexType IndexType; - - static constexpr size_t SIZE = 1; - - OperationRoot(MutableMultiArrayBase& ma, - const std::shared_ptr&... indices); - - template - OperationMaster operator=(const OpClass& in); - - template - inline T get(ET pos) const; - - MExt rootSteps(std::intptr_t iPtrNum = 0) const; // nullptr for simple usage with decltype - - template - Expr loop(Expr exp) const; - - private: - - std::shared_ptr - mkIndex(const MultiArrayBase& ma, - const std::shared_ptr&... indices); - - MutableMultiArrayBase& mArrayRef; - T* mDataPtr; - std::shared_ptr mIndex; - IndexInfo mIInfo; - }; - - template - size_t sumRootNum() - { - return typename Op::rootNum(); - } - - template - size_t sumRootNum() - { - return typename Op1::rootNum() + sumRootNum(); - } - - template - struct RootSumN - { - template - struct rs - { - static constexpr size_t SIZE = Op1::SIZE + RootSumN::template rs::SIZE; - }; - }; - - template <> - struct RootSumN<0> - { - template - struct rs - { - static constexpr size_t SIZE = Op1::SIZE; - }; - }; - - - template - struct RootSum - { - static constexpr size_t SIZE = RootSumN::template rs::SIZE; - }; - - - template - class Operation : public OperationTemplate > - { - public: - - typedef T value_type; - typedef OperationBase OB; - typedef OperationTemplate > OT; - typedef OpFunction F; - - static constexpr size_t SIZE = RootSum::SIZE; - - private: - std::tuple mOps; - - public: - typedef decltype(PackNum::template mkSteps(0, mOps)) ETuple; - - Operation(const Ops&... ops); - - template - inline T get(ET pos) const; - - auto rootSteps(std::intptr_t iPtrNum = 0) const // nullptr for simple usage with decltype - -> decltype(PackNum::mkSteps(iPtrNum, mOps)); - - template - auto loop(Expr exp) const - -> decltype(PackNum::mkLoop( mOps, exp)); - - }; - - template - class Contraction : public OperationTemplate > - { - public: - - typedef T value_type; - typedef OperationTemplate > OT; - - static constexpr size_t SIZE = Op::SIZE; - - private: - - const Op& mOp; - std::shared_ptr mInd; - - public: - typedef decltype(mOp.rootSteps(0)) ETuple; - - Contraction(const Op& op, std::shared_ptr ind); - - template - inline T get(ET pos) const; - - auto rootSteps(std::intptr_t iPtrNum = 0) const // nullptr for simple usage with decltype - -> decltype(mOp.rootSteps(iPtrNum)); - - template - auto loop(Expr exp) const -> decltype(mInd->iforh(exp)); - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - namespace - { - using namespace MultiArrayHelper; - } - - /*************************** - * OperationTemplate * - ***************************/ - - template - template - auto OperationTemplate::operator+(const Second& in) const - -> Operation,OperationClass,Second> - { - return Operation,OperationClass,Second>(THIS(), in); - } - - template - template - auto OperationTemplate::operator-(const Second& in) const - -> Operation,OperationClass,Second> - { - return Operation,OperationClass,Second>(THIS(), in); - } - - template - template - auto OperationTemplate::operator*(const Second& in) const - -> Operation,OperationClass,Second> - { - return Operation,OperationClass,Second>(THIS(), in); - } - - template - template - auto OperationTemplate::operator/(const Second& in) const - -> Operation,OperationClass,Second> - { - return Operation,OperationClass,Second>(THIS(), in); - } - - template - template - auto OperationTemplate::c(std::shared_ptr& ind) const - -> Contraction - { - return Contraction(THIS(), ind); - } - - /***************************************** - * OperationMaster::AssignmentExpr * - *****************************************/ - - template - OperationMaster::AssignmentExpr:: - AssignmentExpr(OperationMaster& m, const OpClass& sec) : - mM(m), mSec(sec) {} - - template - inline void OperationMaster::AssignmentExpr:: - operator()(size_t start, ExtType last) const - { - mM.add(start, mSec.template get(last) ); - } - - template - typename OperationMaster::AssignmentExpr::ExtType - OperationMaster::AssignmentExpr:: - rootSteps(std::intptr_t iPtrNum) const - { - return mSec.rootSteps(iPtrNum); - } - - - /************************* - * OperationMaster * - *************************/ - - template - OperationMaster:: - OperationMaster(MutableMultiArrayBase& ma, const OpClass& second, - std::shared_ptr& index) : - mSecond(second), mArrayRef(ma), mDataPtr(mArrayRef.data()), - mIndex(mkIndex(index)), mIInfo(*mIndex) - { - performAssignment(0); - } - - template - OperationMaster:: - OperationMaster(MutableMultiArrayBase& ma, const OpClass& second, - std::shared_ptr& index, - const IndexInfo* blockIndex) : - mSecond(second), mArrayRef(ma), mDataPtr(mArrayRef.data()), - mIndex(mkIndex(index)), mIInfo(*mIndex) - { - performAssignment(0); - } - - template - std::shared_ptr::IndexType> - OperationMaster:: - mkIndex(std::shared_ptr& index) - { - MultiRangeFactory mrf( index->range() ); - std::shared_ptr > mr = - std::dynamic_pointer_cast >( mrf.create() ); - auto i = std::make_shared( mr->begin() ); - (*i) = *index; - return i; - } - - template - void OperationMaster::performAssignment(std::intptr_t blockIndexNum) - { - AssignmentExpr ae(*this, mSecond); // Expression to be executed within loop - const auto loop = mSecond.template loopifor(ae))>( mIndex->ifor(ae) ); - // hidden Loops outside ! -> auto vectorizable - loop(); // execute overall loop(s) and so internal hidden loops and so the inherited expressions - } - - template - inline T OperationMaster::get(size_t pos) const - { - return mDataPtr[pos]; - } - - - /**************************** - * ConstOperationRoot * - ****************************/ - - template - ConstOperationRoot:: - ConstOperationRoot(const MultiArrayBase& ma, - const std::shared_ptr&... indices) : - mArrayRef(ma), mDataPtr(mArrayRef.data()), - mIndex( mkIndex(ma,indices...) ), mIInfo(*mIndex) - {} - - template - std::shared_ptr::IndexType> - ConstOperationRoot:: - mkIndex(const MultiArrayBase& ma, - const std::shared_ptr&... indices) - { - auto i = std::make_shared( ma.range() ); - (*mIndex)(indices...); - return i; - } - - template - template - inline T ConstOperationRoot::get(ET pos) const - { - return mDataPtr[pos.val()]; - } - - template - MExt ConstOperationRoot::rootSteps(std::intptr_t iPtrNum) const - { - return MExt(getStepSize( mIndex->info(), iPtrNum )); - //return MExt(getStepSize( getRootIndices( mIndex->info() ), iPtrNum )); - } - - - template - template - Expr ConstOperationRoot::loop(Expr exp) const - { - return exp; - } - - /*********************** - * OperationRoot * - ***********************/ - - template - OperationRoot:: - OperationRoot(MutableMultiArrayBase& ma, - const std::shared_ptr&... indices) : - mArrayRef(ma), mDataPtr(mArrayRef.data()), - mIndex( mkIndex( ma, indices... ) ), mIInfo(*mIndex) - {} - - template - std::shared_ptr::IndexType> - OperationRoot:: - mkIndex(const MultiArrayBase& ma, - const std::shared_ptr&... indices) - { - auto i = std::make_shared( ma.range() ); - (*mIndex)(indices...); - return i; - } - - template - template - OperationMaster OperationRoot::operator=(const OpClass& in) - { - return OperationMaster(mArrayRef, in, mIndex); - } - - template - template - inline T OperationRoot::get(ET pos) const - { - return mDataPtr[pos.val()]; - } - - template - MExt OperationRoot::rootSteps(std::intptr_t iPtrNum) const - { - return MExt(getStepSize( mIndex->info(), iPtrNum )); - //return MExt(getStepSize( getRootIndices( mIndex->info() ), iPtrNum )); - } - - template - template - Expr OperationRoot::loop(Expr exp) const - { - return exp; - } - - /******************* - * Operation * - *******************/ - - template - Operation::Operation(const Ops&... ops) : - mOps(ops...) {} - - template - template - inline T Operation::get(ET pos) const - { - typedef std::tuple OpTuple; - return PackNum:: - template mkOpExpr(pos, mOps); - } - - template - auto Operation::rootSteps(std::intptr_t iPtrNum) const - -> decltype(PackNum::mkSteps(iPtrNum, mOps)) - { - return PackNum::mkSteps(iPtrNum, mOps); - } - - template - template - auto Operation::loop(Expr exp) const - -> decltype(PackNum::mkLoop( mOps, exp )) - { - return PackNum::mkLoop( mOps, exp ); - } - - - /********************* - * Contraction * - *********************/ - - template - Contraction::Contraction(const Op& op, std::shared_ptr ind) : - mOp(op), - mInd(ind) {} - - // forward loop !!!! - template - template - inline T Contraction::get(ET pos) const - { - return mOp.template get(pos); - } - - template - auto Contraction::rootSteps(std::intptr_t iPtrNum) const - -> decltype(mOp.rootSteps(iPtrNum)) - { - return mOp.rootSteps(iPtrNum); - } - - template - template - auto Contraction::loop(Expr exp) const -> decltype(mInd->iforh(exp)) - { - return mInd->iforh(exp); - } - -} - -#endif diff --git a/install/include/pack_num.h b/install/include/pack_num.h deleted file mode 100644 index 9631565..0000000 --- a/install/include/pack_num.h +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- - -#ifndef __pack_num_h__ -#define __pack_num_h__ - -#include -//#include -#include -#include - -#include "base_def.h" -#include "xfor/exttype.h" - -namespace MultiArrayHelper -{ - - template - struct PackNum - { - template - static void printTuple(std::ostream& out, const std::tuple& tp) - { - out << std::get(tp) << ", "; - PackNum::printTuple(out, tp); - } - - template - static auto mkSteps(std::intptr_t ii, const std::tuple& otp) - -> decltype(PackNum::mkSteps(ii, otp).extend( std::get(otp).rootSteps(ii)) ) - { - return PackNum::mkSteps(ii, otp).extend( std::get(otp).rootSteps(ii)); - } - - template - static void mkExt(std::array& out, - const std::array& siar, - const OpClass& second) - { - std::get(out) = second.rootSteps( std::get(siar) ); - PackNum::mkExt(out, siar, second); - } - - template - static inline T mkOpExpr(const ETuple& pos, const OpTuple& ops, const Args&... args) - { - typedef typename std::remove_reference(ops))>::type NextOpType; - static_assert(LAST > NextOpType::SIZE, "inconsistent array positions"); - static constexpr size_t NEXT = LAST - NextOpType::SIZE; - return PackNum::template mkOpExpr - ( pos, ops, std::get(ops).get(Getter::template getX( pos )), args...); - } - - template - static auto mkLoop( const OpTuple& ot, Expr&& exp ) - -> decltype(std::get(ot).loop( PackNum::mkLoop(ot,exp) )) - { - return std::get(ot).loop( PackNum::mkLoop(ot,exp) ); - } - }; - - template<> - struct PackNum<0> - { - template - static void printTuple(std::ostream& out, const std::tuple& tp) - { - out << std::get(tp); - } - - template - static auto mkSteps(std::intptr_t ii, const std::tuple& otp) - -> decltype(std::get<0>(otp).rootSteps(ii)) - { - return std::get<0>(otp).rootSteps(ii); - } - - template - static void mkExt(std::array& out, - const std::array& siar, - const OpClass& second) - { - std::get<0>(out) = second.rootSteps( std::get<0>(siar) ); - } - - template - static inline T mkOpExpr(const ETuple& pos, const OpTuple& ops, const Args&... args) - { - typedef typename std::remove_reference(ops))>::type NextOpType; - static constexpr size_t NEXT = LAST - NextOpType::SIZE; - static_assert(NEXT == 0, "inconsistent array positions"); - return OpFunction::apply(std::get<0>(ops).get(Getter<0>::template getX( pos )), args...); - } - - template - static auto mkLoop( const OpTuple& ot, Expr&& exp ) - -> decltype(std::get<0>(ot).loop( exp )) - { - return std::get<0>(ot).loop( exp ); - } - - - }; - - - -} // end namespace MultiArrayHelper - -#endif diff --git a/install/include/ranges/anonymous_range.h b/install/include/ranges/anonymous_range.h deleted file mode 100644 index 110a369..0000000 --- a/install/include/ranges/anonymous_range.h +++ /dev/null @@ -1,168 +0,0 @@ -// -*- C++ -*- - -#ifndef __anonymous_range_h__ -#define __anonymous_range_h__ - -#include -//#include "base_def.h" -#include "ranges/range_base.h" -#include "ranges/single_range.h" - -namespace MultiArrayTools -{ - - typedef SingleIndex AnonymousIndex; - - class AnonymousRangeFactory : public RangeFactoryBase - { - public: - - typedef AnonymousRange oType; - - AnonymousRangeFactory() = delete; - - template - AnonymousRangeFactory(const std::tuple...>& origs); - - template - AnonymousRangeFactory(std::shared_ptr... origs); - - std::shared_ptr create(); - - }; - - class AnonymousRange : public RangeInterface - { - typedef RangeBase RB; - typedef typename RangeInterface::IndexType IndexType; - - virtual size_t size() const override; - virtual size_t dim() const override; - - size_t get(size_t pos) const; - size_t getMeta(size_t metaPos) const; - - virtual IndexType begin() const override; - virtual IndexType end() const override; - virtual std::shared_ptr index() const override; - - friend AnonymousRangeFactory; - - protected: - - AnonymousRange() = delete; - AnonymousRange(const AnonymousRange& in) = delete; - - template - AnonymousRange(const std::tuple...>& origs); - - template - AnonymousRange(std::shared_ptr... origs); - - size_t mSize; - - std::vector > mOrig; - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - - /*********************** - * AnonymousRange * - ***********************/ - - template - AnonymousRangeFactory::AnonymousRangeFactory(const std::tuple...>& origs) - { - mProd = std::shared_ptr( new AnonymousRange( origs ) ); - } - - template - AnonymousRangeFactory::AnonymousRangeFactory(std::shared_ptr... origs) - { - mProd = std::shared_ptr( new AnonymousRange( origs... ) ); - } - - std::shared_ptr AnonymousRangeFactory::create() - { - setSelf(); - return mProd; - } - - /*********************** - * AnonymousRange * - ***********************/ - - template - AnonymousRange::AnonymousRange(const std::tuple...>& origs) : - RangeInterface() - { - mOrig.resize(sizeof...(RangeTypes)); - RPackNum::RangesToVec( origs, mOrig ); - RPackNum::getSize( origs ); - } - - template - AnonymousRange::AnonymousRange(std::shared_ptr... origs) : - RangeInterface() - { - auto rst = std::make_tuple(origs...); - mOrig.resize(sizeof...(RangeTypes)); - RPackNum::RangesToVec( rst, mOrig ); - RPackNum::getSize( rst ); - } - - size_t AnonymousRange::get(size_t pos) const - { - return pos; - } - - size_t AnonymousRange::getMeta(size_t metaPos) const - { - return metaPos; - } - - size_t AnonymousRange::size() const - { - return mSize; - } - - size_t AnonymousRange::dim() const - { - return 1; - } - - typename AnonymousRange::IndexType AnonymousRange::begin() const - { - AnonymousIndex i( std::dynamic_pointer_cast - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - typename AnonymousRange::IndexType AnonymousRange::end() const - { - AnonymousIndex i( std::dynamic_pointer_cast - ( std::shared_ptr( RB::mThis ) ) ); - i = size(); - return i; - } - - // put this in the interface class !!! - std::shared_ptr AnonymousRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - (std::make_shared - ( std::dynamic_pointer_cast - ( std::shared_ptr( RB::mThis ) ) ) ); - } -} - -#endif diff --git a/install/include/ranges/container_range.h b/install/include/ranges/container_range.h deleted file mode 100644 index f2f0c8c..0000000 --- a/install/include/ranges/container_range.h +++ /dev/null @@ -1,497 +0,0 @@ -// -*- C++ -*- - -#ifndef __container_range_h__ -#define __container_range_h__ - -#include -#include -#include - -//#include "base_def.h" -#include "ranges/range_base.h" -#include "ranges/index_base.h" - -#include "rpack_num.h" - -namespace MultiArrayTools -{ - - template - class ContainerIndex : public IndexInterface, - std::tuple > - { - public: - - typedef IndexInterface, - std::tuple > IB; - typedef std::tuple MetaType; - typedef std::tuple...> IndexPack; - typedef ContainerRange RangeType; - - static IndexType sType() { return IndexType::CONT; } - static size_t sDim() { return sizeof...(Indices); } - static size_t totalDim() { return mkTotalDim(); } - - private: - - bool mExternControl = false; - IndexPack mIPack; - std::array mBlockSizes; - - public: - - ContainerIndex() = delete; - - template - ContainerIndex(const std::shared_ptr& range); - - template - auto get() const -> decltype( *std::get( mIPack ) )&; - - template - auto getPtr() const -> decltype( std::get( mIPack ) )&; - - const IndexPack& pack() const { return mIPack; } - - ContainerIndex& sync(); // recalculate 'IB::mPos' when externalControl == true - ContainerIndex& operator()(const std::shared_ptr&... inds); // control via external indices - ContainerIndex& operator()(); // -> sync; just to shorten the code - - // ==== >>>>> STATIC POLYMORPHISM <<<<< ==== - - IndexType type() const; - - ContainerIndex& operator++(); - ContainerIndex& operator--(); - - ContainerIndex& operator=(size_t pos); - - int pp(std::intptr_t idxPtrNum); - int mm(std::intptr_t idxPtrNum); - - MetaType meta(); - ContainerIndex& at(const MetaType& metaPos); - - size_t dim(); - bool first(); - bool last(); - - std::shared_ptr range(); - - template - auto getPtr() -> decltype( std::get( mIPack ) )&; - - std::shared_ptr getVPtr(size_t n); - size_t getStepSize(size_t n); - - std::vector infoVec() const; - - std::string id() const; - void print(size_t offset); - - template - auto ifor(Exprs exs) const - -> decltype(RPackNum::mkFor(mIPack, exs)); - - template - auto iforh(Exprs exs) const - -> decltype(RPackNum::mkForh(mIPack, exs)); - - }; - - - template - class ContainerRangeFactory : public RangeFactoryBase - { - public: - - typedef ContainerRange oType; - - ContainerRangeFactory(); - ContainerRangeFactory(const std::shared_ptr&... rs); - ContainerRangeFactory(const typename ContainerRange::SpaceType& space); - - virtual std::shared_ptr create() override; - - protected: - - }; - - template - class ContainerRange : public RangeInterface > - { - public: - - typedef RangeBase RB; - typedef std::tuple...> SpaceType; - typedef ContainerIndex IndexType; - //typedef typename RangeInterface >::IndexType IndexType; - - protected: - ContainerRange() = default; - ContainerRange(const ContainerRange& in) = delete; - ContainerRange& operator=(const ContainerRange& in) = delete; - - ContainerRange(const std::shared_ptr&... rs); - ContainerRange(const SpaceType& space); - - SpaceType mSpace; - - public: - static const size_t sdim = sizeof...(Ranges); - - virtual size_t dim() const override; - virtual size_t size() const override; - - template - auto get() const -> decltype( *std::get( mSpace ) )&; - - template - auto getPtr() const -> decltype( std::get( mSpace ) )&; - - const SpaceType& space() const; - - virtual IndexType begin() const override; - virtual IndexType end() const override; - - virtual std::shared_ptr index() const override; - - friend ContainerRangeFactory; - - static constexpr bool defaultable = false; - static constexpr size_t ISSTATIC = SubProp::ISSTATIC; - static constexpr size_t SIZE = SubProp::SIZE; - }; - -} // end namespace MultiArrayTools - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - namespace - { - using namespace MultiArrayHelper; - } - - /********************** - * ContainerIndex * - **********************/ - - template - template - ContainerIndex::ContainerIndex(const std::shared_ptr& range) : - IndexInterface,std::tuple >(range, 0) - { - RPackNum::construct(mIPack, *range); - IB::mPos = RPackNum::makePos(mIPack); - std::get(mBlockSizes) = 1; - RPackNum::initBlockSizes(mBlockSizes, mIPack); - } - - template - ContainerIndex& ContainerIndex::sync() - { - if(mExternControl){ - IB::mPos = RPackNum::makePos(mIPack); - //VCHECK(id()); - //VCHECK(sizeof...(Indices)); - //assert(IB::mPos < IB::max()); - } - return *this; - } - - template - template - auto ContainerIndex::get() const -> decltype( *std::get( mIPack ) )& - { - return *std::get( mIPack ); - } - - template - template - auto ContainerIndex::getPtr() const -> decltype( std::get( mIPack ) )& - { - return std::get( mIPack ); - } - - template - ContainerIndex& ContainerIndex::operator()(const std::shared_ptr&... inds) - { - RPackNum::swapIndices(mIPack, inds...); - mExternControl = true; - return sync(); - } - - template - ContainerIndex& ContainerIndex::operator()() - { - return sync(); - } - - template - IndexType ContainerIndex::type() const { return IndexType::CONT; } - - template - ContainerIndex& ContainerIndex::operator++() - { - if(mExternControl){ - IB::mPos = RPackNum::makePos(mIPack); - } - RPackNum::pp( mIPack ); - ++IB::mPos; - return *this; - } - - template - ContainerIndex& ContainerIndex::operator--() - { - if(mExternControl){ - IB::mPos = RPackNum::makePos(mIPack); - } - RPackNum::mm( mIPack ); - --IB::mPos; - return *this; - - } - - template - ContainerIndex& ContainerIndex::operator=(size_t pos) - { - IB::mPos = pos; - RPackNum::setIndexPack(mIPack, pos); - return *this; - } - - template - int ContainerIndex::pp(std::intptr_t idxPtrNum) - { - int tmp = RPackNum::pp(mIPack, mBlockSizes, idxPtrNum); - IB::mPos += tmp; - return tmp; - } - - template - int ContainerIndex::mm(std::intptr_t idxPtrNum) - { - int tmp = RPackNum::mm(mIPack, mBlockSizes, idxPtrNum); - IB::mPos -= tmp; - return tmp; - } - - template - typename ContainerIndex::MetaType ContainerIndex::meta() - { - MetaType metaTuple; - RPackNum::getMetaPos(metaTuple, mIPack); - return metaTuple; - } - - template - ContainerIndex& ContainerIndex::at(const MetaType& metaPos) - { - RPackNum::setMeta(mIPack, metaPos); - IB::mPos = RPackNum::makePos(mIPack); - return *this; - } - - template - size_t ContainerIndex::dim() - { - return sizeof...(Indices); - } - - template - bool ContainerIndex::first() - { - return IB::pos() == 0; - } - - template - bool ContainerIndex::last() - { - return IB::pos() == IB::mMax - 1; - } - - template - std::shared_ptr::RangeType> - ContainerIndex::range() - { - return std::dynamic_pointer_cast( IB::mRangePtr ); - } - - template - template - auto ContainerIndex::getPtr() -> decltype( std::get( mIPack ) )& - { - return std::get( mIPack ); - } - - template - std::shared_ptr ContainerIndex::getVPtr(size_t n) - { - if(n >= sizeof...(Indices)){ - assert(0); - // throw !! - } - ContainerIndex const* t = this; - return RPackNum::getIndexPtr(*t, n); - } - - template - size_t ContainerIndex::getStepSize(size_t n) - { - if(n >= sizeof...(Indices)){ - assert(0); - // throw !! - } - return mBlockSizes[n+1]; - } - - template - std::vector ContainerIndex::infoVec() const - { - std::vector out; - out.reserve(sizeof...(Indices)); - RPackNum::buildInfoVec(out, mIPack, mBlockSizes); - return std::move( out ); - } - - template - std::string ContainerIndex::id() const - { - return std::string("con") + std::to_string(IB::mId); - } - - template - void ContainerIndex::print(size_t offset) - { - if(offset == 0){ - std::cout << " === " << std::endl; - } - for(size_t j = 0; j != offset; ++j) { std::cout << "\t"; } - std::cout << id() << "[" << reinterpret_cast(this) << "]" - << "(" << IB::mRangePtr << "): " << meta() << std::endl; - RPackNum::printIndex(mIPack, offset+1); - } - - template - template - auto ContainerIndex::ifor(Exprs exs) const - -> decltype(RPackNum::mkFor(mIPack, exs)) - { - return RPackNum::mkFor(mIPack, exs); - } - - template - template - auto ContainerIndex::iforh(Exprs exs) const - -> decltype(RPackNum::mkForh(mIPack, exs)) - { - return RPackNum::mkForh(mIPack, exs); - } - - - /***************************** - * ContainerRangeFactory * - *****************************/ - - template - ContainerRangeFactory::ContainerRangeFactory(const std::shared_ptr&... rs) - { - mProd = std::shared_ptr >( new ContainerRange( rs... ) ); - } - - template - ContainerRangeFactory:: - ContainerRangeFactory(const typename ContainerRange::SpaceType& space) - { - mProd = std::shared_ptr >( new ContainerRange( space ) ); - } - - template - std::shared_ptr ContainerRangeFactory::create() - { - setSelf(); - return mProd; - } - - /********************** - * ContainerRange * - **********************/ - - template - ContainerRange::ContainerRange(const std::shared_ptr&... rs) : - mSpace( std::make_tuple( rs... ) ) {} - - template - ContainerRange::ContainerRange(const SpaceType& space) : mSpace( space ) {} - - template - size_t ContainerRange::dim() const - { - return sizeof...(Ranges); - } - - template - size_t ContainerRange::size() const - { - return RPackNum::getSize(mSpace); - } - - template - template - auto ContainerRange::get() const -> decltype( *std::get( mSpace ) )& - { - return *std::get( mSpace ); - } - - template - template - auto ContainerRange::getPtr() const -> decltype( std::get( mSpace ) )& - { - return std::get( mSpace ); - } - - template - const typename ContainerRange::SpaceType& ContainerRange::space() const - { - return mSpace; - } - - template - typename ContainerRange::IndexType ContainerRange::begin() const - { - ContainerIndex - i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - template - typename ContainerRange::IndexType ContainerRange::end() const - { - ContainerIndex - i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = size(); - return i; - } - - template - std::shared_ptr ContainerRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - ( std::make_shared - ( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ) ); - } - -} // end namespace MultiArrayTools - - -#endif diff --git a/install/include/ranges/index_base.h b/install/include/ranges/index_base.h deleted file mode 100644 index 99b6b0f..0000000 --- a/install/include/ranges/index_base.h +++ /dev/null @@ -1,157 +0,0 @@ -// -*- C++ -*- - -#ifndef __index_base_h__ -#define __index_base_h__ - -#include -#include -#include - -#include "rbase_def.h" -#include "range_base.h" -#include "index_type.h" -#include "vindex_wrapper.h" -#include "index_info.h" - -#include "xfor/xfor.h" - -namespace MultiArrayTools -{ - - template - class IndexInterface - { - public: - //typedef typename I::RangeType RangeType; - - //DEFAULT_MEMBERS(IndexInterface); - - I& THIS() { return static_cast(*this); } - I const& THIS() const { return static_cast(*this); } - - ~IndexInterface() = default; - - IndexType type() const { return THIS().type(); } - - I& operator=(size_t pos) { return THIS() = pos; } - I& operator++() { return THIS()++; } - I& operator--() { return THIS()--;} - - int pp(std::intptr_t idxPtrNum) { return THIS().pp(idxPtrNum); } - int mm(std::intptr_t idxPtrNum) { return THIS().mm(idxPtrNum); } - - bool operator==(const IndexInterface& in) const; - bool operator!=(const IndexInterface& in) const; - - size_t dim() const { return THIS().dim(); } - size_t pos() const; - size_t max() const; - - bool last() const { return THIS().last(); } - bool first() const { return THIS().first(); } - - - std::shared_ptr vrange() const { return mRangePtr; } - /*auto range() const -> decltype( I::S_range(THIS()) ) { return I::S_range(THIS()); } - - template - auto getPtr() const -> decltype(I::template S_get(THIS())) - { return I::template S_get(THIS()); } - */ - std::shared_ptr getVPtr(size_t n) const { return THIS().getVPtr(n); } - - std::vector infoVec() const { return THIS().infoVec(); } - - size_t getStepSize(size_t n) const { return THIS().getStepSize(n); } - - operator size_t() const; - - std::string id() const { return THIS().id(); } - - MetaType meta() const { return THIS().meta(); } - I& at(const MetaType& meta) { return THIS().at(meta); } - - void print(size_t offset = 0) const { THIS().print(offset); } - - IndexInfo info() const { return IndexInfo(THIS()); } - - // CHECK / IMPLEMENT !!!!!! - template - auto ifor(const Expr ex) const -> decltype(THIS().template ifor(ex)) - { return THIS().template ifor(ex); } - - template - auto iforh(const Expr ex) const -> decltype(THIS().template iforh(ex)) - { return THIS().template iforh(ex); } - - private: - - friend I; - - IndexInterface() { mId = indexId(); } - IndexInterface(const IndexInterface& in) = default; - IndexInterface& operator=(const IndexInterface& in) = default; - IndexInterface(IndexInterface&& in) = default; - IndexInterface& operator=(IndexInterface&& in) = default; - - IndexInterface(const std::shared_ptr& range, size_t pos); - - std::shared_ptr mRangePtr; - size_t mPos; - size_t mId; - size_t mMax; - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - /********************** - * IndexInterface * - **********************/ - - template - IndexInterface::IndexInterface(const std::shared_ptr& range, - size_t pos) : mRangePtr(range), - mPos(pos), - mMax(mRangePtr->size()) - { - mId = indexId(); - } - - template - bool IndexInterface::operator==(const IndexInterface& in) const - { - return in.mPos == mPos and in.mRangePtr.get() == mRangePtr.get(); - } - - template - bool IndexInterface::operator!=(const IndexInterface& in) const - { - return in.mPos != mPos or in.mRangePtr.get() != mRangePtr.get(); - } - - template - size_t IndexInterface::pos() const - { - return mPos; - } - - template - size_t IndexInterface::max() const - { - return mMax; - } - - template - IndexInterface::operator size_t() const - { - return pos(); - } -} - -#endif diff --git a/install/include/ranges/index_info.h b/install/include/ranges/index_info.h deleted file mode 100644 index 01efba3..0000000 --- a/install/include/ranges/index_info.h +++ /dev/null @@ -1,103 +0,0 @@ -// -*- C++ -*- - -#ifndef __index_info_h__ -#define __index_info_h__ - -#include -#include -#include -#include -#include "vindex_base.h" -#include "index_type.h" - -namespace MultiArrayTools -{ - class IndexInfo; - - class IndexInfo - { - public: - - IndexInfo(IndexInfo&& in) = default; - IndexInfo& operator=(IndexInfo&& in) = default; - IndexInfo(const IndexInfo& in) = default; - IndexInfo& operator=(const IndexInfo& in) = default; - - template - IndexInfo(const IndexClass& ind, size_t stepSize = 1); - - template - IndexInfo& reassign(const IndexClass& ind, size_t stepSize = 1); - - bool operator==(const IndexInfo& in) const; - bool operator!=(const IndexInfo& in) const; - - bool operator<=(const IndexInfo& in) const; - bool operator<(const IndexInfo& in) const; - bool operator>(const IndexInfo& in) const; - bool operator>=(const IndexInfo& in) const; - - - const IndexInfo* getPtr(size_t inum) const; - std::intptr_t getPtrNum() const; - size_t dim() const; - size_t max() const; - size_t getStepSize(size_t inum) const; - size_t getStepSize() const; - IndexType type() const; - - private: - - IndexInfo() = default; - - std::vector mNext; - std::intptr_t mPtrNum; - size_t mDim; - size_t mMax; - size_t mStepSize; - IndexType mType; - }; - - template - IndexInfo::IndexInfo(const IndexClass& ind, size_t stepSize) : - mNext(ind.infoVec()), - mPtrNum( reinterpret_cast( &ind ) ), - mDim(ind.vrange()->dim()), - mMax(ind.max()), - mStepSize(stepSize), - mType(ind.type()) - {} - - template - IndexInfo& IndexInfo::reassign(const IndexClass& ind, size_t stepSize) - { - IndexInfo ii(ind, stepSize); - (*this) = std::move(ii); - return *this; - } - - std::vector getRootIndices(const IndexInfo& info); - - inline size_t getStepSize(const IndexInfo& ii, std::intptr_t j) - { - if(ii.type() == IndexType::SINGLE){ - return ii.getPtrNum() == j ? 1 : 0; - } - else { - size_t ss = 0; - size_t sx = 1; - for(size_t i = 0; i != ii.dim(); ++i){ - const IndexInfo& itmp = *ii.getPtr(ii.dim()-i-1); - const size_t max = itmp.max(); - const size_t tmp = getStepSize(itmp, j); - ss += tmp * sx; - sx *= max; - } - return ss; - } - } - - size_t getStepSize(const std::vector& iv, std::intptr_t j); -} // end namespace MultiArrayTools - -#endif diff --git a/install/include/ranges/index_type.h b/install/include/ranges/index_type.h deleted file mode 100644 index 6d8c52a..0000000 --- a/install/include/ranges/index_type.h +++ /dev/null @@ -1,14 +0,0 @@ - -#ifndef __index_type_h__ -#define __index_type_h__ - -namespace MultiArrayTools -{ - enum class IndexType{ - SINGLE = 0, - MULTI = 1, - CONT = 2 - }; -} - -#endif diff --git a/install/include/ranges/multi_range.h b/install/include/ranges/multi_range.h deleted file mode 100644 index c6d27fe..0000000 --- a/install/include/ranges/multi_range.h +++ /dev/null @@ -1,543 +0,0 @@ -// -*- C++ -*- - -#ifndef __multi_range_h__ -#define __multi_range_h__ - -#include -#include -#include - -//#include "base_def.h" -#include "ranges/range_base.h" -#include "ranges/index_base.h" - -#include "rpack_num.h" - -namespace MultiArrayTools -{ - namespace - { - using namespace MultiArrayHelper; - } - - template - class MultiIndex : public IndexInterface, - std::tuple > - { - public: - - typedef IndexInterface, - std::tuple > IB; - typedef std::tuple...> IndexPack; - typedef std::tuple MetaType; - typedef MultiRange RangeType; - - static IndexType sType() { return IndexType::MULTI; } - static size_t sDim() { return sizeof...(Indices); } - static size_t totalDim() { return mkTotalDim(); } - - private: - - IndexPack mIPack; - std::array mBlockSizes; - - public: - - const IndexPack& pack() const { return mIPack; } - - MultiIndex() = delete; - - // NO DEFAULT HERE !!! - // ( have to assign sub-indices (ptr!) correctly ) - //MultiIndex(const MultiIndex& in); - //MultiIndex& operator=(const MultiIndex& in); - MultiIndex& operator=(ContainerIndex& ci); - - template - MultiIndex(const std::shared_ptr& range); - - template - MultiIndex& up(); - - template - MultiIndex& down(); - - template - auto get() const -> decltype( *std::get( mIPack ) )&; - - template - auto getPtr() const -> decltype( std::get( mIPack ) )&; - - // raplace instances (in contrast to its analogon in ContainerIndex - // MultiIndices CANNOT be influences be its subindices, so there is - // NO foreign/external controll) - // Do NOT share index instances between two or more MultiIndex instances - MultiIndex& operator()(std::shared_ptr&... indices); - - // ==== >>>>> STATIC POLYMORPHISM <<<<< ==== - - IndexType type() const; - - MultiIndex& operator=(size_t pos); - - MultiIndex& operator++(); - MultiIndex& operator--(); - - int pp(std::intptr_t idxPtrNum); - int mm(std::intptr_t idxPtrNum); - - MetaType meta(); - MultiIndex& at(const MetaType& metaPos); - - size_t dim(); - bool first(); - bool last(); - std::shared_ptr range(); - - template - auto getPtr() -> decltype( std::get( mIPack ) )&; - - std::shared_ptr getVPtr(size_t n); - size_t getStepSize(size_t n); - - std::vector infoVec() const; - - std::string id() const; - void print(size_t offset); - - template - auto ifor(Exprs exs) const - -> decltype(RPackNum::mkFor(mIPack, exs)); - - template - auto iforh(Exprs exs) const - -> decltype(RPackNum::mkForh(mIPack, exs)); - - }; - - /************************* - * MultiRangeFactory * - *************************/ - - template - class MultiRangeFactory : public RangeFactoryBase - { - public: - typedef MultiRange oType; - - MultiRangeFactory() = delete; - MultiRangeFactory(const std::shared_ptr&... rs); - MultiRangeFactory(const typename MultiRange::SpaceType& space); - MultiRangeFactory(const std::shared_ptr >& cr); - - virtual std::shared_ptr create() override; - }; - - /****************** - * MultiRange * - ******************/ - - template - class MultiRange : public RangeInterface > - { - public: - typedef RangeBase RB; - typedef std::tuple...> SpaceType; - typedef MultiIndex IndexType; - //typedef typename RangeInterface >::IndexType IndexType; - - protected: - MultiRange() = delete; - MultiRange(const MultiRange& in) = delete; - MultiRange& operator=(const MultiRange& in) = delete; - - MultiRange(const std::shared_ptr&... rs); - MultiRange(const SpaceType& space); - - SpaceType mSpace; - - public: - - static const size_t sdim = sizeof...(Ranges); - - template - auto get() const -> decltype( *std::get( mSpace ) )&; - - template - auto getPtr() const -> decltype( std::get( mSpace ) )&; - - virtual size_t dim() const override; - virtual size_t size() const override; - - const SpaceType& space() const; - - virtual IndexType begin() const override; - virtual IndexType end() const override; - - virtual std::shared_ptr index() const override; - - friend MultiRangeFactory; - - static constexpr bool defaultable = false; - static constexpr size_t ISSTATIC = SubProp::ISSTATIC; - static constexpr size_t SIZE = SubProp::SIZE; - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - - namespace - { - using namespace MultiArrayHelper; - } - - /****************** - * MultiIndex * - ******************/ - - /* - template - MultiIndex::MultiIndex(const MultiIndex& in) : - IndexInterface >(in) - { - RPackNum::copy(mIPack, in); - IB::mPos = RPackNum::makePos(mIPack); - } - - template - MultiIndex& MultiIndex::operator=(const MultiIndex& in) - { - IndexI::operator=(in); - RPackNum::copy(mIPack, in); - IB::mPos = RPackNum::makePos(mIPack); - return *this; - } - */ - template - MultiIndex& MultiIndex::operator=(ContainerIndex& ci) - { - RPackNum::copyInst(mIPack, ci); - IB::mPos = RPackNum::makePos(mIPack); - return *this; - } - - template - template - MultiIndex::MultiIndex(const std::shared_ptr& range) : - IndexInterface,std::tuple >(range, 0) - { - RPackNum::construct(mIPack, *range); - IB::mPos = RPackNum::makePos(mIPack); - std::get(mBlockSizes) = 1; - RPackNum::initBlockSizes(mBlockSizes, mIPack); // has one more element! - } - - template - template - MultiIndex& MultiIndex::up() - { - static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices"); - IB::mPos += RPackNum::blockSize( mIPack ); - RPackNum::pp( mIPack ); - return *this; - } - - template - template - MultiIndex& MultiIndex::down() - { - static_assert(DIR < sizeof...(Indices), "DIR exceeds number of sub-indices"); - IB::mPos -= RPackNum::blockSize( mIPack ); - RPackNum::mm( mIPack ); - return *this; - } - - template - template - auto MultiIndex::get() const -> decltype( *std::get( mIPack ) )& - { - return *std::get(mIPack); - } - - template - template - auto MultiIndex::getPtr() const -> decltype( std::get( mIPack ) )& - { - return std::get(mIPack); - } - - template - MultiIndex& MultiIndex::operator()(std::shared_ptr&... indices) - { - RPackNum::swapIndices(mIPack, indices...); - RPackNum::setIndexPack(mIPack, IB::mPos); - return *this; - } - - template - IndexType MultiIndex::type() const - { - return IndexType::MULTI; - } - - template - MultiIndex& MultiIndex::operator=(size_t pos) - { - IB::mPos = pos; - RPackNum::setIndexPack(mIPack, pos); - return *this; - } - - template - MultiIndex& MultiIndex::operator++() - { - RPackNum::pp( mIPack ); - ++IB::mPos; - return *this; - } - - template - MultiIndex& MultiIndex::operator--() - { - RPackNum::mm( mIPack ); - --IB::mPos; - return *this; - } - - template - int MultiIndex::pp(std::intptr_t idxPtrNum) - { - int tmp = RPackNum::pp(mIPack, mBlockSizes, idxPtrNum); - IB::mPos += tmp; - return tmp; - } - - template - int MultiIndex::mm(std::intptr_t idxPtrNum) - { - int tmp = RPackNum::mm(mIPack, mBlockSizes, idxPtrNum); - IB::mPos -= tmp; - return tmp; - } - - template - typename MultiIndex::MetaType MultiIndex::meta() - { - MetaType metaTuple; - RPackNum::getMetaPos(metaTuple, mIPack); - return metaTuple; - } - - template - MultiIndex& MultiIndex::at(const MetaType& metaPos) - { - RPackNum::setMeta(mIPack, metaPos); - IB::mPos = RPackNum::makePos(mIPack); - return *this; - } - - template - size_t MultiIndex::dim() - { - return sizeof...(Indices); - } - - template - bool MultiIndex::first() - { - return IB::mPos == 0; - } - - template - bool MultiIndex::last() - { - return IB::mPos == IB::mMax - 1; - } - - template - std::shared_ptr::RangeType> - MultiIndex::range() - { - return std::dynamic_pointer_cast( IB::mRangePtr ); - } - - template - template - auto MultiIndex::getPtr() -> decltype( std::get( mIPack ) )& - { - return std::get(mIPack); - } - - template - std::shared_ptr MultiIndex::getVPtr(size_t n) - { - if(n >= sizeof...(Indices)){ - assert(0); - // throw !! - } - MultiIndex const* t = this; - return RPackNum::getIndexPtr(*t, n); - } - - template - size_t MultiIndex::getStepSize(size_t n) - { - if(n >= sizeof...(Indices)){ - assert(0); - // throw !! - } - return mBlockSizes[n+1]; - } - - template - std::vector MultiIndex::infoVec() const - { - std::vector out; - out.reserve(sizeof...(Indices)); - RPackNum::buildInfoVec(out, mIPack, mBlockSizes); - return std::move( out ); - } - - template - std::string MultiIndex::id() const - { - return std::string("mul") + std::to_string(IB::mId); - } - - template - void MultiIndex::print(size_t offset) - { - if(offset == 0){ - std::cout << " === " << std::endl; - } - for(size_t j = 0; j != offset; ++j) { std::cout << "\t"; } - std::cout << id() << "[" << reinterpret_cast(this) - << "]" << "(" << IB::mRangePtr << "): " << meta() << std::endl; - RPackNum::printIndex(mIPack, offset+1); - } - - template - template - auto MultiIndex::ifor(Exprs exs) const - -> decltype(RPackNum::mkFor(mIPack, exs)) - { - return RPackNum::mkFor(mIPack, exs); - } - - template - template - auto MultiIndex::iforh(Exprs exs) const - -> decltype(RPackNum::mkForh(mIPack, exs)) - { - return RPackNum::mkForh(mIPack, exs); - } - - /************************* - * MultiRangeFactory * - *************************/ - - template - MultiRangeFactory::MultiRangeFactory(const std::shared_ptr&... rs) - { - mProd = std::shared_ptr< MultiRange >( new MultiRange( rs... ) ); - } - - template - MultiRangeFactory::MultiRangeFactory(const typename MultiRange::SpaceType& st) - { - mProd = std::shared_ptr< MultiRange >( new MultiRange( st ) ); - } - - template - MultiRangeFactory::MultiRangeFactory(const std::shared_ptr >& cr) - { - mProd = std::shared_ptr< MultiRange >( new MultiRange( cr->space() ) ); - } - - template - std::shared_ptr MultiRangeFactory::create() - { - setSelf(); - return mProd; - } - - /****************** - * MultiRange * - ******************/ - - template - MultiRange::MultiRange(const std::shared_ptr&... rs) : mSpace(std::make_tuple(rs...)) {} - - template - MultiRange::MultiRange(const SpaceType& space) : mSpace( space ) {} - - template - template - auto MultiRange::get() const -> decltype( *std::get( mSpace ) )& - { - return *std::get(mSpace); - } - - template - template - auto MultiRange::getPtr() const -> decltype( std::get( mSpace ) )& - { - return std::get(mSpace); - } - - template - size_t MultiRange::dim() const - { - return sdim; - } - - template - size_t MultiRange::size() const - { - return RPackNum::getSize(mSpace); - } - - template - const typename MultiRange::SpaceType& MultiRange::space() const - { - return mSpace; - } - - template - typename MultiRange::IndexType MultiRange::begin() const - { - MultiIndex - i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - template - typename MultiRange::IndexType MultiRange::end() const - { - MultiIndex - i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis )) ); - i = size(); - return i; - } - - template - std::shared_ptr MultiRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - ( std::make_shared - ( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ) ); - } -} - -#endif diff --git a/install/include/ranges/range_base.h b/install/include/ranges/range_base.h deleted file mode 100644 index a0f38c4..0000000 --- a/install/include/ranges/range_base.h +++ /dev/null @@ -1,93 +0,0 @@ -// -*- C++ -*- - -#ifndef __range_base_h__ -#define __range_base_h__ - -#include -#include -#include - -#include "base_def.h" - -namespace MultiArrayTools -{ - class RangeBase; -} -#include "vindex_base.h" - -namespace MultiArrayTools -{ - - size_t indexId(); - - enum class SpaceType - { - NONE = 0, - ANY = 1, -#define include_range_type(x,n) x = n, -#include "range_types/header.h" -#undef include_range_type - }; - - class RangeFactoryBase - { - public: - - RangeFactoryBase() = default; - virtual ~RangeFactoryBase() = default; - - // should return mProd !! - virtual std::shared_ptr create() = 0; - - protected: - - std::shared_ptr mProd; - - // call this function before returning product !! - void setSelf(); - }; - - class RangeBase - { - public: - - virtual ~RangeBase() = default; - - virtual size_t size() const = 0; - virtual size_t dim() const = 0; - - virtual std::shared_ptr index() const = 0; - - bool operator==(const RangeBase& in) const; - bool operator!=(const RangeBase& in) const; - - //virtual bool regular() const = 0; // integer distance (e.g. 2,3,4,...) - //virtual bool linear() const = 0; // 1dim valuable (e.g. 2.45, 3.12, 3.56,...) - //virtual bool multi() const = 0; // mdim - //virtual bool maplike() const = 0; // meta type is ~ MultiArray - - friend RangeFactoryBase; - - protected: - - RangeBase() = default; - std::weak_ptr mThis; - }; - - template - class RangeInterface : public RangeBase - { - public: - - typedef Index IndexType; - - virtual Index begin() const = 0; - virtual Index end() const = 0; - - protected: - RangeInterface() = default; - }; - -} - -#endif diff --git a/install/include/ranges/range_types/header.h b/install/include/ranges/range_types/header.h deleted file mode 100644 index 0632275..0000000 --- a/install/include/ranges/range_types/header.h +++ /dev/null @@ -1,23 +0,0 @@ - -#ifdef include_range_type -#define __incl_this__ -#endif -#ifdef __single_range_h__ -// singel_range is template which is specialized here -// therefore it must be defined before... -#define __incl_this__ -#endif - -#ifdef __incl_this__ - -#define __ranges_header__ -//#ifndef __ranges_header__ -//#define __ranges_header__ - -#include "spin_range.h" - -#undef __ranges_header__ -//#endif -#endif - -#undef __incl_this__ diff --git a/install/include/ranges/range_types/spin_range.h b/install/include/ranges/range_types/spin_range.h deleted file mode 100644 index 77be683..0000000 --- a/install/include/ranges/range_types/spin_range.h +++ /dev/null @@ -1,149 +0,0 @@ - - -#ifdef include_range_type -include_range_type(SPIN,2) -#else - -#ifdef __ranges_header__ -// assert, that this is only used within range_types/header.h - -//#ifndef __spin_range_h__ -//#define __spin_range_h__ - -namespace MultiArrayTools -{ - typedef SingleIndex SpinIndex; - - template <> - class SingleRangeFactory : public RangeFactoryBase - { - public: - - typedef SingleRange oType; - - SingleRangeFactory(); - std::shared_ptr create(); - - }; - - template <> - class SingleRange : public RangeInterface - { - public: - typedef RangeBase RB; - typedef typename RangeInterface >::IndexType IndexType; - - virtual size_t size() const override; - virtual size_t dim() const override; - - size_t get(size_t pos) const; - size_t getMeta(size_t metaPos) const; - - virtual IndexType begin() const override; - virtual IndexType end() const override; - virtual std::shared_ptr index() const override; - - friend SingleRangeFactory; - - static constexpr bool defaultable = true; - static constexpr size_t mSpinNum = 4; - - static constexpr size_t ISSTATIC = 1; - static constexpr size_t SIZE = mSpinNum; - - static SingleRangeFactory factory() - { return SingleRangeFactory(); } - - protected: - - SingleRange() = default; - SingleRange(const SingleRange& in) = delete; - - //SingleRange(size_t spinNum); - }; - - typedef SingleRange SpinRange; - typedef SingleRangeFactory SpinRF; -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - /******************** - * SingleRange * - ********************/ - - SingleRangeFactory::SingleRangeFactory() - { - // Quasi Singleton - if(not mProd){ - mProd = std::shared_ptr( new SingleRange() ); - setSelf(); - } - } - - std::shared_ptr SingleRangeFactory::create() - { - return mProd; - } - - /******************** - * SingleRange * - ********************/ - - size_t SingleRange::get(size_t pos) const - { - return pos; - } - - size_t SingleRange::getMeta(size_t metaPos) const - { - return metaPos; - } - - size_t SingleRange::size() const - { - return mSpinNum; - } - - size_t SingleRange::dim() const - { - return 1; - } - - typename SingleRange::IndexType SingleRange::begin() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - typename SingleRange::IndexType SingleRange::end() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = size(); - return i; - } - - // put this in the interface class !!! - std::shared_ptr SingleRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - ( std::make_shared - ( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ) ); - } - -} - -//#endif // #ifndef __spin_range_h__ - -#endif // #ifdef __ranges_header__ - -#endif // #ifdef include_range_type diff --git a/install/include/ranges/rbase_def.h b/install/include/ranges/rbase_def.h deleted file mode 100644 index 5521720..0000000 --- a/install/include/ranges/rbase_def.h +++ /dev/null @@ -1,80 +0,0 @@ -// -*- C++ -*- - -#ifndef __ranges_base_def_h__ -#define __ranges_base_def_h__ - -namespace MultiArrayTools -{ - /*********************** - * Provided Types * - ***********************/ - - // range_base.h - enum class SpaceType; - - // range_base.h - class RangeFactoryBase; - - // range_base.h - class RangeBase; - - // range_base.h - template - class RangeInterface; - - // index_base.h - class VirtualIndexWrapperBase; - typedef VirtualIndexWrapperBase VIWB; - - // index_base.h - template - class IndexWrapper; - - // index_base.h - template - class IndexInterface; - - // single_range.h - template - class SingleRange; - - // single_range.h - template - class SingleRangeFactory; - - // single_range.h - template - class SingleIndex; - - // multi_range.h - template - class MultiRangeFactory; - - // multi_range.h - template - class MultiRange; - - // multi_range.h - template - class MultiIndex; - - // container_range.h - template - class ContainerRangeFactory; - - // container_range.h - template - class ContainerRange; - - // container_range.h - template - class ContainerIndex; - - // anonymous_range.h - class AnonymousRangeFactory; - - // anonymous_range.h - class AnonymousRange; -} - -#endif diff --git a/install/include/ranges/rheader.h b/install/include/ranges/rheader.h deleted file mode 100644 index cc0795f..0000000 --- a/install/include/ranges/rheader.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include "single_range.h" -#include "multi_range.h" -#include "container_range.h" -//#include "anonymous_range.h" have to fix bug !! diff --git a/install/include/ranges/rpack_num.h b/install/include/ranges/rpack_num.h deleted file mode 100644 index e41f3b3..0000000 --- a/install/include/ranges/rpack_num.h +++ /dev/null @@ -1,452 +0,0 @@ - -#ifndef __rpack_num_h__ -#define __rpack_num_h__ - -#include -#include "vindex_wrapper.h" -#include "index_info.h" - -namespace MultiArrayHelper -{ - using namespace MultiArrayTools; - - - template - size_t mkTotalDim() - { - return Index1::totalDim(); - } - - template - size_t mkTotalDim() - { - return Index1::totalDim() * mkTotalDim(); - } - - - template - struct SubProp - { - static constexpr size_t ISSTATIC = RangeType::ISSTATIC & SubProp::ISSTATIC; - static constexpr size_t SIZE = RangeType::SIZE * SubProp::SIZE; - }; - - template <> - struct SubProp - { - static constexpr size_t ISSTATIC = 1; - static constexpr size_t SIZE = 1; - }; - - template - struct RPackNum - { - template - static std::shared_ptr getIndex(const IndexType& in, size_t n) - { - if(n == N){ - return make_viwb( in.template get() ); - } - else { - return RPackNum::getIndex(in, n); - } - } - - template - static std::shared_ptr getIndexPtr(const IndexType& in, size_t n) - { - if(n == N){ - return make_viwb( in.template getPtr() ); - } - else { - return RPackNum::getIndexPtr(in, n); - } - } - - template - static void initBlockSizes(std::array& bs, - std::tuple...>& ip) - { - std::get(bs) = RPackNum::blockSize(ip); - RPackNum::initBlockSizes(bs, ip); - } - - template - static inline void pp(std::tuple...>& ip) - { - auto& si = *std::get(ip); - if(si.last()){ - si = 0; - RPackNum::pp(ip); - } - else { - ++si; - } - } - - template - static inline int pp(std::tuple...>& ip, - std::array& bs, - std::intptr_t idxPtrNum) - { - auto& siPtr = std::get(ip); - //VCHECK(siPtr.id()); - if(reinterpret_cast(siPtr.get()) == idxPtrNum){ - return RPackNum::pp(ip, bs, idxPtrNum); - } - else { - int tmp = siPtr->pp(idxPtrNum); - if(siPtr->pos() == siPtr->max()){ - (*siPtr) = 0; - return RPackNum::pp(ip, bs, idxPtrNum) - siPtr->max() + 1; - } - else { - return tmp * std::get(bs); - } - } - } - - template - static inline void mm(std::tuple...>& ip) - { - auto& si = *std::get(ip); - if(si.first()){ - si = si.max() - 1; - RPackNum::mm(ip); - } - else { - --si; - } - } - - // !!!! - template - static inline int mm(std::tuple...>& ip, - std::array& bs, - std::intptr_t idxPtrNum) - { - auto& siPtr = std::get(ip); - if(reinterpret_cast(siPtr.get()) == idxPtrNum){ - return std::get(bs) + RPackNum::mm(ip, bs, idxPtrNum); - } - else { - if(siPtr->first()){ - (*siPtr) = siPtr->max() - 1; - return RPackNum::mm(ip, bs, idxPtrNum) - siPtr->max() + 1; - } - else { - return siPtr->mm(idxPtrNum); - } - } - } - - template - static size_t getSize(const RangeTuple& rt) - { - return std::get(rt)->size() * RPackNum::getSize(rt); - } - - template - static void getMetaPos(MetaType& target, - const IndexPack& source) - { - std::get(target) = std::get(source)->meta(); - RPackNum::getMetaPos(target, source); - } - - template - static void setMeta(IndexPack& target, const MetaType& source) - { - std::get(target)->at( std::get(source) ); - RPackNum::setMeta(target, source); - } - - template - static void setIndexPack(IndexPack& iPack, size_t pos) - { - auto& i = *std::get(iPack).get(); - const size_t ownPos = pos % i.max(); - i = ownPos; - RPackNum::setIndexPack(iPack, (pos - ownPos) / i.max() ); - } - - template - static void construct(std::tuple...>& ip, - const MRange& range) - { - typedef typename std::remove_reference())>::type SubRangeType; - typedef typename SubRangeType::IndexType SubIndexType; - typedef typename std::remove_reference(ip).get())>::type TypeFromIndexPack; - - static_assert(std::is_same::value, - "inconsiśtent types"); - - std::get(ip) = std::shared_ptr( new SubIndexType( range.template getPtr() ) ); - RPackNum::construct(ip, range); - } - - template class IndexType, class... Indices> - static void copyInst(std::tuple...>& ip, - const IndexType& ind) - { - std::get(ip) = ind.template getPtr() ; - RPackNum::copyInst(ip, ind); - } - - template - static inline size_t makePos(const std::tuple...>& iPtrTup) - { - //const auto& idx = *std::get(iPtrTup); - return std::get(iPtrTup)->pos() + RPackNum::makePos(iPtrTup) * std::get(iPtrTup)->max(); - } - - template - static void swapIndices(Pack& ipack, const std::shared_ptr& nind, - const std::shared_ptr&... ninds) - { - std::get::value-N-1>(ipack) = nind; - RPackNum::swapIndices(ipack, ninds...); - } - - template - static size_t blockSize(const std::tuple...>& pack) - { - return std::get(pack)->max() * RPackNum::blockSize(pack); - } - - - template - static void RangesToVec(const std::tuple...>& rst, - std::vector v) - { - v[N] = std::get(rst); - RPackNum::RangesToVec(rst, v); - } - - template - static void printIndex(const std::tuple...>& ip, size_t offset) - { - std::get(ip)->print(offset); - RPackNum::printIndex(ip, offset); - } - - template - static void checkDefaultable() - { - static_assert( Range::defaultable, "not defaultable" ); - RPackNum::template checkDefaultable(); - } - - template - static void buildInfoVec(std::vector& out, - const std::tuple...>& ip, - const std::array& bs) - { - static const size_t POS = sizeof...(Indices)-N-1; - out.emplace_back(*std::get(ip), std::get(bs)); - RPackNum::buildInfoVec(out, ip, bs); - } - - template - static auto mkFor(const IndexPack& ipack, Exprs exs) - -> decltype(std::get::value-N-1>(ipack) - ->ifor( RPackNum::mkFor(ipack, exs) ) ) - { - return std::get::value-N-1>(ipack) - ->ifor( RPackNum::mkFor(ipack, exs) ); - } - - template - static auto mkForh(const IndexPack& ipack, Exprs exs) - -> decltype(std::get::value-N-1>(ipack) - ->iforh( RPackNum::mkForh(ipack, exs) ) ) - { - return std::get::value-N-1>(ipack) - ->iforh( RPackNum::mkForh(ipack, exs) ); - } - - }; - - - template<> - struct RPackNum<0> - { - template - static std::shared_ptr getIndex(const IndexType& in, size_t n) - { - return make_viwb( in.template get<0>() ); - } - - template - static std::shared_ptr getIndexPtr(const IndexType& in, size_t n) - { - return make_viwb( in.template getPtr<0>() ); - } - - template - static void initBlockSizes(std::array& bs, - std::tuple...>& ip) - { - std::get<0>(bs) = RPackNum::blockSize(ip); - } - - template - static inline void pp(std::tuple...>& ip) - { - auto& si = *std::get<0>(ip); - ++si; - } - - template - static inline int pp(std::tuple...>& ip, - std::array& bs, - std::intptr_t idxPtrNum) - { - auto& siPtr = std::get<0>(ip); - if(reinterpret_cast(siPtr.get()) == idxPtrNum){ - return std::get<0>(bs); - } - else { - int tmp = siPtr->pp(idxPtrNum); - return tmp * std::get<1>(bs); - } - } - - template - static inline void mm(std::tuple...>& ip) - { - auto& si = *std::get<0>(ip); - --si; - } - - template - static inline int mm(std::tuple...>& ip, - std::array& bs, - std::intptr_t idxPtrNum) - { - auto& siPtr = std::get<0>(ip); - if(reinterpret_cast(siPtr.get()) == idxPtrNum){ - return std::get<0>(bs); - //return 1; - } - else { - return siPtr->mm(idxPtrNum); - } - } - - template - static size_t getSize(const RangeTuple& rt) - { - return std::get<0>(rt)->size(); - } - - template - static void getMetaPos(MetaType& target, - const IndexPack& source) - { - std::get<0>(target) = std::get<0>(source)->meta(); - } - - template - static void setMeta(IndexPack& target, const MetaType& source) - { - std::get<0>(target)->at( std::get<0>( source ) ); - } - - template - static void setIndexPack(IndexPack& iPack, size_t pos) - { - auto& i = *std::get<0>(iPack); - const size_t ownPos = pos % i.max(); - i = ownPos; - } - - template - static void construct(std::tuple...>& ip, - const MRange& range) - { - typedef typename std::remove_reference())>::type SubRangeType; - typedef typename SubRangeType::IndexType SubIndexType; - typedef typename std::remove_reference(ip).get())>::type TypeFromIndexPack; - - static_assert(std::is_same::value, - "inconsiśtent types"); - - std::get<0>(ip) = std::shared_ptr( new SubIndexType( range.template getPtr<0>() ) ); - } - - template class IndexType, class... Indices> - static void copyInst(std::tuple...>& ip, - const IndexType& ind) - { - std::get<0>(ip) = ind.template getPtr<0>(); - } - - template - static inline size_t makePos(const std::tuple...>& iPtrTup) - { - return std::get<0>(iPtrTup)->pos(); - } - - template - static void swapIndices(Pack& ipack, const std::shared_ptr& nind) - { - std::get::value-1>(ipack) = nind; - } - - template - static size_t blockSize(const std::tuple...>& pack) - { - return std::get(pack)->max(); - } - - template - static void RangesToVec(const std::tuple...>& rst, - std::vector v) - { - v[0] = std::get<0>(rst); - } - - template - static void printIndex(const std::tuple...>& ip, size_t offset) - { - std::get<0>(ip)->print(offset); - } - - template - static void checkDefaultable() - { - static_assert( Range::defaultable, "not defaultable" ); - } - - template - static void buildInfoVec(std::vector& out, - const std::tuple...>& ip, - const std::array& bs) - { - static const size_t POS = sizeof...(Indices)-1; - out.emplace_back(*std::get(ip), std::get(bs)); - } - - template - static auto mkFor(const IndexPack& ipack, Exprs exs) - -> decltype(std::get::value-1>(ipack) - ->ifor(exs) ) - { - return std::get::value-1>(ipack)->ifor(exs); - } - - template - static auto mkForh(const IndexPack& ipack, Exprs exs) - -> decltype(std::get::value-1>(ipack) - ->iforh(exs) ) - { - return std::get::value-1>(ipack)->iforh(exs); - } - - }; - - -} // end namespace MultiArrayHelper - -#endif diff --git a/install/include/ranges/single_range.h b/install/include/ranges/single_range.h deleted file mode 100644 index f85f7b4..0000000 --- a/install/include/ranges/single_range.h +++ /dev/null @@ -1,367 +0,0 @@ -// -*- C++ -*- - -#ifndef __single_range_h__ -#define __single_range_h__ - -#include -#include -#include - -//#include "base_def.h" -#include "ranges/index_base.h" -#include "ranges/range_base.h" - -#include "xfor/xfor.h" - -using MultiArrayHelper::For; - -namespace MultiArrayTools -{ - - template - class SingleIndex : public IndexInterface,U> - { - public: - - typedef IndexInterface,U> IB; - typedef U MetaType; - typedef SingleRange RangeType; - - //DEFAULT_MEMBERS_X(SingleIndex); - - SingleIndex(const std::shared_ptr >& range); - - static IndexType sType() { return IndexType::SINGLE; } - static size_t totalDim() { return 1; } - - // ==== >>>>> STATIC POLYMORPHISM <<<<< ==== - - IndexType type() const; - - SingleIndex& operator=(size_t pos); - SingleIndex& operator++(); - SingleIndex& operator--(); - - int pp(std::intptr_t idxPtrNum); - int mm(std::intptr_t idxPtrNum); - - U meta(); - SingleIndex& at(const U& metaPos); - - size_t dim(); // = 1 - bool last(); - bool first(); - - std::shared_ptr range(); - - template - void getPtr(); - - std::shared_ptr getVPtr(size_t n); - size_t getStepSize(size_t n); - - std::vector infoVec() const; - - std::string id() const; - void print(size_t offset); - - template - auto ifor(Expr ex) const - -> For,Expr>; - - template - auto iforh(Expr ex) const - -> For,Expr,ForType::HIDDEN>; - - }; - - template - class SingleRangeFactory : public RangeFactoryBase - { - public: - - typedef SingleRange oType; - - SingleRangeFactory() = delete; - SingleRangeFactory(const std::vector& space); - std::shared_ptr create(); - - }; - - template - class SingleRange : public RangeInterface > - { - public: - typedef RangeBase RB; - typedef SingleIndex IndexType; - //typedef typename RangeInterface >::IndexType IndexType; - - virtual size_t size() const override; - virtual size_t dim() const override; - - const U& get(size_t pos) const; - size_t getMeta(const U& metaPos) const; - - virtual IndexType begin() const override; - virtual IndexType end() const override; - virtual std::shared_ptr index() const override; - - friend SingleRangeFactory; - - static constexpr bool defaultable = false; - static constexpr size_t ISSTATIC = 0; - static constexpr size_t SIZE = -1; - - - protected: - - SingleRange() = delete; - SingleRange(const SingleRange& in) = delete; - - SingleRange(const std::vector& space); - - std::vector mSpace; - }; - -} - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayTools -{ - /****************** - * SingleIndex * - ******************/ - - template - SingleIndex::SingleIndex(const std::shared_ptr >& range) : - IndexInterface,U>(range, 0) {} - - template - IndexType SingleIndex::type() const - { - return IndexType::SINGLE; - } - - template - SingleIndex& SingleIndex::operator=(size_t pos) - { - IB::mPos = pos; - return *this; - } - - template - SingleIndex& SingleIndex::operator++() - { - ++IB::mPos; - return *this; - } - - template - SingleIndex& SingleIndex::operator--() - { - --IB::mPos; - return *this; - } - - template - int SingleIndex::pp(std::intptr_t idxPtrNum) - { - ++(*this); - return 1; - } - - template - int SingleIndex::mm(std::intptr_t idxPtrNum) - { - --(*this); - return 1; - } - - template - U SingleIndex::meta() - { - return std::dynamic_pointer_cast const>( IB::mRangePtr )->get( IB::pos() ); - } - - template - SingleIndex& SingleIndex::at(const U& metaPos) - { - (*this) = std::dynamic_pointer_cast const>( IB::mRangePtr )->getMeta( metaPos ); - return *this; - } - - template - size_t SingleIndex::dim() // = 1 - { - return 1; - } - - template - bool SingleIndex::last() - { - return IB::mPos == IB::mMax - 1; - } - - template - bool SingleIndex::first() - { - return IB::mPos == 0; - } - - template - std::shared_ptr::RangeType> SingleIndex::range() - { - return std::dynamic_pointer_cast( IB::mRangePtr ); - } - - template - template - void SingleIndex::getPtr() {} - - template - std::shared_ptr SingleIndex::getVPtr(size_t n) - { - return std::shared_ptr(); - } - - template - std::vector SingleIndex::infoVec() const - { - return std::move( std::vector() ); - } - - template - size_t SingleIndex::getStepSize(size_t n) - { - return 1; - } - - template - std::string SingleIndex::id() const - { - return std::string("sin") + std::to_string(IB::mId); - } - - template - void SingleIndex::print(size_t offset) - { - if(offset == 0){ - std::cout << " === " << std::endl; - } - for(size_t j = 0; j != offset; ++j) { std::cout << "\t"; } - std::cout << id() << "[" << reinterpret_cast(this) - << "](" << IB::mRangePtr << "): " << meta() << std::endl; - } - - template - template - auto SingleIndex::ifor(Expr ex) const - -> For,Expr> - { - //static const size_t LAYER = typename Expr::LAYER; - return For,Expr>(this, ex); - } - - template - template - auto SingleIndex::iforh(Expr ex) const - -> For,Expr,ForType::HIDDEN> - { - //static const size_t LAYER = typename Expr::LAYER; - return For,Expr,ForType::HIDDEN>(this, ex); - } - - - /******************** - * SingleRange * - ********************/ - - template - SingleRangeFactory::SingleRangeFactory(const std::vector& space) - { - mProd = std::shared_ptr( new SingleRange( space ) ); - } - - template - std::shared_ptr SingleRangeFactory::create() - { - setSelf(); - return mProd; - } - - /******************** - * SingleRange * - ********************/ - - template - SingleRange::SingleRange(const std::vector& space) : RangeInterface >(), - mSpace(space) {} - - template - const U& SingleRange::get(size_t pos) const - { - return mSpace[pos]; - } - - template - size_t SingleRange::getMeta(const U& metaPos) const - { - size_t cnt = 0; - for(auto& x: mSpace){ - if(x == metaPos){ - return cnt; - } - ++cnt; - } - return cnt; - } - - template - size_t SingleRange::size() const - { - return mSpace.size(); - } - - template - size_t SingleRange::dim() const - { - return 1; - } - - template - typename SingleRange::IndexType SingleRange::begin() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = 0; - return i; - } - - template - typename SingleRange::IndexType SingleRange::end() const - { - SingleIndex i( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ); - i = size(); - return i; - } - - // put this in the interface class !!! - template - std::shared_ptr SingleRange::index() const - { - typedef IndexWrapper IW; - return std::make_shared - ( std::make_shared - ( std::dynamic_pointer_cast > - ( std::shared_ptr( RB::mThis ) ) ) ); - } - -} - -#include "range_types/header.h" - -#endif diff --git a/install/include/ranges/vindex_base.h b/install/include/ranges/vindex_base.h deleted file mode 100644 index 114d2e1..0000000 --- a/install/include/ranges/vindex_base.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef __vindex_base_h__ -#define __vindex_base_h__ - -//#include "ranges/range_base.h" -#include "ranges/index_type.h" -#include "base_def.h" - -namespace MultiArrayTools -{ - -#ifndef __range_base_h__ - class RangeBase; -#endif - - class VirtualIndexWrapperBase - { - public: - DEFAULT_MEMBERS(VirtualIndexWrapperBase); - - virtual IndexType type() const = 0; - virtual size_t dim() const = 0; - virtual size_t pos() const = 0; - virtual size_t max() const = 0; - virtual std::shared_ptr rangePtr() const = 0; - virtual std::shared_ptr getPtr(size_t n) const = 0; - virtual std::intptr_t getPtrNum() const = 0; - virtual size_t getStepSize(size_t n) const = 0; - }; - - typedef VirtualIndexWrapperBase VIWB; - -} // end namespace MultiArrayTools - -#endif diff --git a/install/include/ranges/vindex_wrapper.h b/install/include/ranges/vindex_wrapper.h deleted file mode 100644 index 705269f..0000000 --- a/install/include/ranges/vindex_wrapper.h +++ /dev/null @@ -1,43 +0,0 @@ - -#ifndef __vindex_wrapper_h__ -#define __vindex_wrapper_h__ - -#include "ranges/vindex_base.h" - -namespace MultiArrayTools -{ - - template - std::shared_ptr > make_viwb(std::shared_ptr idxPtr) - { - return std::make_shared >(idxPtr); - } - - template - class IndexWrapper : public VirtualIndexWrapperBase - { - public: - - DEFAULT_MEMBERS(IndexWrapper); - - IndexWrapper(std::shared_ptr idxPtr) : mIdxPtr(idxPtr) {} - - virtual IndexType type() const override { return mIdxPtr->type(); } - virtual size_t dim() const override { return mIdxPtr->dim(); } - virtual size_t pos() const override { return mIdxPtr->pos(); } - virtual size_t max() const override { return mIdxPtr->max(); } - virtual std::shared_ptr rangePtr() const override { return mIdxPtr->vrange(); } - virtual std::shared_ptr getPtr(size_t n) const override - { return mIdxPtr->getVPtr(n); } - virtual std::intptr_t getPtrNum() const override { return reinterpret_cast( mIdxPtr.get() ); } - virtual size_t getStepSize(size_t n) const override { return mIdxPtr->getStepSize(n); } - - std::shared_ptr get() const { return mIdxPtr; } // unwrap - - private: - std::shared_ptr mIdxPtr; - }; - -} - -#endif diff --git a/install/include/utils.h b/install/include/utils.h deleted file mode 100644 index 6e1344c..0000000 --- a/install/include/utils.h +++ /dev/null @@ -1,30 +0,0 @@ - -#ifndef __utils_h__ -#define __utils_h__ - -#include -#include "pack_num.h" - -namespace MultiArrayHelper -{ - - using namespace MultiArrayTools; - - template - std::ostream& operator<<(std::ostream& out, const std::tuple& tp); - - /*==================* - * TEMPLATE CODE * - *==================*/ - - template - std::ostream& operator<<(std::ostream& out, const std::tuple& tp) - { - PackNum::printTuple(out, tp); - return out; - } - - -} // end namespace MultiArrayHelper - -#endif diff --git a/install/include/xfor/exttype.h b/install/include/xfor/exttype.h deleted file mode 100644 index 65718b3..0000000 --- a/install/include/xfor/exttype.h +++ /dev/null @@ -1,220 +0,0 @@ - -#ifndef __exttype_h__ -#define __exttype_h__ - -#include - -namespace MultiArrayHelper -{ - - template - class MExt - { - private: - - size_t mExt = 0u; - X mNext; - - public: - - static constexpr size_t NUM = X::NUM + 1; - - MExt() = default; - MExt(const MExt& in) = default; - MExt& operator=(const MExt& in) = default; - MExt(MExt&& in) = default; - MExt& operator=(MExt&& in) = default; - - inline MExt(size_t ext, X next); - - template - inline MExt(size_t y, const Z& z); - - template - inline MExt(const Y& y, const Z& z); - - template - inline MExt(const std::array& arr); - - inline size_t val() const; - inline const X& next() const; - - inline MExt operator+(const MExt& in) const; - inline MExt operator*(size_t in) const; - - template - auto extend(const Y& y) const -> MExt - { return MExt(mExt, mNext.extend(y)); } - - }; - - template <> - class MExt - { - private: - - size_t mExt = 0u; - - public: - - static constexpr size_t NUM = 0; - - MExt() = default; - MExt(const MExt& in) = default; - MExt& operator=(const MExt& in) = default; - MExt(MExt&& in) = default; - MExt& operator=(MExt&& in) = default; - - inline MExt(size_t ext); - - template - inline MExt(size_t y, const Z& z); - - template - inline MExt(const Y& y, const Z& z); - - template - inline MExt(const std::array& arr); - - inline size_t val() const; - inline size_t next() const { return 0; } - - inline MExt operator+(const MExt& in) const; - inline MExt operator*(size_t in) const; - - template - auto extend(const Y& y) const -> MExt - { return MExt(mExt,y); } - - }; - - - template - struct Getter - { - template - static inline size_t get(const ExtType& et) - { - return Getter::get(et.next()); - } - - template - static inline auto getX(const ExtType& et) - -> decltype(Getter::getX(et.next())) - { - return Getter::getX(et.next()); - } - }; - - template <> - struct Getter<0> - { - template - static inline size_t get(const ExtType& et) - { - return et.get(); - } - - template - static inline auto getX(const ExtType& et) - -> ExtType - { - return et; - } - }; - -} // end namespace MultiArrayHelper - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -namespace MultiArrayHelper -{ - - template - inline MExt::MExt(size_t ext, X next) : mExt(ext), mNext(next) {} - - template - template - inline MExt::MExt(const std::array& arr) : - mExt(std::get(arr)), mNext(arr) {} - - template - template - inline MExt::MExt(size_t y, const Z& z) : - mExt(z.val()), mNext(z.val(), z.next()) {} - - template - template - inline MExt::MExt(const Y& y, const Z& z) : - mExt(y.val()), mNext(y.next(), z) {} - - template - inline size_t MExt::val() const - { - return mExt; - } - - template - inline const X& MExt::next() const - { - return mNext; - } - - template - inline MExt MExt::operator+(const MExt& in) const - { - return MExt(mExt + in.val(), mNext + in.next()); - } - - template - inline MExt MExt::operator*(size_t in) const - { - return MExt(mExt * in, mNext * in); - } - - - //template <> - inline MExt::MExt(size_t ext) : mExt(ext) {} - - - //template <> - template - inline MExt::MExt(size_t y, const Z& z) : - mExt(z.val()) {} - - //template <> - template - inline MExt::MExt(const Y& y, const Z& z) : - mExt(y.val()) {} - - - //template <> - template - inline MExt::MExt(const std::array& arr) : - mExt(std::get(arr)) {} - - //template <> - inline size_t MExt::val() const - { - return mExt; - } - - //template <> - inline MExt MExt::operator+(const MExt& in) const - { - return MExt(mExt + in.val()); - } - - //template <> - inline MExt MExt::operator*(size_t in) const - { - return MExt(mExt * in); - } - - -} // end namespace MultiArrayHelper - - -#endif diff --git a/install/include/xfor/for_type.h b/install/include/xfor/for_type.h deleted file mode 100644 index 0d2deda..0000000 --- a/install/include/xfor/for_type.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef __for_type_h__ -#define __for_type_h__ - -namespace MultiArrayHelper -{ - - - enum class ForType { - DEFAULT = 0, - HIDDEN = 1 - }; - - -} // end namespace MultiArrayHelper - - -#endif diff --git a/install/include/xfor/for_utils.h b/install/include/xfor/for_utils.h deleted file mode 100644 index b706c97..0000000 --- a/install/include/xfor/for_utils.h +++ /dev/null @@ -1,39 +0,0 @@ - -#ifndef __for_utils_h__ -#define __for_utils_h__ - -#include "ranges/rheader.h" -#include -#include - -namespace MultiArrayHelper -{ - namespace { - template - using to_size_t = size_t; - } - - template - struct XFPackNum - { - template - static inline ETuple mkPos(size_t pos, const ETuple& et, const ETuple& lt, const Args&... args) - { - return std::move( XFPackNum::mkPos(pos, et, lt, std::get(lt) + pos * std::get(et), args...) ); - } - }; - - template <> - struct XFPackNum<0> - { - template - static inline ETuple mkPos(size_t pos, const ETuple& et, const ETuple& lt, const Args&... args) - { - return ETuple(std::get<0>(lt) + pos * std::get<0>(et), args...); - } - - }; - -} // end namespace MultiArrayHelper - -#endif diff --git a/install/include/xfor/xfor.h b/install/include/xfor/xfor.h deleted file mode 100644 index cec68a4..0000000 --- a/install/include/xfor/xfor.h +++ /dev/null @@ -1,172 +0,0 @@ - -#ifndef __xfor_h__ -#define __xfor_h__ - -#include -#include -#include -#include "xfor/for_utils.h" -#include "xfor/for_type.h" -#include "xfor/exttype.h" - -namespace MultiArrayHelper -{ - - // 'HIDDEN FOR' CLASS for nested for loops in contractions a.s.o. - // (NO COUNTING OF MASTER POSITION !!!!!) - - template - struct PosForward - { - static inline size_t value(size_t last, size_t max, size_t pos) - { - return last * max + pos; - } - }; - - template <> - struct PosForward - { - static inline size_t value(size_t last, size_t max, size_t pos) - { - return last; - } - }; - - template - struct ForBound - { - template - static inline size_t bound(size_t bound) - { - return bound; - } - }; - - template <> - struct ForBound<1> - { - template - static constexpr size_t bound(size_t bound) - { - return BOUND; - } - }; - - template - class For - { - private: - For() = default; - //For(const For& in) = default; - //For& operator=(const For& in) = default; - - const IndexClass* mIndPtr; - size_t mSPos; - size_t mMax; - Expr mExpr; - - typedef decltype(mExpr.rootSteps()) ExtType; - ExtType mExt; - - public: - - static constexpr size_t LAYER = Expr::LAYER + 1; - static constexpr size_t SIZE = Expr::SIZE; - - For(const For& in) = default; - For& operator=(const For& in) = default; - For(For&& in) = default; - For& operator=(For&& in) = default; - - For(const std::shared_ptr& indPtr, - Expr expr); - - For(const IndexClass* indPtr, - Expr expr); - - - inline void operator()(size_t mlast, ExtType last) const; - inline void operator()(size_t mlast = 0) const; - - auto rootSteps(std::intptr_t iPtrNum = 0) const -> ExtType; - - }; - - template - size_t exceptMax(size_t max) { return max; } - - template <> - size_t exceptMax<1>(size_t max) { return 1; } - -} // namespace MultiArrayHelper - -/* ========================= * - * --- TEMPLATE CODE --- * - * ========================= */ - -#include - -namespace MultiArrayHelper -{ - - template - For::For(const std::shared_ptr& indPtr, - Expr expr) : - mIndPtr(indPtr.get()), mSPos(mIndPtr->pos()), mMax(mIndPtr->max()), mExpr(expr), - mExt(expr.rootSteps( reinterpret_cast( mIndPtr.get() ))) - { - assert(mIndPtr != nullptr); - //VCHECK(mIndPtr->id()); - //VCHECK(mIndPtr->max()); - } - - template - For::For(const IndexClass* indPtr, - Expr expr) : - mIndPtr(indPtr), mSPos(mIndPtr->pos()), mMax(mIndPtr->max()), - mExpr(std::forward( expr )), - mExt(expr.rootSteps( reinterpret_cast( mIndPtr ) )) - { - assert(mIndPtr != nullptr); - //VCHECK(mIndPtr->id()); - //VCHECK(mIndPtr->max()); - } - - template - inline void For::operator()(size_t mlast, - ExtType last) const - { - typedef typename IndexClass::RangeType RangeType; - for(size_t pos = 0u; pos != ForBound::template bound(mMax); ++pos){ - //for(size_t pos = mSPos; pos != mMax; ++pos){ - const size_t mnpos = PosForward::value(mlast, mMax, pos); - const ExtType npos = last + mExt*pos; - mExpr(mnpos, npos); - } - } - - template - inline void For::operator()(size_t mlast) const - { - typedef typename IndexClass::RangeType RangeType; - const ExtType last; - for(size_t pos = 0u; pos != ForBound::template bound(mMax); ++pos){ - //for(size_t pos = mSPos; pos != mMax; ++pos){ - const size_t mnpos = PosForward::value(mlast, mMax, pos); - const ExtType npos = last + mExt*pos; - mExpr(mnpos, npos); - } - } - - template - auto For::rootSteps(std::intptr_t iPtrNum) const - -> ExtType - { - return mExpr.rootSteps(iPtrNum); - } - - -} // namespace MultiArrayHelper - -#endif diff --git a/install/lib/libmultiarray.a b/install/lib/libmultiarray.a deleted file mode 100644 index 765e03e05b3a0b9b5e86c85e9dbf519baa631972..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32044 zcmeHw4Rl+@weFD>If5iUhEgz4h)P{>8fxqi5(_9#{*gUO)&_=?z7t?S~E=z?G@wyLu? z*0y0o^{iO5tL^GocUMPy+s5#$aJafE)*M?AUzh0V+8DmZ0FmnRntMAE?X^8Uts570 zb#<(p+upe%z9F)rKz8+(J!fb@4+I@T)7lYhPsDp#saFf$9vXwb%M3T#@IDg zA7X^+XVJnqS1$0Q9Hsi|4_&o-E|gkNytSjFt1Z^vxh~$5h|B{YG|%B{K4>6O3>=5U z4c!+n`Y?>QwtRTT&m+c3oocp^lv(tvrG{oP7;8z)s#@9Av%a-wMMgYgiPlv#eG{a* zdNvm5C0$(!NOyZ%d>vTNT_1+S4s9isZEclZ=M>rt=cq04+}U$y>AmoVaI~?=VUAW@FzBkzAwq_#5srh!c#rM{z|Dxjf?)vrY1_B7)Ll{ZY$~=^CZ3? ztgA~!-wyv3R}PueLul_SrLsn9Jn^#KG_`->IEq=9P3`@)uqTWDX_6azVVMa2d+)6A zh5kJC(Nbb-hJznbtD|2xr*ERFcjL@GnU9iwpUw?j}qG`e68G*T#vns0tv#P3Vs;aB!I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