Skip to content

Commit

Permalink
Remove phi_add_gate test
Browse files Browse the repository at this point in the history
  • Loading branch information
MetcalfeTom committed May 15, 2020
1 parent eca73ad commit 907e861
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions test/aqua/test_shor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

import unittest
import math
import operator
from test.aqua import QiskitAquaTestCase
from ddt import ddt, data, idata, unpack
from qiskit import BasicAer, QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer
from qiskit.aqua import QuantumInstance
from qiskit.aqua.algorithms import Shor

Expand Down Expand Up @@ -74,36 +73,6 @@ def test_shor_modinv(self, a_v, m_v, expected):
modinv = Shor.modinv(a_v, m_v)
self.assertTrue(modinv == expected)

@idata([[3, "0011"],
[5, "0101"]])
@unpack
def test_phi_add_gate(self, addition_magnitude, expected_state):
""" shor phi add gate test """
shor = Shor(3)
shor._n = 2
shor._qft.num_qubits = 3
shor._iqft.num_qubits = 3
q = QuantumRegister(4)
c = ClassicalRegister(4, name='measurement')
circuit = QuantumCircuit(q, c)

gate = shor._phi_add_gate(3, addition_magnitude)
qubits = [q[i] for i in reversed(range(len(q) - 1))]

circuit.compose(shor._qft, qubits, inplace=True)
circuit.compose(gate, qubits, inplace=True)
circuit.compose(shor._iqft, qubits, inplace=True)
circuit.measure(q, c)

backend = BasicAer.get_backend('qasm_simulator')
quantum_instance = QuantumInstance(backend, shots=1000)

result = quantum_instance.execute(circuit)

result_data = result.get_counts().items()
most_likely_state = max(result_data, key=operator.itemgetter(1))[0]
self.assertTrue(most_likely_state, expected_state)


if __name__ == '__main__':
unittest.main()

0 comments on commit 907e861

Please sign in to comment.