removed exp() and replaced hypot() with sqrt(norm())

This commit is contained in:
Ahmet Inan 2019-01-19 13:59:52 +01:00
commit a85cbcf6ba

View file

@ -102,15 +102,15 @@ static constexpr Complex<T> operator / (Complex<T> a, Complex<T> b)
}
template <typename T>
static constexpr Complex<T> exp(Complex<T> a)
static constexpr T norm(Complex<T> a)
{
return Complex<T>(exp(a.real()) * cos(a.imag()), exp(a.real()) * sin(a.imag()));
return a.real() * a.real() + a.imag() * a.imag();
}
template <typename T>
static constexpr T abs(Complex<T> a)
{
return hypot(a.real(), a.imag());
return sqrt(norm(a));
}
template <typename T>
@ -119,10 +119,4 @@ static constexpr T arg(Complex<T> a)
return atan2(a.imag(), a.real());
}
template <typename T>
static constexpr T norm(Complex<T> a)
{
return a.real() * a.real() + a.imag() * a.imag();
}
#endif