Git Product home page Git Product logo

svd's People

Contributors

ktye avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

svd's Issues

Accessing array[-1] element

In svd.go:194:

svd/svd.go

Line 194 in 845d02e

if math.Abs(S[L-1]) <= eps {

The last loop iteration is L=0, and in this case S[-1] is attempted to be accessed, which is undefined behaviour.

Additionally, after the L=0 loop, L will be decremented to L=-1, which causes the loop condition to fail, and thus exit the loop. The following loop on line 203 sets i=L=-1, and thus attempts to access t[-1], which is undefined behaviour.

Suggested fix for line 190 is to make it closer to the original Fortran:

L = k
for LL = 1; LL <= k; LL++ {
    L = k + 1 - LL

Interestingly, an older C translation of SVD from the ACM 1969 issue has the same bug, but not the original Fortran...
http://www.geocities.ws/hjsmithh/Algo358GDa.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.