Evolution
QBase.evolve — FunctionApply a unitary evolution U to density matrix ρ: $\rho' = U\rho U^{\dagger}$.
evolve(U :: Unitary, ρ :: State) :: StateApply a unitary evolution U to a state ket ψ: $|\psi'\rangle = U|\psi\rangle$.
evolve(U :: Unitary, ψ :: Ket) :: KetEvolve a State ρ by Λ the ChoiOp representation of a channel.
evolve(Λ :: ChoiOp, ρ :: State) :: State
evolve(Λ :: ChoiOp, ρ :: AbstractMatrix) :: MatrixSee the choi_evolve method for details.
Evolve a State ρ by the KrausChannel 𝒩.
evolve(𝒩 :: KrausChannel, ρ :: State) :: State
evolve(𝒩 :: KrausChannel, ρ :: AbstractMatrix) :: MatrixSee the kraus_evolve method for details.
Base.:* — Method*(U :: Unitary, ket :: Ket) :: Ket
*(bra :: Bra, U :: Unitary) :: Bra
*(U1 :: Unitary, ρ :: State, U2 :: Unitary) :: MatrixUnitaries
QBase.Unitary — TypeUnitary( 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.
QBase.is_unitary — Functionis_unitary( U :: Matrix; atol=ATOL :: Float64 ) :: BoolReturns true if matrix U is unitary. The hermitian adjoint of a unitary matrix is its inverse:
U' * U == IwhereIis the identity matrix.
Unitary Operations
Base.:* — Method*(unitaries :: Vararg{Unitary}; atol=ATOL :: Float64) :: UnitaryBase.kron — Methodkron(unitaries :: Vararg{Unitary}; atol=ATOL :: Float64) :: UnitaryBase.adjoint — Methodadjoint(U :: Unitary) :: UnitaryUnitary Constructors
QBase.σI — ConstantσI :: Unitary{Int64}Identity unitary:
julia> σI
2×2 Unitary{Int64}:
1 0
0 1QBase.σx — Constantσx :: Unitary{Int64}Pauli-X unitary:
julia> σx
2×2 Unitary{Int64}:
0 1
1 0QBase.σy — Constantσy :: Unitary{Complex{Int64}}Pauli-Y unitary:
julia> σy
2×2 Unitary{Complex{Int64}}:
0+0im 0-1im
0+1im 0+0imQBase.σz — Constantσz :: Unitary{Int64}Pauli-Z unitary:
julia> σz
2×2 Unitary:
1 0
0 -1QBase.qubit_rotation — Functionqubit_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.
QBase.random_unitary — Functionrandom_unitary( d :: Int64 ) :: Unitary{Complex{Float64}}Constructs a d x d random unitary matrix according to the Haar measure.
Channels
QBase.replacer_channel — Functionreplacer_channel(
ρ :: State,
σ :: State,
μ :: Real
) :: StateThe 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 satisfy1 ≥ μ ≥ 0ρandσare not the same size
QBase.depolarizing_channel — Functiondepolarizing_channel( ρ :: State, μ :: Real ) :: StateThe 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.
QBase.erasure_channel — Functionerasure_channel( ρ :: State, μ :: Real ) :: StateThe 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.
Kraus Channels
QBase.KrausChannel — TypeKrausChannel(
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.
QBase.is_kraus_channel — Functionis_kraus_channel(
kraus_ops :: Vector{<:AbstractMatrix};
atol=ATOL :: Float64
) :: BoolReturns true if the kraus_ops constitute a quantum channel. The requirements are:
- Completeness, $\sum_{i} K^{\dagger}_i K_i = \mathbb{I}$.
QBase.kraus_evolve — Functionkraus_evolve(
kraus_ops :: Vector{<:AbstractMatrix},
ρ :: Matrix
) :: MatrixApplies 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.
Choi Operators
QBase.ChoiOp — TypeChoiOp( Λ :: 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.
QBase.is_choi_matrix — Functionis_choi_matrix(
Λ :: AbstractMatrix,
dims :: Vector{Int};
atol=ATOL :: Float
) :: BoolReturns 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$.
QBase.choi_matrix — Functionchoi_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).
QBase.choi_evolve — Functionchoi_evolve(Λ :: Matrix{<:Number}, ρ :: Matrix{<:Number}) :: Matrix
choi_evolve(
Λ :: Matrix{<:Number}, ρ :: Matrix{<:Number}, dims :: Vector{Int}
) :: MatrixApplies 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.
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.