%LU     LU factorization.
%   [L,U] = LU(A) returns an upper triangular matrix in U and a permuted
%   lower triangular matrix in L, such that A = L*U. The input matrix A can
%   be full or sparse.
%
%   [L,U,P] = LU(A) returns unit lower triangular matrix L, upper
%   triangular matrix U, and permutation matrix P such that P*A = L*U.
%
%   [L,U,P] = LU(A, outputForm) returns P in the form specified by
%   outputForm:
%       'matrix' - (default) P is a matrix such that P*A = L*U. 
%       'vector' - P is a vector such that A(P,:) = L*U.
%
%   The following syntaxes *only* apply for a sparse input matrix A:
%
%   [L,U,P,Q] = LU(A) returns unit lower triangular matrix L, upper
%   triangular matrix U, and row/column permutation matrices P and Q such
%   that P*A*Q = L*U. For sparse matrices this is significantly more time
%   and memory efficient than the three-output syntax.
%
%   [L,U,P,Q,D] = LU(A) also returns a diagonal scaling matrix D such that
%   P*(D\A)*Q = L*U for sparse A. Typically, the row-scaling leads to a
%   sparser and more stable factorization. Note that this is the
%   factorization used by sparse MLDIVIDE.
%
%   [___] = LU(A,THRESH) specifies the pivoting strategy employed by LU.
%   THRESH is a scalar or two-element vector with values in [0 1].
%   Increasing the value of THRESH tends to lead to higher accuracy, but
%   typically at a greater cost in time and memory. Depending on the number
%   of output arguments specified, the default value and requirements for
%   the thresh input are different:
%     * If 3 or fewer outputs are specified, then THRESH is a scalar. The
%       default value is 1.0.
%     * If 4 or more outputs are specified, then THRESH is a two-element
%       vector. The default value is [0.1 0.001].
%
%   [___] = LU(___, outputForm) specifies the output form of P and Q. Use
%   this option to return P and Q as vectors instead of matrices. P and Q
%   satisfy different identities depending on the number of outputs
%   specified and whether they are matrices or vectors:
%     With 4 outputs:
%       'matrix' - (default) P is a matrix such that P*A*Q = L*U.
%       'vector' - P is a vector such that A(P,Q) = L*U.
%     With 5 outputs:
%       'matrix' - (default) P is a matrix such that P*(D\A)*Q = L*U.
%       'vector' - P is a vector such that D(:,P)\A(:,Q) = L*U.
%
%   See also QR, CHOL, ILU, MLDIVIDE, DECOMPOSITION, INV, COND.

%   Copyright 1984-2020 The MathWorks, Inc.
%   Built-in function.