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