Next: Functions of a Matrix, Previous: Basic Matrix Functions, Up: Linear Algebra
Compute the Cholesky factor, r, of the symmetric positive definite matrix a, where
r' * r = a.See also: cholinv, chol2inv.
Compute the Hessenberg decomposition of the matrix a.
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). The Hessenberg decomposition is
p * h * p' = a
wherep
is a square unitary matrix (p' * p = I
, using complex-conjugate transposition) andh
is upper Hessenberg (i >= j+1 => h (i, j) = 0
).
Compute the LU decomposition of a, using subroutines from Lapack. The result is returned in a permuted form, according to the optional return value p. For example, given the matrix
a = [1, 2; 3, 4]
,[l, u, p] = lu (a)returns
l = 1.00000 0.00000 0.33333 1.00000 u = 3.00000 4.00000 0.00000 0.66667 p = 0 1 1 0The matrix is not required to be square.
Compute the QR factorization of a, using standard Lapack subroutines. For example, given the matrix
a = [1, 2; 3, 4]
,[q, r] = qr (a)returns
q = -0.31623 -0.94868 -0.94868 0.31623 r = -3.16228 -4.42719 0.00000 -0.63246The
qr
factorization has applications in the solution of least squares problemsmin norm(A x - b)
for overdetermined systems of equations (i.e.,
a
is a tall, thin matrix). The QR factorization isq * r = a
whereq
is an orthogonal matrix andr
is upper triangular.The permuted QR factorization
[
q,
r,
p] = qr (
a)
forms the QR factorization such that the diagonal entries ofr
are decreasing in magnitude order. For example, given the matrixa = [1, 2; 3, 4]
,[q, r, p] = qr(a)returns
q = -0.44721 -0.89443 -0.89443 0.44721 r = -4.47214 -3.13050 0.00000 0.44721 p = 0 1 1 0The permuted
qr
factorization[q, r, p] = qr (a)
factorization allows the construction of an orthogonal basis ofspan (a)
.
Generalized eigenvalue problem A x = s B x, QZ decomposition. There are three ways to call this function:
lambda = qz(A,B)
Computes the generalized eigenvalues lambda of (A - s B).
[AA, BB, Q, Z, V, W, lambda] = qz (A, B)
Computes qz decomposition, generalized eigenvectors, and generalized eigenvalues of (A - sB)
A*V = B*V*diag(lambda) W'*A = diag(lambda)*W'*B AA = Q'*A*Z, BB = Q'*B*Zwith Q and Z orthogonal (unitary)= I
[AA,BB,Z{, lambda}] = qz(A,B,opt)
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
"+"
- = nonnegative real part: leading block has all eigenvalues in the closed right half-plane
Note: qz performs permutation balancing, but not scaling (see balance). Order of output arguments was selected for compatibility with MATLAB
See also: balance, dare, eig, schur.
Compute the Hessenberg-triangular decomposition of the matrix pencil
(
a,
b)
, returning aa=
q*
a*
z, bb=
q*
b*
z, with q and z orthogonal. For example,[aa, bb, q, z] = qzhess ([1, 2; 3, 4], [5, 6; 7, 8]) => aa = [ -3.02244, -4.41741; 0.92998, 0.69749 ] => bb = [ -8.60233, -9.99730; 0.00000, -0.23250 ] => q = [ -0.58124, -0.81373; -0.81373, 0.58124 ] => z = [ 1, 0; 0, 1 ]The Hessenberg-triangular decomposition is the first step in Moler and Stewart's QZ decomposition algorithm.
Algorithm taken from Golub and Van Loan, Matrix Computations, 2nd edition.
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
anddare
).schur
always returnss = u' * a * u
whereu
is a unitary matrix (u'* u
is identity) ands
is upper triangular. The eigenvalues ofa
(ands
) are the diagonal elements ofs
. If the matrixa
is real, then the real Schur decomposition is computed, in which the matrixu
is orthogonal ands
is block upper triangular with blocks of size at most2 x 2
along the diagonal. The diagonal elements ofs
(or the eigenvalues of the2 x 2
blocks, when appropriate) are the eigenvalues ofa
ands
.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 ofs
(used inare
),opt = "d"
indicates that all eigenvalues with magnitude less than one should be moved to the leading block ofs
(used indare
), andopt = "u"
, the default, indicates that no ordering of eigenvalues should occur. The leadingk
columns ofu
always span thea
-invariant subspace corresponding to thek
leading eigenvalues ofs
.
Compute the singular value decomposition of a
a = u * sigma * v'The function
svd
normally returns the vector of singular values. If asked for three return values, it computes U, S, and V. For example,svd (hilb (3))returns
ans = 1.4083189 0.1223271 0.0026873and
[u, s, v] = svd (hilb (3))returns
u = -0.82704 0.54745 0.12766 -0.45986 -0.52829 -0.71375 -0.32330 -0.64901 0.68867 s = 1.40832 0.00000 0.00000 0.00000 0.12233 0.00000 0.00000 0.00000 0.00269 v = -0.82704 0.54745 0.12766 -0.45986 -0.52829 -0.71375 -0.32330 -0.64901 0.68867If given a second argument,
svd
returns an economy-sized decomposition, eliminating the unnecessary rows or columns of u or v.
Computes householder reflection vector housv to reflect x to be jth column of identity, i.e., (I - beta*housv*housv')x =e(j) inputs x: vector j: index into vector z: threshold for zero (usually should be the number 0) outputs: (see Golub and Van Loan) beta: If beta = 0, then no reflection need be applied (zer set to 0) housv: householder vector
Construct an orthogonal basis u of block Krylov subspace
[v a*v a^2*v ... a^(k+1)*v]Using Householder reflections to guard against loss of orthogonality.
If v is a vector, then h contains the Hessenberg matrix such that
a*u == u*h
. Otherwise, h is meaningless.The value of nu is the dimension of the span of the krylov subspace (based on eps1).
If b is a vector and k is greater than m-1, then h contains the Hessenberg decompostion of a.
The optional parameter eps1 is the threshold for zero. The default value is 1e-12.
If the optional parameter pflg is nonzero, row pivoting is used to improve numerical behavior. The default value is 0.
Reference: Hodel and Misra, "Partial Pivoting in the Computation of Krylov Subspaces", to be submitted to Linear Algebra and its Applications