mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-19 19:34:29 +08:00
Ref<> objects must be nested by reference because they potentially store a temporary object
This commit is contained in:
parent
c13e9bbabf
commit
6719e56b5b
@ -94,7 +94,8 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
|
|||||||
typedef _PlainObjectType PlainObjectType;
|
typedef _PlainObjectType PlainObjectType;
|
||||||
typedef _StrideType StrideType;
|
typedef _StrideType StrideType;
|
||||||
enum {
|
enum {
|
||||||
Options = _Options
|
Options = _Options,
|
||||||
|
Flags = traits<Map<_PlainObjectType, _Options, _StrideType> >::Flags | NestByRefBit
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived> struct match {
|
template<typename Derived> struct match {
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
static int nb_temporaries;
|
static int nb_temporaries;
|
||||||
|
|
||||||
inline void on_temporary_creation(int size) {
|
inline void on_temporary_creation(int) {
|
||||||
// here's a great place to set a breakpoint when debugging failures in this test!
|
// here's a great place to set a breakpoint when debugging failures in this test!
|
||||||
if(size!=0) nb_temporaries++;
|
nb_temporaries++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ atan2(const AutoDiffScalar<DerTypeA>& a, const AutoDiffScalar<DerTypeB>& b)
|
|||||||
Scalar tmp4 = tmp3/(tmp2+tmp3);
|
Scalar tmp4 = tmp3/(tmp2+tmp3);
|
||||||
|
|
||||||
if (tmp4!=0)
|
if (tmp4!=0)
|
||||||
ret.derivatives() = (a.derivatives() * b.value() - a.value() * b.derivatives()) * (tmp2+tmp3);
|
ret.derivatives() = (a.value() * b.derivatives() - a.derivatives() * b.value()) * (tmp2+tmp3);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ MatrixPowerAtomic<MatrixType>::computeSuperDiag(const ComplexScalar& curr, const
|
|||||||
ComplexScalar logCurr = log(curr);
|
ComplexScalar logCurr = log(curr);
|
||||||
ComplexScalar logPrev = log(prev);
|
ComplexScalar logPrev = log(prev);
|
||||||
int unwindingNumber = ceil((numext::imag(logCurr - logPrev) - M_PI) / (2*M_PI));
|
int unwindingNumber = ceil((numext::imag(logCurr - logPrev) - M_PI) / (2*M_PI));
|
||||||
ComplexScalar w = numext::atanh2(curr - prev, curr + prev) + ComplexScalar(0, M_PI*unwindingNumber);
|
ComplexScalar w = numext::atanh2(curr - prev, curr + prev) + ComplexScalar(RealScalar(0), RealScalar(M_PI*unwindingNumber));
|
||||||
return RealScalar(2) * exp(RealScalar(0.5) * p * (logCurr + logPrev)) * sinh(p * w) / (curr - prev);
|
return RealScalar(2) * exp(RealScalar(0.5) * p * (logCurr + logPrev)) * sinh(p * w) / (curr - prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user