cMHN 1.1
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
is_unitary.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_UNITARY_H
4#define pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_UNITARY_H
5
11
12namespace pRC
13{
14 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
15 If<IsInvocable<Adjoint, X>> = 0,
16 If<IsInvocable<IsApprox, ResultOf<Mul, ResultOf<Adjoint, X>, X>,
17 ResultOf<Mul, ResultOf<Adjoint, X>, X>>> = 0,
18 class TT = typename R::Value>
19 static inline constexpr auto isUnitary(X &&a,
20 TT const &tolerance = NumericLimits<TT>::tolerance())
21 {
22 using T = RemoveReference<decltype((adjoint(a) * a))>;
23 return isApprox(adjoint(a) * a, identity<T>(), tolerance);
24 }
25}
26#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_UNITARY_H
Definition cholesky.hpp:18
static constexpr auto makeConstantSequence()
Definition sequence.hpp:402
std::remove_reference_t< T > RemoveReference
Definition type_traits.hpp:56
static constexpr auto adjoint(JacobiRotation< T > const &a)
Definition jacobi_rotation.hpp:325
static constexpr auto isApprox(XA &&a, XB &&b, TT const &tolerance=NumericLimits< TT >::tolerance())
Definition is_approx.hpp:24
static constexpr auto isUnitary(X &&a, TT const &tolerance=NumericLimits< TT >::tolerance())
Definition is_unitary.hpp:19
Definition limits.hpp:13