cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
mul.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_MUL_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_MUL_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() - a.imag() * b.imag();
14 auto const imag = a.real() * b.imag() + a.imag() * b.real();
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() * b;
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 = a * b.imag();
33
34 return Complex(real, imag);
35 }
36}
37#endif // pRC_CORE_COMPLEX_FUNCTIONS_MUL_H
Definition cholesky.hpp:10
Complex(T const &) -> Complex< T >
static constexpr auto operator*(JacobiRotation< TA > const &a, JacobiRotation< TB > const &b)
Definition jacobi_rotation.hpp:298
static constexpr decltype(auto) real(X &&a)
Definition real.hpp:12
static constexpr decltype(auto) imag(X &&a)
Definition imag.hpp:12