Functions | |
while (n > 1 &&floor(n/2)==n/2) k++ | |
endwhile | if (n!=1) k- |
endif | if (k< 0) n |
endif | switch (n) case 1 h |
otherwise | error ("n must be 2^k*p, for p = 1, 12, 20 or 28") |
while (true) if(floor(k/2)! | |
if (k==0) break | |
h (2:end, 2:end) | |
h (:, h(1,:)==-1)* | |
h (!h) | |
endfunction | !assert (hadamard(1), 1)%!assert(hadamard(2) |
assert (norm(h *h'-n *eye(n)), 0) | |
Variables | |
function | h |
endif | k = 0 |
n = n/2 | |
endswitch | h2 = [1,1 |
tl = [-1,-1,+1,-1,-1,-1,+1,+1,+1,-1,+1] |
endfunction !assert | ( | hadamard(1) | , | |
1 | ||||
) |
assert | ( | norm(h *h'-n *eye(n)) | , | |
0 | ||||
) |
h | ( | ! | h | ) |
h | ( | : | , | |
h(1,:) | = =-1 | |||
) |
h | ( | 2:end | , | |
2:end | ||||
) |
if | ( | k | = =0 |
) |
endif if | ( | ) |
endwhile if | ( | n! | = 1 |
) |
endif switch | ( | n | ) |
while | ( | true | ) |
while | ( | n | , | |
1 && | floorn/2 = =n/2 | |||
) |
h |
Initial value:
hadamard (n) if (nargin != 1) print_usage ()
endif h2 = [1,1 |
endfunction !test ! for n = n/2 |
tl = [-1,-1,+1,-1,-1,-1,+1,+1,+1,-1,+1] |