[S] Sym. Sq. Root of Matrix

Erin Hodgess (hodgess@uhdux2.dt.uh.edu)
Mon, 18 May 1998 12:43:59 -0500


Dear Richard:

Here is a little function that I wrote to produce a
square root of a matrix.

dar3 <- function(x)
{
x1 <- eigen(x)
if(any(x1$values) < 0)
stop("Negative Eigenvalues")
x1e <- diag(x1$values)
x1e <- sqrt(x1e)
u1 <- cbind(x1$vectors)
u1i <- solve(u1)
w <- u1 %*% x1e %*% u1i
w
}

I hope this helps!

Sincerely,
Erin Hodgess
Assistant Professor
Dept. of Computer and Mathematical Sciences
University of Houston -- Downtown
e-mail: hodgess@uhdux2.dt.uh.edu

From: ID49@vm.acs.unt.edu
Subject: [S] Symmetric Square Root of Matrix
To: s-news@wubios.wustl.edu
Sender: owner-s-news@wubios.wustl.edu
Status: R

I understand that chol() returns an upper triangular matrix that
corresponds to the square root of a matrix. Is there an S function
that is the square root of a matrix but is symmetric?

Richard Herrington
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news