rename MultiArray + pre-processor variables

This commit is contained in:
Christian Zimmermann 2021-07-28 20:59:31 +02:00
parent c5e6003fc9
commit 3975edea20
69 changed files with 454 additions and 454 deletions

View file

@ -1,6 +1,6 @@
#ifndef __ma_allocator__
#define __ma_allocator__
#ifndef __cxz_allocator__
#define __cxz_allocator__
#include <cstdlib>
#include <new>

View file

@ -1,6 +1,6 @@
#ifndef __arith_h__
#define __arith_h__
#ifndef __cxz_arith_h__
#define __cxz_arith_h__
#include <functional>

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __base_def_h__
#define __base_def_h__
#ifndef __cxz_base_def_h__
#define __cxz_base_def_h__
#include <cassert>

View file

@ -1,5 +1,5 @@
#ifndef __basic_types_h__
#define __basic_types_h__
#ifndef __cxz_basic_types_h__
#define __cxz_basic_types_h__
#include <string>

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __cnorxz_h__
#define __cnorxz_h__
#ifndef __cxz_cnorxz_h__
#define __cxz_cnorxz_h__
#include <cstdlib>
#include "container_index.h"

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __container_index_h__
#define __container_index_h__
#ifndef __cxz_container_index_h__
#define __cxz_container_index_h__
#include <cstdlib>
#include <tuple>

View file

@ -1,6 +1,6 @@
#ifndef __ma_conversions_h__
#define __ma_conversions_h__
#ifndef __cxz_conversions_h__
#define __cxz_conversions_h__
#include "cxz_array.h"
#include "slice.h"
@ -94,7 +94,7 @@ namespace CNORXZ
}
template <typename C, typename T, class... Ranges>
auto tcast(MultiArray<T,Ranges...>& ma)
auto tcast(Array<T,Ranges...>& ma)
-> decltype(rangeTpToSlice
( rtcast<C,T>( ma.range()->space() ),
reinterpret_cast<C*>( ma.data() ) ))
@ -107,7 +107,7 @@ namespace CNORXZ
}
template <typename C, typename T, class... Ranges>
auto tcast(const MultiArray<T,Ranges...>& ma)
auto tcast(const Array<T,Ranges...>& ma)
-> decltype(rangeTpToSlice
( rtcast<C,T>( ma.range()->space() ),
reinterpret_cast<const C*>( ma.data() ) ))

View file

@ -12,21 +12,21 @@ namespace CNORXZ
}
/*******************
* MultiArray *
* Array *
*******************/
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const typename CRange::Space& space) :
MutableMultiArrayBase<T,SRanges...>(space),
Array<T,SRanges...>::Array(const typename CRange::Space& space) :
MutableArrayBase<T,SRanges...>(space),
mCont(MAB::mRange->size())
{
MAB::mInit = true;
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const typename CRange::Space& space,
Array<T,SRanges...>::Array(const typename CRange::Space& space,
const vector<T>& vec) :
MutableMultiArrayBase<T,SRanges...>(space),
MutableArrayBase<T,SRanges...>(space),
mCont(vec)
{
MAB::mInit = true;
@ -37,24 +37,24 @@ namespace CNORXZ
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
Array<T,SRanges...>::Array(const std::shared_ptr<SRanges>&... ranges) :
MutableArrayBase<T,SRanges...>(ranges...),
mCont(MAB::mRange->size())
{
MAB::mInit = true;
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, const T& val) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
Array<T,SRanges...>::Array(const std::shared_ptr<SRanges>&... ranges, const T& val) :
MutableArrayBase<T,SRanges...>(ranges...),
mCont(MAB::mRange->size(), val)
{
MAB::mInit = true;
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, const vector<T>& vec) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
Array<T,SRanges...>::Array(const std::shared_ptr<SRanges>&... ranges, const vector<T>& vec) :
MutableArrayBase<T,SRanges...>(ranges...),
mCont(vec)
{
MAB::mInit = true;
@ -64,8 +64,8 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, vector<T>&& vec) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
Array<T,SRanges...>::Array(const std::shared_ptr<SRanges>&... ranges, vector<T>&& vec) :
MutableArrayBase<T,SRanges...>(ranges...),
mCont(std::forward<vector<T>>(vec))
{
MAB::mInit = true;
@ -76,8 +76,8 @@ namespace CNORXZ
template <typename T, class... SRanges>
template <class... Ranges>
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, MultiArray<T,Ranges...>&& in) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
Array<T,SRanges...>::Array(const std::shared_ptr<SRanges>&... ranges, Array<T,Ranges...>&& in) :
MutableArrayBase<T,SRanges...>(ranges...),
mCont( std::move( in.mCont ) )
{
// maybe some checks here in the future...
@ -87,8 +87,8 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::MultiArray(MultiArray<T,AnonymousRange>&& ama, SIZET<SRanges>... sizes) :
MutableMultiArrayBase<T,SRanges...>
Array<T,SRanges...>::Array(Array<T,AnonymousRange>&& ama, SIZET<SRanges>... sizes) :
MutableArrayBase<T,SRanges...>
( ama.range()->template get<0>().template scast<SRanges...>(sizes...)->space() ),
mCont( std::move( ama.mCont ) )
{
@ -97,85 +97,85 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
T& MultiArray<T,SRanges...>::operator[](const IndexType& i)
T& Array<T,SRanges...>::operator[](const IndexType& i)
{
return mCont[ i.pos() ];
}
template <typename T, class... SRanges>
const T& MultiArray<T,SRanges...>::operator[](const IndexType& i) const
const T& Array<T,SRanges...>::operator[](const IndexType& i) const
{
return mCont[ i.pos() ];
}
template <typename T, class... SRanges>
T& MultiArray<T,SRanges...>::at(const typename IndexType::MetaType& meta)
T& Array<T,SRanges...>::at(const typename IndexType::MetaType& meta)
{
return mCont[ MAB::cbegin().at(meta).pos() ];
}
template <typename T, class... SRanges>
const T& MultiArray<T,SRanges...>::at(const typename IndexType::MetaType& meta) const
const T& Array<T,SRanges...>::at(const typename IndexType::MetaType& meta) const
{
return mCont[ MAB::cbegin().at(meta).pos() ];
}
template <typename T, class... SRanges>
bool MultiArray<T,SRanges...>::isConst() const
bool Array<T,SRanges...>::isConst() const
{
return false;
}
template <typename T, class... SRanges>
bool MultiArray<T,SRanges...>::isSlice() const
bool Array<T,SRanges...>::isSlice() const
{
return false;
}
template <typename T, class... SRanges>
template <class... SRanges2>
MultiArray<T,SRanges2...> MultiArray<T,SRanges...>::format(const std::shared_ptr<SRanges2>&... nrs)
Array<T,SRanges2...> Array<T,SRanges...>::format(const std::shared_ptr<SRanges2>&... nrs)
{
//MAB::mInit = false;
return MultiArray<T,SRanges2...>( nrs... , mCont );
return Array<T,SRanges2...>( nrs... , mCont );
}
template <typename T, class... SRanges>
template <class... SRanges2>
MultiArray<T,SRanges2...> MultiArray<T,SRanges...>::format(const std::tuple<std::shared_ptr<SRanges2>...>& nrs)
Array<T,SRanges2...> Array<T,SRanges...>::format(const std::tuple<std::shared_ptr<SRanges2>...>& nrs)
{
//MAB::mInit = false;
return MultiArray<T,SRanges2...>( nrs , mCont );
return Array<T,SRanges2...>( nrs , mCont );
}
template <typename T, class... SRanges>
template <class... SRanges2>
Slice<T,SRanges2...> MultiArray<T,SRanges...>::slformat(const std::shared_ptr<SRanges2>&... nrs)
Slice<T,SRanges2...> Array<T,SRanges...>::slformat(const std::shared_ptr<SRanges2>&... nrs)
{
return Slice<T,SRanges2...>( nrs..., mCont.data() );
}
template <typename T, class... SRanges>
template <class... SRanges2>
ConstSlice<T,SRanges2...> MultiArray<T,SRanges...>::slformat(const std::shared_ptr<SRanges2>&... nrs) const
ConstSlice<T,SRanges2...> Array<T,SRanges...>::slformat(const std::shared_ptr<SRanges2>&... nrs) const
{
return ConstSlice<T,SRanges2...>( nrs..., mCont.data() );
}
template <typename T, class... SRanges>
const T* MultiArray<T,SRanges...>::data() const
const T* Array<T,SRanges...>::data() const
{
return mCont.data();
}
template <typename T, class... SRanges>
T* MultiArray<T,SRanges...>::data()
T* Array<T,SRanges...>::data()
{
return mCont.data();
}
template <typename T, class... SRanges>
std::shared_ptr<MultiArrayBase<T,AnonymousRange> > MultiArray<T,SRanges...>::anonymous(bool slice) const
std::shared_ptr<ArrayBase<T,AnonymousRange> > Array<T,SRanges...>::anonymous(bool slice) const
{
AnonymousRangeFactory arf(MAB::mRange->space());
if(slice){
@ -184,14 +184,14 @@ namespace CNORXZ
data() );
}
else {
return std::make_shared<MultiArray<T,AnonymousRange> >
return std::make_shared<Array<T,AnonymousRange> >
( std::dynamic_pointer_cast<AnonymousRange>( arf.create() ),
mCont );
}
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator=(const T& in)
Array<T,SRanges...>& Array<T,SRanges...>::operator=(const T& in)
{
for(auto& x: mCont){
x = in;
@ -200,7 +200,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator+=(const MultiArray& in)
Array<T,SRanges...>& Array<T,SRanges...>::operator+=(const Array& in)
{
if(not MAB::mInit){ // not initialized by default constructor !!
(*this) = in;
@ -217,7 +217,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator-=(const MultiArray& in)
Array<T,SRanges...>& Array<T,SRanges...>::operator-=(const Array& in)
{
if(not MAB::mInit){ // not initialized by default constructor !!
(*this) = in;
@ -234,7 +234,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator*=(const T& in)
Array<T,SRanges...>& Array<T,SRanges...>::operator*=(const T& in)
{
for(auto& x: mCont){
x *= in;
@ -243,7 +243,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator/=(const T& in)
Array<T,SRanges...>& Array<T,SRanges...>::operator/=(const T& in)
{
for(auto& x: mCont){
x /= in;
@ -252,7 +252,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArray<T,SRanges...>::operator T() const
Array<T,SRanges...>::operator T() const
{
//static_assert( sizeof...(SRanges) == 1, "try to cast non-scalar type into scalar" );
// TODO: check that SIZE is statically = 1 !!!
@ -260,7 +260,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
auto MultiArray<T,SRanges...>::cat() const
auto Array<T,SRanges...>::cat() const
-> decltype(ArrayCatter<T>::cat(*this))
{
return ArrayCatter<T>::cat(*this);

View file

@ -18,49 +18,49 @@ namespace CNORXZ
struct ArrayCatter
{
template <class... Ranges>
static auto cat(const MultiArray<T,Ranges...>& ma)
-> MultiArray<T,Ranges...>
static auto cat(const Array<T,Ranges...>& ma)
-> Array<T,Ranges...>
{
return ma;
}
};
template <typename T, class... SRanges>
class MultiArray : public MutableMultiArrayBase<T,SRanges...>
class Array : public MutableArrayBase<T,SRanges...>
{
public:
typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB;
typedef ArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;
using MultiArrayBase<T,SRanges...>::operator[];
using MutableMultiArrayBase<T,SRanges...>::operator[];
using ArrayBase<T,SRanges...>::operator[];
using MutableArrayBase<T,SRanges...>::operator[];
DEFAULT_MEMBERS(MultiArray);
MultiArray(const std::shared_ptr<SRanges>&... ranges);
MultiArray(const std::shared_ptr<SRanges>&... ranges, const T& val);
MultiArray(const std::shared_ptr<SRanges>&... ranges, const vector<T>& vec);
MultiArray(const std::shared_ptr<SRanges>&... ranges, vector<T>&& vec);
DEFAULT_MEMBERS(Array);
Array(const std::shared_ptr<SRanges>&... ranges);
Array(const std::shared_ptr<SRanges>&... ranges, const T& val);
Array(const std::shared_ptr<SRanges>&... ranges, const vector<T>& vec);
Array(const std::shared_ptr<SRanges>&... ranges, vector<T>&& vec);
template <class... Ranges>
MultiArray(const std::shared_ptr<SRanges>&... ranges, MultiArray<T,Ranges...>&& in); // same effect as format
Array(const std::shared_ptr<SRanges>&... ranges, Array<T,Ranges...>&& in); // same effect as format
MultiArray(const typename CRange::Space& space);
MultiArray(const typename CRange::Space& space, const vector<T>& vec);
MultiArray(MultiArray<T,AnonymousRange>&& ama, SIZET<SRanges>... sizes);
Array(const typename CRange::Space& space);
Array(const typename CRange::Space& space, const vector<T>& vec);
Array(Array<T,AnonymousRange>&& ama, SIZET<SRanges>... sizes);
// Only if ALL ranges have default extensions:
//MultiArray(const vector<T>& vec);
//MultiArray(vector<T>&& vec);
//Array(const vector<T>& vec);
//Array(vector<T>&& vec);
// template <class Range2, class Range3>
// MultiArray(const MultiArray<MultiArray<T,Range2>,Range3> in);
// Array(const Array<Array<T,Range2>,Range3> in);
// implement contstructor using FunctionalMultiArray as Input !!!
// implement contstructor using FunctionalArray as Input !!!
//template <class Range2, class Range3>
//MultiArray& operator=(const MultiArray<MultiArray<T,Range2>,Range3> in);
//Array& operator=(const Array<Array<T,Range2>,Range3> in);
virtual T& operator[](const IndexType& i) final;
virtual const T& operator[](const IndexType& i) const final;
@ -71,11 +71,11 @@ namespace CNORXZ
virtual bool isSlice() const override;
template <class... SRanges2>
MultiArray<T,SRanges2...> format(const std::shared_ptr<SRanges2>&... nrs); // reformat array using 'nr' which in
Array<T,SRanges2...> format(const std::shared_ptr<SRanges2>&... nrs); // reformat array using 'nr' which in
// total must have the same size as mRange
template <class... SRanges2>
MultiArray<T,SRanges2...> format(const std::tuple<std::shared_ptr<SRanges2>...>& nrs);
Array<T,SRanges2...> format(const std::tuple<std::shared_ptr<SRanges2>...>& nrs);
template <class... SRanges2>
Slice<T,SRanges2...> slformat(const std::shared_ptr<SRanges2>&... nrs);
@ -89,23 +89,23 @@ namespace CNORXZ
virtual const vector<T>& vdata() const { return mCont; }
vector<T>&& vmove() { MAB::mInit = false; return std::move(mCont); }
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
//virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymousMove() override;
virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
//virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymousMove() override;
auto cat() const
-> decltype(ArrayCatter<T>::cat(*this));
operator T() const;
MultiArray& operator=(const T& in);
Array& operator=(const T& in);
MultiArray& operator+=(const MultiArray& in);
MultiArray& operator-=(const MultiArray& in);
MultiArray& operator*=(const T& in);
MultiArray& operator/=(const T& in);
Array& operator+=(const Array& in);
Array& operator-=(const Array& in);
Array& operator*=(const T& in);
Array& operator/=(const T& in);
template <typename U, class... SRanges2>
friend class MultiArray;
friend class Array;
private:
@ -113,17 +113,17 @@ namespace CNORXZ
};
template <typename T>
using Scalar = MultiArray<T,NullRange>;
using Scalar = Array<T,NullRange>;
template <typename T>
Scalar<T> scalar(const T& in);
template <typename T, class... ERanges>
struct ArrayCatter<MultiArray<T,ERanges...> >
struct ArrayCatter<Array<T,ERanges...> >
{
template <class... Ranges>
static auto cat(const MultiArray<MultiArray<T,ERanges...>,Ranges...>& ma)
-> MultiArray<T,Ranges...,ERanges...>
static auto cat(const Array<Array<T,ERanges...>,Ranges...>& ma)
-> Array<T,Ranges...,ERanges...>
{
auto sma = *ma.begin();
const size_t smas = sma.size();
@ -136,7 +136,7 @@ namespace CNORXZ
assert(x.size() == smas);
ov.insert(ov.end(), x.vdata().begin(), x.vdata().end());
}
return MultiArray<T,Ranges...,ERanges...>(cr->space(), std::move(ov));
return Array<T,Ranges...,ERanges...>(cr->space(), std::move(ov));
}
};

View file

@ -5,11 +5,11 @@ namespace CNORXZ
{
/**********************
* MultiArrayBase *
* ArrayBase *
**********************/
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(const MultiArrayBase& in) :
ArrayBase<T,SRanges...>::ArrayBase(const ArrayBase& in) :
mInit(in.mInit),
mRange(in.mRange)
{
@ -20,7 +20,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(MultiArrayBase&& in) :
ArrayBase<T,SRanges...>::ArrayBase(ArrayBase&& in) :
mInit(in.mInit),
mRange(in.mRange)
{
@ -30,7 +30,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>& MultiArrayBase<T,SRanges...>::operator=(const MultiArrayBase& in)
ArrayBase<T,SRanges...>& ArrayBase<T,SRanges...>::operator=(const ArrayBase& in)
{
mInit = in.mInit;
mRange = in.mRange;
@ -41,7 +41,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>& MultiArrayBase<T,SRanges...>::operator=(MultiArrayBase&& in)
ArrayBase<T,SRanges...>& ArrayBase<T,SRanges...>::operator=(ArrayBase&& in)
{
mInit = in.mInit;
mRange = in.mRange;
@ -52,7 +52,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(const std::shared_ptr<SRanges>&... ranges)
ArrayBase<T,SRanges...>::ArrayBase(const std::shared_ptr<SRanges>&... ranges)
{
ContainerRangeFactory<SRanges...> crf(ranges...);
mRange = std::dynamic_pointer_cast<ContainerRange<SRanges...> >( crf.create() );
@ -60,7 +60,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
MultiArrayBase<T,SRanges...>::MultiArrayBase(const typename CRange::Space& space)
ArrayBase<T,SRanges...>::ArrayBase(const typename CRange::Space& space)
{
ContainerRangeFactory<SRanges...> crf(space);
mRange = std::dynamic_pointer_cast<ContainerRange<SRanges...> >( crf.create() );
@ -69,7 +69,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
template <typename X>
const T& MultiArrayBase<T,SRanges...>::operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i)
const T& ArrayBase<T,SRanges...>::operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i)
{
IndexType ii(*mProtoI);
ii = i;
@ -77,7 +77,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
const T& MultiArrayBase<T,SRanges...>::operator[](const std::tuple<IPTR<typename SRanges::IndexType>...>& is) const
const T& ArrayBase<T,SRanges...>::operator[](const std::tuple<IPTR<typename SRanges::IndexType>...>& is) const
{
IndexType ii(*mProtoI);
ii(is);
@ -85,25 +85,25 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
size_t MultiArrayBase<T,SRanges...>::size() const
size_t ArrayBase<T,SRanges...>::size() const
{
return mRange->size();
}
template <typename T, class... SRanges>
typename MultiArrayBase<T,SRanges...>::CIndexType MultiArrayBase<T,SRanges...>::begin() const
typename ArrayBase<T,SRanges...>::CIndexType ArrayBase<T,SRanges...>::begin() const
{
return cbegin();
}
template <typename T, class... SRanges>
typename MultiArrayBase<T,SRanges...>::CIndexType MultiArrayBase<T,SRanges...>::end() const
typename ArrayBase<T,SRanges...>::CIndexType ArrayBase<T,SRanges...>::end() const
{
return end();
}
template <typename T, class... SRanges>
typename MultiArrayBase<T,SRanges...>::CIndexType MultiArrayBase<T,SRanges...>::cbegin() const
typename ArrayBase<T,SRanges...>::CIndexType ArrayBase<T,SRanges...>::cbegin() const
{
CIndexType i(*mProtoI,true);
i = 0;
@ -111,7 +111,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
typename MultiArrayBase<T,SRanges...>::CIndexType MultiArrayBase<T,SRanges...>::cend() const
typename ArrayBase<T,SRanges...>::CIndexType ArrayBase<T,SRanges...>::cend() const
{
CIndexType i(*mProtoI,true);
i = i.max();
@ -119,28 +119,28 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
const std::shared_ptr<typename MultiArrayBase<T,SRanges...>::CRange>&
MultiArrayBase<T,SRanges...>::range() const
const std::shared_ptr<typename ArrayBase<T,SRanges...>::CRange>&
ArrayBase<T,SRanges...>::range() const
{
return mRange;
}
template <typename T, class... SRanges>
bool MultiArrayBase<T,SRanges...>::isConst() const
bool ArrayBase<T,SRanges...>::isConst() const
{
return true;
}
template <typename T, class... SRanges>
ConstOperationRoot<T,SRanges...>
MultiArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
ArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
{
return ConstOperationRoot<T,SRanges...>(*this, inds...);
}
template <typename T, class... SRanges>
ConstOperationRoot<T,SRanges...>
MultiArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind) const
ArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind) const
{
return ConstOperationRoot<T,SRanges...>(data(), *ind);
}
@ -148,7 +148,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
template <class... MappedRanges>
ConstOperationRoot<T,MappedRanges...>
MultiArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds) const
ArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds) const
{
static_assert(sizeof...(SRanges) == sizeof...(MappedRanges),
"number of mapped ranges must be equal to number of original ranges");
@ -156,14 +156,14 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
bool MultiArrayBase<T,SRanges...>::isInit() const
bool ArrayBase<T,SRanges...>::isInit() const
{
return mInit;
}
template <typename T, class... SRanges>
template <size_t N>
auto MultiArrayBase<T,SRanges...>::getRangePtr() const
auto ArrayBase<T,SRanges...>::getRangePtr() const
-> decltype(mRange->template getPtr<N>())
{
return mRange->template getPtr<N>();
@ -171,20 +171,20 @@ namespace CNORXZ
/******************************
* MutableMultiArrayBase *
* MutableArrayBase *
******************************/
template <typename T, class... SRanges>
MutableMultiArrayBase<T,SRanges...>::MutableMultiArrayBase(const std::shared_ptr<SRanges>&... ranges) :
MultiArrayBase<T,SRanges...>(ranges...) {}
MutableArrayBase<T,SRanges...>::MutableArrayBase(const std::shared_ptr<SRanges>&... ranges) :
ArrayBase<T,SRanges...>(ranges...) {}
template <typename T, class... SRanges>
MutableMultiArrayBase<T,SRanges...>::MutableMultiArrayBase(const typename CRange::Space& space) :
MultiArrayBase<T,SRanges...>(space) {}
MutableArrayBase<T,SRanges...>::MutableArrayBase(const typename CRange::Space& space) :
ArrayBase<T,SRanges...>(space) {}
template <typename T, class... SRanges>
template <typename X>
T& MutableMultiArrayBase<T,SRanges...>::operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i)
T& MutableArrayBase<T,SRanges...>::operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i)
{
IndexType ii(*MAB::mProtoI);
ii = i;
@ -192,7 +192,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
T& MutableMultiArrayBase<T,SRanges...>::operator[](const std::tuple<IPTR<typename SRanges::IndexType>...>& is)
T& MutableArrayBase<T,SRanges...>::operator[](const std::tuple<IPTR<typename SRanges::IndexType>...>& is)
{
IndexType ii(*MAB::mProtoI,this->data());
ii(is);
@ -200,7 +200,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
typename MutableMultiArrayBase<T,SRanges...>::IndexType MutableMultiArrayBase<T,SRanges...>::begin()
typename MutableArrayBase<T,SRanges...>::IndexType MutableArrayBase<T,SRanges...>::begin()
{
IndexType i(*MAB::mProtoI,this->data(),true);
i = 0;
@ -208,7 +208,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
typename MutableMultiArrayBase<T,SRanges...>::IndexType MutableMultiArrayBase<T,SRanges...>::end()
typename MutableArrayBase<T,SRanges...>::IndexType MutableArrayBase<T,SRanges...>::end()
{
IndexType i(*MAB::mProtoI,this->data(),true);
i = i.max();
@ -217,35 +217,35 @@ namespace CNORXZ
template <typename T, class... SRanges>
bool MutableMultiArrayBase<T,SRanges...>::isConst() const
bool MutableArrayBase<T,SRanges...>::isConst() const
{
return false;
}
template <typename T, class... SRanges>
OperationRoot<T,SRanges...>
MutableMultiArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds)
MutableArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds)
{
return OperationRoot<T,SRanges...>(*this, inds...);
}
template <typename T, class... SRanges>
OperationRoot<T,SRanges...>
MutableMultiArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind)
MutableArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind)
{
return OperationRoot<T,SRanges...>(data(), *ind);
}
template <typename T, class... SRanges>
ConstOperationRoot<T,SRanges...>
MutableMultiArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
MutableArrayBase<T,SRanges...>::operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
{
return ConstOperationRoot<T,SRanges...>(*this, inds...);
}
template <typename T, class... SRanges>
ConstOperationRoot<T,SRanges...>
MutableMultiArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind) const
MutableArrayBase<T,SRanges...>::op(const std::shared_ptr<CIndexType>& ind) const
{
return ConstOperationRoot<T,SRanges...>(data(), *ind);
}
@ -253,7 +253,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
template <class... MappedRanges>
OperationRoot<T,MappedRanges...>
MutableMultiArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds)
MutableArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds)
{
static_assert(sizeof...(SRanges) == sizeof...(MappedRanges),
"number of mapped ranges must be equal to number of original ranges");
@ -263,7 +263,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
template <class... MappedRanges>
ConstOperationRoot<T,MappedRanges...>
MutableMultiArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds) const
MutableArrayBase<T,SRanges...>::m(const std::shared_ptr<typename MappedRanges::IndexType>&... inds) const
{
static_assert(sizeof...(SRanges) == sizeof...(MappedRanges),
"number of mapped ranges must be equal to number of original ranges");

View file

@ -51,7 +51,7 @@ namespace CNORXZ
// Explicitely specify subranges in template argument !!!
template <typename T, class... SRanges>
class MultiArrayBase
class ArrayBase
{
public:
@ -67,17 +67,17 @@ namespace CNORXZ
public:
//DEFAULT_MEMBERS(MultiArrayBase);
MultiArrayBase(const std::shared_ptr<SRanges>&... ranges);
MultiArrayBase(const typename CRange::Space& space);
//DEFAULT_MEMBERS(ArrayBase);
ArrayBase(const std::shared_ptr<SRanges>&... ranges);
ArrayBase(const typename CRange::Space& space);
MultiArrayBase() = default;
MultiArrayBase(const MultiArrayBase& in);
MultiArrayBase(MultiArrayBase&& in);
MultiArrayBase& operator=(const MultiArrayBase& in);
MultiArrayBase& operator=(MultiArrayBase&& in);
ArrayBase() = default;
ArrayBase(const ArrayBase& in);
ArrayBase(ArrayBase&& in);
ArrayBase& operator=(const ArrayBase& in);
ArrayBase& operator=(ArrayBase&& in);
virtual ~MultiArrayBase() = default;
virtual ~ArrayBase() = default;
template <typename X>
const T& operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i);
@ -100,7 +100,7 @@ namespace CNORXZ
virtual bool isConst() const;
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const = 0;
virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const = 0;
virtual ConstOperationRoot<T,SRanges...>
op(const std::shared_ptr<CIndexType>& ind) const;
@ -121,26 +121,26 @@ namespace CNORXZ
};
template <typename T, class... SRanges>
class MutableMultiArrayBase : public MultiArrayBase<T,SRanges...>
class MutableArrayBase : public ArrayBase<T,SRanges...>
{
public:
typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB;
typedef ArrayBase<T,SRanges...> MAB;
typedef ContainerIndex<T,typename SRanges::IndexType...> IndexType;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> CIndexType;
using MultiArrayBase<T,SRanges...>::operator[];
using MultiArrayBase<T,SRanges...>::at;
using MultiArrayBase<T,SRanges...>::data;
using MultiArrayBase<T,SRanges...>::begin;
using MultiArrayBase<T,SRanges...>::end;
using MultiArrayBase<T,SRanges...>::cbegin;
using MultiArrayBase<T,SRanges...>::cend;
using ArrayBase<T,SRanges...>::operator[];
using ArrayBase<T,SRanges...>::at;
using ArrayBase<T,SRanges...>::data;
using ArrayBase<T,SRanges...>::begin;
using ArrayBase<T,SRanges...>::end;
using ArrayBase<T,SRanges...>::cbegin;
using ArrayBase<T,SRanges...>::cend;
DEFAULT_MEMBERS(MutableMultiArrayBase);
MutableMultiArrayBase(const std::shared_ptr<SRanges>&... ranges);
MutableMultiArrayBase(const typename CRange::Space& space);
DEFAULT_MEMBERS(MutableArrayBase);
MutableArrayBase(const std::shared_ptr<SRanges>&... ranges);
MutableArrayBase(const typename CRange::Space& space);
template <typename X>
T& operator[](const ConstContainerIndex<X,typename SRanges::IndexType...>& i);

View file

@ -68,7 +68,7 @@ namespace CNORXZ
template <class... Indices>
auto OperationBase<T,OperationClass>::p(const std::shared_ptr<Indices>&... inds) const
{
auto ma = std::make_shared<MultiArray<T,typename Indices::RangeType...>>
auto ma = std::make_shared<Array<T,typename Indices::RangeType...>>
(inds->range()... , static_cast<T>(0));
(*ma)(inds...) = THIS();
return ConstOperationRoot<T,typename Indices::RangeType...>(ma, inds...);
@ -78,7 +78,7 @@ namespace CNORXZ
template <class... Indices>
auto OperationBase<T,OperationClass>::to(const std::shared_ptr<Indices>&... inds) const
{
MultiArray<T,typename Indices::RangeType...> out(inds->range()...);
Array<T,typename Indices::RangeType...> out(inds->range()...);
out(inds...) = THIS();
return out;
}
@ -87,7 +87,7 @@ namespace CNORXZ
template <class... Indices>
auto OperationBase<T,OperationClass>::addto(const std::shared_ptr<Indices>&... inds) const
{
MultiArray<T,typename Indices::RangeType...> out(inds->range()...,
Array<T,typename Indices::RangeType...> out(inds->range()...,
static_cast<T>(0));
out(inds...) += THIS();
return out;
@ -97,7 +97,7 @@ namespace CNORXZ
template <class... Indices>
auto OperationBase<T,OperationClass>::pto(const std::shared_ptr<Indices>&... inds) const
{
MultiArray<T,typename Indices::RangeType...> out(inds->range()...);
Array<T,typename Indices::RangeType...> out(inds->range()...);
out(inds...).par() = THIS();
return out;
}
@ -106,7 +106,7 @@ namespace CNORXZ
template <class... Indices>
auto OperationBase<T,OperationClass>::paddto(const std::shared_ptr<Indices>&... inds) const
{
MultiArray<T,typename Indices::RangeType...> out(inds->range()...,
Array<T,typename Indices::RangeType...> out(inds->range()...,
static_cast<T>(0));
out(inds...).par() += THIS();
return out;
@ -343,7 +343,7 @@ namespace CNORXZ
template <typename T, class... Ranges>
ConstOperationRoot<T,Ranges...>::
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
ConstOperationRoot(const ArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
mDataPtr(ma.data()),
mOrigDataPtr(ma.data()),
@ -355,7 +355,7 @@ namespace CNORXZ
template <typename T, class... Ranges>
ConstOperationRoot<T,Ranges...>::
ConstOperationRoot(std::shared_ptr<MultiArrayBase<T,Ranges...> > maptr,
ConstOperationRoot(std::shared_ptr<ArrayBase<T,Ranges...> > maptr,
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
mDataPtr(maptr->data()),
mOrigDataPtr(maptr->data()),
@ -517,7 +517,7 @@ namespace CNORXZ
template <typename T, class... Ranges>
OperationRoot<T,Ranges...>::
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
OperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
mDataPtr(ma.data()),
mOrigDataPtr(ma.data()),
@ -531,7 +531,7 @@ namespace CNORXZ
template <typename T, class... Ranges>
OperationRoot<T,Ranges...>::
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
OperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::tuple<std::shared_ptr<typename Ranges::IndexType>...>& indices) :
mDataPtr(ma.data()),
mOrigDataPtr(ma.data()),
@ -728,7 +728,7 @@ namespace CNORXZ
template <typename T, class... Ranges>
ParallelOperationRoot<T,Ranges...>::
ParallelOperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
ParallelOperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
mDataPtr(ma.data()),
mOrigDataPtr(ma.data()),

View file

@ -477,10 +477,10 @@ namespace CNORXZ
static constexpr bool CONT = true;
static constexpr bool VABLE = true;
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
ConstOperationRoot(const ArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices);
ConstOperationRoot(std::shared_ptr<MultiArrayBase<T,Ranges...> > maptr,
ConstOperationRoot(std::shared_ptr<ArrayBase<T,Ranges...> > maptr,
const std::shared_ptr<typename Ranges::IndexType>&... indices);
ConstOperationRoot(const T* data, const IndexType& ind);
@ -506,7 +506,7 @@ namespace CNORXZ
const T* mDataPtr;
const T* mOrigDataPtr;
IndexType mIndex;
std::shared_ptr<MultiArrayBase<T,Ranges...> > mMaPtr; // never remove this ptr, otherwise we lose temporary container instances!
std::shared_ptr<ArrayBase<T,Ranges...> > mMaPtr; // never remove this ptr, otherwise we lose temporary container instances!
};
template <typename T, class Op>
@ -609,10 +609,10 @@ namespace CNORXZ
IndexType mIndex;
public:
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
OperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices);
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
OperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::tuple<std::shared_ptr<typename Ranges::IndexType>...>& indices);
OperationRoot(T* data, const IndexType& ind);
@ -695,7 +695,7 @@ namespace CNORXZ
IndexType mIndex;
public:
ParallelOperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
ParallelOperationRoot(MutableArrayBase<T,Ranges...>& ma,
const std::shared_ptr<typename Ranges::IndexType>&... indices);
ParallelOperationRoot(T* data, const IndexType& ind);

View file

@ -45,7 +45,7 @@ namespace CNORXZ
DynamicOuterOp<T,Operation,Ranges...>::DynamicOuterOp(const DynamicOuterOp& in) :
mThreadId(omp_get_thread_num()), mOp(in.mOp),
mIndices(in.mIndices),
mMa((mThreadId != in.mThreadId) ? std::make_shared<MultiArray<T,Ranges...>>(*in.mMa) : in.mMa),
mMa((mThreadId != in.mThreadId) ? std::make_shared<Array<T,Ranges...>>(*in.mMa) : in.mMa),
mProto((mThreadId != in.mThreadId) ? OperationRoot<T,Ranges...>(*mMa,mIndices) : in.mProto),
mL((mThreadId != in.mThreadId) ?
mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices,
@ -60,7 +60,7 @@ namespace CNORXZ
DynamicOuterOp<T,Operation,Ranges...>::DynamicOuterOp(DynamicOuterOp&& in) :
mThreadId(omp_get_thread_num()), mOp(in.mOp),
mIndices(in.mIndices),
mMa((mThreadId != in.mThreadId) ? std::make_shared<MultiArray<T,Ranges...>>(*in.mMa) : in.mMa),
mMa((mThreadId != in.mThreadId) ? std::make_shared<Array<T,Ranges...>>(*in.mMa) : in.mMa),
mProto((mThreadId != in.mThreadId) ? OperationRoot<T,Ranges...>(*mMa,mIndices) : in.mProto),
mL((mThreadId != in.mThreadId) ?
mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices,
@ -79,7 +79,7 @@ namespace CNORXZ
mOp = in.mOp;
mIndices = in.mIndices;
if(mThreadId != in.mThreadId){
mMa = std::make_shared<MultiArray<T,Ranges...>>(in.mMa);
mMa = std::make_shared<Array<T,Ranges...>>(in.mMa);
mProto = OperationRoot<T,Ranges...>(*mMa,mIndices);
mL = mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices,
std::make_tuple(mMa),
@ -103,7 +103,7 @@ namespace CNORXZ
mOp = in.mOp;
mIndices = in.mIndices;
if(mThreadId != in.mThreadId){
mMa = std::make_shared<MultiArray<T,Ranges...>>(in.mMa);
mMa = std::make_shared<Array<T,Ranges...>>(in.mMa);
mProto = OperationRoot<T,Ranges...>(*mMa,mIndices);
mL = mkILoop(std::make_tuple(*mProto.mOp,mOp), mIndices,
std::make_tuple(mMa),
@ -124,7 +124,7 @@ namespace CNORXZ
const std::shared_ptr<typename Ranges::IndexType>&... inds)
: mThreadId(omp_get_thread_num()), mOp(op),
mIndices(inds...),
mMa(std::make_shared<MultiArray<T,Ranges...>>(mkArray<T>(inds->range()...))),
mMa(std::make_shared<Array<T,Ranges...>>(mkArray<T>(inds->range()...))),
mProto(OperationRoot<T,Ranges...>(*mMa,inds...)),
mL(std::make_tuple(*mProto.mOp,mOp), std::make_tuple(inds...),
std::make_tuple(mMa), std::make_tuple(mProto.mOp->assign( mOp, mkMIndex(inds...) )),
@ -137,7 +137,7 @@ namespace CNORXZ
: mThreadId(omp_get_thread_num()),
//mDyn(dyn),
mOp(op), mIndices(inds...),
mMa(std::make_shared<MultiArray<T,Ranges...>>(mkArray<T>(inds->range()...))),
mMa(std::make_shared<Array<T,Ranges...>>(mkArray<T>(inds->range()...))),
mProto(OperationRoot<T,Ranges...>(*mMa,inds...)),
mL(std::make_tuple(*mProto.mOp,mOp), std::make_tuple(inds...),
std::make_tuple(mMa), std::make_tuple(mProto.mOp->assign( mOp, mkMIndex(inds...) )),

View file

@ -1,6 +1,6 @@
#ifndef __dynamic_operation_h__
#define __dynamic_operation_h__
#ifndef __cxz_dynamic_operation_h__
#define __cxz_dynamic_operation_h__
#include "base_def.h"
#include "cxz_operation.h"
@ -77,13 +77,13 @@ namespace CNORXZ
Operation mOp;
//OperationRoot<T,Ranges...> mProto;
std::tuple<std::shared_ptr<typename Ranges::IndexType>...> mIndices;
std::shared_ptr<MultiArray<T,Ranges...>> mMa;
std::shared_ptr<Array<T,Ranges...>> mMa;
OpH<OperationRoot<T,Ranges...>> mProto;
typedef ILoop<std::tuple<OperationRoot<T,Ranges...>,Operation>,
std::tuple<std::shared_ptr<typename Ranges::IndexType>...>,
std::tuple<std::shared_ptr<MultiArray<T,Ranges...>>>,
std::tuple<std::shared_ptr<Array<T,Ranges...>>>,
std::tuple<decltype(mProto.mOp->assign( mOp, mkMIndex(std::shared_ptr<typename Ranges::IndexType>()...) ))>> LoopT;

View file

@ -6,30 +6,30 @@ namespace CNORXZ
/****************************
* FunctionalMultiArray *
* FunctionalArray *
****************************/
template <typename T, class Function, class... SRanges>
FunctionalMultiArray<T,Function,SRanges...>::FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges,
FunctionalArray<T,Function,SRanges...>::FunctionalArray(const std::shared_ptr<SRanges>&... ranges,
const std::shared_ptr<Function>& func) :
MultiArrayBase<T,SRanges...>(ranges...), mFunc(func) {}
ArrayBase<T,SRanges...>(ranges...), mFunc(func) {}
template <typename T, class Function, class... SRanges>
FunctionalMultiArray<T,Function,SRanges...>::FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges) :
MultiArrayBase<T,SRanges...>(ranges...) {}
FunctionalArray<T,Function,SRanges...>::FunctionalArray(const std::shared_ptr<SRanges>&... ranges) :
ArrayBase<T,SRanges...>(ranges...) {}
template <typename T, class Function, class... SRanges>
FunctionalMultiArray<T,Function,SRanges...>::FunctionalMultiArray(const typename CRange::Space& space) :
MultiArrayBase<T,SRanges...>(space) {}
FunctionalArray<T,Function,SRanges...>::FunctionalArray(const typename CRange::Space& space) :
ArrayBase<T,SRanges...>(space) {}
template <typename T, class Function, class... SRanges>
FunctionalMultiArray<T,Function,SRanges...>::FunctionalMultiArray(const typename CRange::Space& space,
FunctionalArray<T,Function,SRanges...>::FunctionalArray(const typename CRange::Space& space,
const std::shared_ptr<Function>& func) :
MultiArrayBase<T,SRanges...>(space), mFunc(func) {}
ArrayBase<T,SRanges...>(space), mFunc(func) {}
template <typename T, class Function, class... SRanges>
const T& FunctionalMultiArray<T,Function,SRanges...>::operator[](const IndexType& i) const
const T& FunctionalArray<T,Function,SRanges...>::operator[](const IndexType& i) const
{
if constexpr(Function::FISSTATIC){
mVal = Function::apply(i.meta());
@ -41,7 +41,7 @@ namespace CNORXZ
}
template <typename T, class Function, class... SRanges>
const T& FunctionalMultiArray<T,Function,SRanges...>::at(const typename CRange::IndexType::MetaType& meta) const
const T& FunctionalArray<T,Function,SRanges...>::at(const typename CRange::IndexType::MetaType& meta) const
{
if constexpr(Function::FISSTATIC){
mVal = Function::apply(meta);
@ -53,32 +53,32 @@ namespace CNORXZ
}
template <typename T, class Function, class... SRanges>
const T* FunctionalMultiArray<T,Function,SRanges...>::data() const
const T* FunctionalArray<T,Function,SRanges...>::data() const
{
return &mVal;
}
template <typename T, class Function, class... SRanges>
bool FunctionalMultiArray<T,Function,SRanges...>::isConst() const
bool FunctionalArray<T,Function,SRanges...>::isConst() const
{
return true;
}
template <typename T, class Function, class... SRanges>
bool FunctionalMultiArray<T,Function,SRanges...>::isSlice() const
bool FunctionalArray<T,Function,SRanges...>::isSlice() const
{
return false;
}
template <typename T, class Function, class... SRanges>
std::shared_ptr<MultiArrayBase<T,AnonymousRange> > FunctionalMultiArray<T,Function,SRanges...>::anonymous(bool slice) const
std::shared_ptr<ArrayBase<T,AnonymousRange> > FunctionalArray<T,Function,SRanges...>::anonymous(bool slice) const
{
assert(0); // think about it carefully
return nullptr;
}
template <typename T, class Function, class... SRanges>
ConstOperationRoot<T,SRanges...> FunctionalMultiArray<T,Function,SRanges...>::
ConstOperationRoot<T,SRanges...> FunctionalArray<T,Function,SRanges...>::
operator()(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
{
if(not mMaPtr){
@ -89,7 +89,7 @@ namespace CNORXZ
}
template <typename T, class Function, class... SRanges>
auto FunctionalMultiArray<T,Function,SRanges...>::
auto FunctionalArray<T,Function,SRanges...>::
exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
-> Operation<T,Function,MetaOperationRoot<SRanges>...>
{

View file

@ -1,6 +1,6 @@
#ifndef __functional_array__
#define __functional_array__
#ifndef __cxz_functional_array__
#define __cxz_functional_array__
#include "cxz_array_base.h"
#include "slice.h"
@ -9,14 +9,14 @@ namespace CNORXZ
{
template <typename T, class Function, class... SRanges>
class FunctionalMultiArray : public MultiArrayBase<T,SRanges...>
class FunctionalArray : public ArrayBase<T,SRanges...>
{
public:
typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB;
typedef ArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IndexType;
typedef MultiArray<T,SRanges...> MAType;
typedef Array<T,SRanges...> MAType;
typedef T value_type;
private:
@ -27,11 +27,11 @@ namespace CNORXZ
public:
DEFAULT_MEMBERS(FunctionalMultiArray);
FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges, const std::shared_ptr<Function>& func);
FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges);
FunctionalMultiArray(const typename CRange::Space& space);
FunctionalMultiArray(const typename CRange::Space& space, const std::shared_ptr<Function>& func);
DEFAULT_MEMBERS(FunctionalArray);
FunctionalArray(const std::shared_ptr<SRanges>&... ranges, const std::shared_ptr<Function>& func);
FunctionalArray(const std::shared_ptr<SRanges>&... ranges);
FunctionalArray(const typename CRange::Space& space);
FunctionalArray(const typename CRange::Space& space, const std::shared_ptr<Function>& func);
virtual const T& operator[](const IndexType& i) const override;
virtual const T& at(const typename CRange::IndexType::MetaType& meta) const override;
@ -40,7 +40,7 @@ namespace CNORXZ
virtual bool isConst() const override;
virtual bool isSlice() const override;
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
auto exec(const std::shared_ptr<typename SRanges::IndexType>&... inds) const
-> Operation<T,Function,MetaOperationRoot<SRanges>...>;

View file

@ -237,7 +237,7 @@ namespace CNORXZ
template <class MArray>
auto dynamic(const MArray& ma, bool slice)
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange>>
-> std::shared_ptr<ArrayBase<typename MArray::value_type,DynamicRange>>
{
DynamicRangeFactory drf(ma.range()->space());
if(slice){
@ -246,7 +246,7 @@ namespace CNORXZ
ma.data() );
}
else {
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange>>
return std::make_shared<Array<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.vdata() );
}
@ -254,7 +254,7 @@ namespace CNORXZ
template <class MArray>
auto mdynamic(MArray& ma, bool slice)
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange>>
-> std::shared_ptr<MutableArrayBase<typename MArray::value_type,DynamicRange>>
{
DynamicRangeFactory drf(ma.range()->space());
if(slice){
@ -263,7 +263,7 @@ namespace CNORXZ
ma.data() );
}
else {
return std::make_shared<MultiArray<typename MArray::value_type,DynamicRange>>
return std::make_shared<Array<typename MArray::value_type,DynamicRange>>
( std::dynamic_pointer_cast<DynamicRange>( drf.create() ),
ma.vdata() );
}
@ -294,7 +294,7 @@ namespace CNORXZ
}
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
auto anonToDynView(const ArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
@ -307,7 +307,7 @@ namespace CNORXZ
}
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
auto anonToDynView(MutableArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> Slice<T,Range1,RangeTypes...,DynamicRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
@ -320,8 +320,8 @@ namespace CNORXZ
}
template <typename T, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>
auto dynToAnonMove(Array<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> Array<T,Range1,RangeTypes...,AnonymousRange>
{
constexpr size_t LAST = sizeof...(RangeTypes)+1;
AnonymousRangeFactory arf(rptr<LAST>(ma)->orig());
@ -333,7 +333,7 @@ namespace CNORXZ
}
template <typename T>
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
auto anonToDynView(const ArrayBase<T,AnonymousRange>& ma)
-> ConstSlice<T,DynamicRange>
{
DynamicRangeFactory drf(rptr<0>(ma)->orig());
@ -342,7 +342,7 @@ namespace CNORXZ
}
template <typename T>
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
auto anonToDynView(MutableArrayBase<T,AnonymousRange>& ma)
-> Slice<T,DynamicRange>
{
DynamicRangeFactory drf(rptr<0>(ma)->orig());
@ -351,8 +351,8 @@ namespace CNORXZ
}
template <typename T>
auto dynToAnonMove(MultiArray<T,DynamicRange>&& ma)
-> MultiArray<T,AnonymousRange>
auto dynToAnonMove(Array<T,DynamicRange>&& ma)
-> Array<T,AnonymousRange>
{
AnonymousRangeFactory arf(rptr<0>(ma)->orig());
auto mNSpace = std::make_tuple( createExplicit( arf ) );
@ -376,23 +376,23 @@ namespace CNORXZ
template <typename T, class... Ranges>
auto mkArray(const std::shared_ptr<Ranges>&... rs)
-> MultiArray<T,Ranges...>
-> Array<T,Ranges...>
{
return MultiArray<T,Ranges...>(rs...);
return Array<T,Ranges...>(rs...);
}
template <typename T, class... Ranges>
auto mkArray(const std::shared_ptr<Ranges>&... rs, const T& val)
-> MultiArray<T,Ranges...>
-> Array<T,Ranges...>
{
return MultiArray<T,Ranges...>(rs..., val);
return Array<T,Ranges...>(rs..., val);
}
template <typename T, class... Ranges>
auto mkArrayPtr(const std::shared_ptr<Ranges>&... rs)
-> std::shared_ptr<MultiArray<T,Ranges...>>
-> std::shared_ptr<Array<T,Ranges...>>
{
return std::make_shared<MultiArray<T,Ranges...>>(rs...);
return std::make_shared<Array<T,Ranges...>>(rs...);
}
}

View file

@ -1,6 +1,6 @@
#ifndef __helper_tools_h__
#define __helper_tools_h__
#ifndef __cxz_helper_tools_h__
#define __cxz_helper_tools_h__
#include "base_def.h"
#include "slice.h"
@ -119,35 +119,35 @@ namespace CNORXZ
template <class MArray>
auto dynamic(const MArray& ma, bool slice = false)
-> std::shared_ptr<MultiArrayBase<typename MArray::value_type,DynamicRange>>;
-> std::shared_ptr<ArrayBase<typename MArray::value_type,DynamicRange>>;
template <class MArray>
auto mdynamic(MArray& ma, bool slice)
-> std::shared_ptr<MutableMultiArrayBase<typename MArray::value_type,DynamicRange>>;
-> std::shared_ptr<MutableArrayBase<typename MArray::value_type,DynamicRange>>;
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(const MultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
auto anonToDynView(const ArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> ConstSlice<T,Range1,RangeTypes...,DynamicRange>;
template <typename T, class Range1, class... RangeTypes>
auto anonToDynView(MutableMultiArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
auto anonToDynView(MutableArrayBase<T,Range1,RangeTypes...,AnonymousRange>& ma)
-> Slice<T,Range1,RangeTypes...,DynamicRange>;
template <typename T, class Range1, class... RangeTypes>
auto dynToAnonMove(MultiArray<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> MultiArray<T,Range1,RangeTypes...,AnonymousRange>;
auto dynToAnonMove(Array<T,Range1,RangeTypes...,DynamicRange>&& ma)
-> Array<T,Range1,RangeTypes...,AnonymousRange>;
template <typename T>
auto anonToDynView(const MultiArrayBase<T,AnonymousRange>& ma)
auto anonToDynView(const ArrayBase<T,AnonymousRange>& ma)
-> ConstSlice<T,DynamicRange>;
template <typename T>
auto anonToDynView(MutableMultiArrayBase<T,AnonymousRange>& ma)
auto anonToDynView(MutableArrayBase<T,AnonymousRange>& ma)
-> Slice<T,DynamicRange>;
template <typename T>
auto dynToAnonMove(MultiArray<T,DynamicRange>&& ma)
-> MultiArray<T,AnonymousRange>;
auto dynToAnonMove(Array<T,DynamicRange>&& ma)
-> Array<T,AnonymousRange>;
template <class Range>
auto metaSlice(const std::shared_ptr<Range>& r)
@ -159,15 +159,15 @@ namespace CNORXZ
template <typename T, class... Ranges>
auto mkArray(const std::shared_ptr<Ranges>&... rs)
-> MultiArray<T,Ranges...>;
-> Array<T,Ranges...>;
template <typename T, class... Ranges>
auto mkArrayPtr(const std::shared_ptr<Ranges>&... rs)
-> std::shared_ptr<MultiArray<T,Ranges...>>;
-> std::shared_ptr<Array<T,Ranges...>>;
template <typename T, class... Ranges>
auto mkArray(const std::shared_ptr<Ranges>&... rs, const T& val)
-> MultiArray<T,Ranges...>;
-> Array<T,Ranges...>;
template <class OpTp, class IndTp, class VarTp, class LTp>
auto mkILoop(const OpTp& opTp, const IndTp& indTp, const VarTp& varTp, const LTp& lTp,
@ -214,11 +214,11 @@ namespace CNORXZ
template <class Index>
inline auto mkOp(const std::shared_ptr<Index>& i)
-> decltype(std::declval<FunctionalMultiArray<typename Index::MetaType,
-> decltype(std::declval<FunctionalArray<typename Index::MetaType,
identity<typename Index::MetaType>,typename Index::RangeType> >
().exec(i))
{
FunctionalMultiArray<typename Index::MetaType,
FunctionalArray<typename Index::MetaType,
identity<typename Index::MetaType>,
typename Index::RangeType> fma(i->range());
return fma.exec(i);

View file

@ -1,6 +1,6 @@
#ifndef __high_level_operation_h__
#define __high_level_operation_h__
#ifndef __cxz_high_level_operation_h__
#define __cxz_high_level_operation_h__
#include "base_def.h"
#include "ranges/rheader.h"

View file

@ -415,7 +415,7 @@ namespace CNORXZ
struct OutRangeMaker<SpaceType::ANY>
{
template <class MapF, class ORType>
static void mk(std::shared_ptr<ORType>& outRange, MultiArray<size_t,ORType>& mapMult, const MapF& mapf)
static void mk(std::shared_ptr<ORType>& outRange, Array<size_t,ORType>& mapMult, const MapF& mapf)
{
std::map<typename MapF::value_type,size_t> mult;
for(auto ii = mapf.begin(); ii.max() != ii.pos(); ++ii) {
@ -434,7 +434,7 @@ namespace CNORXZ
typename ORType::FType orf(outmeta);
outRange = std::dynamic_pointer_cast<ORType>( orf.create() );
mapMult = MultiArray<size_t,ORType>( outRange, outmult );
mapMult = Array<size_t,ORType>( outRange, outmult );
}
};
@ -442,7 +442,7 @@ namespace CNORXZ
struct OutRangeMaker<SpaceType::NONE>
{
template <class MapF, class ORType>
static void mk(std::shared_ptr<ORType>& outRange, MultiArray<size_t,ORType>& mapMult, const MapF& mapf)
static void mk(std::shared_ptr<ORType>& outRange, Array<size_t,ORType>& mapMult, const MapF& mapf)
{
static_assert( std::is_same<size_t,typename MapF::value_type>::value,
"out range value type for NONE must be size_t" );
@ -464,7 +464,7 @@ namespace CNORXZ
typename ORType::FType orf(max);
outRange = std::dynamic_pointer_cast<ORType>( orf.create() );
mapMult = MultiArray<size_t,ORType>( outRange, outmult );
mapMult = Array<size_t,ORType>( outRange, outmult );
}
};
@ -472,7 +472,7 @@ namespace CNORXZ
template <class MA>
void GenMapRange<ORType,Op,XSTYPE,Ranges...>::mkOutRange(const MA& mapf)
{
//FunctionalMultiArray<typename MapF::value_type,MapF,Ranges...> fma(mSpace, mMapf);
//FunctionalArray<typename MapF::value_type,MapF,Ranges...> fma(mSpace, mMapf);
OutRangeMaker<XSTYPE>::mk(mOutRange,mMapMult,mapf);
auto i = mapf.begin();
mMapPos.resize(i.max());
@ -666,7 +666,7 @@ namespace CNORXZ
template <class ORType, class Op, SpaceType XSTYPE, class... Ranges>
auto GenMapRange<ORType,Op,XSTYPE,Ranges...>::mapMultiplicity() const
-> const MultiArray<size_t,ORType>&
-> const Array<size_t,ORType>&
{
return mMapMult;
}

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __map_range_h__
#define __map_range_h__
#ifndef __cxz_map_range_h__
#define __cxz_map_range_h__
#include <cstdlib>
#include <tuple>
@ -29,12 +29,12 @@ namespace CNORXZ
template <class Func, class... Indices>
auto mkMapOp(const std::shared_ptr<Func>& func,
const std::shared_ptr<Indices>&... is)
-> decltype(std::make_tuple(FunctionalMultiArray<typename Func::value_type,Func,
-> decltype(std::make_tuple(FunctionalArray<typename Func::value_type,Func,
typename Indices::RangeType...>().exec(is...),
FunctionalMultiArray<typename Func::value_type,Func,
FunctionalArray<typename Func::value_type,Func,
typename Indices::RangeType...>()))
{
typedef FunctionalMultiArray<typename Func::value_type,Func,typename Indices::RangeType...> FMA;
typedef FunctionalArray<typename Func::value_type,Func,typename Indices::RangeType...> FMA;
if(Func::FISSTATIC){
FMA fma(is->range()...);
return std::make_tuple(fma.exec(is...),fma);
@ -277,7 +277,7 @@ namespace CNORXZ
Op mMapf;
//Op mMapf;
std::shared_ptr<ORType> mOutRange;
MultiArray<size_t,ORType> mMapMult;
Array<size_t,ORType> mMapMult;
vector<size_t> mMapPos;
private:
@ -314,7 +314,7 @@ namespace CNORXZ
virtual IndexType begin() const final;
virtual IndexType end() const final;
const MultiArray<size_t,ORType>& mapMultiplicity() const;
const Array<size_t,ORType>& mapMultiplicity() const;
ConstSlice<size_t,GenMapRange> explMapMultiplicity() const;
vector<size_t> mapPos() const;

View file

@ -1,6 +1,6 @@
#ifndef __map_range_factory_product_map_h__
#define __map_range_factory_product_map_h__
#ifndef __cxz_map_range_factory_product_map_h__
#define __cxz_map_range_factory_product_map_h__
#include <memory>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __mbase_def_h__
#define __mbase_def_h__
#ifndef __cxz_mbase_def_h__
#define __cxz_mbase_def_h__
#include "ranges/rbase_def.h"
#include "allocator.h"
@ -23,15 +23,15 @@ namespace CNORXZ
// cxz_array.h
template <typename T, class... SRanges>
class MultiArrayBase;
class ArrayBase;
// cxz_array.h
template <typename T, class... SRanges>
class MutableMultiArrayBase;
class MutableArrayBase;
// cxz_array.h
template <typename T, class... SRanges>
class MultiArray;
class Array;
// cxz_operation.h
template <typename T, class OperationClass>

View file

@ -1,6 +1,6 @@
#ifndef __operation_def_h__
#define __operation_def_h__
#ifndef __cxz_operation_def_h__
#define __cxz_operation_def_h__
#include "cxz_operation.h"

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __anonymous_range_h__
#define __anonymous_range_h__
#ifndef __cxz_anonymous_range_h__
#define __cxz_anonymous_range_h__
#include <cstdlib>
#include <map>

View file

@ -1,6 +1,6 @@
#ifndef __dynamic_meta_h__
#define __dynamic_meta_h__
#ifndef __cxz_dynamic_meta_h__
#define __cxz_dynamic_meta_h__
#include <cstdlib>
#include <utility>

View file

@ -1,6 +1,6 @@
#ifndef __dynamic_range_h__
#define __dynamic_range_h__
#ifndef __cxz_dynamic_range_h__
#define __cxz_dynamic_range_h__
#include <cassert>
#include <map>

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __index_base_h__
#define __index_base_h__
#ifndef __cxz_index_base_h__
#define __cxz_index_base_h__
#include <cstdlib>
#include <string>

View file

@ -1,6 +1,6 @@
#ifndef __index_type_h__
#define __index_type_h__
#ifndef __cxz_index_type_h__
#define __cxz_index_type_h__
namespace CNORXZ
{

View file

@ -1,6 +1,6 @@
#ifndef __index_wrapper_h__
#define __index_wrapper_h__
#ifndef __cxz_index_wrapper_h__
#define __cxz_index_wrapper_h__
#include "ranges/rbase_def.h"
#include "xfor/xfor.h"

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __multi_range_h__
#define __multi_range_h__
#ifndef __cxz_multi_range_h__
#define __cxz_multi_range_h__
#include <cstdlib>
#include <tuple>

View file

@ -1,6 +1,6 @@
#ifndef __multi_range_factory_product_map_h__
#define __multi_range_factory_product_map_h__
#ifndef __cxz_multi_range_factory_product_map_h__
#define __cxz_multi_range_factory_product_map_h__
#include <memory>
#include <vector>

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __range_base_h__
#define __range_base_h__
#ifndef __cxz_range_base_h__
#define __cxz_range_base_h__
#include <cstdlib>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __range_helper_h__
#define __range_helper_h__
#ifndef __cxz_range_helper_h__
#define __cxz_range_helper_h__
namespace CNORXZ
{

View file

@ -4,11 +4,11 @@
//#else
#ifndef include_range_type
#ifdef __ranges_header__
#ifdef __cxz_ranges_header__
// assert, that this is only used within range_types/header.h
#ifndef __range_type_classic_def__
#define __range_type_classic_def__
#ifndef __cxz_range_type_classic_def__
#define __cxz_range_type_classic_def__
namespace CNORXZ
{
@ -80,8 +80,8 @@ namespace CNORXZ
}
#endif // #ifndef __range_type_classic_def__
#endif // #ifndef __cxz_range_type_classic_def__
#endif // #ifdef __ranges_header__
#endif // #ifdef __cxz_ranges_header__
#endif // #ifdef include_range_type

View file

@ -1,19 +1,19 @@
#ifdef include_range_type
#define __incl_this__
#define __cxz_incl_this__
#endif
#ifdef __single_range_h__
#ifdef __cxz_single_range_h__
// singel_range is template which is specialized here
// therefore it must be defined before...
#define __incl_this__
#define __cxz_incl_this__
#endif
#ifdef __incl_this__
#ifdef __cxz_incl_this__
#define __ranges_header__
//#ifndef __ranges_header__
//#define __ranges_header__
#define __cxz_ranges_header__
//#ifndef __cxz_ranges_header__
//#define __cxz_ranges_header__
#include "null_range.h"
#include "spin_range.h"

View file

@ -4,11 +4,11 @@
include_range_type(NUL,-2)
#else
#ifdef __ranges_header__
#ifdef __cxz_ranges_header__
// assert, that this is only used within range_types/header.h
#ifndef __range_type_null_def__
#define __range_type_null_def__
#ifndef __cxz_range_type_null_def__
#define __cxz_range_type_null_def__
namespace CNORXZ
{
@ -89,8 +89,8 @@ namespace CNORXZ
}
#endif // #ifndef __range_type_null_def__
#endif // #ifndef __cxz_range_type_null_def__
#endif // #ifdef __ranges_header__
#endif // #ifdef __cxz_ranges_header__
#endif // #ifdef include_range_type

View file

@ -3,10 +3,10 @@
include_range_type(PSPACE,3) // Periodic 1dim space
#else
#ifdef __ranges_header__
#ifdef __cxz_ranges_header__
#ifndef __range_type_space_def__
#define __range_type_space_def__
#ifndef __cxz_range_type_space_def__
#define __cxz_range_type_space_def__
namespace CNORXZ
{
@ -128,8 +128,8 @@ namespace CNORXZ
using MSpaceRF = decltype(CreateNDimSpaceRange<N>::template mkf<SpaceRange>());
}
#endif // #ifndef __range_type_space_def__
#endif // #ifndef __cxz_range_type_space_def__
#endif // #ifdef __ranges_header__
#endif // #ifdef __cxz_ranges_header__
#endif // #ifdef include_range_type

View file

@ -4,11 +4,11 @@
include_range_type(SPIN,2)
#else
#ifdef __ranges_header__
#ifdef __cxz_ranges_header__
// assert, that this is only used within range_types/header.h
#ifndef __range_type_spin_def__
#define __range_type_spin_def__
#ifndef __cxz_range_type_spin_def__
#define __cxz_range_type_spin_def__
namespace CNORXZ
{
@ -82,8 +82,8 @@ namespace CNORXZ
}
#endif // #ifndef __range_type_spin_def__
#endif // #ifndef __cxz_range_type_spin_def__
#endif // #ifdef __ranges_header__
#endif // #ifdef __cxz_ranges_header__
#endif // #ifdef include_range_type

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __ranges_base_def_h__
#define __ranges_base_def_h__
#ifndef __cxz_ranges_base_def_h__
#define __cxz_ranges_base_def_h__
#include <cstdlib>

View file

@ -1,6 +1,6 @@
#ifndef __reg_ind_num_h__
#define __reg_ind_num_h__
#ifndef __cxz_reg_ind_num_h__
#define __cxz_reg_ind_num_h__

View file

@ -1,6 +1,6 @@
//#ifndef __rheader_h__
//#define __rheader_h__
//#ifndef __cxz_rheader_h__
//#define __cxz_rheader_h__
#include "dynamic_range.h"
#include "rpheader.h"

View file

@ -1,6 +1,6 @@
//#ifndef __rpheader_h__
//#define __rpheader_h__
//#ifndef __cxz_rpheader_h__
//#define __cxz_rpheader_h__
#include "single_range.h"
#include "multi_range.h"

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
#ifndef __single_range_h__
#define __single_range_h__
#ifndef __cxz_single_range_h__
#define __cxz_single_range_h__
#include <cstdlib>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __subrange_h__
#define __subrange_h__
#ifndef __cxz_subrange_h__
#define __cxz_subrange_h__
#include <cstdlib>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __ma_type_map_h__
#define __ma_type_map_h__
#ifndef __cxz_type_map_h__
#define __cxz_type_map_h__
#include <string>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __value_range_h__
#define __value_range_h__
#ifndef __cxz_value_range_h__
#define __cxz_value_range_h__
#include <cstdlib>
#include <vector>

View file

@ -1,6 +1,6 @@
#ifndef __x_to_string_h__
#define __x_to_string_h__
#ifndef __cxz_x_to_string_h__
#define __cxz_x_to_string_h__
#include <string>
#include <vector>

View file

@ -17,7 +17,7 @@ namespace CNORXZ
template <typename T, class... SRanges>
ConstSlice<T,SRanges...>::ConstSlice(const std::tuple<std::shared_ptr<SRanges>...>& ranges,
const T* data) :
MultiArrayBase<T,SRanges...>(ranges),
ArrayBase<T,SRanges...>(ranges),
mData(data)
{
MAB::mInit = true;
@ -25,15 +25,15 @@ namespace CNORXZ
template <typename T, class... SRanges>
ConstSlice<T,SRanges...>::ConstSlice(const std::shared_ptr<SRanges>&... ranges, const T* data) :
MultiArrayBase<T,SRanges...>(ranges...),
ArrayBase<T,SRanges...>(ranges...),
mData(data)
{
MAB::mInit = true;
}
template <typename T, class... SRanges>
ConstSlice<T,SRanges...>::ConstSlice(const MultiArrayBase<T,AnonymousRange>& ma, SIZET<SRanges>... sizes) :
MultiArrayBase<T,SRanges...>
ConstSlice<T,SRanges...>::ConstSlice(const ArrayBase<T,AnonymousRange>& ma, SIZET<SRanges>... sizes) :
ArrayBase<T,SRanges...>
( ma.range()->template get<0>().template scast<SRanges...>(sizes...)->space() ),
mData( ma.data() )
{
@ -87,7 +87,7 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
std::shared_ptr<MultiArrayBase<T,AnonymousRange> > ConstSlice<T,SRanges...>::anonymous(bool slice) const
std::shared_ptr<ArrayBase<T,AnonymousRange> > ConstSlice<T,SRanges...>::anonymous(bool slice) const
{
assert(slice);
assert(not MAB::mProtoI->sliceMode()); // only originally ordered slices!
@ -118,13 +118,13 @@ namespace CNORXZ
template <typename T, class... SRanges>
Slice<T,SRanges...>::Slice(const std::shared_ptr<SRanges>&... ranges, T* data) :
MutableMultiArrayBase<T,SRanges...>(ranges...),
MutableArrayBase<T,SRanges...>(ranges...),
mData(data) {}
template <typename T, class... SRanges>
Slice<T,SRanges...>::Slice(const std::tuple<std::shared_ptr<SRanges>...>& ranges,
T* data) :
MutableMultiArrayBase<T,SRanges...>(ranges),
MutableArrayBase<T,SRanges...>(ranges),
mData(data)
{
MAB::mInit = true;
@ -208,14 +208,14 @@ namespace CNORXZ
}
template <typename T, class... SRanges>
std::shared_ptr<MultiArrayBase<T,AnonymousRange> > Slice<T,SRanges...>::anonymous(bool slice) const
std::shared_ptr<ArrayBase<T,AnonymousRange> > Slice<T,SRanges...>::anonymous(bool slice) const
{
assert(0); // think about carefully!!!!
return nullptr;
}
/*
template <typename T, class... SRanges>
std::shared_ptr<MultiArrayBase<T,AnonymousRange> > Slice<T,SRanges...>::anonymousMove()
std::shared_ptr<ArrayBase<T,AnonymousRange> > Slice<T,SRanges...>::anonymousMove()
{
assert(0); // think about carefully!!!!
return nullptr;

View file

@ -1,6 +1,6 @@
#ifndef __slice_h__
#define __slice_h__
#ifndef __cxz_slice_h__
#define __cxz_slice_h__
#include "cxz_array_base.h"
#include "cxz_operation.h"
@ -8,23 +8,23 @@
namespace CNORXZ
{
template <typename T, class... SRanges>
class ConstSlice : public MultiArrayBase<T,SRanges...>
class ConstSlice : public ArrayBase<T,SRanges...>
{
public:
typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB;
typedef ArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType;
using MultiArrayBase<T,SRanges...>::operator();
using MultiArrayBase<T,SRanges...>::operator[];
using ArrayBase<T,SRanges...>::operator();
using ArrayBase<T,SRanges...>::operator[];
DEFAULT_MEMBERS(ConstSlice);
ConstSlice(const std::tuple<std::shared_ptr<SRanges>...>& ranges,
const T* data = nullptr);
ConstSlice(const std::shared_ptr<SRanges>&... ranges, const T* data = nullptr);
ConstSlice(const MultiArrayBase<T,AnonymousRange>& ma, SIZET<SRanges>... sizes);
ConstSlice(const ArrayBase<T,AnonymousRange>& ma, SIZET<SRanges>... sizes);
virtual const T& operator[](const IType& i) const final;
virtual const T& at(const typename IType::MetaType& meta) const override;
@ -36,7 +36,7 @@ namespace CNORXZ
virtual auto begin() const -> IType override;
virtual auto end() const -> IType override;
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
auto define(const std::shared_ptr<typename SRanges::IndexType>&... inds)
-> ConstSliceDef<T,SRanges...>;
@ -51,18 +51,18 @@ namespace CNORXZ
template <typename T, class... SRanges>
class Slice : public MutableMultiArrayBase<T,SRanges...>
class Slice : public MutableArrayBase<T,SRanges...>
{
public:
typedef ContainerRange<SRanges...> CRange;
typedef MultiArrayBase<T,SRanges...> MAB;
typedef ArrayBase<T,SRanges...> MAB;
typedef ConstContainerIndex<T,typename SRanges::IndexType...> IType;
using MultiArrayBase<T,SRanges...>::operator();
using MutableMultiArrayBase<T,SRanges...>::operator();
using MultiArrayBase<T,SRanges...>::operator[];
using MutableMultiArrayBase<T,SRanges...>::operator[];
using ArrayBase<T,SRanges...>::operator();
using MutableArrayBase<T,SRanges...>::operator();
using ArrayBase<T,SRanges...>::operator[];
using MutableArrayBase<T,SRanges...>::operator[];
DEFAULT_MEMBERS(Slice);
@ -85,8 +85,8 @@ namespace CNORXZ
virtual auto begin() const -> IType override;
virtual auto end() const -> IType override;
virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
//virtual std::shared_ptr<MultiArrayBase<T,AnonymousRange> > anonymousMove() override;
virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymous(bool slice = false) const override;
//virtual std::shared_ptr<ArrayBase<T,AnonymousRange> > anonymousMove() override;
auto define(const std::shared_ptr<typename SRanges::IndexType>&... inds)
-> SliceDef<T,SRanges...>;

View file

@ -1,6 +1,6 @@
#ifndef __static_for_h__
#define __static_for_h__
#ifndef __cxz_static_for_h__
#define __cxz_static_for_h__
#include <cstdlib>

View file

@ -14,10 +14,10 @@ namespace CNORXZ
static constexpr bool VALUE = true; \
}
add_array_trait(MultiArrayBase);
add_array_trait(MutableMultiArrayBase);
add_array_trait(MultiArray);
add_array_trait(FunctionalMultiArray);
add_array_trait(ArrayBase);
add_array_trait(MutableArrayBase);
add_array_trait(Array);
add_array_trait(FunctionalArray);
add_array_trait(Slice);
add_array_trait(ConstSlice);

View file

@ -1,6 +1,6 @@
#ifndef __type_operations_h__
#define __type_operations_h__
#ifndef __cxz_type_operations_h__
#define __cxz_type_operations_h__
#include <cstdlib>
#include <vector>
@ -20,7 +20,7 @@ namespace CNORXZ
using namespace CNORXZInternal;
}
// MultiArray
// Array
template <typename T, class... Ranges>
class operate
@ -30,7 +30,7 @@ namespace CNORXZ
operate(const std::shared_ptr<typename Ranges::IndexType>&... inds) : ituple(inds...) {}
inline auto apply(const MultiArray<T,Ranges...>& ma)
inline auto apply(const Array<T,Ranges...>& ma)
-> OperationRoot<T,Ranges...>
{
return unpack<0,sizeof...(Ranges),0>
@ -46,9 +46,9 @@ namespace CNORXZ
};
template <class OperationClass, typename T, class... Ranges>
class OperationTemplate<MultiArray<T,Ranges...>,OperationClass> : public OperationBase<MultiArray<T,Ranges...>,OperationClass>
class OperationTemplate<Array<T,Ranges...>,OperationClass> : public OperationBase<Array<T,Ranges...>,OperationClass>
{
typedef OperationBase<MultiArray<T,Ranges...>,OperationClass> OB;
typedef OperationBase<Array<T,Ranges...>,OperationClass> OB;
auto operator()(const std::shared_ptr<typename Ranges::IndexType>&... indices)
-> Operation<OperationRoot<T,Ranges...>,operate<T,Ranges...>,OperationClass>

View file

@ -1,6 +1,6 @@
#ifndef __exttype_h__
#define __exttype_h__
#ifndef __cxz_exttype_h__
#define __cxz_exttype_h__
#include <array>

View file

@ -1,6 +1,6 @@
#ifndef __for_type_h__
#define __for_type_h__
#ifndef __cxz_for_type_h__
#define __cxz_for_type_h__
namespace CNORXZInternal
{

View file

@ -1,6 +1,6 @@
#ifndef __for_utils_h__
#define __for_utils_h__
#ifndef __cxz_for_utils_h__
#define __cxz_for_utils_h__
//#include "ranges/rheader.h"
#include <array>

View file

@ -1,6 +1,6 @@
#ifndef __ma_iloop_h__
#define __ma_iloop_h__
#ifndef __cxz_iloop_h__
#define __cxz_iloop_h__
#include <cstdlib>
#include <memory>

View file

@ -1,6 +1,6 @@
#ifndef __xfor_h__
#define __xfor_h__
#ifndef __cxz_xfor_h__
#define __cxz_xfor_h__
#include <cstdlib>
#include <memory>

View file

@ -1,7 +1,7 @@
#include "ranges/anonymous_range.h"
#include "ranges/ranges_header.cc.h"
#include "ma_assert.h"
#include "cxz_assert.h"
namespace CNORXZ
{

View file

@ -1,7 +1,7 @@
#include "ranges/dynamic_range.h"
#include "ranges/ranges_header.cc.h"
#include "ma_assert.h"
#include "cxz_assert.h"
namespace CNORXZ
{

View file

@ -10,8 +10,8 @@ add_dependencies(autest multiarray)
target_link_libraries(autest ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} multiarray)
add_test(NAME autest COMMAND autest)
#add_executable(mautest src/tests/ma_unit_test.cc ${MA_CC_FILES})
add_executable(mautest ma_unit_test.cc)
#add_executable(mautest src/tests/array_unit_test.cc ${MA_CC_FILES})
add_executable(mautest array_unit_test.cc)
add_dependencies(mautest multiarray)
target_link_libraries(mautest ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} multiarray)
add_test(NAME mautest COMMAND mautest)

View file

@ -98,7 +98,7 @@ namespace {
TEST_F(MATest_1Dim, SimpleCall)
{
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
Array<double,MATest_1Dim::SRange> ma(srptr, vv);
EXPECT_EQ( ma.size(), 5u);
EXPECT_EQ( ma.isConst(), false);
EXPECT_EQ( ma.isSlice(), false);
@ -115,7 +115,7 @@ namespace {
TEST_F(MATest_1Dim, ForLoop)
{
vector<double> v2 = { 0.693 , 2.718, 3.141, 1.618, 9.98 };
MultiArray<double,MATest_1Dim::SRange> ma(srptr, std::move( v2 ) );
Array<double,MATest_1Dim::SRange> ma(srptr, std::move( v2 ) );
size_t cnt = 0;
for(auto el: ma){
@ -142,7 +142,7 @@ namespace {
swapFactory<SRF>( rfbptr, { 'a', 'c', 'e', 'g', 'i' } );
std::shared_ptr<SRange> sr2 = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
Array<double,MATest_1Dim::SRange> ma(srptr, vv);
auto i = ma.cbegin();
EXPECT_EQ( ma[ i.at('x') ], 3.141);
@ -158,7 +158,7 @@ namespace {
TEST_F(MATest_MDim, SimpleCall)
{
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
Array<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
EXPECT_EQ( ma.size(), 24u );
EXPECT_EQ( ma.range()->dim(), 2u );
@ -175,7 +175,7 @@ namespace {
TEST_F(MATest_MDim, ReFormat)
{
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
Array<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
auto ma2 = ma.format( sr4ptr );
auto i = ma2.cbegin();
@ -188,7 +188,7 @@ namespace {
TEST_F(MATest_MDim, SliceTest1)
{
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
Array<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
Slice<double,MATest_MDim::SRange> sl(sr3ptr);
auto i = MAT::getIndex(sr3ptr);

View file

@ -119,7 +119,7 @@ namespace
TEST_F(MapTest, Exec1)
{
MultiArray<double,SRange,SRange> ma1(sr1ptr,sr2ptr,v1);
Array<double,SRange,SRange> ma1(sr1ptr,sr2ptr,v1);
auto ii1 = getIndex( rptr<0>( ma1 ) );
@ -127,8 +127,8 @@ namespace
auto mr = mkMapR( mkMapOp(std::make_shared<plus<size_t>>(),ii1,ii2) , sr1ptr, sr2ptr );
//auto mr = mkMapR(std::make_shared<plus<size_t>>(),sr1ptr,sr2ptr);
MultiArray<double,MpRange> res(mr);
MultiArray<double,MpRange> res2(mr);
Array<double,MpRange> res(mr);
Array<double,MpRange> res2(mr);
auto jj = getIndex( mr );
(*jj)(ii1,ii2);
///auto jj = mkMapI( std::make_shared<plus<size_t> >(), ii1, ii1 );
@ -137,8 +137,8 @@ namespace
auto mult = mr->explMapMultiplicity();
res2(jj) += ma1(ii1,ii2) / staticcast<double>( mult(jj) );
MultiArray<double,TRange> form = res.format(mpr1ptr->outRange());
MultiArray<double,TRange> form2 = res2.format(mpr1ptr->outRange());
Array<double,TRange> form = res.format(mpr1ptr->outRange());
Array<double,TRange> form2 = res2.format(mpr1ptr->outRange());
EXPECT_EQ( jj->range()->outRange()->size(), static_cast<size_t>( 10 ) );
EXPECT_EQ( jj->range()->mapMultiplicity().at(9), static_cast<size_t>( 3 ) );
@ -169,7 +169,7 @@ namespace
TEST_F(MetaOp_Test, SimpleCall)
{
FunctionalMultiArray<double,Pow<double>,SR,SR> fma(sr1ptr, sr2ptr);
FunctionalArray<double,Pow<double>,SR,SR> fma(sr1ptr, sr2ptr);
auto i = fma.begin();
@ -178,8 +178,8 @@ namespace
TEST_F(MetaOp_Test, Operation)
{
FunctionalMultiArray<double,Pow<double>,SR,SR> fma(sr1ptr, sr2ptr);
MultiArray<double,SR> res( sr1ptr );
FunctionalArray<double,Pow<double>,SR,SR> fma(sr1ptr, sr2ptr);
Array<double,SR> res( sr1ptr );
auto i1 = MAT::getIndex(sr1ptr);
auto i2 = MAT::getIndex(sr2ptr);
@ -203,14 +203,14 @@ namespace
TEST_F(OpTest_Sub, Exec)
{
MultiArray<double,SRange,SRange,SRange> ma1(sr1ptr, sr2ptr, sr3ptr, v1);
MultiArray<double,SRange,SRange> ma2(sr3ptr, sr2ptr, v2);
Array<double,SRange,SRange,SRange> ma1(sr1ptr, sr2ptr, sr3ptr, v1);
Array<double,SRange,SRange> ma2(sr3ptr, sr2ptr, v2);
SubRangeFactory<SRange> subf(sr2ptr, vector<size_t>({0,2}));
auto subptr = MAT::createExplicit(subf);
MultiArray<double,SRange,SRange> res(sr3ptr,sr1ptr,0.);
MultiArray<double,SRange,SubRange<SRange>,SRange> res2(sr3ptr,subptr,sr1ptr,0.);
Array<double,SRange,SRange> res(sr3ptr,sr1ptr,0.);
Array<double,SRange,SubRange<SRange>,SRange> res2(sr3ptr,subptr,sr1ptr,0.);
auto i1 = MAT::getIndex( sr1ptr );
auto i2 = MAT::getIndex( sr2ptr );

View file

@ -31,9 +31,9 @@ namespace
TEST_F(OpTest_Spin, Contract)
{
MultiArray<double,SR,SR,SR,SR,SR,SR,SR,SR> ma(sr, sr, sr, sr, sr, sr, sr, sr, data);
MultiArray<double,SR,SR> res1( sr, sr );
MultiArray<double,SR,SR> res2( sr, sr );
Array<double,SR,SR,SR,SR,SR,SR,SR,SR> ma(sr, sr, sr, sr, sr, sr, sr, sr, data);
Array<double,SR,SR> res1( sr, sr );
Array<double,SR,SR> res2( sr, sr );
auto alpha = MAT::getIndex<SR>();
auto beta = MAT::getIndex<SR>();
@ -47,7 +47,7 @@ namespace
res1(delta, deltap) += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix);
//res1(delta, deltap) += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap);
std::clock_t end = std::clock();
std::cout << "MultiArray time: " << static_cast<double>( end - begin ) / CLOCKS_PER_SEC
std::cout << "Array time: " << static_cast<double>( end - begin ) / CLOCKS_PER_SEC
<< std::endl;
res2(delta, deltap).par() += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(alpha).c(beta).c(gamma);

View file

@ -43,13 +43,13 @@ namespace
{
protected:
MultiArray<double,CR,DR> ma1;
MultiArray<double,CR,DR> ma2;
MultiArray<double,DR> ma3;
MultiArray<double,DR> ma5;
Array<double,CR,DR> ma1;
Array<double,CR,DR> ma2;
Array<double,DR> ma3;
Array<double,DR> ma5;
MultiArray<double,CR,DR> res1;
MultiArray<double,CR,DR> res2;
Array<double,CR,DR> res1;
Array<double,CR,DR> res2;
std::map<std::string,std::shared_ptr<IndexW>> imap;

View file

@ -165,8 +165,8 @@ namespace {
void OpTest_Spin::contract()
{
MultiArray<double,SR,SR,SR,SR,SR,SR,SR,SR> ma( sr, sr, sr, sr, sr, sr, sr, sr, data);
MultiArray<double,CR,SR,SR> res1( cr, sr, sr );
Array<double,SR,SR,SR,SR,SR,SR,SR,SR> ma( sr, sr, sr, sr, sr, sr, sr, sr, data);
Array<double,CR,SR,SR> res1( cr, sr, sr );
auto ii = MAT::getIndex<CR>(cr);
auto jj = MAT::getIndex<CR>(cr);
@ -221,7 +221,7 @@ namespace {
//tcast<v256>(res1)(ii ,delta, deltap).par() += tcast<v256>(ma)(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix);
//}
auto end = std::chrono::system_clock::now();
std::cout << "MultiArray time: " << std::chrono::duration<double>(end-begin).count()
std::cout << "Array time: " << std::chrono::duration<double>(end-begin).count()
<< std::endl;
assert( xround(res1.at(mkts(0,0,0))) == xround(vres[0]) );
@ -251,9 +251,9 @@ namespace {
#ifndef ONLY_SPIN
void OpTest_Performance::PCheck()
{
MultiArray<double,MRange> ma2(mrptr, cv2);
MultiArray<double,SRange> ma1(sr1ptr, cv1);
MultiArray<double,MRange> res(mrptr);
Array<double,MRange> ma2(mrptr, cv2);
Array<double,SRange> ma1(sr1ptr, cv1);
Array<double,MRange> res(mrptr);
auto si1 = MAT::getIndex(sr1ptr);
auto si2 = MAT::getIndex(sr2ptr);
@ -265,7 +265,7 @@ namespace {
res(mi) = ma2(mi) * ma1(si1);
std::clock_t end = std::clock();
std::cout << "MultiArray time: " << static_cast<double>( end - begin ) / CLOCKS_PER_SEC
std::cout << "Array time: " << static_cast<double>( end - begin ) / CLOCKS_PER_SEC
<< std::endl;
vector<double> res2(vs1*vs2);

View file

@ -35,7 +35,7 @@ namespace
typedef MRF::oType MRange;
typedef AnonymousRange ANO;
typedef MultiArray<double,ANO> AMA;
typedef Array<double,ANO> AMA;
OpTest_MDim()
{
@ -77,9 +77,9 @@ namespace
TEST_F(OpTest_1Dim, ExecOp)
{
MultiArray<double,SRange> ma1(srptr, v1);
MultiArray<double,SRange> ma2(srptr, v2);
MultiArray<double,SRange> res(srptr);
Array<double,SRange> ma1(srptr, v1);
Array<double,SRange> ma2(srptr, v2);
Array<double,SRange> res(srptr);
auto i = MAT::getIndex( srptr );
@ -94,10 +94,10 @@ namespace
TEST_F(OpTest_MDim, ExecOp1)
{
MultiArray<double,SRange,SRange> res(sr2ptr,sr4ptr);
MultiArray<double,SRange,SRange> res2(sr2ptr,sr4ptr);
const MultiArray<double,SRange> ma1(sr2ptr, v1);
const MultiArray<double,SRange> ma2(sr4ptr, v2);
Array<double,SRange,SRange> res(sr2ptr,sr4ptr);
Array<double,SRange,SRange> res2(sr2ptr,sr4ptr);
const Array<double,SRange> ma1(sr2ptr, v1);
const Array<double,SRange> ma2(sr4ptr, v2);
auto i1 = MAT::getIndex( sr2ptr );
auto i2 = MAT::getIndex( sr4ptr );
@ -127,9 +127,9 @@ namespace
TEST_F(OpTest_MDim, ExecContract)
{
MultiArray<double,SRange> res(sr2ptr);
const MultiArray<double,SRange> ma1(sr2ptr, v1);
const MultiArray<double,SRange> ma2(sr4ptr, v2);
Array<double,SRange> res(sr2ptr);
const Array<double,SRange> ma1(sr2ptr, v1);
const Array<double,SRange> ma2(sr4ptr, v2);
auto i1 = MAT::getIndex( sr2ptr );
auto i2 = MAT::getIndex( sr4ptr );
@ -143,10 +143,10 @@ namespace
TEST_F(OpTest_MDim, ExecOp2)
{
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
MultiArray<double,MRange> ma1(mr1ptr, v3);
MultiArray<double,SRange> ma2(sr4ptr, v2);
MultiArray<double,SRange> ma3(sr4ptr, v4);
Array<double,MRange,SRange> res(mr1ptr,sr4ptr);
Array<double,MRange> ma1(mr1ptr, v3);
Array<double,SRange> ma2(sr4ptr, v2);
Array<double,SRange> ma3(sr4ptr, v4);
auto i1 = MAT::getIndex( mr1ptr );
auto i2 = MAT::getIndex( sr4ptr );
@ -171,10 +171,10 @@ namespace
TEST_F(OpTest_MDim, ExecOpAnon)
{
MultiArray<double,MRange> ma1(mr1ptr, v3);
MultiArray<double,AnonymousRange> maa
= *std::dynamic_pointer_cast<MultiArray<double,AnonymousRange>>( ma1.anonymous() );
MultiArray<double,AnonymousRange> maa2( maa.template getRangePtr<0>() );
Array<double,MRange> ma1(mr1ptr, v3);
Array<double,AnonymousRange> maa
= *std::dynamic_pointer_cast<Array<double,AnonymousRange>>( ma1.anonymous() );
Array<double,AnonymousRange> maa2( maa.template getRangePtr<0>() );
auto ar = maa.template getRangePtr<0>();
auto i1 = MAT::getIndex( ar );
@ -188,10 +188,10 @@ namespace
TEST_F(OpTest_MDim, ExecFOp)
{
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
MultiArray<double,MRange> ma1(mr1ptr, v3);
MultiArray<double,SRange> ma2(sr4ptr, v2);
MultiArray<double,SRange> ma3(sr4ptr, v4);
Array<double,MRange,SRange> res(mr1ptr,sr4ptr);
Array<double,MRange> ma1(mr1ptr, v3);
Array<double,SRange> ma2(sr4ptr, v2);
Array<double,SRange> ma3(sr4ptr, v4);
auto i1 = MAT::getIndex( mr1ptr );
auto i2 = MAT::getIndex( sr4ptr );
@ -216,13 +216,13 @@ namespace
TEST_F(OpTest_MDim, ExecDOp)
{
//typedef MultiArray<double,AnonymousRange> AMA;
typedef MultiArray<double,DynamicRange> DMA;
//typedef Array<double,AnonymousRange> AMA;
typedef Array<double,DynamicRange> DMA;
MultiArray<double,MRange,SRange> ma1(mr1ptr,sr4ptr,v5);
MultiArray<double,SRange> ma2(sr2ptr,v1);
MultiArray<double,SRange,MRange> res(sr4ptr,mr1ptr);
MultiArray<double,MRange,SRange> res2(mr1ptr,sr4ptr);
Array<double,MRange,SRange> ma1(mr1ptr,sr4ptr,v5);
Array<double,SRange> ma2(sr2ptr,v1);
Array<double,SRange,MRange> res(sr4ptr,mr1ptr);
Array<double,MRange,SRange> res2(mr1ptr,sr4ptr);
DMA dma1 = *std::dynamic_pointer_cast<DMA>( dynamic( ma1 ) );
DMA dma2 = *std::dynamic_pointer_cast<DMA>( dynamic( ma2 ) );
@ -285,13 +285,13 @@ namespace
TEST_F(OpTest_MDim, ExecOp3)
{
MultiArray<double,MRange,SRange> res(mr1ptr,sr4ptr);
MultiArray<double,MRange> ma1(mr1ptr, v3);
MultiArray<double,SRange> ma2(sr2ptr, v1);
MultiArray<double,SRange> ma3(sr4ptr, v4);
MultiArray<double,SRange,SRange,SRange,SRange> ma4(sr1ptr,sr2ptr,sr3ptr,sr4ptr);
MultiArray<double,SRange> ma5(sr1ptr, v3);
MultiArray<double,SRange> ma6(sr3ptr, v2);
Array<double,MRange,SRange> res(mr1ptr,sr4ptr);
Array<double,MRange> ma1(mr1ptr, v3);
Array<double,SRange> ma2(sr2ptr, v1);
Array<double,SRange> ma3(sr4ptr, v4);
Array<double,SRange,SRange,SRange,SRange> ma4(sr1ptr,sr2ptr,sr3ptr,sr4ptr);
Array<double,SRange> ma5(sr1ptr, v3);
Array<double,SRange> ma6(sr3ptr, v2);
auto si0 = MAT::getIndex( sr1ptr ); // 'x'
auto si1 = MAT::getIndex( sr2ptr ); // '1'
@ -324,9 +324,9 @@ namespace
(*si3) = 0;
Slice<double,SRange,SRange> sl(sr4ptr,sr3ptr);
sl.define(si3,si2) = ma4(si0,si1,si2,si3);
MultiArrayBase<double,SRange,SRange>& slb = sl;
ArrayBase<double,SRange,SRange>& slb = sl;
MultiArray<double,SRange,SRange> ma8(sr3ptr,sr4ptr);
Array<double,SRange,SRange> ma8(sr3ptr,sr4ptr);
//ma8(si2,si3) = ma4(si0,si1,si2,si3);
ma8(si2,si3) = slb(si3,si2);