From 14bee6764abbe25f2c9c2ed1145901229763c516 Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Tue, 4 Feb 2020 17:48:32 +0100 Subject: [PATCH] added todo --- lib_q_computer_math.py | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/lib_q_computer_math.py b/lib_q_computer_math.py index 70590a2..3f4729c 100644 --- a/lib_q_computer_math.py +++ b/lib_q_computer_math.py @@ -1153,25 +1153,23 @@ def test_quantum_processor(): def test_light(): - global UNIVERSE_STATES - UNIVERSE_STATES = [] - hor = s('|0>', name='→') - ver = s('|1>', name='↑') - diag1 = hor + ver - diag1.name = '🡕' - hor_filter = MeasurementOperator.create_from_prob(Matrix(hor.m), name='h') - diag_filter = MeasurementOperator.create_from_prob(Matrix(diag1.m), name='d') - ver_filter = MeasurementOperator.create_from_prob(Matrix(ver.m), name='v') + # TODO: Are these measurement operators the correct way to represent hor/ver/diag filter? + hor_filter = MeasurementOperator.create_from_prob(Matrix(_0.m), name='h') + diag_filter = MeasurementOperator.create_from_prob(Matrix(_p.m), name='d') + ver_filter = MeasurementOperator.create_from_prob(Matrix(_1.m), name='v') - for i in range(10): - random_pol = [[np.random.uniform(0, 1)], [np.random.uniform(0, 1)]] - random_light = State(normalize_state(random_pol)) - qc = QuantumCircuit(1, initial_steps=[[random_light]]) - qc.add_row([hor_filter, diag_filter, ver_filter]) - qc.print() - qp = QuantumProcessor(qc) - # TODO: Dealing with non-normalized state vectors - qp.print_sample(qp.get_sample(100)) + # create random light/photon + random_pol = [[np.random.uniform(0, 1)], [np.random.uniform(0, 1)]] + random_light = State(normalize_state(random_pol)) + qc = QuantumCircuit(1, initial_steps=[[random_light]]) + + # add three filters as operators + qc.add_row([hor_filter, diag_filter, ver_filter]) + qc.print() + qp = QuantumProcessor(qc) + # TODO: This doesn't work - dealing with non-normalized state vectors + # - When measured in horizontal filter, the state vector has a positive |0> and 0 for |1> + qp.print_sample(qp.get_sample(100)) if __name__ == "__main__":