Concept

Qubit Preparation

Prepares independent single-qubit probabilities of being in the |1⟩ state using single-qubit rotations.

Qubits 3 Cost O(n) Default P(|1⟩) = (0.2, 0.5, 0.8)

Qubit preparation initializes each individual qubit in a register into a target single-qubit state with a specified probability P(|1⟩) = p. Because each qubit is prepared independently, the overall state is an unentangled product state.

For each qubit, an RY(θ) rotation with angle θ = 2 · acos(√(1 - p)) (in piradians) or equivalent prepares the exact requested probability. Special cases include p = 0 (|0⟩, no-op), p = 1 (|1⟩, X gate), and p = 0.5 (|+⟩, H gate).

How it works

  1. 1
    Angle calculation

    For each probability p_i, compute the single-qubit rotation angle θ_i.

  2. 2
    Independent rotation

    Apply RY, X, or H to each corresponding wire index.

Default Qubi (static)
QubitPreparation((0.2, 0.5, 0.8))

Function form: QubitPreparation((0.2, 0.5, 0.8))

Circuit

This example expands from a standard-library function. Open it in the simulator to see every gate.

Expected result

State. Independent marginals P(q0=1)=0.2, P(q1=1)=0.5, P(q2=1)=0.8

Product distribution across basis states: P(000) = 0.8·0.5·0.2 = 0.08, P(111) = 0.2·0.5·0.8 = 0.08, etc.

BasisAmplitudeProbability
P(q0=1) single qubit
20%
P(q1=1) single qubit
50%
P(q2=1) single qubit
80%

Notes

  • Single qubit: QubitPreparation(70%) or QubitPreparation(0.7) prepares wire 0 with 70% probability of |1⟩.
  • Multiple qubits: QubitPreparation((20%, 50%, 80%)) or QubitPreparation((0.2, 0.5, 0.8)) prepares wire 0 with 20%, wire 1 with 50%, wire 2 with 80%.
  • Stepped range: QubitPreparation(10%.10%.50%) or QubitPreparation((0.2.0.1.0.5)) expands to stepped probability lists across the register.
  • Explicit wires: QubitPreparation((20%, 50%), 1..2) prepares wires 1 and 2.

Change parameters

The write-up above is for the default circuit. Use this control to generate other variants and load them in the simulator.