change ma templ args -> explicit subranges (compiles, unit tests work)
This commit is contained in:
parent
b50620a451
commit
f99e55d4fd
7 changed files with 239 additions and 254 deletions
|
@ -107,15 +107,15 @@ namespace MultiArrayTools
|
||||||
class ContainerIndex;
|
class ContainerIndex;
|
||||||
|
|
||||||
// multi_array.h
|
// multi_array.h
|
||||||
template <typename T, class Range>
|
template <typename T, class... SRanges>
|
||||||
class MultiArrayBase;
|
class MultiArrayBase;
|
||||||
|
|
||||||
// multi_array.h
|
// multi_array.h
|
||||||
template <typename T, class Range>
|
template <typename T, class... SRanges>
|
||||||
class MutableMultiArrayBase;
|
class MutableMultiArrayBase;
|
||||||
|
|
||||||
// multi_array.h
|
// multi_array.h
|
||||||
template <typename T, class Range>
|
template <typename T, class... SRanges>
|
||||||
class MultiArray;
|
class MultiArray;
|
||||||
|
|
||||||
// multi_array_operation.h
|
// multi_array_operation.h
|
||||||
|
|
|
@ -41,21 +41,15 @@ namespace {
|
||||||
typedef SingleRangeFactory<char,RangeType::ANY> SRF;
|
typedef SingleRangeFactory<char,RangeType::ANY> SRF;
|
||||||
typedef SRF::oType SRange;
|
typedef SRF::oType SRange;
|
||||||
|
|
||||||
typedef ContainerRangeFactory<SRange> CRF;
|
|
||||||
typedef CRF::oType CRange;
|
|
||||||
|
|
||||||
MATest_1Dim()
|
MATest_1Dim()
|
||||||
{
|
{
|
||||||
swapFactory<SRF>(rfbptr, {'x', 'y', 'l', 'f', 'g'} );
|
swapFactory<SRF>(rfbptr, {'x', 'y', 'l', 'f', 'g'} );
|
||||||
srptr = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
srptr = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
||||||
|
|
||||||
swapMFactory<CRF>(rfbptr, srptr);
|
|
||||||
crptr = std::dynamic_pointer_cast<CRange>( rfbptr->create() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RangeFactoryBase> rfbptr;
|
std::shared_ptr<RangeFactoryBase> rfbptr;
|
||||||
std::shared_ptr<SRange> srptr;
|
std::shared_ptr<SRange> srptr;
|
||||||
std::shared_ptr<CRange> crptr;
|
|
||||||
std::vector<double> vv = { 3.141, 2.718, 1.618, 0.693, 0.577 };
|
std::vector<double> vv = { 3.141, 2.718, 1.618, 0.693, 0.577 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -70,13 +64,6 @@ namespace {
|
||||||
typedef MultiRangeFactory<SRange,SRange> MRF;
|
typedef MultiRangeFactory<SRange,SRange> MRF;
|
||||||
typedef MRF::oType MRange;
|
typedef MRF::oType MRange;
|
||||||
|
|
||||||
typedef ContainerRangeFactory<MRange,SRange> CRF;
|
|
||||||
typedef CRF::oType CRange;
|
|
||||||
|
|
||||||
typedef ContainerRangeFactory<SRange> CRF2;
|
|
||||||
typedef CRF2::oType CRange2;
|
|
||||||
|
|
||||||
|
|
||||||
MATest_MDim()
|
MATest_MDim()
|
||||||
{
|
{
|
||||||
swapFactory<SRF>(rfbptr, {'x', 'y'} );
|
swapFactory<SRF>(rfbptr, {'x', 'y'} );
|
||||||
|
@ -96,8 +83,6 @@ namespace {
|
||||||
swapMFactory<MRF>(rfbptr, sr1ptr, sr2ptr);
|
swapMFactory<MRF>(rfbptr, sr1ptr, sr2ptr);
|
||||||
mrptr = std::dynamic_pointer_cast<MRange>( rfbptr->create() );
|
mrptr = std::dynamic_pointer_cast<MRange>( rfbptr->create() );
|
||||||
|
|
||||||
swapMFactory<CRF>(rfbptr, mrptr, sr3ptr);
|
|
||||||
crptr = std::dynamic_pointer_cast<CRange>( rfbptr->create() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RangeFactoryBase> rfbptr;
|
std::shared_ptr<RangeFactoryBase> rfbptr;
|
||||||
|
@ -106,7 +91,6 @@ namespace {
|
||||||
std::shared_ptr<SRange> sr3ptr;
|
std::shared_ptr<SRange> sr3ptr;
|
||||||
std::shared_ptr<SRange> sr4ptr;
|
std::shared_ptr<SRange> sr4ptr;
|
||||||
std::shared_ptr<MRange> mrptr;
|
std::shared_ptr<MRange> mrptr;
|
||||||
std::shared_ptr<CRange> crptr;
|
|
||||||
std::vector<double> vv = { 2.917, 9.436, 0.373, 7.192, 7.315, 1.536, 4.892, 0.280,
|
std::vector<double> vv = { 2.917, 9.436, 0.373, 7.192, 7.315, 1.536, 4.892, 0.280,
|
||||||
8.870, 4.790, 8.215, 5.063, 1.530, 3.084, 1.609, 4.847,
|
8.870, 4.790, 8.215, 5.063, 1.530, 3.084, 1.609, 4.847,
|
||||||
8.175, 0.112, 6.712, 6.408, 1.959, 0.331, 4.209, 2.951 };
|
8.175, 0.112, 6.712, 6.408, 1.959, 0.331, 4.209, 2.951 };
|
||||||
|
@ -114,7 +98,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(MATest_1Dim, SimpleCall)
|
TEST_F(MATest_1Dim, SimpleCall)
|
||||||
{
|
{
|
||||||
MultiArray<double,MATest_1Dim::CRange> ma(crptr, vv);
|
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
|
||||||
EXPECT_EQ( ma.size(), 5);
|
EXPECT_EQ( ma.size(), 5);
|
||||||
EXPECT_EQ( ma.isConst(), false);
|
EXPECT_EQ( ma.isConst(), false);
|
||||||
EXPECT_EQ( ma.isSlice(), false);
|
EXPECT_EQ( ma.isSlice(), false);
|
||||||
|
@ -131,7 +115,7 @@ namespace {
|
||||||
TEST_F(MATest_1Dim, ForLoop)
|
TEST_F(MATest_1Dim, ForLoop)
|
||||||
{
|
{
|
||||||
std::vector<double> v2 = { 0.693 , 2.718, 3.141, 1.618, 9.98 };
|
std::vector<double> v2 = { 0.693 , 2.718, 3.141, 1.618, 9.98 };
|
||||||
MultiArray<double,MATest_1Dim::CRange> ma(crptr, std::move( v2 ) );
|
MultiArray<double,MATest_1Dim::SRange> ma(srptr, std::move( v2 ) );
|
||||||
size_t cnt = 0;
|
size_t cnt = 0;
|
||||||
for(auto el: ma){
|
for(auto el: ma){
|
||||||
|
|
||||||
|
@ -157,14 +141,12 @@ namespace {
|
||||||
{
|
{
|
||||||
swapFactory<SRF>( rfbptr, { 'a', 'c', 'e', 'g', 'i' } );
|
swapFactory<SRF>( rfbptr, { 'a', 'c', 'e', 'g', 'i' } );
|
||||||
std::shared_ptr<SRange> sr2 = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
std::shared_ptr<SRange> sr2 = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
||||||
swapMFactory<CRF>( rfbptr, sr2 );
|
|
||||||
std::shared_ptr<CRange> cr2 = std::dynamic_pointer_cast<CRange>( rfbptr->create() );
|
|
||||||
|
|
||||||
MultiArray<double,MATest_1Dim::CRange> ma(crptr, vv);
|
MultiArray<double,MATest_1Dim::SRange> ma(srptr, vv);
|
||||||
auto i = ma.beginIndex();
|
auto i = ma.beginIndex();
|
||||||
EXPECT_EQ( ma[ i.at('x') ], 3.141);
|
EXPECT_EQ( ma[ i.at('x') ], 3.141);
|
||||||
|
|
||||||
auto ma2 = ma.format( cr2 );
|
auto ma2 = ma.format( sr2 );
|
||||||
auto j = ma2.beginIndex();
|
auto j = ma2.beginIndex();
|
||||||
|
|
||||||
EXPECT_EQ( ma[ j.at('a') ], 3.141);
|
EXPECT_EQ( ma[ j.at('a') ], 3.141);
|
||||||
|
@ -176,7 +158,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(MATest_MDim, SimpleCall)
|
TEST_F(MATest_MDim, SimpleCall)
|
||||||
{
|
{
|
||||||
MultiArray<double,MATest_MDim::CRange> ma(crptr, vv);
|
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
|
||||||
EXPECT_EQ( ma.size(), 24 );
|
EXPECT_EQ( ma.size(), 24 );
|
||||||
EXPECT_EQ( ma.range()->dim(), 2 );
|
EXPECT_EQ( ma.range()->dim(), 2 );
|
||||||
|
|
||||||
|
@ -193,7 +175,7 @@ namespace {
|
||||||
|
|
||||||
TEST_F(MATest_MDim, ReFormat)
|
TEST_F(MATest_MDim, ReFormat)
|
||||||
{
|
{
|
||||||
MultiArray<double,MATest_MDim::CRange> ma(crptr, vv);
|
MultiArray<double,MATest_MDim::MRange,MATest_MDim::SRange> ma(mrptr, sr3ptr, vv);
|
||||||
|
|
||||||
auto ma2 = ma.format( sr4ptr );
|
auto ma2 = ma.format( sr4ptr );
|
||||||
auto i = ma2.beginIndex();
|
auto i = ma2.beginIndex();
|
||||||
|
|
|
@ -8,136 +8,137 @@ namespace MultiArrayTools
|
||||||
* MultiArrayBase::const_iterator *
|
* MultiArrayBase::const_iterator *
|
||||||
**************************************/
|
**************************************/
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArrayBase<T,CRange>::const_iterator::const_iterator(const MultiArrayBase<T,CRange>& ma):
|
MultiArrayBase<T,SRanges...>::const_iterator::const_iterator(const MultiArrayBase<T,SRanges...>& ma):
|
||||||
mMAPtr(&ma), mPos(0) { }
|
mMAPtr(&ma), mPos(0) { }
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArrayBase<T,CRange>::const_iterator::const_iterator(const MultiArrayBase<T,CRange>& ma,
|
MultiArrayBase<T,SRanges...>::const_iterator::const_iterator(const MultiArrayBase<T,SRanges...>& ma,
|
||||||
const typename CRange::IndexType& index):
|
const typename CRange::IndexType& index):
|
||||||
mMAPtr(&ma), mPos(index.pos()) { }
|
mMAPtr(&ma), mPos(index.pos()) { }
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator==(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator==(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mMAPtr == it.mMAPtr and mPos == it.mPos;
|
return mMAPtr == it.mMAPtr and mPos == it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator!=(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator!=(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mMAPtr != it.mMAPtr or mPos != it.mPos;
|
return mMAPtr != it.mMAPtr or mPos != it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MultiArrayBase<T,CRange>::const_iterator::operator*() const
|
const T& MultiArrayBase<T,SRanges...>::const_iterator::operator*() const
|
||||||
{
|
{
|
||||||
return mMAPtr->data()[mPos];
|
return mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T const* MultiArrayBase<T,CRange>::const_iterator::operator->() const
|
T const* MultiArrayBase<T,SRanges...>::const_iterator::operator->() const
|
||||||
{
|
{
|
||||||
return &mMAPtr->data()[mPos];
|
return &mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator& MultiArrayBase<T,CRange>::const_iterator::operator++()
|
typename MultiArrayBase<T,SRanges...>::const_iterator& MultiArrayBase<T,SRanges...>::const_iterator::operator++()
|
||||||
{
|
{
|
||||||
++mPos;
|
++mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::const_iterator::operator++(int)
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::const_iterator::operator++(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp(*this);
|
const_iterator tmp(*this);
|
||||||
++mPos;
|
++mPos;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator& MultiArrayBase<T,CRange>::const_iterator::operator--()
|
typename MultiArrayBase<T,SRanges...>::const_iterator& MultiArrayBase<T,SRanges...>::const_iterator::operator--()
|
||||||
{
|
{
|
||||||
--mPos;
|
--mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::const_iterator::operator--(int)
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::const_iterator::operator--(int)
|
||||||
{
|
{
|
||||||
const_iterator tmp(*this);
|
const_iterator tmp(*this);
|
||||||
--mPos;
|
--mPos;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator& MultiArrayBase<T,CRange>::const_iterator::operator+=(int diff)
|
typename MultiArrayBase<T,SRanges...>::const_iterator& MultiArrayBase<T,SRanges...>::const_iterator::operator+=(int diff)
|
||||||
{
|
{
|
||||||
mPos += diff;
|
mPos += diff;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator& MultiArrayBase<T,CRange>::const_iterator::operator-=(int diff)
|
typename MultiArrayBase<T,SRanges...>::const_iterator& MultiArrayBase<T,SRanges...>::const_iterator::operator-=(int diff)
|
||||||
{
|
{
|
||||||
mPos -= diff;
|
mPos -= diff;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::const_iterator::operator+(int num) const
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::const_iterator::operator+(int num) const
|
||||||
{
|
{
|
||||||
const_iterator tmp(*this);
|
const_iterator tmp(*this);
|
||||||
tmp += num;
|
tmp += num;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::const_iterator::operator-(int num) const
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::const_iterator::operator-(int num) const
|
||||||
{
|
{
|
||||||
const_iterator tmp(*this);
|
const_iterator tmp(*this);
|
||||||
tmp -= num;
|
tmp -= num;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
int MultiArrayBase<T,CRange>::const_iterator::operator-(const const_iterator& it) const
|
int MultiArrayBase<T,SRanges...>::const_iterator::operator-(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos - it.mPos;
|
return mPos - it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MultiArrayBase<T,CRange>::const_iterator::operator[](int num) const
|
const T& MultiArrayBase<T,SRanges...>::const_iterator::operator[](int num) const
|
||||||
{
|
{
|
||||||
return *(operator+(num));
|
return *(operator+(num));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator<(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator<(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos < it.mPos;
|
return mPos < it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator>(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator>(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos > it.mPos;
|
return mPos > it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator<=(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator<=(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos <= it.mPos;
|
return mPos <= it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::const_iterator::operator>=(const const_iterator& it) const
|
bool MultiArrayBase<T,SRanges...>::const_iterator::operator>=(const const_iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos >= it.mPos;
|
return mPos >= it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename CRange::IndexType MultiArrayBase<T,CRange>::const_iterator::index() const
|
typename MultiArrayBase<T,SRanges...>::IndexType
|
||||||
|
MultiArrayBase<T,SRanges...>::const_iterator::index() const
|
||||||
{
|
{
|
||||||
auto i = mMAPtr->beginIndex();
|
auto i = mMAPtr->beginIndex();
|
||||||
i = mPos;
|
i = mPos;
|
||||||
|
@ -148,61 +149,67 @@ namespace MultiArrayTools
|
||||||
* MultiArrayBase *
|
* MultiArrayBase *
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArrayBase<T,CRange>::MultiArrayBase(const std::shared_ptr<CRange>& range) : mRange(range) {}
|
MultiArrayBase<T,SRanges...>::MultiArrayBase(const std::shared_ptr<SRanges>&... ranges)
|
||||||
|
{
|
||||||
|
ContainerRangeFactory<SRanges...> crf(ranges...);
|
||||||
|
mRange = std::dynamic_pointer_cast<ContainerRange<SRanges...> >( crf.create() );
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
size_t MultiArrayBase<T,CRange>::size() const
|
size_t MultiArrayBase<T,SRanges...>::size() const
|
||||||
{
|
{
|
||||||
return mRange->size();
|
return mRange->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::begin() const
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::begin() const
|
||||||
{
|
{
|
||||||
return const_iterator(*this, beginIndex());
|
return const_iterator(*this, beginIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MultiArrayBase<T,CRange>::const_iterator MultiArrayBase<T,CRange>::end() const
|
typename MultiArrayBase<T,SRanges...>::const_iterator MultiArrayBase<T,SRanges...>::end() const
|
||||||
{
|
{
|
||||||
return const_iterator(*this, endIndex());
|
return const_iterator(*this, endIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename CRange::IndexType MultiArrayBase<T,CRange>::beginIndex() const
|
typename MultiArrayBase<T,SRanges...>::IndexType
|
||||||
|
MultiArrayBase<T,SRanges...>::beginIndex() const
|
||||||
{
|
{
|
||||||
return mRange->begin();
|
return mRange->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename CRange::IndexType MultiArrayBase<T,CRange>::endIndex() const
|
typename MultiArrayBase<T,SRanges...>::IndexType
|
||||||
|
MultiArrayBase<T,SRanges...>::endIndex() const
|
||||||
{
|
{
|
||||||
return mRange->end();
|
return mRange->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const std::shared_ptr<CRange>& MultiArrayBase<T,CRange>::range() const
|
const std::shared_ptr<typename MultiArrayBase<T,SRanges...>::CRange>&
|
||||||
|
MultiArrayBase<T,SRanges...>::range() const
|
||||||
{
|
{
|
||||||
return mRange;
|
return mRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::isConst() const
|
bool MultiArrayBase<T,SRanges...>::isConst() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
template <class... SubRanges>
|
ConstOperationRoot<T,SRanges...>
|
||||||
ConstOperationRoot<T,SubRanges...>
|
MultiArrayBase<T,SRanges...>::operator()(std::shared_ptr<typename SRanges::IndexType>&... inds) const
|
||||||
MultiArrayBase<T,CRange>::operator()(std::shared_ptr<typename SubRanges::IndexType>&... inds) const
|
|
||||||
{
|
{
|
||||||
return ConstOperationRoot<T,SubRanges...>(*this, inds...);
|
return ConstOperationRoot<T,SRanges...>(*this, inds...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArrayBase<T,CRange>::isInit() const
|
bool MultiArrayBase<T,SRanges...>::isInit() const
|
||||||
{
|
{
|
||||||
return mInit;
|
return mInit;
|
||||||
}
|
}
|
||||||
|
@ -211,156 +218,157 @@ namespace MultiArrayTools
|
||||||
* MutableMultiArrayBase::iterator *
|
* MutableMultiArrayBase::iterator *
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MutableMultiArrayBase<T,CRange>::iterator::iterator(MutableMultiArrayBase<T,CRange>& ma):
|
MutableMultiArrayBase<T,SRanges...>::iterator::iterator(MutableMultiArrayBase<T,SRanges...>& ma):
|
||||||
mMAPtr(&ma), mPos(0)
|
mMAPtr(&ma), mPos(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MutableMultiArrayBase<T,CRange>::iterator::iterator(MutableMultiArrayBase<T,CRange>& ma,
|
MutableMultiArrayBase<T,SRanges...>::iterator::iterator(MutableMultiArrayBase<T,SRanges...>& ma,
|
||||||
const typename CRange::IndexType& index):
|
const typename CRange::IndexType& index):
|
||||||
mMAPtr(&ma), mPos(index.pos())
|
mMAPtr(&ma), mPos(index.pos())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator==(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator==(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mMAPtr == it.mMAPtr and mPos == it.mPos;
|
return mMAPtr == it.mMAPtr and mPos == it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator!=(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator!=(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mMAPtr != it.mMAPtr or mPos != it.mPos;
|
return mMAPtr != it.mMAPtr or mPos != it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MutableMultiArrayBase<T,CRange>::iterator::operator*() const
|
const T& MutableMultiArrayBase<T,SRanges...>::iterator::operator*() const
|
||||||
{
|
{
|
||||||
return mMAPtr->data()[mPos];
|
return mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T const* MutableMultiArrayBase<T,CRange>::iterator::operator->() const
|
T const* MutableMultiArrayBase<T,SRanges...>::iterator::operator->() const
|
||||||
{
|
{
|
||||||
return &mMAPtr->data()[mPos];
|
return &mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T& MutableMultiArrayBase<T,CRange>::iterator::operator*()
|
T& MutableMultiArrayBase<T,SRanges...>::iterator::operator*()
|
||||||
{
|
{
|
||||||
return mMAPtr->data()[mPos];
|
return mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T* MutableMultiArrayBase<T,CRange>::iterator::operator->()
|
T* MutableMultiArrayBase<T,SRanges...>::iterator::operator->()
|
||||||
{
|
{
|
||||||
return &mMAPtr->data()[mPos];
|
return &mMAPtr->data()[mPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator& MutableMultiArrayBase<T,CRange>::iterator::operator++()
|
typename MutableMultiArrayBase<T,SRanges...>::iterator& MutableMultiArrayBase<T,SRanges...>::iterator::operator++()
|
||||||
{
|
{
|
||||||
++mPos;
|
++mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::iterator::operator++(int)
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::iterator::operator++(int)
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
iterator tmp(*this);
|
||||||
++mPos;
|
++mPos;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator& MutableMultiArrayBase<T,CRange>::iterator::operator--()
|
typename MutableMultiArrayBase<T,SRanges...>::iterator& MutableMultiArrayBase<T,SRanges...>::iterator::operator--()
|
||||||
{
|
{
|
||||||
--mPos;
|
--mPos;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::iterator::operator--(int)
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::iterator::operator--(int)
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
iterator tmp(*this);
|
||||||
--mPos;
|
--mPos;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator& MutableMultiArrayBase<T,CRange>::iterator::operator+=(int diff)
|
typename MutableMultiArrayBase<T,SRanges...>::iterator& MutableMultiArrayBase<T,SRanges...>::iterator::operator+=(int diff)
|
||||||
{
|
{
|
||||||
mPos += diff;
|
mPos += diff;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator& MutableMultiArrayBase<T,CRange>::iterator::operator-=(int diff)
|
typename MutableMultiArrayBase<T,SRanges...>::iterator& MutableMultiArrayBase<T,SRanges...>::iterator::operator-=(int diff)
|
||||||
{
|
{
|
||||||
mPos -= diff;
|
mPos -= diff;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::iterator::operator+(int num) const
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::iterator::operator+(int num) const
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
iterator tmp(*this);
|
||||||
tmp += num;
|
tmp += num;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::iterator::operator-(int num) const
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::iterator::operator-(int num) const
|
||||||
{
|
{
|
||||||
iterator tmp(*this);
|
iterator tmp(*this);
|
||||||
tmp -= num;
|
tmp -= num;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
int MutableMultiArrayBase<T,CRange>::iterator::operator-(const iterator& it) const
|
int MutableMultiArrayBase<T,SRanges...>::iterator::operator-(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos - it.mPos;
|
return mPos - it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MutableMultiArrayBase<T,CRange>::iterator::operator[](int num) const
|
const T& MutableMultiArrayBase<T,SRanges...>::iterator::operator[](int num) const
|
||||||
{
|
{
|
||||||
return *(operator+(num));
|
return *(operator+(num));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T& MutableMultiArrayBase<T,CRange>::iterator::operator[](int num)
|
T& MutableMultiArrayBase<T,SRanges...>::iterator::operator[](int num)
|
||||||
{
|
{
|
||||||
return *(operator+(num));
|
return *(operator+(num));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator<(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator<(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos < it.mPos;
|
return mPos < it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator>(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator>(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos > it.mPos;
|
return mPos > it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator<=(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator<=(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos <= it.mPos;
|
return mPos <= it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::iterator::operator>=(const iterator& it) const
|
bool MutableMultiArrayBase<T,SRanges...>::iterator::operator>=(const iterator& it) const
|
||||||
{
|
{
|
||||||
return mPos >= it.mPos;
|
return mPos >= it.mPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename CRange::IndexType MutableMultiArrayBase<T,CRange>::iterator::index() const
|
typename MutableMultiArrayBase<T,SRanges...>::IndexType
|
||||||
|
MutableMultiArrayBase<T,SRanges...>::iterator::index() const
|
||||||
{
|
{
|
||||||
auto i = mMAPtr->beginIndex();
|
auto i = mMAPtr->beginIndex();
|
||||||
i = mPos;
|
i = mPos;
|
||||||
|
@ -371,51 +379,50 @@ namespace MultiArrayTools
|
||||||
* MutableMultiArrayBase *
|
* MutableMultiArrayBase *
|
||||||
******************************/
|
******************************/
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MutableMultiArrayBase<T,CRange>::MutableMultiArrayBase(const std::shared_ptr<CRange>& range) :
|
MutableMultiArrayBase<T,SRanges...>::MutableMultiArrayBase(const std::shared_ptr<SRanges>&... ranges) :
|
||||||
MultiArrayBase<T,CRange>(range) {}
|
MultiArrayBase<T,SRanges...>(ranges...) {}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::begin()
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::begin()
|
||||||
{
|
{
|
||||||
return iterator(*this, MAB::beginIndex());
|
return iterator(*this, MAB::beginIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
typename MutableMultiArrayBase<T,CRange>::iterator MutableMultiArrayBase<T,CRange>::end()
|
typename MutableMultiArrayBase<T,SRanges...>::iterator MutableMultiArrayBase<T,SRanges...>::end()
|
||||||
{
|
{
|
||||||
return iterator(*this, MAB::endIndex());
|
return iterator(*this, MAB::endIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MutableMultiArrayBase<T,CRange>::isConst() const
|
bool MutableMultiArrayBase<T,SRanges...>::isConst() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
template <class... SubRanges>
|
OperationRoot<T,SRanges...>
|
||||||
OperationRoot<T,SubRanges...>
|
MutableMultiArrayBase<T,SRanges...>::operator()(std::shared_ptr<typename SRanges::IndexType>&... inds)
|
||||||
MutableMultiArrayBase<T,CRange>::operator()(std::shared_ptr<typename SubRanges::IndexType>&... inds)
|
|
||||||
{
|
{
|
||||||
return OperationRoot<T,SubRanges...>(*this, inds...);
|
return OperationRoot<T,SRanges...>(*this, inds...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* MultiArray *
|
* MultiArray *
|
||||||
*******************/
|
*******************/
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArray<T,CRange>::MultiArray(const std::shared_ptr<CRange>& range) :
|
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges) :
|
||||||
MutableMultiArrayBase<T,CRange>(range),
|
MutableMultiArrayBase<T,SRanges...>(ranges...),
|
||||||
mCont(MAB::mRange->size())
|
mCont(MAB::mRange->size())
|
||||||
{
|
{
|
||||||
MAB::mInit = true;
|
MAB::mInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArray<T,CRange>::MultiArray(const std::shared_ptr<CRange>& range, const std::vector<T>& vec) :
|
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, const std::vector<T>& vec) :
|
||||||
MutableMultiArrayBase<T,CRange>(range),
|
MutableMultiArrayBase<T,SRanges...>(ranges...),
|
||||||
mCont(vec)
|
mCont(vec)
|
||||||
{
|
{
|
||||||
MAB::mInit = true;
|
MAB::mInit = true;
|
||||||
|
@ -424,9 +431,9 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
MultiArray<T,CRange>::MultiArray(const std::shared_ptr<CRange>& range, std::vector<T>&& vec) :
|
MultiArray<T,SRanges...>::MultiArray(const std::shared_ptr<SRanges>&... ranges, std::vector<T>&& vec) :
|
||||||
MutableMultiArrayBase<T,CRange>(range),
|
MutableMultiArrayBase<T,SRanges...>(ranges...),
|
||||||
mCont(vec)
|
mCont(vec)
|
||||||
{
|
{
|
||||||
MAB::mInit = true;
|
MAB::mInit = true;
|
||||||
|
@ -434,11 +441,11 @@ namespace MultiArrayTools
|
||||||
mCont.erase(mCont.begin() + MAB::mRange->size(), mCont.end());
|
mCont.erase(mCont.begin() + MAB::mRange->size(), mCont.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
template <class Range2, class Range3>
|
template <class Range2, class Range3>
|
||||||
MultiArray<T,CRange>::MultiArray(const MultiArray<MultiArray<T,Range2>,Range3> in) :
|
MultiArray<T,SRanges...>::MultiArray(const MultiArray<MultiArray<T,Range2>,Range3> in) :
|
||||||
MutableMultiArrayBase<T,CRange>(merge(in.range(), in[ in.beginIndex() ].range()))
|
MutableMultiArrayBase<T,SRanges...>(merge(in.range(), in[ in.beginIndex() ].range()))
|
||||||
// assert that Range2 has always same extension
|
// assert that Range2 has always same extension
|
||||||
{
|
{
|
||||||
MAB::mInit = true;
|
MAB::mInit = true;
|
||||||
|
@ -448,11 +455,11 @@ namespace MultiArrayTools
|
||||||
}
|
}
|
||||||
assert(mCont.size() == MAB::mRange->size());
|
assert(mCont.size() == MAB::mRange->size());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
template <class Range2, class Range3>
|
template <class Range2, class Range3>
|
||||||
MultiArray<T,CRange>& MultiArray<T,CRange>::operator=(const MultiArray<MultiArray<T,Range2>,Range3> in)
|
MultiArray<T,SRanges...>& MultiArray<T,SRanges...>::operator=(const MultiArray<MultiArray<T,Range2>,Range3> in)
|
||||||
{
|
{
|
||||||
MAB::mRange.reset(new Range(merge(in.range(), in[ in.beginIndex() ].range())));
|
MAB::mRange.reset(new Range(merge(in.range(), in[ in.beginIndex() ].range())));
|
||||||
// assert that Range2 has always same extension
|
// assert that Range2 has always same extension
|
||||||
|
@ -464,65 +471,64 @@ namespace MultiArrayTools
|
||||||
return *this;
|
return *this;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T& MultiArray<T,CRange>::operator[](const typename CRange::IndexType& i)
|
T& MultiArray<T,SRanges...>::operator[](const typename CRange::IndexType& i)
|
||||||
{
|
{
|
||||||
return mCont[ i.pos() ];
|
return mCont[ i.pos() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MultiArray<T,CRange>::operator[](const typename CRange::IndexType& i) const
|
const T& MultiArray<T,SRanges...>::operator[](const typename CRange::IndexType& i) const
|
||||||
{
|
{
|
||||||
return mCont[ i.pos() ];
|
return mCont[ i.pos() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T& MultiArray<T,CRange>::at(const typename CRange::IndexType::MetaType& meta)
|
T& MultiArray<T,SRanges...>::at(const typename CRange::IndexType::MetaType& meta)
|
||||||
{
|
{
|
||||||
return mCont[ MAB::beginIndex().at(meta).pos() ];
|
return mCont[ MAB::beginIndex().at(meta).pos() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T& MultiArray<T,CRange>::at(const typename CRange::IndexType::MetaType& meta) const
|
const T& MultiArray<T,SRanges...>::at(const typename CRange::IndexType::MetaType& meta) const
|
||||||
{
|
{
|
||||||
return mCont[ MAB::beginIndex().at(meta).pos() ];
|
return mCont[ MAB::beginIndex().at(meta).pos() ];
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArray<T,CRange>::isConst() const
|
bool MultiArray<T,SRanges...>::isConst() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
bool MultiArray<T,CRange>::isSlice() const
|
bool MultiArray<T,SRanges...>::isSlice() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
template <class Range2>
|
template <class... SRanges2>
|
||||||
MultiArray<T,Range2> MultiArray<T,CRange>::format(const std::shared_ptr<Range2>& nr)
|
MultiArray<T,SRanges2...> MultiArray<T,SRanges...>::format(const std::shared_ptr<SRanges2>&... nrs)
|
||||||
{
|
{
|
||||||
assert(MAB::mRange->size() == nr->size());
|
return MultiArray<T,SRanges2...>( nrs... , std::move(mCont) );
|
||||||
return MultiArray<T,Range2>( nr, std::move(mCont) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
const T* MultiArray<T,CRange>::data() const
|
const T* MultiArray<T,SRanges...>::data() const
|
||||||
{
|
{
|
||||||
return mCont.data();
|
return mCont.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
T* MultiArray<T,CRange>::data()
|
T* MultiArray<T,SRanges...>::data()
|
||||||
{
|
{
|
||||||
return mCont.data();
|
return mCont.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
void MultiArray<T,CRange>::manipulate(ManipulatorBase<T>& mb,
|
void MultiArray<T,SRanges...>::manipulate(ManipulatorBase<T>& mb,
|
||||||
const typename Range::IndexType& manBegin,
|
const typename Range::IndexType& manBegin,
|
||||||
const typename Range::IndexType& manEnd)
|
const typename Range::IndexType& manEnd)
|
||||||
{
|
{
|
||||||
|
@ -539,28 +545,28 @@ namespace MultiArrayTools
|
||||||
/*
|
/*
|
||||||
template <typename T, class Range, class Function>
|
template <typename T, class Range, class Function>
|
||||||
FunctionalMultiArray<T,Range,Function>::FunctionalMultiArray(const Range& range) :
|
FunctionalMultiArray<T,Range,Function>::FunctionalMultiArray(const Range& range) :
|
||||||
MultiArrayBase<T,CRange>(range), mFunc() {}
|
MultiArrayBase<T,SRanges...>(range), mFunc() {}
|
||||||
*/
|
*/
|
||||||
template <typename T, class CRange, class Function>
|
template <typename T, class Function, class... SRanges>
|
||||||
FunctionalMultiArray<T,CRange,Function>::FunctionalMultiArray(const std::shared_ptr<CRange>& range,
|
FunctionalMultiArray<T,Function,SRanges...>::FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges,
|
||||||
const Function& func) :
|
const Function& func) :
|
||||||
MultiArrayBase<T,CRange>(range), mFunc(func) {}
|
MultiArrayBase<T,SRanges...>(ranges...), mFunc(func) {}
|
||||||
|
|
||||||
template <typename T, class CRange, class Function>
|
template <typename T, class Function, class... SRanges>
|
||||||
const T& FunctionalMultiArray<T,CRange,Function>::operator[](const typename CRange::IndexType& i) const
|
const T& FunctionalMultiArray<T,Function,SRanges...>::operator[](const typename CRange::IndexType& i) const
|
||||||
{
|
{
|
||||||
mVal = mFunc(i);
|
mVal = mFunc(i);
|
||||||
return mVal;
|
return mVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange, class Function>
|
template <typename T, class Function, class... SRanges>
|
||||||
bool FunctionalMultiArray<T,CRange,Function>::isConst() const
|
bool FunctionalMultiArray<T,Function,SRanges...>::isConst() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, class CRange, class Function>
|
template <typename T, class Function, class... SRanges>
|
||||||
bool FunctionalMultiArray<T,CRange,Function>::isSlice() const
|
bool FunctionalMultiArray<T,Function,SRanges...>::isSlice() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,14 @@ namespace MultiArrayTools
|
||||||
{
|
{
|
||||||
|
|
||||||
// Explicitely specify subranges in template argument !!!
|
// Explicitely specify subranges in template argument !!!
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
class MultiArrayBase
|
class MultiArrayBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef T value_type;
|
typedef T value_type;
|
||||||
|
typedef ContainerRange<SRanges...> CRange;
|
||||||
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
class const_iterator : public std::iterator<std::random_access_iterator_tag,T>
|
class const_iterator : public std::iterator<std::random_access_iterator_tag,T>
|
||||||
{
|
{
|
||||||
|
@ -63,15 +65,15 @@ namespace MultiArrayTools
|
||||||
bool operator>=(const const_iterator& it) const;
|
bool operator>=(const const_iterator& it) const;
|
||||||
|
|
||||||
// Multi Array specific:
|
// Multi Array specific:
|
||||||
typename CRange::IndexType index() const;
|
typename ContainerRange<SRanges...>::IndexType index() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MultiArrayBase const* mMAPtr = nullptr;
|
MultiArrayBase const* mMAPtr = nullptr;
|
||||||
size_t mPos;
|
size_t mPos;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFAULT_MEMBERS(MultiArrayBase);
|
DEFAULT_MEMBERS(MultiArrayBase);
|
||||||
MultiArrayBase(const std::shared_ptr<CRange>& range);
|
MultiArrayBase(const std::shared_ptr<SRanges>&... ranges);
|
||||||
|
|
||||||
virtual ~MultiArrayBase() = default;
|
virtual ~MultiArrayBase() = default;
|
||||||
|
|
||||||
|
@ -86,15 +88,14 @@ namespace MultiArrayTools
|
||||||
virtual const_iterator begin() const;
|
virtual const_iterator begin() const;
|
||||||
virtual const_iterator end() const;
|
virtual const_iterator end() const;
|
||||||
|
|
||||||
virtual typename CRange::IndexType beginIndex() const;
|
virtual IndexType beginIndex() const;
|
||||||
virtual typename CRange::IndexType endIndex() const;
|
virtual IndexType endIndex() const;
|
||||||
|
|
||||||
virtual const std::shared_ptr<CRange>& range() const;
|
virtual const std::shared_ptr<CRange>& range() const;
|
||||||
|
|
||||||
virtual bool isConst() const;
|
virtual bool isConst() const;
|
||||||
|
|
||||||
template <class... SubRanges>
|
ConstOperationRoot<T,SRanges...> operator()(std::shared_ptr<typename SRanges::IndexType>&... inds) const;
|
||||||
ConstOperationRoot<T,SubRanges...> operator()(std::shared_ptr<typename SubRanges::IndexType>&... inds) const;
|
|
||||||
|
|
||||||
virtual bool isInit() const;
|
virtual bool isInit() const;
|
||||||
|
|
||||||
|
@ -104,13 +105,14 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
class MutableMultiArrayBase : public MultiArrayBase<T,CRange>
|
class MutableMultiArrayBase : public MultiArrayBase<T,SRanges...>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename MultiArrayBase<T,CRange>::const_iterator const_iterator;
|
typedef ContainerRange<SRanges...> CRange;
|
||||||
typedef MultiArrayBase<T,CRange> MAB;
|
typedef typename MultiArrayBase<T,SRanges...>::const_iterator const_iterator;
|
||||||
|
typedef MultiArrayBase<T,SRanges...> MAB;
|
||||||
typedef typename CRange::IndexType IndexType;
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
class iterator : public std::iterator<std::random_access_iterator_tag,T>,
|
class iterator : public std::iterator<std::random_access_iterator_tag,T>,
|
||||||
|
@ -163,7 +165,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_MEMBERS(MutableMultiArrayBase);
|
DEFAULT_MEMBERS(MutableMultiArrayBase);
|
||||||
MutableMultiArrayBase(const std::shared_ptr<CRange>& range);
|
MutableMultiArrayBase(const std::shared_ptr<SRanges>&... ranges);
|
||||||
|
|
||||||
virtual T& operator[](const IndexType& i) = 0;
|
virtual T& operator[](const IndexType& i) = 0;
|
||||||
virtual T& at(const typename CRange::IndexType::MetaType& meta) = 0;
|
virtual T& at(const typename CRange::IndexType::MetaType& meta) = 0;
|
||||||
|
@ -175,27 +177,27 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
virtual bool isConst() const override;
|
virtual bool isConst() const override;
|
||||||
|
|
||||||
template <class... SubRanges>
|
OperationRoot<T,SRanges...> operator()(std::shared_ptr<typename SRanges::IndexType>&... inds);
|
||||||
OperationRoot<T,SubRanges...> operator()(std::shared_ptr<typename SubRanges::IndexType>&... inds);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class CRange>
|
template <typename T, class... SRanges>
|
||||||
class MultiArray : public MutableMultiArrayBase<T,CRange>
|
class MultiArray : public MutableMultiArrayBase<T,SRanges...>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef MultiArrayBase<T,CRange> MAB;
|
typedef ContainerRange<SRanges...> CRange;
|
||||||
typedef typename MultiArrayBase<T,CRange>::const_iterator const_iterator;
|
typedef MultiArrayBase<T,SRanges...> MAB;
|
||||||
typedef typename MutableMultiArrayBase<T,CRange>::iterator iterator;
|
typedef typename MultiArrayBase<T,SRanges...>::const_iterator const_iterator;
|
||||||
|
typedef typename MutableMultiArrayBase<T,SRanges...>::iterator iterator;
|
||||||
typedef typename CRange::IndexType IndexType;
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
DEFAULT_MEMBERS(MultiArray);
|
DEFAULT_MEMBERS(MultiArray);
|
||||||
MultiArray(const std::shared_ptr<CRange>& range);
|
MultiArray(const std::shared_ptr<SRanges>&... ranges);
|
||||||
MultiArray(const std::shared_ptr<CRange>& range, const std::vector<T>& vec);
|
MultiArray(const std::shared_ptr<SRanges>&... ranges, const std::vector<T>& vec);
|
||||||
MultiArray(const std::shared_ptr<CRange>& range, std::vector<T>&& vec);
|
MultiArray(const std::shared_ptr<SRanges>&... ranges, std::vector<T>&& vec);
|
||||||
|
|
||||||
template <class Range2, class Range3>
|
// template <class Range2, class Range3>
|
||||||
MultiArray(const MultiArray<MultiArray<T,Range2>,Range3> in);
|
// MultiArray(const MultiArray<MultiArray<T,Range2>,Range3> in);
|
||||||
|
|
||||||
// implement contstructor using FunctionalMultiArray as Input !!!
|
// implement contstructor using FunctionalMultiArray as Input !!!
|
||||||
|
|
||||||
|
@ -210,8 +212,8 @@ namespace MultiArrayTools
|
||||||
virtual bool isConst() const override;
|
virtual bool isConst() const override;
|
||||||
virtual bool isSlice() const override;
|
virtual bool isSlice() const override;
|
||||||
|
|
||||||
template <class Range2>
|
template <class... SRanges2>
|
||||||
MultiArray<T,Range2> format(const std::shared_ptr<Range2>& nr); // reformat array using 'nr' which in
|
MultiArray<T,SRanges2...> format(const std::shared_ptr<SRanges2>&... nrs); // reformat array using 'nr' which in
|
||||||
// total must have the same size as mRange
|
// total must have the same size as mRange
|
||||||
|
|
||||||
const T* data() const override;
|
const T* data() const override;
|
||||||
|
@ -221,24 +223,26 @@ namespace MultiArrayTools
|
||||||
// const typename CRange::IndexType& manBegin,
|
// const typename CRange::IndexType& manBegin,
|
||||||
// const typename CRange::IndexType& manEnd);
|
// const typename CRange::IndexType& manEnd);
|
||||||
|
|
||||||
template <typename U, class RangeX>
|
template <typename U, class... SRanges2>
|
||||||
friend class MultiArray;
|
friend class MultiArray;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<T> mCont;
|
std::vector<T> mCont;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, class CRange, class Function>
|
template <typename T, class Function, class... SRanges>
|
||||||
class FunctionalMultiArray : public MultiArrayBase<T,CRange>
|
class FunctionalMultiArray : public MultiArrayBase<T,SRanges...>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef ContainerRange<SRanges...> CRange;
|
||||||
typedef MultiArrayBase<T,CRange> MAB;
|
typedef MultiArrayBase<T,CRange> MAB;
|
||||||
typedef typename MultiArrayBase<T,CRange>::const_iterator const_iterator;
|
typedef typename MultiArrayBase<T,CRange>::const_iterator const_iterator;
|
||||||
typedef typename CRange::IndexType IndexType;
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
DEFAULT_MEMBERS(FunctionalMultiArray);
|
DEFAULT_MEMBERS(FunctionalMultiArray);
|
||||||
//FunctionalMultiArray(const CRange& range);
|
//FunctionalMultiArray(const CRange& range);
|
||||||
FunctionalMultiArray(const std::shared_ptr<CRange>& range, const Function& func);
|
FunctionalMultiArray(const std::shared_ptr<SRanges>&... ranges, const Function& func);
|
||||||
|
|
||||||
virtual const T& operator[](const IndexType& i) const override;
|
virtual const T& operator[](const IndexType& i) const override;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
OperationMaster<T,Ranges...>::
|
OperationMaster<T,Ranges...>::
|
||||||
OperationMaster(MutableMultiArrayBase<T,CRange>& ma, const OperationBase<T>& second,
|
OperationMaster(MutableMultiArrayBase<T,Ranges...>& ma, const OperationBase<T>& second,
|
||||||
std::shared_ptr<typename CRange::IndexType>& index) :
|
std::shared_ptr<typename CRange::IndexType>& index) :
|
||||||
mSecond(second), mArrayRef(ma), mIndex()
|
mSecond(second), mArrayRef(ma), mIndex()
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
ConstOperationRoot<T,Ranges...>::
|
ConstOperationRoot<T,Ranges...>::
|
||||||
ConstOperationRoot(const MultiArrayBase<T,CRange>& ma,
|
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
||||||
OperationBase<T>(), OperationTemplate<ConstOperationRoot<T,Ranges...> >(this),
|
OperationBase<T>(), OperationTemplate<ConstOperationRoot<T,Ranges...> >(this),
|
||||||
mArrayRef(ma), mIndex( std::make_shared<IndexType>( mArrayRef.range() ) )
|
mArrayRef(ma), mIndex( std::make_shared<IndexType>( mArrayRef.range() ) )
|
||||||
|
@ -86,7 +86,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
template <typename T, class... Ranges>
|
template <typename T, class... Ranges>
|
||||||
OperationRoot<T,Ranges...>::
|
OperationRoot<T,Ranges...>::
|
||||||
OperationRoot(MutableMultiArrayBase<T,CRange>& ma,
|
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
const std::shared_ptr<typename Ranges::IndexType>&... indices) :
|
||||||
MutableOperationBase<T>(), OperationTemplate<OperationRoot<T,Ranges...> >(this),
|
MutableOperationBase<T>(), OperationTemplate<OperationRoot<T,Ranges...> >(this),
|
||||||
mArrayRef(ma), mIndex( std::make_shared<IndexType>( mArrayRef.range() ) )
|
mArrayRef(ma), mIndex( std::make_shared<IndexType>( mArrayRef.range() ) )
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace MultiArrayTools
|
||||||
typedef ContainerRange<Ranges...> CRange;
|
typedef ContainerRange<Ranges...> CRange;
|
||||||
typedef typename MultiRange<Ranges...>::IndexType IndexType;
|
typedef typename MultiRange<Ranges...>::IndexType IndexType;
|
||||||
|
|
||||||
OperationMaster(MutableMultiArrayBase<T,CRange>& ma, const OperationBase<T>& second,
|
OperationMaster(MutableMultiArrayBase<T,Ranges...>& ma, const OperationBase<T>& second,
|
||||||
std::shared_ptr<typename CRange::IndexType>& index);
|
std::shared_ptr<typename CRange::IndexType>& index);
|
||||||
|
|
||||||
virtual T& get() override;
|
virtual T& get() override;
|
||||||
|
@ -80,7 +80,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
//void performAssignment(const OperationBase<T>& in);
|
//void performAssignment(const OperationBase<T>& in);
|
||||||
OperationBase<T> const& mSecond;
|
OperationBase<T> const& mSecond;
|
||||||
MutableMultiArrayBase<T,CRange>& mArrayRef;
|
MutableMultiArrayBase<T,Ranges...>& mArrayRef;
|
||||||
std::shared_ptr<IndexType> mIndex;
|
std::shared_ptr<IndexType> mIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,14 +96,14 @@ namespace MultiArrayTools
|
||||||
typedef ContainerRange<Ranges...> CRange;
|
typedef ContainerRange<Ranges...> CRange;
|
||||||
typedef typename CRange::IndexType IndexType;
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
ConstOperationRoot(const MultiArrayBase<T,CRange>& ma,
|
ConstOperationRoot(const MultiArrayBase<T,Ranges...>& ma,
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
||||||
|
|
||||||
virtual const T& get() const override;
|
virtual const T& get() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
MultiArrayBase<T,CRange> const& mArrayRef;
|
MultiArrayBase<T,Ranges...> const& mArrayRef;
|
||||||
std::shared_ptr<IndexType> mIndex;
|
std::shared_ptr<IndexType> mIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ namespace MultiArrayTools
|
||||||
typedef ContainerRange<Ranges...> CRange;
|
typedef ContainerRange<Ranges...> CRange;
|
||||||
typedef typename CRange::IndexType IndexType;
|
typedef typename CRange::IndexType IndexType;
|
||||||
|
|
||||||
OperationRoot(MutableMultiArrayBase<T,CRange>& ma,
|
OperationRoot(MutableMultiArrayBase<T,Ranges...>& ma,
|
||||||
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
const std::shared_ptr<typename Ranges::IndexType>&... indices);
|
||||||
|
|
||||||
OperationMaster<T,Ranges...> operator=(const OperationBase<T>& in);
|
OperationMaster<T,Ranges...> operator=(const OperationBase<T>& in);
|
||||||
|
@ -128,7 +128,7 @@ namespace MultiArrayTools
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
MutableMultiArrayBase<T,CRange>& mArrayRef;
|
MutableMultiArrayBase<T,Ranges...>& mArrayRef;
|
||||||
std::shared_ptr<IndexType> mIndex;
|
std::shared_ptr<IndexType> mIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,33 +40,26 @@ namespace {
|
||||||
typedef SingleRangeFactory<char,RangeType::ANY> SRF;
|
typedef SingleRangeFactory<char,RangeType::ANY> SRF;
|
||||||
typedef SRF::oType SRange;
|
typedef SRF::oType SRange;
|
||||||
|
|
||||||
typedef ContainerRangeFactory<SRange> CRF;
|
|
||||||
typedef CRF::oType CRange;
|
|
||||||
|
|
||||||
OpTest_1Dim()
|
OpTest_1Dim()
|
||||||
{
|
{
|
||||||
swapFactory<SRF>(rfbptr, {'a', 'l', 'f', 'g'} );
|
swapFactory<SRF>(rfbptr, {'a', 'l', 'f', 'g'} );
|
||||||
srptr = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
srptr = std::dynamic_pointer_cast<SRange>( rfbptr->create() );
|
||||||
|
|
||||||
swapMFactory<CRF>(rfbptr, srptr);
|
|
||||||
crptr = std::dynamic_pointer_cast<CRange>( rfbptr->create() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RangeFactoryBase> rfbptr;
|
std::shared_ptr<RangeFactoryBase> rfbptr;
|
||||||
std::shared_ptr<SRange> srptr;
|
std::shared_ptr<SRange> srptr;
|
||||||
std::shared_ptr<CRange> crptr;
|
|
||||||
std::vector<double> v1 = { 2.917, 9.436, 0.373, 7.192 };
|
std::vector<double> v1 = { 2.917, 9.436, 0.373, 7.192 };
|
||||||
std::vector<double> v2 = { 8.870, 4.790, 8.215, 5.063 };
|
std::vector<double> v2 = { 8.870, 4.790, 8.215, 5.063 };
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(OpTest_1Dim, ExecOp)
|
TEST_F(OpTest_1Dim, ExecOp)
|
||||||
{
|
{
|
||||||
MultiArray<double,CRange> ma1(crptr, v1);
|
MultiArray<double,SRange> ma1(srptr, v1);
|
||||||
MultiArray<double,CRange> ma2(crptr, v2);
|
MultiArray<double,SRange> ma2(srptr, v2);
|
||||||
MultiArray<double,CRange> res(crptr);
|
MultiArray<double,SRange> res(srptr);
|
||||||
|
|
||||||
auto i = std::dynamic_pointer_cast<SRange::IndexType>( srptr->index() );
|
auto i = std::dynamic_pointer_cast<SRange::IndexType>( srptr->index() );
|
||||||
res.operator()<SRange>(i) = ma1.operator()<SRange>(i) + ma2.operator()<SRange>(i);
|
res(i) = ma1(i) + ma2(i);
|
||||||
|
|
||||||
EXPECT_EQ( fabs( res.at('a') - (2.917+8.870) ) < 0.0001, true);
|
EXPECT_EQ( fabs( res.at('a') - (2.917+8.870) ) < 0.0001, true);
|
||||||
EXPECT_EQ( fabs( res.at('l') - (9.436+4.790) ) < 0.0001, true );
|
EXPECT_EQ( fabs( res.at('l') - (9.436+4.790) ) < 0.0001, true );
|
||||||
|
|
Loading…
Reference in a new issue