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
6
#include <
etl/_complex/complex.hpp
>
7
#include <
etl/_concepts/floating_point.hpp
>
8
#include <
etl/_concepts/integral.hpp
>
9
10
namespace
etl
{
11
13
template
<
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
22
template
<
float
ing_po
int
Float>
23
[[nodiscard]]
constexpr
auto
norm
(Float f)
noexcept
->
complex<Float>
24
{
25
return
etl::norm
(
etl::complex<Float>
(f));
26
}
27
29
template
<
int
egral Integer>
30
[[nodiscard]]
constexpr
auto
norm
(Integer i)
noexcept
->
complex<double>
31
{
32
return
etl::norm
(
etl::complex<double>
(i));
33
}
34
35
}
// namespace etl
36
37
#endif
// TETL_COMPLEX_NORM_HPP
complex.hpp
floating_point.hpp
etl::norm
constexpr auto norm(complex< T > const &z) noexcept -> T
Definition
norm.hpp:14
integral.hpp
etl
Definition
adjacent_find.hpp:8
etl::complex
A complex number.
Definition
complex.hpp:19
include
etl
_complex
norm.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0