From dc4432e0d92114a6e68e46a2b20c4d5514df06bf Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 24 Nov 2023 16:49:04 +0000 Subject: [PATCH] build based on 64a2265 --- dev/.documenter-siteinfo.json | 2 +- dev/api/index.html | 60 ++++++++++++++--------------- dev/benchmark_comparison/index.html | 32 +++++++-------- dev/benchmark_single/index.html | 18 ++++----- dev/index.html | 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 696ee11d..29400445 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-11-24T15:12:23","documenter_version":"1.1.2"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2023-11-24T16:49:02","documenter_version":"1.1.2"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 5f7b009f..8c17c6db 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,5 +1,5 @@ -API · QuPhys.jl

API

Quantum object functions

QuPhys.QuantumObjectType
mutable struct QuantumObject{MT<:AbstractArray,ObjType<:QuantumObjectType}
+API · QuPhys.jl

API

Quantum object functions

QuPhys.QuantumObjectType
mutable struct QuantumObject{MT<:AbstractArray,ObjType<:QuantumObjectType}
     data::MT
     type::Type{ObjType}
     dims::Vector{Int}
@@ -13,7 +13,7 @@
 ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢
 
 julia> a isa QuantumObject
-true
source
QuPhys.ket2dmFunction
ket2dm(ψ::QuantumObject)

Transform the ket state $\ket{\psi}$ into a pure density matrix $\hat{\rho} = \dyad{\psi}$.

source
LinearAlgebra.trFunction
tr(A::QuantumObject})

Returns the trace of A.

Examples

julia> a = destroy(20)
+true
source
QuPhys.ket2dmFunction
ket2dm(ψ::QuantumObject)

Transform the ket state $\ket{\psi}$ into a pure density matrix $\hat{\rho} = \dyad{\psi}$.

source
LinearAlgebra.trFunction
tr(A::QuantumObject})

Returns the trace of A.

Examples

julia> a = destroy(20)
 Quantum Object:   type=Operator   dims=[20]   size=(20, 20)   ishermitian=false
 20×20 SparseMatrixCSC{ComplexF64, Int64} with 19 stored entries:
 ⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀
@@ -23,7 +23,7 @@
 ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢
 
 julia> tr(a' * a)
-190.0 + 0.0im
source
LinearAlgebra.normFunction
norm(A::QuantumObject)

Returns the norm of A.

Examples

julia> ψ = fock(10, 2)
+190.0 + 0.0im
source
LinearAlgebra.normFunction
norm(A::QuantumObject)

Returns the norm of A.

Examples

julia> ψ = fock(10, 2)
 Quantum Object:   type=Ket   dims=[10]   size=(10,)
 10-element Vector{ComplexF64}:
  0.0 + 0.0im
@@ -38,7 +38,7 @@
  0.0 + 0.0im
 
 julia> norm(ψ)
-1.0
source
Base.kronFunction
kron(A::QuantumObject, B::QuantumObject)

Returns the Kronecker product $\hat{A} \otimes \hat{B}$.

Examples

julia> a = destroy(20)
 Quantum Object:   type=Operator   dims=[20]   size=(20, 20)   ishermitian=false
 20×20 SparseMatrixCSC{ComplexF64, Int64} with 19 stored entries:
 ⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀
@@ -70,7 +70,7 @@
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀
 ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀
-⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠦
source

General functions

QuPhys.tidyupFunction
tidyup(A::QuantumObject, tol::Real=1e-14)

Removes those elements of a QuantumObject A whose absolute value is less than tol.

source
QuPhys.tidyup!Function
tidyup!(A::QuantumObject, tol::Real=1e-14)

Removes those elements of a QuantumObject A whose absolute value is less than tol. In-place version of tidyup.

source
QuPhys.gaussianFunction
gaussian(x::Number, μ::Number, σ::Number)

Returns the gaussian function $\exp \left[- \frac{(x - \mu)^2}{2 \sigma^2} \right]$, where $\mu$ and $\sigma^2$ are the mean and the variance respectively.

source
QuPhys.ptraceFunction
ptrace(QO::QuantumObject, sel::Vector{Int})

Partial trace of a quantum state QO leaving only the dimensions with the indices present in the sel vector.

Examples

Two qubits in the state $\ket{\psi} = \ket{e,g}$:

julia> ψ = kron(fock(2,0), fock(2,1))
+⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠦
source

General functions

QuPhys.tidyupFunction
tidyup(A::QuantumObject, tol::Real=1e-14)

Removes those elements of a QuantumObject A whose absolute value is less than tol.

source
QuPhys.tidyup!Function
tidyup!(A::QuantumObject, tol::Real=1e-14)

Removes those elements of a QuantumObject A whose absolute value is less than tol. In-place version of tidyup.

source
QuPhys.gaussianFunction
gaussian(x::Number, μ::Number, σ::Number)

Returns the gaussian function $\exp \left[- \frac{(x - \mu)^2}{2 \sigma^2} \right]$, where $\mu$ and $\sigma^2$ are the mean and the variance respectively.

source
QuPhys.ptraceFunction
ptrace(QO::QuantumObject, sel::Vector{Int})

Partial trace of a quantum state QO leaving only the dimensions with the indices present in the sel vector.

Examples

Two qubits in the state $\ket{\psi} = \ket{e,g}$:

julia> ψ = kron(fock(2,0), fock(2,1))
 Quantum Object:   type=Ket   dims=[2, 2]   size=(4,)
 4-element Vector{ComplexF64}:
  0.0 + 0.0im
@@ -94,7 +94,7 @@
 Quantum Object:   type=Operator   dims=[2]   size=(2, 2)   ishermitian=true
 2×2 Matrix{ComplexF64}:
  0.5+0.0im  0.0+0.0im
- 0.0+0.0im  0.5+0.0im
source
QuPhys.entropy_vnFunction
entropy_vn(ρ::QuantumObject; base::Int=0, tol::Real=1e-15)

Calculates the Von Neumann entropy $S = - \Tr \left[ \hat{\rho} \log \left( \hat{\rho} \right) \right]$ where $\hat{\rho}$ is the density matrix of the system.

The base parameter specifies the base of the logarithm to use, and when using the default value 0, the natural logarithm is used. The tol parameter describes the absolute tolerance for detecting the zero-valued eigenvalues of the density matrix $\hat{\rho}$.

Examples

Pure state:

julia> ψ = fock(2,0)
+ 0.0+0.0im  0.5+0.0im
source
QuPhys.entropy_vnFunction
entropy_vn(ρ::QuantumObject; base::Int=0, tol::Real=1e-15)

Calculates the Von Neumann entropy $S = - \Tr \left[ \hat{\rho} \log \left( \hat{\rho} \right) \right]$ where $\hat{\rho}$ is the density matrix of the system.

The base parameter specifies the base of the logarithm to use, and when using the default value 0, the natural logarithm is used. The tol parameter describes the absolute tolerance for detecting the zero-valued eigenvalues of the density matrix $\hat{\rho}$.

Examples

Pure state:

julia> ψ = fock(2,0)
 Quantum Object:   type=Ket   dims=[2]   size=(2,)
 2-element Vector{ComplexF64}:
  1.0 + 0.0im
@@ -114,13 +114,13 @@
  0.0+0.0im  0.5+0.0im
 
 julia> entropy_vn(ρ, base=2)
-1.0
source
QuPhys.entanglementFunction
entanglement(QO::QuantumObject, sel::Vector)

Calculates the entanglement by doing the partial trace of QO, selecting only the dimensions with the indices contained in the sel vector, and then using the Von Neumann entropy entropy_vn.

source
QuPhys.expectFunction
expect(O::QuantumObject, ψ::QuantumObject)

Expectation value of the operator O with the state ψ. The latter can be a KetQuantumObject, BraQuantumObject or a OperatorQuantumObject. If ψ is a density matrix, the function calculates $\Tr \left[ \hat{O} \hat{\psi} \right]$, while if ψ is a state, the function calculates $\mel{\psi}{\hat{O}}{\psi}$.

The function returns a real number if the operator is hermitian, and returns a complex number otherwise.

Examples

julia> ψ = 1 / √2 * (fock(10,2) + fock(10,4));
+1.0
source
QuPhys.entanglementFunction
entanglement(QO::QuantumObject, sel::Vector)

Calculates the entanglement by doing the partial trace of QO, selecting only the dimensions with the indices contained in the sel vector, and then using the Von Neumann entropy entropy_vn.

source
QuPhys.expectFunction
expect(O::QuantumObject, ψ::QuantumObject)

Expectation value of the operator O with the state ψ. The latter can be a KetQuantumObject, BraQuantumObject or a OperatorQuantumObject. If ψ is a density matrix, the function calculates $\Tr \left[ \hat{O} \hat{\psi} \right]$, while if ψ is a state, the function calculates $\mel{\psi}{\hat{O}}{\psi}$.

The function returns a real number if the operator is hermitian, and returns a complex number otherwise.

Examples

julia> ψ = 1 / √2 * (fock(10,2) + fock(10,4));
 
 julia> a = destroy(10);
 
 julia> expect(a' * a, ψ) ≈ 3
-true
source
QuPhys.wignerFunction
wigner(state::QuantumObject, xvec::AbstractVector, yvec::AbstractVector; g::Real=√2,
-    solver::WignerSolver=WignerLaguerre())

Generates the Wigner quasipropability distribution of state at points xvec + 1im * yvec. The g parameter is a scaling factor related to the value of $\hbar$ in the commutation relation $[x, y] = i \hbar$ via $\hbar=2/g^2$ giving the default value $\hbar=1$.

The solver parameter can be either WignerLaguerre() or WignerClenshaw(). The former uses the Laguerre polynomial expansion of the Wigner function, while the latter uses the Clenshaw algorithm. The Laguerre expansion is faster for sparse matrices, while the Clenshaw algorithm is faster for dense matrices. The WignerLaguerre solver has an optional parallel parameter which defaults to true and uses multithreading to speed up the calculation.

source
QuPhys.get_coherenceFunction
get_coherence(ψ::QuantumObject)

Get the coherence value $\alpha$ by measuring the expectation value of the destruction operator $\hat{a}$ on the state $\ket{\psi}$.

It returns both $\alpha$ and the state $\ket{\delta_\psi} = \exp ( \bar{\alpha} \hat{a} - \alpha \hat{a}^\dagger )$. The latter corresponds to the quantum fulctuations around the coherent state $\ket{\alpha}$.

source
QuPhys.n_thFunction
n_th(ω::Number, T::Real)

Gives the mean number of excitations in a mode with frequency ω at temperature T: $n_{\rm th} (\omega, T) = \frac{1}{e^{\omega/T} - 1}$

source

Quantum states, operators and super-operators

QuPhys.spreFunction
spre(O::QuantumObject, Id_cache=I(size(O,1)))

Returns the super-operator form of O acting on the left of the density matrix operator, $\mathcal{O} \left(\hat{O}\right) \left[ \hat{\rho} \right] = \hat{O} \hat{\rho}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{O}\right) \boldsymbol{\cdot} = \hat{\mathbb{1}} \otimes \hat{O}$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.spostFunction
spost(O::QuantumObject)

Returns the super-operator form of O acting on the right of the density matrix operator, $\mathcal{O} \left(\hat{O}\right) \left[ \hat{\rho} \right] = \hat{\rho} \hat{O}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{O}\right) \boldsymbol{\cdot} = \hat{O}^T \otimes \hat{\mathbb{1}}$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.sprepostFunction
sprepost(A::QuantumObject, B::QuantumObject)

Returns the super-operator form of A and B acting on the left and the right of the density matrix operator respectively, $\mathcal{O} \left( \hat{A}, \hat{B} \right) \left[ \hat{\rho} \right] = \hat{A} \hat{\rho} \hat{B}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{A}, \hat{B}\right) \boldsymbol{\cdot} = \text{spre}(A) * \text{spost}(B)$.

source
QuPhys.lindblad_dissipatorFunction
lindblad_dissipator(O::QuantumObject, Id_cache=I(size(O,1))

Returns the Lindblad super-operator defined as $\mathcal{D} \left( \hat{O} \right) \left[ \hat{\rho} \right] = \frac{1}{2} \left( 2 \hat{O} \hat{\rho} \hat{O}^\dagger - \hat{O}^\dagger \hat{O} \hat{\rho} - \hat{\rho} \hat{O}^\dagger \hat{O} \right)$ considering the density matrix $\hat{\rho}$ in the vectorized form.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.destroyFunction
destroy(N::Int)

Bosonic annihilation operator with Hilbert space cutoff N. This operator acts on a fock state as $\hat{a} \ket{n} = \sqrt{n} \ket{n-1}$.

Examples

julia> a = destroy(20)
+true
source
QuPhys.wignerFunction
wigner(state::QuantumObject, xvec::AbstractVector, yvec::AbstractVector; g::Real=√2,
+    solver::WignerSolver=WignerLaguerre())

Generates the Wigner quasipropability distribution of state at points xvec + 1im * yvec. The g parameter is a scaling factor related to the value of $\hbar$ in the commutation relation $[x, y] = i \hbar$ via $\hbar=2/g^2$ giving the default value $\hbar=1$.

The solver parameter can be either WignerLaguerre() or WignerClenshaw(). The former uses the Laguerre polynomial expansion of the Wigner function, while the latter uses the Clenshaw algorithm. The Laguerre expansion is faster for sparse matrices, while the Clenshaw algorithm is faster for dense matrices. The WignerLaguerre solver has an optional parallel parameter which defaults to true and uses multithreading to speed up the calculation.

source
QuPhys.get_coherenceFunction
get_coherence(ψ::QuantumObject)

Get the coherence value $\alpha$ by measuring the expectation value of the destruction operator $\hat{a}$ on the state $\ket{\psi}$.

It returns both $\alpha$ and the state $\ket{\delta_\psi} = \exp ( \bar{\alpha} \hat{a} - \alpha \hat{a}^\dagger )$. The latter corresponds to the quantum fulctuations around the coherent state $\ket{\alpha}$.

source
QuPhys.n_thFunction
n_th(ω::Number, T::Real)

Gives the mean number of excitations in a mode with frequency ω at temperature T: $n_{\rm th} (\omega, T) = \frac{1}{e^{\omega/T} - 1}$

source

Quantum states, operators and super-operators

QuPhys.spreFunction
spre(O::QuantumObject, Id_cache=I(size(O,1)))

Returns the super-operator form of O acting on the left of the density matrix operator, $\mathcal{O} \left(\hat{O}\right) \left[ \hat{\rho} \right] = \hat{O} \hat{\rho}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{O}\right) \boldsymbol{\cdot} = \hat{\mathbb{1}} \otimes \hat{O}$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.spostFunction
spost(O::QuantumObject)

Returns the super-operator form of O acting on the right of the density matrix operator, $\mathcal{O} \left(\hat{O}\right) \left[ \hat{\rho} \right] = \hat{\rho} \hat{O}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{O}\right) \boldsymbol{\cdot} = \hat{O}^T \otimes \hat{\mathbb{1}}$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.sprepostFunction
sprepost(A::QuantumObject, B::QuantumObject)

Returns the super-operator form of A and B acting on the left and the right of the density matrix operator respectively, $\mathcal{O} \left( \hat{A}, \hat{B} \right) \left[ \hat{\rho} \right] = \hat{A} \hat{\rho} \hat{B}$.

Since the density matrix is vectorized, this super-operator is always a matrix, obtained from $\mathcal{O} \left(\hat{A}, \hat{B}\right) \boldsymbol{\cdot} = \text{spre}(A) * \text{spost}(B)$.

source
QuPhys.lindblad_dissipatorFunction
lindblad_dissipator(O::QuantumObject, Id_cache=I(size(O,1))

Returns the Lindblad super-operator defined as $\mathcal{D} \left( \hat{O} \right) \left[ \hat{\rho} \right] = \frac{1}{2} \left( 2 \hat{O} \hat{\rho} \hat{O}^\dagger - \hat{O}^\dagger \hat{O} \hat{\rho} - \hat{\rho} \hat{O}^\dagger \hat{O} \right)$ considering the density matrix $\hat{\rho}$ in the vectorized form.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.destroyFunction
destroy(N::Int)

Bosonic annihilation operator with Hilbert space cutoff N. This operator acts on a fock state as $\hat{a} \ket{n} = \sqrt{n} \ket{n-1}$.

Examples

julia> a = destroy(20)
 Quantum Object:   type=Operator   dims=[20]   size=(20, 20)   ishermitian=false
 20×20 SparseMatrixCSC{ComplexF64, Int64} with 19 stored entries:
 ⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀
@@ -130,7 +130,7 @@
 ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢
 
 julia> fock(20, 3)' * a * fock(20, 4)
-2.0 + 0.0im
source
QuPhys.createFunction
create(N::Int)

Bosonic creation operator with Hilbert space cutoff N. This operator acts on a fock state as $\hat{a}^\dagger \ket{n} = \sqrt{n+1} \ket{n+1}$.

Examples

julia> a_d = create(20)
+2.0 + 0.0im
source
QuPhys.createFunction
create(N::Int)

Bosonic creation operator with Hilbert space cutoff N. This operator acts on a fock state as $\hat{a}^\dagger \ket{n} = \sqrt{n+1} \ket{n+1}$.

Examples

julia> a_d = create(20)
 Quantum Object:   type=Operator   dims=[20]   size=(20, 20)   ishermitian=false
 20×20 SparseMatrixCSC{ComplexF64, Int64} with 19 stored entries:
 ⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀
@@ -140,21 +140,21 @@
 ⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀
 
 julia> fock(20, 4)' * a_d * fock(20, 3)
-2.0 + 0.0im
source
QuPhys.sigmapFunction
sigmap()

Pauli ladder operator $\hat{\sigma}_+ = \hat{\sigma}_x + i \hat{\sigma}_y$.

source
QuPhys.sigmamFunction
sigmam()

Pauli ladder operator $\hat{\sigma}_- = \hat{\sigma}_x - i \hat{\sigma}_y$.

source
QuPhys.sigmaxFunction
sigmax()

Pauli operator $\hat{\sigma}_x = \hat{\sigma}_- + \hat{\sigma}_+$.

source
QuPhys.sigmayFunction
sigmay()

Pauli operator $\hat{\sigma}_y = i \left( \hat{\sigma}_- - \hat{\sigma}_+ \right)$.

source
QuPhys.sigmazFunction
sigmaz()

Pauli operator $\hat{\sigma}_z = \comm{\hat{\sigma}_+}{\hat{\sigma}_-}$.

source
QuPhys.eyeFunction
eye(N::Int; type=OperatorQuantumObject, dims=[N])

Identity operator $\hat{\mathbb{1}}$ with Hilbert dimension N.

source
QuPhys.fockFunction
fock(N::Int, pos::Int; dims::Vector{Int}=[N], sparse::Bool=false)

Generates a fock state $\ket{\psi}$ of dimension N. It is also possible to specify the list of dimensions dims if different subsystems are present.

source
QuPhys.basisFunction
basis(N::Int, pos::Int; dims::Vector{Int}=[N])

Generates a fock state like fock.

source
QuPhys.coherentFunction
coherent(N::Real, α::T)

Generates a coherent state $\ket{\alpha}$, which is defined as an eigenvector of the bosonic annihilation operator $\hat{a} \ket{\alpha} = \alpha \ket{\alpha}$.

source
QuPhys.rand_dmFunction
rand_dm(N::Integer; kwargs...)

Generates a random density matrix $\hat{\rho}$, with the property to be positive definite, and that $\Tr \left[ \hat{\rho} \right] = 1$.

source
QuPhys.projectionFunction
projection(N::Int, i::Int, j::Int)

Generates the projection operator $\hat{O} = \dyad{i}{j}$ with Hilbert space dimension N.

source
QuPhys.sinmFunction
sinm(O::QuantumObject)

Generates the sine of the operator O, defined as

$\sin \left( \hat{O} \right) = \frac{e^{i \hat{O}} - e^{-i \hat{O}}}{2 i}$

source
QuPhys.cosmFunction
cosm(O::QuantumObject)

Generates the cosine of the operator O, defined as

$\cos \left( \hat{O} \right) = \frac{e^{i \hat{O}} + e^{-i \hat{O}}}{2}$

source

Time evolution

QuPhys.sigmapFunction
sigmap()

Pauli ladder operator $\hat{\sigma}_+ = \hat{\sigma}_x + i \hat{\sigma}_y$.

source
QuPhys.sigmamFunction
sigmam()

Pauli ladder operator $\hat{\sigma}_- = \hat{\sigma}_x - i \hat{\sigma}_y$.

source
QuPhys.sigmaxFunction
sigmax()

Pauli operator $\hat{\sigma}_x = \hat{\sigma}_- + \hat{\sigma}_+$.

source
QuPhys.sigmayFunction
sigmay()

Pauli operator $\hat{\sigma}_y = i \left( \hat{\sigma}_- - \hat{\sigma}_+ \right)$.

source
QuPhys.sigmazFunction
sigmaz()

Pauli operator $\hat{\sigma}_z = \comm{\hat{\sigma}_+}{\hat{\sigma}_-}$.

source
QuPhys.eyeFunction
eye(N::Int; type=OperatorQuantumObject, dims=[N])

Identity operator $\hat{\mathbb{1}}$ with Hilbert dimension N.

source
QuPhys.fockFunction
fock(N::Int, pos::Int; dims::Vector{Int}=[N], sparse::Bool=false)

Generates a fock state $\ket{\psi}$ of dimension N. It is also possible to specify the list of dimensions dims if different subsystems are present.

source
QuPhys.basisFunction
basis(N::Int, pos::Int; dims::Vector{Int}=[N])

Generates a fock state like fock.

source
QuPhys.coherentFunction
coherent(N::Real, α::T)

Generates a coherent state $\ket{\alpha}$, which is defined as an eigenvector of the bosonic annihilation operator $\hat{a} \ket{\alpha} = \alpha \ket{\alpha}$.

source
QuPhys.rand_dmFunction
rand_dm(N::Integer; kwargs...)

Generates a random density matrix $\hat{\rho}$, with the property to be positive definite, and that $\Tr \left[ \hat{\rho} \right] = 1$.

source
QuPhys.projectionFunction
projection(N::Int, i::Int, j::Int)

Generates the projection operator $\hat{O} = \dyad{i}{j}$ with Hilbert space dimension N.

source
QuPhys.sinmFunction
sinm(O::QuantumObject)

Generates the sine of the operator O, defined as

$\sin \left( \hat{O} \right) = \frac{e^{i \hat{O}} - e^{-i \hat{O}}}{2 i}$

source
QuPhys.cosmFunction
cosm(O::QuantumObject)

Generates the cosine of the operator O, defined as

$\cos \left( \hat{O} \right) = \frac{e^{i \hat{O}} + e^{-i \hat{O}}}{2}$

source

Time evolution

QuPhys.sesolveProblemFunction
sesolveProblem(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector;
     alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5()
     e_ops::AbstractVector=[],
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
-    kwargs...)

Generates the ODEProblem for the Schrödinger time evolution of a quantum system.

Arguments

  • H::QuantumObject: The Hamiltonian of the system.
  • ψ0::QuantumObject: The initial state of the system.
  • t_l::AbstractVector: The time list of the evolution.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: The algorithm used for the time evolution.
  • e_ops::AbstractVector: The list of operators to be evaluated during the evolution.
  • H_t::Union{Nothing,Function}: The time-dependent Hamiltonian of the system. If nothing, the Hamiltonian is time-independent.
  • params::NamedTuple: The parameters of the system.
  • kwargs...: The keyword arguments passed to the ODEProblem constructor.

Returns

  • prob: The ODEProblem for the Schrödinger time evolution of the system.
source
QuPhys.mesolveProblemFunction
mesolveProblem(H::QuantumObject,
+    kwargs...)

Generates the ODEProblem for the Schrödinger time evolution of a quantum system.

Arguments

  • H::QuantumObject: The Hamiltonian of the system.
  • ψ0::QuantumObject: The initial state of the system.
  • t_l::AbstractVector: The time list of the evolution.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: The algorithm used for the time evolution.
  • e_ops::AbstractVector: The list of operators to be evaluated during the evolution.
  • H_t::Union{Nothing,Function}: The time-dependent Hamiltonian of the system. If nothing, the Hamiltonian is time-independent.
  • params::NamedTuple: The parameters of the system.
  • kwargs...: The keyword arguments passed to the ODEProblem constructor.

Returns

  • prob: The ODEProblem for the Schrödinger time evolution of the system.
source
QuPhys.mesolveProblemFunction
mesolveProblem(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector, c_ops::AbstractVector=[];
     alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5(),
     e_ops::AbstractVector=[],
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
-    kwargs...)

Generates the ODEProblem for the master equation time evolution of an open quantum system.

Arguments

  • H::QuantumObject: The Hamiltonian or the Liouvillian of the system.
  • ψ0::QuantumObject: The initial state of the system.
  • t_l::AbstractVector: The time list of the evolution.
  • c_ops::AbstractVector=[]: The list of the collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5(): The algorithm used for the time evolution.
  • e_ops::AbstractVector=[]: The list of the operators for which the expectation values are calculated.
  • H_t::Union{Nothing,Function}=nothing: The time-dependent Hamiltonian or Liouvillian.
  • params::NamedTuple=NamedTuple(): The parameters of the time evolution.
  • kwargs...: The keyword arguments for the ODEProblem.

Returns

  • prob::ODEProblem: The ODEProblem for the master equation time evolution.
source
QuPhys.mcsolveProblemFunction
mcsolveProblem(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
+    kwargs...)

Generates the ODEProblem for the master equation time evolution of an open quantum system.

Arguments

  • H::QuantumObject: The Hamiltonian or the Liouvillian of the system.
  • ψ0::QuantumObject: The initial state of the system.
  • t_l::AbstractVector: The time list of the evolution.
  • c_ops::AbstractVector=[]: The list of the collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5(): The algorithm used for the time evolution.
  • e_ops::AbstractVector=[]: The list of the operators for which the expectation values are calculated.
  • H_t::Union{Nothing,Function}=nothing: The time-dependent Hamiltonian or Liouvillian.
  • params::NamedTuple=NamedTuple(): The parameters of the time evolution.
  • kwargs...: The keyword arguments for the ODEProblem.

Returns

  • prob::ODEProblem: The ODEProblem for the master equation time evolution.
source
QuPhys.mcsolveProblemFunction
mcsolveProblem(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
     ψ0::QuantumObject{<:AbstractArray{T2},KetQuantumObject},
     t_l::AbstractVector,
     c_ops::Vector{QuantumObject{Tc, OperatorQuantumObject}}=QuantumObject{Matrix, OperatorQuantumObject}[];
@@ -163,7 +163,7 @@
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
     jump_callback::TJC=DiscreteLindbladJumpCallback(),
-    kwargs...)

Generates the ODEProblem for a single trajectory of the Monte Carlo wave function time evolution of an open quantum system.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • prob::ODEProblem: The ODEProblem for the Monte Carlo wave function time evolution.
source
QuPhys.mcsolveEnsembleProblemFunction
mcsolveEnsembleProblem(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
+    kwargs...)

Generates the ODEProblem for a single trajectory of the Monte Carlo wave function time evolution of an open quantum system.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • prob::ODEProblem: The ODEProblem for the Monte Carlo wave function time evolution.
source
QuPhys.mcsolveEnsembleProblemFunction
mcsolveEnsembleProblem(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
     ψ0::QuantumObject{<:AbstractArray{T2},KetQuantumObject},
     t_l::AbstractVector,
     c_ops::Vector{QuantumObject{Tc, OperatorQuantumObject}}=QuantumObject{Matrix, OperatorQuantumObject}[];
@@ -174,21 +174,21 @@
     jump_callback::TJC=DiscreteLindbladJumpCallback(),
     prob_func::Function=_mcsolve_prob_func,
     output_func::Function=_mcsolve_output_func,
-    kwargs...)

Generates the ODEProblem for an ensemble of trajectories of the Monte Carlo wave function time evolution of an open quantum system.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • prob_func::Function: Function to use for generating the ODEProblem.
  • output_func::Function: Function to use for generating the output of a single trajectory.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • prob::EnsembleProblem with ODEProblem: The Ensemble ODEProblem for the Monte Carlo

wave function time evolution.

source
QuPhys.sesolveFunction
sesolve(H::QuantumObject,
+    kwargs...)

Generates the ODEProblem for an ensemble of trajectories of the Monte Carlo wave function time evolution of an open quantum system.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • prob_func::Function: Function to use for generating the ODEProblem.
  • output_func::Function: Function to use for generating the output of a single trajectory.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • prob::EnsembleProblem with ODEProblem: The Ensemble ODEProblem for the Monte Carlo

wave function time evolution.

source
QuPhys.sesolveFunction
sesolve(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector;
     alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5(),
     e_ops::AbstractVector=[],
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
-    kwargs...)

Time evolution of a closed quantum system using the Schrödinger equation.

Arguments

  • H::QuantumObject: Hamiltonian of the system.

  • ψ0::QuantumObject: Initial state of the system.

  • t_l::AbstractVector: List of times at which to save the state of the system.

  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.

  • e_ops::AbstractVector: List of operators for which to calculate expectation values.

  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.

  • params::NamedTuple: Dictionary of parameters to pass to the solver.

  • kwargs...: Additional keyword arguments to pass to the solver.

  • Returns

  • sol::TimeEvolutionSol: The solution of the time evolution.

source
QuPhys.mesolveFunction
mesolve(H::QuantumObject,
+    kwargs...)

Time evolution of a closed quantum system using the Schrödinger equation.

Arguments

  • H::QuantumObject: Hamiltonian of the system.

  • ψ0::QuantumObject: Initial state of the system.

  • t_l::AbstractVector: List of times at which to save the state of the system.

  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.

  • e_ops::AbstractVector: List of operators for which to calculate expectation values.

  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.

  • params::NamedTuple: Dictionary of parameters to pass to the solver.

  • kwargs...: Additional keyword arguments to pass to the solver.

  • Returns

  • sol::TimeEvolutionSol: The solution of the time evolution.

source
QuPhys.mesolveFunction
mesolve(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector, c_ops::AbstractVector=[];
     alg::OrdinaryDiffEqAlgorithm=Tsit5(),
     e_ops::AbstractVector=[],
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
-    kwargs...)

Time evolution of an open quantum system using master equation.

Arguments

  • H::QuantumObject: Hamiltonian of Liouvillian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::AbstractVector: List of collapse operators.
  • alg::OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::AbstractVector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Named Tuple of parameters to pass to the solver.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • sol::TimeEvolutionSol: The solution of the time evolution.
source
QuPhys.mcsolveFunction
mcsolve(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
+    kwargs...)

Time evolution of an open quantum system using master equation.

Arguments

  • H::QuantumObject: Hamiltonian of Liouvillian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::AbstractVector: List of collapse operators.
  • alg::OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::AbstractVector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Named Tuple of parameters to pass to the solver.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • sol::TimeEvolutionSol: The solution of the time evolution.
source
QuPhys.mcsolveFunction
mcsolve(H::QuantumObject{<:AbstractArray{T1},OperatorQuantumObject},
     ψ0::QuantumObject{<:AbstractArray{T2},KetQuantumObject},
     t_l::AbstractVector,
     c_ops::Vector{QuantumObject{Tc, OperatorQuantumObject}}=QuantumObject{Matrix, OperatorQuantumObject}[];
@@ -199,7 +199,7 @@
     n_traj::Int=1,
     ensemble_method=EnsembleThreads(),
     jump_callback::TJC=DiscreteLindbladJumpCallback(),
-    kwargs...)

Time evolution of an open quantum system using quantum trajectories.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • n_traj::Int: Number of trajectories to use.
  • ensemble_method: Ensemble method to use.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • sol::TimeEvolutionMCSol: The solution of the time evolution.

Notes

ensemble_method can be one of EnsembleThreads(), EnsembleSerial(), EnsembleDistributed().

source
QuPhys.dfd_mesolveFunction
function dfd_mesolve(H::Function, ψ0::QuantumObject,
+    kwargs...)

Time evolution of an open quantum system using quantum trajectories.

Arguments

  • H::QuantumObject: Hamiltonian of the system.
  • ψ0::QuantumObject: Initial state of the system.
  • t_l::AbstractVector: List of times at which to save the state of the system.
  • c_ops::Vector: List of collapse operators.
  • alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm: Algorithm to use for the time evolution.
  • e_ops::Vector: List of operators for which to calculate expectation values.
  • H_t::Union{Nothing,Function}: Time-dependent part of the Hamiltonian.
  • params::NamedTuple: Dictionary of parameters to pass to the solver.
  • n_traj::Int: Number of trajectories to use.
  • ensemble_method: Ensemble method to use.
  • jump_callback::LindbladJumpCallbackType: The Jump Callback type: Discrete or Continuous.
  • kwargs...: Additional keyword arguments to pass to the solver.

Returns

  • sol::TimeEvolutionMCSol: The solution of the time evolution.

Notes

ensemble_method can be one of EnsembleThreads(), EnsembleSerial(), EnsembleDistributed().

source
QuPhys.dfd_mesolveFunction
function dfd_mesolve(H::Function, ψ0::QuantumObject,
     t_l::AbstractVector, c_ops::Function, maxdims::AbstractVector,
     dfd_params::NamedTuple=NamedTuple();
     alg::OrdinaryDiffEq.OrdinaryDiffEqAlgorithm=Tsit5(),
@@ -207,7 +207,7 @@
     H_t::Union{Nothing,Function}=nothing,
     params::NamedTuple=NamedTuple(),
     tol_list::Vector{<:Number}=fill(1e-8, length(maxdims)),
-    kwargs...)

Time evolution of an open quantum system using master equation, dynamically changing the dimension of the Hilbert subspaces.

source
QuPhys.dsf_mesolveFunction
function dsf_mesolve(H::Function,
+    kwargs...)

Time evolution of an open quantum system using master equation, dynamically changing the dimension of the Hilbert subspaces.

source
QuPhys.dsf_mesolveFunction
function dsf_mesolve(H::Function,
     ψ0::QuantumObject,
     t_l::AbstractVector, c_ops::Function,
     op_list::Vector{TOl},
@@ -219,7 +219,7 @@
     params::NamedTuple=NamedTuple(),
     δα_list::Vector{<:Number}=fill(0.2, length(op_list)),
     krylov_dim::Int=min(5,cld(length(ket2dm(ψ0).data), 3)),
-    kwargs...)

Time evolution of an open quantum system using master equation and the Dynamical Shifted Fock algorithm.

source
QuPhys.dsf_mcsolveFunction
function dsf_mcsolve(H::Function,
+    kwargs...)

Time evolution of an open quantum system using master equation and the Dynamical Shifted Fock algorithm.

source
QuPhys.dsf_mcsolveFunction
function dsf_mcsolve(H::Function,
     ψ0::QuantumObject,
     t_l::AbstractVector, c_ops::Function,
     op_list::Vector{TOl},
@@ -234,12 +234,12 @@
     ensemble_method=EnsembleThreads(),
     jump_callback::LindbladJumpCallbackType=DiscreteLindbladJumpCallback(),
     krylov_dim::Int=min(5,cld(length(ψ0.data), 3)),
-    kwargs...)

Time evolution of a quantum system using the Monte Carlo wave function method and the Dynamical Shifted Fock algorithm.

source
QuPhys.liouvillianFunction
liouvillian(H::QuantumObject, c_ops::AbstractVector, Id_cache=I(prod(H.dims))

Construct the Liouvillian superoperator for a system Hamiltonian and a set of collapse operators: $\mathcal{L} \cdot = -i[\hat{H}, \cdot] + \sum_i \mathcal{D}[\hat{O}_i] \cdot$, where $\mathcal{D}[\hat{O}_i] \cdot = \hat{O}_i \cdot \hat{O}_i^\dagger - \frac{1}{2} \hat{O}_i^\dagger \hat{O}_i \cdot - \frac{1}{2} \cdot \hat{O}_i^\dagger \hat{O}_i$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.liouvillian_generalizedFunction
liouvillian_generalized(H::QuantumObject, fields::Vector, 
-T_list::Vector; N_trunc::Int=size(H,1), tol::Float64=0.0, σ_filter::Union{Nothing, Real}=nothing)

Constructs the generalized Liouvillian for a system coupled to a bath of harmonic oscillators.

See, e.g., Settineri, Alessio, et al. "Dissipation and thermal noise in hybrid quantum systems in the ultrastrong-coupling regime." Physical Review A 98.5 (2018): 053834.

source
QuPhys.steadystate_floquetFunction
steadystate_floquet(H_0::QuantumObject,
+    kwargs...)

Time evolution of a quantum system using the Monte Carlo wave function method and the Dynamical Shifted Fock algorithm.

source
QuPhys.liouvillianFunction
liouvillian(H::QuantumObject, c_ops::AbstractVector, Id_cache=I(prod(H.dims))

Construct the Liouvillian superoperator for a system Hamiltonian and a set of collapse operators: $\mathcal{L} \cdot = -i[\hat{H}, \cdot] + \sum_i \mathcal{D}[\hat{O}_i] \cdot$, where $\mathcal{D}[\hat{O}_i] \cdot = \hat{O}_i \cdot \hat{O}_i^\dagger - \frac{1}{2} \hat{O}_i^\dagger \hat{O}_i \cdot - \frac{1}{2} \cdot \hat{O}_i^\dagger \hat{O}_i$.

The optional argument Id_cache can be used to pass a precomputed identity matrix. This can be useful when the same function is applied multiple times with a known Hilbert space dimension.

source
QuPhys.liouvillian_generalizedFunction
liouvillian_generalized(H::QuantumObject, fields::Vector, 
+T_list::Vector; N_trunc::Int=size(H,1), tol::Float64=0.0, σ_filter::Union{Nothing, Real}=nothing)

Constructs the generalized Liouvillian for a system coupled to a bath of harmonic oscillators.

See, e.g., Settineri, Alessio, et al. "Dissipation and thermal noise in hybrid quantum systems in the ultrastrong-coupling regime." Physical Review A 98.5 (2018): 053834.

source
QuPhys.steadystate_floquetFunction
steadystate_floquet(H_0::QuantumObject,
     c_ops::Vector, H_p::QuantumObject,
     H_m::QuantumObject,
     ω::Real; n_max::Int=4, lf_solver::LSolver=LiouvillianDirectSolver(),
-    ss_solver::Type{SSSolver}=SteadyStateDirectSolver)

Calculates the steady state of a periodically driven system. Here H_0 is the Hamiltonian or the Liouvillian of the undriven system. Considering a monochromatic drive at frequency $\\omega$, we divide it into two parts, H_p and H_m, where H_p oscillates as $e^{i \\omega t}$ and H_m oscillates as $e^{-i \\omega t}$. n_max is the number of iterations used to obtain the effective Liouvillian, lf_solver is the solver used to solve the effective Liouvillian, and ss_solver is the solver used to solve the steady state.

source

Correlations and Spectrum

QuPhys.correlation_3op_2tFunction
correlation_3op_2t(H::QuantumObject,
+    ss_solver::Type{SSSolver}=SteadyStateDirectSolver)

Calculates the steady state of a periodically driven system. Here H_0 is the Hamiltonian or the Liouvillian of the undriven system. Considering a monochromatic drive at frequency $\\omega$, we divide it into two parts, H_p and H_m, where H_p oscillates as $e^{i \\omega t}$ and H_m oscillates as $e^{-i \\omega t}$. n_max is the number of iterations used to obtain the effective Liouvillian, lf_solver is the solver used to solve the effective Liouvillian, and ss_solver is the solver used to solve the steady state.

source

Correlations and Spectrum

QuPhys.correlation_3op_2tFunction
correlation_3op_2t(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector,
     τ_l::AbstractVector,
@@ -247,7 +247,7 @@
     B::QuantumObject,
     C::QuantumObject,
     c_ops::AbstractVector=[];
-    kwargs...)

Returns the two-times correlation function of three operators $\hat{A}$, $\hat{B}$ and $\hat{C}$: $\expval{\hat{A}(t) \hat{B}(t + \tau) \hat{C}(t)}$ for a given initial state $\ket{\psi_0}$.

source
QuPhys.correlation_2op_2tFunction
correlation_2op_2t(H::QuantumObject,
+    kwargs...)

Returns the two-times correlation function of three operators $\hat{A}$, $\hat{B}$ and $\hat{C}$: $\expval{\hat{A}(t) \hat{B}(t + \tau) \hat{C}(t)}$ for a given initial state $\ket{\psi_0}$.

source
QuPhys.correlation_2op_2tFunction
correlation_2op_2t(H::QuantumObject,
     ψ0::QuantumObject,
     t_l::AbstractVector,
     τ_l::AbstractVector,
@@ -255,20 +255,20 @@
     B::QuantumObject,
     c_ops::AbstractVector=[];
     reverse::Bool=false,
-    kwargs...)

Returns the two-times correlation function of two operators $\hat{A}$ and $\hat{B}$at different times\expval{\hat{A}(t + \tau) \hat{B}(t)}. Whenreverse=true, the correlation function is calculated as\expval{\hat{A}(t) \hat{B}(t + \tau)}`.

source
QuPhys.correlation_2op_1tFunction
correlation_2op_1t(H::QuantumObject,
+    kwargs...)

Returns the two-times correlation function of two operators $\hat{A}$ and $\hat{B}$at different times\expval{\hat{A}(t + \tau) \hat{B}(t)}. Whenreverse=true, the correlation function is calculated as\expval{\hat{A}(t) \hat{B}(t + \tau)}`.

source
QuPhys.correlation_2op_1tFunction
correlation_2op_1t(H::QuantumObject,
     ψ0::QuantumObject,
     τ_l::AbstractVector,
     A::QuantumObject,
     B::QuantumObject,
     c_ops::AbstractVector=[];
     reverse::Bool=false,
-    kwargs...)

Returns the one-time correlation function of two operators $\hat{A}$ and $\hat{B}$ at different times $\expval{\hat{A}(\tau) \hat{B}(0)}$. When $reverse=true$, the correlation function is calculated as $\expval{\hat{A}(0) \hat{B}(\tau)}$.

source
QuPhys.spectrumFunction
spectrum(H::QuantumObject,
+    kwargs...)

Returns the one-time correlation function of two operators $\hat{A}$ and $\hat{B}$ at different times $\expval{\hat{A}(\tau) \hat{B}(0)}$. When $reverse=true$, the correlation function is calculated as $\expval{\hat{A}(0) \hat{B}(\tau)}$.

source
QuPhys.spectrumFunction
spectrum(H::QuantumObject,
 ω_list::AbstractVector,
 A::QuantumObject{<:AbstractArray{T2},OperatorQuantumObject},
 B::QuantumObject{<:AbstractArray{T3},OperatorQuantumObject},
 c_ops::AbstractVector=[];
 solver::MySolver=ExponentialSeries(),
-    kwargs...)

Returns the emission spectrum $S(\omega) = \int_{-\infty}^\infty \expval{\hat{A}(\tau) \hat{B}(0)} e^{-i \omega \tau} d \tau$.

source

Eigenvalues and eigenvectors

LinearAlgebra.eigenFunction
LinearAlgebra.eigen(A::QuantumObject; kwargs...)

Calculates the eigenvalues and eigenvectors of the QuantumObject A using the Julia LinearAlgebra package.

julia> a = destroy(5);
+    kwargs...)

Returns the emission spectrum $S(\omega) = \int_{-\infty}^\infty \expval{\hat{A}(\tau) \hat{B}(0)} e^{-i \omega \tau} d \tau$.

source

Eigenvalues and eigenvectors

LinearAlgebra.eigenFunction
LinearAlgebra.eigen(A::QuantumObject; kwargs...)

Calculates the eigenvalues and eigenvectors of the QuantumObject A using the Julia LinearAlgebra package.

julia> a = destroy(5);
 
 julia> H = a + a'
 Quantum Object:   type=Operator   dims=[5]   size=(5, 5)   ishermitian=true
@@ -299,10 +299,10 @@
 julia> ψ_1 = QuantumObject(U[:,1], dims=H.dims);
 
 julia> expect(H, ψ_1) ≈ E[1]
-true
source
QuPhys.eigsolveFunction
function eigsolve(A::QuantumObject; v0::Union{Nothing,AbstractVector}=nothing, 
+true
source
QuPhys.eigsolveFunction
function eigsolve(A::QuantumObject; v0::Union{Nothing,AbstractVector}=nothing, 
     sigma::Union{Nothing, Real}=nothing, k::Int = min(4, size(A, 1)), 
     krylovdim::Int = min(10, size(A, 1)), tol::Real = 1e-8, maxiter::Int = 200,
-    solver::Union{Nothing, LinearSolve.SciMLLinearSolveAlgorithm} = nothing, kwargs...)

Solve for the eigenvalues and eigenvectors of a matrix A using the Arnoldi method. The keyword arguments are passed to the linear solver.

source
QuPhys.eigsolve_alFunction
eigsolve_al(H::QuantumObject,
+    solver::Union{Nothing, LinearSolve.SciMLLinearSolveAlgorithm} = nothing, kwargs...)

Solve for the eigenvalues and eigenvectors of a matrix A using the Arnoldi method. The keyword arguments are passed to the linear solver.

source
QuPhys.eigsolve_alFunction
eigsolve_al(H::QuantumObject,
     T::Real, c_ops::AbstractVector=[];
     alg::OrdinaryDiffEqAlgorithm=Tsit5(),
     H_t::Union{Nothing,Function}=nothing,
@@ -313,4 +313,4 @@
     krylovdim::Int=min(10, size(H, 1)),
     maxiter::Int=200,
     eigstol::Real=1e-6,
-    kwargs...)

Solve the eigenvalue problem for a Liouvillian superoperator L using the Arnoldi-Lindblad method.

Arguments

  • H: The Hamiltonian (or directly the Liouvillian) of the system.
  • T: The time at which to evaluate the time evolution
  • c_ops: A vector of collapse operators
  • alg: The differential equation solver algorithm
  • H_t: A function H_t(t) that returns the additional term at time t
  • params: A dictionary of additional parameters
  • progress: Whether to show a progress bar
  • ρ0: The initial density matrix. If not specified, a random density matrix is used
  • k: The number of eigenvalues to compute
  • krylovdim: The dimension of the Krylov subspace
  • maxiter: The maximum number of iterations for the eigsolver
  • eigstol: The tolerance for the eigsolver
  • kwargs: Additional keyword arguments passed to the differential equation solver

Returns

  • EigsolveResult: A struct containing the eigenvalues, the eigenvectors, and some information about the eigsolver

References

  • [1] Minganti, F., & Huybrechts, D. (2022). Arnoldi-Lindblad time evolution:

Faster-than-the-clock algorithm for the spectrum of time-independent and Floquet open quantum systems. Quantum, 6, 649.

source
+ kwargs...)

Solve the eigenvalue problem for a Liouvillian superoperator L using the Arnoldi-Lindblad method.

Arguments

  • H: The Hamiltonian (or directly the Liouvillian) of the system.
  • T: The time at which to evaluate the time evolution
  • c_ops: A vector of collapse operators
  • alg: The differential equation solver algorithm
  • H_t: A function H_t(t) that returns the additional term at time t
  • params: A dictionary of additional parameters
  • progress: Whether to show a progress bar
  • ρ0: The initial density matrix. If not specified, a random density matrix is used
  • k: The number of eigenvalues to compute
  • krylovdim: The dimension of the Krylov subspace
  • maxiter: The maximum number of iterations for the eigsolver
  • eigstol: The tolerance for the eigsolver
  • kwargs: Additional keyword arguments passed to the differential equation solver

Returns

  • EigsolveResult: A struct containing the eigenvalues, the eigenvectors, and some information about the eigsolver

References

  • [1] Minganti, F., & Huybrechts, D. (2022). Arnoldi-Lindblad time evolution:

Faster-than-the-clock algorithm for the spectrum of time-independent and Floquet open quantum systems. Quantum, 6, 649.

source
diff --git a/dev/benchmark_comparison/index.html b/dev/benchmark_comparison/index.html index 2f3a9fa2..0d481264 100644 --- a/dev/benchmark_comparison/index.html +++ b/dev/benchmark_comparison/index.html @@ -1,5 +1,5 @@ -Multi VS Single Thread · QuPhys.jl

Benchmark Report for QuPhys

Job Properties

  • Time of benchmarks:
    • Target: 24 Nov 2023 - 15:06
    • Baseline: 24 Nov 2023 - 15:09
  • Package commits:
    • Target: 75c60e
    • Baseline: 75c60e
  • Julia commits:
    • Target: 8e5136
    • Baseline: 8e5136
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: JULIA_NUM_THREADS => 4
    • Baseline: JULIA_NUM_THREADS => 1

Results

A ratio greater than 1.0 denotes a possible regression (marked with :x:), while a ratio less than 1.0 denotes a possible improvement (marked with :whitecheckmark:). Only significant results - results that indicate possible regressions or improvements - are shown below (thus, an empty table means that all benchmark results remained invariant between builds).

IDtime ratiomemory ratio
["entanglement", "ptrace_dm"]0.93 (5%) :whitecheckmark:1.00 (1%)
["permutation", "bdf"]0.94 (5%) :whitecheckmark:1.00 (1%)
["timeevolution", "mcsolve_parallel"]0.43 (5%) :whitecheckmark:1.00 (1%)
["wigner", "wigner_clenshaw"]0.94 (5%) :whitecheckmark:1.00 (1%)
["wigner", "wigner_clenshaw_fock"]0.87 (5%) :whitecheckmark:1.00 (1%)
["wigner", "wigner_laguerre_sparse_parallel"]0.48 (5%) :whitecheckmark:1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["entanglement"]
  • ["permutation"]
  • ["spectrum"]
  • ["timeevolution"]
  • ["wigner"]

Julia versioninfo

Target

Julia Version 1.9.4
+Multi VS Single Thread · QuPhys.jl

Benchmark Report for QuPhys

Job Properties

  • Time of benchmarks:
    • Target: 24 Nov 2023 - 16:43
    • Baseline: 24 Nov 2023 - 16:45
  • Package commits:
    • Target: 64a226
    • Baseline: 64a226
  • Julia commits:
    • Target: 8e5136
    • Baseline: 8e5136
  • Julia command flags:
    • Target: None
    • Baseline: None
  • Environment variables:
    • Target: JULIA_NUM_THREADS => 4
    • Baseline: JULIA_NUM_THREADS => 1

Results

A ratio greater than 1.0 denotes a possible regression (marked with :x:), while a ratio less than 1.0 denotes a possible improvement (marked with :whitecheckmark:). Only significant results - results that indicate possible regressions or improvements - are shown below (thus, an empty table means that all benchmark results remained invariant between builds).

IDtime ratiomemory ratio
["permutation", "bdf"]1.08 (5%) :x:1.00 (1%)
["timeevolution", "mcsolve_parallel"]0.43 (5%) :whitecheckmark:1.00 (1%)
["wigner", "wigner_clenshaw_fock"]0.94 (5%) :whitecheckmark:1.00 (1%)
["wigner", "wigner_laguerre_sparse_parallel"]0.50 (5%) :whitecheckmark:1.00 (1%)

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["entanglement"]
  • ["permutation"]
  • ["spectrum"]
  • ["timeevolution"]
  • ["wigner"]

Julia versioninfo

Target

Julia Version 1.9.4
 Commit 8e5136fa297 (2023-11-14 08:46 UTC)
 Build Info:
   Official https://julialang.org/ release
@@ -9,13 +9,13 @@
   uname: Linux 6.2.0-1016-azure #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023 x86_64 x86_64
   CPU: AMD EPYC 7763 64-Core Processor: 
               speed         user         nice          sys         idle          irq
-       #1  2611 MHz       3004 s          0 s        246 s       5805 s          0 s
-       #2  2595 MHz       3549 s          0 s        204 s       5311 s          0 s
-       #3  3380 MHz       1944 s          0 s        255 s       6842 s          0 s
-       #4  3241 MHz       1908 s          0 s        238 s       6898 s          0 s
-  Memory: 15.606895446777344 GB (13413.7578125 MB free)
-  Uptime: 909.9 sec
-  Load Avg:  1.31  1.15  0.82
+       #1  2445 MHz       2338 s          0 s        224 s       6690 s          0 s
+       #2  2618 MHz       3700 s          0 s        207 s       5341 s          0 s
+       #3  3253 MHz       2679 s          0 s        267 s       6306 s          0 s
+       #4  3242 MHz       1768 s          0 s        272 s       7207 s          0 s
+  Memory: 15.60689926147461 GB (13404.41796875 MB free)
+  Uptime: 929.21 sec
+  Load Avg:  1.24  1.12  0.82
   WORD_SIZE: 64
   LIBM: libopenlibm
   LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
@@ -29,14 +29,14 @@
   uname: Linux 6.2.0-1016-azure #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023 x86_64 x86_64
   CPU: AMD EPYC 7763 64-Core Processor: 
               speed         user         nice          sys         idle          irq
-       #1  3237 MHz       3547 s          0 s        262 s       6807 s          0 s
-       #2  3243 MHz       4364 s          0 s        254 s       6008 s          0 s
-       #3  3095 MHz       1960 s          0 s        307 s       8333 s          0 s
-       #4  2593 MHz       2137 s          0 s        325 s       8143 s          0 s
-  Memory: 15.606895446777344 GB (13558.8046875 MB free)
-  Uptime: 1066.31 sec
-  Load Avg:  1.18  1.16  0.88
+       #1  2724 MHz       2440 s          0 s        256 s       8135 s          0 s
+       #2  2445 MHz       3757 s          0 s        344 s       6727 s          0 s
+       #3  3242 MHz       3304 s          0 s        287 s       7242 s          0 s
+       #4  3243 MHz       2602 s          0 s        286 s       7940 s          0 s
+  Memory: 15.60689926147461 GB (13463.4140625 MB free)
+  Uptime: 1087.6 sec
+  Load Avg:  1.16  1.14  0.89
   WORD_SIZE: 64
   LIBM: libopenlibm
   LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
-  Threads: 1 on 4 virtual cores
+ Threads: 1 on 4 virtual cores
diff --git a/dev/benchmark_single/index.html b/dev/benchmark_single/index.html index db0cadba..cd000126 100644 --- a/dev/benchmark_single/index.html +++ b/dev/benchmark_single/index.html @@ -1,5 +1,5 @@ -Multi Threads · QuPhys.jl

Benchmark Report for QuPhys

Job Properties

  • Time of benchmark: 24 Nov 2023 - 15:12
  • Package commit: 75c60e
  • Julia commit: 8e5136
  • Julia command flags: None
  • Environment variables: JULIA_NUM_THREADS => 4

Results

Below is a table of this job's results, obtained by running the benchmarks. The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to index into the BaseBenchmarks suite to retrieve the corresponding benchmarks. The percentages accompanying time and memory values in the below table are noise tolerances. The "true" time/memory value for a given benchmark is expected to fall within this percentage of the reported value. An empty cell means that the value was zero.

IDtimeGC timememoryallocations
["entanglement", "entropy_vn"]5.501 μs (5%)30.05 KiB (1%)18
["entanglement", "ptrace"]6.382 μs (5%)27.22 KiB (1%)22
["entanglement", "ptrace_dm"]318.744 μs (5%)77.72 KiB (1%)1359
["permutation", "bdf"]1.096 ms (5%)2.41 MiB (1%)12603
["permutation", "get_bdf_blocks"]44.102 μs (5%)358.94 KiB (1%)24
["spectrum", "spectrum_exponential_series"]7.132 ms (5%)1.58 MiB (1%)11508
["spectrum", "spectrum_fft"]5.166 ms (5%)720.91 KiB (1%)948
["timeevolution", "liouvillian"]128.309 μs (5%)572.30 KiB (1%)313
["timeevolution", "liouvillian_generalized"]4.144 ms (5%)31.82 MiB (1%)863
["timeevolution", "liouvillian_generalized_trunc"]382.944 μs (5%)2.44 MiB (1%)859
["timeevolution", "mcsolve_parallel"]750.140 ms (5%)59.23 MiB (1%)54196
["timeevolution", "mcsolve_serial"]1.764 s (5%)59.23 MiB (1%)54171
["timeevolution", "mesolve"]21.374 ms (5%)771.08 KiB (1%)424
["timeevolution", "steadystate"]511.624 μs (5%)1.40 MiB (1%)412
["timeevolution", "steadystate_floquet"]104.163 ms (5%)4.397 ms133.75 MiB (1%)883
["wigner", "wigner_clenshaw"]173.280 ms (5%)16.414 ms682.59 MiB (1%)1177
["wigner", "wigner_clenshaw_fock"]70.231 ms (5%)6.127 ms318.62 MiB (1%)631
["wigner", "wigner_laguerre"]100.839 ms (5%)7.57 MiB (1%)21
["wigner", "wigner_laguerre_fock"]3.573 ms (5%)7.55 MiB (1%)26
["wigner", "wigner_laguerre_sparse"]101.128 ms (5%)7.56 MiB (1%)21
["wigner", "wigner_laguerre_sparse_parallel"]51.975 ms (5%)60.44 MiB (1%)61

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["entanglement"]
  • ["permutation"]
  • ["spectrum"]
  • ["timeevolution"]
  • ["wigner"]

Julia versioninfo

Julia Version 1.9.4
+Multi Threads · QuPhys.jl

Benchmark Report for QuPhys

Job Properties

  • Time of benchmark: 24 Nov 2023 - 16:48
  • Package commit: 64a226
  • Julia commit: 8e5136
  • Julia command flags: None
  • Environment variables: JULIA_NUM_THREADS => 4

Results

Below is a table of this job's results, obtained by running the benchmarks. The values listed in the ID column have the structure [parent_group, child_group, ..., key], and can be used to index into the BaseBenchmarks suite to retrieve the corresponding benchmarks. The percentages accompanying time and memory values in the below table are noise tolerances. The "true" time/memory value for a given benchmark is expected to fall within this percentage of the reported value. An empty cell means that the value was zero.

IDtimeGC timememoryallocations
["entanglement", "entropy_vn"]5.480 μs (5%)30.05 KiB (1%)18
["entanglement", "ptrace"]6.452 μs (5%)27.22 KiB (1%)22
["entanglement", "ptrace_dm"]343.179 μs (5%)77.72 KiB (1%)1359
["permutation", "bdf"]1.169 ms (5%)2.41 MiB (1%)12603
["permutation", "get_bdf_blocks"]44.613 μs (5%)358.94 KiB (1%)24
["spectrum", "spectrum_exponential_series"]7.109 ms (5%)1.58 MiB (1%)11508
["spectrum", "spectrum_fft"]5.156 ms (5%)720.91 KiB (1%)948
["timeevolution", "liouvillian"]129.000 μs (5%)572.30 KiB (1%)313
["timeevolution", "liouvillian_generalized"]4.156 ms (5%)31.82 MiB (1%)842
["timeevolution", "liouvillian_generalized_trunc"]376.771 μs (5%)2.44 MiB (1%)838
["timeevolution", "mcsolve_parallel"]750.204 ms (5%)59.23 MiB (1%)54196
["timeevolution", "mcsolve_serial"]1.723 s (5%)8.627 ms59.23 MiB (1%)54171
["timeevolution", "mesolve"]21.369 ms (5%)771.08 KiB (1%)424
["timeevolution", "steadystate"]546.788 μs (5%)1.40 MiB (1%)412
["timeevolution", "steadystate_floquet"]107.734 ms (5%)6.671 ms133.75 MiB (1%)884
["wigner", "wigner_clenshaw"]183.061 ms (5%)23.226 ms682.59 MiB (1%)1177
["wigner", "wigner_clenshaw_fock"]78.112 ms (5%)12.162 ms318.62 MiB (1%)631
["wigner", "wigner_laguerre"]101.366 ms (5%)7.57 MiB (1%)21
["wigner", "wigner_laguerre_fock"]3.530 ms (5%)7.55 MiB (1%)26
["wigner", "wigner_laguerre_sparse"]101.257 ms (5%)7.56 MiB (1%)21
["wigner", "wigner_laguerre_sparse_parallel"]55.064 ms (5%)2.667 ms60.44 MiB (1%)60

Benchmark Group List

Here's a list of all the benchmark groups executed by this job:

  • ["entanglement"]
  • ["permutation"]
  • ["spectrum"]
  • ["timeevolution"]
  • ["wigner"]

Julia versioninfo

Julia Version 1.9.4
 Commit 8e5136fa297 (2023-11-14 08:46 UTC)
 Build Info:
   Official https://julialang.org/ release
@@ -9,14 +9,14 @@
   uname: Linux 6.2.0-1016-azure #16~22.04.1-Ubuntu SMP Tue Oct 10 17:11:51 UTC 2023 x86_64 x86_64
   CPU: AMD EPYC 7763 64-Core Processor: 
               speed         user         nice          sys         idle          irq
-       #1  2445 MHz       3934 s          0 s        330 s       7912 s          0 s
-       #2  3241 MHz       4904 s          0 s        328 s       6956 s          0 s
-       #3  2602 MHz       2299 s          0 s        347 s       9514 s          0 s
-       #4  2594 MHz       2759 s          0 s        356 s       9050 s          0 s
-  Memory: 15.606895446777344 GB (13395.69921875 MB free)
-  Uptime: 1222.66 sec
-  Load Avg:  1.41  1.27  0.98
+       #1  3261 MHz       2961 s          0 s        277 s       9178 s          0 s
+       #2  3243 MHz       4332 s          0 s        357 s       7725 s          0 s
+       #3  2595 MHz       3655 s          0 s        368 s       8395 s          0 s
+       #4  2445 MHz       3067 s          0 s        378 s       8968 s          0 s
+  Memory: 15.60689926147461 GB (13387.87109375 MB free)
+  Uptime: 1246.37 sec
+  Load Avg:  1.29  1.2  0.96
   WORD_SIZE: 64
   LIBM: libopenlibm
   LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
-  Threads: 4 on 4 virtual cores
+ Threads: 4 on 4 virtual cores
diff --git a/dev/index.html b/dev/index.html index 0fe1ac9f..ede79434 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Introduction · QuPhys.jl
+Introduction · QuPhys.jl