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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
2 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
4 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6516
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6516
diff changeset
8 ## your option) any later version.
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
9 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
14 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6516
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6516
diff changeset
17 ## <http://www.gnu.org/licenses/>.
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
18 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
19 ## Original version by Paul Kienzle distributed as free software in the
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
20 ## public domain.
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
21
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
22 ## -*- texinfo -*-
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
29 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
30 ## Some of the properties of Hadamard matrices are:
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
31 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
32 ## @itemize @bullet
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
51 ## @end deftypefn
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
52
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
53
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
54 ## Reference [1] contains a list of Hadamard matrices up to n=256.
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
55 ## See code for h28 in hadamard.m for an example of how to extend
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
56 ## this function for additional p.
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
57 ##
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
60 ## http://www.research.att.com/~njas/hadamard/
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
61
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
64 if (nargin != 1)
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
65 print_usage ();
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
66 endif
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
67
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
68 ## Find k if n = 2^k*p.
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
73 endwhile
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
74
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
75 ## Find base hadamard.
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
76 ## Except for n=2^k, need a multiple of 4.
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
79 endif
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
80
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
81 ## Trigger error if not a multiple of 4.
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
82 if (k < 0)
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
83 n =- 1;
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
84 endif
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
85
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
86 switch (n)
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
87 case 1
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
88 h = 1;
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
89 case 3
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
90 h = h12 ();
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
91 case 5
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
92 h = h20 ();
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
93 case 7
13913
521adfd775be hadamard.m: Fix failing %!tests
Rik <octave@nomad.inbox5.com>
parents: 13893
diff changeset
94 h = h28 ();
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
97 endswitch
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
98
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
99 ## Build H(2^k*n) from kron(H(2^k),H(n)).
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
100 h2 = [1,1;1,-1];
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
108 endif
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
109 h2 = kron (h2, h2);
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
112 endfunction
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
113
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
114 function h = h12 ()
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
115 tu = [-1,+1,-1,+1,+1,+1,-1,-1,-1,+1,-1];
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
116 tl = [-1,-1,+1,-1,-1,-1,+1,+1,+1,-1,+1];
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
117 ## Note: assert (tu(2:end), tl(end:-1:2)).
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
118 h = ones (12);
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
119 h(2:end,2:end) = toeplitz (tu, tl);
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
120 endfunction
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
121
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
122 function h = h20 ()
8507
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
123 tu = [+1,-1,-1,+1,+1,+1,+1,-1,+1,-1,+1,-1,-1,-1,-1,+1,+1,-1,-1];
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
124 tl = [+1,-1,-1,+1,+1,-1,-1,-1,-1,+1,-1,+1,-1,+1,+1,+1,+1,-1,-1];
cadc73247d65 style fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
125 ## Note: assert (tu(2:end), tl(end:-1:2)).
5827
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
126 h = ones (20);
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
127 h(2:end,2:end) = fliplr (toeplitz (tu, tl));
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
128 endfunction
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
129
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
130 function h = h28 ()
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
131 ## Williamson matrix construction from
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
162 endfunction
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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
1fe78adb91bc [project @ 2006-05-22 06:25:14 by jwe]
jwe
parents:
diff changeset
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