Evolution

QBase.evolveFunction

Apply a unitary evolution U to density matrix ρ: $\rho' = U\rho U^{\dagger}$.

evolve(U :: Unitary, ρ :: State) :: State
source

Apply a unitary evolution U to a state ket ψ: $|\psi'\rangle = U|\psi\rangle$.

evolve(U ::  Unitary, ψ :: Ket) :: Ket
source

Evolve a State ρ by Λ the ChoiOp representation of a channel.

evolve(Λ ::  ChoiOp, ρ :: State) :: State
evolve(Λ :: ChoiOp, ρ :: AbstractMatrix) :: Matrix

See the choi_evolve method for details.

source

Evolve a State ρ by the KrausChannel 𝒩.

evolve(𝒩 :: KrausChannel, ρ :: State) :: State
evolve(𝒩 :: KrausChannel, ρ :: AbstractMatrix) :: Matrix

See the kraus_evolve method for details.

source
Base.:*Method
*(U :: Unitary, ket :: Ket) :: Ket
*(bra :: Bra, U :: Unitary) :: Bra
*(U1 :: Unitary, ρ :: State, U2 ::  Unitary) :: Matrix
source

Unitaries

QBase.UnitaryType
Unitary( U :: AbstractMatrix ) <: Operator{T}

Unitary matrices represent the physical evolution of quantum states. The Constructor, Unitary(U), throws a DomainError if the provided matrix, U is not unitary.

source
QBase.is_unitaryFunction
is_unitary( U :: Matrix; atol=ATOL :: Float64 ) :: Bool

Returns true if matrix U is unitary. The hermitian adjoint of a unitary matrix is its inverse:

  • U' * U == I where I is the identity matrix.
source

Unitary Operations

Base.:*Method
*(unitaries :: Vararg{Unitary}; atol=ATOL :: Float64) :: Unitary
source
Base.kronMethod
kron(unitaries :: Vararg{Unitary}; atol=ATOL :: Float64) :: Unitary
source

Unitary Constructors

QBase.σIConstant
σI :: Unitary{Int64}

Identity unitary:

julia> σI
2×2 Unitary{Int64}:
 1  0
 0  1
source
QBase.σxConstant
σx :: Unitary{Int64}

Pauli-X unitary:

julia> σx
2×2 Unitary{Int64}:
 0  1
 1  0
source
QBase.σyConstant
σy :: Unitary{Complex{Int64}}

Pauli-Y unitary:

julia> σy
2×2 Unitary{Complex{Int64}}:
 0+0im  0-1im
 0+1im  0+0im
source
QBase.σzConstant
σz :: Unitary{Int64}

Pauli-Z unitary:

julia> σz
2×2 Unitary:
 1   0
 0  -1
source
QBase.qubit_rotationFunction
qubit_rotation( θ :: Real; axis="x" :: String ) :: Unitary{Complex{Float64}}

Returns a unitary which performs a qubit rotation along bloch sphere. θ designates the angle of rotation and axis ("x", "y", "z") designates the cartesian axis about which the qubit is rotated.

source
QBase.random_unitaryFunction
random_unitary( d :: Int64 ) :: Unitary{Complex{Float64}}

Constructs a d x d random unitary matrix according to the Haar measure.

source

Channels

QBase.replacer_channelFunction
replacer_channel(
    ρ :: State,
    σ :: State,
    μ :: Real
) :: State

The replacer channel replaces the quantum state ρ with quantum state σ with probability μ. The replacer channel is expressed:

\[ \mathcal{R}_{\mu}(\rho) = \mu \rho + (1-\mu)\sigma\]

A DomainError is thrown if

  • μ does not satisfy 1 ≥ μ ≥ 0
  • ρ and σ are not the same size
source
QBase.depolarizing_channelFunction
depolarizing_channel( ρ :: State, μ :: Real ) :: State

The depolarizing channel mixes uniform classical noise into a quantum state ρ. The argument μ describes the amount of noise mixed into the quantum states. For a quantum state $\rho$, the depolarizing channel is expressed:

\[ \mathcal{D}_{\mu}(\rho) = \mu \rho + \frac{(1 - \mu)}{d}\mathbb{I}_d\]

A DomainError is thrown if μ does not satisfy 1 ≥ μ ≥ 0.

source
QBase.erasure_channelFunction
erasure_channel( ρ :: State, μ :: Real ) :: State

The erasure channel mixes a quantum state ρ with an error flag $|F\rangle$ orthogonal to the Hilbert space of ρ. The argument μ describes the probability that ρ is replaced with the error flag. For a quantum state $\rho$, the erasure channel is expressed:

\[ \mathcal{E}_{\mu}(\rho) = \mu \rho + (1 - \mu) |F \rangle \langle F|\]

Note that the erasure channel increases the dimension of the Hilbert space by 1.

A DomainError is thrown if μ does not satisfy 1 ≥ μ ≥ 0.

source

Kraus Channels

QBase.KrausChannelType
KrausChannel(
    kraus_ops :: Vector{Matrix{T}};
    atol=ATOL :: Float64
) :: KrausChannel{T}

The Kraus operator representation of a quantum channel. The channel evolves a density operator $\rho$ as,

\[ \mathcal{N}(\rho) = \sum_{i} K_{i} \rho K_{i}^{\dagger},\]

where $\{K_i \in L(A,B)\}_i$ are a set of linear operators known as Kraus operators.

A DomainError is thrown if kraus_ops do not constitute a quantum channel. See is_kraus_channel for details.

source
QBase.is_kraus_channelFunction
is_kraus_channel(
    kraus_ops :: Vector{<:AbstractMatrix};
    atol=ATOL :: Float64
) :: Bool

Returns true if the kraus_ops constitute a quantum channel. The requirements are:

  • Completeness, $\sum_{i} K^{\dagger}_i K_i = \mathbb{I}$.
source
QBase.kraus_evolveFunction
kraus_evolve(
    kraus_ops :: Vector{<:AbstractMatrix},
    ρ :: Matrix
) :: Matrix

Applies the Kraus operators kraus_ops to evolve the density operator ho. The evolved state $\rho'$ is constructed as,

\[ \rho' = \sum_{i} K_{i} \rho K_{i}^{\dagger}\]

where $K_i$ is a Kraus operator.

source

Choi Operators

QBase.ChoiOpType
ChoiOp( Λ :: AbstractMatrix, dims :: Vector{Int} ) :: ChoiOp{<:Number}
ChoiOp( 𝒩 :: Function, dims :: Vector{Int} ) :: ChoiOp{ComplexF64}

Constructs the Choi operator representation of a quantum channel. If either a function 𝒩 or set of kraus operators is provided as input, the Choi matrix is constructed with the choi_matrix method.

The ChoiOp type contains the fields:

  • M :: Matrix{<:Number} - The Choi matrix.
  • dims :: Vector{Int} - The channel's input/output dimension [dim_in, dim_out].

A DomainError is thrown if is_choi_matrix returns false.

source
QBase.is_choi_matrixFunction
is_choi_matrix(
    Λ :: AbstractMatrix,
    dims :: Vector{Int};
    atol=ATOL :: Float
) :: Bool

Returns true if matrix Λ is a Choi operator representation of a quantum channel.

The requirements on Λ are (https://arxiv.org/abs/1111.6950):

  • Is Hermitian, $\Lambda = \Lambda^{\dagger}$.
  • Is trace-preserving, $\text{Tr}_B[\Lambda^{AB}]=\mathbb{I}_A$.
  • Is completely-positive, $\Lambda \geq 0$.
source
QBase.choi_matrixFunction
choi_matrix( 𝒩 :: Function, dims :: Vector{Int} ) :: Matrix{ComplexF64}

Returns the Choi operator of a channel. The Choi matrix is constructed as

\[ \Lambda^{AB} = \sum_{i,j \in [d_A]} E^A_{i,j} \otimes \mathcal{N}^{A' \to B}(E_{i,j}^{A'}) ,\]

where $[d_A]$ is the finite alphabet indexing the input space and $E_{i,j}$ is a square matrix of dimension $d_A$ with a $1$ in the $(i,j)$ entry and a $0$ everywhere else. The input $\Lambda$ is the output dimension.

The input function 𝒩 is called as 𝒩(X) for arbitrary input X. Channel functions with multiple parameters can be considered by declaring a function 𝒩_xy(ρ) = 𝒩(ρ,x,y) for fixed (x,y) and then call, choi(𝒩_xy, dim_in, dim_out).

source
QBase.choi_evolveFunction
choi_evolve(Λ :: Matrix{<:Number}, ρ :: Matrix{<:Number}) :: Matrix
choi_evolve(
    Λ :: Matrix{<:Number}, ρ :: Matrix{<:Number}, dims :: Vector{Int}
) :: Matrix

Applies the Choi operator Λ to the density operator ρ where dims = [dim_in, dim_out] describes the input and output dimension of the Choi operator Λ. The output of the quantum channel evaluated as,

\[ \rho'_B = \text{Tr}_A[\Lambda_{AB}(\rho_A^{T}\otimes \mathbb{I}_B)],\]

where the partial_trace is taken with respect to the input system.

Dimension Verification

The method choi_evolve(Λ :: Matrix{<:Number}, ρ :: Matrix{<:Number}) does not verify the dimensions of Λ or ρ. An error will occur if proper dimensions are not used. This function bypasses the QBase.jl type system and relies upon the user to verify their arguments.

source