bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / linalg / _special_matrices / hadamard
function
scipy.linalg._special_matrices:hadamard
source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_special_matrices.py:222
Signature
def hadamard(n, dtype = <class 'int'>)Summary
Construct a Hadamard matrix.
Extended Summary
Constructs an n-by-n Hadamard matrix, using Sylvester's construction. n must be a power of 2.
Parameters
n: intThe order of the matrix.
nmust be a power of 2.dtype: dtype, optionalThe data type of the array to be constructed.
Returns
H: (n, n) ndarrayThe Hadamard matrix.
Notes
Examples
from scipy.linalg import hadamard hadamard(2, dtype=complex) hadamard(4)✓
array([[ 1, 1, 1, 1],
[ 1, -1, 1, -1],
[ 1, 1, -1, -1],
[ 1, -1, -1, 1]])
Aliases
scipy.linalg.hadamard