6778
|
1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton |
3294
|
2 @c This is part of the Octave manual. |
|
3 @c For copying conditions, see the file gpl.texi. |
|
4 |
4167
|
5 @node Linear Algebra |
3294
|
6 @chapter Linear Algebra |
|
7 |
|
8 This chapter documents the linear algebra functions of Octave. |
|
9 Reference material for many of these functions may be found in |
|
10 Golub and Van Loan, @cite{Matrix Computations, 2nd Ed.}, Johns Hopkins, |
|
11 1989, and in @cite{@sc{Lapack} Users' Guide}, SIAM, 1992. |
|
12 |
|
13 @menu |
6531
|
14 * Techniques used for Linear Algebra:: |
3294
|
15 * Basic Matrix Functions:: |
|
16 * Matrix Factorizations:: |
|
17 * Functions of a Matrix:: |
|
18 @end menu |
|
19 |
6531
|
20 @node Techniques used for Linear Algebra |
|
21 @section Techniques used for Linear Algebra |
|
22 |
|
23 Octave includes a poly-morphic solver, that selects an appropriate |
|
24 matrix factorization depending on the properties of the matrix itself. |
|
25 Generally, the cost of determining the matrix type is small relative to |
|
26 the cost of factorizing the matrix itself, but in any case the matrix |
|
27 type is cached once it is calculated, so that it is not re-determined |
|
28 each time it is used in a linear equation. |
|
29 |
|
30 The selection tree for how the linear equation is solve or a matrix |
|
31 inverse is form is given by |
|
32 |
|
33 @enumerate 1 |
|
34 @item If the matrix is upper or lower triangular sparse a forward or |
|
35 backward substition using the @sc{Lapack} xTRTRS function, and goto 4. |
|
36 |
|
37 @c Permuted triangular matrices currently disabled in the code |
|
38 @c |
|
39 @c @item If the matrix is a upper triangular matrix with column permutations |
|
40 @c or lower triangular matrix with row permutations, perform a forward or |
|
41 @c backward substitution, and goto 5. |
|
42 |
|
43 @item If the matrix is square, hermitian with a real positive diagonal, |
|
44 attempt Cholesky factorization using the @sc{Lapack} xPOTRF function. |
|
45 |
|
46 @item If the Cholesky factorization failed or the matrix is not |
|
47 hermitian with a real positive diagonal, and the matrix is square, factorize |
|
48 using the @sc{Lapack} xGETRF function. |
|
49 |
|
50 @item If the matrix is not square, or any of the previous solvers flags |
|
51 a singular or near singular matrix, find a least squares solution using |
|
52 the @sc{Lapack} xGELSS function. |
|
53 @end enumerate |
|
54 |
|
55 The user can force the type of the matrix with the @code{matrix_type} |
|
56 function. This overcomes the cost of discovering the type of the matrix. |
|
57 However, it should be noted incorrectly identifying the type of the matrix |
|
58 will lead to unpredictable results, and so @code{matrix_type} should be |
|
59 used with care. |
|
60 |
|
61 It should be noted that the test for whether a matrix is a candidate for |
|
62 Cholesky factorization, performed above and by the @code{matrix_type} |
|
63 function, does not give a certainty that the matrix is |
|
64 Hermitian. However, the attempt to factorize the matrix will quickly |
|
65 flag a non-Hermitian matrix. |
|
66 |
4167
|
67 @node Basic Matrix Functions |
3294
|
68 @section Basic Matrix Functions |
|
69 |
3373
|
70 @DOCSTRING(balance) |
3294
|
71 |
3373
|
72 @DOCSTRING(cond) |
3294
|
73 |
3373
|
74 @DOCSTRING(det) |
3294
|
75 |
3428
|
76 @DOCSTRING(dmult) |
|
77 |
|
78 @DOCSTRING(dot) |
|
79 |
3373
|
80 @DOCSTRING(eig) |
3294
|
81 |
3373
|
82 @DOCSTRING(givens) |
3294
|
83 |
3373
|
84 @DOCSTRING(inv) |
3294
|
85 |
6531
|
86 @DOCSTRING(matrix_type) |
|
87 |
3373
|
88 @DOCSTRING(norm) |
3294
|
89 |
3373
|
90 @DOCSTRING(null) |
3294
|
91 |
3373
|
92 @DOCSTRING(orth) |
3294
|
93 |
3373
|
94 @DOCSTRING(pinv) |
3294
|
95 |
3373
|
96 @DOCSTRING(rank) |
3294
|
97 |
3373
|
98 @DOCSTRING(trace) |
3294
|
99 |
6502
|
100 @DOCSTRING(rref) |
|
101 |
4167
|
102 @node Matrix Factorizations |
3294
|
103 @section Matrix Factorizations |
|
104 |
3373
|
105 @DOCSTRING(chol) |
3294
|
106 |
6502
|
107 @DOCSTRING(cholinv) |
|
108 |
|
109 @DOCSTRING(chol2inv) |
|
110 |
3373
|
111 @DOCSTRING(hess) |
3294
|
112 |
3373
|
113 @DOCSTRING(lu) |
3294
|
114 |
3373
|
115 @DOCSTRING(qr) |
3294
|
116 |
3373
|
117 @DOCSTRING(qz) |
3372
|
118 |
3373
|
119 @DOCSTRING(qzhess) |
3294
|
120 |
3373
|
121 @DOCSTRING(schur) |
3294
|
122 |
3373
|
123 @DOCSTRING(svd) |
3294
|
124 |
5775
|
125 @c FIXME -- should there be a new section here? |
3428
|
126 |
|
127 @DOCSTRING(housh) |
|
128 |
|
129 @DOCSTRING(krylov) |
|
130 |
4167
|
131 @node Functions of a Matrix |
3294
|
132 @section Functions of a Matrix |
|
133 |
3373
|
134 @DOCSTRING(expm) |
3294
|
135 |
3373
|
136 @DOCSTRING(logm) |
3294
|
137 |
3373
|
138 @DOCSTRING(sqrtm) |
3294
|
139 |
3373
|
140 @DOCSTRING(kron) |
3294
|
141 |
3373
|
142 @DOCSTRING(syl) |