File: Basic-Matrix-Functions.html

package info (click to toggle)
octave 3.6.2-5%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 71,636 kB
  • sloc: cpp: 241,186; fortran: 23,651; sh: 14,790; ansic: 7,153; lex: 3,761; objc: 3,404; yacc: 3,386; makefile: 2,073; awk: 985; perl: 838
file content (459 lines) | stat: -rw-r--r-- 24,786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
<html lang="en">
<head>
<title>Basic Matrix Functions - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Linear-Algebra.html#Linear-Algebra" title="Linear Algebra">
<link rel="prev" href="Techniques-Used-for-Linear-Algebra.html#Techniques-Used-for-Linear-Algebra" title="Techniques Used for Linear Algebra">
<link rel="next" href="Matrix-Factorizations.html#Matrix-Factorizations" title="Matrix Factorizations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Basic-Matrix-Functions"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Matrix-Factorizations.html#Matrix-Factorizations">Matrix Factorizations</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Techniques-Used-for-Linear-Algebra.html#Techniques-Used-for-Linear-Algebra">Techniques Used for Linear Algebra</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Linear-Algebra.html#Linear-Algebra">Linear Algebra</a>
<hr>
</div>

<h3 class="section">18.2 Basic Matrix Functions</h3>

<!-- balance src/DLD-FUNCTIONS/balance.cc -->
<p><a name="doc_002dbalance"></a>

<div class="defun">
&mdash; Loadable Function: <var>AA</var> = <b>balance</b> (<var>A</var>)<var><a name="index-balance-2001"></a></var><br>
&mdash; Loadable Function: <var>AA</var> = <b>balance</b> (<var>A, opt</var>)<var><a name="index-balance-2002"></a></var><br>
&mdash; Loadable Function: [<var>DD</var>, <var>AA</var>] = <b>balance</b> (<var>A, opt</var>)<var><a name="index-balance-2003"></a></var><br>
&mdash; Loadable Function: [<var>D</var>, <var>P</var>, <var>AA</var>] = <b>balance</b> (<var>A, opt</var>)<var><a name="index-balance-2004"></a></var><br>
&mdash; Loadable Function: [<var>CC</var>, <var>DD</var>, <var>AA</var>, <var>BB</var>] = <b>balance</b> (<var>A, B, opt</var>)<var><a name="index-balance-2005"></a></var><br>
<blockquote>
        <p>Compute <var>AA</var><code> = </code><var>DD</var><code> \ </code><var>A</var><code> * </code><var>DD</var> in which <var>AA</var>
is a matrix whose row and column norms are roughly equal in magnitude, and
<var>DD</var><code> = </code><var>P</var><code> * </code><var>D</var>, in which <var>P</var> is a permutation
matrix and <var>D</var> is a diagonal matrix of powers of two.  This allows the
equilibration to be computed without round-off.  Results of eigenvalue
calculation are typically improved by balancing first.

        <p>If two output values are requested, <code>balance</code> returns
the diagonal <var>D</var> and the permutation <var>P</var> separately as vectors. 
In this case, <var>DD</var><code> = eye(n)(:,</code><var>P</var><code>) * diag (</code><var>D</var><code>)</code>, where
n is the matrix size.

        <p>If four output values are requested, compute <var>AA</var><code> =
</code><var>CC</var><code>*</code><var>A</var><code>*</code><var>DD</var> and <var>BB</var><code> = </code><var>CC</var><code>*</code><var>B</var><code>*</code><var>DD</var>,
in which <var>AA</var> and <var>BB</var> have non-zero elements of approximately the
same magnitude and <var>CC</var> and <var>DD</var> are permuted diagonal matrices as
in <var>DD</var> for the algebraic eigenvalue problem.

        <p>The eigenvalue balancing option <var>opt</var> may be one of:

          <dl>
<dt>"noperm", "S"<dd>Scale only; do not permute.

          <br><dt>"noscal", "P"<dd>Permute only; do not scale. 
</dl>

        <p>Algebraic eigenvalue balancing uses standard <span class="sc">lapack</span> routines.

        <p>Generalized eigenvalue problem balancing uses Ward's algorithm
(SIAM Journal on Scientific and Statistical Computing, 1981). 
</p></blockquote></div>

<!-- cond scripts/linear-algebra/cond.m -->
   <p><a name="doc_002dcond"></a>

<div class="defun">
&mdash; Function File:  <b>cond</b> (<var>A</var>)<var><a name="index-cond-2006"></a></var><br>
&mdash; Function File:  <b>cond</b> (<var>A, p</var>)<var><a name="index-cond-2007"></a></var><br>
<blockquote><p>Compute the <var>p</var>-norm condition number of a matrix.

        <p><code>cond (</code><var>A</var><code>)</code> is ## defined as
<code>norm (</code><var>A</var><code>, </code><var>p</var><code>) * norm (inv (</code><var>A</var><code>), </code><var>p</var><code>)</code>.

        <p>By default <var>p</var><code> = 2</code> is used which implies a (relatively slow)
singular value decomposition.  Other possible selections are
<var>p</var><code> = 1, Inf, "fro"</code> which are generally faster.  See
<code>norm</code> for a full discussion of possible <var>p</var> values. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcondest.html#doc_002dcondest">condest</a>, <a href="doc_002drcond.html#doc_002drcond">rcond</a>, <a href="doc_002dnorm.html#doc_002dnorm">norm</a>, <a href="doc_002dsvd.html#doc_002dsvd">svd</a>. 
</p></blockquote></div>

<!-- det src/DLD-FUNCTIONS/det.cc -->
   <p><a name="doc_002ddet"></a>

<div class="defun">
&mdash; Loadable Function:  <b>det</b> (<var>A</var>)<var><a name="index-det-2008"></a></var><br>
&mdash; Loadable Function: [<var>d</var>, <var>rcond</var>] = <b>det</b> (<var>A</var>)<var><a name="index-det-2009"></a></var><br>
<blockquote><p>Compute the determinant of <var>A</var>.

        <p>Return an estimate of the reciprocal condition number if requested.

        <p>Routines from <span class="sc">lapack</span> are used for full matrices and code from
<span class="sc">umfpack</span> is used for sparse matrices.

        <p>The determinant should not be used to check a matrix for singularity. 
For that, use any of the condition number functions: <code>cond</code>,
<code>condest</code>, <code>rcond</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcond.html#doc_002dcond">cond</a>, <a href="doc_002dcondest.html#doc_002dcondest">condest</a>, <a href="doc_002drcond.html#doc_002drcond">rcond</a>. 
</p></blockquote></div>

<!-- eig src/DLD-FUNCTIONS/eig.cc -->
   <p><a name="doc_002deig"></a>

<div class="defun">
&mdash; Loadable Function: <var>lambda</var> = <b>eig</b> (<var>A</var>)<var><a name="index-eig-2010"></a></var><br>
&mdash; Loadable Function: <var>lambda</var> = <b>eig</b> (<var>A, B</var>)<var><a name="index-eig-2011"></a></var><br>
&mdash; Loadable Function: [<var>V</var>, <var>lambda</var>] = <b>eig</b> (<var>A</var>)<var><a name="index-eig-2012"></a></var><br>
&mdash; Loadable Function: [<var>V</var>, <var>lambda</var>] = <b>eig</b> (<var>A, B</var>)<var><a name="index-eig-2013"></a></var><br>
<blockquote><p>Compute the eigenvalues and eigenvectors of a matrix.

        <p>Eigenvalues are computed in a several step process which begins with a
Hessenberg decomposition, followed by a Schur&nbsp;decomposition, from which
the eigenvalues are apparent.  The eigenvectors, when desired, are computed
by further manipulations of the Schur&nbsp;decomposition.

        <p>The eigenvalues returned by <code>eig</code> are not ordered. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002deigs.html#doc_002deigs">eigs</a>, <a href="doc_002dsvd.html#doc_002dsvd">svd</a>. 
</p></blockquote></div>

<!-- givens src/DLD-FUNCTIONS/givens.cc -->
   <p><a name="doc_002dgivens"></a>

<div class="defun">
&mdash; Loadable Function: <var>g</var> = <b>givens</b> (<var>x, y</var>)<var><a name="index-givens-2014"></a></var><br>
&mdash; Loadable Function: [<var>c</var>, <var>s</var>] = <b>givens</b> (<var>x, y</var>)<var><a name="index-givens-2015"></a></var><br>
<blockquote><p>Return a 2 by 2 orthogonal matrix
<var>g</var><code> = [</code><var>c</var> <var>s</var><code>; -</code><var>s</var><code>' </code><var>c</var><code>]</code> such that
<var>g</var><code> [</code><var>x</var><code>; </code><var>y</var><code>] = [*; 0]</code> with <var>x</var> and <var>y</var> scalars.

        <p>For example:

     <pre class="example">          givens (1, 1)
               &rArr;   0.70711   0.70711
                   -0.70711   0.70711
</pre>
        </blockquote></div>

<!-- planerot scripts/linear-algebra/planerot.m -->
   <p><a name="doc_002dplanerot"></a>

<div class="defun">
&mdash; Function File: [<var>g</var>, <var>y</var>] = <b>planerot</b> (<var>x</var>)<var><a name="index-planerot-2016"></a></var><br>
<blockquote><p>Given a two-element column vector, returns the
2 by 2 orthogonal matrix
<var>G</var> such that
<var>y</var><code> = </code><var>g</var><code> * </code><var>x</var> and <var>y</var><code>(2) = 0</code>. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dgivens.html#doc_002dgivens">givens</a>. 
</p></blockquote></div>

<!-- inv src/DLD-FUNCTIONS/inv.cc -->
   <p><a name="doc_002dinv"></a>

<div class="defun">
&mdash; Loadable Function: <var>x</var> = <b>inv</b> (<var>A</var>)<var><a name="index-inv-2017"></a></var><br>
&mdash; Loadable Function: [<var>x</var>, <var>rcond</var>] = <b>inv</b> (<var>A</var>)<var><a name="index-inv-2018"></a></var><br>
<blockquote><p>Compute the inverse of the square matrix <var>A</var>.  Return an estimate
of the reciprocal condition number if requested, otherwise warn of an
ill-conditioned matrix if the reciprocal condition number is small.

        <p>In general it is best to avoid calculating the inverse of a matrix
directly.  For example, it is both faster and more accurate to solve
systems of equations (<var>A</var>*x = b) with
<var>y</var><code> = </code><var>A</var><code> \ b</code>, rather than
<var>y</var><code> = inv (</code><var>A</var><code>) * b</code>.

        <p>If called with a sparse matrix, then in general <var>x</var> will be a full
matrix requiring significantly more storage.  Avoid forming the inverse
of a sparse matrix if possible. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dldivide.html#doc_002dldivide">ldivide</a>, <a href="doc_002drdivide.html#doc_002drdivide">rdivide</a>. 
</p></blockquote></div>

<!-- matrix_type src/DLD-FUNCTIONS/matrix_type.cc -->
   <p><a name="doc_002dmatrix_005ftype"></a>

<div class="defun">
&mdash; Loadable Function: <var>type</var> = <b>matrix_type</b> (<var>A</var>)<var><a name="index-matrix_005ftype-2019"></a></var><br>
&mdash; Loadable Function: <var>type</var> = <b>matrix_type</b> (<var>A, 'nocompute'</var>)<var><a name="index-matrix_005ftype-2020"></a></var><br>
&mdash; Loadable Function: <var>A</var> = <b>matrix_type</b> (<var>A, type</var>)<var><a name="index-matrix_005ftype-2021"></a></var><br>
&mdash; Loadable Function: <var>A</var> = <b>matrix_type</b> (<var>A, 'upper', perm</var>)<var><a name="index-matrix_005ftype-2022"></a></var><br>
&mdash; Loadable Function: <var>A</var> = <b>matrix_type</b> (<var>A, 'lower', perm</var>)<var><a name="index-matrix_005ftype-2023"></a></var><br>
&mdash; Loadable Function: <var>A</var> = <b>matrix_type</b> (<var>A, 'banded', nl, nu</var>)<var><a name="index-matrix_005ftype-2024"></a></var><br>
<blockquote><p>Identify the matrix type or mark a matrix as a particular type.  This allows
more rapid solutions of linear equations involving <var>A</var> to be performed. 
Called with a single argument, <code>matrix_type</code> returns the type of the
matrix and caches it for future use.  Called with more than one argument,
<code>matrix_type</code> allows the type of the matrix to be defined.

        <p>If the option 'nocompute' is given, the function will not attempt to guess
the type if it is still unknown.  This is useful for debugging purposes.

        <p>The possible matrix types depend on whether the matrix is full or sparse, and
can be one of the following

          <dl>
<dt>'unknown'<dd>Remove any previously cached matrix type, and mark type as unknown.

          <br><dt>'full'<dd>Mark the matrix as full.

          <br><dt>'positive definite'<dd>Probable full positive definite matrix.

          <br><dt>'diagonal'<dd>Diagonal matrix.  (Sparse matrices only)

          <br><dt>'permuted diagonal'<dd>Permuted Diagonal matrix.  The permutation does not need to be specifically
indicated, as the structure of the matrix explicitly gives this.  (Sparse
matrices only)

          <br><dt>'upper'<dd>Upper triangular.  If the optional third argument <var>perm</var> is given, the
matrix is assumed to be a permuted upper triangular with the permutations
defined by the vector <var>perm</var>.

          <br><dt>'lower'<dd>Lower triangular.  If the optional third argument <var>perm</var> is given, the
matrix is assumed to be a permuted lower triangular with the permutations
defined by the vector <var>perm</var>.

          <br><dt>'banded'<dt>'banded positive definite'<dd>Banded matrix with the band size of <var>nl</var> below the diagonal and <var>nu</var>
above it.  If <var>nl</var> and <var>nu</var> are 1, then the matrix is tridiagonal and
treated with specialized code.  In addition the matrix can be marked as
probably a positive definite.  (Sparse matrices only)

          <br><dt>'singular'<dd>The matrix is assumed to be singular and will be treated with a minimum norm
solution.

        </dl>

        <p>Note that the matrix type will be discovered automatically on the first
attempt to solve a linear equation involving <var>A</var>.  Therefore
<code>matrix_type</code> is only useful to give Octave hints of the matrix type. 
Incorrectly defining the matrix type will result in incorrect results from
solutions of linear equations; it is entirely <strong>the responsibility of
the user</strong> to correctly identify the matrix type.

        <p>Also, the test for positive definiteness is a low-cost test for a Hermitian
matrix with a real positive diagonal.  This does not guarantee that the
matrix is positive definite, but only that it is a probable candidate.  When
such a matrix is factorized, a Cholesky&nbsp;factorization is first
attempted, and if that fails the matrix is then treated with an
LU&nbsp;factorization.  Once the matrix has been factorized,
<code>matrix_type</code> will return the correct classification of the matrix. 
</p></blockquote></div>

<!-- norm src/data.cc -->
   <p><a name="doc_002dnorm"></a>

<div class="defun">
&mdash; Built-in Function:  <b>norm</b> (<var>A</var>)<var><a name="index-norm-2025"></a></var><br>
&mdash; Built-in Function:  <b>norm</b> (<var>A, p</var>)<var><a name="index-norm-2026"></a></var><br>
&mdash; Built-in Function:  <b>norm</b> (<var>A, p, opt</var>)<var><a name="index-norm-2027"></a></var><br>
<blockquote><p>Compute the p-norm of the matrix <var>A</var>.  If the second argument is
missing, <code>p = 2</code> is assumed.

        <p>If <var>A</var> is a matrix (or sparse matrix):

          <dl>
<dt><var>p</var> = <code>1</code><dd>1-norm, the largest column sum of the absolute values of <var>A</var>.

          <br><dt><var>p</var> = <code>2</code><dd>Largest singular value of <var>A</var>.

          <br><dt><var>p</var> = <code>Inf</code> or <code>"inf"</code><dd><a name="index-infinity-norm-2028"></a>Infinity norm, the largest row sum of the absolute values of <var>A</var>.

          <br><dt><var>p</var> = <code>"fro"</code><dd><a name="index-Frobenius-norm-2029"></a>Frobenius norm of <var>A</var>, <code>sqrt (sum (diag (</code><var>A</var><code>' * </code><var>A</var><code>)))</code>.

          <br><dt>other <var>p</var>, <var>p</var><code> &gt; 1</code><dd><a name="index-general-p_002dnorm-2030"></a>maximum <code>norm (A*x, p)</code> such that <code>norm (x, p) == 1</code>
</dl>

        <p>If <var>A</var> is a vector or a scalar:

          <dl>
<dt><var>p</var> = <code>Inf</code> or <code>"inf"</code><dd><code>max (abs (</code><var>A</var><code>))</code>.

          <br><dt><var>p</var> = <code>-Inf</code><dd><code>min (abs (</code><var>A</var><code>))</code>.

          <br><dt><var>p</var> = <code>"fro"</code><dd>Frobenius norm of <var>A</var>, <code>sqrt (sumsq (abs (A)))</code>.

          <br><dt><var>p</var> = 0<dd>Hamming norm - the number of nonzero elements.

          <br><dt>other <var>p</var>, <var>p</var><code> &gt; 1</code><dd>p-norm of <var>A</var>, <code>(sum (abs (</code><var>A</var><code>) .^ </code><var>p</var><code>)) ^ (1/</code><var>p</var><code>)</code>.

          <br><dt>other <var>p</var> <var>p</var><code> &lt; 1</code><dd>the p-pseudonorm defined as above. 
</dl>

        <p>If <var>opt</var> is the value <code>"rows"</code>, treat each row as a vector and
compute its norm.  The result is returned as a column vector. 
Similarly, if <var>opt</var> is <code>"columns"</code> or <code>"cols"</code> then compute
the norms of each column and return a row vector. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcond.html#doc_002dcond">cond</a>, <a href="doc_002dsvd.html#doc_002dsvd">svd</a>. 
</p></blockquote></div>

<!-- null scripts/linear-algebra/null.m -->
   <p><a name="doc_002dnull"></a>

<div class="defun">
&mdash; Function File:  <b>null</b> (<var>A</var>)<var><a name="index-null-2031"></a></var><br>
&mdash; Function File:  <b>null</b> (<var>A, tol</var>)<var><a name="index-null-2032"></a></var><br>
<blockquote><p>Return an orthonormal basis of the null space of <var>A</var>.

        <p>The dimension of the null space is taken as the number of singular
values of <var>A</var> not greater than <var>tol</var>.  If the argument <var>tol</var>
is missing, it is computed as

     <pre class="example">          max (size (<var>A</var>)) * max (svd (<var>A</var>)) * eps
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dorth.html#doc_002dorth">orth</a>. 
</p></blockquote></div>

<!-- orth scripts/linear-algebra/orth.m -->
   <p><a name="doc_002dorth"></a>

<div class="defun">
&mdash; Function File:  <b>orth</b> (<var>A</var>)<var><a name="index-orth-2033"></a></var><br>
&mdash; Function File:  <b>orth</b> (<var>A, tol</var>)<var><a name="index-orth-2034"></a></var><br>
<blockquote><p>Return an orthonormal basis of the range space of <var>A</var>.

        <p>The dimension of the range space is taken as the number of singular
values of <var>A</var> greater than <var>tol</var>.  If the argument <var>tol</var> is
missing, it is computed as

     <pre class="example">          max (size (<var>A</var>)) * max (svd (<var>A</var>)) * eps
</pre>
        <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dnull.html#doc_002dnull">null</a>. 
</p></blockquote></div>

<!-- mgorth src/DLD-FUNCTIONS/mgorth.cc -->
   <p><a name="doc_002dmgorth"></a>

<div class="defun">
&mdash; Loadable Function: [<var>y</var>, <var>h</var>] = <b>mgorth</b> (<var>x, v</var>)<var><a name="index-mgorth-2035"></a></var><br>
<blockquote><p>Orthogonalize a given column vector <var>x</var> with respect to a given
orthonormal basis <var>v</var> using a modified Gram-Schmidt orthogonalization. 
On exit, <var>y</var> is a unit vector such that:

     <pre class="example">            norm (<var>y</var>) = 1
            <var>v</var>' * <var>y</var> = 0
            <var>x</var> = <var>h</var>*[<var>v</var>, <var>y</var>]
</pre>
        </blockquote></div>

<!-- pinv src/DLD-FUNCTIONS/pinv.cc -->
   <p><a name="doc_002dpinv"></a>

<div class="defun">
&mdash; Loadable Function:  <b>pinv</b> (<var>x</var>)<var><a name="index-pinv-2036"></a></var><br>
&mdash; Loadable Function:  <b>pinv</b> (<var>x, tol</var>)<var><a name="index-pinv-2037"></a></var><br>
<blockquote><p>Return the pseudoinverse of <var>x</var>.  Singular values less than
<var>tol</var> are ignored.

        <p>If the second argument is omitted, it is taken to be

     <pre class="example">          tol = max (size (<var>x</var>)) * sigma_max (<var>x</var>) * eps,
</pre>
        <p class="noindent">where <code>sigma_max (</code><var>x</var><code>)</code> is the maximal singular value of <var>x</var>. 
</p></blockquote></div>

<!-- rank scripts/linear-algebra/rank.m -->
   <p><a name="doc_002drank"></a>

<div class="defun">
&mdash; Function File:  <b>rank</b> (<var>A</var>)<var><a name="index-rank-2038"></a></var><br>
&mdash; Function File:  <b>rank</b> (<var>A, tol</var>)<var><a name="index-rank-2039"></a></var><br>
<blockquote><p>Compute the rank of <var>A</var>, using the singular value decomposition. 
The rank is taken to be the number of singular values of <var>A</var> that
are greater than the specified tolerance <var>tol</var>.  If the second
argument is omitted, it is taken to be

     <pre class="example">          tol = max (size (<var>A</var>)) * sigma(1) * eps;
</pre>
        <p class="noindent">where <code>eps</code> is machine precision and <code>sigma(1)</code> is the largest
singular value of <var>A</var>. 
</p></blockquote></div>

<!-- rcond src/DLD-FUNCTIONS/rcond.cc -->
   <p><a name="doc_002drcond"></a>

<div class="defun">
&mdash; Loadable Function: <var>c</var> = <b>rcond</b> (<var>A</var>)<var><a name="index-rcond-2040"></a></var><br>
<blockquote><p>Compute the 1-norm estimate of the reciprocal condition number as returned
by <span class="sc">lapack</span>.  If the matrix is well-conditioned then <var>c</var> will be near
1 and if the matrix is poorly conditioned it will be close to zero.

        <p>The matrix <var>A</var> must not be sparse.  If the matrix is sparse then
<code>condest (</code><var>A</var><code>)</code> or <code>rcond (full (</code><var>A</var><code>))</code> should be used
instead. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcond.html#doc_002dcond">cond</a>, <a href="doc_002dcondest.html#doc_002dcondest">condest</a>. 
</p></blockquote></div>

<!-- trace scripts/linear-algebra/trace.m -->
   <p><a name="doc_002dtrace"></a>

<div class="defun">
&mdash; Function File:  <b>trace</b> (<var>A</var>)<var><a name="index-trace-2041"></a></var><br>
<blockquote><p>Compute the trace of <var>A</var>, <code>sum (diag (</code><var>A</var><code>))</code>. 
</p></blockquote></div>

<!-- rref scripts/linear-algebra/rref.m -->
   <p><a name="doc_002drref"></a>

<div class="defun">
&mdash; Function File:  <b>rref</b> (<var>A</var>)<var><a name="index-rref-2042"></a></var><br>
&mdash; Function File:  <b>rref</b> (<var>A, tol</var>)<var><a name="index-rref-2043"></a></var><br>
&mdash; Function File: [<var>r</var>, <var>k</var>] = <b>rref</b> (<var><small class="dots">...</small></var>)<var><a name="index-rref-2044"></a></var><br>
<blockquote><p>Return the reduced row echelon form of <var>A</var>.  <var>tol</var> defaults
to <code>eps * max (size (</code><var>A</var><code>)) * norm (</code><var>A</var><code>, inf)</code>.

        <p>Called with two return arguments, <var>k</var> returns the vector of
"bound variables", which are those columns on which elimination
has been performed.

        </blockquote></div>

   </body></html>