freealg.norm#

freealg.norm(A, N=None, order=None)#

Estimate the Schatten norm of a Hermitian matrix.

This function estimates the norm of the matrix \(\mathbf{A}\) or a larger matrix containing \(\mathbf{A}\) using free decompression.

Parameters:
Anumpy.ndarray

The symmetric real-valued matrix \(\mathbf{A}\) whose condition number (or that of a matrix containing \(\mathbf{A}\)) are to be computed.

Nint, default=None

The size of the matrix containing \(\mathbf{A}\) to estimate eigenvalues of. If None, returns estimates of the eigenvalues of \(\mathbf{A}\) itself.

order{float, ''inf, '-inf', 'fro', 'nuc'}, default=2

Order of the norm.

  • float \(p\): Schatten p-norm.

  • 'inf': Largest absolute eigenvalue \(\max \vert \lambda_i \vert)\)

  • '-inf': Smallest absolute eigenvalue \(\min \vert \lambda_i \vert)\)

  • 'fro': Frobenius norm corresponding to \(p=2\)

  • 'nuc': Nuclear (or trace) norm corresponding to \(p=1\)

Returns:
normfloat

matrix norm

See also

eigh
cond
slogdet
trace

Notes

Thes Schatten \(p\)-norm is defined by

\[\Vert \mathbf{A} \Vert_p = \left( \sum_{i=1}^N \vert \lambda_i \vert^p \right)^{1/p}.\]

Examples

>>> from freealg import norm
>>> from freealg.distributions import MarchenkoPastur

>>> mp = MarchenkoPastur(1/50)
>>> A = mp.matrix(3000)
>>> norm(A, 100_000, order='fro')