pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
inflate.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_INFLATE_H
4#define pRC_CORE_TENSOR_FUNCTIONS_INFLATE_H
5
8
9namespace pRC
10{
11 template<Size... Is>
12 struct Inflate;
13
23 template<Size... Is, class X, class R = RemoveReference<X>,
25 If<IsSatisfied<(sizeof...(Is) == typename R::Dimension())>> = 0>
26 static inline constexpr auto inflate(X &&a)
27 {
29 return TensorViews::Inflate<typename R::Type,
30 decltype(typename R::Sizes() * Sizes<Is...>()), Sizes<Is...>, V>(
31 view(forward<X>(a)));
32 }
33
46 template<Size... Is, class X, class R = RemoveReference<X>,
48 If<IsInvocable<Inflate<Is...>, X &>> = 0>
49 static inline constexpr auto inflate(X &&a)
50 {
51 return eval(inflate<Is...>(a));
52 }
53}
54#endif // pRC_CORE_TENSOR_FUNCTIONS_INFLATE_H
Definition sequence.hpp:56
Definition inflate.hpp:11
Definition cholesky.hpp:18
static constexpr X eval(X &&a)
Definition eval.hpp:11
static constexpr auto inflate(X &&a)
Inflates the sizes of a Tensor by repeating its values.
Definition inflate.hpp:26
static constexpr X view(X &&a)
Returns a TensorView obtained from a TensorView.
Definition view.hpp:22
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
std::size_t Size
Definition type_traits.hpp:20
std::is_invocable< F, Args... > IsInvocable
Definition type_traits.hpp:134
Constant< Bool, B > IsSatisfied
Definition type_traits.hpp:71
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13