0
$\begingroup$

I am trying to implement a full adder with minimum of 8 qubits to add two 4 bit integers. Integer 1 will be added on q[0-3] while integer 2 will be added on q[4-7]. The output will be measured on q[0-3].

So far I created a full adder to be measured on 2 states but I am having trouble manipulating this code to measure on 4 states. Below is qiskit code:

qc = QuantumCircuit(8,2)

# AND gate1 implementation
qc.ccx(0,1,3)

# OR gate1 implementation
qc.cx(0,4) 
qc.cx(1,4)

# OR gate2 implementation
qc.cx(2,5) 
qc.cx(4,5)

# AND gate2 implementation
qc.ccx(2,4,6)

# OR gate implementation
qc.x(3)
qc.x(6)
qc.ccx(3,6,7)
qc.x(7)

$\endgroup$
1
  • $\begingroup$ What kind of trouble do you have with measurement? I do not see measure command in your code. $\endgroup$ Sep 1, 2023 at 6:04

1 Answer 1

1
$\begingroup$

If you are aiming to perform arithmetic on a quantum computer, you should take a look at methods that involve the Quantum Fourier Transform: https://arxiv.org/abs/2005.00443

$\endgroup$

Your Answer

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

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