measurement#

Photonic measurements

Classes

GeneralBosonic(cov, weight[, nmode, wires, ...])

General Bosonic measurement.

Generaldyne(cov_m[, nmode, wires, cutoff, ...])

General-dyne measurement.

Homodyne([phi, nmode, wires, cutoff, ...])

Homodyne measurement.

PhotonNumberResolvingBosonic(n[, r, nmode, ...])

Photon-number-resolving measurement for Bosonic state.

class GeneralBosonic(cov: Any, weight: Any, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, name: str = 'GeneralBosonic')[source]#

Bases: Operation

General Bosonic measurement.

Parameters:
  • cov (Any) – The covariance matrices for the general Bosonic measurement.

  • weight (Any) – The weights for the general Bosonic measurement.

  • nmode (int) – The number of modes that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the modes that the quantum operation acts on. Default: None

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

  • name (str) – The name of the measurement. Default: 'GeneralBosonic'

forward(x: list[Tensor], samples: Any = None) list[Tensor][source]#

Perform a forward pass for Gaussian (Bosonic) states.

See https://arxiv.org/abs/2103.05530 Eq.(30-31) and Eq.(35-37)

class Generaldyne(cov_m: Any, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, den_mat: bool = False, name: str = 'Generaldyne', noise: bool = False, mu: float = 0, sigma: float = 0.1)[source]#

Bases: Operation

General-dyne measurement.

Parameters:
  • cov_m (Any) – The covariance matrix for the general-dyne measurement.

  • nmode (int) – The number of modes that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the modes that the quantum operation acts on. Default: None

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

  • den_mat (bool) – Whether to use density matrix representation. Default: False

  • name (str) – The name of the measurement. Default: 'Generaldyne'

  • 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(x: list[Tensor], samples: Any = None) list[Tensor][source]#

Perform a forward pass for Gaussian (Bosonic) states.

See Quantum Continuous Variables: A Primer of Theoretical Methods (2024) by Alessio Serafini Eq.(5.143) and Eq.(5.144) in page 121

For Bosonic state, see https://arxiv.org/abs/2103.05530 Eq.(35-37)

class Homodyne(phi: Any = None, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, den_mat: bool = False, eps: float = 0.0002, requires_grad: bool = False, noise: bool = False, mu: float = 0, sigma: float = 0.1, name: str = 'Homodyne')[source]#

Bases: Generaldyne

Homodyne measurement.

Parameters:
  • phi (Any) – The homodyne measurement angle. Default: None

  • nmode (int) – The number of modes that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the modes that the quantum operation acts on. Default: None

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

  • den_mat (bool) – Whether to use density matrix representation. Default: False

  • eps (float) – The measurement accuracy. Default: 2e-4

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

  • 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

  • name (str) – The name of the measurement. Default: 'Homodyne'

extra_repr() str[source]#
forward(x: Tensor | list[Tensor], samples: Any = None) Tensor | list[Tensor][source]#

Perform a forward pass.

init_para(inputs: Any = None) None[source]#

Initialize the parameters.

inputs_to_tensor(inputs: Any = None) Tensor[source]#

Convert inputs to torch.Tensor.

op_cv(x: list[Tensor], samples: Any = None) list[Tensor][source]#

Perform a forward pass for Gaussian (Bosonic) states.

op_fock(x: Tensor, samples: Any = None) Tensor[source]#

Perform a forward pass for Fock state tensors.

class PhotonNumberResolvingBosonic(n: int, r: Any = 0.05, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, name: str = 'PhotonNumberResolvingBosonic')[source]#

Bases: GeneralBosonic

Photon-number-resolving measurement for Bosonic state.

Parameters:
  • n (int) – Photon number.

  • r (Any) – The quality parameter for the approximation. Default: 0.05

  • nmode (int) – The number of modes that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the modes that the quantum operation acts on. Default: None

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

  • name (str) – The name of the measurement. Default: 'PhotonNumberResolvingBosonic'

forward(x: list[Tensor]) list[Tensor][source]#