# Documentation for LinearAlgebraLAPACK?

Does anybody use the functions provided in the context LinearAlgebraLAPACK 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.;
LinearAlgebraLAPACKGETRF[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["LinearAlgebraLAPACK*"]


An output example was offered by Nasser here.

However, they are not documented -- although they give some feedback when entering wrong input.

• How do you use LinearAlgebraLAPACK ? Do you need to load a package first? Can you show how to even call it? And which version of Mathematica is this supported at? Lapack itself is documented at netlib.org/lapack Jul 3, 2017 at 19:25
• there is a web page here showing mapping between Lapack calls and Mathematica own functions (which many most likely end up calling it and BLAS at one point) Jul 3, 2017 at 19:33
• @Nasser: The context is automatically loaded at startup. (I am currently using version 11.0.1 but I know that this context has been there for quite some versions before.) It is not added to the context Global`, most likely because these functions are solely meant as helpers for LinearSolve, LUDecomposition and friends. I am interested in calling LAPACK rather directly, e.g., because I observed a rather weird behavior of LUDecomposition with non-square matrices. Jul 3, 2017 at 19:57
• A related question. The BLAS functions are now documented (it wasn't before), but the LAPACK ones remain undocumented. Oct 27, 2017 at 13:36
• I'd run my documentation generator on this stuff, but being all inside the kernel it wouldn't help at all. If you find out how things work you should write doc pages and then wrap up a doc paclet to distribute. Oct 27, 2017 at 21:31