cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
scale.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_SCALE_H
4#define pRC_CORE_TENSOR_FUNCTIONS_SCALE_H
5
13
14namespace pRC
15{
16 template<class XA, class XB, class RA = RemoveReference<XA>,
17 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
18 If<IsTensorish<RB>> = 0, class DA = typename RA::Dimension,
19 class DB = typename RB::Dimension,
20 If<IsSatisfied<(DA() == 0 || DB() == 0)>> = 0,
21 If<IsInvocable<TensorProduct, XA, XB>> = 0>
22 static inline constexpr auto operator*(XA &&a, XB &&b)
23 {
24 return tensorProduct(forward<XA>(a), forward<XB>(b));
25 }
26
27 template<class XA, class XB, class RA = RemoveReference<XA>,
28 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
29 If<IsTensorish<RB>> = 0, class DA = typename RA::Dimension,
30 class DB = typename RB::Dimension,
31 If<IsSatisfied<(DA() == 0 && DB() != 0)>> = 0,
32 If<IsInvocable<Div,
33 decltype(unit<typename RB::template ChangeType<typename RA::Type>>(
34 declval<XA>()())),
35 XB>> = 0>
36 static inline constexpr auto operator/(XA &&a, XB &&b)
37 {
39 forward<XA>(a)()) /
40 forward<XB>(b);
41 }
42
43 template<class XA, class XB, class RA = RemoveReference<XA>,
44 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
45 If<IsTensorish<RB>> = 0, class DA = typename RA::Dimension,
46 class DB = typename RB::Dimension,
47 If<IsSatisfied<(DA() != 0 && DB() == 0)>> = 0,
48 If<IsInvocable<Div, XA,
49 decltype(unit<typename RA::template ChangeType<typename RB::Type>>(
50 declval<XB>()()))>> = 0>
51 static inline constexpr auto operator/(XA &&a, XB &&b)
52 {
53 return forward<XA>(a) /
55 forward<XB>(b)());
56 }
57
58 template<class XA, class XB, class RA = RemoveReference<XA>,
59 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
60 If<Any<IsValue<RB>, IsComplex<RB>>> = 0,
61 If<IsInvocable<Mul, XA, decltype(unit<Tensor<RB>>(declval<XB>()))>> = 0>
62 static inline constexpr auto operator*(XA &&a, XB &&b)
63 {
65 }
66
67 template<class XA, class XB, class RA = RemoveReference<XA>,
68 class RB = RemoveReference<XB>, If<Any<IsValue<RA>, IsComplex<RA>>> = 0,
69 If<IsTensorish<RB>> = 0,
70 If<IsInvocable<Mul, decltype(unit<Tensor<RA>>(declval<XA>())), XB>> = 0>
71 static inline constexpr auto operator*(XA &&a, XB &&b)
72 {
73 return unit<Tensor<RA>>(forward<XA>(a)) * forward<XB>(b);
74 }
75
76 template<class XA, class XB, class RA = RemoveReference<XA>,
77 class RB = RemoveReference<XB>, If<IsTensorish<RA>> = 0,
78 If<Any<IsValue<RB>, IsComplex<RB>>> = 0,
79 If<IsInvocable<Div, XA, decltype(unit<Tensor<RB>>(declval<XB>()))>> = 0>
80 static inline constexpr auto operator/(XA &&a, XB &&b)
81 {
83 }
84
85 template<class XA, class XB, class RA = RemoveReference<XA>,
86 class RB = RemoveReference<XB>, If<Any<IsValue<RA>, IsComplex<RA>>> = 0,
87 If<IsTensorish<RB>> = 0,
88 If<IsInvocable<Div, decltype(unit<Tensor<RA>>(declval<XA>())), XB>> = 0>
89 static inline constexpr auto operator/(XA &&a, XB &&b)
90 {
91 return unit<Tensor<RA>>(forward<XA>(a)) / forward<XB>(b);
92 }
93}
94#endif // pRC_CORE_TENSOR_FUNCTIONS_SCALE_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
static constexpr auto operator*(JacobiRotation< TA > const &a, JacobiRotation< TB > const &b)
Definition jacobi_rotation.hpp:311
static constexpr auto operator/(Sequence< T, As... > const, Sequence< T, Bs... > const)
Definition sequence.hpp:169
static constexpr auto tensorProduct(XA &&a, XB &&b)
Definition tensor_product.hpp:19