Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes

Change language to:
English - Français - 日本語 - Português -

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> Linear Algebra > Linear Equations > lu


LU factorization with pivoting

Calling Sequence

[L,U]= lu(A)
[L,U,E]= lu(A)



real or complex matrix (m x n).


real or complex matrices (m x min(m,n)).


real or complex matrices (min(m,n) x n ).


a (n x n) permutation matrix.


[L,U]= lu(A) produces two matrices L and U such that A = L*U with U upper triangular and L a general matrix without any particular structure. In fact, the matrix A is factored as E*A=B*U where the matrix B is lower triangular and the matrix L is computed from L=E'*B.

If A has rank k, rows k+1 to n of U are zero.

[L,U,E]= lu(A) produces three matrices L, U and E such that E*A = L*U with U upper triangular and E*L lower triangular for a permutation matrix E.

If A is a real matrix, using the function lufact and luget it is possible to obtain the permutation matrices and also when A is not full rank the column compression of the matrix L.

Example #1

In the following example, we create the Hilbert matrix of size 4 and factor it with A=LU. Notice that the matrix L is not lower triangular. To get a lower triangular L matrix, we should have given the output argument E to Scilab.

a = testmatrix("hilb",4);

Example #2

In the following example, we create the Hilbert matrix of size 4 and factor it with EA=LU. Notice that the matrix L is lower triangular.

a = testmatrix("hilb",4);

Example #3

The following example shows how to use the lufact and luget functions.



See Also

  • lufact — sparse lu factorization
  • luget — extraction of sparse LU factors
  • lusolve — sparse linear system solver
  • qr — QR decomposition
  • svd — singular value decomposition

Used Functions

lu decompositions are based on the Lapack routines DGETRF for real matrices and ZGETRF for the complex case.

Report an issue
<< lsq Linear Equations pinv >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:27:16 CEST 2015