reimplement abs2 not to use std::norm which is incredibly slow.

This commit is contained in:
Gael Guennebaud 2011-11-08 22:42:51 +01:00
parent 45a6bb34c3
commit fb3aa7220f

View File

@ -309,8 +309,7 @@ struct abs2_impl<std::complex<RealScalar> >
{ {
static inline RealScalar run(const std::complex<RealScalar>& x) static inline RealScalar run(const std::complex<RealScalar>& x)
{ {
using std::norm; return real(x)*real(x) + imag(x)*imag(x);
return norm(x);
} }
}; };