Re: problem with svd in numpy



Zeynep Gerek wrote:
Hello,

I am having weird problem with svd routine in python.

numpy questions are best asked on the numpy list.

http://www.scipy.org/Mailing_Lists

I am comparing eigenvector values from python and matlab. And they are giving different values. Actually, they are same but python gives negative values of these numbers.

This is my test program (I am dealing with 100x100 matrices) with the array I used in matlab.

I am not sure if svd in numpy has a problem or not. When I test this matrix in matlab, eigenvector values are different, Any idea why I am not getting exact results from both program?

You didn't show what code you executed in Matlab. Did you also do an SVD there, or did you do an eigenvalue decomposition? The two are not the same thing. Which did you intend to do?

In any case, it looks as if numpy_u == -matlab_u. How do numpy_vt and matlab_vt compare? Do they also have flipped signs? If so, then there is no problem. (u, vt) can be replaced with (-u, -vt). The SVD is not unique. Which one you get depends on the precise operations of the implementation.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

.



Relevant Pages

  • Of money and mouths
    ... He emailed me a Python ... Matlab is a package produced by Mathworks. ... I'm not sure how to interface Lisp with a process ... Now the Scheme ...
    (comp.lang.python)
  • Of money and mouths
    ... He emailed me a Python ... Matlab is a package produced by Mathworks. ... I'm not sure how to interface Lisp with a process ... Now the Scheme ...
    (comp.lang.lisp)
  • Re: About alternatives to Matlab
    ... Python to interface with data acquisition hardware really result in ... I am very familiar with Matlab, Labview, and Python, ... Matlab and Python sucks equally much when it comes to ...
    (comp.lang.python)
  • ANN: matplotlib-0.40 python plots with matlab syntax
    ... matplotlib is a pure python 2D plotting library with a matlab syntax ... in one enhanced function 'errorbar'. ...
    (comp.lang.python)
  • Re: About alternatives to Matlab
    ... is there any alternative software for Matlab? ... I have used Matlab for years, and has recently changed to Python. ... Python language is fare more expressive and productive than Matlab, ... The NumPy package is the core requirement for numerical work in Python. ...
    (comp.lang.python)