Page 108 - Applied Numerical Methods Using MATLAB
P. 108
DECOMPOSITION (FACTORIZATION) 97
Table 2.1 Residual Error and the Number of Floating-Point Operations of Various
Solutions
tmp = forsubst(L,P*b)
backsubst(U,tmp) gauss(A,b) A\b A^-1*b
||Ax i − b|| 1.3597e-016 5.5511e-017 1.7554e-016 3.0935e-012
# of flops 123 224 155 50
(cf) The numbers of flops for the LU decomposition and the inverse of the matrix A are not counted.
(cf) Note that the command ‘flops’ to count the number of floating-point operations is no longer
available in MATLAB 6.x and higher versions.
2.4.2 Other Decomposition (Factorization): Cholesky, QR, and SVD
There are several other matrix decompositions such as Cholesky decomposition,
QR decomposition, and singular value decomposition (SVD). Instead of looking
into the details of these algorithms, we will simply survey the MATLAB built-in
functions implementing these decompositions.
Cholesky decomposition factors a positive definite symmetric/Hermitian matrix
into an upper triangular matrix premultiplied by its transpose as
T
A = U U (U: an upper triangular matrix) (2.4.12)
and is implemented by the MATLAB built-in function chol().
(cf) If a (complex-valued) matrix A satisfies A ∗T = A—that is, the conjugate transpose
of a matrix equals itself—it is said to be Hermitian. It is said to be just symmetric
T
in the case of a real-valued matrix with A = A.
∗T
(cf) If a square matrix A satisfies x A x > 0 ∀ x = 0, the matrix is said to be positive
definite (see Appendix B).
>>A = [2 3 4;3 5 6;4 6 9]; %a positive definite symmetric matrix
>>U = chol(A) %Cholesky decomposition
U = 1.4142 2.1213 2.8284
0 0.7071 0.0000
0 0 1.0000
>>U’*U - A %to check if the result is right
QR decomposition is to express a square or rectangular matrix as the product
of an orthogonal (unitary) matrix Q and an upper triangular matrix R as
A = QR (2.4.13)
∗T
T
where Q Q = I (Q Q = I). This is implemented by the MATLAB built-in
function qr().