pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
atanh.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_ATANH_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_ATANH_H
5
7
8namespace pRC
9{
10 template<class T>
11 static inline constexpr auto atanh(Complex<T> const &a)
12 {
13 auto const is = a.imag() * a.imag();
14 auto const t = unit<T>() - is - a.real() * a.real();
15
16 auto num = unit<T>() + a.real();
17 auto den = unit<T>() - a.real();
18
19 num = is + num * num;
20 den = is + den * den;
21
22 auto const real = identity<T>(0.25) * (log(num) - log(den));
23 auto const imag =
24 identity<T>(0.5) * atan2(identity<T>(2) * a.imag(), t);
25
26 return Complex(real, imag);
27 }
28}
29#endif // pRC_CORE_COMPLEX_FUNCTIONS_ATANH_H
Definition complex.hpp:26
constexpr decltype(auto) real() &&
Definition complex.hpp:125
constexpr decltype(auto) imag() &&
Definition complex.hpp:145
Definition cholesky.hpp:18
static constexpr decltype(auto) imag(X &&a)
Definition imag.hpp:11
static constexpr decltype(auto) real(X &&a)
Definition real.hpp:11
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto log(Complex< T > const &a)
Definition log.hpp:11
static constexpr auto atanh(Complex< T > const &a)
Definition atanh.hpp:11
static constexpr auto atan2(XA &&a, XB &&b)
Calculates element-wise atan2 of two Tensors containing x and y coordinates.
Definition atan2.hpp:28