| Date: | Tue, 8 Apr 2003 21:11:12 -0300 |
| Reply-To: | Carlos Tadeu <ctsdias@CARPA.CIAGRI.USP.BR> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Carlos Tadeu <ctsdias@CARPA.CIAGRI.USP.BR> |
| Subject: | svd in iml |
| Content-Type: | text/plain; charset="iso-8859-1" |
Dear SAS-l,
I am trying to do a singular value decomposition of matrix A in IML using eigvec and eigval functions, but I can not reproduce the original matrix A.
What is wrong? Does anyone have had the same problem?
I know that SVD routine operates well.
The code that I am using eigvec function is:
proc iml;
reset print;
A={1 2 7 9,
0 4 5 1,
2 6 8 2};
n=nrow(A);
p=ncol(A);
AAL=A*t(A);
ALA=t(A)*A;
U=eigvec(AAL);
V=eigvec(ALA);
L=eigval(AAL);
D=sqrt(diag(L));
U=U[1:3,1:3];
V=V[1:4,1:3];
RR=U*D*t(V);
quit;
TIA
Carlos
|