MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
matrix_properties.hpp File Reference
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <limits>
#include <mtl/concepts/matrix.hpp>
#include <mtl/concepts/magnitude.hpp>
#include <mtl/math/identity.hpp>
#include <mtl/functor/scalar/conj.hpp>
#include <mtl/interface/dispatch_traits.hpp>

Namespaces

namespace  mtl
namespace  mtl::detail
 mat*vec multiply into pre-allocated y: y = A * x.

Functions

template<typename M, typename F>
bool mtl::detail::all_stored (const M &A, F &&f)
 Calls f(r, c, v) for each stored entry of a compressed2D, row by row.
template<Matrix M>
bool mtl::is_square (const M &A)
 A.num_rows() == A.num_cols().
template<Matrix M>
bool mtl::is_empty (const M &A)
 A has no rows or no columns.
template<Matrix M>
bool mtl::is_symmetric (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 A == A^T (within tol). Non-square matrices are never symmetric.
template<Matrix M>
bool mtl::is_hermitian (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 A == A^H (within tol): A(i,j) == conj(A(j,i)), and the diagonal is real.
template<Matrix M>
bool mtl::is_upper_triangular (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 Upper triangular: everything strictly below the main diagonal is ~0.
template<Matrix M>
bool mtl::is_lower_triangular (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 Lower triangular: everything strictly above the main diagonal is ~0.
template<Matrix M>
bool mtl::is_triangular (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 Upper or lower triangular.
template<Matrix M>
bool mtl::is_diagonal (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 Diagonal: every off-diagonal entry is ~0.
template<Matrix M>
bool mtl::is_banded (const M &A, std::size_t kl, std::size_t ku, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(0))
 Banded with lower bandwidth kl and upper bandwidth ku: an entry more than kl below (i - j > kl) or more than ku above (j - i > ku) the diagonal must be ~0.
template<Matrix M>
bool mtl::is_diagonally_dominant (const M &A, bool strict=false)
 Row diagonally dominant: |A(i,i)| >= sum_{j != i} |A(i,j)| for every row (strict: strictly greater).
template<Matrix M>
magnitude_t< typename M::value_type > mtl::detail::product_tol (const M &A, magnitude_t< typename M::value_type > tol)
template<Matrix M>
bool mtl::is_unitary (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(-1))
 Unitary: A is square and A^H A == I (within tol).
template<Matrix M>
bool mtl::is_orthogonal (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(-1))
 Orthogonal: alias for is_unitary (conventional name for real matrices).
template<Matrix M>
bool mtl::is_normal (const M &A, magnitude_t< typename M::value_type > tol=magnitude_t< typename M::value_type >(-1))
 Normal: A is square and A A^H == A^H A (within tol) – the class of matrices unitarily diagonalizable, containing the symmetric/Hermitian, skew, and unitary matrices.