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
|
<html lang="en">
<head>
<title>Famous Matrices - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Matrix-Manipulation.html#Matrix-Manipulation" title="Matrix Manipulation">
<link rel="prev" href="Special-Utility-Matrices.html#Special-Utility-Matrices" title="Special Utility Matrices">
<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">
<p>
<a name="Famous-Matrices"></a>
Previous: <a rel="previous" accesskey="p" href="Special-Utility-Matrices.html#Special-Utility-Matrices">Special Utility Matrices</a>,
Up: <a rel="up" accesskey="u" href="Matrix-Manipulation.html#Matrix-Manipulation">Matrix Manipulation</a>
<hr>
</div>
<h3 class="section">16.5 Famous Matrices</h3>
<p>The following functions return famous matrix forms.
<!-- ./special-matrix/hadamard.m -->
<p><a name="doc_002dhadamard"></a>
<div class="defun">
— Function File: <b>hadamard</b> (<var>n</var>)<var><a name="index-hadamard-1350"></a></var><br>
<blockquote><p>Construct a Hadamard matrix <var>Hn</var> of size <var>n</var>-by-<var>n</var>. The
size <var>n</var> must be of the form <code>2 ^ </code><var>k</var><code> * </code><var>p</var> in which
<var>p</var> is one of 1, 12, 20 or 28. The returned matrix is normalized,
meaning <code>Hn(:,1) == 1</code> and <code>H(1,:) == 1</code>.
<p>Some of the properties of Hadamard matrices are:
<ul>
<li><code>kron (</code><var>Hm</var><code>, </code><var>Hn</var><code>)</code> is a Hadamard matrix of size
<var>m</var>-by-<var>n</var>.
<li><code>Hn * Hn' == </code><var>n</var><code> * eye (</code><var>n</var><code>)</code>.
<li>The rows of <var>Hn</var> are orthogonal.
<li><code>det (</code><var>A</var><code>) <= abs(det (</code><var>Hn</var><code>))</code> for all <var>A</var> with
<code>abs (</code><var>A</var><code> (</code><var>i</var><code>, </code><var>j</var><code>)) <= 1</code>.
<li>Multiply any row or column by -1 and still have a Hadamard matrix.
</ul>
</blockquote></div>
<!-- ./special-matrix/hankel.m -->
<p><a name="doc_002dhankel"></a>
<div class="defun">
— Function File: <b>hankel</b> (<var>c, r</var>)<var><a name="index-hankel-1351"></a></var><br>
<blockquote><p>Return the Hankel matrix constructed given the first column <var>c</var>, and
(optionally) the last row <var>r</var>. If the last element of <var>c</var> is
not the same as the first element of <var>r</var>, the last element of
<var>c</var> is used. If the second argument is omitted, it is assumed to
be a vector of zeros with the same size as <var>c</var>.
<p>A Hankel matrix formed from an m-vector <var>c</var>, and an n-vector
<var>r</var>, has the elements
<pre class="example"> H(i,j) = c(i+j-1), i+j-1 <= m;
H(i,j) = r(i+j-m), otherwise
</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_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>.
</p></blockquote></div>
<!-- ./special-matrix/hilb.m -->
<p><a name="doc_002dhilb"></a>
<div class="defun">
— Function File: <b>hilb</b> (<var>n</var>)<var><a name="index-hilb-1352"></a></var><br>
<blockquote><p>Return the Hilbert matrix of order <var>n</var>. The
i, j
element of a Hilbert matrix is defined as
<pre class="example"> H (i, j) = 1 / (i + j - 1)
</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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>.
</p></blockquote></div>
<!-- ./special-matrix/invhilb.m -->
<p><a name="doc_002dinvhilb"></a>
<div class="defun">
— Function File: <b>invhilb</b> (<var>n</var>)<var><a name="index-invhilb-1353"></a></var><br>
<blockquote><p>Return the inverse of a Hilbert matrix of order <var>n</var>. This can be
computed exactly using
<pre class="example">
(i+j) /n+i-1\ /n+j-1\ /i+j-2\ 2
A(i,j) = -1 (i+j-1)( )( ) ( )
\ n-j / \ n-i / \ i-2 /
= p(i) p(j) / (i+j-1)
</pre>
<p>where
<pre class="example"> k /k+n-1\ /n\
p(k) = -1 ( ) ( )
\ k-1 / \k/
</pre>
<p>The validity of this formula can easily be checked by expanding
the binomial coefficients in both formulas as factorials. It can
be derived more directly via the theory of Cauchy matrices:
see J. W. Demmel, Applied Numerical Linear Algebra, page 92.
<p>Compare this with the numerical calculation of <code>inverse (hilb (n))</code>,
which suffers from the ill-conditioning of the Hilbert matrix, and the
finite precision of your computer's floating point arithmetic.
<!-- 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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>.
</p></blockquote></div>
<!-- ./special-matrix/magic.m -->
<p><a name="doc_002dmagic"></a>
<div class="defun">
— Function File: <b>magic</b> (<var>n</var>)<var><a name="index-magic-1354"></a></var><br>
<blockquote>
<p>Create an <var>n</var>-by-<var>n</var> magic square. Note that <code>magic
(</code><var>2</var><code>)</code> is undefined since there is no 2-by-2 magic square.
</blockquote></div>
<!-- ./special-matrix/pascal.m -->
<p><a name="doc_002dpascal"></a>
<div class="defun">
— Function File: <b>pascal</b> (<var>n, t</var>)<var><a name="index-pascal-1355"></a></var><br>
<blockquote>
<p>Return the Pascal matrix of order <var>n</var> if <var>t</var><code> = 0</code>.
<var>t</var> defaults to 0. Return lower triangular Cholesky factor of
the Pascal matrix if <var>t</var><code> = 1</code>. This matrix is its own
inverse, that is <code>pascal (</code><var>n</var><code>, 1) ^ 2 == eye (</code><var>n</var><code>)</code>.
If <var>t</var><code> = -1</code>, return its absolute value. This is the
standard pascal triangle as a lower-triangular matrix.
If <var>t</var><code> = 2</code>, return a transposed and permuted version of
<code>pascal (</code><var>n</var><code>, 1)</code>, which is the cube-root of the identity
matrix. That is <code>pascal (</code><var>n</var><code>, 2) ^ 3 == eye (</code><var>n</var><code>)</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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>, <a href="doc_002dhadamard.html#doc_002dhadamard">hadamard</a>, <a href="doc_002dwilkinson.html#doc_002dwilkinson">wilkinson</a>, <a href="doc_002dcompan.html#doc_002dcompan">compan</a>, <a href="doc_002drosser.html#doc_002drosser">rosser</a>.
</p></blockquote></div>
<!-- ./special-matrix/rosser.m -->
<p><a name="doc_002drosser"></a>
<div class="defun">
— Function File: <b>rosser</b> ()<var><a name="index-rosser-1356"></a></var><br>
<blockquote>
<p>Returns the Rosser matrix. This is a difficult test case used to test
eigenvalue algorithms.
<!-- 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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>, <a href="doc_002dhadamard.html#doc_002dhadamard">hadamard</a>, <a href="doc_002dwilkinson.html#doc_002dwilkinson">wilkinson</a>, <a href="doc_002dcompan.html#doc_002dcompan">compan</a>, <a href="doc_002dpascal.html#doc_002dpascal">pascal</a>.
</p></blockquote></div>
<!-- ./special-matrix/sylvester_matrix.m -->
<p><a name="doc_002dsylvester_005fmatrix"></a>
<div class="defun">
— Function File: <b>sylvester_matrix</b> (<var>k</var>)<var><a name="index-sylvester_005fmatrix-1357"></a></var><br>
<blockquote><p>Return the Sylvester matrix of order
n = 2^k.
<!-- 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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>.
</p></blockquote></div>
<!-- ./special-matrix/toeplitz.m -->
<p><a name="doc_002dtoeplitz"></a>
<div class="defun">
— Function File: <b>toeplitz</b> (<var>c, r</var>)<var><a name="index-toeplitz-1358"></a></var><br>
<blockquote><p>Return the Toeplitz matrix constructed given the first column <var>c</var>,
and (optionally) the first row <var>r</var>. If the first element of <var>c</var>
is not the same as the first element of <var>r</var>, the first element of
<var>c</var> is used. If the second argument is omitted, the first row is
taken to be the same as the first column.
<p>A square Toeplitz matrix has the form:
<pre class="example"> c(0) r(1) r(2) ... r(n)
c(1) c(0) r(1) ... r(n-1)
c(2) c(1) c(0) ... r(n-2)
. , , . .
. , , . .
. , , . .
c(n) c(n-1) c(n-2) ... c(0)
</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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>.
</p></blockquote></div>
<!-- ./special-matrix/vander.m -->
<p><a name="doc_002dvander"></a>
<div class="defun">
— Function File: <b>vander</b> (<var>c, n</var>)<var><a name="index-vander-1359"></a></var><br>
<blockquote><p>Return the Vandermonde matrix whose next to last column is <var>c</var>.
If <var>n</var> is specified, it determines the number of columns;
otherwise, <var>n</var> is taken to be equal to the length of <var>c</var>.
<p>A Vandermonde matrix has the form:
<pre class="example"> c(1)^(n-1) ... c(1)^2 c(1) 1
c(2)^(n-1) ... c(2)^2 c(2) 1
. . . . .
. . . . .
. . . . .
c(n)^(n-1) ... c(n)^2 c(n) 1
</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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>.
</p></blockquote></div>
<!-- ./special-matrix/wilkinson.m -->
<p><a name="doc_002dwilkinson"></a>
<div class="defun">
— Function File: <b>wilkinson</b> (<var>n</var>)<var><a name="index-wilkinson-1360"></a></var><br>
<blockquote>
<p>Return the Wilkinson matrix of order <var>n</var>.
<!-- 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_002dhankel.html#doc_002dhankel">hankel</a>, <a href="doc_002dvander.html#doc_002dvander">vander</a>, <a href="doc_002dsylvester_005fmatrix.html#doc_002dsylvester_005fmatrix">sylvester_matrix</a>, <a href="doc_002dhilb.html#doc_002dhilb">hilb</a>, <a href="doc_002dinvhilb.html#doc_002dinvhilb">invhilb</a>, <a href="doc_002dtoeplitz.html#doc_002dtoeplitz">toeplitz</a>, <a href="doc_002dhadamard.html#doc_002dhadamard">hadamard</a>, <a href="doc_002drosser.html#doc_002drosser">rosser</a>, <a href="doc_002dcompan.html#doc_002dcompan">compan</a>, <a href="doc_002dpascal.html#doc_002dpascal">pascal</a>.
</p></blockquote></div>
<!-- DO NOT EDIT! Generated automatically by munge-texi. -->
<!-- Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2007, 2008, -->
<!-- 2009 John W. Eaton -->
<!-- This file is part of Octave. -->
<!-- Octave is free software; you can redistribute it and/or modify it -->
<!-- under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation; either version 3 of the License, or (at -->
<!-- your option) any later version. -->
<!-- Octave is distributed in the hope that it will be useful, but WITHOUT -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
<!-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -->
<!-- for more details. -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with Octave; see the file COPYING. If not, see -->
<!-- <http://www.gnu.org/licenses/>. -->
</body></html>
|