def test_calc_whitening_matrix(self): A = misc.randn_c(3, 3) # B is symmetric and positive semi-definite B = np.dot(A, A.conjugate().T) Wd = misc.calc_whitening_matrix(B) D = np.dot(np.dot(Wd.conjugate().T, B), Wd) # D must be an identity matrix np.testing.assert_array_almost_equal(D, np.eye(3))
def test_calc_whitening_matrices(self): Nr = np.array([2, 2]) Nt = np.array([2, 2]) K = Nt.size Nti = 1 iPu = 1e-1 # Power for each user (linear scale) pe = 1e-3 # External interference power (in linear scale) noise_var = 1e-4 # Generate the multi-user channel mu_channel = multiuser.MultiUserChannelMatrixExtInt() mu_channel.randomize(Nr, Nt, K, Nti) mu_channel.noise_var = noise_var bd_obj = blockdiagonalization.BDWithExtIntBase(K, iPu, noise_var, pe) W_all_k = bd_obj.calc_whitening_matrices(mu_channel) R_all_k = mu_channel.calc_cov_matrix_extint_plus_noise(pe) for W, R in zip(W_all_k, R_all_k): np.testing.assert_array_almost_equal( W, calc_whitening_matrix(R).conjugate().T)