Possible bug in determinant calculation

I know that this has been fixed, but I wanted to mention that the Bareiss algorithm produces exact results with integer matrices, and is simpler than LU with pivoting. I wrote a templated C++ Bareiss implementation that gives the correct result with integer, float, and GMP mpf_t matrices.

I’ll also second the suggestion to have the det() function return the same type as the argument.

Determinants do have pedagogical uses… e.g. they are used heavily in G. Baley Price’s Multivariable Analysis extending differentiation to higher dimensions. The mechanics, if you will, are ugly, but conceptually Price’s approach is intuitive (to my mind).

Larry

2 Likes

Julia 1.7 uses the Bareiss algorithm for determinants of BigInt matrices. (The implementation is also provided in a generic form in LinearAlgebra.det_bareiss if you want to use it for some other type.)

8 Likes