Exemplo n.º 1
0
def test_qasm_ex2():
    q = Qasm(
        "qubit q_0",
        "qubit q_1",
        "qubit q_2",
        "h  q_1",
        "cnot q_1,q_2",
        "cnot q_0,q_1",
        "h q_0",
        "measure q_1",
        "measure q_0",
        "c-x q_1,q_2",
        "c-z q_0,q_2",
    )
    assert q.get_circuit() == CGate(2, Z(0)) * CGate(1, X(0)) * Mz(2) * Mz(1) * H(
        2
    ) * CNOT(2, 1) * CNOT(1, 0) * H(1)
def test_Mz():
    assert str(Mz(0)) == 'Mz(0)'
def test_qasm_ex2():
    q = Qasm('qubit q_0', 'qubit q_1', 'qubit q_2', 'h  q_1', 'cnot q_1,q_2',
             'cnot q_0,q_1', 'h q_0', 'measure q_1', 'measure q_0',
             'c-x q_1,q_2', 'c-z q_0,q_2')
    assert q.get_circuit() == CGate(2, Z(0)) * CGate(
        1, X(0)) * Mz(2) * Mz(1) * H(2) * CNOT(2, 1) * CNOT(1, 0) * H(1)
Exemplo n.º 4
0
Arquivo: qasm.py Projeto: msgoff/sympy
 def measure(self, arg):
     self.circuit.append(Mz(self.index(arg)))
Exemplo n.º 5
0
def test_Mz():
    assert str(Mz(0)) == "Mz(0)"