Skip to content

Commit

Permalink
reorganize manual in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
apkille committed Dec 25, 2024
1 parent c310e27 commit ea87da6
Showing 1 changed file with 213 additions and 45 deletions.
258 changes: 213 additions & 45 deletions docs/src/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,69 @@ Listed below are supported predefined Gaussian states:
Detailed discussions and mathematical descriptions for each of these states are given in the
[Gaussian Zoos](@ref) page.

### Gaussian Unitaries

To transform Gaussian states into Gaussian states, we need Gaussian maps. Let's begin with the simplest Gaussian transformation, a unitary transformation, which can be created with the [`GaussianUnitary`](@ref) type:

```@docs; canonical = false
GaussianUnitary
```

This is a rather clean way to characterize a large group of Gaussian transformations on
an `N`-mode Gaussian bosonic system. As long as we have a displacement vector of size `2N` and symplectic matrix of size `2N x 2N`, we can create a Gaussian transformation.

This library has a number of predefined Gaussian unitaries, which are listed below:

- [`displace`](@ref)
- [`squeeze`](@ref)
- [`twosqueeze`](@ref)
- [`phaseshift`](@ref)
- [`beamsplitter`](@ref)

Detailed discussions and mathematical descriptions for each of these unitaries are given in the [Gaussian Zoos](@ref) page.

## Gaussian Channels

Noisy bosonic channels are an important model for describing the interaction between a Gaussian state and its environment. Similar to Gaussian unitaries, Gaussian channels are linear bosonic channels that map Gaussian states to Gaussian states. Such objects can be created with the [`GaussianChannel`](@ref) type:

```@docs; canonical = false
GaussianChannel
```

Listed below are a list of predefined Gaussian channels supported by Gabs:

- [`attenuator`](@ref)
- [`amplifier`](@ref)

!!! note
Any predefined Gaussian unitary
method can be called with an additional noise matrix to create a [`GaussianChannel`](@ref) object. For instance, a noisy displacement operator can be called with [`displace`](@ref) as follows:

```jldoctest
julia> basis = QuadPairBasis(1);

julia> noise = [1.0 -2.0; 4.0 -3.0];

julia> displace(basis, 1.0-im, noise)
GaussianChannel for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
transform: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
noise: 2×2 Matrix{Float64}:
1.0 -2.0
4.0 -3.0
```

## Tensor Products

If we were operating in the state (Fock) space, and wanted to describe multi-mode Gaussian states,
we would take the tensor product of multiple density operators. That method, however,
is quite computationally expensive and requires a finite truncation of the Fock basis. To create
such state vector simulations, we recommend using the [QuantumOptics.jl](https://github.com/qojulia/QuantumOptics.jl) library. For our purposes in the phase space, we can manually create multi-mode Gaussian systems with a tensor product, which can be called with either [`tensor`](@ref) or ``, the Kronecker product symbol
such state vector simulations, we recommend using the [QuantumOptics.jl](https://github.com/qojulia/QuantumOptics.jl) library. For our purposes in the phase space, we efficiently create multi-mode Gaussian systems via direct sum, which corresponds to a tensor product of infinite-dimensional Hilbert spaces. A tensor product of Gaussian states can be called with either [`tensor`](@ref) or ``, the Kronecker product symbol
which can be typed in the Julia REPL as `\otimes<TAB>`. Take the following example, where we produce a 3-mode Gaussian state that consists of a coherent state, vacuumstate, and squeezed state:

```jldoctest
Expand Down Expand Up @@ -109,64 +168,173 @@ covariance: 6×6 Matrix{Float64}:
0.0 0.0 0.0 0.0 1.0 0.0
0.0 0.0 0.184235 0.0 0.0 0.748048
```
These tensor product methods are also available for Gaussian unitaries and channels:

## Gaussian Operators
```jldoctest
julia> basis = QuadBlockBasis(1);
To transform Gaussian states into Gaussian states, we need Gaussian maps. There are various ways to construct Gaussian transformations, which we will discuss in this section.
julia> squeeze(basis, 2.0, pi/3) ⊗ phaseshift(basis, pi/6)
GaussianUnitary for 2 modes.
symplectic basis: QuadBlockBasis
displacement: 4-element Vector{Float64}:
0.0
0.0
0.0
0.0
symplectic: 4×4 Matrix{Float64}:
1.94877 0.0 -3.14095 0.0
0.0 0.866025 0.0 0.5
-3.14095 0.0 5.57563 0.0
0.0 -0.5 0.0 0.866025
```

### Gaussian Unitaries
For applying the same predefined operator to a multi-mode system, simply call
the operator on the corresponding multi-mode basis. For instance, if we wanted to
apply a phase shift of `π/4` to a three-mode Gaussian system, then we would
create the following operation:

Let's begin with the simplest Gaussian transformation, a unitary transformation, which can be created with the [`GaussianUnitary`](@ref) type:
```jldoctest
julia> basis = QuadPairBasis(3);
```@docs; canonical = false
GaussianUnitary
julia> phaseshift(basis, pi/4)
GaussianUnitary for 3 modes.
symplectic basis: QuadPairBasis
displacement: 6-element Vector{Float64}:
0.0
0.0
0.0
0.0
0.0
0.0
symplectic: 6×6 Matrix{Float64}:
0.707107 0.707107 0.0 0.0 0.0 0.0
-0.707107 0.707107 0.0 0.0 0.0 0.0
0.0 0.0 0.707107 0.707107 0.0 0.0
0.0 0.0 -0.707107 0.707107 0.0 0.0
0.0 0.0 0.0 0.0 0.707107 0.707107
0.0 0.0 0.0 0.0 -0.707107 0.707107
```

This is a rather clean way to characterize a large group of Gaussian transformations on
an `N`-mode Gaussian bosonic system. As long as we have a displacement vector of size `2N` and symplectic matrix of size `2N x 2N`, we can create a Gaussian transformation.
If, instead we wanted to apply phase shifts of `π/3`, `π/4`, and `π/5`
to the respective-modes of a three-mode Gaussian system, then we would dispatch
`phaseshift` on a vector of the phase shifts:

This library has a number of predefined Gaussian unitaries, which are listed below:
```jldoctest
julia> basis = QuadPairBasis(3);
- [`displace`](@ref)
- [`squeeze`](@ref)
- [`twosqueeze`](@ref)
- [`phaseshift`](@ref)
- [`beamsplitter`](@ref)

Detailed discussions and mathematical descriptions for each of these unitaries are given in the [Gaussian Zoos](@ref) page.
julia> phaseshift(basis, [pi/3, pi/4, pi/5])
GaussianUnitary for 3 modes.
symplectic basis: QuadPairBasis
displacement: 6-element Vector{Float64}:
0.0
0.0
0.0
0.0
0.0
0.0
symplectic: 6×6 Matrix{Float64}:
0.5 0.866025 0.0 0.0 0.0 0.0
-0.866025 0.5 0.0 0.0 0.0 0.0
0.0 0.0 0.707107 0.707107 0.0 0.0
0.0 0.0 -0.707107 0.707107 0.0 0.0
0.0 0.0 0.0 0.0 0.809017 0.587785
0.0 0.0 0.0 0.0 -0.587785 0.809017
```

### Gaussian Channels
Similar properties hold for Gaussian channels and states. Let's see some examples
for multi-mode coherent states:

Noisy bosonic channels are an important model for describing the interaction between a Gaussian state and its environment. Similar to Gaussian unitaries, Gaussian channels are linear bosonic channels that map Gaussian states to Gaussian states. Such objects can be created with the [`GaussianChannel`](@ref) type:
```jldoctest
julia> basis = QuadPairBasis(3);
```@docs; canonical = false
GaussianChannel
julia> coherentstate(basis, 1.0-im)
GaussianState for 3 modes.
symplectic basis: QuadPairBasis
mean: 6-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
1.4142135623730951
-1.4142135623730951
1.4142135623730951
-1.4142135623730951
covariance: 6×6 Matrix{Float64}:
1.0 0.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 0.0 1.0 0.0
0.0 0.0 0.0 0.0 0.0 1.0
julia> coherentstate(basis, [1.0-im, 2.0-2.0im, 3.0-3.0im])
GaussianState for 3 modes.
symplectic basis: QuadPairBasis
mean: 6-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
2.8284271247461903
-2.8284271247461903
4.242640687119286
-4.242640687119286
covariance: 6×6 Matrix{Float64}:
1.0 0.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0
0.0 0.0 0.0 0.0 1.0 0.0
0.0 0.0 0.0 0.0 0.0 1.0
```

Listed below are a list of predefined Gaussian channels supported by Gabs:
## Partial Traces

- [`attenuator`](@ref)
- [`amplifier`](@ref)

!!! note
When its noise matrix $\mathbf{N} = \mathbf{0}$ and transform operator $\mathbf{T}$ is a symplectic matrix, a Gaussian channel is a unitary operator. Any predefined Gaussian unitary
method can be called with an additional noise matrix to create a [`GaussianChannel`](@ref) object. For instance, a noisy displacement operator can be called with [`displace`](@ref) as follows:

```jldoctest
julia> basis = QuadPairBasis(1);
Partial traces of Gaussian states can be performed with [`ptrace`](@ref). For tracing
out a single-mode, call an integer corresponding to the mode of choice in a multi-mode Gaussian system. For tracing out several modes, call instead a vector of integers.
Let's see some examples:
```jldoctest
julia> basis = QuadPairBasis(2);
julia> noise = [1.0 -2.0; 4.0 -3.0];
julia> state = coherentstate(basis, [1.0-im, 2.0-2.0im]) ⊗ eprstate(basis, 2.0, pi/3)
GaussianState for 4 modes.
symplectic basis: QuadPairBasis
mean: 8-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
2.8284271247461903
-2.8284271247461903
0.0
0.0
0.0
0.0
covariance: 8×8 Matrix{Float64}:
1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 13.6541 0.0 -6.82248 -11.8169
0.0 0.0 0.0 0.0 0.0 13.6541 -11.8169 6.82248
0.0 0.0 0.0 0.0 -6.82248 -11.8169 13.6541 0.0
0.0 0.0 0.0 0.0 -11.8169 6.82248 0.0 13.6541
julia> ptrace(state, 1)
GaussianState for 1 mode.
symplectic basis: QuadPairBasis
mean: 2-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
covariance: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
julia> displace(basis, 1.0-im, noise)
GaussianChannel for 1 mode.
symplectic basis: QuadPairBasis
displacement: 2-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
transform: 2×2 Matrix{Float64}:
1.0 0.0
0.0 1.0
noise: 2×2 Matrix{Float64}:
1.0 -2.0
4.0 -3.0
```
julia> ptrace(state, [1, 4])
GaussianState for 2 modes.
symplectic basis: QuadPairBasis
mean: 4-element Vector{Float64}:
1.4142135623730951
-1.4142135623730951
0.0
0.0
covariance: 4×4 Matrix{Float64}:
1.0 0.0 0.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 13.6541 0.0
0.0 0.0 0.0 13.6541
```

0 comments on commit ea87da6

Please sign in to comment.