pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
restrict.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_RESTRICT_H
4#define pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_RESTRICT_H
5
9
10namespace pRC
11{
14 static inline constexpr decltype(auto) restrict(X &&a)
15 {
16 if constexpr(OR == Operator::Restrict::None)
17 {
18 if constexpr(TensorTrain::IsOperator<R>() &&
20 {
21 return eval(forward<X>(a));
22 }
23 else
24 {
25 return view(forward<X>(a));
26 }
27 }
28 else
29 {
30 static_assert(OR != OR, "Unsupported operator restriction.");
31 }
32 }
33}
34#endif // pRC_TENSOR_TRAIN_OPERATOR_FUNCTIONS_RESTRICT_H
Restrict
This enum's elements denote a restriction of an operator.
Definition restrict.hpp:27
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 decltype(auto) restrict(X &&a)
Applies a restriction to a Tensor.
Definition restrict.hpp:23
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
Definition type_traits.hpp:21