annotate doc/interpreter/linalg.txi @ 6993:62c6ef95b98c

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