CustomPerQubitState

class CustomPerQubitState(state_string)[source]

Bases: InitialState

Per-qubit state from a string of '0', '1', '+', '-'.

Parameters:

state_string (str) – One character per qubit. '0' → nothing, '1' → PauliX, '+' → Hadamard, '-' → PauliX then Hadamard.

Methods Summary

build(wires)

Return a state-preparation circuit on len(wires) qubits.

Methods Documentation

build(wires)[source]

Return a state-preparation circuit on len(wires) qubits.

Parameters:

wires (Sequence) – Ordered sequence of wire labels (qubit iwires[i]). May contain non-integer labels (e.g. graph node names); only the length and ordering matter for circuit emission.

Return type:

QuantumCircuit

Returns:

A QuantumCircuit with len(wires) qubits.