ModeRotation
class ModeRotation(rotation_unitary, *, synthesis=None)
Bases: BosonicGate
Implements a passive linear-optical mode transformation.
Given an unitary matrix (rotation_unitary), this gate implements the basis change that maps the creation operators as
equivalently the many-body unitary
The number of bosonic modes the gate acts on is the dimension of rotation_unitary.
Action on the occupation sectors
Restricted to the single-particle sector, the gate is the matrix itself. It acts on every occupation sector at once, however: the two-particle block is the symmetric square of (carrying the factors), and so on up to the truncation.
Synthesis
Breaking this gate down in bosonic space (into a circuit of smaller Evolution gates) is what the synthesis attribute governs. It is None by default, which leaves the gate whole: there is no preferred decomposition, and a method such as BosonicClementsDecomposition is chosen explicitly, either here or for a whole circuit with the B2BSynthesis transpiler pass. The circuit it produces implements the same unitary as the gate (on the untruncated Fock space), and it is the definition of the gate.
A gate that is left whole reaches the boson-to-qubit stage, which needs a plugin registered for ModeRotation to lower it. The library ships none, because the transpiler preset decomposes the gate in bosonic space first. A plugin that maps the generator of to_operator() directly is a few lines long; see Lower a rotation without decomposing it. The two-mode beamsplitter() follows the convention of Clements et al. [1]
Because this gate mixes occupation sectors within a mode, a truncation that merely bounds the initial per-mode occupation is not sufficient. Acting on , a two-mode rotation populates , so a cutoff of max_occupation=1 silently produces a wrong state. The cutoff must bound the total boson number reachable in any single mode. This matters most when the modes have different cutoffs: a rotation moves bosons between modes, so each mode that can receive them needs a cutoff that covers what it can receive, not only what it starts with.
This gate is passive: it conserves the total boson number (it is generated by number-conserving terms). The active Gaussian operations – squeezing and displacement – do not conserve boson number and are not expressible as a ModeRotation.
W. R. Clements et al., Optimal design for universal multiport interferometers, Optica 3, 1460 (2016), arXiv:1603.08788.
Initializing an instance of this gate can be done with the arguments listed below.
Parameters
- rotation_unitary (np.ndarray) – the unitary matrix defining the mode transformation via . It must be square and unitary; this is the caller’s responsibility and is not verified.
- synthesis (B2BSynthesisPlugin | None) – the boson-to-boson synthesis method with which to decompose this gate, when it gets decomposed at all. If
None(the default), the gate has no bosonic decomposition anddecompose()leaves it in place.
Attributes
rotation_unitary
The unitary matrix representing the mode-transformation coefficients.
Methods
beamsplitter
classmethod beamsplitter(theta, phi=0.0)
Constructs the two-mode beamsplitter.
Following the Clements convention, [1] the two-mode transfer matrix is
which together with the single-mode phase shifts generates any when arranged in the Clements mesh.
Parameters
- theta (float) – the mixing angle . A value of gives the balanced 50:50 beamsplitter.
- phi (float) – the relative phase .
Returns
A two-mode ModeRotation.
Return type
from_generator
classmethod from_generator(generator)
Constructs the rotation from an anti-Hermitian generator.
Returns the gate whose rotation_unitary is for the given . For the result to be unitary, must be anti-Hermitian (); this is the caller’s responsibility and is not verified.
Parameters
generator (ndarray) – the anti-Hermitian generator .
Returns
A ModeRotation with rotation_unitary .
Return type
generator
generator()
Returns the anti-Hermitian generator of this rotation.
This is the matrix such that the many-body unitary is , which is what a synthesis plugin exponentiates.
Return type
inverse
inverse(annotated=False)
Returns the inverse of this gate, whose rotation unitary is .
Parameters
annotated (bool) – ignored. The inverse of this gate is another ModeRotation, so it never needs to be an AnnotatedOperation.
Returns
A ModeRotation with the same synthesis method.
Return type
phase_shift
classmethod phase_shift(phases)
Constructs a product of single-mode phase shifts.
Each mode acquires , that is, the rotation unitary is .
Parameters
phases (Sequence[float]) – the phase applied to each mode.
Returns
A ModeRotation that is diagonal in the mode basis.
Return type
to_operator
to_operator(tol=1e-12)
Returns the Hermitian generator of this gate as a BosonOperator.
Builds , the Hermitian operator for which is this gate. That is exactly the form of an Evolution gate at unit time, which makes this the bridge from the gate’s matrix form to the operator algebra, and hence to any boson-to-qubit encoding.
The matrix logarithm of a unitary is anti-Hermitian only up to round-off, so the result is built from the anti-Hermitian part of and is exactly Hermitian, as a PauliEvolutionGate requires of the mapped operator.
Parameters
tol (float) – entries of with magnitude at or below this are dropped. logm of a sparse or block-diagonal unitary leaves round-off in nominally-zero entries; keeping them would bloat the operator with meaningless terms.
Returns
The Hermitian generator as a BosonOperator.