States

A quantum state is represented by a density operator. This matrix describes the wave function of the quantum system.

QBase.is_density_matrixFunction
is_density_matrix( ρ :: Matrix; atol=ATOL :: Float64 ) :: Bool

Returns true if ρ is a valid density matrix. The following constraints must be satisfied for all density matrices:

  • Hermitian: ρ' == ρ
  • Positive Semidefinite: eigmin(ρ) ≥ 0
  • Trace-one: tr(ρ) == 1
source
QBase.StateType
State( ρ :: Matrix{T<:Number} ) <: Operator{T}

The density matrix representation of a quantum state. The constructor, State(ρ) throws a DomainError if is_density_matrix evaluates to false.

source

State Operations

Base.kronMethod
kron(states :: Vararg{State}; atol=ATOL :: Float64) :: State

Performs the kronecker product on the supplied states to construct a new State: $\rho_A \otimes \rho_B = \rho_{AB}.$

This method extends Base.kron.

source
QBase.partial_traceMethod
partial_trace(ρ::State, system::Vector{Int64}, id::Int64) :: State

Takes the partialtrace of a State ρ to construct a new State: ``\text{Tr}B[\rho{AB}] = \rhoA``.

source
LinearAlgebra.eigvalsMethod
eigvals(ρ :: State) :: Vector{Float64}

Computes the eigenvalues of State ρ. The eigenvalues of a density matrix are real. A DomainError is thrown if the imaginary component of any eigenvalues exceeds the absolute tolerance ρ.atol. This method extends LinearAlgebra.eigvals.

source
QBase.is_pureFunction
is_pure(ρ :: State) :: Bool

Returns true if ρ is pure, i.e. rank(ρ) == 1 within the absolute tolerance ρ.atol. This method can also be used on Matrix types.

is_pure(ρ :: Matrix; atol=ATOL :: Float64) :: Bool
source
QBase.is_mixedFunction
is_mixed(ρ :: State) :: Bool

Returns true if ρ is mixed, i.e. rank(ρ) > 1 within the absolute tolerance ρ.atol. This method also can be used on Matrix types.

is_mixed(ρ :: Matrix; atol=ATOL :: Float64) :: Bool
source

State Constructors

Singlet States

QBase.pure_stateFunction
pure_state( ψ :: Ket; atol=ATOL :: Float64 ) :: State
pure_state( ψ :: Bra; atol=ATOL :: Float64 ) :: State

A State is "pure" if it is rank-one (see is_pure). A rank-one density matrix is constructed by taking the outer-product of a Ket (or Bra) with itself, $|\psi\rangle\langle \psi| = \rho$. This method alternatively accepts Vector inputs.

pure_state( ψ :: Vector ) :: State
pure_state( ψ :: Adjoint{T,Vector{T}} where T; atol=ATOL :: Float64 ) :: State
source
QBase.mixed_stateFunction
mixed_state(
    priors :: Probabilities,
    states :: Vector{<:State};
    atol=ATOL :: Float64
) :: State

Constructs the statistical mixture (weighted average) of quantum states. This method can also be used Vector and Matrix types which satisfy the requirements of is_probability_distribution and is_density_matrix respectively.

mixed_state(
    priors :: AbstractVector,
    states :: Vector{<:AbstractMatrix}
) :: State

A DomainError is thrown if the provided Vectors of priors or states do not satisfy their respective requirements.

source
QBase.bloch_qubit_stateFunction

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

Spherical Coordinates:

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

bloch_qubit_state(θ::Real, ϕ::Real) :: State{Complex{Float64}}
  • θ ∈ [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_state(x::Real, y::Real, z::Real) :: State{Complex{Float64}}
  • 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

Ensemble States

QBase.mirror_symmetric_qubit_statesFunction
mirror_symmetric_qubit_states( θ ::  Real ) :: Vector{State{Float64}}

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. See mirror_symmetric_qubit_kets.

Input:

  • θ ∈ [0,π/2]: the hilbert space angle between $|0\rangle$ and $|\psi_{2/3}\rangle$.
source
QBase.sic_qubit_statesFunction
sic_qubit_states :: Vector{State{Complex{Float64}}}

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

source
QBase.bb84_qubit_statesFunction
bb84_qubit_states :: Vector{State}

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 -|$. See bb84_qubit_kets.

source