Called with one output argument chol fails if A or S is
not positive definite. With two or more output arguments p flags
whether the matrix was positive definite and chol does not fail. A
zero value indicated that the matrix was positive definite and the R
gives the factorization, and p will have a positive value otherwise.

If called with 3 outputs then a sparsity preserving row/column permutation
is applied to A prior to the factorization. That is R is the
factorization of A(Q,Q) such that

R' * R = Q' * A * Q.

The sparsity preserving permutation is generally returned as a matrix.
However, given the flag "vector", Q will be returned as a
vector such that

R' * R = A(Q, Q).

Called with either a sparse or full matrix and using the "lower"
flag, chol returns the lower triangular factorization such that

L * L' = A.

For full matrices, if the "lower" flag is set only the lower
triangular part of the matrix is used for the factorization, otherwise the
upper triangular part is used.

In general the lower triangular factorization is significantly faster for
sparse matrices.

The Hessenberg decomposition is usually used as the first step in an
eigenvalue computation, but has other applications as well
(see Golub, Nash, and Van Loan,
IEEE Transactions on Automatic Control, 1979).

When called with two or three output arguments and a spare input matrix,
lu does not attempt to perform sparsity preserving column
permutations. Called with a fourth output argument, the sparsity
preserving column transformation Q is returned, such that
P * A * Q = L * U.

Called with a fifth output argument and a sparse input matrix,
lu attempts to use a scaling factor R on the input matrix
such that
P * (R \ A) * Q = L * U.
This typically leads to a sparser and more stable factorization.

An additional input argument thres, that defines the pivoting
threshold can be given. thres can be a scalar, in which case
it defines the UMFPACK pivoting tolerance for both symmetric and
unsymmetric cases. If thres is a 2-element vector, then the first
element defines the pivoting tolerance for the unsymmetric UMFPACK
pivoting strategy and the second for the symmetric strategy. By default,
the values defined by spparms are used ([0.1, 0.001]).

Given the string argument "vector", lu returns the values
of P and Q as vector values, such that for full matrix,
A (P,:) = L * U, and R(P,:)
* A (:, Q) = L * U.

With two output arguments, returns the permuted forms of the upper and
lower triangular matrices, such that A = L * U.
With one output argument y, then the matrix returned by the LAPACK
routines is returned. If the input matrix is sparse then the matrix L
is embedded into U to give a return value similar to the full case.
For both full and sparse matrices, lu loses the permutation
information.

Given an LU factorization of a real or complex matrix
A = L*U, L lower unit trapezoidal and
U upper trapezoidal, return the LU factorization
of A + x*y.’, where x and y are
column vectors (rank-1 update) or matrices with equal number of columns
(rank-k update).

Optionally, row-pivoted updating can be used by supplying a row permutation
(pivoting) matrix P; in that case, an updated permutation matrix is
returned. Note that if L, U, P is a pivoted
LU factorization as obtained by lu:

[L, U, P] = lu (A);

then a factorization of A+x*y.' can be obtained
either as

[L1, U1] = lu (L, U, P*x, y)

or

[L1, U1, P1] = lu (L, U, P, x, y)

The first form uses the unpivoted algorithm, which is faster, but less
stable. The second form uses a slower pivoted algorithm, which is more
stable.

The matrix case is done as a sequence of rank-1 updates; thus, for large
enough k, it will be both faster and more accurate to recompute the
factorization from scratch.

The qr factorization has applications in the solution of least
squares problems

min norm(A x - b)

for overdetermined systems of equations (i.e.,
A
is a tall, thin matrix). The QR factorization is
Q * R = A where Q is an orthogonal matrix and
R is upper triangular.

If given a second argument of '0', qr returns an economy-sized
QR factorization, omitting zero rows of R and the corresponding
columns of Q.

If the matrix A is full, the permuted QR factorization
[Q, R, P] = qr (A) forms the
QR factorization such that the diagonal entries of R are
decreasing in magnitude order. For example, given the matrix
a = [1, 2; 3, 4],

If the matrix A is sparse, then compute the sparse
QR factorization of A, using CSPARSE. As the matrix Q
is in general a full matrix, this function returns the Q-less
factorization R of A, such that
R = chol (A' * A).

If the final argument is the scalar 0 and the number of rows is
larger than the number of columns, then an economy factorization is
returned. That is R will have only size (A,1) rows.

If an additional matrix B is supplied, then qr returns
C, where C = Q' * B. This allows the
least squares approximation of A \ B to be calculated
as

Given a QR factorization of a real or complex matrix
A = Q*R, Q unitary and
R upper trapezoidal, return the QR factorization of
A + u*v’, where u and v are column vectors
(rank-1 update) or matrices with equal number of columns
(rank-k update). Notice that the latter case is done as a sequence of rank-1
updates; thus, for k large enough, it will be both faster and more accurate
to recompute the factorization from scratch.

The QR factorization supplied may be either full (Q is square) or
economized (R is square).

Given a QR factorization of a real or complex matrix
A = Q*R, Q unitary and
R upper trapezoidal, return the QR factorization of
[A(:,1:j-1) x A(:,j:n)], where u is a column vector to be inserted
into A (if orient is "col"), or the
QR factorization of [A(1:j-1,:);x;A(:,j:n)], where x is a row
vector to be inserted into A (if orient is "row").

The default value of orient is "col". If orient is
"col", u may be a matrix and j an index vector
resulting in the QR factorization of a matrix B such that
B(:,j) gives u and B(:,j) = [] gives A.
Notice that the latter case is done as a sequence of k insertions;
thus, for k large enough, it will be both faster and more accurate to
recompute the factorization from scratch.

If orient is "col", the QR factorization supplied may
be either full (Q is square) or economized (R is square).

Given a QR factorization of a real or complex matrix
A = Q*R, Q unitary and
R upper trapezoidal, return the QR factorization of
[A(:,1:j-1) A(:,j+1:n)], i.e., A with one column deleted
(if orient is "col"), or the QR factorization of
[A(1:j-1,:);A(j+1:n,:)], i.e., A with one row deleted (if
orient is "row").

The default value of orient is "col".

If orient is "col", j may be an index vector
resulting in the QR factorization of a matrix B such that
A(:,j) = [] gives B. Notice that the latter case is done as
a sequence of k deletions; thus, for k large enough, it will be both faster
and more accurate to recompute the factorization from scratch.

If orient is "col", the QR factorization supplied may
be either full (Q is square) or economized (R is square).

Given a QR factorization of a real or complex matrix
A = Q*R, Q unitary and
R upper trapezoidal, return the QR factorization
of A(:,p), where p is the permutation p = [1:i-1, shift(i:j, 1), j+1:n] if i < j
or p = [1:j-1, shift(j:i,-1), i+1:n] if j < i.

As in form [2], but allows ordering of generalized eigenpairs for, e.g.,
solution of discrete time algebraic Riccati equations. Form 3 is not
available for complex matrices, and does not compute the generalized
eigenvectors V, W, nor the orthogonal matrix Q.

opt

for ordering eigenvalues of the GEP pencil. The leading block of
the revised pencil contains all eigenvalues that satisfy:

"N"

= unordered (default)

"S"

= small: leading block has all |lambda| ≤ 1

"B"

= big: leading block has all |lambda| ≥ 1

"-"

= negative real part: leading block has all eigenvalues
in the open left half-plane

"+"

= non-negative real part: leading block has all eigenvalues
in the closed right half-plane

Note: qz performs permutation balancing, but not scaling
(see XREFbalance). The order of output arguments was selected for
compatibility with MATLAB.

where U is a unitary matrix
(U'* U is identity)
and S is upper triangular. The eigenvalues of A (and S)
are the diagonal elements of S. If the matrix A is real, then
the real Schur decomposition is computed, in which the matrix U
is orthogonal and S is block upper triangular with blocks of size at
most
2 x 2
along the diagonal. The diagonal elements of S
(or the eigenvalues of the
2 x 2
blocks, when appropriate) are the eigenvalues of A and S.

The default for real matrices is a real Schur decomposition.
A complex decomposition may be forced by passing the flag
"complex".

The eigenvalues are optionally ordered along the diagonal according to the
value of opt. opt = "a" indicates that all eigenvalues
with negative real parts should be moved to the leading block of S
(used in are), opt = "d" indicates that all
eigenvalues with magnitude less than one should be moved to the leading
block of S (used in dare), and opt = "u", the
default, indicates that no ordering of eigenvalues should occur. The
leading k columns of U always span the A-invariant
subspace corresponding to the k leading eigenvalues of S.

The Schur decomposition is used to compute eigenvalues of a square
matrix, and has applications in the solution of algebraic Riccati equations
in control (see are and dare).

Currently recognized values are "gesvd" and "gesdd".
The default is "gesvd".

When called from inside a function with the "local" option, the
variable is changed locally for the function and any subroutines it calls.
The original variable value is restored when exiting the function.