Skip to content

Infinite loop in svd function #5

@mooreryan

Description

@mooreryan

For some matrices, this loop starts to loop infinitely:

I did some debugging, and this if statement appears to always be true:

if ( ( Math.abs( B.val[(n-1)*B.n + n-2] ) > TOL ) || (Math.abs(B.val[(n-2)*B.n + n-1]) > TOL ) ) {

Calling svd on this matrix (it's centered) will trigger the infinite loop:

[
  [-0.5, -0.5, 1, -1.5, 1.5, 0], 
  [0.5, 0.5, -1, 1.5, -1.5, 0]
]

but this one won't:

[
  [-0.5, -0.5, 1, -1.5, 1.5, 0],  
  [0.5, 0.5, -1, 1.5, -1.5, 1]
]

I tried a few different examples and not every centered matrix triggers this issue, but I haven't found a non-centered matrix that triggers the problem.

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