New answers tagged

3

One problem is that you are resetting the $\left|z\right\rangle$ register after applying the Controlled X(z, y) operation. Right before you reset, your $\left|z\right\rangle$ register is entangled with the other two registers, such that resetting in that way collapses any superposition on the $\left|x\right\rangle \left|y\right\rangle$ registers. While that'...


2

Here is another way to flip the phase of only |0...0⟩: using (ancilla = Qubit()){ (ControlledOnInt(0, X))(register, ancilla); // Bit flips the ancilla to |1⟩ if register is |0...0⟩ Z(ancilla); // Ancilla phase (and therefore whole register phase) becomes -1 if above condition is satisfied (ControlledOnInt(0, X))...


1

ControlledOnInt is a library function which applies a specified operation (in this case SetRegisterToInt) to the target register only if the control register is in a state that encodes the given integer. Internally it does the following: convert the given integer to an array of bits (in little-endian format I think); applies X gate to each qubit that ...


Top 50 recent answers are included