madanr
04-16-2002, 07:00 PM
Hi there, I'm writing a program in Java, and I'm trying to port svdcmp over with very little success.
When I try a test matrix, say, the 1x1 identity matrix or the 2x2 identity matrix, U seems to be calculated correctly (the identity matrix), S seems to be correct (the identity matrix), but V ends up being -1 * the identity matrix (so while it obeys V*V' = I, USV' = -A, not A as it should).
I've thoroughly checked and rechecked the port; at this point, I've not changed anything other than to make it compile in java (I even made all my arrays 1 row and column larger, so there's no chance I've made a mistake going from arrays indexed from 1..n to 0..n-1).
I've gone so far as to hand evaluate every line in svdcmp, and this is the result I keep on getting; is there something wrong with the code, am I making a bonehead mistake, or is there some limitation to svdcmp that I'm simply unaware of?
I would appreciate any help anyone can give me; perhaps certain checkpoints in the code where I can test intermediary values, so that I can pinpoint the exact location of the problem.
Thank you,
Madan R.
When I try a test matrix, say, the 1x1 identity matrix or the 2x2 identity matrix, U seems to be calculated correctly (the identity matrix), S seems to be correct (the identity matrix), but V ends up being -1 * the identity matrix (so while it obeys V*V' = I, USV' = -A, not A as it should).
I've thoroughly checked and rechecked the port; at this point, I've not changed anything other than to make it compile in java (I even made all my arrays 1 row and column larger, so there's no chance I've made a mistake going from arrays indexed from 1..n to 0..n-1).
I've gone so far as to hand evaluate every line in svdcmp, and this is the result I keep on getting; is there something wrong with the code, am I making a bonehead mistake, or is there some limitation to svdcmp that I'm simply unaware of?
I would appreciate any help anyone can give me; perhaps certain checkpoints in the code where I can test intermediary values, so that I can pinpoint the exact location of the problem.
Thank you,
Madan R.