Unitary transformations
A change of frame replaces every operator $X$ by $U^\dagger X U$ for a unitary $U$. Rotating frames remove fast oscillations, displacements move a driven mode to its steady state, and squeezing or Bogoliubov transformations diagonalize quadratic Hamiltonians. For the transformations that keep the operator algebra linear, the image of every operator is known in closed form, so the new Hamiltonian follows exactly, without a Baker–Campbell–Hausdorff series. Consider a Kerr oscillator driven at frequency $\omega_d$,
\[H = \omega a^\dagger a + K a^{\dagger 2} a^2 + \eta e^{-i\omega_d t} a^\dagger + \eta^* e^{i\omega_d t} a.\]
- Rotating frames
- Displacements
- Squeezing and Bogoliubov transformations
- Composition and inversion
- Spins and finite-level systems
- General generators
- Reading displacement amplitudes
Rotating frames
The drive oscillates at $\omega_d$. In the frame rotating at the drive frequency, Rotation(a, ω_d * t, t), the drive becomes static and the mode frequency is replaced by the detuning $\omega - \omega_d$.
using SecondQuantizedAlgebraa = Destroy(FockSpace(:cavity), :a)@variables ω ω_d K t η::NumberH = ω * a' * a + K * a' * a' * a * a + η * expim(-ω_d * t) * a' + conj(η) * expim(ω_d * t) * aH_rot = transform(H, Rotation(a, ω_d * t, t))\[\mathrm{conj}\left( \eta \right) a + \eta a^{\dagger} + \left(\omega - \mathtt{\omega_{d}}\right) a^{\dagger}a + K a^{\dagger}a^{\dagger}aa\]
An observable is transformed with conjugate, which gives $U^\dagger X U$. A Hamiltonian in a frame that moves in time also picks up the term $i(\partial_t U^\dagger)U$, so it is transformed with transform. Here that term subtracts $\omega_d a^\dagger a$.
gauge_term(Rotation(a, ω_d * t, t))\[ - \mathtt{\omega_{d}} a^{\dagger}a\]
SecondQuantizedAlgebra.conjugate — Function
conjugate(A, U::UnitaryTransform)
conjugate(L, U::UnitaryTransform)Image of an operator expression under a unitary transformation.
The result is $U^\dagger A U$, with every operator replaced by its exact image; no series is truncated. Formal operator functions are transformed through their arguments. For a Lindbladian or a superoperator L, every operator it contains is conjugated, so a channel $\mathcal{D}[J]$ becomes $\mathcal{D}[U^\dagger J U]$. For a Hamiltonian in a time-dependent frame use transform, which adds the term from the motion of the frame.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables α::Number;julia> conjugate(a' * a, Displace(a, α))conj(α)*α + conj(α) * a + α * a' + a' * aSee also transform, UnitaryTransform.
SecondQuantizedAlgebra.transform — Function
transform(H, U::UnitaryTransform)
transform(L, U::UnitaryTransform)Hamiltonian in the frame of a unitary transformation.
The result is $U^\dagger H U + i (\partial_t U^\dagger) U$. The second term, returned by gauge_term, comes from the motion of a time-dependent frame. For a static transformation it vanishes and transform agrees with conjugate. For a Lindbladian L, the Hamiltonian is transformed and every jump is conjugated.
QuantumOpticsBase also exports a transform. With both packages loaded, import the name explicitly, using SecondQuantizedAlgebra: transform, or qualify it.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables ω g t;julia> transform(ω * a' * a + g * (a + a'), Rotation(a, ω * t, t))exp(-im*t*ω)*g * a + exp(im*t*ω)*g * a'See also conjugate, gauge_term, RotatingFrame.
SecondQuantizedAlgebra.gauge_term — Function
gauge_term(U::UnitaryTransform)Term that the motion of a time-dependent frame adds to a Hamiltonian.
It is $i (\partial_t U^\dagger) U$, zero for a static transformation. transform adds it automatically.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables ω t;julia> gauge_term(Rotation(a, ω * t, t))-ω * a' * aSee also transform.
RotatingFrame builds the same frame from the Hamiltonian it rotates with, which is convenient when that Hamiltonian involves several subsystems.
transform(H, RotatingFrame(ω_d * a' * a, t)) == H_rottrueSecondQuantizedAlgebra.RotatingFrame — Function
RotatingFrame(H0, t)Frame rotating with a time-independent Hamiltonian H0, the interaction picture.
The transformation is $U = e^{-i H_0 t}$. With transform, a Hamiltonian $H_0 + V$ becomes $U^\dagger V U$, since the motion of the frame cancels H0. H0 must be Hermitian and of a form that UnitaryTransform can exponentiate.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables ω g t;julia> transform(ω * a' * a + g * (a + a'), RotatingFrame(ω * a' * a, t))exp(-im*t*ω)*g * a + exp(im*t*ω)*g * a'SecondQuantizedAlgebra.Rotation — Function
Rotation(a, θ)
Rotation(a, b, θ)
Rotation(x, p, θ)
Rotation(S, axis::Int, θ)
Rotation(σ, W::AbstractMatrix)
Rotation(a, θ, t)
Rotation(a, b, θ, t)
Rotation(x, p, θ, t)
Rotation(S, axis::Int, θ, t)
Rotation(σ, W::AbstractMatrix, t)Rotation of a mode, of a pair of modes or quadratures, of a spin, or of the levels of a finite-level system.
Rotation(a, θ)turns the phase of a mode, $a \mapsto e^{-i\theta} a$.Rotation(a, b, θ)mixes two modes as a beam splitter, $a \mapsto \cos\theta\, a + \sin\theta\, b$ and $b \mapsto -\sin\theta\, a + \cos\theta\, b$.Rotation(x, p, θ)rotates a pair of quadratures in phase space in the same way.Rotation(S, axis, θ)rotates a spin or Pauli triple byθaboutaxis(1, 2 or 3);Sis any component of the triple.Rotation(σ, W)changes the basis of a finite-level system, $\sigma^{ij} \mapsto W^\dagger \sigma^{ij} W$, acting on all transitions of the system;σis any one of them.Wis a square unitary matrix with one row per level; its size is checked, its unitarity is not.
With a final time variable t, the angle or matrix may depend on time and the transformation carries the gauge_term of the moving frame.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables θ;julia> conjugate(a, Rotation(a, θ))exp(-im*θ) * ajulia> Sx = Spin(SpinSpace(:S), :S, 1);julia> conjugate(Sx, Rotation(Sx, 3, θ))cos(θ) * Sx - sin(θ) * SySee also RotatingFrame, Squeeze, Displace.
Rotation is one of several named constructors, which together cover the standard frames of quantum optics:
| System | Constructor | Action |
|---|---|---|
| Mode | Displace(a, α) | $a \mapsto a + \alpha$ |
| Mode | Rotation(a, θ) | $a \mapsto e^{-i\theta} a$ |
| Mode | Squeeze(a, r, ϕ) | $a \mapsto \cosh r\, a + e^{i\phi} \sinh r\, a^\dagger$ |
| Two modes | Rotation(a, b, θ) | beam splitter |
| Two modes | Squeeze(a, b, r) | two-mode squeezing |
| Several modes | Bogoliubov(modes, S) | general linear mixing of $a$ and $a^\dagger$ |
| Quadratures | Displace(x, p, dx, dp) | $x \mapsto x + dx$, $p \mapsto p + dp$ |
| Quadratures | Rotation(x, p, θ) | rotation in phase space |
| Quadratures | Squeeze(x, p, r) | $x \mapsto e^{r} x$, $p \mapsto e^{-r} p$ |
| Spin or Pauli | Rotation(S, axis, θ) | rotation about an axis |
| Finite-level system | Rotation(σ, W) | change of basis by a unitary matrix $W$ |
| Any | RotatingFrame(H0, t) | interaction picture of $H_0$ |
| Driven mode | DisplacementFrame(a, H) | displacement to the steady state |
Displace, Rotation, Squeeze and DisplacementFrame take a final time variable t when their parameters depend on time. The time variable is a real symbolic variable, and without it no time-derivative term is produced, so transform then coincides with conjugate.
Displacements
A strong drive pushes the mode to a large coherent amplitude $\alpha$, and the fluctuations around it are described in a displaced frame. Written with the detuning $\Delta = \omega - \omega_d$, the displaced Hamiltonian shows how the Kerr term acts on the fluctuations: a frequency shift $4K|\alpha|^2$, squeezing terms $K\alpha^2 a^{\dagger 2}$, and a linear term that vanishes when $\alpha$ solves the classical steady-state equation $\Delta\alpha + 2K|\alpha|^2\alpha + \eta = 0$.
@variables Δ α::NumberH_det = substitute(H_rot, Dict(ω => ω_d + Δ))transform(H_det, Displace(a, α))\[\mathrm{conj}\left( \eta \right) ~ \alpha + \mathrm{conj}\left( \alpha \right) ~ \eta + \mathrm{conj}\left( \alpha \right) ~ \Delta ~ \alpha + \alpha^{2} ~ \left( \mathrm{conj}\left( \alpha \right) \right)^{2} ~ K + \left(\mathrm{conj}\left( \eta \right) + \mathrm{conj}\left( \alpha \right) ~ \Delta + 2 ~ \left( \mathrm{conj}\left( \alpha \right) \right)^{2} ~ K ~ \alpha\right) a + \left(\eta + \Delta ~ \alpha + 2 ~ \alpha^{2} ~ K ~ \mathrm{conj}\left( \alpha \right)\right) a^{\dagger} + \left( \mathrm{conj}\left( \alpha \right) \right)^{2} ~ K aa + \left(\Delta + 4 ~ K ~ \mathrm{conj}\left( \alpha \right) ~ \alpha\right) a^{\dagger}a + \alpha^{2} ~ K a^{\dagger}a^{\dagger} + 2 ~ K ~ \mathrm{conj}\left( \alpha \right) a^{\dagger}aa + 2 ~ K ~ \alpha a^{\dagger}a^{\dagger}a + K a^{\dagger}a^{\dagger}aa\]
DisplacementFrame finds the displacement from the linear part of a Hamiltonian, here $\alpha = -\eta/\Delta$. It removes the drive exactly when $K = 0$, and leaves the Kerr correction $2K|\alpha|^2\alpha$ as a residual drive.
D = DisplacementFrame(a, Δ * a' * a + η * a' + conj(η) * a)conjugate(a, D)\[\frac{ - \eta}{\Delta} + a\]
SecondQuantizedAlgebra.DisplacementFrame — Function
DisplacementFrame(a, H)
DisplacementFrame(x, p, H)
DisplacementFrame(a, H, t)
DisplacementFrame(x, p, H, t)
DisplacementFrame(a, L)
DisplacementFrame(a, L, t)Displacement to the classical steady state of a driven mode.
H is a Hamiltonian of one mode that is at most linear in the drive, such as $\Delta a^\dagger a + \eta a^\dagger + \eta^* a$. The transformation displaces the mode by its steady-state amplitude, here $-\eta/\Delta$, which removes the drive. The quadrature form accepts any Hermitian quadratic H. With a time variable t the drive may be a finite sum of phases expim(ω t), and the frame follows the steady driven response, without the transient free oscillation. A drive on resonance throws an ArgumentError, and symbolic denominators are kept as written.
With a damped linear Lindbladian L in place of H, the amplitude is the fixed point of the drift transpose(L)(a) = λ a + c, so loss and heating enter it as well.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables Δ η::Number;julia> H = Δ * a' * a + η * a' + conj(η) * a;julia> conjugate(H, DisplacementFrame(a, H))(-conj(η)*η) / Δ + Δ * a' * aSecondQuantizedAlgebra.Displace — Function
Displace(a, α)
Displace(x, p, dx, dp)
Displace(a, α, t)
Displace(x, p, dx, dp, t)Displacement of a bosonic mode or of a pair of quadratures.
The mode a is shifted by the complex amplitude α, $a \mapsto a + \alpha$. A pair of quadratures is shifted by real amounts, $x \mapsto x + dx$ and $p \mapsto p + dp$. With a final time variable t, the amplitudes may depend on time and the transformation carries the gauge_term of the moving frame.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables α::Number;julia> conjugate(a' * a, Displace(a, α))conj(α)*α + conj(α) * a + α * a' + a' * ajulia> h = PhaseSpace(:mode); x = Position(h, :x); p = Momentum(h, :p);julia> @variables dx dp;julia> conjugate(x * p, Displace(x, p, dx, dp))dp*dx + dp * x + dx * p + x * pSee also DisplacementFrame, Rotation, Squeeze.
Squeezing and Bogoliubov transformations
Around the steady state, the quadratic part of the displaced Hamiltonian has the form $\delta a^\dagger a + \frac{\kappa}{2}(a^{\dagger 2} + a^2)$, with $\delta = \Delta + 4K|\alpha|^2$ and $\kappa = 2K\alpha^2$ for real $\alpha$. A transformation that mixes annihilation and creation operators diagonalizes it. Under Squeeze, the coefficient of $a^2$ becomes $\frac{1}{2}(\kappa\cosh 2r + \delta\sinh 2r)$, which vanishes for $\tanh 2r = -\kappa/\delta$.
@variables δ κ rconjugate(δ * a' * a + κ / 2 * (a' * a' + a * a), Squeeze(a, r))\[\cosh\left( r \right) ~ \sinh\left( r \right) ~ \kappa + \sinh^{2}\left( r \right) ~ \delta + \left(\frac{1}{2} ~ \cosh^{2}\left( r \right) ~ \kappa + \cosh\left( r \right) ~ \sinh\left( r \right) ~ \delta + \frac{1}{2} ~ \sinh^{2}\left( r \right) ~ \kappa\right) aa + \left(\cosh^{2}\left( r \right) ~ \delta + 2 ~ \cosh\left( r \right) ~ \sinh\left( r \right) ~ \kappa + \sinh^{2}\left( r \right) ~ \delta\right) a^{\dagger}a + \left(\frac{1}{2} ~ \cosh^{2}\left( r \right) ~ \kappa + \cosh\left( r \right) ~ \sinh\left( r \right) ~ \delta + \frac{1}{2} ~ \sinh^{2}\left( r \right) ~ \kappa\right) a^{\dagger}a^{\dagger}\]
Bogoliubov does the same for any number of modes with a given matrix.
SecondQuantizedAlgebra.Squeeze — Function
Squeeze(a, r, ϕ = 0)
Squeeze(a, b, r)
Squeeze(x, p, r)
Squeeze(a, r, ϕ, t)
Squeeze(a, b, r, t)
Squeeze(x, p, r, t)Squeezing of a mode, of a pair of modes, or of a pair of quadratures.
Squeeze(a, r, ϕ)squeezes one mode, $a \mapsto \cosh r\, a + e^{i\phi} \sinh r\, a^\dagger$.Squeeze(a, b, r)squeezes two modes jointly, $a \mapsto \cosh r\, a + \sinh r\, b^\dagger$ and the same withaandbexchanged.Squeeze(x, p, r)rescales a pair of quadratures, $x \mapsto e^{r} x$ and $p \mapsto e^{-r} p$.
With a final time variable t, the parameters may depend on time and the transformation carries the gauge_term of the moving frame. A time-dependent single-mode squeeze always gives the phase, Squeeze(a, r, 0, t), since the third argument is ϕ.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables r;julia> conjugate(a, Squeeze(a, r))cosh(r) * a + sinh(r) * a'julia> conjugate(a, inv(Squeeze(a, r)))cosh(r) * a - sinh(r) * a'See also Bogoliubov, Rotation.
SecondQuantizedAlgebra.Bogoliubov — Function
Bogoliubov(modes, S::AbstractMatrix)
Bogoliubov(modes, U::AbstractMatrix, V::AbstractMatrix)General linear transformation of bosonic modes that mixes annihilation and creation operators.
modes is one annihilation operator, or a vector or tuple of them. The block form maps $a \mapsto U a + V a^\dagger$. The full form acts on $(a_1, \ldots, a_N, a_1^\dagger, \ldots, a_N^\dagger)$ with the matrix S, which must have the block structure [U V; conj(V) conj(U)]. For the result to be unitary the blocks must preserve the commutation relations, $S J S^\dagger = J$ with $J = \mathrm{diag}(1_N, -1_N)$. This is the caller's responsibility, also after substitute: the modes and the matrix dimensions are checked, but the condition is not, and a numeric matrix is used as given, without tolerance or projection. For squeezing and beam splitters, Squeeze and Rotation satisfy it by construction.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables u::Number v::Number;julia> B = Bogoliubov(a, [u v; conj(v) conj(u)]);julia> conjugate(a, B)u * a + v * a'julia> conjugate(a, substitute(B, Dict(u => 5//3, v => 4//3)))5//3 * a + 4//3 * a'See also Squeeze, Rotation, UnitaryTransform.
Composition and inversion
Transformations compose with *, the left one applied first, and are inverted with inv, which needs no inverse rules from the caller. The time-derivative terms compose in the same order as the operator maps, so a product of frames gives the same Hamiltonian as the two frame changes applied one after the other. The rotating and displaced frames combine into one.
U = Rotation(a, ω_d * t, t) * Dtransform(substitute(H, Dict(ω => ω_d + Δ)), U) == transform(H_det, D)trueApplying a transformation and then its inverse gives back the original expression.
X = a' * a + K * a' * a' * a * aconjugate(conjugate(X, D), inv(D)) == XtrueParameters of a transformation are set with substitute, so a symbolic frame is built once and evaluated later. Time-dependent transformations in one product must share the same time variable.
conjugate(a, substitute(Squeeze(a, r), Dict(r => 0))) == atruegenerators lists the operators a transformation acts on.
generators(U)\[ \left[ \begin{array}{c} a \\ a^{\dagger} \\ \end{array} \right] \]
SecondQuantizedAlgebra.generators — Function
generators(U::UnitaryTransform)Operators that the transformation U acts on, in canonical order.
Examples
julia> h = FockSpace(:a) ⊗ FockSpace(:b);julia> @qnumbers a::Destroy(h, 1) b::Destroy(h, 2);julia> @variables θ;julia> generators(Rotation(a, b, θ))4-element Vector{Op}: a a' b b'See also UnitaryTransform.
Spins and finite-level systems
A spin or a set of Pauli matrices is rotated about one of its axes. A rotation about the $y$ axis mixes $S_z$ with $S_x$.
using SecondQuantizedAlgebraSz = Spin(SpinSpace(:S), :S, 3)@variables θconjugate(Sz, Rotation(Sz, 2, θ))\[ - \sin\left( \theta \right) {S}_{{x}} + \cos\left( \theta \right) {S}_{{z}}\]
The levels of a finite-level system change to a new basis by a unitary matrix. A real rotation by $\theta$ mixes the two levels of an atom.
h = NLevelSpace(:atom, (:g, :e))σ = Transition(h, :σ, :g, :e)W = [cos(θ) -sin(θ); sin(θ) cos(θ)]conjugate(σ, Rotation(σ, W))\[\cos\left( \theta \right) ~ \sin\left( \theta \right) {\sigma}^{{11}} + \cos^{2}\left( \theta \right) {\sigma}^{{12}} - \sin^{2}\left( \theta \right) {\sigma}^{{21}} - \cos\left( \theta \right) ~ \sin\left( \theta \right) {\sigma}^{{22}}\]
The matrix must be unitary, which is not checked. With a time-dependent matrix, Rotation(σ, W, t) carries the gauge term $i \dot W^\dagger W$.
General generators
A transformation can also be given by its Hermitian generator $G$ as $U = e^{-i\theta G}$. The image of each operator is found by closing the commutators with $G$ and exponentiating the resulting matrix exactly. The tunnelling term $a^\dagger b + b^\dagger a$ between two modes generates a beam splitter with a phase.
using SecondQuantizedAlgebrah = FockSpace(:a) ⊗ FockSpace(:b)a = Destroy(h, :a, 1)b = Destroy(h, :b, 2)@variables θconjugate(a, UnitaryTransform(a' * b + b' * a, θ))\[\cos\left( \theta \right) a - \sin\left( \theta \right) ~ \mathit{i} b\]
The exponential is exact only for numeric rates, so a generator such as $g(a^\dagger b + b^\dagger a)$ with a symbolic $g$ throws an ArgumentError; it is written as UnitaryTransform(a' * b + b' * a, g * θ), or with a named constructor.
SecondQuantizedAlgebra.UnitaryTransform — Type
UnitaryTransform(G, θ)
inv(U)
U1 * U2Exact change of frame generated by a Hermitian operator.
UnitaryTransform(G, θ) is the transformation $U = e^{-i\theta G}$. The image of each operator follows in closed form when the commutators with G close on a finite set of operators and their exponential is known exactly, as for displacements, phase rotations, beam splitters and squeezers with numeric rates; otherwise an ArgumentError is thrown. The named constructors Displace, Rotation, Squeeze, Bogoliubov, RotatingFrame and DisplacementFrame cover the common frames, also with symbolic parameters.
inv(U) is the inverse transformation, and in a product U1 * U2 the left factor is applied first. Parameters of a transformation are replaced with substitute.
Examples
julia> a = Destroy(FockSpace(:cavity), :a);julia> @variables θ;julia> conjugate(a, UnitaryTransform(a' * a, θ))exp(-im*θ) * ajulia> conjugate(a, Displace(a, 1//2) * Rotation(a, θ))1//2 + exp(-im*θ) * aSee also conjugate, transform, generators.
Formal operator functions are transformed through their arguments, so the result stays exact.
conjugate(cos(a + a'), Rotation(a, θ))\[\cos\left( e^{-i \theta} a + e^{i \theta} a^{\dagger} \right)\]
Reading displacement amplitudes
displacement(U, a) returns the c-number part of conjugate(a, U), i.e. the displacement amplitude of a Fock or phase-space frame.
SecondQuantizedAlgebra.displacement — Function
displacement(U::UnitaryTransform, o::Op)Return the c-number part of conjugate(o, U) for a Fock or phase-space operator o: α for conjugate(a, U) = L(a) + α with L linear. For a moving frame the result is the time-dependent amplitude; a site U does not act on gives zero.