tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
conj.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_COMPLEX_CONJ_HPP
5#define TETL_COMPLEX_CONJ_HPP
6
7#include <etl/_complex/complex.hpp>
8#include <etl/_concepts/floating_point.hpp>
9#include <etl/_concepts/integral.hpp>
10
11namespace etl {
12
13/// \ingroup complex
14template <typename T>
15[[nodiscard]] constexpr auto conj(complex<T> const& z) noexcept -> complex<T>
16{
17 return complex<T>(z.real(), -z.imag());
18}
19
20/// \ingroup complex
21template <floating_point Float>
22[[nodiscard]] constexpr auto conj(Float f) noexcept -> complex<Float>
23{
24 return complex<Float>(f);
25}
26
27/// \ingroup complex
28template <integral Integer>
29[[nodiscard]] constexpr auto conj(Integer i) noexcept -> complex<double>
30{
31 return complex<double>(static_cast<double>(i));
32}
33
34} // namespace etl
35
36#endif // TETL_COMPLEX_CONJ_HPP
constexpr auto conj(Integer i) noexcept -> complex< double >
Definition conj.hpp:29
constexpr auto conj(complex< T > const &z) noexcept -> complex< T >
Definition conj.hpp:15
constexpr auto conj(Float f) noexcept -> complex< Float >
Definition conj.hpp:22
Definition adjacent_find.hpp:9
A complex number.
Definition complex.hpp:20