def test_amplitudes_and_probs_output_type(self, wf: Wavefunction): if len(wf.free_symbols) > 0: assert wf.amplitudes.dtype == object assert wf.probabilities().dtype == object else: assert wf.amplitudes.dtype == np.complex128 assert wf.probabilities().dtype == np.float64
def test_get_outcome_probs(self, wf_vec): wf = Wavefunction(wf_vec) probs_dict = wf.get_outcome_probs() assert all([len(key) == wf.n_qubits for key in probs_dict.keys()]) for key in probs_dict.keys(): assert len(key) == wf.n_qubits assert wf.probabilities()[int(key, 2)] == probs_dict[key]