Inverted columns in SVD


SteveM
09-18-2002, 06:50 AM
I am performing SVD on a matrix A where each column of A contains an image. The algorithms i am using have been thoroughly tested using matlab.

However when using the numerical recipes SVD some of the columns in the U and V matrix are sometimes the negative of the matlab columns. Therefore my images (basis images in the columns of the U matrix) are inverted and this is not acceptable. I have NEVER seen matlab invert the images.

So the question is... is there a way to correct the U/V matrices as a post processing step to make them the same as MATLAB

OR

Is numerical recipes not suitable for such an application and i need to use another library.

I have read the NR book and have not seen this effect mentioned anywhere .... can anyone point me to the page?

Thanks in advance.

SteveM
09-24-2002, 08:18 AM
After more testing matlab this too shows a sign ambiguity... sometimes choosing the alternate solution that recipes picks.
Reading some math texts this is perfectly valid.
My misunderstanding so i need to fix my algorithm.

By the way, the line " g = -SIGN(sqrt(s),f); "
fails with visual studio 6 compiler in release mode. Split the square root onto a separate line to get it to compile.