cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
add.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_ADD_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_ADD_H
5
7
8namespace pRC
9{
10 template<IsComplex TA, IsComplex TB>
11 static inline constexpr auto operator+(TA const &a, TB const &b)
12 {
13 auto const real = a.real() + b.real();
14 auto const imag = a.imag() + b.imag();
15
16 return Complex(real, imag);
17 }
18
19 template<IsComplex TA, IsValue TB>
20 static inline constexpr auto operator+(TA const &a, TB const &b)
21 {
22 auto const real = a.real() + b;
23 auto const imag = a.imag();
24
25 return Complex(real, imag);
26 }
27
28 template<IsValue TA, IsComplex TB>
29 static inline constexpr auto operator+(TA const &a, TB const &b)
30 {
31 auto const real = a + b.real();
32 auto const imag = b.imag();
33
34 return Complex(real, imag);
35 }
36}
37#endif // pRC_CORE_COMPLEX_FUNCTIONS_ADD_H
Definition cholesky.hpp:10
Complex(T const &) -> Complex< T >
static constexpr decltype(auto) real(X &&a)
Definition real.hpp:12
static constexpr decltype(auto) imag(X &&a)
Definition imag.hpp:12
static constexpr auto operator+(Sequence< T, As... > const, Sequence< T, Bs... > const)
Definition sequence.hpp:107