Hadamard Row-Wise Generation Algorithm
Brayan Monroy, Jorge Bacca
TL;DR
This work tackles memory bottlenecks in Hadamard matrix use, notably in Hadamard single-pixel imaging, by enabling on-demand row generation rather than full-matrix precomputation. It leverages Sylvester's recursive construction and the Kronecker product to compute the i-th row from binary index digits without forming the entire matrix, via $i_{10}=(b_n\dots b_0)_2$ and $\mathbf{h}_i = \bigotimes_{k=n}^0 \mathbf{h}_{b_k}$. The paper derives and implements an iterative algorithm that builds $\mathbf{h}_i$ from the base $\mathbf{H}_2$ and analyzes the computational cost as $\mathcal{C}(n) = 2^{n+1}-2 \sim \mathcal{O}(2^n)$ multiplications, with the dominant term proportional to $2^n$. It also notes adaptability to different Hadamard orderings via index permutation and provides a GitHub implementation, enabling practical deployment in memory-constrained imaging systems.
Abstract
In this paper, we introduce an efficient algorithm for generating specific Hadamard rows, addressing the memory demands of pre-computing the entire matrix. Leveraging Sylvester's recursive construction, our method generates the required $i$-th row on demand, significantly reducing computational resources. The algorithm uses the Kronecker product to construct the desired row from the binary representation of the index, without creating the full matrix. This approach is particularly useful for single-pixel imaging systems that need only one row at a time.
