Channels, States, and Operations
Channels
CVChannel.Choi
— TypeChoi( JN :: AbstractMatrix, in_dim :: Int, out_dim :: Int ) :: Choi{<:Number}
Choi( N :: Function, in_dim :: Int, out_dim :: Int ) :: Choi{ComplexF64}
Choi( kraus_ops :: Vector{<:AbstractMatrix} ) :: Choi{ComplexF64}
Constructs the Choi matrix representation of a quantum channel. If either a function N
or set of kraus operators is provided as input, the Choi matrix is constructed with the choi
method.
The Choi
type contains the fields:
JN :: Matrix{<:Number}
- The choi matrix.in_dim :: Int
- The channel's input dimension.out_dim :: Int
- The Channel's output dimension.
A DomainError
is thrown if is_choi_matrix
returns false
.
CVChannel.is_choi_matrix
— Functionis_choi_matrix(JN :: AbstractMatrix, dimA :: Int, dimB :: Int) :: Bool
Returns true
if the supplied matrix JN
is a Choi operator. This function returns false
if
size(JN) != (dimA * dimB, dimA * dimB)
CVChannel.parChoi
— FunctionparChoi(chan1 :: Choi, chan2 :: Choi) :: Choi
Returns the tensor product of two Choi
matrices
\[ J^{AB}_{\mathcal{N}}\otimes J^{A'B'}_{\mathcal{M}} \to J^{AA'BB'}_{\mathcal{N}\otimes\mathcal{M}}\]
where $J^{A:B}_{\mathcal{N}}$ and $J^{A':B'}_{\mathcal{M}}$ are the Choi matrices for chan1
and chan2
respectively. Note the implicit swap between systems $B \leftrightarrow A'$.
CVChannel.choi
— Functionchoi(𝒩 :: Function, Σ :: Int, Λ :: Int) :: Matrix{ComplexF64}
choi(kraus_ops :: Vector{<:AbstractMatrix}) :: Matrix{ComplexF64}
This function returns the Choi state of a channel represented either as a generic function 𝒩
or a set of Kraus operators kraus_ops
. It does this using that
\[ J_{\mathcal{N}} = \sum_{a,b \in \Sigma} E_{a,b} \otimes \mathcal{N}(E_{a,b}) ,\]
where $\Sigma$ is the finite alphabet indexing the input space and $E_{a,b}$ is a square matrix of dimension $\Sigma$ with a $1$ in the $(a,b)$ entry and a $0$ everywhere else. The input $\Lambda$ is the output dimension. Note this assumes you have a function that calculates $\mathcal{N}(X)$ for arbitrary input $X$. As many of the functions for channels in this module have multiple parameters, please note that if you have a channel function 𝒩(ρ, p, q)
that calculates $\mathcal{N}_{p,q}(\rho)$, you can declare a function 𝒩_xy(ρ) = 𝒩(ρ,x,y)
for fixed (x,y)
and then call, choi(𝒩_xy, Σ)
.
CVChannel.isometricChannel
— FunctionisometricChannel(kraus_ops :: Vector) :: Matrix
This function builds the isometric representation $V$ of a channel $\mathcal{N}: A \to B$ from the Kraus operators $\{K_{i}\}$. It does this by calculating
\[ V = \sum_{i} K_{i} \otimes |i\rangle\]
CVChannel.complementaryChannel
— FunctioncomplementaryChannel(kraus_ops :: Vector) :: Vector
This function takes a set of Kraus operators for a channel $\mathcal{N}_{A \to B}$ and returns a set of Kraus operators for the complementary channel, $\mathcal{N}^{c}_{A \to E}$. It does this by generating the Kraus operators of the isometric representation of the channel followed by partial trace on the $B$ space.
If $\mathcal{N}_{A \to B}$ is already isometric, the code lets dimE=2 so that functions are well behaved.
CVChannel.krausAction
— FunctionkrausAction(kraus_ops :: Vector, X)
This function takes a set of Kraus operators for a channel $\mathcal{N}_{A \to B}$ and returns the output of the channel for input $X$. That is, given input $X$ it returns
\[ \mathcal{N}_{A \to B}(X) = \sum_{i} K_{i} X K_{i}^{\ast}\]
CVChannel.depolarizingChannel
— FunctiondepolarizingChannel(ρ :: Matrix{Float64}, q :: Union{Int,Float64}) :: Matrix{ComplexF64}
This calculates the action of the depolarizing channel,
\[\Delta_{q}(\rho) = (1-q)\rho + q \text{Tr}(\rho) \frac{1}{d} I_{AB} ,\]
where $q \in [0,1].$ Note these channels are the channels covariant with respect to the unitary group.
A DomainError
is thrown if:
- Matrix
ρ
is not square - Input
q
does not satisfy0 ≤ q ≤ 1
CVChannel.dephrasureChannel
— FunctiondephrasureChannel(
ρ :: Matrix{<:Number},
p :: Union{Int,Float64},
q :: Union{Int,Float64}
) :: Matrix{ComplexF64}
This function calculates the action of the dephrasureChannel,
\[\mathcal{N}_{p,q}( \rho) := (1-q)((1-p) \rho + pZ \rho Z) + q \text{Tr}( \rho) |e\rangle \langle e|,\]
where $p,q \in [0,1]$, $Z$ is the Pauli-Z matrix, and $|e\rangle\langle e|$ an error flag orthogonal to the Hilbert space of input state $\rho$.
A DomainError
is thrown if:
- Matrix
ρ
is not2x2
- Inputs
p
orq
do not satisdy0 ≤ p,q ≤ 1
CVChannel.wernerHolevoChannel
— FunctionwernerHolevoChannel(ρ :: Matrix{<:Number}, λ :: Union{Int,Float64}) :: Matrix{ComplexF64}
This function calculates the action of the generalized Werner-Holevo channels
\[ \mathcal{W}_{d,\lambda}(\rho) = \lambda \Phi_{0}(ρ) + (1-\lambda) \Phi_{1}(ρ)\]
where $\lambda \in [0,1]$. This means these are convex combinations of the original Werner-Holevo channels which are defined as
\[ \Phi_{0}(ρ) = \frac{1}{d+1}(\text{Tr}[\rho]I_{d} +ρ^{T}) \hspace{1cm} \Phi_{1}(ρ) = \frac{1}{d-1}(\text{Tr}[\rho]I_{d} -ρ^{T}) .\]
Note the Choi matrices of these generalized channels are the (unnormalized) Werner states.
A DomainError
is thrown if:
- Matrix
ρ
is not square p
is not in range0 ≤ p ≤ 1
CVChannel.siddhuChannel
— FunctionsiddhuChannel(ρ :: Matrix{<:Number}, s :: Union{Int,Float64}) :: Matrix{<:Number}
This function calculates the action of the Siddhu channel $N_{s}$ which is defined by Kraus operators:
\[ \begin{aligned} K_{0} = \begin{bmatrix} \sqrt{s} & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix} \hspace{5mm} K_{1} = \begin{bmatrix} 0 & 0 & 0 \\ \sqrt{1-s} & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} , \end{aligned}\]
where $s \in [0,1/2]$. This channel was introduced in Equation 9 of this paper.
CVChannel.generalizedSiddhu
— FunctiongeneralizedSiddhu(
ρ :: Matrix{<:Number},
s :: Union{Int,Float64},
μ :: Union{Int,Float64}
) :: Matrix{<:Number}
This function calculates the action of the generalized Siddhu channel $\mathcal{N}_{s,\mu}$ on the qutrit state $\rho$. The action of the channel is defined by Kraus operators:
\[ \begin{aligned} K_{0} = \begin{bmatrix} \sqrt{s} & 0 & 0 \\ 0 & \sqrt{1-\mu} & 0 \\ 0 & 0 & \sqrt{\mu} \end{bmatrix} \hspace{5mm} K_{1} = \begin{bmatrix} 0 & 0 & \sqrt{1-\mu} \\ \sqrt{1-s} & 0 & 0 \\ 0 & \sqrt{\mu} & 0 \end{bmatrix} , \end{aligned}\]
where $s \in [0,1/2]$, $\mu \in [0,1]$. This channel was introduced by Leditzky et al. (cite when on arxiv).
A DomainError
is thrown if:
- Matrix
ρ
is not square ρ
is not a 3-dimensional matrixs
is not in range0 ≤ s ≤ 1/2
μ
is not in range0 ≤ μ ≤ 1
CVChannel.GADChannel
— FunctionGADChannel(
ρ :: Matrix{<:Number},
p :: Union{Int,Float64},
n :: Union{Int,Float64}
) :: Matrix{<:Number}
This function calculates the action of the generalized (qubit) amplitude damping channel $\mathcal{A}_{p,n}$ which is defined by Kraus operators:
\[ \begin{aligned} K_{0} =& \sqrt{1-n} \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-p} \end{bmatrix} \hspace{5mm} K_{1} =& \sqrt{p(1-n)} \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} \\ K_{2} =& \sqrt{n} \begin{bmatrix} \sqrt{1-p} & 0 \\ 0 & 1 \end{bmatrix} \hspace{5mm} K_{3} =& \sqrt{pn} \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix} \end{aligned}\]
where $p,n \in [0,1]$. This channel may be found in Section 3 of this paper.
States
CVChannel.wernerState
— FunctionwernerState(dim :: Int, p ::Union{Int,Float64}) :: Matrix{Float64}
This function constructs the Werner states,
\[ \sigma_{d,p} = p \frac{\Pi_{0}}{d+1 \choose 2} + (1-p) \frac{\Pi_{1}}{d \choose 2}\]
where $p \in [0,1]$ and $\Pi_0, \Pi_1$ are the projectors onto the symmetric and anti-symmetric subspaces respectively. They can be determined by
\[ \Pi_0 = \frac{1}{2} (I_{A} \otimes I_{B} + \mathbb{F}) \hspace{1cm} \Pi_1 = \frac{1}{2}(I_{A} \otimes I_{B} - \mathbb{F})\]
where $\mathbb{F}$ is the swap operator.
A DomainError
is thrown if:
d ≤ 1
p
is not in range0 ≤ p ≤ 1
CVChannel.axisymmetricState
— FunctionaxisymmetricState(
d :: Int64,
x :: Union{Int,Float64},
y :: Union{Int,Float64}
) :: Matrix{Float64}
Construct the axisymmetric state $\rho^{\text{axi}}$ as described in section IV.C. of this paper. This state is a bipartite quantum state with each subspace having dimension d
. The diagonal of $\rho^{\text{axi}}$ is parameterized as
\[ \rho^{\text{axi}}_{jj,jj} = \frac{1}{d^2}+a, \quad \text{and}\quad \rho^{\text{axi}}_{jk,jk} = \frac{1}{d^2}- \frac{a}{d-1} \; (j\neq k)\]
while the off-diagonals are expressed as
\[ \rho^{\text{axi}}_{jj,kk} = b,\]
where $a = y\frac{d-1}{d}$ and $b = \frac{x}{\sqrt{d(d-1)}}$. All remaining elements of $\rho^{\text{axi}}$ are zero. Inputs x
and y
of the axisymmetricState
function parameterize $\rho^{\text{axi}}$ and are constrained as:
- $-\frac{1}{d\sqrt{d-1}} \leq y \leq \frac{\sqrt{d-1}}{d}$
- $-\frac{1}{\sqrt{d(d-1)}}\leq x \leq \sqrt{\frac{d-1}{d}}$
- $-\frac{1}{\sqrt{d}}\left( y + \frac{1}{d\sqrt{d-1}}\right) \leq x \leq \frac{d-1}{\sqrt{d}}\left(y + \frac{1}{d\sqrt{d-1}} \right)$
If any of the constraints above do not hold, a DomainError
is thrown.
CVChannel.haarStates
— FunctionhaarStates(n :: Int64, d :: Int64) :: Vector{Matrix{ComplexF64}}
Constructs a list of n
random states on a d
-dimensional Hilbert space according to the Haar measure.
Operations
CVChannel.isPPT
— FunctionisPPT(x, sys :: Int, dims :: Vector) :: Bool
This function returns true if the input state x is PPT with respect to the (sys)th system. False otherwise. dims is a vector of the sizes of the subsystems.
CVChannel.swapOperator
— FunctionswapOperator(dim :: Int) :: Matrix{Float64}
This function is the swap operator $\mathbb{F}$ which is defined by the action
\[\mathbb{F}(u \otimes v) = v \otimes u \hspace{5mm} u,v \in \mathcal{H}_{A} .\]
The function uses that $\mathbb{F} = \sum_{a,b \in \Sigma} E_{a,b} \otimes E_{b,a}$ where $E_{a,b}$ is a square matrix of dimension $\Sigma$ with a one in the $(a,b)$ entry and a $0$ everywhere else.
CVChannel.permuteSubsystems
— FunctionpermuteSubsystems(
ρ:: Vector,
perm::Vector{Int64},
dims::Vector{Int64}
) :: Vector
This function returns the vector with the subsystems permuted. For example, given three subspaces $A,B,C$, and the permutation $\pi$ defined by $(A,B,C) \xrightarrow[]{\pi} (C,A,B),$ the function implements the process:
\[ |e_{i}\rangle_{A} |e_j \rangle_{B} |e_k \rangle_{C} \xrightarrow[]{\pi} |e_{k} \rangle_{C} |e_{i}\rangle_{A} |e_{j} \rangle_{B} ,\]
by re-indexing the vector, permuting the indices appropriately, and converting it back into a vector.
permuteSubsystems(
ρ:: Matrix,
perm::Vector{Int64},
dims::Vector{Int64}
) :: Matrix
This function returns the matrix with the subsystems permuted. It is a generalization of the vector code. For example, given three subspaces $A,B,C$, and the permutation $\pi$ defined by $(A,B,C) \xrightarrow[]{\pi} (C,A,B),$ the function implements the process:
\[|e_{i}\rangle\langle e_{i}|_{A}\otimes |e_j \rangle\langle e_j|_{B}\otimes |e_k \rangle\langle e_k|_{C} \xrightarrow[]{\pi} |e_{k} \rangle\langle e_{k}|_{C}\otimes |e_{i}\rangle\langle e_{i}|_{A} \otimes |e_{j} \rangle\langle e_{j}|_{B} ,\]
by re-indexing the matrix, permuting the indices, and reconstructing the matrix. Both bra and ket indices receive the same permutation.
CVChannel.shiftOperator
— FunctionshiftOperator(d::Int64) :: Matrix
This function returns the operator that shifts the computational basis mod d for complex Euclidean space of dimension d. That is, it returns the operator $S$ defined by the action
\[ S|k\rangle = |k+1 \mod d \rangle\]
CVChannel.discreteWeylOperator
— FunctiondiscreteWeylOperator(m :: Int64, n :: Int64, d :: Int64)
This function returns the (m,n)^th unitary for generating the generalized Bell basis. They are defined by their action on the computational basis:
\[ U_{m,n}|e_{k}\rangle = e^{2 \pi mk i / d} |e_{k+n}\rangle\]
These are the discrete Weyl Operator basis. See Section 3 of this paper for further details.
Different works define the discrete Weyl operators differently such that the phase or ordering may differ. Please check your reference.