pRC
multi-purpose Tensor Train library for C++
Loading...
Searching...
No Matches
is_diagonal.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_DIAGONAL_H
4#define pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_DIAGONAL_H
5
11
12namespace pRC
13{
23 template<class X, class R = RemoveReference<X>, If<IsTensorish<R>> = 0,
24 If<IsInvocable<Diagonal, X>> = 0,
25 If<IsInvocable<IsApprox, ResultOf<Diagonal, X>, X>> = 0,
26 class TT = typename R::Value>
27 static inline constexpr auto isDiagonal(X &&a,
28 TT const &tolerance = NumericLimits<TT>::tolerance())
29 {
30 return isApprox(diagonal(a), a, tolerance);
31 }
32}
33#endif // pRC_CORE_TENSOR_OPERATOR_FUNCTIONS_IS_DIAGONAL_H
Definition cholesky.hpp:18
static constexpr auto diagonal(X &&a)
Transforms a Tensor into diagonal form.
Definition diagonal.hpp:26
static constexpr auto isApprox(XA &&a, XB &&b, TT const &tolerance=NumericLimits< TT >::tolerance())
Checks if two pRC objects agree up to a given tolerance.
Definition is_approx.hpp:44
static constexpr Conditional< IsSatisfied< C >, RemoveConstReference< X >, X > copy(X &&a)
Definition copy.hpp:13
static constexpr auto isDiagonal(X &&a, TT const &tolerance=NumericLimits< TT >::tolerance())
Checks if a Tensor is diagonal.
Definition is_diagonal.hpp:27
Definition limits.hpp:13