tdm#

Time domain multiplexing

Classes

QumodeCircuitTDM(nmode, init_state[, ...])

Time-domain-multiplexed photonic quantum circuit.

class QumodeCircuitTDM(nmode: int, init_state: Any, cutoff: int | None = None, backend: str = 'gaussian', name: str | None = None, noise: bool = False, mu: float = 0, sigma: float = 0.1)[source]#

Bases: QumodeCircuit

Time-domain-multiplexed photonic quantum circuit.

Note

When using large squeezing parameters, we recommend using a double data type and a smaller eps for Homodyne to avoid issues with non-positive definiteness of the covariance matrix.

Parameters:
  • nmode (int) – The number of spatial modes in the circuit.

  • init_state (Any) – The initial state of the circuit. It can be a vacuum state with 'vac'. For Gaussian backend, it can be arbitrary Gaussian states with [cov, mean]. Use xxpp convention and \(\hbar=2\) by default.

  • cutoff (int | None) – The Fock space truncation. Default: None

  • backend (str) – Use 'gaussian' for Gaussian backend or 'bosonic' for Bosonic backend. Default: 'gaussian'

  • name (str | None) – The name of the circuit. Default: None

  • noise (bool) – Whether to introduce Gaussian noise. Default: False

  • mu (float) – The mean of Gaussian noise. Default: 0

  • sigma (float) – The standard deviation of Gaussian noise. Default: 0.1

forward(data: Tensor | None = None, state: Any = None, nstep: int | None = None) list[Tensor][source]#

Perform a forward pass of the TDM photonic quantum circuit and return the final state.

Parameters:
  • data (Tensor | None) – The input data for the encoders with the shape of \((\text{batch}, \text{ntimes}, \text{nfeat})\). Default: None

  • state (Any) – The initial state for the photonic quantum circuit. Default: None

  • nstep (int | None) – The number of the evolved time steps. Default: None

Returns:

The covariance matrix and displacement vector of the measured final state.

Return type:

list[Tensor]

get_samples(wires: int | list[int] | None = None) Tensor[source]#

Get the measured samples according to the given wires.