scipy.linalg.hadamard¶
- scipy.linalg.hadamard(n, dtype=<class 'int'>)[源代码]¶
构造一个阿达玛矩阵。
使用Sylvester的构造,构造一个n乘n的Hadamard矩阵。 n 一定是2的幂。
- 参数
- n集成
矩阵的顺序。 n 一定是2的幂。
- dtype数据类型,可选
要构造的数组的数据类型。
- 退货
- H(n,n)ndarray
阿达玛矩阵。
注意事项
0.8.0 新版功能.
示例
>>> from scipy.linalg import hadamard >>> hadamard(2, dtype=complex) array([[ 1.+0.j, 1.+0.j], [ 1.+0.j, -1.-0.j]]) >>> hadamard(4) array([[ 1, 1, 1, 1], [ 1, -1, 1, -1], [ 1, 1, -1, -1], [ 1, -1, -1, 1]])