use modern ei_first_aligned function, dont try compiling coeffRef() on rvalue expressions.

This commit is contained in:
Benoit Jacob 2010-05-08 15:57:56 -04:00
parent 5deda97413
commit eda2795f51

View File

@ -62,13 +62,9 @@ MatrixBase<Derived>::stableNorm() const
Alignment = (int(Flags)&DirectAccessBit) || (int(Flags)&AlignedBit) ? 1 : 0 Alignment = (int(Flags)&DirectAccessBit) || (int(Flags)&AlignedBit) ? 1 : 0
}; };
int n = size(); int n = size();
int bi=0; int bi = ei_first_aligned(derived());
if ((int(Flags)&DirectAccessBit) && !(int(Flags)&AlignedBit)) if (bi>0)
{ ei_stable_norm_kernel(this->head(bi), ssq, scale, invScale);
bi = ei_first_aligned(&const_cast_derived().coeffRef(0), n);
if (bi>0)
ei_stable_norm_kernel(this->head(bi), ssq, scale, invScale);
}
for (; bi<n; bi+=blockSize) for (; bi<n; bi+=blockSize)
ei_stable_norm_kernel(this->segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale); ei_stable_norm_kernel(this->segment(bi,std::min(blockSize, n - bi)).template forceAlignedAccessIf<Alignment>(), ssq, scale, invScale);
return scale * ei_sqrt(ssq); return scale * ei_sqrt(ssq);