InitializeModes

class InitializeModes(occupation)

Bases: BosonicGate

Prepares a bosonic Fock state.

This gate declares the occupation of the modes it is placed on, i.e. the Fock state

\[\lvert n_0, n_1, \ldots, n_{M-1} \rangle = \prod_m \frac{(b^\dagger_m)^{n_m}}{\sqrt{n_m!}} \lvert \text{vac} \rangle \, ,\]

where \(n_m\) is occupation[m]. Synthesis emits the gates that set each mode’s qubits to the pattern encoding its occupation level.

Note

The occupation entries are non-negative integers, not booleans: a single mode may hold arbitrarily many bosons.

Note

This gate does not itself fix a truncation. The occupation it declares must of course be representable by whatever cutoff the boson-to-qubit encoding uses (an occupation of 3 requires max_occupation >= 3) which the synthesis plugin checks at transpile time, since that is where the cutoff is known. max_occupation reports the largest level this gate declares.

Caution

This is an early development prototype. Beware of changes to its interface without warning during the pre-release development of this package.

Initializing an instance of this gate can be done with the arguments listed below.

Parameters:

occupation (Sequence[int]) – the boson number of each mode in the BosonicRegister being initialized by this gate.

Raises:

ValueError – if any occupation entry is negative.

Attributes

max_occupation

The largest occupation level this gate declares.

A boson-to-qubit encoding must retain at least this many levels to represent the declared Fock state; see occupation_encoding().

occupation: tuple[int, ...]

The boson number of each mode in the BosonicRegister initialized by this gate.

Methods

classmethod vacuum(num_modes)

Builds the gate for the vacuum state \(\lvert 0, \ldots, 0 \rangle\).

Parameters:

num_modes (int) – the number of bosonic modes to initialize.

Returns:

An InitializeModes gate declaring zero bosons in every mode.

Return type:

InitializeModes