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__":