I am working with matrices of which I need both the LinearSolveFunction and the determinant. My question is about something the documentation isn't entirely clear on. As far as I can tell, the LinearSolveFunction obtained from LinearSolve stores the LU decomposition of the matrix and from that it would be very easy to obtain the determinant.
mat = RandomReal[{-1, 1}, {3, 3}]
ls = LinearSolve[mat]
ls[[2, 3]]
Det[mat]
Tr[ls[[2, 3, 1]], Times]
However, the documentation mentions that:
When you create a
LinearSolveFunctionusingLinearSolve[m], this often works by decomposing the matrixminto triangular forms, and sometimes it is useful to be able to get such forms explicitly."
So my question is: when use the above code, am I guaranteed that I will find the LU decomposition of my matrix when I evaluate ls[[2, 3]]? I can see that this is certainly not true when using other Methods in LinearSolve, but the default Automatic method seems to do have the LU decompositions there. Then again: the method being Automatic suggests that it might do something different depending on the matrix I put in.
So all being said and done: is there a good, reliable way to obtain the determinant from a LinearSolveFunction object?
"Cholesky","Banded","Krylov", and even"Multifrontal", which seems to produce a nonstandard LU decomposition). – Michael E2 Mar 17 '18 at 14:43