pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
sub.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_COMPLEX_FUNCTIONS_SUB_H
4#define pRC_CORE_COMPLEX_FUNCTIONS_SUB_H
5
8
9namespace pRC
10{
11 template<class TA, class TB, If<IsInvocable<Sub, TA, TB>> = 0>
12 static inline constexpr auto operator-(Complex<TA> const &a,
13 Complex<TB> const &b)
14 {
15 auto const real = a.real() - b.real();
16 auto const imag = a.imag() - b.imag();
17
18 return Complex(real, imag);
19 }
20
21 template<class TA, class TB, If<IsValue<TB>> = 0,
22 If<IsInvocable<Sub, TA, TB>> = 0>
23 static inline constexpr auto operator-(Complex<TA> const &a, TB const &b)
24 {
25 auto const real = a.real() - b;
26 auto const imag = a.imag();
27
28 return Complex(real, imag);
29 }
30
31 template<class TA, class TB, If<IsValue<TA>> = 0,
32 If<IsInvocable<Sub, TA, TB>> = 0>
33 static inline constexpr auto operator-(TA const &a, Complex<TB> const &b)
34 {
35 auto const real = a - b.real();
36 auto const imag = -b.imag();
37
38 return Complex(real, imag);
39 }
40}
41#endif // pRC_CORE_COMPLEX_FUNCTIONS_SUB_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 auto operator-(Sequence< T, As... > const, Sequence< T, Bs... > const)
Definition sequence.hpp:132
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13