Forms Hadamard matrices (R.W. Payne).

### Options

`PRINT` = string token |
Controls printed output (`monitoring` ); default `*` i.e. none |
---|---|

`METHOD` = string token |
Method of construction (`firstpaley` , `secondpaley` , `stored` , `sylvestre` , `tensorproduct` , `turyn` , `williamson` ); default `*` i.e. determined automatically |

### Parameters

`NROWS` = scalars |
Number of rows of the matrices |
---|---|

`HADAMARDMATRIX` = matrices |
Saves the Hadamard matrices |

`ERROR` = scalars |
Returns 0 if the matrix has been formed successfully and 1 if not |

### Description

A Hadamard matrix is a matrix containing values -1 and +1 whose rows are orthogonal: i.e. if `H`

is a Hadamard matrix

`H *+ T(H) = n * IDENTITY(`

*n*)

where

is the number of rows of *n*`H`

, which must be 2 or a multiple of 4.

`FHADAMARDMATRIX`

provides several methods for forming the matrices, described in Hedayat, Sloane & Stufken (1999, Chapter 7). These work for all sizes of matrix up to 200, and various other sizes above that. The `METHOD`

option can be used to specify the method. If this is unset `FHADAMARDMATRIX`

selects an appropriate method automatically (you may then want to set the `PRINT`

option to `monitoring`

to record what method has been used). The settings of `METHOD`

, in the order in which they will be selected, are as follows.

`sylvestre` |
uses a tensor product construction building on the 2 × 2 matrix to form matrices of size n = 2^{m} for any positive integer m. |
---|---|

`williamson` |
builds the matrix from four circulant matrices; `FHADAMARDMATRIX` has a repertoire covering 20, 28, 36, 44, 52, 60, 68, 76, 84, 92, 100, 108, 116, 124, 132, 148, 156 and 172 rows. |

`turyn` |
builds the matrix from a circulant and seven retrocirculant matrices; this method is used for the matrix with 188 rows. |

`tensorproduct` |
uses a tensor product between the matrix with two rows, and a Hadamard matrix with n/2 rows. |

`secondpaley` |
forms matrices with n = 2 × (s + 1), where s is a prime power, using properties of the Galois field of order s. |

`firstpaley` |
forms matrices with n = s + 1, where s is a prime power, using properties of the Galois field of order s. |

`stored` |
takes a matrix from a stored repertoire with rows from four to 32. |

The number of rows of the matrix is specified by the `NROWS`

parameter, the `HADAMARDMATRIX`

parameter saves the matrix, and the `ERROR`

parameter can be set to a scalar which returns zero if the matrix has been formed successfully and one if not.

Options: `PRINT`

, `METHOD`

.

Parameters: `NROWS`

, `HADAMARDMATRIX`

, `ERROR`

.

### Method

The methods are described in Chapter 7 of Hedayat, Sloane & Stufken (1999).

### Reference

Hedayat, A.S., Sloane, N.J.A., & Stufken, J. (1999). *Orthogonal Arrays, Theory & Applications*. Springer-Verlag, New York.

### See also

Procedures: `AGBIB`

, `AGMAINEFFECT`

.

Commands for: Calculations and manipulation, Design of experiments.

### Example

CAPTION 'FHADAMARDMATRIX example'; STYLE=meta SCALAR order; VALUE=8 FHADAMARD order; M PRINT M; FIELD=5; DECIMALS=1 " check matrix Hadamard " DIAGONAL [ROWS=order] I CALCULATE I = 1 MATRIX [ROWS=order; COLUMNS=order] MTM CALCULATE MTM = M*+T(M) & MTM= MTM - I*order & meancheck = MEAN(MTM) & varcheck = VAR(MTM) PRINT meancheck,varcheck