fix cathastrophic bug (although it did not affect anything so far)
This commit is contained in:
parent
f6372fcbdb
commit
1f88bd2c58
5 changed files with 50 additions and 6 deletions
|
@ -8,6 +8,41 @@ namespace MultiArrayTools
|
|||
* MultiArrayBase *
|
||||
**********************/
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
MultiArrayBase<T,SRanges...>::MultiArrayBase(const MultiArrayBase& in) :
|
||||
mInit(in.mInit),
|
||||
mRange(in.mRange)
|
||||
{
|
||||
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
MultiArrayBase<T,SRanges...>::MultiArrayBase(MultiArrayBase&& in) :
|
||||
mInit(in.mInit),
|
||||
mRange(in.mRange)
|
||||
{
|
||||
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
MultiArrayBase<T,SRanges...>& MultiArrayBase<T,SRanges...>::operator=(const MultiArrayBase& in)
|
||||
{
|
||||
mInit = in.mInit;
|
||||
mRange = in.mRange;
|
||||
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
MultiArrayBase<T,SRanges...>& MultiArrayBase<T,SRanges...>::operator=(MultiArrayBase&& in)
|
||||
{
|
||||
mInit = in.mInit;
|
||||
mRange = in.mRange;
|
||||
mProtoI = std::make_shared<IndexType>( mRange, reinterpret_cast<std::intptr_t>(this) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, class... SRanges>
|
||||
MultiArrayBase<T,SRanges...>::MultiArrayBase(const std::shared_ptr<SRanges>&... ranges)
|
||||
{
|
||||
|
|
|
@ -66,10 +66,16 @@ namespace MultiArrayTools
|
|||
|
||||
public:
|
||||
|
||||
DEFAULT_MEMBERS(MultiArrayBase);
|
||||
//DEFAULT_MEMBERS(MultiArrayBase);
|
||||
MultiArrayBase(const std::shared_ptr<SRanges>&... ranges);
|
||||
MultiArrayBase(const typename CRange::Space& space);
|
||||
|
||||
MultiArrayBase() = default;
|
||||
MultiArrayBase(const MultiArrayBase& in);
|
||||
MultiArrayBase(MultiArrayBase&& in);
|
||||
MultiArrayBase& operator=(const MultiArrayBase& in);
|
||||
MultiArrayBase& operator=(MultiArrayBase&& in);
|
||||
|
||||
virtual ~MultiArrayBase() = default;
|
||||
|
||||
template <typename X>
|
||||
|
|
|
@ -535,9 +535,10 @@ namespace MultiArrayTools
|
|||
|
||||
template <typename T, class Op, class IndexType>
|
||||
template <class Expr>
|
||||
auto Contraction<T,Op,IndexType>::loop(Expr exp) const -> decltype(mInd->iforh(1,exp))
|
||||
auto Contraction<T,Op,IndexType>::loop(Expr exp) const
|
||||
-> decltype(mInd->iforh(1,mOp.loop(exp)))
|
||||
{
|
||||
return mInd->iforh(1,exp);
|
||||
return mInd->iforh(1,mOp.loop(exp));
|
||||
}
|
||||
|
||||
/**************************
|
||||
|
|
|
@ -475,7 +475,8 @@ namespace MultiArrayTools
|
|||
-> decltype(mOp.rootSteps(iPtrNum));
|
||||
|
||||
template <class Expr>
|
||||
auto loop(Expr exp) const -> decltype(mInd->iforh(1,exp));
|
||||
auto loop(Expr exp) const
|
||||
-> decltype(mInd->iforh(1,mOp.loop(exp)));
|
||||
};
|
||||
|
||||
template <typename T, class Op, class... Indices>
|
||||
|
|
|
@ -297,7 +297,8 @@ namespace {
|
|||
data.resize(s);
|
||||
for(size_t i = 0; i != s; ++i){
|
||||
double arg = static_cast<double>( i - s ) - 0.1;
|
||||
data[i] = sin(arg)/arg;
|
||||
data[i] = sin(arg);
|
||||
//VCHECK(data[i]);
|
||||
}
|
||||
SRF f;
|
||||
sr = std::dynamic_pointer_cast<SR>(f.create());
|
||||
|
@ -468,7 +469,7 @@ namespace {
|
|||
for(size_t a = 0; a != 4; ++a){
|
||||
for(size_t b = 0; b != 4; ++b){
|
||||
for(size_t c = 0; c != 4; ++c){
|
||||
const size_t sidx = d*4*4*4*4*4*4*4 + a*5*4*4*4*4 + b*5*4*4*4 + c*5*4 + p;
|
||||
const size_t sidx = d*4*4*4*4*4*4*4 + a*5*4*4*4*4*4 + b*5*4*4*4 + c*5*4 + p;
|
||||
vres[tidx] += data[sidx];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue