WState¶
- class WState(block_size, n_blocks)[source]¶
Bases:
InitialStateProduct of W-states on contiguous qubit blocks.
Prepares a uniform superposition over one-hot basis states within each block:
|s₀⟩ = |W_{block_size}⟩^{⊗ n_blocks}where |W_n⟩ = (|10…0⟩ + |01…0⟩ + … + |00…1⟩) / √n.
Useful as the initial state for any one-hot encoded problem (routing, assignment, scheduling, graph coloring, etc.).
- Parameters:
Methods Summary
build(wires)Prepare W-states on each block of qubits.
Methods Documentation
- build(wires)[source]¶
Prepare W-states on each block of qubits.
- Parameters:
wires (
Sequence) – Must have lengthblock_size * n_blocks.- Return type:
- Returns:
A
QuantumCircuitwithblock_size * n_blocksqubits.