DiracNotation.diracFunction
dirac(state::MixedState, statename::String="ρ"; header::Bool=false)
dirac(io::IO, state::MixedState, ldims::Vector{Int}, rdims::Vector{Int}, statename::String="ρ"; header::Bool=false)

Display a matrix as Dirac notation.

Example

julia> using Random; Random.seed!(0);

julia> op1 = randn(Complex{Float64}, 2,2);

julia> dirac(op1)
ρ = (0.480201+0.585777im)|0⟩⟨0|+(0.414801+0.210248im)|0⟩⟨1|+(-0.249614-0.0953561im)|1⟩⟨0|+(0.0459249-0.0770869im)|1⟩⟨1|

julia> op2 = randn(Complex{Float64}, 4,3);

julia> dirac(op2, [2,2], [3])
ρ = (-0.363602+1.11322im)|00⟩⟨0|+(-1.1365-1.75419im)|00⟩⟨1|+(0.197612+0.078787im)|00⟩⟨2|+(-0.487131-0.539384im)|01⟩⟨0|+(1.60954+0.155347im)|01⟩⟨1|+(-0.253062+0.334967im)|01⟩⟨2|+(0.281063+0.573909im)|10⟩⟨0|+(-0.0828287-0.42515im)|10⟩⟨1|+(0.212297-0.539294im)|10⟩⟨2|+(-0.24491-0.132634im)|11⟩⟨0|+(0.807711-0.0626612im)|11⟩⟨1|+(1.00625+0.288773im)|11⟩⟨2|
DiracNotation.diracFunction
dirac(state::PureState, statename::String="ψ"; header::Bool=false)
dirac(io::IO, state::PureState, dims::Vector{Int}, statename::String="ψ"; header::Bool=false)

Display a vector as Dirac notation.

Example

julia> using Random; Random.seed!(0);

julia> dirac(randn(Complex{Float64}, 2))
|ψ⟩ = (0.480201+0.585777im)|0⟩+(-0.249614-0.0953561im)|1⟩

julia> qutrit = rand(Complex{Float64},3);

julia> dirac(qutrit, [3])
|ψ⟩ = (0.27888+0.203477im)|0⟩+(0.0423017+0.0682693im)|1⟩+(0.361828+0.973216im)|2⟩

dirac(qubitqutrit, [2,3])
|ψ⟩ = (-0.487131-0.539384im)|00⟩+(0.281063+0.573909im)|01⟩+(-0.24491-0.132634im)|02⟩+(-1.1365-1.75419im)|10⟩+(1.60954+0.155347im)|11⟩+(-0.0828287-0.42515im)|12⟩
DiracNotation.ind2NaryMethod
ind2Nary(n::Int, dims::Vector{Int})

Arguments

• n::Int: n th row(column) of qudit/operator array.
• dims::Vector{Int}: N-ary array
DiracNotation.print_diracFunction
print_dirac(io::IO, state::PureState, dims::Vector{Int}, statename::String="ψ")
print_dirac(io::IO, state::MixedState,
ldims::Vector{Int},
rdims::Vector{Int},
statename::String="ρ") where T <: Number
DiracNotation.print_dirac_termMethod
print_dirac_term(io::IO, idx::Int, value::T, dims::Vector{Int}, isfirstterm=false) where T
print_dirac_term(io::IO, row::Int, col::Int,
value::T, ldims::Vector{Int}, rdims::Vector{Int}, isfirstterm=false) where T
DiracNotation.set_propertiesMethod
set_properties(; kw...)

Arguments

• precision::Int.
• islatex::Bool. true -> rendered by mathjax on IJulia
• displayall::Bool. true -> display all terms.
• numhead: Display the first part of terms. Default is 5 terms.
• newline::Bool.
• imag_suffix::String.