isaac-jordan / Matrixonator-Java

A Java port of The Matrixonator Python. A program for dealing with mathematical matrices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing tests for calculating Reduced Row Echelon Form (RREF) of matrix

isaac-jordan opened this issue · comments

First failed test is testMatrixReduceNegative() which gives the following exception when calcuting RREF of { { 1, 2, 1 }, { -2, -3, 1 }, { 3, 5, 0 } }. The correct result is given here.

java.lang.ArrayIndexOutOfBoundsException: 3
at ijordan.matrixonator.model.Matrix.stepOne(Matrix.java:175)
at ijordan.matrixonator.model.Matrix.stepOne(Matrix.java:184)
at ijordan.matrixonator.model.Matrix.reducedEchelonForm(Matrix.java:125)
at ijordan.matrixonatorTest.MatrixTest.testMatrixReduceNegative(MatrixTest.java:120)
...

The second failed test gives no exception, just an incorrect result. The solution given by the method is [[3.1305550697556894E56, 1.4903230184787869E57, 1.693570856450139E58, 1.1369543976996965E58], [-4.14862777762012E52, -1.9749837758229463E53, -2.244328862416484E54, -1.5066978510467205E54], [-6.3998734312946644E44, -3.0467052894723863E45, -3.462210019214276E46, -2.324304821444897E46], [-2.2234667295396705E29, -1.0584971591358462E30, -1.2028532862476555E31, -8.075182259887142E30]], whereas the correct solution is given here.

Both of these failures are very likely due to incorrect code in the method calculating the RREF.

Found some information relating to this issue.
The code that this algorithm stems from in the original Matrixonator repo is actually bugged as well for the same test data. So solving this issue here, will likely also be related to the issue in that Python code.

commented

This issue seems to have been fixed with your most recent commit.

Indeed, thank you for pointing this out. Solved by a32cffb.