3
$\begingroup$

I am new and I don't understand where I should give the input and where I should get the output. Please explain with an example of a circuit run on the Quirk simulator. How to add two numbers?

$\endgroup$
2

1 Answer 1

1
$\begingroup$

Directly implementing the circuits for a full-adder described in the answers to the question linked in the comments in Quirk and swapping the third qubit with the fourth qubit for later convenience, we have the following full adder:

Full Adder on single-qubit input

Quirk allows for up to $16$ qubits. Thus calling this full adder gate "FA", we can daisy-chain up to four such full adders as below, being careful to let the carry register shift over:

Full Adder on 4 Qubits

As above, we add the two $4$-qubit registers $|a\rangle=|a_3a_2a_1a_0\rangle$ and $|b\rangle=|b_3b_2b_1b_0\rangle$ into a $4$-qubit register $|d\rangle=|d_3d_2d_1d_0\rangle$; the third carry register $|c\rangle=|c_3c_2c_1c_0\rangle$ follows through the end.

I think the above example successfully adds $|a\rangle=|0001\rangle$ and $|b\rangle=|1101\rangle$ to get $|d\rangle=|1110\rangle$.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.