operation#
Base classes for photonic quantum operations
Classes
|
A base class for photonic quantum channels. |
|
Delay loop. |
|
A base class for photonic quantum gates. |
|
A base class for quantum operations. |
- class Channel(name: str | None = None, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None)[source]#
Bases:
OperationA base class for photonic quantum channels.
- Parameters:
name (str | None) – The name of the channel. Default:
Nonenmode (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:
Nonecutoff (int | None) – The Fock space truncation. Default:
None
- op_cv(x: list[Tensor]) 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.35-5.37) in page 90
- class Delay(name='Delay', ntau: int = 1, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, den_mat: bool = False, noise: bool = False, mu: float = 0, sigma: float = 0.1)[source]#
Bases:
OperationDelay loop.
- Parameters:
name – The name of the quantum operation. Default:
'Delay'ntau (int) – The number of modes in the delay loop. Default: 1
nmode (int) – The number of spatial 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:
Nonecutoff (int | None) – The Fock space truncation. Default:
Noneden_mat (bool) – Whether to use density matrix representation. Default:
Falsenoise (bool) – Whether to introduce Gaussian noise. Default:
Falsemu (float) – The mean of Gaussian noise. Default: 0
sigma (float) – The standard deviation of Gaussian noise. Default: 0.1
- forward(x: Tensor | list[Tensor] | MatrixProductState | DistributedFockState) Tensor | list[Tensor] | MatrixProductState | DistributedFockState[source]#
Perform a forward pass.
- class Gate(name: str | None = None, nmode: int = 1, wires: int | list[int] | None = None, cutoff: int | None = None, den_mat: bool = False, noise: bool = False, mu: float = 0, sigma: float = 0.1)[source]#
Bases:
OperationA base class for photonic quantum gates.
- Parameters:
name (str | None) – The name of the gate. Default:
Nonenmode (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:
Nonecutoff (int | None) – The Fock space truncation. Default:
Noneden_mat (bool) – Whether to use density matrix representation. Default:
Falsenoise (bool) – Whether to introduce Gaussian noise. Default:
Falsemu (float) – The mean of Gaussian noise. Default: 0
sigma (float) – The standard deviation of Gaussian noise. Default: 0.1
- forward(x: Tensor | list[Tensor] | MatrixProductState | DistributedFockState) Tensor | list[Tensor] | MatrixProductState | DistributedFockState[source]#
Perform a forward pass.
- get_displacement() Tensor[source]#
Get the global displacement vector acting on quadrature operators in xxpp order.
- get_matrix_state(matrix: Tensor) Tensor[source]#
Get the local transformation matrix acting on Fock state tensors.
- get_mpo() tuple[list[Tensor], int][source]#
Convert gate to MPO form with identities at empty sites.
Note
If sites are not adjacent, insert identities in the middle, i.e.,
>>> | | | | | >>> --A---x---B-- -> --A---I---B-- >>> | | | | |
where
>>> a >>> | >>> --i--I--j-- >>> | >>> b
means \(\delta_{i,j} \delta_{a,b}\)
- get_symplectic() Tensor[source]#
Get the global symplectic matrix acting on quadrature operators in xxpp order.
- op_dist_state(x: DistributedFockState) DistributedFockState[source]#
Perform a forward pass for a distributed Fock state tensor.
- op_mps(mps: MatrixProductState) MatrixProductState[source]#
Perform a forward pass for the
MatrixProductState.
- class Operation(name: str | None = None, nmode: int = 1, wires: int | list | None = None, cutoff: int = 2, den_mat: bool = False, noise: bool = False, mu: float = 0, sigma: float = 0.1)[source]#
Bases:
ModuleA base class for quantum operations.
- Parameters:
name (str | None) – The name of the quantum operation. Default:
Nonenmode (int) – The number of modes that the quantum operation acts on. Default: 1
wires (int | list | None) – The indices of the modes that the quantum operation acts on. Default:
Nonecutoff (int) – The Fock space truncation. Default: 2
den_mat (bool) – Whether to use density matrix representation. Default:
Falsenoise (bool) – Whether to introduce Gaussian noise. Default:
Falsemu (float) – The mean of Gaussian noise. Default: 0
sigma (float) – The standard deviation of Gaussian noise. Default: 0.1