Determinant of a 4x4 matrix

55 views
Skip to first unread message

Demián Gutierrez

unread,
Aug 10, 2013, 9:35:04 PM8/10/13
to la...@googlegroups.com
Hello,

When calculating the determinant of a 4x4 matrix using the following code:

    Matrix m = new Basic2DMatrix(new double[][]{{3, 3, 4, 43}, {5, 5, 6, 6}, {70, 7, 8, 8}, {9, 9, 10, 11}});
    System.out.println(m.determinant());

I get 0 as result.

I've calculated it by myself and the result was -9954. I also confirmed the previous result with octave.

Am I doing something wrong or did I just step on a bug?

Regards,
Demián

Vladimir Kostyukov

unread,
Aug 11, 2013, 1:30:07 AM8/11/13
to Demián Gutierrez, la...@googlegroups.com
Hello Demián,

First of all, thank you for the report! I'll try to explain the current situation. This issue was expected to be seen at version 0.4.0, and it was (supposed to) fixed by this pull-request in version 0.4.5 (current development version). But, after your test-case I've realized that there is still a bug in current implementation! I've failed an issue about your findings and I hope Yriy (the person who was fixing previous bug) will fix it ASAP.

So, what about the current situation. Now I've switched the la4j to LU-based determinant calculation. Here is the commit. I would suggest you to update your library instance by current one (if you able to build it by yorself). If not - I would suggest you to wait stable release 0.4.5, which will be ready in two weeks.

Again, thank you very much for reporting. Fell free to ask any questions about la4j (including its building from sources).




--
Thanks,
Vladimir Kostyukov
Reply all
Reply to author
Forward
0 new messages