BlochSphereBigFloat.jl Documentation
Requirements
This package requires the CoordinateSystems.jl package to be installed.
Installation
] add git@github.com:Fhoeddinghaus/BlochSphereBigFloat.jl.git
or
] add https://github.com/Fhoeddinghaus/BlochSphereBigFloat.jl.git
PulseSequenceRandomizedRotations submodule
This packages contains a submodule PulseSequenceRandomizedRotations
that provides functions to simulate and visualize randomized rotation sequences on the Bloch sphere. See the PulseSequenceRandomizedRotations documentation for more details.
Index
BlochSphereBigFloat.PulseSequenceRandomizedRotations
BlochSphereBigFloat.PauliX
BlochSphereBigFloat.PauliY
BlochSphereBigFloat.PauliZ
BlochSphereBigFloat.SingleQubitState
BlochSphereBigFloat.StereographicCoordinates
Base.convert
Base.convert
Base.convert
Base.getproperty
Base.iterate
Base.length
Base.propertynames
Base.show
BlochSphereBigFloat.BlochVec
BlochSphereBigFloat.PulseSequenceRandomizedRotations.animate_sequence_path
BlochSphereBigFloat.PulseSequenceRandomizedRotations.overlap_by_sequence
BlochSphereBigFloat.PulseSequenceRandomizedRotations.overlap_by_sequence_threaded
BlochSphereBigFloat.PulseSequenceRandomizedRotations.plot_sequence_path
BlochSphereBigFloat.PulseSequenceRandomizedRotations.plot_sequence_path_triple
BlochSphereBigFloat.PulseSequenceRandomizedRotations.seq2vals
BlochSphereBigFloat.PulseSequenceRandomizedRotations.states_by_sequence
BlochSphereBigFloat.PulseSequenceRandomizedRotations.states_by_sequence_threaded
BlochSphereBigFloat.PulseSequenceRandomizedRotations.vals2sequence
BlochSphereBigFloat.Rx
BlochSphereBigFloat.Ry
BlochSphereBigFloat.Rz
BlochSphereBigFloat.ep
BlochSphereBigFloat.interpolate_path
BlochSphereBigFloat.numdigits
BlochSphereBigFloat.pBloch
BlochSphereBigFloat.pBloch
BlochSphereBigFloat.plot_axis_arrow
BlochSphereBigFloat.projection
BlochSphereBigFloat.projection
BlochSphereBigFloat.projection
BlochSphereBigFloat.projection
BlochSphereBigFloat.projection
BlochSphereBigFloat.projection
BlochSphereBigFloat.setup_blochplot
BlochSphereBigFloat.setup_doubleplot
BlochSphereBigFloat.setup_tripleplot
API
BlochSphereBigFloat.PauliX
— ConstantPauliX
The Pauli-X matrix.
BlochSphereBigFloat.PauliY
— ConstantPauliY
The Pauli-Y matrix.
BlochSphereBigFloat.PauliZ
— ConstantPauliZ
The Pauli-Z matrix.
BlochSphereBigFloat.SingleQubitState
— Typemutable struct SingleQubitState <: StaticArrays.FieldVector{2, Complex{BigFloat}}
Defines a single qubit state in the form |ψ⟩ = a|0⟩ + b|1⟩, where ψ = (a,b)ᵀ. The state is normalized and the global phase is adjusted such that Im(a) == 0. The state can be constructed from complex numbers, real numbers, or vectors of complex or real numbers. The state is represented as a StaticArrays.FieldVector
of length 2 with complex BigFloat elements.
BlochSphereBigFloat.StereographicCoordinates
— Typemutable struct StereographicCoordinates{ST <: Union{PolarCoordinates, PlanarCoordinates, Complex}} <: Coordinates{BigFloat, 2}
Defines a mutable struct StereographicCoordinates
that represents coordinates in the stereographic projection of a sphere. It can store coordinates in different forms: as polar coordinates, planar coordinates, or as a complex number. The struct also includes a sign field sgnZ
to indicate the hemisphere of the original point, independent of the pole of projection.
Base.convert
— Methodfunction Base.convert(::Type{StereographicCoordinates{Complex}}, s::StereographicCoordinates{ST}) where ST
Converts a StereographicCoordinates
object s
of type ST
to a StereographicCoordinates{Complex}
object.
Base.convert
— Methodfunction Base.convert(::Type{StereographicCoordinates{PlanarCoordinates}}, s::StereographicCoordinates{ST}) where ST
Converts a StereographicCoordinates
object s
of type ST
to a StereographicCoordinates{PlanarCoordinates}
object.
Base.convert
— Methodfunction Base.convert(::Type{StereographicCoordinates{PolarCoordinates}}, s::StereographicCoordinates{ST}) where ST
Converts a StereographicCoordinates
object s
of type ST
to a StereographicCoordinates{PolarCoordinates}
object.
Base.getproperty
— Methodfunction Base.getproperty(p::StereographicCoordinates, i::Symbol)
Retrieves the property i
from the StereographicCoordinates
object p
. If i
is :data
or :sgnZ
, it returns the corresponding field. If i
is a property of the underlying data type, it retrieves that property. Otherwise, it raises an error.
Base.iterate
— Methodfunction Base.iterate(p::StereographicCoordinates{ST}, state::Int64=1) where {ST <: Union{PolarCoordinates, PlanarCoordinates, Complex}}
Iterates over the StereographicCoordinates
object p
.
Base.length
— Methodfunction Base.length(p::StereographicCoordinates{ST}) where {ST <: Union{PolarCoordinates, PlanarCoordinates, Complex}}
Returns the length of the StereographicCoordinates
object p
, which is 2 for complex coordinates and 3 for polar or planar coordinates.
Base.propertynames
— Methodfunction Base.propertynames(p::StereographicCoordinates)
Returns the property names of the StereographicCoordinates
object p
, including :data
and :sgnZ
, as well as the property names of the underlying data type.
Base.show
— Methodfunction Base.show(io::IO, s::SingleQubitState)
Displays the SingleQubitState
in a human-readable format, showing the type and values of the state.
BlochSphereBigFloat.BlochVec
— Methodfunction BlochVec(s::SingleQubitState)::SpatialCoordinates{BigFloat}
Calculates the Bloch vector representation of a single qubit state s
.
BlochSphereBigFloat.Rx
— MethodRotation operator on ℂ² around x-axis (in Bloch picture) by angle `β`.
BlochSphereBigFloat.Ry
— MethodRotation operator on ℂ² around y-axis (in Bloch picture) by angle `β`.
BlochSphereBigFloat.Rz
— MethodRotation operator on ℂ² around z-axis (in Bloch picture) by angle `γ`.
BlochSphereBigFloat.ep
— Methodep(x::Vector) = exp(-im/2 * sum(x * P))
Calculates the matrix exponential e^(-im/2 * ∑ xᵢ⋅Pauliᵢ)
for a vector x
where Pauli[X,Y,Z]
are the Pauli matrices.
BlochSphereBigFloat.interpolate_path
— Functioninterpolate_path(state::SingleQubitState, ϕ::Real, Rot::Function, N::Int=50)
Interpolates a path of N
states starting from state
by applying the single qubit operator Rot
with parameter ϕ/N
for N
steps. The function returns a vector of SingleQubitState
objects representing the interpolated states.
BlochSphereBigFloat.numdigits
— Methodnumdigits()
Returns the number of digits of the current precision for BigFloat
numbers, which is determined by the machine epsilon. The precision can be adjusted using setprecision(BigFloat, num_bits)
for num_bits
bits.
BlochSphereBigFloat.pBloch
— Functionfunction pBloch(ax, s::Vector{SingleQubitState}, arrow=true; alphamin=1, eyepos = false, kwargs...)
Plots a vector of single qubit states s
on the Bloch sphere in the 3D scene ax
as Bloch vectors. See pBloch
for a single state.
BlochSphereBigFloat.pBloch
— Functionfunction pBloch(ax, s::SingleQubitState, arrow=true; alphamin=1, eyepos = false, kwargs...)
Plots a single qubit state s
on the Bloch sphere in the 3D scene ax
as a Bloch vector. If arrow
is true, it plots an arrow representing the Bloch vector; otherwise, it plots a point. The alphamin
parameter controls the minimum alpha transparency of the arrow or point based on the distance from the camera. kwargs
get passed to the plotting function (e.g. arrows3d!
or scatter!
).
BlochSphereBigFloat.plot_axis_arrow
— Methodfunction plot_axis_arrow(ax, P_rot; linewidth=0.01, color=:blue)
Plots an axis arrow in the 3D scene ax
at the origin pointing in the direction of the vector P_rot
.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{SingleQubitState}, s::StereographicCoordinates)
Projects a point from StereographicCoordinates
to SingleQubitState
.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{SpatialCoordinates}, s::StereographicCoordinates)
Projects a point from StereographicCoordinates
to SpatialCoordinates
.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{SphereCoordinates}, s::StereographicCoordinates)
Projects a point from StereographicCoordinates
to SphereCoordinates
.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{StereographicCoordinates}, point::SingleQubitState; proj=:north)
Projects a point from SingleQubitState
to StereographicCoordinates
using the specified projection pole (proj
). The proj
argument can be one of :top
, :north
, :topdown
, :n
, :t
, +1
for the northern hemisphere, or :bottom
, :south
, :bottomup
, :s
, :b
, -1
for the southern hemisphere. The special cases :both
and :abs
will automatically determine the hemisphere based on the point's polar angle.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{StereographicCoordinates}, point::SpatialCoordinates; proj=:north)
Projects a point from SpatialCoordinates
to StereographicCoordinates
using the specified projection pole (proj
). The proj
argument can be one of :top
, :north
, :topdown
, :n
, :t
, +1
for the northern hemisphere, or :bottom
, :south
, :bottomup
, :s
, :b
, -1
for the southern hemisphere. The special cases :both
and :abs
will automatically determine the hemisphere based on the point's polar angle.
BlochSphereBigFloat.projection
— Methodfunction projection(::Type{StereographicCoordinates}, point::SphereCoordinates; proj=:north)
Projects a point from SphereCoordinates
to StereographicCoordinates
using the specified projection pole (proj
). The proj
argument can be one of :top
, :north
, :topdown
, :n
, :t
, +1
for the northern hemisphere, or :bottom
, :south
, :bottomup
, :s
, :b
, -1
for the southern hemisphere. The special cases :both
and :abs
will automatically determine the hemisphere based on the point's polar angle.
BlochSphereBigFloat.setup_blochplot
— Methodfunction setup_blochplot(;size=(500,500), fig=false, eyepos = [3,3,2], show_axis=true, outlines_only=false, scenekw=(limits=Rect(-1,-1,-1,2,2,2),), _unusedkwargs...)
Sets up a 3D Bloch sphere plot with optional outlines instead of 3D mesh and camera controls.
BlochSphereBigFloat.setup_doubleplot
— Methodfunction setup_doubleplot(;size=(1500, 1200))
Sets up a double plot with a Bloch sphere plot and a stereographic projection plot.
BlochSphereBigFloat.setup_tripleplot
— Methodfunction setup_tripleplot(;size=(1500, 1200))
Sets up a triple plot with a Bloch sphere plot, a stereographic projection plot for the north pole, and a stereographic projection plot for the south pole.