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_TENSOR_FUNCTIONS_BACKWARDS_H
4#define pRC_TENSOR_TRAIN_TENSOR_FUNCTIONS_BACKWARDS_H
5
8
9namespace pRC
10{
11 template<class X, TensorTrain::IsTensorish R = RemoveReference<X>>
12 static inline constexpr auto backwards(X &&a)
13 {
14 if constexpr(IsInvocable<View, X>)
15 {
17 using N = decltype(reverse(typename R::N()));
18 using Ranks = decltype(reverse(typename R::Ranks()));
19
20 return TensorTrain::TensorViews::Backwards<typename R::Type, N,
21 Ranks, V>(view(forward<X>(a)));
22 }
23 else
24 {
25 return eval(backwards(a));
26 }
27 }
28}
29#endif // pRC_TENSOR_TRAIN_TENSOR_FUNCTIONS_BACKWARDS_H
Definition backwards.hpp:17
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