4
$\begingroup$

I don't know how to prepare using Qiskit the following state in order to implement a Steane's 7-qubit code circuit (I omit the normalization factor): \begin{align*} |0_L\rangle =&|0000000\rangle+|1010101\rangle+|0110011\rangle+|1100110\rangle+ \\ +&|0001111\rangle+|1011010\rangle+|0111100\rangle+|1101001\rangle \end{align*} Furthermore, I was wondering if it exists a general procedure in order to prepare an arbitrary multipartite state like $|0_L\rangle$.

$\endgroup$
  • 1
    $\begingroup$ You have to use the initialize() function. Look at this post: quantumcomputing.stackexchange.com/questions/1413/… $\endgroup$ – Michele Amoretti Jul 24 at 7:19
  • $\begingroup$ Thank you! What if I wanted to use only gates (even if it is not necessary since initialize() exists)? Is there a rule to prepare this kind of states (like for example the combo Hadamard on first qubit+ CNOT for Bell basis in bipartite case)? $\endgroup$ – Hub One Jul 24 at 7:27
  • 1
    $\begingroup$ I am not aware of a general rule. Specific states may have ultra-optimized circuits. The initialize() function is based on a nice algorithm (which is not very recent, and I would like to know if there are even better ones). Note: in your example the $|1011010\rangle$ state appears twice. $\endgroup$ – Michele Amoretti Jul 24 at 7:40
  • $\begingroup$ Thank you again, I've edited the question, now it should be correct. $\endgroup$ – Hub One Jul 24 at 7:47
  • 3
    $\begingroup$ Did you look at this question: quantumcomputing.stackexchange.com/questions/13024/…? It gives the theory, although not the specific qiskit implementation. $\endgroup$ – DaftWullie Jul 24 at 8:27
4
$\begingroup$

Here is a circuit that can create the desired state (similar ideas were discussed in this answer), if all mentioned measurements yield $|0\rangle$ state:

or in a more compact form (the circuits are constructed via quirk). The first three qubits are ancillary qubits and the rest are the qubits where $|0_L\rangle$ will be created if after the measurements all ancillary qubits are in the $|000\rangle$ state, otherwise one should repeat the procedure until the desired measurement result will be archived.


Let's go step by step. The circuit has three parts and in each step, we assume that the measured state of the ancillary is $|0\rangle$. The normalization factors are omitted.

  1. The state after measuring the first ancillary qubit in the $|0\rangle$ state: (measuring $XIXIXIX$ stabilizer)

$$|000\rangle \big( |0000000\rangle + |1010101\rangle \big)$$

  1. The state after measuring the second ancillary qubit in the $|0\rangle$ state: (measuring $IXXIIXX$ stabilizer)

$$|000\rangle \big( |0000000\rangle + |1010101\rangle + |0110011\rangle + |1100110\rangle\big)$$

  1. The state after measuring the third ancillary qubit in the $|0\rangle$ state: (measuring $IIIXXXX$ stabilizer)

$$|000\rangle |0_L\rangle = |000\rangle \big( |0000000\rangle + |1010101\rangle + |0110011\rangle + |1100110\rangle \\ |0001111\rangle + |1011010\rangle +|0111100\rangle + |1101001\rangle \big)$$

After disregarding the ancillary qubits that are in the $|000\rangle$ state we will have the desired $|0_L\rangle$ state. The probability that each measurement outcome will be $|0\rangle$ is $0.5$, thus the probability of creating the $|0_L\rangle$ state with this circuit is $0.125$. For Qiskit, one can implement the circuit mentioned above, then apply any algorithm or gate that is needed on the $|0_L\rangle$ state, and after the computation disregard all the results where ancillary qubits are not in the $|000\rangle$ state.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Very clear, but I don't understand the part about the probability of the outcome. I mean, on the three ancillary qubits you have two Hadamards thus, provided that $H\cdot H=I$, where $I$ is the identity, you should get $|0\rangle$ with probability 1, or am I missing something? $\endgroup$ – Hub One Jul 24 at 16:58
  • 1
    $\begingroup$ @HubOne, There is no place where we have $H \cdot H$, we always have control gates in the middle of Hadamards in this circuit. The probabilities can be seen from the link that I have shared for the equivalent circuit. Also, the probabilities can be obtained by calculating the state before, for example, the first measurement. $\endgroup$ – Davit Khachatryan Jul 24 at 17:17
  • 1
    $\begingroup$ @HubOne, let me try to explain with a simpler circuit. Can you find the state before the measurement of this two-qubit circuit? What is the probability of measuring $|0\rangle$ state? CNOT is a two qubit gate and it changes the state of both qubits. For example, if after CNOT we created an entangled state, that already means that the state of both qubits is changed (the control qubit's state inclusive...it will have some correlation with the target qubit). $\endgroup$ – Davit Khachatryan Jul 25 at 9:19
  • 1
    $\begingroup$ Is the state before the measurement $\frac{1}{\sqrt{2}}(|+\rangle |0\rangle + |-\rangle |1\rangle)$? However, I can see the problem now, it totally makes sense. Thank you $\endgroup$ – Hub One Jul 25 at 9:32
  • 1
    $\begingroup$ No problem :) you can change the title $\endgroup$ – Hub One Jul 25 at 9:39
0
$\begingroup$

Qubits are initialized at 0 so would you be wanting to flip certain qubits to 1?

I’m tempted to just apply x gates to obtain the necessary bits.

For example: |ψ⟩=...+|1010101⟩+...

from qiskit import QuantumCircuit qc = QuantumCircuit(7) qc.x([0, 2, 4, 6])

I hope I understood your question :)

| improve this answer | |
$\endgroup$
  • $\begingroup$ I don't think that with this method you can obtain the superposition I need on the state $|\psi\rangle$, maybe you can prove that I'm wrong. $\endgroup$ – Hub One Jul 24 at 7:13
  • $\begingroup$ I guess that I have to use a combination of Hadamard and $\sigma_x$, but I don't know how to do that efficiently. $\endgroup$ – Hub One Jul 24 at 7:17

Your Answer

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

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