python 踩坑记录
- 生成mu, sigma^2的正态分布
sigma * np.random.randn(...) + mu
- 生成复数矩阵,要记得指定数据类型
self.h_mat = np.zeros(self.W.shape, dtype=complex) # 数据类型指定好,不然报错
for i in range(num_i):
for j in range(num_i):
self.h_mat[i][j] = 1. / np.sqrt(2) * np.random.randn() + 1j * 1. / np.sqrt(2) * np.random.randn()
Casting complex values to real discards the imaginary part.