pRC
multi-purpose Tensor Train library for C++
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
9
10namespace pRC
11{
12 template<class X, class R = RemoveReference<X>,
13 If<TensorTrain::IsOperatorish<R>> = 0, If<IsInvocable<View, X>> = 0>
14 static inline constexpr auto backwards(X &&a)
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
25 template<class X, class R = RemoveReference<X>,
26 If<TensorTrain::IsOperatorish<R>> = 0,
27 If<Not<IsInvocable<View, X>>> = 0>
28 static inline constexpr auto backwards(X &&a)
29 {
30 return eval(backwards(a));
31 }
32}
33#endif // pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_BACKWARDS_H
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr X view(X &&a)
Returns a TensorView obtained from a TensorView.
Definition view.hpp:22
static constexpr auto reverse(Direction const D)
Definition direction.hpp:24
static constexpr auto backwards(X &&a)
Flips the order of the indices of a Tensor.
Definition backwards.hpp:19
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13