cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
unit.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_UNIT_H
4#define pRC_CORE_TENSOR_UNIT_H
5
9
10namespace pRC
11{
12 template<class T>
13 struct Unit<T, If<IsTensorView<T>>> : Unit<ResultOf<Eval, T>>
14 {
15 };
16
17 template<class T>
18 struct Unit<T, If<IsTensor<T>>>
19 {
20 constexpr auto operator()()
21 {
22 auto const f = []()
23 {
25 };
26 using F = RemoveConstReference<decltype(f)>;
27 using Sizes = typename T::Sizes;
29 }
30
31 template<class X, If<IsConstructible<typename T::Type, X>> = 0>
32 constexpr auto operator()(X &&value)
33 {
34 auto const f = [value = typename T::Type(forward<X>(value))]()
35 {
36 return value;
37 };
38 using F = RemoveConstReference<decltype(f)>;
39 using Sizes = typename T::Sizes;
41 }
42 };
43}
44#endif // pRC_CORE_TENSOR_UNIT_H
Definition sequence.hpp:56
Definition loop.hpp:18
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
std::enable_if_t< B{}, int > If
Definition type_traits.hpp:68
RemoveConst< RemoveReference< T > > RemoveConstReference
Definition type_traits.hpp:62
Definition type_traits.hpp:60
Definition type_traits.hpp:16
constexpr auto operator()(X &&value)
Definition unit.hpp:32
constexpr auto operator()()
Definition unit.hpp:20
Definition type_traits.hpp:265