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

API

BlochSphereBigFloat.SingleQubitStateType
mutable 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.

source
BlochSphereBigFloat.StereographicCoordinatesType
mutable 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.

source
Base.convertMethod
function Base.convert(::Type{StereographicCoordinates{Complex}}, s::StereographicCoordinates{ST}) where ST

Converts a StereographicCoordinates object s of type ST to a StereographicCoordinates{Complex} object.

source
Base.convertMethod
function Base.convert(::Type{StereographicCoordinates{PlanarCoordinates}}, s::StereographicCoordinates{ST}) where ST

Converts a StereographicCoordinates object s of type ST to a StereographicCoordinates{PlanarCoordinates} object.

source
Base.convertMethod
function Base.convert(::Type{StereographicCoordinates{PolarCoordinates}}, s::StereographicCoordinates{ST}) where ST

Converts a StereographicCoordinates object s of type ST to a StereographicCoordinates{PolarCoordinates} object.

source
Base.getpropertyMethod
function 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.

source
Base.iterateMethod
function Base.iterate(p::StereographicCoordinates{ST}, state::Int64=1) where {ST <: Union{PolarCoordinates, PlanarCoordinates, Complex}}

Iterates over the StereographicCoordinates object p.

source
Base.lengthMethod
function 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.

source
Base.propertynamesMethod
function 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.

source
Base.showMethod
function Base.show(io::IO, s::SingleQubitState)

Displays the SingleQubitState in a human-readable format, showing the type and values of the state.

source
BlochSphereBigFloat.BlochVecMethod
function BlochVec(s::SingleQubitState)::SpatialCoordinates{BigFloat}

Calculates the Bloch vector representation of a single qubit state s.

source
BlochSphereBigFloat.epMethod
ep(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.

source
BlochSphereBigFloat.interpolate_pathFunction
interpolate_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.

source
BlochSphereBigFloat.numdigitsMethod
numdigits()

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.

source
BlochSphereBigFloat.pBlochFunction
function 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.

source
BlochSphereBigFloat.pBlochFunction
function 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!).

source
BlochSphereBigFloat.plot_axis_arrowMethod
function 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.

source
BlochSphereBigFloat.projectionMethod
function projection(::Type{SingleQubitState}, s::StereographicCoordinates)

Projects a point from StereographicCoordinates to SingleQubitState.

source
BlochSphereBigFloat.projectionMethod
function projection(::Type{SpatialCoordinates}, s::StereographicCoordinates)

Projects a point from StereographicCoordinates to SpatialCoordinates.

source
BlochSphereBigFloat.projectionMethod
function projection(::Type{SphereCoordinates}, s::StereographicCoordinates)

Projects a point from StereographicCoordinates to SphereCoordinates.

source
BlochSphereBigFloat.projectionMethod
function 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.

source
BlochSphereBigFloat.projectionMethod
function 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.

source
BlochSphereBigFloat.projectionMethod
function 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.

source
BlochSphereBigFloat.setup_blochplotMethod
function 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.

source
BlochSphereBigFloat.setup_tripleplotMethod
function 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.

source