Hadamard Matrix

class fastmat.Hadamard

Bases: Matrix

A Hadamard Matrix is recursively defined as

\[H_n = H_1 \otimes H_{n-1},\]

where

\[\begin{split}H_1 = \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}\end{split}\]

and \(H_0 = (1)\). Obviously the dimension of \(H_n\) is \(2^n\). The transform is realized with the Fast Hadamard Transform (FHT).

>>> # import the package
>>> import fastmat as fm
>>>
>>> # define the parameter
>>> n = 4
>>>
>>> # construct the matrix
>>> H = fm.Hadamard(n)

This yields a Hadamard matrix \({\mathcal{H}}_4\) of order \(4\), i.e. with \(16\) rows and columns.

The algorithm we used is described in [2] and was implemented in Cython [3].

__init__()

Initialize Hadamard matrix instance.

Parameters
orderint

The order of the Hadamard matrix to generate. The matrix data type is numpy.int8

**optionsoptional

Optional keyworded arguments. Supports all optional arguments supported by fastmat.Matrix.

order

Return the order of the hadamard matrix.