[R] a simple question about a matrix
bates at stat.wisc.edu
Mon Feb 23 00:44:21 CET 2004
"Liaw, Andy" <andy_liaw at merck.com> writes:
> If the matrix is real, then isn't that just
> sqrt(eigen(crossprod(x))$values) ??
> > From: li xian
> > suppose x is a matrix.
> > how to define ||x|| in R?
The symbol ||x|| could mean many different things when x is a matrix.
I presume that you mean some kind of matrix norm. Could you be more
specific about which norm you want? (There are several.)
The one-norm, the Frobenius norm, and the infinity norm are all
available in the new version of the Matrix package, which is currently
available only for the development version of R (to be R-1.9.0).
> mm = Matrix(rnorm(9), nrow = 3)
[,1] [,2] [,3]
[1,] -1.0210873 0.9941221 2.363475
[2,] -0.5171302 -0.3243187 -1.455873
[3,] -2.3793565 0.5223258 -1.034270
> norm(mm, '1')
> norm(mm, 'O') # the one norm
> norm(mm, 'I') # the infinity norm
> norm(mm, 'F') # the Frobenius norm
> norm(mm, 'M') # the Maximum modulus (not really a norm)
More information about the R-help