0

I have a square symmetric real matrix S of dimension 31. I want to compute its trace (nuclear) norm, Frobenius (Hilbert--Schmidt) norm and operator (spectral) norm. I am using eigen:

x <- eigen(S, only.values = TRUE)$values
sum(abs(x))
sqrt(sum(x^2))
max(abs(x))

Is there a faster way to do this? For the Frobenius norm, I suppose that sum(S^2) should be faster. I also believe that there should be a way to compute the operator norm faster, as it only requires the maximal and minimal eigenvalues rather than all of them. I am not sure, however, how to handle the trace norm efficiently. It can be computed as the trace of the matrix square root of t(S) %*% S but (at least to my knowledge) computing the matrix square root is done using eigen too (see below my code if helpful).

I don't know if it helps at all, but I also know that S+diag(31) is positive semidefinite.

I need to do this for a lot of matrices (4 000 000 or so) so even mild improvements would be consequential.

Here is the code for matrix square root I am using

sqm <- function(A)
{
    A <- eigen(A)
    A$vectors %*% (sqrt(A$values) * t(A$vectors))
}
YZS
  • 101

0 Answers0