numeric
numeric copied to clipboard
SVD outputs NaN for certain inputs
Example input:
IN> numeric.svd([[ 1.2314470096270005, -8.927990819795772],
[ 0.0710192233504547, -0.5148893692907976]])
OUT> {U: [[ NaN, NaN], [ NaN, NaN]], S: [ 0, NaN], V: [[ 0.9906, 0.1366], [ 0.1366, -0.9906]]}
Tested on both Chromium and Firefox.

However, GNU Octave manages to compute a correct SVD without outputting NaN.
octave:23> A = [[ 1.2314470096270005, -8.927990819795772],
> [ 0.0710192233504547, -0.5148893692907976]]
A =
1.231447 -8.927991
0.071019 -0.514889
octave:24> [U, S, V] = svd(A)
U =
-0.998341 -0.057576
-0.057576 0.998341
S =
Diagonal Matrix
9.0275e+00 0
0 3.0340e-17
V =
-0.13664 -0.99062
0.99062 -0.13664
octave:25> U * S * V'
ans =
1.231447 -8.927991
0.071019 -0.514889
can reproduce: x=[[1,2],[2,4]]
numeric.svd(x).S [0, NaN]
x=[[1,2],[3,6]]
numeric.svd(x).S [7.071067811865476, 0]
Hi,
Thanks for this bug report. I apologize, I can't really make the fixes. I know it's my fault, but my build/test/deploy system takes me a whole week of work to update every time I have to bugfix something. This is because I need to test in multiple browsers and that software stack is a mess (not my fault). I really don't have the time to do it right now!
I will try to fix it when I can fix the whole thing though.
Thanks!
On 25 April 2017 at 02:57, cladelpino [email protected] wrote:
can reproduce: x=[[1,2],[2,4]]
numeric.svd(x).S [0, NaN]
x=[[1,2],[3,6]]
numeric.svd(x).S [7.071067811865476, 0]
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sloisel/numeric/issues/75#issuecomment-296861563, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwKXKyirCryjrbB8guGFc3u3soik6TKks5rzUUGgaJpZM4KZWb3 .
-- Sébastien Loisel Assistant Professor Department of Mathematics, Heriot-Watt University Riccarton, EH14 4AS, United Kingdom web: http://www.ma.hw.ac.uk/~loisel/ email: S.Loisel at hw.ac.uk phone: +44 131 451 3234 fax: +44 131 451 3249
Thanks to you for this piece of software. Do you have this bug located or do you need help locating it ?
Hi,
First, like I said, I literally cannot put any fixes in there because my build/test/deploy system is the most painful thing to fix so I've not even been applying patches people are sending me!
Second, the SVD code is supposedly a port of the code by Golub and Reisch. It was sent to me by Shanti Rao a long time ago and I haven't looked inside the routines. So no, I don't know where the problem is.
Thanks,
On 26 April 2017 at 21:16, cladelpino [email protected] wrote:
Thanks to you for this piece of software. Do you have this bug located or do you need help locating it ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sloisel/numeric/issues/75#issuecomment-297513247, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwKXPsxvgRzoiGdD9xTtemvp-vq5G4vks5rz5gcgaJpZM4KZWb3 .
-- Sébastien Loisel Assistant Professor Department of Mathematics, Heriot-Watt University Riccarton, EH14 4AS, United Kingdom web: http://www.ma.hw.ac.uk/~loisel/ email: S.Loisel at hw.ac.uk phone: +44 131 451 3234 fax: +44 131 451 3249
For a 3x2 matrix (e.g. numeric.svd([[1,4],[2,5],[3,6]])), I get U as a 3x2 matrix instead of a 3x3 as I was expecting. Any ideas why that might be?