States

QBase.StatesModule

The States submodule provides:

  • abstract and concrete types for quantum state representations.
  • A catalog of constructors for instantiating quantum states.
source

In discrete and finite quantum systems, states can be represented computationally with vectors (Bra-Ket Representation) or matrices (Density Matrix Representation).

Bra-Ket Representation

A quantum state is represented by a vector on a complex-valued Hilbert space. In Bra-Ket notation, a quantum state denoted $|\psi\rangle$ is referred to as a ket and is simply understood as a column vector. Each ket has an associated dual vector known as a bra. A bra is may be represented by a row vector and can be constructed from a ket via Hermitian adjoint, $\langle\psi| = (|\psi\rangle)^{\dagger}$.

It is essential that a quantum states are normalized, $\langle\psi|\psi\rangle = 1$, where $\langle \; | \; \rangle$ denotes the inner product (dot product) between bra and ket.

The States module provides a validation method, is_ket() for checking whether a vector satisfies the requirements for being a quantum state ket.

QBase.States.is_ketFunction
is_ket( ψ :: Vector ) :: Bool

Returns true if vector ψ is a valid ket representation of a quamtum state:

  • ψ is a real or complex-valued vector.
  • ψ is normalized with respect to the bra-ket inner prodcut (ψ' * ψ == 0).
source

Ket Types

QBase.States.AbstractKetType
AbstractKet <: AbstractVector{Complex{Float64}}

The abstract type representing a quantum state ket. Since kets are contained within a complex-valued hilbert space, they are appropriately AbstractVector{Complex{Float64}} subtypes. An AbstractKet cannot be instantiated, it serves as a supertype from which ket types are defined.

An AbstractKet subtype may be operated upon by a AbstractUnitary subtype to produce a new Ket.

*( U :: Unitaries.AbstractUnitary, ψ :: AbstractKet) :: Ket
source

The States module provides two concrete subtypes of AbstractKet:

QBase.States.KetType
Ket( ψ :: Vector{Complex{Float64}} ) <: AbstractKet

A ket representation of a general quantum state. When given invalid input, the constructor, Ket(ψ), throws:

  • DomainError - If ψ is not normalized.
  • MethodError - If ψ is not a column vector ([a,b,c] or [a;b;c])
source
QBase.States.QubitKetType
QubitKet( ψ :: Vector{Complex{Float64}} ) <: AbstractKet

A ket representation of a 2-dimensional quantum state. When given invalid input, the constructor, QubitKet(ψ), throws:

  • DomainError - If ψ is not normalized.
  • MethodError - If ψ is not a column vector.
source

Ket Constructors

QBase.States.basis_ketsFunction
basis_kets( dim :: Int64 ) :: Vector{Ket}

The computation basis vectors for a hilbert space of dimension, dim.

source
QBase.States.bell_ketsConstant
bell_kets :: Vector{Ket}

The Bell basis kets, ordered as $\{|\Phi^+\rangle, |\Phi^-\rangle, |\Psi^+\rangle, |\Psi^-\rangle \}$, where

\[\begin{matrix} |\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle), & |\Phi^-\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle), \\ |\Psi^+\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle), & |\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle). \\ \end{matrix}\]
source
QBase.States.generalized_bell_ketsFunction
generalized_bell_kets( dim :: Int64 ) :: Vector{Ket}

The Bell basis for quantum states of dimension dim. Each state is constructed by

\[|\Psi^p_c\rangle = \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1} e^{i2\pi pj/d}|j\rangle |mod(j+c,d)\rangle\]

where $p,c\in 0,\cdots, (d-1)$ and $d$ is dim. When iterated $c$ is the major index and $p$ is the minor index.

A DomainError is thrown if dim ≥ 2 is not satisfied.

source

Singlet States

QBase.States.bloch_qubit_ketFunction
bloch_qubit_ket( θ :: Real, ϕ :: Real ) :: QubitKet

Returns the qubit ket for the specified spherical coordinate on the surface of bloch sphere, (r=1, θ, ϕ). If the state does not have a complex phase then

bloch_qubit_ket( θ :: Real ) :: QubitKet

can be used to construct the state.

Inputs:

  • θ ∈ [0, 2π]: polar angle (w.r.t z-axis)
  • ϕ ∈ [0, 2π]: azimuthal angle (x-y plane)

A DomainError is thrown if inputs θ and/or ϕ do are not within the valid range.

source

Triplet States

QBase.States.trine_qubit_ketsConstant
trine_qubit_kets :: Vector{QubitKet}

The triplet of kets representing three quantum states separated by equal angles in the z-x plane of bloch sphere.

julia> States.trine_qubit_kets == [[1.0, 0], [0.5, sqrt(3)/2], [0.5, -sqrt(3)/2]]
true
source
QBase.States.mirror_symmetric_qubit_ketsFunction
mirror_symmetric_qubit_kets( θ :: Real ) :: Vector{QubitKet}

Returns the triplet of qubit kets in the z-x plane of bloch sphere. The first ket is $|0\rangle$ and the other two are symmetric across the z-axis.

Input:

  • θ ∈ [0,π/2]: the hilbert space angle between |0> and symmetric kets.
source
QBase.States.planar_symmetric_qubit_ketsFunction
planar_symmetric_qubit_kets( n :: Int64 ) :: Vector{QubitKet}

Constructs a set of QubitKet states oriented symmetrically in the x-z-plane. Each state is separated by a bloch angle of 2π/n. The states are constructed with the form

\[|\psi_j \rangle = \cos(j \pi/n) | 0\rangle + \sin(j \pi/n)|1\rangle\]

where $j \in 0,\cdots, (n-1)$.

A DomainError is thrown if

source

Density Matrix Representation

Quantum states can be represented in matrix form.

QBase.States.DensityMatrixType
DensityMatrix( ρ :: Matrix{Complex{Float64}} ) <: AbstractDensityMatrix

The density matrix representation of a quantum state. The constructor, DensityMatrix(ρ) throws a DomainError if is_density_matrix(ρ) is false.

Base methods extended to use the DensityMatrix type:

  • QMath.partial_trace - Returns DensityMatrix if supplied with one.
  • Base.kron - The kronecker product of two density matrices is a DensityMatrix.
source
QBase.States.QubitType
Qubit( ρ :: Matrix{Complex{Float64}} ) <: AbstractDensityMatrix

The 2x2 density matrix representation of a qubit. The constructor, Qubit(ρ) throws a DomainError if is_density_matrix(ρ) is false or if ρ is not 2x2 in dimension.

source

Density Matrix Constructors

The density matrix $\rho$ can be constructed from ket $|\psi\rangle$ by taking the outer-product of the ket with itself, $|\psi\rangle\langle\psi| = \rho$.

QBase.States.pure_stateFunction
pure_state( ψ :: AbstractKet ) :: Qubit

A state is considered "pure" if it is rank-one. A rank-one density matrix is constructed by taking the outer-product of a ket state.

The method alternatively accepts a Vector input.

pure_state( ψ :: Vector ) :: Qubit

A DomainError is thrown if ψ is not a valid ket.

source
QBase.States.pure_qubitFunction
pure_qubit( ψ :: AbstractKet ) :: Qubit

A qubit is considered "pure" if it is rank-one. A rank-one density matrix is constructed by taking the outer-product of a ket state.

The method alternatively accepts a Vector input.

pure_qubit( ψ :: Vector ) :: Qubit

A DomainError is thrown if ψ is not a valid ket.`

source
QBase.States.basis_statesFunction
basis_states( dim :: Int64 ) :: Vector{DensityMatrix}

The density matrices for the computational basis of dimension, dim.

source

The rank of the density matrix can be greater than 1. If a density matrix has rank greater than one, we call the state mixed.

QBase.States.mixed_stateFunction
mixed_state(
    priors :: QMath.Marginals,
    ρ_states :: Vector{<:AbstractDensityMatrix}
) :: DensityMatrix

Constructs the statistical mixture (weighted average) of quantum states. The method accepts states as type DensityMatrix or subbtypes AbstractDensityMatrix.

source
QBase.States.mixed_qubitFunction
mixed_qubit( priors :: QMath.Marginals, ρ_states :: Vector{Qubit} ) :: Qubit

Constructs the statistical mixture (weighted average) of qubits.

source
QBase.States.bloch_qubitFunction

Returns the qubit density matrix for quantum state described by a coordinate on bloch sphere.

Spherical Coordinates:

States on the surface of bloch sphere may be described by spherical coordinates.

bloch_qubit(θ::Real, ϕ::Real) :: Qubit
  • θ ∈ [0, π]: polar angle (w.r.t z-axis).
  • ϕ ∈ [0, 2π]: azimuthal angle (x-y plane)

Cartesian Coordinates:

States within the volume of bloch sphere may be described in cartesian coordinates.

bloch_qubit(x::Real, y::Real, z::Real) :: Qubit
  • where x, y, and z are constrained to the unit sphere, 0 <= norm([x,y,z]) <= 1.

A DomainError is thrown if the coordinates (x,y,z) do not adhere to constraints.

source

Triplets

QBase.States.mirror_symmetric_qubitsFunction
mirror_symmetric_qubits( θ ::  Real ) :: Vector{Qubit}

Returns a set of 3 mirror symmetric qubit density matrices. The first state is $|0\rangle\langle 0|$ the other two are symmetric about the $|0\rangle$ axis.

Input:

  • θ ∈ [0,π/2]: the hilbert space angle between $|0\rangle$ and $|\psi_{2/3}\rangle$.
source

Quadruplets

QBase.States.sic_qubitsConstant
sic_qubits :: Vector{Qubit}

The quadruplet of symmetric informationally complete (SIC) qubits. The qubits are the vertices of a tetrahedron inscribed on bloch sphere.

julia> States.sic_qubits
4-element Array{QBase.States.Qubit,1}:
 [1.0 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 0.0 + 0.0im]
 [0.33333333333333337 + 0.0im 0.47140452079103173 + 0.0im; 0.47140452079103173 + 0.0im 0.6666666666666666 + 0.0im]
 [0.33333333333333337 + 0.0im -0.2357022603955158 - 0.4082482904638631im; -0.2357022603955158 + 0.4082482904638631im 0.6666666666666666 + 0.0im]
 [0.33333333333333337 - 0.0im -0.2357022603955158 + 0.4082482904638631im; -0.2357022603955158 - 0.4082482904638631im 0.6666666666666666 - 0.0im]
source
QBase.States.bb84_qubitsConstant
bb84_qubits :: Vector{Qubit}

The quadruplet of qubits used in the BB84 Quantum Key Distribution protocol. The states are $|0\rangle\langle 0|$, $|1\rangle\langle 1|$, $|+\rangle\langle +|$, and $|- \rangle\langle -|$.

julia> States.bb84_qubits
4-element Array{QBase.States.Qubit,1}:
 [1.0 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 0.0 + 0.0im]
 [0.0 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 1.0 + 0.0im]
 [0.5 + 0.0im 0.5 + 0.0im; 0.5 + 0.0im 0.5 + 0.0im]
 [0.5 + 0.0im -0.5 + 0.0im; -0.5 + 0.0im 0.5 + 0.0im]
source