Does anybody use the functions provided in the context LinearAlgebra`LAPACK directly? Is there any documentation out there? Guessing the argument patterns for these function by trial and error is somewhat a nuisance...
Edit: Here is a usage example, computing an LU-factorization for a rectanguar matrix.
m = RandomReal[{-10, 10}, RandomInteger[{100, 2500}, 2]];
lu = m;
n = Min[Dimensions[lu]];
p = ConstantArray[0, n];
c = 0.;
LinearAlgebra`LAPACK`GETRF[lu, p, c];
u = UpperTriangularize[lu];
l = LowerTriangularize[lu, -1] + IdentityMatrix[Dimensions[lu]];
(* computing permuations *)
r = s = Range[Length[lu]];
Do[s[[{i, p[[i]]}]] = s[[{p[[i]], i}]], {i, 1, n}];
r[[s]] = Range[Length[lu]];
Max[Abs[l[[r, 1 ;; n]].u[[1 ;; n, All]] - m]]
Max[Abs[l[[All, 1 ;; n]].u[[1 ;; n, All]] - m[[s]]]]
Note that the arrays lu
and p
and the integer c
are passed by reference and get modified. This can be considered evil behavior by the generic Mathematica user but it is of course more effecient than copying arrays.
We can also compare it to what LUDecomposition
provides us with:
{LU, S, a} = LUDecomposition[m];
Max[Abs[lu - LU]]
S == s
Surprisingly, LUDecomposition
tends to be faster than GETRF
called this way.
Edit: And as Nasser suggested: You can see those commands by issueing
Names["LinearAlgebra`LAPACK`*"]
An output example was offered by Nasser here.
However, they are not documented -- although they give some feedback when entering wrong input.