3
$\begingroup$

What is the algorithm for LU factorization in MATLAB, i.e. [L,U] = lu(a)?

After searching for many examples and trying to compare the result with MATLAB, they are all different.

However, I would like to do the result as it is in MATLAB. Which books contain the algorithm; or, what is exact algorithm used?

a = [1,2,3;4,5,6;7,8,9] [L,U] = lu(a) 

I Googled this, and it is different from MATLAB:
http://web.mit.edu/18.06/www/Course-Info/Tcodes.html
http://www.stat.nctu.edu.tw/~misg/SUmmer_Course/C_language/Ch06/LUdecomposition.htm

  • 0
    Well, one problem with your example is that it's *singular*; a floating-point implementation of LU might yield diagonal elements that are tiny, but not zero, due to floating-point error...2012-05-06

2 Answers 2

1

Nothing special here. MATLAB just uses a type of row exchange algorithm, of which the pivot element is selected. The default threshold of selecting is 1, as mentioned in MATLAB's help document. Try [L,U,P] = lu(a), where P shows the row permutation of the matrix a, based on the pivot selecting criteria A(i,j) >= thresh(1) * max(abs(A(j:m,j))).

0

Since MATLAB Uses Intel's MKL Library, see version -blas in MATLAB, the question is what algorithm does MKL use?

For that you can have a look here (LAPACK - Matrix Factorization Functions):

https://software.intel.com/en-us/mkl-developer-reference-c-matrix-factorization-lapack-computational-routines