States
A quantum state is represented by a density operator. This matrix describes the wave function of the quantum system.
QBase.is_density_matrix — Functionis_density_matrix( ρ :: Matrix; atol=ATOL :: Float64 ) :: BoolReturns 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
QBase.State — TypeState( ρ :: 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.
State Operations
Base.kron — Methodkron(states :: Vararg{State}; atol=ATOL :: Float64) :: StatePerforms the kronecker product on the supplied states to construct a new State: $\rho_A \otimes \rho_B = \rho_{AB}.$
This method extends Base.kron.
QBase.partial_trace — Methodpartial_trace(ρ::State, system::Vector{Int64}, id::Int64) :: StateTakes the partialtrace of a State ρ to construct a new State: ``\text{Tr}B[\rho{AB}] = \rhoA``.
LinearAlgebra.eigvals — Methodeigvals(ρ :: 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.
QBase.is_pure — Functionis_pure(ρ :: State) :: BoolReturns 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) :: BoolQBase.is_mixed — Functionis_mixed(ρ :: State) :: BoolReturns 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) :: BoolState Constructors
Singlet States
QBase.pure_state — Functionpure_state( ψ :: Ket; atol=ATOL :: Float64 ) :: State
pure_state( ψ :: Bra; atol=ATOL :: Float64 ) :: StateA 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 ) :: StateQBase.mixed_state — Functionmixed_state(
priors :: Probabilities,
states :: Vector{<:State};
atol=ATOL :: Float64
) :: StateConstructs 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}
) :: StateA DomainError is thrown if the provided Vectors of priors or states do not satisfy their respective requirements.
QBase.bloch_qubit_state — FunctionReturns 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, andzare 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.
Ensemble States
QBase.computational_basis_states — Functioncomputational_basis_states( dim :: Int64 ) :: Vector{State}The set of density matrices constructed from the computational_basis_vectors with dimension, dim.
QBase.bell_states — Functionbell_states() :: Vector{State{Float64}}The Bell basis density matrices. See bell_kets for more details.
QBase.generalized_bell_states — Functiongeneralized_bell_states( dim :: Int64 ) :: Vector{State{ComplexF64}The generalized Bell basis density matrices. See generalized_bell_kets for more details. A DomainError is thrown if dim ≥ 2 is not satisfied.
QBase.planar_symmetric_qubit_states — Functionplanar_symmetric_qubit_states( n :: Int64 ) :: Vector{State{Float64}}Constructs a set of pure States oriented symmetrically in the x-z-plane. See planar_symmetric_qubit_kets for details.
QBase.trine_qubit_states — Functiontrine_qubit_states() :: Vector{State{Float64}}Returns the qubit trine states in density matrix form. See trine_qubit_kets.
QBase.mirror_symmetric_qubit_states — Functionmirror_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$.
QBase.sic_qubit_states — Functionsic_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.
QBase.bb84_qubit_states — Functionbb84_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.