※ 引述《yabt (痴心絕對)》之銘言:
: ※ 引述《brooky (未夠班)》之銘言:
: : d_minus[d_minus > 1e-07] <- 1/d_minus[d_minus > 1e-07];
: : d_minus[d_minus <= 1e-07] <- 0;
: : x_minus <- v %*% diag(d_minus) %*% t(u);
: : coef <- x_minus %*% y;
: I have used "lm" to do the same job as yours, and the coefficients are
: identical to those from SVD.
: I suppose that your "d_minus" is the "d" component in the ouput of SVD,
: and there might be some problem in your code.
Thanks for your reply.
I use "d_minus" to save "1/d" where d is the component get from SVD.
I need "1/d" because I want to use it for calculating "x^-1"
x ^-1 = v %*% w^-1 %*% t(u)