pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
polar.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_POLAR_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_POLAR_H
5
10
11namespace pRC
12{
13 template<class TA, class TB, If<All<IsValue<TA>, IsValue<TB>>> = 0,
14 If<IsInvocable<Cos, TB>> = 0, If<IsInvocable<Sin, TB>> = 0,
15 If<IsInvocable<Mul, TA, TB>> = 0>
16 static inline constexpr auto polar(TA const &rho, TB const &theta)
17 {
18 auto const real = rho * cos(theta);
19 auto const imag = rho * sin(theta);
20
21 return Complex(real, imag);
22 }
23}
24#endif // pRC_CORE_COMPLEX_FUNCTIONS_POLAR_H
Definition complex.hpp:26
Definition cholesky.hpp:18
static constexpr auto polar(TA const &rho, TB const &theta)
Definition polar.hpp:16
static constexpr auto cos(Complex< T > const &a)
Definition cos.hpp:11
static constexpr decltype(auto) imag(X &&a)
Definition imag.hpp:11
static constexpr decltype(auto) real(X &&a)
Definition real.hpp:11
static constexpr auto sin(Complex< T > const &a)
Definition sin.hpp:11
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13