0

Studying Grover on IBM lab using Qiskit. But the following code produces unexpected outputs. Note that PhaseOracle produces 2 CCZ gates. *Could anyone check(and explain) why are those unexpected counts/outputs(given at the bottom) being produced?

Note that-- when I try a similar code with similar logical expressions with aqua (which is deprecated, the expected outputs are produced)

from qiskit import *
from qiskit.tools.visualization import plot_histogram
from qiskit.circuit.library import PhaseOracle
from qiskit.algorithms import Grover, AmplificationProblem
%matplotlib inline

matplotlib inline
oracle = PhaseOracle('((A & C) | (B & D)) & ~(C & D)')
problem = AmplificationProblem(oracle=oracle, is_good_state=oracle.evaluate_bitstring)
backend = Aer.get_backend('qasm_simulator')
grover = Grover(quantum_instance=backend)
result = grover.amplify(problem)
print(result.circuit_results[0])

{'0111': 259, '1100': 244, '1101': 234, '0011': 287}

it can already be deduced from the problem detail section.

EA_Oracle
  • 1
  • 1

0 Answers0