I am implementing a Carry Select Adder, the problem is that the circuit is quite complex to translate in Qiskit.

I need to use one (or multiple) line(s) as input for two (or more) gates.

In particular, given two Reversible Full Adder (RFA) gates both use the qubits A0 and B0, but with different carry in input. If I simply put them in series the second RFA would take as input the output of the first.

I came up with the solution of placing them in parallel by using a copy of the lines A0 and B0 for the second one but I don't like it and maybe there's a more elegant design that I can use.

Graphically, what I would like:

what I would like

What I came up with:

What I came up with

  • 1
    $\begingroup$ Doesn't the no-cloning theorem prevent you from doing this? $\endgroup$ Jun 20 at 5:36
  • $\begingroup$ @Zeeshanahmed I am a computer scientist and new to quantum computing. I didn't know this theorem. So it seems that I cannot clone a wire like a would do with a classical circuit. But can't I just entangle the states? They should behave like a copy as far as I can understand. $\endgroup$
    – eddie
    Jun 20 at 7:35
  • 1
    $\begingroup$ Actually I came up with a better solution: since they're input qubits I can simply use a CNOT where the controlled bit is set to state 0 and the control bit is the state to "copy". So if A0' is the control bit, A0'' will be the controlled bit. It makes sense, right? $\endgroup$
    – eddie
    Jun 20 at 7:55
  • 1
    $\begingroup$ @Zeeshanahmed: Actually, you can do this for basis states. Lookup what is fan-out for details. $\endgroup$ Jun 20 at 13:39
  • 1
    $\begingroup$ @MartinVesely Thank you. This solves part of the problem, because my implementation is using 28 qubits for a 4-qubit carry select adder (which, in classical computing, it uses 8 bits I suppose). I am sure I can use even less qubits, but not less that 22, because I can copy the state but not the "wire" as I would do with a classical circuit. Maybe there are some properties that I am ignoring. $\endgroup$
    – eddie
    Jun 21 at 8:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.