Exemplo n.º 1
0
    def test_gev_falls_back_to_pca_for_unity_noise_matrix(self):
        Phi_XX = hermitian(6, 6)
        Phi_NN = np.identity(6)
        W_gev = get_gev_vector(Phi_XX, Phi_NN)
        W_pca = get_pca_vector(Phi_XX)

        tc.assert_allclose(cos_similarity(W_gev, W_pca), 1.0, atol=1e-6)
Exemplo n.º 2
0
 def _w_gev(self):
     w_gev = beamformer.get_gev_vector(self._Cov_X,
                                       self._Cov_N,
                                       force_cython=True)
     if self.debug:
         print('w_gev', repr(w_gev))
     return w_gev
Exemplo n.º 3
0
    def test_result_equal(self):
        import time

        F = 513

        phi_XX = pos_def_hermitian(F, 6, 6)
        phi_NN = pos_def_hermitian(F, 6, 6)
        t = time.time()
        python_gev = _get_gev_vector(phi_XX, phi_NN)
        elapsed_time_python = time.time() - t

        t = time.time()
        cython_gev = get_gev_vector(phi_XX, phi_NN, True)
        elapsed_time_cython1 = time.time() - t

        tc.assert_allclose(cos_similarity(python_gev, cython_gev),
                           1.0,
                           atol=1e-6)

        # assume speedup is bigger than 4
        assert elapsed_time_python / elapsed_time_cython1 > 4
Exemplo n.º 4
0
 def test_gev_ban_dimensions(self):
     output = blind_analytic_normalization(
         get_gev_vector(pos_def_hermitian(self.shape_psd),
                        pos_def_hermitian(self.shape_psd)),
         pos_def_hermitian(self.shape_psd))
     tc.assert_equal(output.shape, self.shape_vector)
Exemplo n.º 5
0
 def test_gev_dimensions(self):
     output = get_gev_vector(pos_def_hermitian(self.shape_psd),
                             pos_def_hermitian(self.shape_psd))
     tc.assert_equal(output.shape, self.shape_vector)