Fock Simulators#

Warning

The ordering of the Fock basis is increasing with particle numbers, and in each particle number conserving subspace, lexicographic ordering is used.

Example for 3 modes:

\[| 000 \rangle, | 001 \rangle, | 010 \rangle, | 100 \rangle, | 002 \rangle, | 011 \rangle, | 020 \rangle, | 101 \rangle, | 110 \rangle, | 200 \rangle \dots\]

General Fock Simulator#

class FockSimulator(d: int, config: Config | None = None, calculator: BaseCalculator | None = None)#

Performs photonic simulations using Fock representation.

The simulation (when executed) results in an instance of FockState.

Example usage:

import numpy as np
import piquasso as pq


with pq.Program() as program:
    pq.Q(all) | pq.Vacuum()

    pq.Q(0)   | pq.Squeezing(r=0.1)
    pq.Q(1)   | pq.Squeezing(r=0.2)

    pq.Q(0, 1) | pq.Beamsplitter(theta=np.pi / 3)

    pq.Q(0) | pq.Attenuator(theta=0.01)
    pq.Q(1) | pq.Attenuator(theta=0.02)

    pq.Q(0) | pq.Kerr(xi=0.05)

simulator = pq.FockSimulator(d=2, config=pq.Config(cutoff=7))
result = simulator.execute(program)
Supported preparations:

Vacuum, Create, Annihilate, DensityMatrix.

Supported gates:

Interferometer, Beamsplitter, Phaseshifter, MachZehnder, Fourier, Kerr, CrossKerr, CubicPhase, GaussianTransform, Squeezing, QuadraticPhase, Squeezing2, ControlledX, ControlledZ, Displacement, PositionDisplacement, MomentumDisplacement.

Supported measurements:

ParticleNumberMeasurement.

Supported channels:

Attenuator

Pure Fock Simulator#

class PureFockSimulator(d: int, config: Config | None = None, calculator: BaseCalculator | None = None)#

Performs photonic simulations using Fock representation with pure states.

The simulation (when executed) results in an instance of PureFockState.

Example usage:

import numpy as np
import piquasso as pq


with pq.Program() as program:
    pq.Q(all) | pq.Vacuum()

    pq.Q(0)   | pq.Squeezing(r=0.1)
    pq.Q(1)   | pq.Squeezing(r=0.2)

    pq.Q(0, 1) | pq.Beamsplitter(theta=np.pi / 3)

    pq.Q(0) | pq.Kerr(xi=0.05)

simulator = pq.PureFockSimulator(d=2, config=pq.Config(cutoff=7))
result = simulator.execute(program)
Supported preparations:

Vacuum, Create, Annihilate, StateVector.

Supported gates:

Interferometer, Beamsplitter, Phaseshifter, MachZehnder, Fourier, Kerr, CrossKerr, CubicPhase, GaussianTransform, Squeezing, QuadraticPhase, Squeezing2, ControlledX, ControlledZ, Displacement, PositionDisplacement, MomentumDisplacement.

Supported measurements:

ParticleNumberMeasurement.

Supported channels:

Attenuator.