cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
identity.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_IDENTITY_H
4#define pRC_CORE_TENSOR_IDENTITY_H
5
10
11namespace pRC
12{
13 template<IsTensor T>
14 requires(isEven(T::Dimension))
15 struct Identity<T>
16 {
17 constexpr auto operator()() const
18 {
19 return diagonal(unit<T>());
20 }
21
22 template<class X>
24 constexpr auto operator()(X &&value) const
25 {
26 return diagonal(unit<T>(forward<X>(value)));
27 }
28 };
29
30 template<IsTensorView T>
31 struct Identity<T> : Identity<ResultOf<Eval, T>>
32 {
33 };
34}
35#endif // pRC_CORE_TENSOR_IDENTITY_H
Definition value.hpp:12
Definition concepts.hpp:37
int value
Definition gmock-actions_test.cc:1714
Definition cholesky.hpp:10
static constexpr auto unit()
Definition unit.hpp:13
static constexpr auto diagonal(X &&a)
Definition diagonal.hpp:15
static constexpr auto isEven(T const a)
Definition is_even.hpp:11
constexpr auto operator()(X &&value) const
Definition identity.hpp:24
constexpr auto operator()() const
Definition identity.hpp:17