diff --git a/CHANGELOG.md b/CHANGELOG.md index d48259f..89fe257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # News +## Unreleased + +- Align `GaussianState`, `GaussianUnitary`, and `GaussianChannel` parameterization with QuantumInterface basis API. + - `GaussianState` now subtyped as `StateVector{B,V}` instead of `StateVector{M,V}`. + - `GaussianUnitary` and `GaussianChannel` now subtyped as `AbstractOperator{B,B}` instead of `AbstractOperator{D,T}` and `AbstractOperator{D,T}`. + - Added `basis_l` and `basis_r` fields to `GaussianUnitary` and `GaussianChannel` for QuantumInterface compatibility; these fields mirror the `basis` field. + ## v1.3.4 - 2026-01-05 - Add optional rng arguments to random methods. diff --git a/src/types.jl b/src/types.jl index a619071..23bbafa 100644 --- a/src/types.jl +++ b/src/types.jl @@ -22,7 +22,7 @@ covariance: 2×2 Matrix{Float64}: 0.0 1.0 ``` """ -@kwdef struct GaussianState{B<:SymplecticBasis,M,V} <: StateVector{M,V} +@kwdef struct GaussianState{B<:SymplecticBasis,M,V} <: StateVector{B,V} basis::B mean::M covar::V @@ -53,6 +53,7 @@ Defines a Gaussian unitary for an N-mode bosonic system over a 2N-dimensional ph ## Fields - `basis`: Symplectic basis for Gaussian unitary. +- `basis_l`, `basis_r`: For QuantumInterface compatibility; always equal to `basis`. - `disp`: The displacement vector of length 2N. - `symplectic`: The symplectic matrix of size 2N x 2N. - `ħ = 2`: Reduced Planck's constant. @@ -80,14 +81,16 @@ symplectic: 2×2 Matrix{Float64}: 0.0 1.0 ``` """ -@kwdef struct GaussianUnitary{B<:SymplecticBasis,D,S} <: AbstractOperator{D,S} +@kwdef struct GaussianUnitary{B<:SymplecticBasis,D,S} <: AbstractOperator{B,B} basis::B + basis_l::B = basis + basis_r::B = basis disp::D symplectic::S ħ::Number = 2 function GaussianUnitary(b::B, d::D, s::S; ħ::Number = 2) where {B,D,S} all(size(s) .== length(d) .== 2*(b.nmodes)) || throw(DimensionMismatch(UNITARY_ERROR)) - return new{B,D,S}(b, d, s, ħ) + return new{B,D,S}(b, b, b, d, s, ħ) end end @@ -133,6 +136,7 @@ Defines a Gaussian channel for an N-mode bosonic system over a 2N-dimensional ph ## Fields - `basis`: Symplectic representation for Gaussian channel. +- `basis_l`, `basis_r`: For QuantumInterface compatibility; always equal to `basis`. - `disp`: The displacement vector of length 2N. - `transform`: The transformation matrix of size 2N x 2N. - `noise`: The noise matrix of size 2N x 2N. @@ -166,15 +170,17 @@ noise: 2×2 Matrix{Float64}: 4.0 2.0 ``` """ -@kwdef struct GaussianChannel{B<:SymplecticBasis,D,T} <: AbstractOperator{D,T} +@kwdef struct GaussianChannel{B<:SymplecticBasis,D,T} <: AbstractOperator{B,B} basis::B + basis_l::B = basis + basis_r::B = basis disp::D transform::T noise::T ħ::Number = 2 function GaussianChannel(b::B, d::D, t::T, n::T; ħ::Number = 2) where {B,D,T} all(length(d) .== size(t) .== size(n) .== 2*(b.nmodes)) || throw(DimensionMismatch(CHANNEL_ERROR)) - return new{B,D,T}(b, d, t, n, ħ) + return new{B,D,T}(b, b, b, d, t, n, ħ) end end