Ejemplo n.º 1
0
def test_probability() -> None:
    state = qf.w_state(3)
    qf.print_state(state)
    prob = state.probabilities()

    qf.print_probabilities(state)
    assert np.isclose(prob.sum(), 1)
Ejemplo n.º 2
0
def test_probability():
    state = qf.w_state(3)
    qf.print_state(state)
    prob = state.probabilities()

    qf.print_probabilities(state)
    assert qf.asarray(prob).sum() == ALMOST_ONE
Ejemplo n.º 3
0
def test_print_probabilities() -> None:
    f = io.StringIO()
    state = qf.w_state(5)
    qf.print_probabilities(state, file=f)
Ejemplo n.º 4
0
def test_print_probabilities():
    f = io.StringIO()
    state = qf.w_state(5)
    qf.print_probabilities(state, file=f)
    print(f.getvalue())
Ejemplo n.º 5
0
 def main():
     """CLI"""
     print(prepare_w16.__doc__)
     print("states           : probabilities")
     ket = prepare_w16()
     qf.print_probabilities(ket)