Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
IncompleteLU = "40713840-3770-5561-ab4c-a76e7d0d7895"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
Expand Down Expand Up @@ -52,7 +51,6 @@ GPUArrays = "10, 11"
Graphs = "1.7"
IncompleteLU = "0.2"
KernelAbstractions = "0.9.2"
LaTeXStrings = "1.2"
LinearAlgebra = "1"
LinearSolve = "2, 3"
Makie = "0.20, 0.21, 0.22"
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ end
DocMeta.setdocmeta!(QuantumToolbox, :DocTestSetup, doctest_setup; recursive = true)

# some options for `makedocs`
const DRAFT = false # set `true` to disable cell evaluation
const DOCTEST = true # set `false` to skip doc tests
const DRAFT = get(ENV, "DRAFT", false) == "true" # set `true` to disable cell evaluation
const DOCTEST = get(ENV, "DOCTEST", true) == "true" # set `false` to skip doc tests

# generate bibliography
bib = CitationBibliography(
Expand Down
19 changes: 10 additions & 9 deletions ext/QuantumToolboxMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import Makie:
surface!,
barplot!,
GridPosition,
@L_str,
Reverse,
ylims!,
RGBAf,
Expand All @@ -28,7 +27,8 @@ import Makie:
RGBf,
Vec3f,
Point3f,
NoShading
NoShading,
latexstring

@doc raw"""
plot_wigner(
Expand Down Expand Up @@ -417,7 +417,7 @@ function _draw_bloch_sphere!(b::Bloch, ax)
base_color = parse(RGBf, b.sphere_color)
sphere_color = RGBAf(base_color, b.sphere_alpha)
sphere_mesh = Sphere(Point3f(0), radius)
mesh!(ax, sphere_mesh; color = sphere_color, shading = NoShading, transparency = true)
mesh!(ax, sphere_mesh; color = sphere_color, shading = NoShading, transparency = true, rasterize = 3)
θ_vals = range(0.0f0, 2π, length = n_lon + 1)[1:(end-1)]
φ_curve = range(0.0f0, π, length = 600)
line_alpha = max(0.05, b.sphere_alpha * 0.5)
Expand Down Expand Up @@ -644,6 +644,7 @@ function _plot_vectors!(b::Bloch, ax)
linewidth = b.vector_width,
arrowsize = arrowsize_vec,
arrowcolor = color,
rasterize = 3,
)
end
end
Expand All @@ -665,7 +666,7 @@ function _add_labels!(b::Bloch, ax)
if !isempty(b.xlabel) && !isempty(b.xlabel[1])
text!(
ax,
L"\textbf{x}",
latexstring(b.xlabel[1]),
position = Point3f(0, -offset_scale * b.xlpos[1], 0),
color = label_color,
fontsize = label_size,
Expand All @@ -675,7 +676,7 @@ function _add_labels!(b::Bloch, ax)
if length(b.xlabel) > 1 && !isempty(b.xlabel[2])
text!(
ax,
L"\textbf{-x}",
latexstring(b.xlabel[2]),
position = Point3f(0, -offset_scale * b.xlpos[2], 0),
color = label_color,
fontsize = label_size,
Expand All @@ -685,7 +686,7 @@ function _add_labels!(b::Bloch, ax)
if !isempty(b.ylabel) && !isempty(b.ylabel[1])
text!(
ax,
L"\textbf{y}",
latexstring(b.ylabel[1]),
position = Point3f(offset_scale * b.ylpos[1], 0, 0),
color = label_color,
fontsize = label_size,
Expand All @@ -695,7 +696,7 @@ function _add_labels!(b::Bloch, ax)
if length(b.ylabel) > 1 && !isempty(b.ylabel[2])
text!(
ax,
L"\textbf{-y}",
latexstring(b.ylabel[2]),
position = Point3f(offset_scale * b.ylpos[2], 0, 0),
color = label_color,
fontsize = label_size,
Expand All @@ -705,7 +706,7 @@ function _add_labels!(b::Bloch, ax)
if !isempty(b.zlabel) && !isempty(b.zlabel[1])
text!(
ax,
L"\mathbf{|0\rangle}",
latexstring(b.zlabel[1]),
position = Point3f(0, 0, offset_scale * b.zlpos[1]),
color = label_color,
fontsize = label_size,
Expand All @@ -715,7 +716,7 @@ function _add_labels!(b::Bloch, ax)
if length(b.zlabel) > 1 && !isempty(b.zlabel[2])
text!(
ax,
L"\mathbf{|1\rangle}",
latexstring(b.zlabel[2]),
position = Point3f(0, 0, offset_scale * b.zlpos[2]),
color = label_color,
fontsize = label_size,
Expand Down
1 change: 0 additions & 1 deletion src/QuantumToolbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import Distributed: RemoteChannel
import FFTW: fft, ifft, fftfreq, fftshift
import Graphs: connected_components, DiGraph
import IncompleteLU: ilu
import LaTeXStrings: @L_str
import Pkg
import Random: AbstractRNG, default_rng, seed!
import SpecialFunctions: loggamma
Expand Down
12 changes: 6 additions & 6 deletions src/visualization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ A structure representing a Bloch sphere visualization for quantum states.
- `view::Tuple{Int,Int}}`: Azimuthal and elevation viewing angles in degrees (default: (-60, 30))

## Label properties
- `xlabel::Vector{AbstractString}}`: Labels for x-axis (default: [L"x", ""])
- `xlabel::Vector{String}}`: Labels for x-axis (default: [raw"$x$", ""])
- `xlpos::Vector{Float64}}`: Positions of x-axis labels (default: [1.0, -1.0])
- `ylabel::Vector{AbstractString}}`: Labels for y-axis (default: [L"y", ""])
- `ylabel::Vector{String}}`: Labels for y-axis (default: [raw"$y$", ""])
- `ylpos::Vector{Float64}}`: Positions of y-axis labels (default: [1.0, -1.0])
- `zlabel::Vector{AbstractString}}`: Labels for z-axis (default: [L"|0\rangle", L"|1\rangle"])
- `zlabel::Vector{String}}`: Labels for z-axis (default: [raw"$|0\rangle$", raw"$|1\rangle$"])
- `zlpos::Vector{Float64}}`: Positions of z-axis labels (default: [1.0, -1.0])
"""
@kwdef mutable struct Bloch
Expand All @@ -139,11 +139,11 @@ A structure representing a Bloch sphere visualization for quantum states.
vector_width::Float64 = 0.025
vector_arrowsize::NTuple{3,Real} = (0.07, 0.08, 0.08)
view::Tuple{Int,Int} = (-60, 30)
xlabel::Vector{AbstractString} = [L"x", ""]
xlabel::Vector{String} = [raw"$x$", raw""]
xlpos::Vector{Float64} = [1.0, -1.0]
ylabel::Vector{AbstractString} = [L"y", ""]
ylabel::Vector{String} = [raw"$y$", ""]
ylpos::Vector{Float64} = [1.0, -1.0]
zlabel::Vector{AbstractString} = [L"|0\rangle", L"|1\rangle"]
zlabel::Vector{String} = [raw"$|0\rangle$", raw"$|1\rangle$"]
zlpos::Vector{Float64} = [1.0, -1.0]
end

Expand Down
Loading