USAGE NOTES FOR THE HADAMARD PACKAGE Paley`s

advertisement
USAGE NOTES FOR THE HADAMARD PACKAGE
Paley's Construction of Hadamard Matrices
Levent Kitis
University of Virginia
Charlottesville, VA 22901
lk3a@kelvin.seas.virginia.edu
September 1993 IBM RS6000 AIX Version 3.2.3 Mathematica Version
2.2
DEFINITION
matrix if
An n x n matrix H with entries -1 and 1 is called an Hadamard
H . Transpose[H] = n IdentityMatrix[n]
If H is an n x n Hadamard matrix, then n = 1, n = 2, or Mod[n, 4] = 0.
Hadamard's conjecture is that there is a Hadamard matrix of order n = 4 k
for every positive integer k.
The Hadamard Mathematica package constructs an Hadamard matrix using
Paley's
method based on the following theorem
PALEY'S THEOREM (1933) If q is an odd prime or q = 0 and n is any
positive integer,
then there is an Hadamard matrix of order m = 2^e (q^n + 1), where e is
any positive
integer such that Mod[m, 4] = 0.
DEFINITION The Paley class of a positive integer m is defined as the set
of all
possible four-tuples {k, e, q, n} where m = 2^e (q^n + 1), q is an odd
prime and
k = 0
k = 1
k = 2
if
if
if
q = 0
Mod[q^n - 3, 4] = 0
Mod[q^n - 1, 4] = 0
The package function class finds the Paley class of a given integer. For
example:
In[2]:= class[32]
Out[2]= {{1, 0, 31, 1}, {1, 2, 7, 1}, {1, 3, 3, 1}, {0, 5, 0,
1}}
In[3]:= class[56]
Out[3]= {{1, 1, 3, 3}, {2, 2, 13, 1}}
In[4]:= class[388]
Out[4]= {{2, 1, 193, 1}}
In[5]:= class[92]
Out[5]= {}
In[6]:= class[112]
Out[6]= {{1, 2, 3, 3}, {2, 3, 13, 1}}
When class[m] = {}, as for m = 92, the Paley construction is not
applicable
and class[m] is automatically {} if m > 1000 because the package is
restricted
to matrix orders up to 1000.
The program gives a normalized Hadamard matrix in the sense that the
first
row and the first column are both equal to { 1, 1, 1,...,1, 1}. The
finite Galois field GF(q^n) is used in the construction and according to
the
way in which the elements of GF(q^n) are ordered, different matrices are
obtained.
The program chooses a random permutation of GF(q^n) every time it is
called, so that,
in general, two successive calls with the same argument will generate
different
matrices.
When q = 0, that is , the order n is a power of 2, the recursive relation
H[1] := {{1}}
H[2] := {{1, 1}, {1, -1}}
H[n_] := Kronecker[ H[2], H[n/2] ]
is used to construct the Hadamard matrix, where the Kronecker product is
essentially the same as the product found by Mathematica's Outer
function.
Given the Hadamard matrices H[m] and H[n] of orders m and n, the products
Kronecker[ H[m], H[n] ] and
Kronecker[ H[n], H[m] ]
are Hadamard matrices of order m n. Consider, for instance, n = 4, m =
100:
class[100] = {{2, 1, 7, 2}}
class[400] = {{1, 1, 199, 1}, {2, 3, 7, 2}}
When using {2, 3, 7, 2} as the Paley decomposition of 400, the program
essentially
calculates this Kronecker product. If H[100] has already been found, then
it may be faster to compute the Kronecker product of it with H[4],
although
the Kronecker product as defined in this package is slow for matrices of
large
order. A timing experiment with n = 48 is given below. For an explanation
of
the function calls see (1) and (2) following the timing experiment.
In[8]:= class[48]
Out[8]= {{1, 0, 47, 1}, {1, 1, 23, 1}, {1, 2, 11, 1}, {2, 3, 5, 1}}
In[9]:= Timing[Hadamard[48, 4, 1]][[1]] (This corresponds to 48 =
2^3(5^1+1))
Out[9]= 0.71 Second
In[10]:= Timing[ Kronecker[X, Y] ][[1]]
Out[10]= 0.45 Second
In[11]:= Dimensions /@ {X, Y}
Out[11]= {{12, 12}, {4, 4}}
In[12]:= Timing[Hadamard[48, 1, 1]][[1]] (This corresponds to 48 = 47^1 +
1)
Out[12]= 2.36 Second
The limit on the order n of the Hadamard matrix imposed by the program is
1000.
However, the program is slow for orders approaching 400, and should
probably
not be used for orders larger than 400. The time it takes to construct
one matrix
of order 396 on an RS6000 is approximately 170 seconds as reported by
Timing
and Hadamard[100] takes about 15 seconds. For order 400, I always got a
Segmentation fault(coredump) on the RS6000.
There are two principal ways in which the function Hadamard can be called
(1) Hadamard[n] where class[n] is not the empty list returns a
randomly
selected Hadamard matrix for each 4-tuple in class[n]. For Example:
In[9]:= class[8]
Out[9]= {{1, 0, 7, 1}, {1, 1, 3, 1}, {0, 3, 0, 1}}
In[10]:= Hadamard[8]
Out[10]= {{{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, 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},
{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, 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, 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, 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, -1, 1, -1},
-1, -1, 1, 1, -1, -1, 1},
-1, 1, -1, -1, 1, -1, 1},
-1, -1, 1, -1, 1, 1, -1}}}
(2) Hadamard[n, k, t] returns t randomly chosen matrices with
construction
corresponding to the n-tuple class[n][[k]]. For example, if n = 144,
class[144] =
{{1, 1, 71, 1}, {2, 3, 17, 1}}
and we are only interested in the construction where 144 is decomposed as
2^3 ( 17^1 + 1 ), then the function call
Hadamard[144, 2, 5]
will generate 5 Hadamard matrices of order 144 using this decomposition,
because class[144][[2]] = {2, 3, 17, 1}. The 5 matrices are obtained
via 5 random permutations of the elements of the Galois field GF(17)
within Paley's construction.
EXAMPLE
In[2]:= class[12]
Out[2]= {{1, 0, 11, 1}, {2, 1, 5, 1}}
In[3]:= Hadamard[12, 2, 2]
(2 constructions with 12 = 2^1(5^1 + 1))
Out[3] = {{{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, 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, -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},
{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, -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, -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},
{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, 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, 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},
{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, 1, -1, -1, 1, -1, 1, -1, -1}}}
REFERENCES
The Paley construction is described and proved in Design Theory by Th.
Beth,
D. Jungnickel, and H. Lenz, published by Wissenschaftsverlag,
Bibliographisches
Institut, Zurich, 1985. Additional constructions are given in Orthogonal
Designs - Quadratic Forms and Hadamard Matrices - by A. V. Geramita and
J. Seberry, published by Marcel Dekker, Inc., 1979.
Download