By construction, LUDecomposition performs LU-decomposition with pivoting; i.e., with row permutations (otherwise, the decomposition may not exist). Is it possible to tell Mathematica not to use pivoting in cases when the decomposition can be performed without it?

  • $\begingroup$ It seems LAPACK does not have a no-pivot routine, but MKL does. I can't find an access point within Mathematica, but maybe there is some way to use it. $\endgroup$
    – Michael E2
    Commented Dec 7, 2017 at 20:38
  • $\begingroup$ This seems to work N@LUDecomposition[SetPrecision[m, Infinity]], but it will be slower than machine precision. $\endgroup$
    – Michael E2
    Commented Dec 7, 2017 at 20:42
  • $\begingroup$ @MichaelE2 if BLAS has it Mathematica might expose that. $\endgroup$
    – b3m2a1
    Commented Mar 26, 2018 at 8:59
  • 1
    $\begingroup$ @b3m2a1, the subset of level-3 BLAS in Mathematica does not have a routine for LU decomposition. $\endgroup$ Commented Mar 26, 2018 at 9:23
  • 3
    $\begingroup$ @MichaelE2 I might be remembering incorrectly, but I believe the exact integer/rational case also uses a pivot strategy, just a different one from the approximate numeric case. $\endgroup$ Commented Mar 26, 2018 at 13:20

1 Answer 1


Here's one way to cheat LUDecomposition[]:

BlockRandom[SeedRandom[42]; mat = RandomReal[{1, 2}, {3, 3}]];

{lu, piv, cond} = LUDecomposition[Map[Interval[{#, #}] &, mat, {2}]] /.
                  Interval -> Mean;

Norm[(LowerTriangularize[lu, -1] + IdentityMatrix[Length[lu]]).
     UpperTriangularize[lu] - mat, ∞]

As another example, let's use this trick to get the Cholesky triangle corresponding to a symmetric positive definite matrix:

mat = N[HilbertMatrix[6]];
lu = First[LUDecomposition[Map[Interval[{#, #}] &, mat, {2}]] /. Interval -> Mean];

Form the Cholesky triangle:

ch1 = DiagonalMatrix[1/Sqrt[Diagonal[lu]]].UpperTriangularize[lu];

Compare with the result of CholeskyDecomposition[]:

Norm[ch1 - CholeskyDecomposition[mat], ∞]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.