Menu

Array out of bounds error in Matrix.solve

Anonymous
2012-03-13
2012-12-12
  • Anonymous

    Anonymous - 2012-03-13

    I frequently get an array out of bounds exception using the Matrix.solve method.  It occurs at the line "while ((Math.abs(mat.el)<1e-15)&&(p<=nRows))."  This while loop appears to allow the value of "p" to exceed the array bounds for the mat.el expression.  I think maybe it was meant for the "if" statement that follows the while loop to be part of the while loop so the method exits when p grows too large.

     
  • David

    David - 2012-03-16

    Hi,
    thanks for reporting the problem.
    I will investigate this.
    regards,

     
  • David

    David - 2012-03-27

    Hi again,
    I think the problem was in the condition testing. I have made an update (you can get it via checkout). But I think that if you got the exception, this is a problem of a non-invertible matrix, and you will still have the problem. Have you tried to check matrix rank before computing ?

    regards,
    david

     

Log in to post a comment.