Q#

class Q(*modes: int | Any)#

The implementation of qumodes, which is used to track on which qumodes are the operators placed in the circuit.

Example usage:

import numpy as np
import piquasso as pq

with pq.Program() as program:
    pq.Q(0, 1) | pq.Squeezing(r=0.5)

simulator = pq.GaussianSimulator(d=5)
result = simulator.execute(program)

In the above example, the Squeezing gate is applied to modes 0, 1.

Note, that it is not necessarily required to specify any modes, if the context permits, e.g. when registering states.

One could use the all keyword to indicate that the registered Instruction mashould be applied to all modes, i.e.:

with pq.Program() as program:
    pq.Q(0, 1) | pq.Squeezing(r=0.5)

    pq.Q(all) | pq.ParticleNumberMeasurement()

or alternatively no parameters, i.e.:

with pq.Program() as program:
    pq.Q(0, 1) | pq.Squeezing(r=0.5)

    pq.Q() | pq.ParticleNumberMeasurement()
Parameters:

modes (int) – Variable length list of non-negative integers specifying the modes.

Raises:

InvalidModes – Raised if - the specified modes are not distinct; - negative integers were specified.