cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
minus.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_TENSOR_TRAIN_COMMON_FUNCTIONS_MINUS_H
4#define pRC_TENSOR_TRAIN_COMMON_FUNCTIONS_MINUS_H
5
8
9namespace pRC
10{
11 template<class X, class R = RemoveReference<X>,
12 If<Any<TensorTrain::IsTensorish<R>, TensorTrain::IsOperatorish<R>>> = 0>
13 static inline constexpr auto operator-(X &&a)
14 {
15 return enumerate(
16 []<Index C>(auto &&a)
17 {
18 if constexpr(C == 0)
19 {
20 return -forward<decltype(a)>(a);
21 }
22 else
23 {
24 return forward<decltype(a)>(a);
25 }
26 },
27 forward<X>(a));
28 }
29}
30#endif // pRC_TENSOR_TRAIN_COMMON_FUNCTIONS_MINUS_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
Size Index
Definition type_traits.hpp:21
static constexpr auto operator-(Sequence< T, As... > const, Sequence< T, Bs... > const)
Definition sequence.hpp:132
static constexpr auto enumerate(F &&f, Xs &&...args)
Definition enumerate.hpp:20