1
$\begingroup$

I want to create a two-qubit quantum circuit for a function with these inputs and outputs:

f(00)=10

f(01)=10

f(10)=01

f(11)=01

I do not know how to think about this problem systematically and come up with a quantum circuit. Please note that I am using Qiskit so consider the Qiskit order.

$\endgroup$
1
  • $\begingroup$ Thanks for the comment @MarcoFellous-Asiani. It is going to be an oracle for Simon's Algorithm. Does it make a difference? $\endgroup$
    – Hamideh
    May 10 at 10:27

1 Answer 1

3
$\begingroup$

In Simon's algorithm, the oracle maps $|0\rangle|x\rangle$ to $|f(x)\rangle|x\rangle$. In your case: $$|00\rangle|00\rangle \rightarrow |10\rangle|00\rangle$$ $$|00\rangle|01\rangle \rightarrow |10\rangle|01\rangle$$ $$|00\rangle|10\rangle \rightarrow |01\rangle|10\rangle$$ $$|00\rangle|11\rangle \rightarrow |01\rangle|11\rangle$$

Note: Like Qiskit, I'm using little-endian bit ordering.

This is a unitary operation and can be easily implemented:

circ = QuantumCircuit(4)

circ.cx(1, 2)
circ.cx(2, 3)
circ.x(3)

enter image description here

And to test the output of this circuit, you can use this code snippet:

from qiskit.quantum_info import Statevector

sv = Statevector.from_label('00++').evolve(circ)
sv.draw('latex')
$\endgroup$
3
  • $\begingroup$ It is going to be an oracle for Simon's Algorithm. Does it make a difference? $\endgroup$
    – Hamideh
    May 10 at 10:26
  • 1
    $\begingroup$ Yes! I updated my answer accordingly. $\endgroup$ May 10 at 16:53
  • $\begingroup$ Thanks. It seems to be correct. How did you come up with such a circuit? I am trying to develop my intuition about quantum circuits. $\endgroup$
    – Hamideh
    May 12 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.