On Tue, Jun 28, 2011 at 11:36 AM, eat <e.antero.ta...@gmail.com> wrote:
> Hi, > > On Tue, Jun 28, 2011 at 7:43 PM, Lou Pecora <lou_boog2...@yahoo.com>wrote: > >> >> ------------------------------ >> *From:* santhu kumar <mesan...@gmail.com> >> *To:* numpy-discussion@scipy.org >> *Sent:* Tue, June 28, 2011 11:56:48 AM >> *Subject:* [Numpy-discussion] SVD does not converge >> >> Hello, >> >> I have a 380X5 matrix and when I am calculating pseudo-inverse of the >> matrix using pinv(numpy.linalg) I get the following error message: >> >> raise LinAlgError, 'SVD did not converge' >> numpy.linalg.linalg.LinAlgError: SVD did not converge >> >> I have looked in the list that it is a recurring issue but I was unable to >> find any solution. Can somebody please guide me on how to fix that issue? >> >> Thanks >> Santhosh >> ============================================== >> >> I had a similar problem (although I wasn't looking for the pseudo >> inverse). I found that "squaring" the matrix fixed the problem. But I'm >> guessing in your situation that would mean a 380 x 380 matrix (I hope I'm >> thinking about your case correctly). But it's worth trying since it's easy >> to do. >> > With my rusty linear algebra: if one chooses to proceed with this > 'squaring' avenue, wouldn't it then be more economical to base the > calculations on a square 5x5 matrix? Something like: > A_pinv= dot(A, pinv(dot(A.T, A))).T > Instead of a 380x380 based matrix: > A_pinv= dot(pinv(dot(A, A.T)), A).T > > Yes, or similarly, start with a QR decomposition and work with R. In fact, the SVD algorithm we use first does QR, then reduces R to tridiagonal form (IIRC), and proceeds from there. Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion