Mercurial > octave-antonio
annotate scripts/special-matrix/hadamard.m @ 20162:2645f9ef8c88 stable
doc: Update more docstrings to have one sentence summary as first line.
Reviewed specfun, special-matrix, testfun, and time script directories.
* scripts/specfun/expint.m, scripts/specfun/isprime.m,
scripts/specfun/legendre.m, scripts/specfun/primes.m,
scripts/specfun/reallog.m, scripts/specfun/realsqrt.m,
scripts/special-matrix/gallery.m, scripts/special-matrix/hadamard.m,
scripts/special-matrix/hankel.m, scripts/special-matrix/hilb.m,
scripts/special-matrix/invhilb.m, scripts/special-matrix/magic.m,
scripts/special-matrix/pascal.m, scripts/special-matrix/rosser.m,
scripts/special-matrix/toeplitz.m, scripts/special-matrix/vander.m,
scripts/special-matrix/wilkinson.m, scripts/testfun/assert.m,
scripts/testfun/demo.m, scripts/testfun/example.m, scripts/testfun/fail.m,
scripts/testfun/rundemos.m, scripts/testfun/runtests.m,
scripts/testfun/speed.m, scripts/time/asctime.m, scripts/time/calendar.m,
scripts/time/clock.m, scripts/time/ctime.m, scripts/time/datenum.m,
scripts/time/datestr.m, scripts/time/datevec.m, scripts/time/etime.m,
scripts/time/is_leap_year.m, scripts/time/now.m, scripts/time/weekday.m:
Update more docstrings to have one sentence summary as first line.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 03 May 2015 17:00:11 -0700 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 1993-2015 Paul Kienzle |
5827 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5827 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5827 | 18 ## |
19 ## Original version by Paul Kienzle distributed as free software in the | |
20 ## public domain. | |
21 | |
22 ## -*- texinfo -*- | |
23 ## @deftypefn {Function File} {} hadamard (@var{n}) | |
20162
2645f9ef8c88
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 ## Construct a Hadamard matrix (@nospell{Hn}) of size @var{n}-by-@var{n}. |
2645f9ef8c88
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
25 ## |
2645f9ef8c88
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
26 ## The size @var{n} must be of the form @math{2^k * p} in which p is one of |
2645f9ef8c88
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
27 ## 1, 12, 20 or 28. The returned matrix is normalized, meaning |
2645f9ef8c88
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
28 ## @w{@code{Hn(:,1) == 1}} and @w{@code{Hn(1,:) == 1}}. |
5827 | 29 ## |
30 ## Some of the properties of Hadamard matrices are: | |
31 ## | |
32 ## @itemize @bullet | |
33 ## @item | |
12639
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
34 ## @code{kron (Hm, Hn)} is a Hadamard matrix of size @var{m}-by-@var{n}. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
35 ## |
5827 | 36 ## @item |
12639
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
37 ## @code{Hn * Hn' = @var{n} * eye (@var{n})}. |
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
38 ## |
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
39 ## @item |
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
40 ## The rows of @nospell{Hn} are orthogonal. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
41 ## |
5827 | 42 ## @item |
12639
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
43 ## @code{det (@var{A}) <= abs (det (Hn))} for all @var{A} with |
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
44 ## @w{@code{abs (@var{A}(i, j)) <= 1}}. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
10791
diff
changeset
|
45 ## |
5827 | 46 ## @item |
12639
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
47 ## Multiplying any row or column by -1 and the matrix will remain a Hadamard |
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
48 ## matrix. |
5827 | 49 ## @end itemize |
12639
4d777e05d47c
doc: Review and update documentation for "Matrix Manipulation" chapter.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
50 ## @seealso{compan, hankel, toeplitz} |
5827 | 51 ## @end deftypefn |
52 | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
53 |
5827 | 54 ## Reference [1] contains a list of Hadamard matrices up to n=256. |
55 ## See code for h28 in hadamard.m for an example of how to extend | |
56 ## this function for additional p. | |
57 ## | |
58 ## References: | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
59 ## [1] A Library of Hadamard Matrices, N. J. A. Sloane |
5827 | 60 ## http://www.research.att.com/~njas/hadamard/ |
61 | |
62 function h = hadamard (n) | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
63 |
5827 | 64 if (nargin != 1) |
65 print_usage (); | |
66 endif | |
67 | |
8507 | 68 ## Find k if n = 2^k*p. |
5827 | 69 k = 0; |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
70 while (n > 1 && fix (n/2) == n/2) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 k++; |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
72 n /= 2; |
5827 | 73 endwhile |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
74 |
8507 | 75 ## Find base hadamard. |
76 ## Except for n=2^k, need a multiple of 4. | |
5827 | 77 if (n != 1) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
78 k -= 2; |
5827 | 79 endif |
80 | |
8507 | 81 ## Trigger error if not a multiple of 4. |
5827 | 82 if (k < 0) |
83 n =- 1; | |
84 endif | |
85 | |
86 switch (n) | |
87 case 1 | |
88 h = 1; | |
89 case 3 | |
90 h = h12 (); | |
91 case 5 | |
92 h = h20 (); | |
93 case 7 | |
13913
521adfd775be
hadamard.m: Fix failing %!tests
Rik <octave@nomad.inbox5.com>
parents:
13893
diff
changeset
|
94 h = h28 (); |
5827 | 95 otherwise |
11472
1740012184f9
Use uppercase for variable names in error() strings to match Info documentation. Only m-files done.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
96 error ("hadamard: N must be 2^k*p, for p = 1, 12, 20 or 28"); |
5827 | 97 endswitch |
98 | |
8507 | 99 ## Build H(2^k*n) from kron(H(2^k),H(n)). |
5827 | 100 h2 = [1,1;1,-1]; |
101 while (true) | |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
102 if (fix (k/2) != k/2) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
103 h = kron (h2, h); |
5827 | 104 endif |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
105 k = fix (k/2); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
106 if (k == 0) |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
107 break; |
5827 | 108 endif |
109 h2 = kron (h2, h2); | |
110 endwhile | |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
111 |
5827 | 112 endfunction |
113 | |
114 function h = h12 () | |
8507 | 115 tu = [-1,+1,-1,+1,+1,+1,-1,-1,-1,+1,-1]; |
116 tl = [-1,-1,+1,-1,-1,-1,+1,+1,+1,-1,+1]; | |
117 ## Note: assert (tu(2:end), tl(end:-1:2)). | |
5827 | 118 h = ones (12); |
119 h(2:end,2:end) = toeplitz (tu, tl); | |
120 endfunction | |
121 | |
122 function h = h20 () | |
8507 | 123 tu = [+1,-1,-1,+1,+1,+1,+1,-1,+1,-1,+1,-1,-1,-1,-1,+1,+1,-1,-1]; |
124 tl = [+1,-1,-1,+1,+1,-1,-1,-1,-1,+1,-1,+1,-1,+1,+1,+1,+1,-1,-1]; | |
125 ## Note: assert (tu(2:end), tl(end:-1:2)). | |
5827 | 126 h = ones (20); |
127 h(2:end,2:end) = fliplr (toeplitz (tu, tl)); | |
128 endfunction | |
129 | |
130 function h = h28 () | |
131 ## Williamson matrix construction from | |
132 ## http://www.research.att.com/~njas/hadamard/had.28.will.txt | |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
133 ## Normalized so that each row and column starts with +1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
134 h = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
135 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
136 1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
137 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
138 1 -1 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
139 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
140 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
141 1 -1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
142 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
143 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
144 1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
145 1 -1 -1 1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
146 1 -1 -1 -1 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
147 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 -1 1 -1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
148 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
149 1 1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
150 1 1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
151 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
152 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
153 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
154 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
155 1 1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
156 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
157 1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
158 1 1 1 -1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
159 1 -1 1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
160 1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
161 1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 1 -1]; |
5827 | 162 endfunction |
163 | |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
164 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
165 %!assert (hadamard (1), 1) |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
166 %!assert (hadamard (2), [1,1;1,-1]) |
5827 | 167 %!test |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
168 %! for n = [1,2,4,8,12,24,48,20,28,2^9] |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
169 %! h = hadamard (n); |
13913
521adfd775be
hadamard.m: Fix failing %!tests
Rik <octave@nomad.inbox5.com>
parents:
13893
diff
changeset
|
170 %! assert (norm (h*h' - n*eye (n)), 0); |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
171 %! endfor |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
172 |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
173 %!error hadamard () |
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
174 %!error hadamard (1,2) |
13913
521adfd775be
hadamard.m: Fix failing %!tests
Rik <octave@nomad.inbox5.com>
parents:
13893
diff
changeset
|
175 %!error <N must be 2\^k\*p> hadamard (5) |
13893
5b1ddcf5ede1
hadamard.m: Embed hadamard28 matrix as constant rather than computed value.
Rik <octave@nomad.inbox5.com>
parents:
12639
diff
changeset
|
176 |