From Qiskit document, the Statevector can be used to specify the oracle of Grover Search. After seeing the source code of the operators, it seems a statevector is converted to a rank-1 projector operator. In this case, the operator may not be unitary.
The code below can be run on a real IBMQ machine.
from qiskit import * from qiskit.quantum_info import Statevector from qiskit.aqua.algorithms import Grover from qiskit import QuantumCircuit oracle = Statevector([0,0,0,0,0,1,1,0]) good_state = ['110','101'] grover = Grover(oracle=oracle, good_state=good_state) # backend = provider.get_backend('ibmq_lima') backend = BasicAer.get_backend('qasm_simulator') result = grover.run(quantum_instance=backend) print('Result type:', type(result)) print() print('Success!' if result.oracle_evaluation else 'Failure!') print('Top measurement:', result)
I am wondering if Statevector of Qiskit has actual speed up or it is just for illustration of Grover Search. Besides, how does it realize when the operator is not unitary?