mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
removed exp() and replaced hypot() with sqrt(norm())
This commit is contained in:
parent
c81732c768
commit
a85cbcf6ba
1 changed files with 3 additions and 9 deletions
12
complex.hh
12
complex.hh
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue