[Jama] JAMA Matrix library bug

16 views
Skip to first unread message

Averbuch, Alex

unread,
Jan 29, 2018, 10:05:12 AM1/29/18
to ja...@list.nist.gov
To whom it may concern.

I've discovered bug in the function implementing Singular Value Decomposition (svd()) in Matrix class. It works incorrectly when the original matrix has more columns than rows. If that is the case, it creates square matrix U with the number of rows and columns equal to the number of rows of the original matrix, but internal n value (returned by getColumnDimention() function) is one greater. Because that value is used in many functions, such as print() and getArrayCopy(), any call of them causes ArrayIndexOutOfBoundsException.

BTW, is there any reason why to use those values rather than built in array variable "length"? If there is such reason, some check of consistency should be implemented in all functions, using m and n as an internal array sizes.

Best regards,

Alex

Reply all
Reply to author
Forward
0 new messages