Skip to content

SVD outputs NaN for certain inputs #75

Description

@dllu

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.

image

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions