def test_real_imag_2_complex_array_wrong_len(array): with pytest.raises( ValueError, match= "separate_real_imag_of_mc_samples: vectors of real and imaginary " "parts are expected to contain exactly as many real as " r"imaginary parts but the first one is of odd length=.*", ): real_imag_2_complex(array)
def test_real_imag_2_complex_vector_wrong_len(vector): with pytest.raises( ValueError, match= "separate_real_imag_of_vector: vector of real and imaginary parts is " "expected to contain exactly as many real as imaginary parts but is of " r"odd length=.*", ): real_imag_2_complex(vector)
def test_real_imag_2_complex_array_values(array): half_the_array_length = len(array[0]) // 2 assert_equal( real_imag_2_complex(array), array[:, :half_the_array_length] + 1j * array[:, half_the_array_length:], )
def test_real_imag_2_complex_vector_len(array): assert_equal(len(real_imag_2_complex(array)), len(array) // 2)
def test_real_imag_2_complex_array_shape(array): assert_equal( real_imag_2_complex(array).shape, (len(array), len(array[0]) // 2))
def complex_H_with_UH(monte_carlo): return { "H": real_imag_2_complex(monte_carlo["H"]), "UH": monte_carlo["UH"], }