mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Workaround missalignment produced by first_aligned for PacketSize==1 and size==1
This commit is contained in:
parent
bb3a9b4941
commit
307c4fc292
@ -157,6 +157,7 @@ inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real
|
|||||||
MatrixBase<Derived>::stableNorm() const
|
MatrixBase<Derived>::stableNorm() const
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
|
using std::abs;
|
||||||
const Index blockSize = 4096;
|
const Index blockSize = 4096;
|
||||||
RealScalar scale(0);
|
RealScalar scale(0);
|
||||||
RealScalar invScale(1);
|
RealScalar invScale(1);
|
||||||
@ -167,6 +168,10 @@ MatrixBase<Derived>::stableNorm() const
|
|||||||
typedef typename internal::conditional<Alignment, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, Aligned>,
|
typedef typename internal::conditional<Alignment, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, Aligned>,
|
||||||
typename Base::ConstSegmentReturnType>::type SegmentWrapper;
|
typename Base::ConstSegmentReturnType>::type SegmentWrapper;
|
||||||
Index n = size();
|
Index n = size();
|
||||||
|
|
||||||
|
if(n==1)
|
||||||
|
return abs(this->coeff(0));
|
||||||
|
|
||||||
Index bi = internal::first_aligned(derived());
|
Index bi = internal::first_aligned(derived());
|
||||||
if (bi>0)
|
if (bi>0)
|
||||||
internal::stable_norm_kernel(this->head(bi), ssq, scale, invScale);
|
internal::stable_norm_kernel(this->head(bi), ssq, scale, invScale);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user