tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
norm.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_COMPLEX_NORM_HPP
4#define TETL_COMPLEX_NORM_HPP
5
9
10namespace etl {
11
13template <typename T>
14[[nodiscard]] constexpr auto norm(complex<T> const& z) noexcept -> T
15{
16 auto const x = z.real();
17 auto const y = z.imag();
18 return x * x + y * y;
19}
20
22template <floating_point Float>
23[[nodiscard]] constexpr auto norm(Float f) noexcept -> complex<Float>
24{
26}
27
29template <integral Integer>
30[[nodiscard]] constexpr auto norm(Integer i) noexcept -> complex<double>
31{
33}
34
35} // namespace etl
36
37#endif // TETL_COMPLEX_NORM_HPP
constexpr auto norm(complex< T > const &z) noexcept -> T
Definition norm.hpp:14
Definition adjacent_find.hpp:8
A complex number.
Definition complex.hpp:19