Limits of matrix size in SVDcmp


Michou
05-22-2007, 07:42 AM
Hello,

It's my first message here !
I am french so sorry for my english.

I have a problem with svdcmp.
svd works fine with "little" matrix (1300x5) but doesn't works with another big matrix (1300x1300).

Is there a limit size for matrix in svdcmp ?

May I have to replace float by double in svdcmp ?

Help me please, it's very important and I don't understand alone !

paolog
06-27-2007, 10:41 AM
Michou,

Can you tell us in what way it does not work? Do any of these apply?

1. A very large matrix will cause the program to run out of memory. Changing float to double will not help here, as it the matrix will then require twice as much memory. Is there any way you can use a smaller matrix?

2. If the matrix is very large, the program will take a long time to find a solution. If you run the program and nothing seems to happen, this might be the reason. I suggest you put in some diagnostics so you can keep track of what stage the program has reached. For example, before the first loop, you could put:

std::cout << "Reducing matrix to bidiagonal form..." << std::endl;

and then immediately inside the loop:

std::cout << "Processing column " << i + 1 << " of " << n << std::endl;

Add similar diagnostics elsewhere in the program.

You might be surprised at how long it takes it to process a single row of the reduction of the matrix to bidiagonal form.

3. Did you type the program in from the book? If so, check very carefully that you have transcribed it correctly. Then check it again. I typed it in from the book and had to go through it three times before I found all my errors.

4. Does produce results like -1.#IND? If so, you have problems with overflow or underflow. The summed results are simply too large. I don't know how to fix this (yet) because I am having the same problem. Good luck...

Paolo

paolog
06-29-2007, 06:10 AM
Actually, make that four times. I still had transcription errors after the third check.