cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
backwards.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_BACKWARDS_H
4#define pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_BACKWARDS_H
5
8
9namespace pRC
10{
11 template<class X, TensorTrain::IsOperatorish R = RemoveReference<X>>
12 static inline constexpr auto backwards(X &&a)
13 {
14 if constexpr(IsInvocable<View, X>)
15 {
17 using M = decltype(reverse(typename R::M()));
18 using N = decltype(reverse(typename R::N()));
19 using Ranks = decltype(reverse(typename R::Ranks()));
20
21 return TensorTrain::OperatorViews::Backwards<typename R::Type, M, N,
22 Ranks, V>(view(forward<X>(a)));
23 }
24 else
25 {
26 return eval(backwards(a));
27 }
28 }
29}
30#endif // pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_BACKWARDS_H
Definition concepts.hpp:31
Definition cholesky.hpp:10
std::remove_reference_t< T > RemoveReference
Definition basics.hpp:41
static constexpr auto reverse(Direction const D)
Definition direction.hpp:24
static constexpr decltype(auto) view(X &&a)
Definition view.hpp:13
static constexpr auto backwards(X &&a)
Definition backwards.hpp:12
static constexpr decltype(auto) eval(X &&a)
Definition eval.hpp:12