cMHN 1.2
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 requires(TensorTrain::IsTensorish<R> || TensorTrain::IsOperatorish<R>)
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:10
Size Index
Definition basics.hpp:32
static constexpr auto enumerate(F &&f, Xs &&...args)
Definition enumerate.hpp:21