tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
cos.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_COS_HPP
5#define TETL_COMPLEX_COS_HPP
6
7#include <etl/_cmath/cos.hpp>
8#include <etl/_cmath/cosh.hpp>
9#include <etl/_cmath/sin.hpp>
10#include <etl/_cmath/sinh.hpp>
11#include <etl/_complex/complex.hpp>
12
13namespace etl {
14
15/// \ingroup complex
16template <typename T>
17[[nodiscard]] constexpr auto cos(complex<T> const& z) -> complex<T>
18{
19 auto const x = z.real();
20 auto const y = z.imag();
21 return {cos(x) * cosh(y), -sin(x) * sinh(y)};
22}
23
24} // namespace etl
25
26#endif // TETL_COMPLEX_COS_HPP
constexpr auto cos(complex< T > const &z) -> complex< T >
Definition cos.hpp:17
Definition adjacent_find.hpp:9
A complex number.
Definition complex.hpp:20