β The singular values are the absolute values of the eigenvalues of a normal matrixA , because the spectral theorem can be applied to obtain unitary diagonalization of as . Therefore, .β
The first two methods would not stable in general if the matrix has singular values of widely varying magnitudes. You narrowed the focus to Hermitian matrices, but this is defined more generally and absmat3 is numerically fine for Hermitian matrices, but it is wrong for general square matrices.
More generally, \sqrt{A^* A} is the semidefinite factor H in the polar factorization A=UH where U is unitary and can be obtained from the SVD:
function absmat4(A::AbstractMatrix)
F = svd(A)
return F.Vt' * Diagonal(F.S) * F.Vt
end
That is not faster, but works for any square matrix. You could then have
function absmat3(A::Hermitian{<:AbstractMatrix})
F = eigen(A)
return F.vectors * Diagonal(abs.(F.values)) * F.vectors'
end
I donβt think you will do much better in terms of methods based on the standard matrix decompositions. But there are iterative methods for U which could then give you H=U^* A. A Newton iteration for computing U takes the form
X_{k+1} = \frac{1}{2} (X_k + X_k^{-*}), \qquad X_0 = A.
X_k is quadratically convergent to U. There also appears to be a package for this already: PolarFact.jl. The README provides some references.