Matrix Properties

MatrixAlgebraKit.jl provides a number of methods to check various properties of matrices.

MatrixAlgebraKit.isunitary — Function
isunitary(A; isapprox_kwargs...)

Test whether a linear map is unitary, i.e. A * A' ≈ I ≈ A' * A. The isapprox_kwargs are passed on to isapprox to control the tolerances.

See also isisometric.

source
MatrixAlgebraKit.ishermitian — Function
ishermitian(A; isapprox_kwargs...)

Test whether a linear map is Hermitian, i.e. A = A'. The isapprox_kwargs can be used to control the tolerances of the equality.

source
MatrixAlgebraKit.isantihermitian — Function
isantihermitian(A; isapprox_kwargs...)

Test whether a linear map is anti-Hermitian, i.e. A = -A'. The isapprox_kwargs can be used to control the tolerances of the equality.

source

Furthermore, there are also methods to project a matrix onto the nearest matrix (in 2-norm distance) with a given property.

MatrixAlgebraKit.project_isometric — Function
project_isometric(A; kwargs...)
project_isometric(A, alg)
project_isometric!(A, [W]; kwargs...)
project_isometric!(A, [W], alg)

Compute the projection of A onto the manifold of isometric matrices, i.e. matrices satisfying A' * A ≈ I. This projection is computed via the polar decomposition, i.e. W corresponds to the first return value of left_polar!, but avoids computing the positive definite factor explicitly.

Note

The bang method project_isometric! optionally accepts the output structure and possibly destroys the input matrix A. Always use the return value of the function as it may not always be possible to use the provided W as output.

source
MatrixAlgebraKit.project_hermitian — Function
project_hermitian(A; kwargs...)
project_hermitian(A, alg)
project_hermitian!(A, [Aₕ]; kwargs...)
project_hermitian!(A, [Aₕ], alg)

Compute the hermitian part of a (square) matrix A, defined as (A + A') / 2. For real matrices this corresponds to the symmetric part of A. In the bang method, the output storage can be provided via the optional argument Aₕ; by default it is equal to A and so the input matrix A is replaced by its hermitian projection.

See also project_antihermitian.

source
MatrixAlgebraKit.project_antihermitian — Function
project_antihermitian(A; kwargs...)
project_antihermitian(A, alg)
project_antihermitian!(A, [Aₐ]; kwargs...)
project_antihermitian!(A, [Aₐ], alg)

Compute the anti-hermitian part of a (square) matrix A, defined as (A - A') / 2. For real matrices this corresponds to the antisymmetric part of A. In the bang method, the output storage can be provided via the optional argument Aₐ; by default it is equal toAand so the input matrixA` is replaced by its antihermitian projection.

See also project_hermitian.

source