diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 43e45aab9..0d7b7e88e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -53,6 +53,7 @@ jobs: - 'lib/BloqadeSchema' - 'lib/BloqadeWaveforms' - 'lib/YaoSubspaceArrayReg' + - 'lib/BloqadeNoisy' steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_coherentnoise_rabi.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_coherentnoise_rabi.png new file mode 100644 index 000000000..1ba4d0dbc Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_coherentnoise_rabi.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_depol_dists.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_depol_dists.png new file mode 100644 index 000000000..a2189a0e0 Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_depol_dists.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_depolarizingrabi.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_depolarizingrabi.png new file mode 100644 index 000000000..7d0281cc8 Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_depolarizingrabi.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_fidelitymeasures.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_fidelitymeasures.png new file mode 100644 index 000000000..1efd323ea Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_fidelitymeasures.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_manybodyscar.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_manybodyscar.png new file mode 100644 index 000000000..54c03b870 Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_manybodyscar.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_numberdensity.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_numberdensity.png new file mode 100644 index 000000000..d7a189a28 Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_numberdensity.png differ diff --git a/docs/src/assets/BloqadeNoisy_tutorial/noisy_whitepapercomparison.png b/docs/src/assets/BloqadeNoisy_tutorial/noisy_whitepapercomparison.png new file mode 100644 index 000000000..20fbb1ab2 Binary files /dev/null and b/docs/src/assets/BloqadeNoisy_tutorial/noisy_whitepapercomparison.png differ diff --git a/examples/8.simulating noise/Project.toml b/examples/8.simulating noise/Project.toml new file mode 100644 index 000000000..a132f592a --- /dev/null +++ b/examples/8.simulating noise/Project.toml @@ -0,0 +1,12 @@ +[deps] +Bloqade = "bd27d05e-4ce1-5e79-84dd-c5d7d508bbe1" +CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" +DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" +Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" +ProgressBars = "49802e3a-d2f1-5c88-81d8-b72133a6f568" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +Yao = "5872b779-8223-5990-8dd0-5abbb0748c8c" diff --git a/examples/8.simulating noise/main.jl b/examples/8.simulating noise/main.jl new file mode 100644 index 000000000..7d499ca4a --- /dev/null +++ b/examples/8.simulating noise/main.jl @@ -0,0 +1,454 @@ +# # [Simulating Noise](@id blockade) + +# ## Background +# +# ### The Lindblad master equation +# Open quantum systems in the limit of ultraweak coupling to a Markovian bath can be modelled using the Lindblad master equation: +# ```math +# \frac{\partial \rho}{\partial t} = i[\rho, \mathcal H_{eff}] + \sum_{k}\gamma_k L_k\rho L_k^\dagger +# `` +# where `` \mathcal H_{eff}`` is the effective Hamiltonian, `` L_k`` are the quantum jump operators, and `` \gamma_k`` are the jump rates. The jump operators describe the coupling to the bath, and they are without loss of generality taken to be traceless. The effective Hamiltonian is non-Hermitian and is related to the closed-system Hamiltonian ``\mathcal H`` via ``\mathcal H_{eff} = \mathcal H-\frac{i}{2}\sum_{k}\gamma_k L_k^\dagger L_k``. +# +# ### Stochastic wavefunction method +# The infinitesimal form of this channel can be put into Kraus map form as +# ```math +# \rho(t+dt) = (1-i dt \mathcal H_{eff})\rho(t) (1+i dt \mathcal H_{eff}) + dt\sum_{k}\gamma_k L_k \rho(t) L_k^\dagger +# `` +# This corresponds to a quantum jump `` L_k`` with probability `` dp_k = dt\gamma_k\operatorname{Tr}(L_k \rho L_k^\dagger)``. If `` \rho = |\psi\rangle\langle \psi|``is a (normalized) pure state, then +# `` dp_k = dt \gamma_k \Vert L_k|\psi\rangle\Vert^2``, the norm of the state after undergoing the quantum jump. With probability `` 1-dp`` where `` dp = \sum_k dp_k`` is the total probability of experencing a quantum jump, the system evolves to ``(1-i dt \mathcal H_{eff})\rho (1+i dt \mathcal H_{eff}) \approx \rho + i dt[\rho, \mathcal H_{eff}]``. This corresponds to the normal Liouville-Von Neumann equation with the non-Hermitian effective Hamiltonian ``\mathcal H_{eff}``. The physical interpretation of this is that an absence of a quantum jump also has an affect on the system evolution. +# +# These dynamics can be modeled stochastically by chopping the evolution into small intervals `` dt``. At each time step, the state `` |\psi\rangle`` evolves to `` \frac{1}{\mathcal N}(1-idt\mathcal H_{eff})|\psi \rangle`` +# with probability ``1-dp`` and evolves to ``\frac{1}{\mathcal N}L_k |\psi \rangle`` with probability ``dp_k``, where ``\frac{1}{\mathcal N}`` is the appropriate normalization. Performing this stochastic evolution results in a single trajectory consisting of a number of random quantum jumps at random times. Averaging over ``j \in \{1,...,m\}`` trajectories results in an ensemble of state ``|\psi_j(t)\rangle``, and averaging ``|\psi_j\rangle\langle\psi_j|`` over these trajectories converges to the density matrix ``\rho`` produced by the master equation in the limit as ``m\to \infty``. +# +# ### Stochastic wavefunction algorithm +# In practice, directly simulating the stochastic process described above is computationally inefficient. Noticing that +# ```math +# \Vert(1-idt\mathcal H_{eff})|\psi \rangle\Vert^2 = 1 - dt\sum_k \gamma_k\langle \psi| L_k^\dagger L_k |\psi\rangle = 1 - dp \ , +# ``` +# the change in the wavefunction norm over an interval of coherent evolution is related to the accumulation of probability `` p`` of experiencing a quantum jump. The result is the following algorithm: +# 1. Choose a random number `` r`` +# 2. Evolve according to `` \frac{\partial}{\partial t}|\psi\rangle = -i\mathcal H_{eff}|\psi\rangle`` without normalizing the state +# 3. When `` \Vert |\psi\rangle \Vert^2 = r``, trigger a quantum jump `` k`` according to the distribution `` p_k \equiv dp_k/\sum_k dp_k`` and normalize +# +# ### Further reading +# For a more in-depth description of the algorithm, please refer to refs. [1,2]. + +using BloqadeNoisy + +using Bloqade +using Yao +using CSV +using DataFrames +using JSON +using LaTeXStrings +using LinearAlgebra +using Plots +using StatsBase +using Printf +using ProgressBars +pythonplot() + + +# ## Noisy Single-Qubit Rabi Oscillations + +# ### Solution to the master equation +# First, we observe the effect that incoherent depolarizing noise has on the Rabi oscillations of a single qubit. A depolarizing channel is modelled by collapse operators +# ``X, Y, `` and `` Z`` which occur with the a uniform rate ``\gamma``, as expressed in the following master equation +# ```math +# \rho(t+dt) = (1-idt\mathcal H)\rho(t)(1+idt H) + dt\gamma (X \rho(t) X + Y \rho(t) Y + Z \rho(t) Z-3\rho(t)) +# ``` +# Using the identity `` 2I = \rho + X\rho X + Y\rho Y + Z \rho Z`` for arbitrary `` \rho``, we can write +# ```math +# \rho(t+dt) = (1-idt\mathcal H') \rho(t) (1+idt \mathcal H') + 4\gamma dt\frac{I}{2} +# ``` +# where ``\mathcal H' = \mathcal H - 4i\gamma``. This corresponds to ``\rho`` undergoing coherent evolution according to +# ``\mathcal H'`` with probability `` 1-4\gamma dt`` and being replaced with the completely mixed state +# with probability `` 4\gamma dt``. Since all trace-preserving quantum channels stabilize the maximally mixed state, +# the evolution can be modeled as a continuous-time Markov chain transitioning between coherent evolution +# ``|\psi(t)\rangle`` and the mixed state `` \frac{I}{2}`` with probability `` 4\gamma dt p_I(t)``, where `` p_I(t)`` +# is the probability that the system is already in the mixed state. Integrating this probability over time gives ``p_I(t) = 1-e^{-4\gamma t}``. Therefore we can write down the solution +# ```math +# \rho(t) = e^{-4\gamma t}|\psi(t)\rangle\langle\psi(t)| + (1-e^{-4\gamma t})\frac{I}{2} +# ```math +# Where ``|\psi\rangle`` is evolved via the Schrodinger equation and normalized. Solving the Schrodinger equation for a +# time-independent `` \mathcal H'`` gives `` |\psi(t)\rangle = e^{-i\mathcal Ht}e^{-4\gamma t}|\psi\rangle``. Normalizing +# this state gets rid of the exponential decay factor, leaving `` |\psi(t)\rangle\rangle = e^{-i\mathcal Ht}|\psi\rangle``, +# corresponding to coherent evolution by the original Hamiltonian `` \mathcal H``. +# +# Consider the Hamiltonian ``\mathcal H = \frac{\Omega}{2}X`` and an initial state ``|\psi\rangle = |0\rangle``. +# The time-evolution operator is ``e^{-iXt\Omega/2} = \cos(\frac{\Omega}{2}t) -i\sin(\frac{\Omega}{2}t)X``, +# and so the state evovles in time to ``|\psi(t)\rangle = \cos(\frac{\Omega}{2}t)|0\rangle - i\sin(\frac{\Omega}{2}t)|1\rangle``. +# The expectation value of the number operator ``\hat n`` is then ``\langle \hat n(t) \rangle_\psi = \sin^2(\frac{\Omega}{2}t)``. +# Plugging this into the master equation solution, in a noisy channel the evolution is +# ```math +# \langle \hat n(t) \rangle = e^{-4\gamma t}\langle \hat n(t) \rangle_\psi + (1-e^{-4\gamma t})\frac{1}{2}\operatorname{Tr}(\hat n) = \frac{1}{2} - \frac{1}{2}e^{-4\gamma t}\cos(\Omega t) +# ``` +# Like an underdamped harmonic oscillator, the value oscillates around an equilibrium value of ``1/2`` with an envelope that decays +# exponentially in time. +# +# ### Simulation in Bloqade +# In BloqadeNoisy, the `NoisySchrodingerProblem` plays the same role as the `SchrodingerProblem` in Bloqade, and `emulate_noisy` plays the same role as `emulate!`. The `NoisySchrodingerProblem` is constructed using the following arguments: +# 1. initial state +# 2. list of times to save the solution +# 3. noiseless Hamiltonian +# 4. list of collapse operators. The rate is absorbed into the operators, so ``L_k`` becomes ``\sqrt{\gamma_k}L_k``. +# +# `emulate` is called with the problem and the number of trajectories. Additional arguments can be a list of operators to take expectation values. Calling `emulate` with `report_error = true` will return a set of estimates of error by computing the standard deviation of the expectation values over the trajectories. Lastly, choices for the `ensemble_algo` argument are `EnsembleSerial()`, `EnsembleThreads()`, or `EnsembleDistributed()` for different levels of parallelization. + +Ω = 2π +γ = 0.1 + +c_ops = sqrt(γ) .* mat.([X, Y, Z]) #collapse operators +e_ops = [mat(Op.n)] #expectation values + +h = rydberg_h([(0.0,)]; Ω = Ω) +save_times = LinRange(0, 10, 200) + +#Construct noisy problem +prob = NoisySchrodingerProblem( + zero_state(1), + save_times, + h, + c_ops +) + +sol = emulate_noisy( + prob, 2000, e_ops; + ensemble_algo = EnsembleThreads(), + report_error = true +) + +plot( + save_times, + sol.expectations[1], + ribbon = sol.twosigma[1], + title = "Noisy Rabi Oscillation", + xlabel = "Rabi periods", + ylabel = L"\langle \hat n \rangle", + label = "simulated" +) +plot!( + save_times, + 1/2 .- 1/2*exp.(-4γ * save_times) .* cos.(Ω * save_times), + label = "analytic" +) +ylims!(0,1) + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_depolarizingrabi.png") + +# ## Coherent noise in neutral atom simulators +# One of the advantages of neutral atoms is that they couple weakly to their environment. This means that incoherent noise is supressed. A more dominant source of noise is due to imperfect control, which causes fluctuation the Rabi power ``\Omega``, detuning ``\Delta``, and atoms positions ``\vec r_{ij}`` between shots. This is referred to as "coherent" noise because it preserves the coherence over a single shot, but averaging over many shots still produces a mixed state. This noise afffects the system globally and is distinct from noise due to coupling to a bath. +# +# To model this affect, we consider ``\Omega`` distributed according to ``G(\Omega) = \frac{1}{\sqrt{2\pi\sigma^2}}e^{-(\Omega - \bar \Omega)^2/2\sigma^2}``. Let the Hamiltonian again be ``\mathcal H = \frac{\Omega}{2}X``. The noiseless evolution of ``\langle Z \rangle`` is then ``\langle Z(t) \rangle = \cos(\Omega t)``. We then average ``\langle Z \rangle`` over the distribution in ``\Omega``: +# ```math +# \overline{\langle Z \rangle} = \frac{1}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^{\infty}\cos(\Omega t)e^{-(\Omega-\bar\Omega)^2/2\sigma^2} d\Omega = \cos(\bar \Omega t)e^{-2\sigma^2t^2/4} +# ``` +# Thus we see where incoherent noise results in an exponential envelope, coherent noise results in a Gaussian envelope. This result holds generally. Combining this with the result from pure depolarizing noise, we obtain an envelope in the form of an exponentially modified Gaussian: +# ```math +# \langle Z(t)\rangle = \cos(\bar \Omega t)e^{-\sigma^2t^2/2 - 4\gamma t} +# ``` +# +# ### Implementation in BloqadeNoisy +# +# The stochastic wavefunction method allows for this experimental setting to be modelled by varying the parameters in the Hamiltonian between trajectories. In BloqadeNoisy, this is represented as a method which takes a Hamiltonian and returns another method that can be called to generate random samples. The levels of coherent, incoherent, and readout noise are contained in an `ErrorModel` object, which is constructed using +# 1. A method that takes a number of atoms and returns a confusion matrix +# 2. A method that takes a number of atoms and returns a set of collapse operators +# 3. A method that accepts a Hamiltonian and returns a method to generate random samples + +γ = .01 +σ = .1 * 2π +Ω = 2π +h = rydberg_h([(0.0,)]; Ω = Ω) +times = LinRange(0,5,400) + +#construct error model +em = ErrorModel( + n->I, + n->[sqrt(γ) * mat(op) for op in [X, Y, Z]], #depolarizing noise + h->(()->rydberg_h( + [(0.0,)]; + Ω = Ω + σ*randn()) + ) #G(Ω) +) + +prob = NoisySchrodingerProblem(zero_state(1), times, h, em) +sim = emulate_noisy(prob, 2000, [mat(Z)]; report_error = true); + +plot( + times, sim.expectations[1], ribbon = sim.twosigma[1], + label = "simulated", ylabel = L"\langle Z \rangle", + xlabel = "Rabi periods", title = "Coherent noise" +) +plot!( + times, + (t->cos(Ω*t)*exp.(-σ^2*t^2/2 - 4γ*t)).(times), + label = "analytic" +) + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_coherentnoise_rabi.png") + +# ## Noise on Aquila +# Aquila's noise model was calibrated using experimental data, and the parameters that are modelled are the following: +# +# | Parameter | Desc. | Default value | +# | ---------- | ----- | ------------- | +# | ``\delta \Omega/\langle \Omega \rangle`` | Relative global Rabi drive fluctation | 0.018 (dim.) | +# | ``\delta \Omega_i / \langle \Omega \rangle`` | Relative local Rabi drive fluctation | 0.008 (dim.) | +# | ``\delta \Delta`` | Global detuning fluctuation | ``0.18 \ (rad / \mu s)`` | +# | ``\delta \Delta_i`` | Global detuning fluctuation | ``0.50 \ (rad / \mu s)`` | +# | ``\delta r_x, \delta r_y`` | Lattice site position uncertainty | ``0.05 \ \mu m`` | +# | ``\tau_{relaxation}`` | Relaxation time | ``100 \ \mu s`` | +# | ``\tau_{dephasing}`` | Dephasing time | ``50 \ \mu s`` | +# +# In addition, the affect of readout noise can also be modelled using BloqadeNoisy. Readout error in neutral atom simulators is highly local, so it can be modeled as a problility ``p_{0 \to 1}`` and ``p_{1 \to 0}`` of confusing ``|0\rangle`` and ``|1 \rangle`` and vice-versa. +# +# +# | Parameter | Desc. | Default value | +# | ---------- | ----- | ------------- | +# | ``p_{0 \to 1}`` | Probability of confusing 0 with 1 | 0.01 | +# | ``p_{1 \to 0}`` | Probability of confusing 1 with 0 | 0.08 | +# +# The effect of readout error can be modelled by a confusion matrix of the form ``C = \begin{pmatrix} 1-p_{01} & p_{10} \\ p_{01} & 1-p_{10} \end{pmatrix}^{\otimes N}``. This transforms the output probability distribution from ``p(z)`` to ``\tilde p(z) = \sum_{x} C_{zx}p(x)``, which affects the sampled bitstrings and expectation values of operators estimated from the machine. +# +# ### Using Aquila noise model +# BloqadeNoisy makes Aquila's noise model available to use. It is constructed by calling `Aquila()` and is passed as the fourth argument to `emulate_noisy`. + +# ### Experimental validation +# The experimental data used to calibrate the noise model is taken from the Aquila whitepaper [3]. Readout error can be added to expectation values in the computational basis by passing `readout = true` to `emulate`. The operators must be of type `Diagonal`. Below, we show the estimation of a noisy expectation value incorporating the effect of readout error and compare to the experimental whitepaper data. + +whitepaper_data = CSV.read("/Bloqade.jl/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_long.csv", DataFrame, delim = ",", header = false) +times = collect(whitepaper_data[1,:]) +data = collect(whitepaper_data[2,:]) +save_times = LinRange(0, last(times), 400) + +Ω = 15.3 +Δ = 0 +H = rydberg_h([(0.0,)]; Ω = Ω, Δ = Δ) + +prob = NoisySchrodingerProblem(zero_state(1), save_times, H, Aquila()) +sim = emulate_noisy(prob, 1000, [mat(Op.n)]; readout_error = true); + +plot(times, data, marker = :diamond, + markersize = 4, color = :green, linestyle = :dash, + xlabel = L"t \ (\mu s)", ylabel = L"\langle \hat n \rangle", + label = "Data", title = "Simulation vs Data" +) +plot!(save_times, sim[1], color = :blue, label = "Sim") + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_whitepapercomparison.png") + +# The `Aquila()` method is shorthand for `load_error_model(JSON.parse(AQUILA))`. The `AQUILA` string is a JSON dictionary containing the preconfigured noise model, and this syntax allows the noise model to be modified. + +default_error_model = JSON.parse(AQUILA) +dephasing_rate = 1/10 +default_error_model["incoherent"]["dephasing rate"] = dephasing_rate + +#create error model based on Aquila +new_error_model = load_error_model(default_error_model); + +# ### Simulated scar experiment +# +# Many-body scars are product states that have a large overlap with a tower of eigenstates exhibiting atypical properties such as low entanglement. Ref [4] studies the scarring properties of the PXP model, given by the Hamiltonian +# ```math +# \mathcal H_{\text{PXP}} = \sum_{i}P_iXP_i + \mu \sum_{i}\hat n_i +# ``` +# where ``P_i = \bigotimes_{\langle j, i \rangle}|0_i\rangle\langle 0_i|``, with ``\langle j, i\rangle`` running over the nearest neighbors of ``i``, and ``\mu`` is the chemical potential. Scarring is observed when states fail to thermalize, i.e. exectation values exhibit long-lived dynamic revivals. The PXP model can be approximately realized in a Rydberg atom array by operating in the blockaded subspace and tuning ``\Delta`` to cancel the mean-field contribution of the next-nearest-neighbor Van der Waals interactions. +# +# BloqadeNoisy allows for estimation of expectation values at a fixed number of shots to emulate an experimental setting. We can use this to predict what a many-body scar experiment on Aquila would look like. Following [4], we first adiabatically prepare the ground state of the PXP model with a chemical potential ``\mu_i = -0.76`` and then a quench to ``\mu = 1.6``. + +Ω = 2π +C = 862690 * 2π +Rb = (C/Ω)^(1/6) +N = 14 + +atoms = generate_sites(ChainLattice(), N, scale = .65*Rb) +Δ_NNN = 1/(2N) * sum( + [ + (r=norm(atoms[i] .- atoms[j]); + r > Rb ? C/r^6 : 0) + for i in 1:N for j in 1:N + ] +) + +μ_i = -.76 * 2π +μ_f = 1.6 * 2π + +t1 = 2 #adiabatic prep time +t2 = 2 #quench time + +Δ_ad = piecewise_linear(clocks = [0, t1], values = [-40*2π, Δ_NNN - μ_i]) +Δ_quench = piecewise_constant(clocks = [0, t2], values = [Δ_NNN - μ_f]) +Δ = append(Δ_ad, Δ_quench) + +times = LinRange(t1, t1+t2, 200) +H = rydberg_h(atoms; Ω = Ω, Δ = Δ) +ψ = solve( + SchrodingerProblem(zero_state(N), t1+t2, H; + save_on = true, saveat = times, save_start = false + ), + DP8() +); + +expt_times = LinRange(t1, t1+t2, 70) +prob = NoisySchrodingerProblem(zero_state(N), expt_times, H, Aquila()) +@time sim = emulate_noisy(prob, 500, [mat(chain(igate(N)-put(N, i=>Op.n) for i in 1:N))]; + readout_error = true, report_error = true, shots = 1000, + ensemble_algo = EnsembleThreads() +) + +plot(times, [abs(p[1])^2 for p in ψ.u], + label = "ideal", + color = :blue, title = "Many-body scar simulation" +) +scatter!(expt_times, sim.expectations, + yerr = sqrt.(sim.shot_error[1].^2 .+ sim.propagated_err[1].^2), + xlabel = L"t \ (\mu s)", + ylabel = L"\langle (1-\hat n)^{\otimes N}\rangle", + label = "noisy", color = :red, +) + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_manybodyscar.png") + +# ## Manybody Fidelity +# A Haar-random pure state ``|\psi\rangle`` from a Hilbert space with dimension ``D = 2^N`` produces probability amplitudes ``p(z) = |\langle z |\psi\rangle|^2`` that are distributed exponentially according to the Porter-Thomas distribution ``P_1(p) = De^{-Dp}`` in the limit of large ``D``. Haar-random sates are produced by chaotic quantum evolution, which we can achieve by randomly spacing ``N`` atoms and choosing ``\Omega(t)`` to be strong relative to the coupling and vary sufficiently over the interval. Under the influence of noise, the evolution can be desribed by +# ```math +# \rho(t) = F|\psi(t)\rangle \langle \psi(t)| + (1-F(t))\chi +# ``` +# where ``\chi`` is a density matrix with ``r(z) = \langle z|\chi|z\rangle`` strongly peaked around ``1/D``, approximately ``P_2(r) = \delta(z-\frac{1}{D})``. The probability ``q(z) = \langle z|\rho|z\rangle`` is thus distributed according to the convolution +# ```math +# P_3(q) = \int_0^{q}\frac{1}{1-F}\delta\left(\frac{z}{1-F}-\frac{1}{D}\right)\frac{1}{F}De^{-D(q-z)/F}dz = \begin{cases} +# 0 & q < (1-F)/D\\ +# \frac{D}{F}e^{(1-F)/F}e^{-Dq/F} & \text{otherwise} +# \end{cases} +# ``` +# This distribution is the one described in [5]. +# +# We consider single-atom depolarizing noise at a rate ``\gamma``, and we take ``F(t)`` to be the probability that no error has occurred after time ``t``. Since there are ``3N`` possible errors ocurring at a rate ``\gamma``, we find ``F(t) = 1-e^{-3N\gamma t}``. +# +# ### Implementation in Bloqade +# First, we set up a Hamiltonian and simulate noiseless evolution: + +tend = 10 +Ω = Waveform(t-> 2.5*2π*(sin(sqrt(10)*2π*t)+cos(sqrt(2)*2π*t)), tend) +R = (862690/2.5)^(1/6) + +N = 12 +D = 2^N +atoms = [(R*i+.05*randn(),) for i in 1:N] + +h = rydberg_h(atoms; Ω = Ω) + +ψ = solve(SchrodingerProblem(zero_state(N), tend, h), DP8()).u[end] + +# First, we construct a single-atom depolarizing model on ``N`` qubits. Then, we repeat the simulation with different depolarizing rates. The `emulate` method can take a function of the solution to save. We save two quantities: the probability amplitudes ``|\langle z | \psi \rangle |^2`` and the fidelity ``F = \langle \psi| \rho |\psi \rangle``. + +depol(γ, N) = [sqrt(γ)*mat(put(N, i=>op)) for i in 1:N for op in [X,Y,Z]] +function sim_depol(γ) + prob = NoisySchrodingerProblem( + zero_state(N), + [0.0,tend], + h, + depol(γ, N) + ) + sim = emulate_noisy(prob, 1000, + sol -> [ + abs.(sol[end]).^2, + abs(sol[end]' * ψ)^2 + ]; + ensemble_algo = EnsembleThreads() + ) + (simulation_series_mean(sim), + simulation_series_err(sim)) +end +depol_strengths = [.002, .004, .006] +p = [sim_depol(γ) for γ in depol_strengths]; + +# Lastly, we create a histogram of the probability amplitudes from the simulation for each level of depolarizing noise, and compare against the prediction: + +colors = [:blue, :green, :purple] + +plot(xlabel = L"p", ylabel = L"P(p)", title = "Probability distribution vs noise strength") +stephist!(abs.(ψ).^2, yaxis =:log, normalize =true, color = :black, label = "γ = 0") +plot!(x->D*exp(-D*x), 0, .002, color = :black, linestyle = :dash, label = "") + +for (p, c, r) in zip(p, colors, depol_strengths) + F = exp(-r * 3N * tend) + stephist!(p[1][1], yaxis =:log, normalize =true, color = c, label = "γ = $(@sprintf("%.3f", r))") + plot!(x->D/F*exp((1-F)/F)*exp(-D* x/F), (1-F)/D, .002, color = c, linestyle = :dash, label = "") + plot!([(1-F)/D, (1-F)/D], [0, D/F], color = c, linestyle = :dash, label = "") +end + +ylims!(10, 2f4) +xlims!(0, .0015) + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_depol_dists.png") + +# We can examine three different measures of fidelity: First, we have the actual state fidelity ``F = \langle \psi | \rho |\psi \rangle`` which is saved in the simulation. Next, we have the prediction from the depolarizing model ``F = e^{-3N\gamma t}``. Lastly, there is another quantity called the linear cross-entropy which acts as a proxy for the fidelity with chaotic Hamiltonians. The cross entropy is defined +# ```math +# \text{XEB} = \langle D^2 p(z)q(z) - 1\rangle +# ``` +# where ``p(z) = |\langle z | \psi \rangle|^2`` and ``q(z) = \langle z | \rho |z \rangle``. Using the form from above ``\rho = F|\psi\rangle \langle \psi| + (1-F)\chi``, we see that +# ```math +# \langle p(z) q(z) \rangle = F\langle p^2(z)\rangle + (1-F)\langle p(z) r(z) \rangle +# ``` +# Using the fact that ``P_1(p) = De^{-Dp}`` and ``P_2(r) = \delta(r-1/N)``, we compute +# ```math +# \langle p^2(z)\rangle = D\int_0^\infty p^2e^{-Dp}dp = \frac{2}{D^2} +# ``` +# and +# ```math +# \langle p(z) r(z) \rangle = D\int_0^\infty\int_0^\infty p\delta(r-\frac{1}{D})e^{-Dp/r}dpdr = \frac{1}{D^2} +# ``` +# Substituting these in gives ``\text{XEB} = D^2(2/D^2)F + D^2(1-F)/D^2 - 1 = F``. Thus all three quantities estimate ``F``. + +plot(depol_strengths, [p[i][1][2] for i in 1:3], title = "Depolarizing fidelity and cross-entropy", xlabel = L"\gamma", ylabel = "fidelity", label = L"F", yerr = [p[i][2][2] for i in 1:3]) +plot!(depol_strengths, exp.(-3N * tend .* depol_strengths), label = L"e^{-3\gamma N T}") +plot!(depol_strengths, [(2^N*sum(p[i][1][1] .* abs.(ψ).^2)-1) for i in 1:3], label = "XEB") + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_fidelitymeasures.png") + +# ## Memory constraints +# When simulating large systems, memory can be an issue. The `NoisySchrodingerProblem` can also be used directly with the `DifferentialEquations` interface to simulate each trajectory manually if more control is required. The `randomize` function reinitializes the trajectory with a new sample from the specified distirbution of Hamiltonian parameters and chooses a random initial condition. + +R = (862690/2.5)^(1/6) +atoms = generate_sites(SquareLattice(), 4, 4, scale = .85*R) +N = length(atoms) +tend = 3.0 +Ω = 2.5*2π + +h = rydberg_h(atoms; Ω = Ω, Δ = 0) + +ψ = solve(SchrodingerProblem(zero_state(N), tend, h), DP8()).u; + +p = zeros(2^N) +ntraj = 250 +prob = NoisySchrodingerProblem(zero_state(N), [tend], h, Aquila()) +for i in ProgressBar(1:ntraj) + sample = randomize(prob) + int = init(sample, DP8()) + solve!(int) + p .+= abs.(int.u).^2/ntraj +end + +scatter( + [real(ψ[end]' * mat(put(N, i=>Op.n)) * ψ[end]) for i in 1:N], + marker = :circle, markersize = 6, title = "Noisy vs noiseless excitation number", + xlabel = "site #", + ylabel = L"\langle \hat n_i \rangle", + label = "ideal" + ) +scatter!([expectation_value_noisy(Aquila(), p, mat(put(N, i=>Op.n))) for i in 1:N], marker = :square, markersize = 6, label = "noisy") +ylims!(0,1) + +# ![BloqadeNoisy]("../../../assets/BloqadeNoisy_tutorial/noisy_numberdensity.png") + +# ## References & Further Reading +# [1] https://qutip.org/docs/latest/guide/dynamics/dynamics-monte.html +# +# [2] https://lukin.physics.harvard.edu/files/lukin/files/physics_285b_lecture_notes.pdf (Chapter 6) +# +# [3] Wurtz, J. et al. (2023). Aquila: QuEra's 256-qubit neutral-atom quantum computer. arXiv preprint arXiv:2306.11727. +# +# [4] Daniel, Aiden, et al. "Bridging quantum criticality via many-body scarring." Physical Review B 107.23 (2023): 235108. +# +# [5] Boixo, Sergio, et al. "Characterizing quantum supremacy in near-term devices." Nature Physics 14.6 (2018): 595-600. diff --git a/lib/BloqadeNoisy/.gitignore b/lib/BloqadeNoisy/.gitignore new file mode 100644 index 000000000..4837dcbe6 --- /dev/null +++ b/lib/BloqadeNoisy/.gitignore @@ -0,0 +1,3 @@ +/.vscode/ +Manifest.toml +LocalPreferences.toml \ No newline at end of file diff --git a/lib/BloqadeNoisy/LICENSE b/lib/BloqadeNoisy/LICENSE new file mode 100644 index 000000000..d03bdce10 --- /dev/null +++ b/lib/BloqadeNoisy/LICENSE @@ -0,0 +1,180 @@ +The Bloqade.jl package is licensed under the Apache License, Version 2.0: + +> Copyright (c) 2022 QuEra Computing Inc.. +> +> Apache License +> Version 2.0, January 2004 +> http://www.apache.org/licenses/ +> +> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION +> +> 1. Definitions. +> +> "License" shall mean the terms and conditions for use, reproduction, +> and distribution as defined by Sections 1 through 9 of this document. +> +> "Licensor" shall mean the copyright owner or entity authorized by +> the copyright owner that is granting the License. +> +> "Legal Entity" shall mean the union of the acting entity and all +> other entities that control, are controlled by, or are under common +> control with that entity. For the purposes of this definition, +> "control" means (i) the power, direct or indirect, to cause the +> direction or management of such entity, whether by contract or +> otherwise, or (ii) ownership of fifty percent (50%) or more of the +> outstanding shares, or (iii) beneficial ownership of such entity. +> +> "You" (or "Your") shall mean an individual or Legal Entity +> exercising permissions granted by this License. +> +> "Source" form shall mean the preferred form for making modifications, +> including but not limited to software source code, documentation +> source, and configuration files. +> +> "Object" form shall mean any form resulting from mechanical +> transformation or translation of a Source form, including but +> not limited to compiled object code, generated documentation, +> and conversions to other media types. +> +> "Work" shall mean the work of authorship, whether in Source or +> Object form, made available under the License, as indicated by a +> copyright notice that is included in or attached to the work +> (an example is provided in the Appendix below). +> +> "Derivative Works" shall mean any work, whether in Source or Object +> form, that is based on (or derived from) the Work and for which the +> editorial revisions, annotations, elaborations, or other modifications +> represent, as a whole, an original work of authorship. For the purposes +> of this License, Derivative Works shall not include works that remain +> separable from, or merely link (or bind by name) to the interfaces of, +> the Work and Derivative Works thereof. +> +> "Contribution" shall mean any work of authorship, including +> the original version of the Work and any modifications or additions +> to that Work or Derivative Works thereof, that is intentionally +> submitted to Licensor for inclusion in the Work by the copyright owner +> or by an individual or Legal Entity authorized to submit on behalf of +> the copyright owner. For the purposes of this definition, "submitted" +> means any form of electronic, verbal, or written communication sent +> to the Licensor or its representatives, including but not limited to +> communication on electronic mailing lists, source code control systems, +> and issue tracking systems that are managed by, or on behalf of, the +> Licensor for the purpose of discussing and improving the Work, but +> excluding communication that is conspicuously marked or otherwise +> designated in writing by the copyright owner as "Not a Contribution." +> +> "Contributor" shall mean Licensor and any individual or Legal Entity +> on behalf of whom a Contribution has been received by Licensor and +> subsequently incorporated within the Work. +> +> 2. Grant of Copyright License. Subject to the terms and conditions of +> this License, each Contributor hereby grants to You a perpetual, +> worldwide, non-exclusive, no-charge, royalty-free, irrevocable +> copyright license to reproduce, prepare Derivative Works of, +> publicly display, publicly perform, sublicense, and distribute the +> Work and such Derivative Works in Source or Object form. +> +> 3. Grant of Patent License. Subject to the terms and conditions of +> this License, each Contributor hereby grants to You a perpetual, +> worldwide, non-exclusive, no-charge, royalty-free, irrevocable +> (except as stated in this section) patent license to make, have made, +> use, offer to sell, sell, import, and otherwise transfer the Work, +> where such license applies only to those patent claims licensable +> by such Contributor that are necessarily infringed by their +> Contribution(s) alone or by combination of their Contribution(s) +> with the Work to which such Contribution(s) was submitted. If You +> institute patent litigation against any entity (including a +> cross-claim or counterclaim in a lawsuit) alleging that the Work +> or a Contribution incorporated within the Work constitutes direct +> or contributory patent infringement, then any patent licenses +> granted to You under this License for that Work shall terminate +> as of the date such litigation is filed. +> +> 4. Redistribution. You may reproduce and distribute copies of the +> Work or Derivative Works thereof in any medium, with or without +> modifications, and in Source or Object form, provided that You +> meet the following conditions: +> +> (a) You must give any other recipients of the Work or +> Derivative Works a copy of this License; and +> +> (b) You must cause any modified files to carry prominent notices +> stating that You changed the files; and +> +> (c) You must retain, in the Source form of any Derivative Works +> that You distribute, all copyright, patent, trademark, and +> attribution notices from the Source form of the Work, +> excluding those notices that do not pertain to any part of +> the Derivative Works; and +> +> (d) If the Work includes a "NOTICE" text file as part of its +> distribution, then any Derivative Works that You distribute must +> include a readable copy of the attribution notices contained +> within such NOTICE file, excluding those notices that do not +> pertain to any part of the Derivative Works, in at least one +> of the following places: within a NOTICE text file distributed +> as part of the Derivative Works; within the Source form or +> documentation, if provided along with the Derivative Works; or, +> within a display generated by the Derivative Works, if and +> wherever such third-party notices normally appear. The contents +> of the NOTICE file are for informational purposes only and +> do not modify the License. You may add Your own attribution +> notices within Derivative Works that You distribute, alongside +> or as an addendum to the NOTICE text from the Work, provided +> that such additional attribution notices cannot be construed +> as modifying the License. +> +> You may add Your own copyright statement to Your modifications and +> may provide additional or different license terms and conditions +> for use, reproduction, or distribution of Your modifications, or +> for any such Derivative Works as a whole, provided Your use, +> reproduction, and distribution of the Work otherwise complies with +> the conditions stated in this License. +> +> 5. Submission of Contributions. Unless You explicitly state otherwise, +> any Contribution intentionally submitted for inclusion in the Work +> by You to the Licensor shall be under the terms and conditions of +> this License, without any additional terms or conditions. +> Notwithstanding the above, nothing herein shall supersede or modify +> the terms of any separate license agreement you may have executed +> with Licensor regarding such Contributions. +> +> 6. Trademarks. This License does not grant permission to use the trade +> names, trademarks, service marks, or product names of the Licensor, +> except as required for reasonable and customary use in describing the +> origin of the Work and reproducing the content of the NOTICE file. +> +> 7. Disclaimer of Warranty. Unless required by applicable law or +> agreed to in writing, Licensor provides the Work (and each +> Contributor provides its Contributions) on an "AS IS" BASIS, +> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +> implied, including, without limitation, any warranties or conditions +> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +> PARTICULAR PURPOSE. You are solely responsible for determining the +> appropriateness of using or redistributing the Work and assume any +> risks associated with Your exercise of permissions under this License. +> +> 8. Limitation of Liability. In no event and under no legal theory, +> whether in tort (including negligence), contract, or otherwise, +> unless required by applicable law (such as deliberate and grossly +> negligent acts) or agreed to in writing, shall any Contributor be +> liable to You for damages, including any direct, indirect, special, +> incidental, or consequential damages of any character arising as a +> result of this License or out of the use or inability to use the +> Work (including but not limited to damages for loss of goodwill, +> work stoppage, computer failure or malfunction, or any and all +> other commercial damages or losses), even if such Contributor +> has been advised of the possibility of such damages. +> +> 9. Accepting Warranty or Additional Liability. While redistributing +> the Work or Derivative Works thereof, You may choose to offer, +> and charge a fee for, acceptance of support, warranty, indemnity, +> or other liability obligations and/or rights consistent with this +> License. However, in accepting such obligations, You may act only +> on Your own behalf and on Your sole responsibility, not on behalf +> of any other Contributor, and only if You agree to indemnify, +> defend, and hold each Contributor harmless for any liability +> incurred by, or claims asserted against, such Contributor by reason +> of your accepting any such warranty or additional liability. +> +> END OF TERMS AND CONDITIONS diff --git a/lib/BloqadeNoisy/Project.toml b/lib/BloqadeNoisy/Project.toml new file mode 100644 index 000000000..6571e08b3 --- /dev/null +++ b/lib/BloqadeNoisy/Project.toml @@ -0,0 +1,32 @@ +name = "BloqadeNoisy" +uuid = "7534646f-0cda-4b9e-a311-3a9166d831c9" +authors = ["ben mcdonough"] +version = "1.0.0-DEV" + +[deps] +BloqadeExpr = "bd27d05e-4ce1-5e79-84dd-c5d7d508abe2" +BloqadeODE = "bd27d05e-4ce1-5e79-84dd-c5d7d508bbe5" +BloqadeWaveforms = "bd27d05e-4ce1-5e79-84dd-c5d7d508bbe7" +DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" +DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" +GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71" +JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" +Kronecker = "2c470bb0-bcc8-11e8-3dad-c9649493f05e" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" +SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" +YaoArrayRegister = "e600142f-9330-5003-8abb-0ebd767abc51" +YaoBlocks = "418bc28f-b43b-5e0b-a6e7-61bbc1a2c1df" +YaoSubspaceArrayReg = "bd27d05e-4ce1-5e79-84dd-c5d7d508ade2" + +[compat] +julia = "1" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/lib/BloqadeNoisy/README.md b/lib/BloqadeNoisy/README.md new file mode 100644 index 000000000..bfb40fbad --- /dev/null +++ b/lib/BloqadeNoisy/README.md @@ -0,0 +1,28 @@ +# BloqadeNoisy + +Bloqade Noisy stochastic wave function-based noisy dynamics simulator. + +## Installation + +

+BloqadeNoisy is a   + + + Julia Language + +   package. To install BloqadeNoisy, + please open + Julia's interactive session (known as REPL) and press ] key in the REPL to use the package mode, and then type the following command: +

+ +For stable release: + +```julia +pkg> add BloqadeNoisy +``` + +For current master: + +```julia +pkg> add BloqadeNoisy#master +``` \ No newline at end of file diff --git a/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect.csv b/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect.csv new file mode 100644 index 000000000..7d0928390 --- /dev/null +++ b/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect.csv @@ -0,0 +1,3 @@ +0.000000000000000000e+00,9.861411987655249300e-04,3.938650745898483740e-03,8.842445163863312668e-03,1.567338709464188157e-02,2.439690926413159294e-02,3.496627480044391112e-02,4.732064913074220808e-02,6.138318533418576223e-02,7.705933594215488847e-02,9.423560019338091120e-02,1.127788947162899486e-01,1.325366998388742834e-01,1.533380853815656253e-01,1.749956612078936991e-01,1.973084330481522375e-01,2.200654780900818397e-01,2.430502927381325284e-01,2.660456100477175956e-01,2.888384436663883337e-01,3.112250835224077417e-01,3.330157752276433625e-01,3.540388028006717369e-01,3.741437578076648451e-01,3.932038000852339787e-01,4.111167920783707630e-01,4.278052599064068873e-01,4.432152192040439420e-01,4.573139621171079527e-01,4.700869942301090232e-01,4.815343495069654978e-01,4.916665631547230131e-01,5.005005891268284879e-01,5.080559580805736886e-01,5.143514421756910648e-01,5.194024454536668722e-01,5.232192926334431338e-01,5.258064966793285500e-01,5.271630300885504772e-01,5.272835358279549522e-01,5.261603531994938354e-01,5.237861669403049980e-01,5.201570600791004528e-01,5.152757164841793580e-01,5.091545254079242744e-01,5.018183479059131757e-01,4.933067511738594701e-01,4.836755529371338236e-01,4.729975749936941032e-01,4.613625752305564043e-01,4.488763718345698539e-01,4.356592333751115875e-01,4.218436576165549012e-01,4.075716769268724060e-01,3.929918587759113069e-01,3.782561709250727433e-01,3.635168624443097518e-01,3.489234991640435823e-01,3.346202640347061830e-01,3.207435913915548387e-01,3.074201839870588371e-01,2.947654148375064009e-01,2.828821056427510694e-01,2.718596384183045722e-01,2.617733576413078245e-01,2.526842069076849495e-01,2.446385551092279953e-01,2.376681683163502090e-01,2.317903044471260887e-01,2.270079157393613545e-01,2.233099636915169550e-01,2.206718598783389274e-01,2.190560620626820498e-01,2.184128457630474529e-01,2.186812882426779070e-01,2.197904809762105116e-01,2.216609848507568314e-01,2.242065223340498070e-01,2.273358915365069899e-01,2.309550587251205378e-01,2.349693818401601408e-01,2.392858852889674925e-01,2.438155100175129764e-01,2.484752431919477755e-01,2.531900315485181019e-01,2.578943823520676304e-01,2.625335673848084306e-01,2.670643520381252300e-01,2.714551961261437163e-01,2.756858899166591548e-01,2.797466266454682327e-01,2.836365249114182752e-01,2.873616680773116161e-01,2.909327404019652619e-01,2.943623764209672977e-01,2.976623648619219353e-01,3.008408641355549418e-01,3.038997933494181902e-01,3.068325760913537814e-01,3.096223826306003235e-01,3.122410189651545487e-01,3.146485617069099128e-01,3.167938104717946124e-01,3.186155717196976767e-01,3.200447462056158487e-01,3.210071354652873632e-01,3.214268300106684073e-01,3.212300072314824284e-01,3.203489248331629624e-01,3.187258811461852748e-01,3.163169041082242727e-01,3.130949440103472647e-01,3.090523658234249904e-01,3.042025817064011872e-01,2.985807158862784916e-01,2.922432464177765477e-01,2.852666444681571933e-01,2.777450837473451895e-01,2.697873586940570112e-01,2.615131932106364299e-01,2.530491614615898999e-01,2.445244615194962223e-01,2.360667803953883093e-01,2.277984877807239239e-01,2.198333503117234911e-01,2.122739331073558722e-01,2.052097896667352261e-01,1.987164918838123240e-01,1.928554923114114972e-01,1.876747540235306488e-01,1.832100373727820752e-01,1.794866940149198176e-01,1.765217930455790230e-01,1.743263942209557493e-01,1.729077818584856541e-01,1.722714959430348414e-01,1.724230061161330652e-01,1.733689341587174859e-01,1.751177451801324003e-01,1.776798852609757784e-01,1.810673830501331738e-01,1.852929625058890306e-01,1.903687607086882450e-01,1.963047542069827900e-01,2.031070254555966681e-01,2.107759995748427484e-01,2.193047822233313848e-01,2.286777243543820504e-01,2.388693070686225273e-01,2.498434331537419395e-01,2.615531714372372196e-01,2.739409764206698350e-01,2.869393703181865041e-01,3.004720514489477856e-01,3.144553566636251740e-01,3.287999952559356731e-01,3.434129458548600966e-01,3.581994044414121281e-01,3.730646661673385212e-01,3.879158335902471166e-01,4.026632487810251071e-01,4.172215797581185770e-01,4.315105064792592593e-01,4.454549808351318529e-01,4.589850808867284027e-01,4.720354922077952264e-01,4.845446928822556565e-01,4.964539382817265145e-01,5.077061576866125359e-01,5.182448894028380826e-01,5.280133748801998372e-01,5.369539295583533045e-01,5.450076797038567733e-01,5.521147365784073724e-01,5.582148380664176957e-01,5.632484521617494577e-01,5.671582989961035937e-01,5.698912137073164352e-01,5.714002326310656521e-01,5.716467770523103731e-01,5.706027845055464676e-01,5.682526372794780567e-01,5.645947561529619518e-01,5.596427397024524852e-01,5.534259623766207836e-01,5.459895857849381695e-01,5.373939715367834769e-01,5.277135266919269485e-01,5.170350573226110136e-01,5.054557229960054965e-01,4.930807226955564171e-01,4.800208474460257446e-01,4.663900299965247909e-01,4.523030310532831777e-01,4.378733596934958894e-01,4.232115164066746482e-01,4.084236066691206424e-01,3.936103418206438054e-01,3.788664137609082383e-01,3.642801968281366154e-01,3.499337126862351877e-01,3.359027819655909797e-01,3.222572699584889122e-01,3.090613534758040459e-01,2.963737333044382805e-01,2.842477432181141905e-01,2.727313194185826961e-01,2.618668317848485416e-01,2.516907852713742844e-01,2.422334306919172453e-01,2.335183395147790997e-01,2.255619982471810392e-01,2.183734929756163679e-01,2.119543406530174090e-01,2.062985189193477509e-01,2.013927309076097016e-01,1.972169184817787468e-01,1.937450235062153081e-01,1.909459676285472640e-01,1.887848117793768377e-01,1.872240255961985511e-01,1.862248078295883069e-01,1.857483633995350158e-01,1.857570734839356086e-01,1.862154719350150867e-01,1.870909706108822568e-01,1.883542834992718018e-01,1.899795189494630221e-01,1.919439313896354193e-01,1.942273491113986339e-01,1.968113098700855490e-01,1.996779678685683956e-01,2.028088439351128924e-01,2.061835144547897458e-01,2.097783320613617886e-01,2.135652890709333618e-01,2.175111178868389394e-01,2.215767237480998075e-01,2.257170198091950353e-01,2.298812194775773643e-01,2.340136098810956522e-01,2.380547997345966171e-01,2.419434058312652791e-01,2.456181051475312960e-01,2.490199561481009072e-01,2.520948629145220998e-01,2.547960420912072643e-01,2.570863447302681459e-01,2.589402763000671626e-01,2.603455878464587259e-01,2.613043118687072841e-01,2.618331623193823066e-01,2.619632498114131125e-01,2.617391051840441962e-01,2.612170512895046759e-01,2.604630052951237285e-01,2.595498309231000778e-01,2.585543962390799422e-01,2.575545040776129335e-01,2.566258769265413187e-01,2.558393814474160810e-01,2.552586401227854296e-01,2.549381723681533596e-01,2.549221553251904138e-01,2.552438559175603805e-01,2.559257363438495192e-01,2.569801903519103869e-01,2.584108242589019389e-01,2.602141593028416411e-01,2.623816104547945227e-01,2.649015773542369723e-01,2.677614900627688366e-01,2.709496515653654902e-01,2.744567540485001178e-01,2.782769659621170955e-01,2.824085294176342242e-01,2.868538459846951549e-01,2.916190704175008475e-01,2.967132638147634283e-01,3.021471975251872055e-01,3.079319089760607087e-01,3.140771364728559556e-01,3.205897525590147845e-01,3.274723191447869164e-01,3.347218608620732838e-01,3.423289424269133630e-01,3.502770987919104351e-01,3.585426482327848108e-01,3.670948745648632272e-01,3.758965511108200430e-01,3.849047472937484615e-01,3.940718424716072033e-01,4.033466605321185394e-01,4.126756370153560338e-01,4.220039281146089061e-01,4.312763867804213502e-01,4.404383425768679250e-01,4.494361384010935323e-01,4.582174095599751973e-01,4.667311024629879346e-01,4.749272594344612908e-01,4.827566183092649177e-01,4.901700854313286171e-01,4.971181631724755912e-01,5.035504104147460191e-01,5.094150232637337794e-01,5.146586101058477913e-01,5.192262294104940112e-01,5.230617367883010349e-01,5.261084707551121342e-01,5.283102731882203251e-01,5.296128251235968643e-01,5.299652418596503267e-01,5.293218553817669036e-01,5.276440862992504144e-01,5.249023004651812707e-01,5.210775292384013380e-01,5.161629469998879616e-01,5.101649974738614590e-01,5.031040831379753886e-01,4.950147622192289099e-01,4.859454203828856289e-01,4.759574177706064613e-01,4.651237589955144469e-01,4.535273500242865685e-01,4.412589453077278567e-01,4.284149027042657987e-01,4.150948879167771777e-01,4.013996502762310348e-01,3.874290123139670916e-01,3.732801701831408026e-01,3.590463949135770938e-01,3.448161799311186826e-01,3.306728481596144520e-01,3.166945931877370168e-01,3.029548926681888688e-01,2.895232022883888479e-01,2.764658214036929129e-01,2.638467992389855188e-01,2.517287667919150818e-01,2.401735683984808911e-01,2.292426095897580618e-01,2.189968503500556718e-01,2.094964140765182559e-01,2.007998220067728767e-01,1.929628930055118097e-01,1.860373888063248105e-01,1.800695025695528417e-01,1.750983129414197814e-01,1.711543281713364117e-01,1.682582401655099147e-01,1.664199936574459748e-01,1.656382522998606499e-01,1.659003115324141353e-01,1.671824705920669507e-01,1.694508427089680136e-01,1.726625461251061200e-01,1.767671861167102176e-01,1.817085219178667388e-01,1.874261938459516053e-01,1.938573826093361596e-01,2.009382846346683682e-01,2.086053001170050381e-01,2.167958544941966381e-01,2.254488102982646625e-01,2.345044532871105591e-01,2.439040805241863841e-01,2.535892427485115785e-01,2.635007305453782034e-01,2.735774102742845049e-01,2.837550315683926017e-01,2.939651387043369923e-01,3.041342024394005361e-01,3.141830884880600361e-01,3.240269468626538751e-01,3.335755875623950817e-01,3.427343631917648681e-01,3.514055626126719178e-01,3.594902615773858945e-01,3.668905642413034518e-01,3.735121269274835343e-01,3.792668411104722082e-01,3.840755317438520056e-01,3.878705303596223786e-01,3.905979687345011442e-01,3.922196764616088793e-01,3.927145582126847501e-01,3.920793773132756899e-01,3.903288929968987131e-01,3.874953380785332024e-01,3.836272632203682198e-01,3.787878088299207469e-01,3.730524988782531470e-01,3.665066767065962572e-01,3.592427223851482054e-01,3.513572039854258033e-01,3.429481042877924879e-01,3.341122771444342554e-01,3.249432390311185470e-01,3.155293999909392078e-01 +0.000000000000000000e+00,9.861411349203583632e-04,3.938646649281694022e-03,8.842397973276234016e-03,1.567311829160219355e-02,2.439586677113715976e-02,3.496310462934249658e-02,4.731250264375558984e-02,6.136469381108898558e-02,7.702119735505999487e-02,9.416274950929527654e-02,1.126482692497892263e-01,1.323146625897518025e-01,1.529776251437540424e-01,1.744335434093045867e-01,1.964625216743258740e-01,2.188324650908858027e-01,2.413040878689819979e-01,2.636365914008652056e-01,2.855937242302832857e-01,3.069498355099145592e-01,3.274955875124508919e-01,3.470428690265930372e-01,3.654286354135797832e-01,3.825173682612050818e-01,3.982019842412132804e-01,4.124031430651176611e-01,4.250670672678681927e-01,4.361620349436735600e-01,4.456739213618323703e-01,4.536012049159861004e-01,4.599499032443123969e-01,4.647289517798361413e-01,4.679464777366554862e-01,4.696073630384187680e-01,4.697123499526268953e-01,4.682588453258691441e-01,4.652433511960684109e-01,4.606653517219543303e-01,4.545322961250495286e-01,4.468652362836053604e-01,4.377045482326753501e-01,4.271152052200151150e-01,4.151910360262448529e-01,4.020575003430836847e-01,3.878726403428056080e-01,3.728259910708157654e-01,3.571354244102457054e-01,3.410420567323731444e-01,3.248035344233499710e-01,3.086861056471643106e-01,2.929560063254176283e-01,2.778707604159924016e-01,2.636709200228111727e-01,2.505727917551836548e-01,2.387625921513616412e-01,2.283923085745738490e-01,2.195774541653418843e-01,2.123967438126961871e-01,2.068935332020866991e-01,2.030788279797801910e-01,2.009354798504207895e-01,2.004232116866411506e-01,2.014840293630905943e-01,2.040476329469675110e-01,2.080364474995566870e-01,2.133700020577723455e-01,2.199684228481529058e-01,2.277549359077163937e-01,2.366573322634680232e-01,2.466084445316710227e-01,2.575457358003940267e-01,2.694101748102462057e-01,2.821445509551943620e-01,2.956914597410155721e-01,3.099911350181676628e-01,3.249793225680042696e-01,3.405853538972400951e-01,3.567305731226985133e-01,3.733272149852661648e-01,3.902778512770508912e-01,4.074754348914214619e-01,4.248040015033980321e-01,4.421400259281095813e-01,4.593544096472593763e-01,4.763150313020366733e-01,4.928897749473328815e-01,5.089498963843469559e-01,5.243735584398839800e-01,5.390493313129441910e-01,5.528794569341715093e-01,5.657826107951833272e-01,5.776959815563037504e-01,5.885764527622691089e-01,5.984007429236822828e-01,6.071644218158470663e-01,6.148798095533906105e-01,6.215728196252433557e-01,6.272789384421854075e-01,6.320385676183714052e-01,6.358920633734160832e-01,6.388748116105495978e-01,6.410127300323270605e-01,6.423185381444677100e-01,6.427891112077495084e-01,6.424041562257982729e-01,6.411263464642587007e-01,6.389029362210750795e-01,6.356687720725596735e-01,6.313505006538411291e-01,6.258716705583203810e-01,6.191583755773819586e-01,6.111450227388088852e-01,6.017798184673249784e-01,5.910296009861381039e-01,5.788836794421630128e-01,5.653564600104704629e-01,5.504887091757766360e-01,5.343474329713517879e-01,5.170244526327789636e-01,4.986338204255844619e-01,4.793083606756213810e-01,4.591955775892681557e-01,4.384532732851653680e-01,4.172451452651373405e-01,3.957366556978690886e-01,3.740913613174227104e-01,3.524678658210236848e-01,3.310174577208191971e-01,3.098824589950598951e-01,2.891952156310858557e-01,2.690776422939871737e-01,2.496411890185212257e-01,2.309870878337995093e-01,2.132067475567378523e-01,1.963821784975221252e-01,1.805863308552605739e-01,1.658833241895526223e-01,1.523285052804947415e-01,1.399683445019519190e-01,1.288402138878789183e-01,1.189720477990527242e-01,1.103819798155940279e-01,1.030779839866683978e-01,9.705756888050778852e-02,9.230758234762197201e-02,8.880414902097272245e-02,8.651278059976932888e-02,8.538866447896566181e-02,8.537716468731434971e-02,8.641453638802057413e-02,8.842886357814516707e-02,9.134122163226716939e-02,9.506705990422670283e-02,9.951777397615152454e-02,1.046024397052125743e-01,1.102296384428892301e-01,1.163093168238636954e-01,1.227545553090027830e-01,1.294831600795228188e-01,1.364189378160287902e-01,1.434925583173861097e-01,1.506419092729617548e-01,1.578118481778446325e-01,1.649533857119000468e-01,1.720222784731333665e-01,1.789771521170624713e-01,1.857772916003150587e-01,1.923802919487067054e-01,1.987398143320441013e-01,2.048036732411917527e-01,2.105125329651391097e-01,2.157993918368232844e-01,2.205900433150118911e-01,2.248045789571690711e-01,2.283599379196762091e-01,2.311733909454495028e-01,2.331667765452012930e-01,2.342711827585414741e-01,2.344317588669380392e-01,2.336122680775999105e-01,2.317989882084118269e-01,2.290036386782292877e-01,2.252650329309948685e-01,2.206492770511289669e-01,2.152484411785799412e-01,2.091777506553420818e-01,2.025714543915903276e-01,1.955776827241569038e-01,1.883526129772937485e-01,1.810543990567759221e-01,1.738372917545353002e-01,1.668463420329600877e-01,1.602130885478458278e-01,1.540524663199220323e-01,1.484611248174793896e-01,1.435171805944878698e-01,1.392813383815031114e-01,1.357991893805332306e-01,1.331043931430521410e-01,1.312224036487234791e-01,1.301743799484167963e-01,1.299808658644480974e-01,1.306649428331023988e-01,1.322545511075722824e-01,1.347838027378455428e-01,1.382931606375341904e-01,1.428285266677641330e-01,1.484392915522326772e-01,1.551755346009494052e-01,1.630846197914053164e-01,1.722074249985660332e-01,1.825745231528015378e-01,1.942025658362585006e-01,2.070911249556747491e-01,2.212201967660250013e-01,2.365485039687990898e-01,2.530127005402675322e-01,2.705274907673870799e-01,2.889866605389687648e-01,3.082649129183585024e-01,3.282204507554164485e-01,3.486981064336230896e-01,3.695329299956928715e-01,3.905540167749209091e-01,4.115884386361545744e-01,4.324651134091357929e-01,4.530184542395895853e-01,4.730916628886056019e-01,4.925395606245301927e-01,5.112308267913042714e-01,5.290496098827403015e-01,5.458964453846057996e-01,5.616884838624641718e-01,5.763590412020149767e-01,5.898565602832730459e-01,6.021430639401902374e-01,6.131922428556567661e-01,6.229873340108880164e-01,6.315189607876124933e-01,6.387831116187505653e-01,6.447794116535007225e-01,6.495098429326446876e-01,6.529779849749776099e-01,6.551888448795671893e-01,6.561492636254653288e-01,6.558688240982853968e-01,6.543611633492741886e-01,6.516455023411241720e-01,6.477482285955520336e-01,6.427043091961270882e-01,6.365583516348527482e-01,6.293651498568418878e-01,6.211895878734934318e-01,6.121058495266223920e-01,6.021959401400509559e-01,5.915475995974541767e-01,5.802517460058238541e-01,5.683996437228088228e-01,5.560800132517970118e-01,5.433763414328249830e-01,5.303645919913222428e-01,5.171115309170762897e-01,5.036738037074330876e-01,4.900978342930850662e-01,4.764205635936730188e-01,4.626709424562633344e-01,4.488720551787727664e-01,4.350436743442097631e-01,4.212050298310665020e-01,4.073775330603062184e-01,3.935872557018718076e-01,3.798669175782475316e-01,3.662572625032796125e-01,3.528076980604297197e-01,3.395761649947064975e-01,3.266282757152703109e-01,3.140357957850042347e-01,3.018746008442214634e-01,2.902222934480827021e-01,2.791556335794828647e-01,2.687479887064136985e-01,2.590669531173523388e-01,2.501722855586341887e-01,2.421142541505156565e-01,2.349324610178434303e-01,2.286551500118120250e-01,2.232990100025059876e-01,2.188693877746145378e-01,2.153608751840773161e-01,2.127581751368698981e-01,2.110371546170577428e-01,2.101660135107862870e-01,2.101064817297995380e-01,2.108149725676668751e-01,2.122436520287085959e-01,2.143413633715955946e-01,2.170543681596014685e-01,2.203268958993880311e-01,2.241014695703182347e-01,2.283190018286983536e-01,2.329186788214570869e-01,2.378376283183617490e-01,2.430104288398737822e-01,2.483684976541479517e-01,2.538394312235863759e-01,2.593463897721689504e-01,2.648076220585340312e-01,2.701362397702252727e-01,2.752403581527559373e-01,2.800236802362394140e-01,2.843866107497552975e-01,2.882279335531786613e-01,2.914470431711426723e-01,2.939466732925554160e-01,2.956360239267827317e-01,2.964341123482772677e-01,2.962731730052737822e-01,2.951018670913764241e-01,2.928880712239479434e-01,2.896210327839181531e-01,2.853127013028551873e-01,2.799980642758241878e-01,2.737344699602938802e-01,2.665998812057942535e-01,2.586901796482892757e-01,2.501156507567529608e-01,2.409969091280267928e-01,2.314604821900770604e-01,2.216344030358458894e-01,2.116440687923791808e-01,2.016086584225342815e-01,1.916383182588074774e-01,1.818322773851825391e-01,1.722779586986040168e-01,1.630510782197428232e-01,1.542166168177972752e-01,1.458305169519339417e-01,1.379418407959900061e-01,1.305951755307810935e-01,1.238329617700059948e-01,1.176975375741769053e-01,1.122326652214957476e-01,1.074843880146912206e-01,1.035011495173707025e-01,1.003331575242717849e-01,9.803108232411525402e-02,9.664419912594317263e-02,9.621818486159264272e-02,9.679277444836453803e-02,9.839948923425009819e-02,1.010596600666711087e-01,1.047829049662821616e-01,1.095662021732757563e-01,1.153936102479228148e-01,1.222366534436186286e-01,1.300553143850413096e-01,1.387995255363917435e-01,1.484110231043886119e-01,1.588253949431491230e-01,1.699741341585220000e-01,1.817865571138093383e-01,1.941914217147064081e-01,2.071181446772129842e-01,2.204975572075300039e-01,2.342621649646128290e-01,2.483459432745877549e-01,2.626837238092694093e-01,2.772102647908126771e-01,2.918591246374637183e-01,3.065614585720384255e-01,3.212448860868414857e-01,3.358325362743473375e-01,3.502424031682602190e-01,3.643870765664204980e-01,3.781739502689505650e-01,3.915058987871081753e-01,4.042824857037031205e-01,4.164016310464400128e-01,4.277617142709152498e-01,4.382640310159529595e-01,4.478154922502300961e-01,4.563314403759544113e-01,4.637384642776634092e-01,4.699770258279151736e-01,4.750037943204006852e-01,4.787935057869413535e-01,4.813402527745015425e-01,4.826580883071705519e-01,4.827808839284682407e-01,4.817614209049581042e-01,4.796697284178796372e-01,4.765907574936337210e-01,4.726214814129798825e-01,4.678676025553804574e-01,4.624400484664071831e-01,4.564514409565368913e-01,4.500127927450165988e-01,4.432305742793496428e-01,4.362043498488656357e-01 +0.000000000000000000e+00,9.861420618097597492e-04,3.938705453048084101e-03,8.843062952370001062e-03,1.567681401873008765e-02,2.440977401073783637e-02,3.500395496803653667e-02,4.741354196444107910e-02,6.158487097975490210e-02,7.745641565182818933e-02,9.495879160638888428e-02,1.140147881935234392e-01,1.345394382808325628e-01,1.564401370421304449e-01,1.796168204744623964e-01,2.039622135587356444e-01,2.293621559407180988e-01,2.556960119704642653e-01,2.828371675730498858e-01,3.106536151065779072e-01,3.390086225291054634e-01,3.677614824731370025e-01,3.967683305807797045e-01,4.258830240321948013e-01,4.549580670324177567e-01,4.838455699419801359e-01,5.123982287953172676e-01,5.404703131042090103e-01,5.679186491374067502e-01,5.946035896198086368e-01,6.203899612527795648e-01,6.451479819858035869e-01,6.687541436147986795e-01,6.910920536405845693e-01,7.120532319741663674e-01,7.315378569748935966e-01,7.494554554267929269e-01,7.657255288899758039e-01,7.802781087681932570e-01,7.930542305928052205e-01,8.040063184529017137e-01,8.130984687972204750e-01,8.203066255150913699e-01,8.256186380831942451e-01,8.290341973738355463e-01,8.305646473974177546e-01,8.302326733462385144e-01,8.280718713812189602e-01,8.241262087907159639e-01,8.184493871202087600e-01,8.111041233339812973e-01,8.021613667063963726e-01,7.916994715398258942e-01,7.798033439622320540e-01,7.665635827498091803e-01,7.520756321861880034e-01,7.364389619109956708e-01,7.197562872481956253e-01,7.021328403751211367e-01,6.836756988591953244e-01,6.644931765654390476e-01,6.446942778236440796e-01,6.243882148884523087e-01,6.036839855047592129e-01,5.826900070772109697e-01,5.615138018236668360e-01,5.402617274148674431e-01,5.190387460257558372e-01,4.979482250218815742e-01,4.770917613847432959e-01,4.565690221952204975e-01,4.364775926742519019e-01,4.169128236412159016e-01,3.979676692970453011e-01,3.797325077618078915e-01,3.622949362856117128e-01,3.457395344207689347e-01,3.301475898609580462e-01,3.155967835748412775e-01,3.021608324162777248e-01,2.899090904572148575e-01,2.789061119616508266e-01,2.692111818581545135e-01,2.608778212988243639e-01,2.539532779219509928e-01,2.484780112214387549e-01,2.444851844425275644e-01,2.420001750330470769e-01,2.410401140606991677e-01,2.416134654426404238e-01,2.437196547106181832e-01,2.473487548685973925e-01,2.524812371810332690e-01,2.590877929114996370e-01,2.671292315806929052e-01,2.765564609705405963e-01,2.873105541193187729e-01,2.993229079679013416e-01,3.125154993784627355e-01,3.268012429723373691e-01,3.420844560086663821e-01,3.582614337539185012e-01,3.752211381106482224e-01,3.928459994448261217e-01,4.110128295184133917e-01,4.295938396950119698e-01,4.484577549142523267e-01,4.674710103045620624e-01,4.864990131030810794e-01,5.054074496422967799e-01,5.240636134254814671e-01,5.423377297861299295e-01,5.601042502465212181e-01,5.772430908118871828e-01,5.936407901630854633e-01,6.091915646118970518e-01,6.237982423080986605e-01,6.373730611616763575e-01,6.498383205431684795e-01,6.611268811283084190e-01,6.711825107777219523e-01,6.799600800096109454e-01,6.874256117892819651e-01,6.935561947942137095e-01,6.983397696850671688e-01,7.017748005399985223e-01,7.038698426349365711e-01,7.046430190267800597e-01,7.041214172048835263e-01,7.023404179777876788e-01,6.993429666797100763e-01,6.951787981598215316e-01,6.899036260854948255e-01,6.835783073136931787e-01,6.762679930215250712e-01,6.680412777036156546e-01,6.589693581727437133e-01,6.491252150861929193e-01,6.385828287587311802e-01,6.274164410624963883e-01,6.156998751641632461e-01,6.035059215905645980e-01,5.909057999919438142e-01,5.779687021684304371e-01,5.647614203115931542e-01,5.513480622089577121e-01,5.377898523527423480e-01,5.241450157819291800e-01,5.104687390296993588e-01,4.968132010774002350e-01,4.832276652277471274e-01,4.697586213183668757e-01,4.564499675551657032e-01,4.433432200744768514e-01,4.304777376480715678e-01,4.178909504495247895e-01,4.056185806302258223e-01,3.936948443839634604e-01,3.821526253504784476e-01,3.710236113853417339e-01,3.603383874877968407e-01,3.501264808935702355e-01,3.404163557988211242e-01,3.312353573013767649e-01,3.226096087272161128e-01,3.145638665197039718e-01,3.071213413908138734e-01,3.003034956768421693e-01,2.941298283878597264e-01,2.886176610137742848e-01,2.837819364952033907e-01,2.796350442747574383e-01,2.761866814815423510e-01,2.734437595620104466e-01,2.714103616154450727e-01,2.700877530637558199e-01,2.694744444231312874e-01,2.695663021046380559e-01,2.703566990594420960e-01,2.718366960202744376e-01,2.739952414694249994e-01,2.768193776507297255e-01,2.802944412742994773e-01,2.844042476419350041e-01,2.891312494929325627e-01,2.944566646797597276e-01,3.003605693746759786e-01,3.068219564158594648e-01,3.138187624210477256e-01,3.213278676544530921e-01,3.293250762544268628e-01,3.377850842596414882e-01,3.466814424494004121e-01,3.559865216846732627e-01,3.656714852851387088e-01,3.757062722630030160e-01,3.860595921447987355e-01,3.966989306796206427e-01,4.075905635319781450e-01,4.186995734521083423e-01,4.299898661363844021e-01,4.414241803835862177e-01,4.529640874589253574e-01,4.645699781354949431e-01,4.762010362085595250e-01,4.878152005852436912e-01,4.993691194795306654e-01,5.108181041581383308e-01,5.221160894980099165e-01,5.332156114280897086e-01,5.440678118829151977e-01,5.546224807090192055e-01,5.648281447061822558e-01,5.746322113643496099e-01,5.839811733541040439e-01,5.928208776523178347e-01,6.010968599475827734e-01,6.087547433238108541e-01,6.157406967015868204e-01,6.220019474887296118e-01,6.274873392608323330e-01,6.321479264237839235e-01,6.359375932832661560e-01,6.388136879135769552e-01,6.407376575037038169e-01,6.416756740628845046e-01,6.415992381778548026e-01,6.404857494805943352e-01,6.383190323549146061e-01,6.350898068614195813e-01,6.307960938655756689e-01,6.254435466289728351e-01,6.190457000574520752e-01,6.116241310389546326e-01,6.032085243353001447e-01,5.938366406626625071e-01,5.835541845031168018e-01,5.724145715713113702e-01,5.604785978110126132e-01,5.478140132435154186e-01,5.344950061211599657e-01,5.206016039879705071e-01,5.062190004829523193e-01,4.914368163693754732e-01,4.763483055711801861e-01,4.610495169718427655e-01,4.456384225543658095e-01,4.302140239449209203e-01,4.148754485369167688e-01,3.997210467206301909e-01,3.848475022070870222e-01,3.703489665989179724e-01,3.563162308697979119e-01,3.428359444017521351e-01,3.299898938196714759e-01,3.178543524630937367e-01,3.064995109569644827e-01,2.959889983046731232e-01,2.863795010235998806e-01,2.777204862784778405e-01,2.700540326405517222e-01,2.634147685905569580e-01,2.578299167123355717e-01,2.533194379599093549e-01,2.498962672084397152e-01,2.475666291138098329e-01,2.463304202485785133e-01,2.461816426493675380e-01,2.471088722205951327e-01,2.490957459901719517e-01,2.521214519304073587e-01,2.561612082039778082e-01,2.611867181703760865e-01,2.671665927186286371e-01,2.740667321350165331e-01,2.818506633014340457e-01,2.904798308059603484e-01,2.999138423532901054e-01,3.101106707341557689e-01,3.210268164846716288e-01,3.326174349873488589e-01,3.448364331795901183e-01,3.576365399483714680e-01,3.709693545002770709e-01,3.847853757687333398e-01,3.990340159801504250e-01,4.136636003615839496e-01,4.286213557881570213e-01,4.438533897598739841e-01,4.593046630350852144e-01,4.749189589158829827e-01,4.906388531050176471e-01,5.064056896089053073e-01,5.221595680709755216e-01,5.378393490789454834e-01,5.533826849260518044e-01,5.687260819883963592e-01,5.838050017692776317e-01,5.985540062936423045e-01,6.129069523718563284e-01,6.267972377083484981e-01,6.401581005778196332e-01,6.529229719791710407e-01,6.650258784648984678e-01,6.764018912667643102e-01,6.869876157397497574e-01,6.967217144572684928e-01,7.055454551354997106e-01,7.134032745044901480e-01,7.202433482792017783e-01,7.260181565789174396e-01,7.306850348272624363e-01,7.342066990121244308e-01,7.365517352692086961e-01,7.376950431624462734e-01,7.376182234186371423e-01,7.363099002856802189e-01,7.337659712776323229e-01,7.299897766948802991e-01,7.249921838001649466e-01,7.187915824000833398e-01,7.114137904371479193e-01,7.028918700131228103e-01,6.932658586993392102e-01,6.825824210583777418e-01,6.708944295543501912e-01,6.582604848966179256e-01,6.447443891285818962e-01,6.304145831550760359e-01,6.153435643709678216e-01,5.996072965644740904e-01,5.832846255633907795e-01,5.664567115514863582e-01,5.492064871398790737e-01,5.316181479271040455e-01,5.137766799315974797e-01,4.957674248624536761e-01,4.776756831526148273e-01,4.595863509628897448e-01,4.415835878387932567e-01,4.237505082251671884e-01,4.061688919022032329e-01,3.889189069723422154e-01,3.720788399855888828e-01,3.557248289802174002e-01,3.399305958136510930e-01,3.247671760252305861e-01,3.103026445857703930e-01,2.966018383369546374e-01,2.837260757188567184e-01,2.717328750049939345e-01,2.606756734048559787e-01,2.506035484451147322e-01,2.415609440985505563e-01,2.335874030439232529e-01,2.267173072019364466e-01,2.209796281547310171e-01,2.163976894326115619e-01,2.129889429011458946e-01,2.107647619931714011e-01,2.097302546774676424e-01,2.098841006950260268e-01,2.112184168968866127e-01,2.137186560162902538e-01,2.173635444949691686e-01,2.221250644976663913e-01,2.279684859304821343e-01,2.348524534322673774e-01,2.427291325002919331e-01,2.515444184262444205e-01,2.612382100584043076e-01,2.717447496718761180e-01,2.829930282499702465e-01,2.949072549912801211e-01,3.074073872831846188e-01,3.204097181574448450e-01,3.338275145950563294e-01,3.475717020505631472e-01,3.615515869365367729e-01,3.756756101373057710e-01,3.898521228810647998e-01,4.039901761618113207e-01,4.180003139240601184e-01,4.317953606850787884e-01,4.452911920851729821e-01,4.584074791636382762e-01,4.710683942758608911e-01,4.832032691405230285e-01,4.947471943235522418e-01,5.056415509714776713e-01,5.158344666231976516e-01,5.252811878712597693e-01,5.339443654073807721e-01,5.417942472325121273e-01,5.488087796741258906e-01,5.549736167201584358e-01,5.602820400158999847e-01,5.647347951480112815e-01,5.683398490321013297e-01,5.711120763131446454e-01 diff --git a/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect_nonoise.csv b/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect_nonoise.csv new file mode 100644 index 000000000..8109f245d --- /dev/null +++ b/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect_nonoise.csv @@ -0,0 +1,3 @@ +0.000000000000000000e+00,9.866348669855748172e-04,3.942590210077477272e-03,8.855708551349596516e-03,1.570472139082217458e-02,2.445783924982418422e-02,3.507096874121148899e-02,4.748573140474331850e-02,6.162748684721015141e-02,7.740357562726229990e-02,9.470199422855755944e-02,1.133906950703650884e-01,1.333176696482810120e-01,1.543119245735511957e-01,1.761854014417245651e-01,1.987358259793796100e-01,2.217504053907287664e-01,2.450102270664970827e-01,2.682951556465948961e-01,2.913889810014322901e-01,3.140845413559621435e-01,3.361885363096974721e-01,3.575257552771888836e-01,3.779424777825051152e-01,3.973088514041749342e-01,4.155201177868834694e-01,4.324966325049315885e-01,4.481827051850127974e-01,4.625443661127875417e-01,4.755662384233081408e-01,4.872477552106509457e-01,4.975990037186395210e-01,5.066365007703925727e-01,5.143792029325349180e-01,5.208450314314549967e-01,5.260481473279623454e-01,5.299971511285631598e-01,5.326943084296076325e-01,5.341358241068472346e-01,5.343131054318828177e-01,5.332148852214804169e-01,5.308300171836113357e-01,5.271507009350619999e-01,5.221758787970633975e-01,5.159145406291548719e-01,5.083886883966298731e-01,4.996357466869812969e-01,4.897102542126569036e-01,4.786847299680722645e-01,4.666496711966906519e-01,4.537127005025316517e-01,4.399969362602456080e-01,4.256387077076083658e-01,4.107847676596065867e-01,3.955891741756465962e-01,3.802100161000715461e-01,3.648061471927934729e-01,3.495340720573890114e-01,3.345450968410692560e-01,3.199828236720261843e-01,3.059810328050276973e-01,2.926619626820224362e-01,2.801349706394970496e-01,2.684955370782223794e-01,2.578245644421620630e-01,2.481879183754522322e-01,2.396361621281319909e-01,2.322044456729522866e-01,2.259125254688537088e-01,2.207649068828275440e-01,2.167511165337793200e-01,2.138461245887296192e-01,2.120109461301852294e-01,2.111934545832096777e-01,2.113294381045902337e-01,2.123439221783387232e-01,2.141527692828170959e-01,2.166645497738118320e-01,2.197826587341826510e-01,2.234076350730209437e-01,2.274396194462672272e-01,2.317808697057421874e-01,2.363382398842697740e-01,2.410255193628631776e-01,2.457655246911993607e-01,2.504918388778825666e-01,2.551501007474986094e-01,2.596987616045486336e-01,2.641092466291984908e-01,2.683654842796595608e-01,2.724627975941434910e-01,2.764061844306773263e-01,2.802080478450696965e-01,2.838854724733851365e-01,2.874571755189466726e-01,2.909402889970177375e-01,2.943471511313858202e-01,2.976822972391516831e-01,3.009398423424912705e-01,3.041014378716108135e-01,3.071349626518349307e-01,3.099940740662015526e-01,3.126187002654774449e-01,3.149365022012325377e-01,3.168652740035102222e-01,3.183161888722260136e-01,3.191977402411798059e-01,3.194201767086116139e-01,3.189001895505222395e-01,3.175655835011901296e-01,3.153596533463106089e-01,3.122449981097923377e-01,3.082065326784791948e-01,3.032535021330322045e-01,2.974203636652006377e-01,2.907664708189682257e-01,2.833745700989409588e-01,2.753481952901865037e-01,2.668081145587114511e-01,2.578880443779389409e-01,2.487298882051426907e-01,2.394787834409409510e-01,2.302782458132882626e-01,2.212656857861896031e-01,2.125685383364370462e-01,2.043011983331506354e-01,1.965628927891540367e-01,1.894365531769672539e-01,1.829886810377864270e-01,1.772701337641538200e-01,1.723176998905134594e-01,1.681562873025685689e-01,1.648015165545475003e-01,1.622624962486203248e-01,1.605445588179450211e-01,1.596517523479754064e-01,1.595889144028039552e-01,1.603631944844450818e-01,1.619849391647811276e-01,1.644679043699964760e-01,1.678288091052796416e-01,1.720862907577595802e-01,1.772593612276054942e-01,1.833654934142859017e-01,1.904184876840964158e-01,1.984262772816839104e-01,2.073888303439116176e-01,2.172962949643882369e-01,2.281275138804627345e-01,2.398490084352498664e-01,2.524144993776339385e-01,2.657649967904494592e-01,2.798294550227374278e-01,2.945259530451839747e-01,3.097633283454520603e-01,3.254431652710046419e-01,3.414620094715165033e-01,3.577136778170361131e-01,3.740915315288902421e-01,3.904905635602525793e-01,4.068091795059117222e-01,4.229505718674085313e-01,4.388236155799514759e-01,4.543432481842633597e-01,4.694303372264961860e-01,4.840110775995117298e-01,4.980159997266453420e-01,5.113787027237570726e-01,5.240344520372448578e-01,5.359187961682549961e-01,5.469663603371650584e-01,5.571099654947055946e-01,5.662801990679741104e-01,5.744055306698921948e-01,5.814130235105530176e-01,5.872296440160179598e-01,5.917841225492567192e-01,5.950092702600555672e-01,5.968446147902451981e-01,5.972391857279336636e-01,5.961542624265153689e-01,5.935658919483579599e-01,5.894669964541977558e-01,5.838689150519069671e-01,5.768022633696047174e-01,5.683170417580477585e-01,5.584819760246926279e-01,5.473831284473259506e-01,5.351218669332962197e-01,5.218123223724769888e-01,5.075784950275306073e-01,4.925511878352262229e-01,4.768649466688489880e-01,4.606551752160037427e-01,4.440555665508316707e-01,4.271959574847565277e-01,4.102006702283713113e-01,3.931873607403453819e-01,3.762663491649207437e-01,3.595403702979976801e-01,3.431046528480006241e-01,3.270472178255189877e-01,3.114492804431888140e-01,2.963856456428461406e-01,2.819250035955974121e-01,2.681300564338452985e-01,2.550574384930798799e-01,2.427574245203190095e-01,2.312734522287198113e-01,2.206415135371387337e-01,2.108894897541476465e-01,2.020365184868913866e-01,1.940924832168449132e-01,1.870577103440108913e-01,1.809229442110532604e-01,1.756696490972518288e-01,1.712706601533031670e-01,1.676911768630000854e-01,1.648900643686031231e-01,1.628214018894695303e-01,1.614361957961362171e-01,1.606841594297585274e-01,1.605154526213832811e-01,1.608822735222113776e-01,1.617402017768010958e-01,1.630492056365162867e-01,1.647742452685532488e-01,1.668854289922299117e-01,1.693577070322559996e-01,1.721701170550285487e-01,1.753046255884715132e-01,1.787446377303182898e-01,1.824732726797494431e-01,1.864715232476276130e-01,1.907164314648824577e-01,1.951794194070436972e-01,1.998249134315812636e-01,2.046093894723022277e-01,2.094809467704679684e-01,2.143794924333698726e-01,2.192375843783695988e-01,2.239819369959161199e-01,2.285355524082526846e-01,2.328203926489682551e-01,2.367604677715107186e-01,2.402851772907245720e-01,2.433327138994135774e-01,2.458533214674742118e-01,2.478121958843292061e-01,2.491918285999239480e-01,2.499936197337852828e-01,2.502386279812719994e-01,2.499673666768588431e-01,2.492386308257197869e-01,2.481273958254297252e-01,2.467218891751832011e-01,2.451199972985020903e-01,2.434252169234745744e-01,2.417423937608876028e-01,2.401735074184762064e-01,2.388137590966544210e-01,2.377481972420490419e-01,2.370490787908907937e-01,2.367741101459912290e-01,2.369656502101033513e-01,2.376508742817513564e-01,2.388428503755641308e-01,2.405424143346693300e-01,2.427406567791912662e-01,2.454218113639624610e-01,2.485663094830282416e-01,2.521537632804755624e-01,2.561656543132023178e-01,2.605875368106150280e-01,2.654106100502364729e-01,2.706325691623819307e-01,2.762577030964639135e-01,2.822962676807334037e-01,2.887632159596226766e-01,2.956764132199978246e-01,3.030544971301676327e-01,3.109145623580857887e-01,3.192698532306767478e-01,3.281276374484858316e-01,3.374874108664366879e-01,3.473395487189068209e-01,3.576644769453961592e-01,3.684324010409160688e-01,3.796035809112184856e-01,3.911290973160588824e-01,4.029520244461751166e-01,4.150088977644192934e-01,4.272313501512999268e-01,4.395477837814268929e-01,4.518849499725546837e-01,4.641693234555968051e-01,4.763281794514392375e-01,4.882903103416973978e-01,4.999863510147652401e-01,5.113487160101254370e-01,5.223111850582676796e-01,5.328082043239720234e-01,5.427739966057970600e-01,5.521415930962408902e-01,5.608419107593773933e-01,5.688030025213596241e-01,5.759496007535109818e-01,5.822030593235218987e-01,5.874817696549229362e-01,5.917021043240063838e-01,5.947799005072876843e-01,5.966324492784272904e-01,5.971809202212389200e-01,5.963531116944367216e-01,5.940863858899244621e-01,5.903306195711557347e-01,5.850509877188011520e-01,5.782303973829864274e-01,5.698714006123206666e-01,5.599974408770069800e-01,5.486533252992770171e-01,5.359048628478136900e-01,5.218376631841820101e-01,5.065551480325173328e-01,4.901758822832787965e-01,4.728303809580596262e-01,4.546575863944876117e-01,4.358012340202083723e-01,4.164063324065493954e-01,3.966159727951966696e-01,3.765686553561357619e-01,3.563962760264085539e-01,3.362228623218375678e-01,3.161640835764237267e-01,2.963274959267069852e-01,2.768134210040570919e-01,2.577163042956792105e-01,2.391263598524819012e-01,2.211312861975323618e-01,2.038178355451893964e-01,1.872730349910560477e-01,1.715848932005641370e-01,1.568424762989749366e-01,1.431352973779175808e-01,1.305520298742037788e-01,1.191786202415568569e-01,1.090959339129722178e-01,1.003771151282767810e-01,9.308487175377649914e-02,8.726890821207911042e-02,8.296372191208369051e-02,8.018695175732676317e-02,7.893842395138872536e-02,7.919998442922947246e-02,8.093614361987651329e-02,8.409549246916574183e-02,8.861279164223855032e-02,9.441157135089496555e-02,1.014070488856021052e-01,1.095091435234403082e-01,1.186253626925401344e-01,1.286633462509310655e-01,1.395328856300189213e-01,1.511472789653048043e-01,1.634239384662248828e-01,1.762842275221499500e-01,1.896525675447177373e-01,2.034549139496320547e-01,2.176167522376436791e-01,2.320608049594799493e-01,2.467046658595836994e-01,2.614585871297668840e-01,2.762236392568068188e-01,2.908904406036651458e-01,3.053386176410382569e-01,3.194371091649642058e-01,3.330453720753049907e-01,3.460154860639504393e-01,3.581950938500838011e-01,3.694310563172074069e-01,3.795736515927005672e-01,3.884811069195669986e-01,3.960242245888696000e-01,4.020908500112949646e-01,4.065899320389094185e-01,4.094549427492769622e-01,4.106464515929347248e-01,4.101537023932075310e-01,4.079951501553341631e-01,4.042178029535231087e-01,3.988954818292354543e-01,3.921260721192637022e-01,3.840279143205240220e-01,3.747355347793467351e-01,3.643949531297926425e-01,3.531588248112391137e-01,3.411816814030316780e-01,3.286155184615991431e-01,3.156059508646977263e-01,3.022891114240119914e-01 +0.000000000000000000e+00,9.866348036082616541e-04,3.942586105629360821e-03,8.855661259283413231e-03,1.570445170643514771e-02,2.445679236650056057e-02,3.506778235195050220e-02,4.747753584802586607e-02,6.160886714216950999e-02,7.736513807333796067e-02,9.462850694301247478e-02,1.132588125526189232e-01,1.330933035865629610e-01,1.539473813092270271e-01,1.756164632047473861e-01,1.978789993294494676e-01,2.205005874231724117e-01,2.432390401523444323e-01,2.658501701263534800e-01,2.880939813538155869e-01,3.097408984711282343e-01,3.305776347542548343e-01,3.504123020042257397e-01,3.690784026054808598e-01,3.864374158431324036e-01,4.023797928434408311e-01,4.168242997711094078e-01,4.297157867815399324e-01,4.410215982739252305e-01,4.507269649596957195e-01,4.588298173751625408e-01,4.653355228061079596e-01,4.702520653257145633e-01,4.735861579845703218e-01,4.753406979759689510e-01,4.755138556211083167e-01,4.740999366983246754e-01,4.710919883810066322e-01,4.664859465387674042e-01,4.602859658013059296e-01,4.525104492441632820e-01,4.431981985522100986e-01,4.324140815450518982e-01,4.202536347968379715e-01,4.068460927632245316e-01,3.923554590693691391e-01,3.769793955771962302e-01,3.609458861561684051e-01,3.445078178062582208e-01,3.279357937215213181e-01,3.115096383209743358e-01,2.955091600729993218e-01,2.802047893963477421e-01,2.658487095093586827e-01,2.526670472085024155e-01,2.408535933562228892e-01,2.305653904637142426e-01,2.219203703949774453e-01,2.149970642232376383e-01,2.098362524120982453e-01,2.064442892935509366e-01,2.047977341757767078e-01,2.048488567733051657e-01,2.065315603501546582e-01,2.097672801014833499e-01,2.144704621748016460e-01,2.205533032774881219e-01,2.279295222891003780e-01,2.365170335242643418e-01,2.462394870999535801e-01,2.570267276195787876e-01,2.688142922945192526e-01,2.815421201668346085e-01,2.951526747347020252e-01,3.095886946936625139e-01,3.247907847165104611e-01,3.406950439137739206e-01,3.572309077006650679e-01,3.743193533660998384e-01,3.918715928308358909e-01,4.097883495837179035e-01,4.279597908173342069e-01,4.462661589021876818e-01,4.645791177506438663e-01,4.827637977297930538e-01,5.006814865105739809e-01,5.181928728889256819e-01,5.351617074018915066e-01,5.514587004417389471e-01,5.669654396062944191e-01,5.815780786116109269e-01,5.952105353103049890e-01,6.077969399482614499e-01,6.192930999585269936e-01,6.296767961930308521e-01,6.389467961793253714e-01,6.471205587700984418e-01,6.542307051279461216e-01,6.603204350419884516e-01,6.654381655331078615e-01,6.696317507124044388e-01,6.729426985376293358e-01,6.754008238465892822e-01,6.770197673898464830e-01,6.777937615969029661e-01,6.776959372104995882e-01,6.766783524844701692e-01,6.746737952446401065e-01,6.715992683551550435e-01,6.673609362023172897e-01,6.618601910957255807e-01,6.550004097059612951e-01,6.466939166676529682e-01,6.368686606737528066e-01,6.254741383226709583e-01,6.124861690833089956e-01,5.979102240437481619e-01,5.817831317947135261e-01,5.641731151972302349e-01,5.451782406442026163e-01,5.249234752148601579e-01,5.035566371825141996e-01,4.812435848085968582e-01,4.581630137640743117e-01,4.345012249760060730e-01,4.104471857034693305e-01,3.861881435153921016e-01,3.619059738084204336e-01,3.377743556994741159e-01,3.139567877257985473e-01,2.906053822937234021e-01,2.678603216405899268e-01,2.458498217158877619e-01,2.246904354886934407e-01,2.044875318803769659e-01,1.853358078694398725e-01,1.673197237315733610e-01,1.505137897142991010e-01,1.349826711882307351e-01,1.207811138275547980e-01,1.079537173543588940e-01,9.653460413613983160e-02,8.654703737325956936e-02,7.800304406785160682e-02,7.090309272143234531e-02,6.523586751139831552e-02,6.097817218979621756e-02,5.809499016383994074e-02,5.653972320506959331e-02,5.625462990033507082e-02,5.717148515967388628e-02,5.921248191280266415e-02,6.229139318806321823e-02,6.631500467512188579e-02,7.118481243893837185e-02,7.679895678866552333e-02,8.305435261568165639e-02,8.984891904570158072e-02,9.708377564952552774e-02,1.046652860403799457e-01,1.125067819126151919e-01,1.205298031097249006e-01,1.286647080781423702e-01,1.368505445908937135e-01,1.450341248359697799e-01,1.531683186524966378e-01,1.612096580106782695e-01,1.691154270490543565e-01,1.768404861695869190e-01,1.843341365611026739e-01,1.915373646770907323e-01,1.983808082732053391e-01,2.047837532808765293e-01,2.106544036915375395e-01,2.158915686339636375e-01,2.203877905789939640e-01,2.240338046291915908e-01,2.267240841264199780e-01,2.283631076290365824e-01,2.288718894955391880e-01,2.281942609019795842e-01,2.263023742305245167e-01,2.232009421190828125e-01,2.189298058354177401e-01,2.135645516700840907e-01,2.072150480749472279e-01,2.000219464318709894e-01,1.921513588083734181e-01,1.837880806707381243e-01,1.751278504277584136e-01,1.663692188728901622e-01,1.577056321777204895e-01,1.493183090850237205e-01,1.413704184945656084e-01,1.340029443583243551e-01,1.273324737554551445e-01,1.214509770644265352e-01,1.164274742060759094e-01,1.123113229479785202e-01,1.091367368503584762e-01,1.069280488994700795e-01,1.057051922593350290e-01,1.054888736351400069e-01,1.063049633951903827e-01,1.081877161132530213e-01,1.111815527707336604e-01,1.153412732919155831e-01,1.207307069003288047e-01,1.274199372802895525e-01,1.354813510602608517e-01,1.449848408431660407e-01,1.559925437726313313e-01,1.685535121197233588e-01,1.826986954383345851e-01,1.984365690610044863e-01,2.157496789284860383e-01,2.345922955364730389e-01,2.548892863305590728e-01,2.765362350489480314e-01,2.994007641604911618e-01,3.233249563394401394e-01,3.481287247222374925e-01,3.736139503732453515e-01,3.995691857776694778e-01,4.257747150061441666e-01,4.520077612120743105e-01,4.780476381297164568e-01,5.036806526293288178e-01,5.287045793538216465e-01,5.529325460871588049e-01,5.761961905929702255e-01,5.983479773665935086e-01,6.192625970955457637e-01,6.388374134940547622e-01,6.569919686933297642e-01,6.736666118163142647e-01,6.888203699565753624e-01,7.024282317316224988e-01,7.144780546382406561e-01,7.249673446006718036e-01,7.339001616781168913e-01,7.412844052659359750e-01,7.471296965706055726e-01,7.514460286482764761e-01,7.542432830929929333e-01,7.555316297617669097e-01,7.553227381377330962e-01,7.536316443579325064e-01,7.504790453539803563e-01,7.458937390559866598e-01,7.399149035390074625e-01,7.325939130461288640e-01,7.239954280704579137e-01,7.141975579113462036e-01,7.032909830887957847e-01,6.913770306021319589e-01,6.785648020894348154e-01,6.649675556803568144e-01,6.506986261197241772e-01,6.358672252168596772e-01,6.205744883381133503e-01,6.049101220220198805e-01,5.889499607923366353e-01,5.727546629010014101e-01,5.563696734459550042e-01,5.398264684698013127e-01,5.231449797156454418e-01,5.063369920154294768e-01,4.894102161418781294e-01,4.723726855710687622e-01,4.552371007328586683e-01,4.380247554548552524e-01,4.207687248546171377e-01,4.035160657687341113e-01,3.863288725533995938e-01,3.692841329242012582e-01,3.524724298778241782e-01,3.359956270247718702e-01,3.199637477121832219e-01,3.044913074004222953e-01,2.896933811549606275e-01,2.756816835451642023e-01,2.625609101267908363e-01,2.504255437367297610e-01,2.393572700507579643e-01,2.294230843963442901e-01,2.206741122340868666e-01,2.131451100042019708e-01,2.068545739429802632e-01,2.018053592168352339e-01,1.979856977308541155e-01,1.953705020700575445e-01,1.939228511698436186e-01,1.935955663990615583e-01,1.943328010985827803e-01,1.960715793059357170e-01,1.987432282388534310e-01,2.022746539833190360e-01,2.065894116245618750e-01,2.116085219798076733e-01,2.172509900487550050e-01,2.234339883184260911e-01,2.300726836817139076e-01,2.370797118802608350e-01,2.443643342824341758e-01,2.518313532317865144e-01,2.593799040992501026e-01,2.669022801996815963e-01,2.742829853039645549e-01,2.813982182572746793e-01,2.881159873791448445e-01,2.942970403753341069e-01,2.997967374964780607e-01,3.044679284096123983e-01,3.081648035823823517e-01,3.107475936079900358e-01,3.120878962265912215e-01,3.120743209150551034e-01,3.106180748347530662e-01,3.076580770129339615e-01,3.031651861752964749e-01,2.971451649568340736e-01,2.896400783856343808e-01,2.807279325587823671e-01,2.705204915735183735e-01,2.591593553351897450e-01,2.468105242992230941e-01,2.336578055398811915e-01,2.198955148261766412e-01,2.057209910780199436e-01,1.913274557131324494e-01,1.768977175499688581e-01,1.625991466230239935e-01,1.485802246231377743e-01,1.349688366099840997e-01,1.218723123226242849e-01,1.093790703849123330e-01,9.756158001331277640e-02,8.648024658321423752e-02,7.618775891172048509e-02,6.673341345049807471e-02,5.816695554072368046e-02,5.054154669851742415e-02,4.391557135559680247e-02,3.835312529698634704e-02,3.392316777349643070e-02,3.069745543431769141e-02,2.874749507967933049e-02,2.814084289456436627e-02,2.893713249042235633e-02,3.118422838485983978e-02,3.491487568465548308e-02,4.014415530218365391e-02,4.686796494011442188e-02,5.506263927357844812e-02,6.468570897325306990e-02,7.567769767158291638e-02,8.796474972073176080e-02,1.014618285112476731e-01,1.160761806859809675e-01,1.317107540188278969e-01,1.482672788713927658e-01,1.656487703512607990e-01,1.837612745782380985e-01,2.025147602190657259e-01,2.218231375305618480e-01,2.416034641122274951e-01,2.617744635081142301e-01,2.822545347104771785e-01,3.029594647812230424e-01,3.238000726025797027e-01,3.446800103189402442e-01,3.654939328183682834e-01,3.861262171763906736e-01,4.064503769943057510e-01,4.263292740586500651e-01,4.456161842439610443e-01,4.641567280685557906e-01,4.817916302770444692e-01,4.983602282766477209e-01,5.137046068515910280e-01,5.276741971101327477e-01,5.401306422208481672e-01,5.509527029179380753e-01,5.600409542504592997e-01,5.673220141373943592e-01,5.727520444221629869e-01,5.763192895777530245e-01,5.780454837872679441e-01,5.779859073848948592e-01,5.762280726676488607e-01,5.728890289210167852e-01,5.681113819421759192e-01,5.620582158095758230e-01,5.549071884359052520e-01,5.468441412829548876e-01,5.380566097238421719e-01,5.287276378409678790e-01,5.190302861963962400e-01,5.091231724471300124e-01 +0.000000000000000000e+00,9.866357231454326703e-04,3.942644990046745464e-03,8.856327487121102779e-03,1.570815868958471556e-02,2.447075596210843140e-02,3.510883537800308513e-02,4.757916374008061555e-02,6.183051176963721279e-02,7.780361586453850287e-02,9.543115723098079262e-02,1.146377684168929517e-01,1.353400781612679460e-01,1.574468058905059142e-01,1.808589170194807028e-01,2.054698493695692463e-01,2.311658195198076360e-01,2.578262157097447882e-01,2.853240812052510456e-01,3.135266889622845832e-01,3.422962051815292006e-01,3.714904361768371910e-01,4.009636501157627930e-01,4.305674628392593961e-01,4.601517752883610424e-01,4.895657491488741853e-01,5.186588071822504364e-01,5.472816452724571512e-01,5.752872443417644810e-01,6.025318717726235729e-01,6.288760635836794233e-01,6.541855801022072869e-01,6.783323290339151601e-01,7.011952505230355515e-01,7.226611590543784436e-01,7.426255369290207797e-01,7.609932732349046214e-01,7.776793403722225273e-01,7.926093975170206418e-01,8.057203140043676104e-01,8.169606063582804945e-01,8.262907643073651442e-01,8.336834653870360823e-01,8.391236696458265198e-01,8.426085863121196562e-01,8.441475092766836941e-01,8.437615221307244173e-01,8.414830774378408984e-01,8.373554586650834297e-01,8.314321390577195103e-01,8.237760534605698126e-01,8.144587993890362032e-01,8.035597895463457707e-01,7.911653766444198821e-01,7.773679706273048939e-01,7.622651672073770257e-01,7.459589044392195278e-01,7.285546613000307703e-01,7.101607090107961984e-01,6.908874226118592032e-01,6.708466575363898343e-01,6.501511929896636177e-01,6.289142415819043430e-01,6.072490223161106648e-01,5.852683921862262828e-01,5.630845309835550427e-01,5.408086732752458436e-01,5.185508805810240540e-01,4.964198460045918804e-01,4.745227229485059484e-01,4.529649692258420624e-01,4.318501976924642993e-01,4.112800240091448734e-01,3.913539017322919533e-01,3.721689351100698206e-01,3.538196608965134549e-01,3.363977915234899196e-01,3.199919122719632747e-01,3.046871274072034397e-01,2.905646549426926795e-01,2.777013697348987842e-01,2.661692977775058644e-01,2.560350686885496385e-01,2.473593351325531764e-01,2.401961699261511152e-01,2.345924532064948553e-01,2.305872630119950029e-01,2.282112829008393073e-01,2.274862397578530371e-01,2.284243840003458148e-01,2.310280236072444204e-01,2.352891222842996566e-01,2.411889702883403541e-01,2.486979351507031810e-01,2.577752989105360215e-01,2.683691880993047119e-01,2.804166025776846927e-01,2.938435493975029567e-01,3.085652880018129318e-01,3.244866930630475044e-01,3.415027408401660747e-01,3.594991245423278525e-01,3.783530039044405435e-01,3.979338882310598513e-01,4.181046502640060614e-01,4.387226665791282287e-01,4.596410746176488593e-01,4.807101312434927110e-01,5.017786534871420123e-01,5.226955176603308439e-01,5.433111897816409464e-01,5.634792575482898691e-01,5.830579328880604040e-01,6.019114943204201262e-01,6.199116398509555426e-01,6.369387238903139181e-01,6.528828555770938014e-01,6.676448406102178934e-01,6.811369539175036181e-01,6.932835358458606656e-01,7.040214097141809235e-01,7.133001232279894133e-01,7.210820201907340854e-01,7.273421520222014269e-01,7.320680407651894983e-01,7.352593065760920643e-01,7.369271732915655404e-01,7.370938657485988088e-01,7.357919123177901755e-01,7.330633657184546514e-01,7.289589546648725937e-01,7.235371785482058726e-01,7.168633574693016319e-01,7.090086505176237397e-01,7.000490557988704454e-01,6.900644062601187789e-01,6.791373759685563893e-01,6.673525119384359217e-01,6.547953067006627714e-01,6.415513264414299810e-01,6.277054086219343576e-01,6.133409415045022461e-01,5.985392359797039319e-01,5.833789975931267247e-01,5.679359038284500505e-01,5.522822886605636139e-01,5.364869333049064881e-01,5.206149591080534433e-01,5.047278157782905117e-01,4.888833557350464876e-01,4.731359833212708810e-01,4.575368660154192080e-01,4.421341936125801619e-01,4.269734705908327377e-01,4.120978265910498761e-01,3.975483299438983265e-01,3.833642906342928369e-01,3.695835385697428532e-01,3.562426608741192657e-01,3.433771915891822846e-01,3.310217439810890783e-01,3.192100782884537691e-01,3.079751013445741759e-01,2.973487977453295183e-01,2.873620956666856907e-01,2.780446739557396740e-01,2.694247204740953250e-01,2.615286546339700702e-01,2.543808294537084347e-01,2.480032300339939655e-01,2.424151858897769518e-01,2.376331139660622371e-01,2.336703074964043003e-01,2.305367829526479007e-01,2.282391935798818439e-01,2.267808140342565948e-01,2.261615956399325167e-01,2.263782865776997055e-01,2.274246072405413377e-01,2.292914679186973392e-01,2.319672136755611680e-01,2.354378794787025386e-01,2.396874392799412945e-01,2.446980342171574119e-01,2.504501677985463415e-01,2.569228595038183238e-01,2.640937523409234711e-01,2.719391741339162727e-01,2.804341562753633887e-01,2.895524169785651525e-01,2.992663184099043638e-01,3.095468082711028135e-01,3.203633563523206607e-01,3.316838954245494575e-01,3.434747743328315228e-01,3.557007281352143058e-01,3.683248646969871087e-01,3.813086670352804908e-01,3.946120077000719872e-01,4.081931681428864755e-01,4.220088554871272990e-01,4.360142095690194841e-01,4.501627942534840998e-01,4.644065689410312725e-01,4.786958392538864238e-01,4.929791907529941786e-01,5.072034101087891100e-01,5.213134007869650866e-01,5.352521073514046046e-01,5.489604620961153758e-01,5.623773684553659002e-01,5.754397356630460703e-01,5.880825779572438350e-01,6.002391896655917547e-01,6.118414052200615849e-01,6.228199490865736765e-01,6.331048760505311179e-01,6.426260997391592955e-01,6.513140040346723225e-01,6.591001288524804824e-01,6.659179192034511141e-01,6.717035244406529548e-01,6.763966332187797414e-01,6.799413288302431635e-01,6.822869491487900673e-01,6.833889353220190532e-01,6.832096535090085299e-01,6.817191742667616516e-01,6.788959946061148276e-01,6.747276882820618660e-01,6.692114705877215686e-01,6.623546648195386410e-01,6.541750587201483613e-01,6.447011406431227831e-01,6.339722069643928259e-01,6.220383341852959713e-01,6.089602108207126108e-01,5.948088268336240159e-01,5.796650343207806477e-01,5.636189681943283292e-01,5.467693347367493795e-01,5.292225834699946230e-01,5.110919729963681046e-01,4.924965433484309596e-01,4.735600093960784518e-01,4.544095908883613033e-01,4.351747954943702146e-01,4.159861713787296189e-01,3.969740457866203220e-01,3.782672659552644978e-01,3.599919569548204468e-01,3.422703162079934747e-01,3.252194781954213521e-01,3.089504343113304574e-01,2.935670369145023662e-01,2.791651125489791330e-01,2.658316952775732767e-01,2.536443929926288643e-01,2.426708984389200352e-01,2.329686541502537511e-01,2.245846765207248630e-01,2.175555403914150587e-01,2.119075196103588077e-01,2.076568747416896732e-01,2.048102728795276051e-01,2.033653323853486794e-01,2.033112652805746656e-01,2.046295826733430800e-01,2.072948513226655076e-01,2.112754724244013116e-01,2.165344580493356319e-01,2.230301831303822535e-01,2.307170944357385955e-01,2.395463614784868744e-01,2.494664589945678745e-01,2.604236749935301964e-01,2.723625424313626531e-01,2.852261960673390107e-01,2.989566587863987657e-01,3.134950634838801209e-01,3.287818175467023818e-01,3.447567169538696685e-01,3.613590163817826939e-01,3.785274608038954325e-01,3.962002826936426025e-01,4.143151695522696576e-01,4.328092070940657843e-01,4.516187941688183938e-01,4.706795328113089760e-01,4.899261001051039566e-01,5.092921063958810723e-01,5.287099460441397891e-01,5.481106490419126454e-01,5.674237436840687820e-01,5.865771418924530245e-01,6.054970596148760986e-01,6.241079849314028483e-01,6.423327058674842549e-01,6.600924085330477364e-01,6.773068541337775583e-01,6.938946407773511904e-01,7.097735530041879848e-01,7.248609987932189691e-01,7.390745304684418482e-01,7.523324434622741252e-01,7.645544438641245222e-01,7.756623734111660617e-01,7.855809782268867725e-01,7.942387125333890685e-01,8.015685565508032795e-01,8.075088332045776696e-01,8.120040110026581770e-01,8.150054763291482152e-01,8.164722603720603322e-01,8.163717050983982926e-01,8.146800523814204942e-01,8.113829432230312833e-01,8.064758138269472187e-01,7.999641768936709418e-01,7.918637786799225253e-01,7.822006250084826418e-01,7.710108726279012448e-01,7.583405860365013407e-01,7.442453639585495662e-01,7.287898438895934472e-01,7.120470972616327332e-01,6.940979315366538893e-01,6.750301186414663368e-01,6.549375713648154518e-01,6.339194904635049310e-01,6.120795051400651499e-01,5.895248282085350233e-01,5.663654447359190991e-01,5.427133494713710649e-01,5.186818443706583404e-01,4.943849026663457713e-01,4.699366016243365918e-01,4.454506218030427900e-01,4.210398068452895215e-01,3.968157751230226293e-01,3.728885726338133089e-01,3.493663555658315656e-01,3.263550910706878860e-01,3.039582657709395952e-01,2.822765931547459028e-01,2.614077131003702537e-01,2.414458790504617758e-01,2.224816304441564752e-01,2.046014497563139467e-01,1.878874049325964246e-01,1.724167790512003695e-01,1.582616895753282960e-01,1.454886997149058836e-01,1.341584244033920126e-01,1.243251332322156261e-01,1.160363523919098611e-01,1.093324685958649706e-01,1.042463367738716562e-01,1.008028953921046023e-01,9.901879409018707334e-02,9.890203947054541922e-02,1.004516664318624158e-01,1.036574438638094564e-01,1.084996247425994015e-01,1.149487515504620944e-01,1.229655283259639409e-01,1.325007703611075505e-01,1.434954417426258511e-01,1.558807896185124553e-01,1.695785821669775484e-01,1.845014549757894584e-01,2.005533680887285064e-01,2.176301735193399423e-01,2.356202906501852767e-01,2.544054847419597309e-01,2.738617418137309079e-01,2.938602315217140326e-01,3.142683483249020249e-01,3.349508201320685052e-01,3.557708726935699395e-01,3.765914370918085896e-01,3.972763868407543364e-01,4.176917901715578307e-01,4.377071620865168877e-01,4.571966996695068230e-01,4.760404829823703388e-01,4.941256161327270968e-01,5.113472873984502565e-01,5.276098135758364727e-01,5.428274948658297072e-01,5.569253757242124125e-01,5.698398733928706772e-01,5.815192597192705426e-01,5.919239892149231741e-01,6.010268697625460455e-01,6.088130762105234961e-01,6.152800108875516871e-01,6.204370185364780355e-01,6.243049661183599497e-01,6.269157002902211451e-01 diff --git a/lib/BloqadeNoisy/examples/QuTiP_comparison/QuTiPComparison.jl b/lib/BloqadeNoisy/examples/QuTiP_comparison/QuTiPComparison.jl new file mode 100644 index 000000000..616ae337f --- /dev/null +++ b/lib/BloqadeNoisy/examples/QuTiP_comparison/QuTiPComparison.jl @@ -0,0 +1,59 @@ +using Bloqade +using BloqadeNoisy + +using LaTeXStrings +using Plots +using CSV +using DataFrames + +reg = zero_state(3) +h = rydberg_h([(0.0, 0.0), (8.0, 0.0), (18.0, 0.0)], Ω=2π, Δ=0) +tend = 4.0 +save_times = LinRange(0, tend, 200) + +#Add collapse operators to simulation +c_ops = [mat(put(3, i => sqrt(0.1) * (X + Y * im) / 2)) for i in 1:3] +ns = NoisySchrodingerProblem(reg, save_times, h, c_ops) + +#get noisy expectation values +ntraj = 2000 +expecs = [mat(put(3, i => Op.n)) for i in 1:3] +@time sim = emulate(ns, ntraj, expecs; report_error = true, ensemble_algo=EnsembleSerial()) + +plot(xlabel="t (µs)", ylabel=L"\langle n_i \rangle") +for (i, _) in enumerate(expecs) + plot!(save_times, + sim.expectations[i], + ribbon=sim.twosigma[i], + color=:blue, + label=(i == 1 ? "BloqadeNoisy" : "") + ) +end + +qutip_vals = CSV.read("/Users/queraintern/Documents/GitHub/Bloqade.jl/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect.csv", DataFrame, header=false, delim=",") +qutip_vals_noiseless = CSV.read("/Users/queraintern/Documents/GitHub/Bloqade.jl/lib/BloqadeNoisy/examples/QuTiP_comparison/3q_expect_nonoise.csv", DataFrame, header=false, delim=",") + +for i in 1:3 + plot!( + 0:1.0f-2:3.99, + collect(qutip_vals[i, :]), + color=:red, + linestyle=:dash, + label=i == 1 ? "QuTiP" : "" + ) +end + +for i in 1:3 + plot!( + 0:1.0f-2:3.99, + collect(qutip_vals_noiseless[i, :]), + color=:black, + label=i == 1 ? "noiseless" : "", + alpha=0.3 + ) +end + +current() +ylims!(0, 1.1) + +png("qutip_comparison.png") \ No newline at end of file diff --git a/lib/BloqadeNoisy/examples/QuTiP_comparison/noisy_comparison.py b/lib/BloqadeNoisy/examples/QuTiP_comparison/noisy_comparison.py new file mode 100644 index 000000000..78fc83405 --- /dev/null +++ b/lib/BloqadeNoisy/examples/QuTiP_comparison/noisy_comparison.py @@ -0,0 +1,65 @@ +import qutip as qt +import numpy as np +from matplotlib import pyplot as plt + +def n(): + return (1-qt.sigmaz())/2 + +def put(nqubits, qubit, op): + ops = [qt.identity(2) for q in range(nqubits)] + ops[qubit] = op + return qt.tensor(*reversed(ops)) + +def state(*states): + return qt.tensor(*[qt.basis(2, s) for s in reversed(states)]) + +def rectlattice(h, w, scale = 1): + return [(scale * j, scale*i) for i in range(w) for j in range(h)] + +C = np.pi * 2 * 862690 + +def dist(c1, c2): + return np.sqrt((c1[0]-c2[0])**2 + (c1[1]-c2[1])**2) + +def rydberg_h(atoms, Omega, delta): + N = len(atoms) + sumOfX = sum([put(N, i, qt.sigmax()) for i in range(N)]) + sumOfn = sum([put(N, i, n()) for i in range(N)]) + ryd_op = [] + for i in range(N): + for j in range(i+1, N): + ryd_op.append( + C/dist(atoms[i], atoms[j])**6 * put(N, i, n()) * put(N, j, n()) + ) + return Omega/2 * sumOfX - delta * sumOfn + sum(ryd_op) + +Omega = 2*np.pi +R = (C/Omega)**(1/6) +N = 3 +atoms = [(0, 0),(8, 0),(18,0)] +h = rydberg_h(atoms, Omega, 0) + +rate = 1/10 + +destroy = qt.basis(2,0) * qt.basis(2,1).dag() +c_ops = [np.sqrt(rate) * put(N, i, destroy) for i in range(N)] + +times = np.arange(0, 4.0, 1e-2) + +sol_noisy = qt.mesolve( + h, + state(*np.zeros(N, dtype = int)), + times, + c_ops = c_ops, + e_ops = [put(N, i, n()) for i in range(3)] +) + +sol = qt.sesolve( + h, + state(*np.zeros(N, dtype = int)), + times, + e_ops = [put(N, i, n()) for i in range(3)] +) + +np.savetxt("./3q_expect_nonoise.csv", sol.expect, header = "", delimiter=",") +np.savetxt("./3q_expect.csv", sol_noisy.expect, header = "", delimiter=",") \ No newline at end of file diff --git a/lib/BloqadeNoisy/examples/QuTiP_comparison/qutip_comparison.png b/lib/BloqadeNoisy/examples/QuTiP_comparison/qutip_comparison.png new file mode 100644 index 000000000..b7670e99a Binary files /dev/null and b/lib/BloqadeNoisy/examples/QuTiP_comparison/qutip_comparison.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz.csv b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz.csv new file mode 100644 index 000000000..daf940829 --- /dev/null +++ b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz.csv @@ -0,0 +1,2 @@ +1.300000000000000044e-01,1.489999999999999936e-01,1.679999999999999827e-01,1.869999999999999996e-01,2.059999999999999887e-01,2.250000000000000056e-01,2.439999999999999947e-01,2.630000000000000115e-01,2.820000000000000284e-01,3.009999999999999898e-01,3.200000000000000067e-01,3.390000000000000235e-01,3.579999999999999849e-01,3.770000000000000018e-01,3.960000000000000187e-01,4.149999999999999800e-01,4.339999999999999969e-01,4.530000000000000138e-01,4.719999999999999751e-01,4.909999999999999920e-01,5.100000000000000089e-01,5.290000000000000258e-01,5.480000000000000426e-01,5.669999999999999485e-01,5.860000000000000764e-01,6.049999999999999822e-01,6.239999999999998881e-01,6.430000000000000160e-01,6.619999999999999218e-01,6.810000000000000497e-01,6.999999999999999556e-01,7.190000000000000835e-01,7.379999999999999893e-01,7.569999999999998952e-01,7.760000000000000231e-01,7.949999999999999289e-01,8.140000000000000568e-01,8.329999999999999627e-01,8.520000000000000906e-01,8.709999999999999964e-01,8.899999999999999023e-01,9.090000000000000302e-01,9.279999999999999361e-01,9.470000000000000639e-01,9.659999999999999698e-01,9.850000000000000977e-01,1.004000000000000004e+00,1.022999999999999909e+00,1.042000000000000037e+00,1.060999999999999943e+00 +6.562500000000000000e-01,7.712499999999999911e-01,8.625000000000000444e-01,9.024999999999999689e-01,9.024999999999999689e-01,8.549999999999999822e-01,8.000000000000000444e-01,6.912499999999999201e-01,5.912500000000000533e-01,4.537499999999999867e-01,3.249999999999999556e-01,1.975000000000000089e-01,1.025000000000000355e-01,4.125000000000000888e-02,1.875000000000004441e-02,3.500000000000003109e-02,1.137500000000000178e-01,1.537500000000000533e-01,3.050000000000000488e-01,4.150000000000000355e-01,5.562500000000000222e-01,6.824999999999999956e-01,7.750000000000000222e-01,8.649999999999999911e-01,9.062500000000000000e-01,9.037500000000000533e-01,8.725000000000000533e-01,8.175000000000000044e-01,7.150000000000000799e-01,5.587500000000000799e-01,4.887500000000000178e-01,3.225000000000000089e-01,2.287500000000000089e-01,1.250000000000000000e-01,5.625000000000002220e-02,3.749999999999997780e-02,4.500000000000003997e-02,9.999999999999997780e-02,1.574999999999999734e-01,2.750000000000000222e-01,3.762499999999999734e-01,5.224999999999999645e-01,6.362499999999999822e-01,7.349999999999999867e-01,7.924999999999999822e-01,8.837500000000000355e-01,8.800000000000000044e-01,8.549999999999999822e-01,8.200000000000000622e-01,7.399999999999999911e-01 diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_detuned_long.csv b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_detuned_long.csv new file mode 100644 index 000000000..76e6ea6f5 --- /dev/null +++ b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_detuned_long.csv @@ -0,0 +1,2 @@ +1.600000000000000033e-01,2.089999999999999913e-01,2.580000000000000071e-01,3.079999999999999960e-01,3.569999999999999840e-01,4.059999999999999720e-01,4.550000000000000155e-01,5.040000000000000036e-01,5.529999999999999361e-01,6.020000000000000906e-01,6.519999999999999130e-01,7.010000000000000675e-01,7.500000000000000000e-01,7.989999999999999325e-01,8.480000000000000870e-01,8.970000000000000195e-01,9.459999999999999520e-01,9.959999999999999964e-01,1.044999999999999929e+00,1.093999999999999861e+00,1.143000000000000016e+00,1.191999999999999948e+00,1.240999999999999881e+00,1.290000000000000036e+00,1.338999999999999968e+00,1.389000000000000012e+00,1.437999999999999945e+00,1.486999999999999877e+00,1.536000000000000032e+00,1.584999999999999964e+00,1.633999999999999897e+00,1.683000000000000052e+00,1.732999999999999874e+00,1.782000000000000028e+00,1.830999999999999961e+00,1.879999999999999893e+00,1.929000000000000048e+00,1.977999999999999980e+00,2.027000000000000135e+00,2.076999999999999957e+00,2.125999999999999890e+00,2.174999999999999822e+00,2.223999999999999755e+00,2.273000000000000131e+00,2.322000000000000064e+00,2.370999999999999996e+00,2.420999999999999819e+00,2.469999999999999751e+00,2.519000000000000128e+00,2.568000000000000060e+00,2.616999999999999993e+00,2.665999999999999925e+00,2.714999999999999858e+00,2.765000000000000124e+00,2.814000000000000057e+00,2.862999999999999989e+00,2.911999999999999922e+00,2.960999999999999854e+00,3.009999999999999787e+00,3.059000000000000163e+00,3.108999999999999986e+00,3.157999999999999918e+00,3.206999999999999851e+00,3.255999999999999783e+00,3.305000000000000160e+00,3.354000000000000092e+00,3.403000000000000025e+00,3.452999999999999847e+00,3.501999999999999780e+00,3.551000000000000156e+00,3.600000000000000089e+00,3.649000000000000021e+00,3.697999999999999954e+00,3.746999999999999886e+00,3.797000000000000153e+00,3.846000000000000085e+00,3.895000000000000018e+00,3.943999999999999950e+00,3.992999999999999883e+00,4.041999999999999815e+00,4.091000000000000192e+00,4.139999999999999680e+00,4.189999999999999503e+00,4.238999999999999879e+00,4.288000000000000256e+00,4.336999999999999744e+00,4.386000000000000121e+00,4.434999999999999609e+00,4.483999999999999986e+00,4.533999999999999808e+00,4.583000000000000185e+00,4.631999999999999673e+00,4.681000000000000050e+00,4.729999999999999538e+00,4.778999999999999915e+00,4.828000000000000291e+00,4.878000000000000114e+00,4.926999999999999602e+00,4.975999999999999979e+00,5.025000000000000355e+00,5.073999999999999844e+00,5.123000000000000220e+00,5.171999999999999709e+00,5.221999999999999531e+00,5.270999999999999908e+00,5.320000000000000284e+00,5.368999999999999773e+00,5.418000000000000149e+00,5.466999999999999638e+00,5.516000000000000014e+00,5.565999999999999837e+00,5.615000000000000213e+00,5.663999999999999702e+00,5.713000000000000078e+00,5.761999999999999567e+00,5.810999999999999943e+00,5.860000000000000320e+00,5.910000000000000142e+00,5.958999999999999631e+00,6.008000000000000007e+00,6.057000000000000384e+00,6.105999999999999872e+00,6.155000000000000249e+00,6.203999999999999737e+00,6.253000000000000114e+00,6.302999999999999936e+00,6.352000000000000313e+00,6.400999999999999801e+00,6.450000000000000178e+00,6.498999999999999666e+00,6.548000000000000043e+00,6.596999999999999531e+00,6.647000000000000242e+00,6.695999999999999730e+00,6.745000000000000107e+00,6.793999999999999595e+00,6.842999999999999972e+00,6.892000000000000348e+00,6.940999999999999837e+00,6.990999999999999659e+00,7.040000000000000036e+00,7.088999999999999524e+00,7.137999999999999901e+00,7.187000000000000277e+00,7.235999999999999766e+00,7.285000000000000142e+00,7.334999999999999964e+00,7.384000000000000341e+00,7.432999999999999829e+00,7.482000000000000206e+00,7.530999999999999694e+00,7.580000000000000071e+00,7.628999999999999559e+00,7.679000000000000270e+00,7.727999999999999758e+00,7.777000000000000135e+00,7.825999999999999623e+00,7.875000000000000000e+00,7.924000000000000377e+00,7.972999999999999865e+00,8.022999999999999687e+00,8.071999999999999176e+00,8.121000000000000441e+00,8.169999999999999929e+00,8.218999999999999417e+00,8.268000000000000682e+00,8.317000000000000171e+00,8.366999999999999105e+00,8.416000000000000369e+00,8.464999999999999858e+00,8.513999999999999346e+00,8.563000000000000611e+00,8.612000000000000099e+00,8.660999999999999588e+00,8.711000000000000298e+00,8.759999999999999787e+00,8.808999999999999275e+00,8.858000000000000540e+00,8.907000000000000028e+00,8.955999999999999517e+00,9.005000000000000782e+00,9.054000000000000270e+00,9.103999999999999204e+00,9.153000000000000469e+00,9.201999999999999957e+00,9.250999999999999446e+00,9.300000000000000711e+00,9.349000000000000199e+00,9.397999999999999687e+00,9.448000000000000398e+00,9.496999999999999886e+00,9.545999999999999375e+00,9.595000000000000639e+00,9.644000000000000128e+00,9.692999999999999616e+00,9.741999999999999105e+00,9.791999999999999815e+00,9.840999999999999304e+00,9.890000000000000568e+00,9.939000000000000057e+00 +3.137499999999999734e-01,1.662500000000000089e-01,2.249999999999996447e-02,1.087500000000000133e-01,3.087499999999999689e-01,4.037500000000000533e-01,2.762499999999999956e-01,7.874999999999998668e-02,4.249999999999998224e-02,1.750000000000000444e-01,3.575000000000000400e-01,3.100000000000000533e-01,1.612500000000000044e-01,4.249999999999998224e-02,8.374999999999999112e-02,2.712499999999999911e-01,3.750000000000000000e-01,2.874999999999999778e-01,1.012499999999999512e-01,4.125000000000000888e-02,1.524999999999999689e-01,3.187499999999999778e-01,3.337499999999999911e-01,1.800000000000000488e-01,7.999999999999996003e-02,1.012499999999999512e-01,2.624999999999999556e-01,3.212500000000000355e-01,2.900000000000000355e-01,1.650000000000000355e-01,8.499999999999996447e-02,1.324999999999999512e-01,2.950000000000000400e-01,3.187499999999999778e-01,2.249999999999999778e-01,9.125000000000005329e-02,1.087500000000000133e-01,1.987499999999999822e-01,2.537500000000000311e-01,2.824999999999999734e-01,2.125000000000000222e-01,1.025000000000000355e-01,1.199999999999999956e-01,2.187500000000000000e-01,2.874999999999999778e-01,2.924999999999999822e-01,2.049999999999999600e-01,1.087500000000000133e-01,1.474999999999999645e-01,2.537500000000000311e-01,2.987499999999999600e-01,2.299999999999999822e-01,1.587499999999999467e-01,1.237500000000000266e-01,1.824999999999999956e-01,2.500000000000000000e-01,2.587500000000000355e-01,2.137499999999999956e-01,1.450000000000000178e-01,1.400000000000000133e-01,1.912500000000000311e-01,2.737500000000000488e-01,2.475000000000000533e-01,1.962500000000000355e-01,1.374999999999999556e-01,1.574999999999999734e-01,2.149999999999999689e-01,2.125000000000000222e-01,2.237500000000000044e-01,1.800000000000000488e-01,1.600000000000000311e-01,1.762500000000000178e-01,2.462499999999999689e-01,2.500000000000000000e-01,2.012500000000000400e-01,2.037499999999999867e-01,1.574999999999999734e-01,2.199999999999999734e-01,2.387500000000000178e-01,1.937499999999999778e-01,1.812500000000000222e-01,1.587499999999999467e-01,1.987499999999999822e-01,2.087499999999999911e-01,2.249999999999999778e-01,2.087499999999999911e-01,1.724999999999999867e-01,1.574999999999999734e-01,1.987499999999999822e-01,2.175000000000000266e-01,1.975000000000000089e-01,2.075000000000000178e-01,1.587499999999999467e-01,1.687499999999999556e-01,1.975000000000000089e-01,2.249999999999999778e-01,1.999999999999999556e-01,1.987499999999999822e-01,1.662500000000000089e-01,2.025000000000000133e-01,2.162500000000000533e-01,2.362499999999999600e-01,2.037499999999999867e-01,2.025000000000000133e-01,1.612500000000000044e-01,2.237500000000000044e-01,2.225000000000000311e-01,2.399999999999999911e-01,1.987499999999999822e-01,1.612500000000000044e-01,2.112500000000000488e-01,2.162500000000000533e-01,2.262499999999999512e-01,2.175000000000000266e-01,2.049999999999999600e-01,1.750000000000000444e-01,1.662500000000000089e-01,1.975000000000000089e-01,2.362499999999999600e-01,2.125000000000000222e-01,1.949999999999999512e-01,1.824999999999999956e-01,1.800000000000000488e-01,2.199999999999999734e-01,2.375000000000000444e-01,2.262499999999999512e-01,1.887499999999999734e-01,1.762500000000000178e-01,2.099999999999999645e-01,2.187500000000000000e-01,2.012500000000000400e-01,2.187500000000000000e-01,1.987499999999999822e-01,1.987499999999999822e-01,2.262499999999999512e-01,2.537500000000000311e-01,2.287500000000000089e-01,2.175000000000000266e-01,2.387500000000000178e-01,1.925000000000000044e-01,2.262499999999999512e-01,2.449999999999999956e-01,2.437500000000000222e-01,2.312499999999999556e-01,2.112500000000000488e-01,2.537500000000000311e-01,2.449999999999999956e-01,2.662499999999999867e-01,2.187500000000000000e-01,2.075000000000000178e-01,2.199999999999999734e-01,2.325000000000000400e-01,2.524999999999999467e-01,2.800000000000000266e-01,2.249999999999999778e-01,2.075000000000000178e-01,2.175000000000000266e-01,2.225000000000000311e-01,2.700000000000000178e-01,1.937499999999999778e-01,1.949999999999999512e-01,2.099999999999999645e-01,1.975000000000000089e-01,2.475000000000000533e-01,2.387500000000000178e-01,2.299999999999999822e-01,2.362499999999999600e-01,2.349999999999999867e-01,2.362499999999999600e-01,2.299999999999999822e-01,2.375000000000000444e-01,2.099999999999999645e-01,1.862500000000000266e-01,2.225000000000000311e-01,1.937499999999999778e-01,2.337500000000000133e-01,2.262499999999999512e-01,1.999999999999999556e-01,2.212499999999999467e-01,1.949999999999999512e-01,2.112500000000000488e-01,2.025000000000000133e-01,1.962500000000000355e-01,2.025000000000000133e-01,2.312499999999999556e-01,1.999999999999999556e-01,2.175000000000000266e-01,2.237500000000000044e-01,2.612499999999999822e-01,2.362499999999999600e-01,2.287500000000000089e-01,2.112500000000000488e-01,2.550000000000000044e-01,2.487500000000000266e-01,2.449999999999999956e-01,1.962500000000000355e-01,1.987499999999999822e-01,1.925000000000000044e-01,2.325000000000000400e-01,2.199999999999999734e-01 diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_long.csv b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_long.csv new file mode 100644 index 000000000..fea5819d7 --- /dev/null +++ b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/15MHz_long.csv @@ -0,0 +1,2 @@ +1.600000000000000033e-01,2.089999999999999913e-01,2.580000000000000071e-01,3.079999999999999960e-01,3.569999999999999840e-01,4.059999999999999720e-01,4.550000000000000155e-01,5.040000000000000036e-01,5.529999999999999361e-01,6.020000000000000906e-01,6.519999999999999130e-01,7.010000000000000675e-01,7.500000000000000000e-01,7.989999999999999325e-01,8.480000000000000870e-01,8.970000000000000195e-01,9.459999999999999520e-01,9.959999999999999964e-01,1.044999999999999929e+00,1.093999999999999861e+00,1.143000000000000016e+00,1.191999999999999948e+00,1.240999999999999881e+00,1.290000000000000036e+00,1.338999999999999968e+00,1.389000000000000012e+00,1.437999999999999945e+00,1.486999999999999877e+00,1.536000000000000032e+00,1.584999999999999964e+00,1.633999999999999897e+00,1.683000000000000052e+00,1.732999999999999874e+00,1.782000000000000028e+00,1.830999999999999961e+00,1.879999999999999893e+00,1.929000000000000048e+00,1.977999999999999980e+00,2.027000000000000135e+00,2.076999999999999957e+00,2.125999999999999890e+00,2.174999999999999822e+00,2.223999999999999755e+00,2.273000000000000131e+00,2.322000000000000064e+00,2.370999999999999996e+00,2.420999999999999819e+00,2.469999999999999751e+00,2.519000000000000128e+00,2.568000000000000060e+00,2.616999999999999993e+00,2.665999999999999925e+00,2.714999999999999858e+00,2.765000000000000124e+00,2.814000000000000057e+00,2.862999999999999989e+00,2.911999999999999922e+00,2.960999999999999854e+00,3.009999999999999787e+00,3.059000000000000163e+00,3.108999999999999986e+00,3.157999999999999918e+00,3.206999999999999851e+00,3.255999999999999783e+00,3.305000000000000160e+00,3.354000000000000092e+00,3.403000000000000025e+00,3.452999999999999847e+00,3.501999999999999780e+00,3.551000000000000156e+00,3.600000000000000089e+00,3.649000000000000021e+00,3.697999999999999954e+00,3.746999999999999886e+00,3.797000000000000153e+00,3.846000000000000085e+00,3.895000000000000018e+00,3.943999999999999950e+00,3.992999999999999883e+00,4.041999999999999815e+00,4.091000000000000192e+00,4.139999999999999680e+00,4.189999999999999503e+00,4.238999999999999879e+00,4.288000000000000256e+00,4.336999999999999744e+00,4.386000000000000121e+00,4.434999999999999609e+00,4.483999999999999986e+00,4.533999999999999808e+00,4.583000000000000185e+00,4.631999999999999673e+00,4.681000000000000050e+00,4.729999999999999538e+00,4.778999999999999915e+00,4.828000000000000291e+00,4.878000000000000114e+00,4.926999999999999602e+00,4.975999999999999979e+00,5.025000000000000355e+00,5.073999999999999844e+00,5.123000000000000220e+00,5.171999999999999709e+00,5.221999999999999531e+00,5.270999999999999908e+00,5.320000000000000284e+00,5.368999999999999773e+00,5.418000000000000149e+00,5.466999999999999638e+00,5.516000000000000014e+00,5.565999999999999837e+00,5.615000000000000213e+00,5.663999999999999702e+00,5.713000000000000078e+00,5.761999999999999567e+00,5.810999999999999943e+00,5.860000000000000320e+00,5.910000000000000142e+00,5.958999999999999631e+00,6.008000000000000007e+00,6.057000000000000384e+00,6.105999999999999872e+00,6.155000000000000249e+00,6.203999999999999737e+00,6.253000000000000114e+00,6.302999999999999936e+00,6.352000000000000313e+00,6.400999999999999801e+00,6.450000000000000178e+00,6.498999999999999666e+00,6.548000000000000043e+00,6.596999999999999531e+00,6.647000000000000242e+00,6.695999999999999730e+00,6.745000000000000107e+00,6.793999999999999595e+00,6.842999999999999972e+00,6.892000000000000348e+00,6.940999999999999837e+00,6.990999999999999659e+00,7.040000000000000036e+00,7.088999999999999524e+00,7.137999999999999901e+00,7.187000000000000277e+00,7.235999999999999766e+00,7.285000000000000142e+00,7.334999999999999964e+00,7.384000000000000341e+00,7.432999999999999829e+00,7.482000000000000206e+00,7.530999999999999694e+00,7.580000000000000071e+00,7.628999999999999559e+00,7.679000000000000270e+00,7.727999999999999758e+00,7.777000000000000135e+00,7.825999999999999623e+00,7.875000000000000000e+00,7.924000000000000377e+00,7.972999999999999865e+00,8.022999999999999687e+00,8.071999999999999176e+00,8.121000000000000441e+00,8.169999999999999929e+00,8.218999999999999417e+00,8.268000000000000682e+00,8.317000000000000171e+00,8.366999999999999105e+00,8.416000000000000369e+00,8.464999999999999858e+00,8.513999999999999346e+00,8.563000000000000611e+00,8.612000000000000099e+00,8.660999999999999588e+00,8.711000000000000298e+00,8.759999999999999787e+00,8.808999999999999275e+00,8.858000000000000540e+00,8.907000000000000028e+00,8.955999999999999517e+00,9.005000000000000782e+00,9.054000000000000270e+00,9.103999999999999204e+00,9.153000000000000469e+00,9.201999999999999957e+00,9.250999999999999446e+00,9.300000000000000711e+00,9.349000000000000199e+00,9.397999999999999687e+00,9.448000000000000398e+00,9.496999999999999886e+00,9.545999999999999375e+00,9.595000000000000639e+00,9.644000000000000128e+00,9.692999999999999616e+00,9.741999999999999105e+00,9.791999999999999815e+00,9.840999999999999304e+00,9.890000000000000568e+00,9.939000000000000057e+00 +8.312500000000000444e-01,9.112500000000000044e-01,6.912499999999999201e-01,3.612499999999999600e-01,1.049999999999999822e-01,2.375000000000004885e-02,1.812500000000000222e-01,4.812499999999999556e-01,8.037499999999999645e-01,8.874999999999999556e-01,7.462500000000000799e-01,4.437499999999999778e-01,1.712500000000000133e-01,2.875000000000005329e-02,1.187500000000000222e-01,4.100000000000000311e-01,7.249999999999999778e-01,8.800000000000000044e-01,7.887500000000000622e-01,5.562500000000000222e-01,2.312499999999999556e-01,6.750000000000000444e-02,1.125000000000000444e-01,3.800000000000000044e-01,6.287499999999999201e-01,8.312500000000000444e-01,8.437500000000000000e-01,6.212500000000000799e-01,3.412500000000000533e-01,1.137500000000000178e-01,9.999999999999997780e-02,2.887499999999999512e-01,5.337499999999999467e-01,7.624999999999999556e-01,8.175000000000000044e-01,6.049999999999999822e-01,3.687500000000000222e-01,1.787499999999999645e-01,9.375000000000000000e-02,2.149999999999999689e-01,4.762499999999999512e-01,6.950000000000000622e-01,8.062500000000000222e-01,7.500000000000000000e-01,5.262499999999999956e-01,2.912500000000000089e-01,1.487500000000000488e-01,1.824999999999999956e-01,3.924999999999999600e-01,5.987500000000000044e-01,7.812500000000000000e-01,7.587500000000000355e-01,6.237500000000000266e-01,3.924999999999999600e-01,2.237500000000000044e-01,1.587499999999999467e-01,3.024999999999999911e-01,4.675000000000000266e-01,6.837500000000000799e-01,7.462500000000000799e-01,6.512499999999999956e-01,4.975000000000000533e-01,2.962500000000000133e-01,1.875000000000000000e-01,2.562499999999999778e-01,4.137499999999999512e-01,5.849999999999999645e-01,6.950000000000000622e-01,7.037499999999999867e-01,5.112499999999999822e-01,3.699999999999999956e-01,2.399999999999999911e-01,2.325000000000000400e-01,3.475000000000000311e-01,4.849999999999999867e-01,6.724999999999999867e-01,6.850000000000000533e-01,5.987500000000000044e-01,4.174999999999999822e-01,2.874999999999999778e-01,2.687500000000000444e-01,3.375000000000000222e-01,4.587499999999999911e-01,6.149999999999999911e-01,6.537500000000000533e-01,6.074999999999999289e-01,4.949999999999999956e-01,3.687500000000000222e-01,2.812500000000000000e-01,3.100000000000000533e-01,4.437499999999999778e-01,5.212499999999999911e-01,6.437500000000000444e-01,6.799999999999999378e-01,5.337499999999999467e-01,4.337499999999999689e-01,3.387499999999999956e-01,3.362500000000000488e-01,4.112500000000000044e-01,4.912499999999999645e-01,5.162499999999999867e-01,5.612500000000000266e-01,5.300000000000000266e-01,4.449999999999999512e-01,3.837500000000000355e-01,3.900000000000000133e-01,4.137499999999999512e-01,4.262500000000000178e-01,5.237499999999999378e-01,5.500000000000000444e-01,5.287500000000000533e-01,4.837500000000000133e-01,4.799999999999999822e-01,4.412500000000000311e-01,4.037500000000000533e-01,4.262500000000000178e-01,4.812499999999999556e-01,5.112499999999999822e-01,4.899999999999999911e-01,5.087500000000000355e-01,4.925000000000000488e-01,4.224999999999999867e-01,4.137499999999999512e-01,4.037500000000000533e-01,4.725000000000000311e-01,4.637499999999999956e-01,5.275000000000000799e-01,5.612500000000000266e-01,4.849999999999999867e-01,5.000000000000000000e-01,4.475000000000000089e-01,4.037500000000000533e-01,4.549999999999999600e-01,4.725000000000000311e-01,4.837500000000000133e-01,5.087500000000000355e-01,5.224999999999999645e-01,4.749999999999999778e-01,4.725000000000000311e-01,4.787500000000000089e-01,4.387499999999999734e-01,4.425000000000000044e-01,4.762499999999999512e-01,5.012499999999999734e-01,5.349999999999999201e-01,5.200000000000000178e-01,4.962499999999999689e-01,4.549999999999999600e-01,4.587499999999999911e-01,4.250000000000000444e-01,4.499999999999999556e-01,4.975000000000000533e-01,5.087500000000000355e-01,5.349999999999999201e-01,4.575000000000000178e-01,4.987500000000000266e-01,4.612500000000000488e-01,4.737500000000000044e-01,4.587499999999999911e-01,4.399999999999999467e-01,4.899999999999999911e-01,4.962499999999999689e-01,5.024999999999999467e-01,5.275000000000000799e-01,4.499999999999999556e-01,4.712499999999999467e-01,4.150000000000000355e-01,4.224999999999999867e-01,4.487499999999999822e-01,4.437499999999999778e-01,4.987500000000000266e-01,5.087500000000000355e-01,5.237499999999999378e-01,4.862499999999999600e-01,4.649999999999999689e-01,4.575000000000000178e-01,4.512500000000000400e-01,4.837500000000000133e-01,4.987500000000000266e-01,4.762499999999999512e-01,4.849999999999999867e-01,4.799999999999999822e-01,4.937500000000000222e-01,4.612500000000000488e-01,4.112500000000000044e-01,4.324999999999999956e-01,5.037499999999999201e-01,4.975000000000000533e-01,5.162499999999999867e-01,4.949999999999999956e-01,5.000000000000000000e-01,4.712499999999999467e-01,4.312500000000000222e-01,4.575000000000000178e-01,4.849999999999999867e-01,4.837500000000000133e-01,5.037499999999999201e-01,5.312500000000000000e-01,5.062499999999999778e-01,5.200000000000000178e-01 diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/data/3q_blockaded_rabi.csv b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/3q_blockaded_rabi.csv new file mode 100644 index 000000000..f99c7583e --- /dev/null +++ b/lib/BloqadeNoisy/examples/whitepaper_comparison/data/3q_blockaded_rabi.csv @@ -0,0 +1,2 @@ +1.150000000000000050e-01,1.450000000000000178e-01,1.739999999999999880e-01,2.030000000000000138e-01,2.330000000000000127e-01,2.630000000000000115e-01,2.920000000000000373e-01,3.210000000000000075e-01,3.509999999999999787e-01,3.810000000000000053e-01,4.099999999999999756e-01,4.390000000000000013e-01,4.690000000000000280e-01,4.989999999999999991e-01,5.280000000000000249e-01,5.569999999999999396e-01,5.869999999999999662e-01,6.169999999999999929e-01,6.459999999999999076e-01,6.750000000000000444e-01,7.050000000000000711e-01,7.350000000000000977e-01,7.640000000000000124e-01,7.929999999999999272e-01,8.229999999999999538e-01,8.529999999999999805e-01,8.819999999999998952e-01,9.110000000000000320e-01,9.410000000000000586e-01,9.699999999999999734e-01,1.000000000000000000e+00,1.028999999999999915e+00,1.058999999999999941e+00,1.088999999999999968e+00,1.117999999999999883e+00,1.147000000000000020e+00,1.177000000000000046e+00,1.206999999999999851e+00,1.235999999999999988e+00,1.264999999999999902e+00,1.294999999999999929e+00,1.324999999999999956e+00,1.353999999999999870e+00,1.383000000000000007e+00,1.413000000000000034e+00,1.442999999999999838e+00,1.471999999999999975e+00,1.500999999999999890e+00,1.530999999999999917e+00,1.560999999999999943e+00,1.589999999999999858e+00,1.618999999999999995e+00,1.649000000000000021e+00,1.679000000000000048e+00,1.707999999999999963e+00,1.736999999999999877e+00,1.766999999999999904e+00,1.796999999999999931e+00,1.825999999999999845e+00,1.854999999999999982e+00,1.885000000000000009e+00,1.915000000000000036e+00,1.943999999999999950e+00,1.972999999999999865e+00,2.003000000000000114e+00,2.032999999999999918e+00,2.062000000000000277e+00,2.092000000000000082e+00,2.120999999999999996e+00,2.149999999999999911e+00,2.180000000000000160e+00,2.209000000000000075e+00,2.238999999999999879e+00,2.269000000000000128e+00,2.298000000000000043e+00,2.326999999999999957e+00,2.356999999999999762e+00,2.387000000000000011e+00,2.415999999999999925e+00,2.444999999999999840e+00,2.475000000000000089e+00,2.504999999999999893e+00,2.533999999999999808e+00,2.563000000000000167e+00,2.592999999999999972e+00,2.621999999999999886e+00,2.652000000000000135e+00,2.681000000000000050e+00,2.710999999999999854e+00,2.741000000000000103e+00,2.770000000000000018e+00,2.798999999999999932e+00,2.828999999999999737e+00,2.858999999999999986e+00,2.887999999999999901e+00,2.916999999999999815e+00,2.947000000000000064e+00,2.976999999999999869e+00,3.005999999999999783e+00,3.035000000000000142e+00,3.064999999999999947e+00 +5.937499999999999722e-02,2.546875000000000111e-01,6.234374999999999778e-01,8.812499999999999778e-01,9.140625000000000000e-01,6.328125000000000000e-01,2.734375000000000000e-01,5.937499999999999722e-02,1.234375000000000056e-01,4.812500000000000111e-01,7.937499999999999556e-01,9.312500000000000222e-01,7.765625000000000444e-01,4.140625000000000000e-01,1.250000000000000000e-01,6.875000000000000555e-02,2.640624999999999778e-01,6.437500000000000444e-01,8.812499999999999778e-01,9.031249999999999556e-01,6.359375000000000444e-01,2.859375000000000111e-01,1.093750000000000000e-01,1.359374999999999889e-01,4.218750000000000000e-01,7.265625000000000000e-01,9.156250000000000222e-01,7.921875000000000444e-01,5.078125000000000000e-01,2.109375000000000000e-01,8.125000000000000278e-02,2.296874999999999889e-01,5.515624999999999556e-01,8.390625000000000444e-01,8.499999999999999778e-01,6.765624999999999556e-01,3.437500000000000000e-01,1.265624999999999944e-01,1.421874999999999944e-01,3.875000000000000111e-01,7.078124999999999556e-01,8.718749999999999556e-01,8.031249999999999778e-01,5.671874999999999556e-01,2.640624999999999778e-01,1.046875000000000028e-01,2.171875000000000056e-01,4.640624999999999889e-01,7.500000000000000000e-01,8.437500000000000000e-01,7.265625000000000000e-01,4.359374999999999778e-01,2.187500000000000000e-01,1.765625000000000111e-01,2.859375000000000111e-01,5.328125000000000222e-01,7.531250000000000444e-01,8.062500000000000222e-01,6.062499999999999556e-01,3.765625000000000222e-01,2.000000000000000111e-01,2.031250000000000000e-01,4.015624999999999889e-01,6.640625000000000000e-01,7.765625000000000444e-01,7.562499999999999778e-01,5.421875000000000444e-01,3.218750000000000222e-01,1.625000000000000056e-01,2.593750000000000222e-01,4.953124999999999889e-01,6.687499999999999556e-01,7.546874999999999556e-01,6.250000000000000000e-01,4.671874999999999778e-01,2.578125000000000000e-01,1.953125000000000000e-01,3.343749999999999778e-01,5.484375000000000222e-01,7.093749999999999778e-01,7.656250000000000000e-01,6.078124999999999778e-01,4.093749999999999889e-01,2.609374999999999889e-01,3.031249999999999778e-01,4.328124999999999889e-01,5.999999999999999778e-01,6.687499999999999556e-01,6.750000000000000444e-01,5.093750000000000222e-01,3.859374999999999889e-01,2.546875000000000111e-01,2.812500000000000000e-01,4.843750000000000000e-01,5.859375000000000000e-01,6.187500000000000222e-01,5.890625000000000444e-01,4.984374999999999778e-01,3.281250000000000000e-01,2.890625000000000000e-01,4.000000000000000222e-01 diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_detuned_long.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_detuned_long.png new file mode 100644 index 000000000..fe46dadee Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_detuned_long.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long.png new file mode 100644 index 000000000..f5cc57772 Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long_incoherent.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long_incoherent.png new file mode 100644 index 000000000..0b9d3365b Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_long_incoherent.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_short_comparison.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_short_comparison.png new file mode 100644 index 000000000..0c43d81bd Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/15MHz_short_comparison.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/3_atom_blockaded_comparison.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/3_atom_blockaded_comparison.png new file mode 100644 index 000000000..3ab6ee1f7 Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/figures/3_atom_blockaded_comparison.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/summary_figure.png b/lib/BloqadeNoisy/examples/whitepaper_comparison/summary_figure.png new file mode 100644 index 000000000..171bb8539 Binary files /dev/null and b/lib/BloqadeNoisy/examples/whitepaper_comparison/summary_figure.png differ diff --git a/lib/BloqadeNoisy/examples/whitepaper_comparison/whitepaper_comparison.jl b/lib/BloqadeNoisy/examples/whitepaper_comparison/whitepaper_comparison.jl new file mode 100644 index 000000000..b5f3c83a3 --- /dev/null +++ b/lib/BloqadeNoisy/examples/whitepaper_comparison/whitepaper_comparison.jl @@ -0,0 +1,103 @@ +using CSV +using DataFrames + +using Plots +using LaTeXStrings + +using Bloqade +using BloqadeNoisy + +source = Base.source_dir() +data_dir = source*"/data/" +figure_dir = source*"/figures/" + +#Example 1: short 15MHz resonant Rabi + +whitepaper_data = CSV.read(data_dir*"15MHz.csv", DataFrame, delim = ",", header = false) + +times = collect(whitepaper_data[1, :]) +data = collect(whitepaper_data[2, :]) + +reg = zero_state(1) +h = rydberg_h([(0,0)], Ω = 15.7, Δ = 0) #Ω=15 has some overall bias which the simulation does not account for +save_times = LinRange(0, last(times), 500) + +ns = NoisySchrodingerProblem(reg, save_times, h, Aquila()) +sim = emulate(ns, 1000, [mat(Op.n)]; readout_error = true, report_error = true) + +scatter(times, data, label = "whitepaper", xlabel = "t (µs)", ylabel = L"\langle n \rangle", color = :red, legendfontsize = 10, tickfontsize = 12, labelfontsize = 14, legend = :outerbottomright) +plot!(save_times, sim.expectations[1], ribbon = sim.propagated_error[1], label = "simulated", color = :blue) +xlims!(first(times), last(times)) +png(figure_dir*"15MHz_short.png") + +#Example 2: long 15MHz resonant Rabi + +whitepaper_data = CSV.read(data_dir*"15MHz_long.csv", DataFrame, delim = ",", header = false) + +times = collect(whitepaper_data[1, :]) +data = collect(whitepaper_data[2, :]) + +reg = zero_state(1) +h = rydberg_h([(0,0)], Ω = 15.3, Δ = 0) #Ω is not known exactly again +save_times = LinRange(0, last(times), 500) + +ns = NoisySchrodingerProblem(reg, save_times, h, Aquila()) +sim = emulate(ns, 2000, [mat(Op.n)]; readout_error = true) + +plot(times, data, label = "whitepaper", xlabel = "t (µs)", ylabel = L"\langle n \rangle", color = :red, legendfontsize = 10, tickfontsize = 12, labelfontsize = 14) +plot!(save_times, sim, label = "simulated", color = :blue) +png(figure_dir*"15MHz_long_incoherent.png") + +#Example 3: long detuned Rabi + +whitepaper_data = CSV.read(data_dir*"15MHz_detuned_long.csv", DataFrame, delim = ",", header = false) + +times = collect(whitepaper_data[1, :]) +data = collect(whitepaper_data[2, :]) + +reg = zero_state(1) +h = rydberg_h([(0,0)], Ω = 14.5, Δ = 17.5) +save_times = LinRange(0, last(times), 500) +ns = NoisySchrodingerProblem(reg, save_times, h, Aquila()) + +sim = emulate(ns, 2000, [mat(Op.n)]; readout_error = true) + +plot(times, data, label = "whitepaper", xlabel = "t (µs)", ylabel = L"\langle n \rangle", color = :red, legendfontsize = 10, tickfontsize = 12, labelfontsize = 14) +plot!(save_times, sim, label = "simulated", color = :blue) +png(figure_dir*"15MHz_detuned_long.png") + +#Example 4: 3-atom Blockade-enhanced Rabi + +whitepaper_data = CSV.read(data_dir*"3q_blockaded_rabi.csv", DataFrame, delim = ",", header = false) + +times = collect(whitepaper_data[1, :]) +data = collect(whitepaper_data[2, :]) + +atoms = [ #From whitepaper + ( + 0.0, + 4e-06 + ), + ( + -2.6e-06, + 0.0 + ), + ( + 2.6e-06, + 0.0 + ), +] +atoms = [a .* 1f6 for a in atoms] #units + +reg = zero_state(3) +h = rydberg_h(atoms, Ω = 2.58*2π, Δ = 0) +save_times = LinRange(0, last(times), 500) + +ns = NoisySchrodingerProblem(reg, save_times, h, Aquila()) + +cmat = Aquila().confusion_mat(3) #get confusion mat to calculate ground state probability +sim = emulate(ns, 1000, sol -> [(cmat*abs.(u).^2)[1] for u in sol]) + +plot(times, data, label = "whitepaper", xlabel = "t (µs)", ylabel = L"p_{000}",color = :red, legendfontsize = 10, tickfontsize = 12, labelfontsize = 14) +plot!(save_times, simulation_series_mean(sim), label = "simulated", color = :blue) +png(figure_dir*"3_atom_blockaded.png") \ No newline at end of file diff --git a/lib/BloqadeNoisy/src/BloqadeNoisy.jl b/lib/BloqadeNoisy/src/BloqadeNoisy.jl new file mode 100644 index 000000000..b7a106761 --- /dev/null +++ b/lib/BloqadeNoisy/src/BloqadeNoisy.jl @@ -0,0 +1,39 @@ +module BloqadeNoisy + +using Reexport +using SciMLBase +using DiffEqBase +using YaoArrayRegister +using YaoSubspaceArrayReg +using YaoBlocks +using Kronecker +using DiffEqCallbacks +using SparseArrays +using StatsBase +using JSON +import Base.+ +@reexport using BloqadeExpr +@reexport using BloqadeODE +@reexport using OrdinaryDiffEq +using BloqadeWaveforms: Waveform +using BloqadeExpr: Hamiltonian, get_rydberg_params +using LinearAlgebra + +export NoisySchrodingerEquation, + NoisySchrodingerProblem, + ErrorModel, + Aquila, + measure_noisy, + expectation_value_noisy, + emulate_noisy, + simulation_series_mean, + simulation_series_err, + randomize, + load_error_model, + AQUILA + +include("error_model.jl") +include("noise_models.jl") +include("problem.jl") + +end diff --git a/lib/BloqadeNoisy/src/error_model.jl b/lib/BloqadeNoisy/src/error_model.jl new file mode 100644 index 000000000..4e605b68f --- /dev/null +++ b/lib/BloqadeNoisy/src/error_model.jl @@ -0,0 +1,113 @@ +""" + struct ErrorModel + +This struct holds all of the information used to simulate coherent noise, +incoherent noise, and readout error for a specific error model. The +structure is as follows: + +# Arguments + +- `confusion_mat`: Function to generate a confusion matrix given a number of qubits, +with type `(Int)->(T)` where `T`` is Matrix-like +- `collapse_ops`: Function to generate the collapse operators given a number of qubits, with type +`(Int)->Vector{SparseMatrixCSC}` +- `coherent_noise`: Function returning a function that generates random samples from a Hamiltonian +with type `(RydbergHamiltonian)->(()->RydbergHamiltonian)` +""" +struct ErrorModel + confusion_mat::Function #used for noisy readout simulation + collapse_ops::Function #collapse operators included in the Lindblaian + coherent_noise::Function #method to modify the Hamiltonian each shot +end + +""" +function measure_noisy + + This function mimicks YaoAPI.measure with noisy readout + +# Arguments + +- reg: statevector representing the quantum state to be measured +- noise_model: an ErrorModel struct which contains a method to create the confusion matrix +- site (optional): site to be measured +- nshots (optional kwarg): number of measurements to return +""" +function measure_noisy( + noise_model::ErrorModel, + amps::Vector{T} where T <: Real, + sites=nothing; + nshots::Int = 1 + ) + nqubits = round(Int,log2(length(amps))) + cmat = noise_model.confusion_mat(nqubits) #generate confusion matrix + w = Weights(cmat * amps) #create weights representing measurement probabilities + if sites === nothing; sites = 1:length(amps); end + [DitStr{2}(digits(sample(w) .- 1; base = 2, pad = nqubits)) for i in 1:nshots] +end + +""" + function expectation_value_noisy + +Get the expectation value of an operator after applying readout error. operators +Must be diagonal in the computational basis. + +# Arguments +- `noisy_model`: the simulated noise model +- `amps`: the probability distribution over computational basis states +- `op`: desired expectation value +- `errs`: (optional) error estimates for the probability amplitudes to propagate to +the error in the expectation value +""" +function expectation_value_noisy( + noise_model::ErrorModel, + amps::Vector{T} where T <: Real, + op::Diagonal; + errs = nothing +) + nqubits = round(Int,log2(length(amps))) + cmat = noise_model.confusion_mat(nqubits) #generate confusion matrix + expec = sum([a * real(n) for (a,n) in zip(cmat * amps, op.diag)]) + return if errs === nothing + expec + else + ( + expectation = expec, + propagated_err = sqrt(sum([(err * real(n))^2 for (err,n) in zip(cmat * errs, op.diag)])) + ) + end +end + +""" + function expectation_value_noisy + +Get the expectation value of an operator after applying readout error. operators +Must be diagonal in the computational basis. + +# Arguments +- `noisy_model`: the simulated noise model +- `amps`: the probability distribution over computational basis states +- `op`: desired expectation value +- `shots`: resample the distribution at a fixed number of shots to compute the expectation value +- `errs`: (optional) error estimates for the probability amplitudes to propagate to +the error in the expectation value +""" +function expectation_value_noisy( + noise_model::ErrorModel, + amps::Vector{T} where T <: Real, + op::Diagonal, + shots; + errs = false +) + nqubits = round(Int,log2(length(amps))) + cmat = noise_model.confusion_mat(nqubits) #generate confusion matrix + w = Weights(cmat * amps) #create weights representing measurement probabilities + S = [real(op.diag[sample(w)]) for i in 1:shots] + return if errs === false + mean(S) + else + ( + expectation = mean(S), + sample_err = 2*std(S)/sqrt(shots) + ) + end +end \ No newline at end of file diff --git a/lib/BloqadeNoisy/src/noise_models.jl b/lib/BloqadeNoisy/src/noise_models.jl new file mode 100644 index 000000000..111853d84 --- /dev/null +++ b/lib/BloqadeNoisy/src/noise_models.jl @@ -0,0 +1,110 @@ +""" +Aquila noise model parameters in JSON format +""" +AQUILA = """{ + "coherent":{ + "local":{ + "site x":0.05,"site y":0.05,"detuning":0.5,"Rabi frequency":0.018 + }, + "global":{ + "detuning":0.18,"Rabi frequency":0.008 + } + }, + "incoherent":{ + "dephasing rate":0.02,"relaxation rate":0.01 + }, + "readout":{ + "single atom":{"p01":0.01,"p10":0.08} + } +}""" + +""" + function load_error_model + +Load a generic Rydberg atom error model from a JSON string + +# Arguments +- `config`: JSON string with error model parameters (example in src/noise_models.jl) +""" +function load_error_model(props) + relax_op = (X+im*Y)/2 #|0⟩⟨1| + + p01 = props["readout"]["single atom"]["p01"] + p10 = props["readout"]["single atom"]["p10"] + relaxation_rate = props["incoherent"]["relaxation rate"] + dephasing_rate = props["incoherent"]["dephasing rate"] + δΩrel = props["coherent"]["global"]["Rabi frequency"] + δΔ = props["coherent"]["global"]["detuning"] + δx = props["coherent"]["local"]["site x"] + δy = props["coherent"]["local"]["site y"] + δΔ_inhom = props["coherent"]["local"]["detuning"] + δΩ_inhom = props["coherent"]["local"]["Rabi frequency"] #changed from .02 (number density is sensitive to this parameter) + + function coherent_noisy(h) + (atoms,ϕ,Ω,Δ) = get_rydberg_params(h) + if Δ === nothing + throw("Δ needs to be specified!") + end + if eltype(atoms) == Tuple{Float64} + atoms = [(first(a), 0.0) for a in atoms] + end + + function sample_noisy_ham() #return a function that modifies h + randomize((x,y)) = (x+δx * randn(), y + δy*randn()) + atoms_noisy = randomize.(atoms) #randomize atom positions + #add coherent drift in Ω and inhomogeneity + Ω_noisy = Ω .* (1+δΩrel*randn() .+ δΩ_inhom * randn(length(atoms))) + #add coherent drift in Δ and inhomogeneity + Δ_noisy = δΔ*randn()+Δ .+ δΔ_inhom * randn(length(atoms)) + return rydberg_h( + atoms_noisy; + Ω = Ω_noisy, + Δ = Δ_noisy, + ϕ = ϕ + ) + end + end + + function collapse_operators(nqubits) + [[ + sqrt(dephasing_rate) * SparseMatrixCSC(mat(put(nqubits, q => Z))) #single-qubit relaxation + for q in 1:nqubits + ]; + [ + sqrt(relaxation_rate) * mat(put(nqubits, q => relax_op)) #single-qubit relaxation + for q in 1:nqubits + ]] + end + + function confusion_mat(N) + M = [[1-p01 p10]; [p01 1-p10]] + return kronecker([M for i in 1:N]...) #readout + end + + ErrorModel( + confusion_mat, + collapse_operators, + coherent_noisy + ) +end + +#add waveforms and numbers (required for Hamiltonian sampling) +function Base.:+(a::Float64, b::Waveform) + Waveform(b.duration) do t + b(t)+a + end +end + +function Base.:+(a::Waveform, b::Float64) + Waveform(a.duration) do t + a(t)+b + end +end + + +""" +function Aquila + + Create an ErrorModel representing the noise model of Aquila. +""" +Aquila() = load_error_model(JSON.parse(AQUILA)) \ No newline at end of file diff --git a/lib/BloqadeNoisy/src/problem.jl b/lib/BloqadeNoisy/src/problem.jl new file mode 100644 index 000000000..5c8a82084 --- /dev/null +++ b/lib/BloqadeNoisy/src/problem.jl @@ -0,0 +1,492 @@ +""" + struct NoisySchrodingerEquation + +Decorator object for SchrodingerEquation. Implements the f(dstate, state, p, t) +interface to fit into a standard ODE Problem. + +# Arguments + +- `equation`: The coherent 'SchrodingerEquation` equation for the problem +- `imag_evo`: ∑_L L^†L for collapse operators L which defines the non-hermitian part of the Hamiltonian +- `num_cops``: number of collapse operators (for displaying) +""" +struct NoisySchrodingerEquation{mType} + equation::SchrodingerEquation #Wraps this SchrodingerEquation + imag_evo::mType #anti-hermitian part of the Hamiltonian + num_cops::Int +end + +function (eq::NoisySchrodingerEquation)(dstate, state, p, t::Number) + eq.equation(dstate, state, p, t) #d/dt|ψ> = -iH|ψ> - .5∑_L L^†L|ψ> + mul!(dstate, eq.imag_evo, state, -0.5, one(t)) + return +end + +function Base.show(io::IO, mime::MIME"text/plain", eq::NoisySchrodingerEquation) #Pretty printing + Base.show(io, mime, eq.equation) + printstyled(io, "collapse operators: ", length(eq.num_cops); color=:yellow) + return println(io) +end + +""" + struct NoisySchrodingerEquation + NoisySchrodingerEquation(reg, tspan, hamiltonian, c_ops; kw...) + NoisySchrodingerEquation(reg, tspan, hamiltonian, noise_model; kw...) + +Define an ODE Problem representing a single noisy trajectory in an open system in the weak-coupling limit + +# Arguments + +- `reg`: evolution register and initial state of the problem +- `tspan`: a vector of times at which to save the simulation +- `hamiltonian`: AbstractBlock such as that produced by `rydberg_h`` + representing evolution hamiltonian +""" +struct NoisySchrodingerProblem{Reg,EquationType<:ODEFunction,uType,tType,Algo,Kwargs} <: + SciMLBase.AbstractODEProblem{uType,tType,true} + reg::Reg + f::EquationType + c_ops::Vector + state::uType + u0::uType + tspan::tType + algo::Algo + coherent_noise::Function + confusion_mat #Matrix-like + save_times + kwargs::Kwargs + p::Real +end + +#internal constructor with all of the options +function NoisySchrodingerProblem( + reg::AbstractRegister, + save_times, + expr, + c_ops::Vector, + coherent_noise::Function, + confusion_mat; #TODO: property checking. Needs to support matrix-vector multiplication + algo=DP8(), #Algorithm that was used for testing + kw... #proceed with caution, some kwargs might break things +) + nqudits(reg) == nqudits(expr) || throw(ArgumentError("number of qubits/sites does not match!")) + + issorted(save_times) || throw(ArgumentError("save_times must be sorted")) + tspan = (0.0, last(save_times)) #Always starting at t=0 to avoid silly mistakes + + state = statevec(reg) #get initial statevector + space = YaoSubspaceArrayReg.space(reg) #BloqadeNoisy does not currently support subspaces + + #type check c_ops + try + if length(c_ops) != 0 + [c^2 * state for c in c_ops] #making sure matrix-vector product works and matrix is square + else + c_ops = [0 * I] + end + catch + throw(ArgumentError("Collapse operators are either not square or do not match register type")) + end + + #type check confusion_mat + try + confusion_mat^2 * abs.(state) .^ 2 #check that matrix-vector product works and matrix is square + catch + throw(ArgumentError("Confusion matrix does not match register type")) + end + + #type check coherent noise + test_hamiltonian_sample = coherent_noise() + typeof(test_hamiltonian_sample) == typeof(expr) || throw(ArgumentError("Coherent noise sample is not compatible with Hamiltonian")) + nqudits(test_hamiltonian_sample) == nqudits(expr) || throw(ArgumentError("Coherent noise sample is not compatible with Hamiltonian")) + + T = real(eltype(state)) + T = isreal(expr) ? T : Complex{T} + eq = NoisySchrodingerEquation( + SchrodingerEquation( + expr, Hamiltonian(T, expr, space) + ), + sum([l' * l for l in c_ops]), + length(c_ops) + ) + ode_f = ODEFunction(eq) + + tspan_type = promote_type(real(eltype(state)), eltype(tspan)) + tspan = tspan_type.(tspan) # promote tspan to T so Dual number works + + jump_cb = ContinuousCallback( #trigger quantum jumps and collapse the state + collapse_condition, + (integrator) -> collapse!(integrator, c_ops), + ) + + #remove save_start and sate_on options to allow saving at specified times + ode_options = ( + save_everystep=false, #save only at designated save_times, improves performance + save_start=true, + dense=false, + reltol=1e-10, + abstol=1e-10, + saveat=save_times, + callback=jump_cb #quantum jumps + ) + + kw = pairs(merge(ode_options, kw)) + + return NoisySchrodingerProblem( + reg, + ode_f, + c_ops, + state, + copy(state), + tspan, + algo, + coherent_noise, + confusion_mat, + save_times, + kw, + rand(), #random initial condition + ) +end + +function NoisySchrodingerProblem( #Generic simulation with collapse operators + reg::ArrayReg, + save_times, + h, + c_ops::Array; + kw... +) + return NoisySchrodingerProblem( + reg, + save_times, + h, + c_ops, + () -> h, + Matrix(I, 2^nqubits(reg), 2^nqubits(reg)); + kw... + ) +end + +function NoisySchrodingerProblem( #Simulation based on NoiseModel + reg::ArrayReg, + save_times, + h::AbstractBlock, + noise_model::ErrorModel; + kw... +) + return NoisySchrodingerProblem( + reg, + save_times, + h, + noise_model.collapse_ops(nqubits(reg)), + noise_model.coherent_noise(h), + noise_model.confusion_mat(nqubits(reg)); + kw... + ) +end + +function collapse_condition(u, t, integrator) #condition for continuous callback + norm(u)^2 - integrator.p +end + +function collapse!(integrator, L_ops) #trigger a quantum jump + dp = 0 + l = length(L_ops) + probs = Vector{Float64}(undef, l) + for i in 1:l + dp += norm(L_ops[i] * integrator.u)^2 #normalization + probs[i] = dp #cumulative distribution + end + r = rand() + for i in 1:l + if r <= probs[i] / dp #choose jump based on r + copy!(integrator.u, L_ops[i] * integrator.u) #jump + normalize!(integrator.u) #normalize + break + end + end + integrator.p = rand() #randomize for next jump +end + +""" + function randomize + +Used to randomly modify the parameters of the Hamiltonian and randomly +change the initial condition, producing another NoisySchrodingerProblem object +representing a new trajectory. This is a replacement for SciML remake +""" +function randomize(prob::NoisySchrodingerProblem) + h = prob.coherent_noise() + p = rand() + space = YaoSubspaceArrayReg.space(prob.reg) + T = real(eltype(prob.state)) + T = isreal(h) ? T : Complex{T} + eq = NoisySchrodingerEquation( + SchrodingerEquation( + h, Hamiltonian(T, h, space) + ), + sum([l' * l for l in prob.c_ops]), + length(prob.c_ops) + ) + ode_f = ODEFunction(eq) + return NoisySchrodingerProblem( + copy(prob.reg), + ode_f, + prob.c_ops, + copy(prob.state), + copy(prob.u0), + prob.tspan, + prob.algo, + prob.coherent_noise, + prob.confusion_mat, + prob.save_times, + prob.kwargs, + p + ) +end + +function Base.show(io::IO, mime::MIME"text/plain", prob::NoisySchrodingerProblem) #pretty printing + indent = get(io, :indent, 0) + tab(indent) = " "^indent + + println(io, tab(indent), "NoisySchrodingerProblem:") + # state info + println(io, tab(indent + 2), "register info:") + print(io, tab(indent + 4), "type: ") + printstyled(io, typeof(prob.reg); color=:green) + println(io) + + print(io, tab(indent + 4), "storage size: ") + printstyled(io, Base.format_bytes(storage_size(prob.reg)); color=:yellow) + println(io) + println(io) + + # tspan info + println(io, tab(indent + 2), "time span (μs): ", prob.tspan) + println(io) + + # equation info + println(io, tab(indent + 2), "equation: ") + show(IOContext(io, :indent => indent + 4), mime, prob.f.f) + println(io, tab(indent + 4), "algorithm: ", repr(prob.algo)) +end + +""" + function solve + +This method should generally not be called directly unless you are implementing your own EnsembleProblem. This Implements +the DifferentialEquations interface for NoisySchrodingerProblem, which represents a single quantum trajectory. +""" +function DiffEqBase.solve(prob::NoisySchrodingerProblem, args...; sensealg=nothing, initial_state=nothing, kw...) + if sensealg === nothing && haskey(prob.kwargs, :sensealg) + sensealg = prob.kwargs[:sensealg] + end + # update initial state + if initial_state !== nothing + initial_state isa AbstractRegister || + throw(ArgumentError("initial_state must be a register, got $(typeof(initial_state))")) + u0 = statevec(initial_state) + else + u0 = prob.u0 + end + return DiffEqBase.solve_up(prob, sensealg, u0, nothing, args...; kw...) +end + +DiffEqBase.get_concrete_problem(prob::NoisySchrodingerProblem, isadapt; kw...) = prob + +""" + function emulate + +Emulate the evolution of a noisy system by averaging over an ensemble of ntraj noisy trajectories. The output is an array +where each array contains the output of output_func on the timeseries corresponding to a single trajectory. + +# Arguments + +- `prob`: NoisySchrodingerProblem to emulate +- `ntraj`: number of trajectories to use for simulation +- `output_func`: Vector{Complex}->Any - Transformation of the statevector array to save +- `ensemble_algo`: See EnsembleProblem documentation. Common choices are EnsembleSerial and EnsembleThreaded +""" +function emulate_noisy( + prob::NoisySchrodingerProblem, + ntraj::Int, + output_func::Function; + ensemble_algo=EnsembleSerial() +) + ensemble_prob = EnsembleProblem( + prob, + prob_func=(prob, i, repeat) -> randomize(prob), + output_func=(sol, i) -> (output_func([normalize(sol(t)) for t in prob.save_times]), false) + ) + solve(ensemble_prob, prob.algo, ensemble_algo, trajectories=ntraj) +end + +""" + function emulate + +Emulate an ensemble and return the ensemble average over bitstring distribution. + +# Arguments +- `prob`: NoisySchrodingerProblem +- `ntraj`: Number of trajectories +- `report_error`: Returns 2σ estimated from the sample +- `ensemble_algo`: What type of parallelization is desired. See EnsembleSimulation documentation +""" +function emulate_noisy( + prob::NoisySchrodingerProblem, + ntraj::Int; + report_error=false, + ensemble_algo=EnsembleSerial() +) + + output_func = sol -> [abs.(u) .^ 2 for u in sol] #store the probability distribution + sim = emulate_noisy(prob, ntraj, output_func; ensemble_algo=ensemble_algo) #call up + return if report_error + ( + amps=simulation_series_mean(sim), + twosigma=simulation_series_err(sim) + ) + else + simulation_series_mean(sim) + end +end + +""" + function emulate + +Emulate an ensemble and return the ensemble average of a set of expectation values + +# Arguments +- `prob`: NoisySchrodingerProblem +- `ntraj`: Number of trajectories +- `expectations`: Set of Hermitian operators representing observables. Matrix-like objects +- `shots`: Whether to resample the solution at a fixed number of shots. No resamping if `shots = 0`` +- `report_error`: Returns 2σ estimated from the sample. Requires expectation values to be diagonal in computational basis +- `ensemble_algo`: What type of parallelization is desired. See EnsembleSimulation documentation +""" +function emulate_noisy( + prob::NoisySchrodingerProblem, + ntraj::Int, + expectations::Array; + readout_error=false, + shots=0, + report_error=false, + ensemble_algo=EnsembleSerial() +) + + @assert all(ishermitian.(expectations)) #observables are hermitian! + + if !readout_error #Was not sure how to do this cleanly because multiple dispatch does not account for different kwargs... + output_func = (sol) -> [[real(u' * (e * u)) for e in expectations] for u in sol] + sim = emulate_noisy(prob, ntraj, output_func; ensemble_algo=ensemble_algo) + + return if report_error + ( + expectations=[simulation_series_mean(sim; index = i) for (i, _) in enumerate(expectations)], + twosigma=[simulation_series_err(sim; index = i) for (i, _) in enumerate(expectations)] + ) + else + [simulation_series_mean(sim; index=i) for (i, _) in enumerate(expectations)] + end + else + @assert all([typeof(e) <: Diagonal for e in expectations]) + + sim = emulate_noisy(prob, ntraj; report_error=true, ensemble_algo=ensemble_algo) + amps = sim.amps + amps_err = sim.twosigma + + if shots == 0 #no resampling + res = [[_expectation_value_noisy(prob.confusion_mat, a, e, err) for (a, err) in zip(amps, amps_err)] for e in expectations] + expec, perr = [[[a[i] for a in e] for e in res] for i in 1:2] + return if report_error + ( + expectations=expec, + propagated_error=perr + ) + else + return expec + end + else + res = [[_expectation_value_noisy(prob.confusion_mat, a, e, err, shots) for (a, err) in zip(amps, amps_err)] for e in expectations] + mval, sample_err, err = [[[a[i] for a in e] for e in res] for i in 1:3] + return if report_error + ( + expectations=mval, + shot_error=sample_err, + propagated_err=err + ) + else + return mval + end + end + end +end + +""" + function expec_series_mean + +Convenience method to access the expectation value over the ensemble +over the series of save times. + +# Arguments +- sim: EnsembleSolution, result of calling `emulate` +- index: index of the expectation value in the array provided +""" +function simulation_series_mean(sim; index=false) + ntraj = length(sim) + times = length(sim[1]) + if index == false + [mean([sim[i][t] for i in 1:ntraj]) for t in 1:times] + else + [mean([sim[i][t][index] for i in 1:ntraj]) for t in 1:times] + end +end + +""" + function expec_series_err + +Convenience method to estimate the sampling error in the ensemble solution + +# Arguments +- `sim`: EnsembleSolution, result of calling `emulate` +- `index`: index of the expectation value in the array provided +- `factor`: How many σ from the mean to report +""" +function simulation_series_err(sim; index=false, factor=2) + ntraj = length(sim) + times = length(sim[1]) + if index == false + [factor * std([sim[i][t] for i in 1:ntraj]) / sqrt(ntraj) for t in 1:times] + else + [factor * std([sim[i][t][index] for i in 1:ntraj]) / sqrt(ntraj) for t in 1:times] + end +end + +function _expectation_value_noisy( + cmat, + amps, + op::Diagonal, + errs::Vector +) + expec = sum([a * real(n) for (a, n) in zip(cmat * amps, op.diag)]) + ( + expec, + sqrt(sum([(err * real(n))^2 for (err, n) in zip(cmat * errs, op.diag)])) + ) +end + +function _expectation_value_noisy( + cmat, + amps, + op::Diagonal, + errs::Vector, + shots::Int +) + w = Weights(cmat * amps) #create weights representing measurement probabilities + samples = sample(1:length(amps), w, shots) + S = [real(op.diag[s]) for s in samples] + ( + mean(S), + 2 * std(S) / sqrt(shots), #Using 2σ because 95% of the data is within this error + sqrt(sum([(err * real(n))^2 for (err, n) in zip(cmat * errs, op.diag)])) + ) +end \ No newline at end of file diff --git a/lib/BloqadeNoisy/test/problem.jl b/lib/BloqadeNoisy/test/problem.jl new file mode 100644 index 000000000..ac4314abb --- /dev/null +++ b/lib/BloqadeNoisy/test/problem.jl @@ -0,0 +1,159 @@ +using BloqadeNoisy +using BloqadeExpr +using BloqadeWaveforms +using Kronecker +using StatsBase +using SciMLBase +using YaoArrayRegister +using YaoBlocks +using LinearAlgebra + +@testset "problem interface" begin + reg = zero_state(1) + h = rydberg_h([(0, 0)], Ω=2π, Δ=0) + save_times = LinRange(0.0, 1.0, 10) + ns = @test_nowarn NoisySchrodingerProblem(reg, save_times, h, Aquila()) +end + +@testset "emulation" begin + save_times = LinRange(0.0, 1.0, 10) + reg = zero_state(1) + ns = NoisySchrodingerProblem( + reg, save_times, rydberg_h([(0, 0)], Ω=2π, Δ=0), Aquila() + ) + sim = @test_nowarn emulate_noisy(ns, 1) + @test length(sim) == length(save_times) + @test length(first(sim)) == length(reg.state) +end + +@testset "Hamiltonian sampling" begin + h = rydberg_h( + [(0.0,)]; + Ω = Waveform(sin, 4), + Δ = piecewise_constant( + clocks = [0, 4], + values = [2π], + ), + ϕ = piecewise_constant( + clocks = [0, 4], + values = [0] + ) + ) + sampler = Aquila().coherent_noise(h) + @test_nowarn solve(SchrodingerProblem(zero_state(1), 4.0, sampler()), DP8()) +end + +@testset "noisy measurements" begin + state = [[.5]; [.5]] + @test length(measure_noisy(Aquila(), state; nshots=10)) == 10 +end + +@testset "expectation values" begin + ns = NoisySchrodingerProblem( + zero_state(1), [0.0, 4.0], rydberg_h([(0, 0)], Ω=2π, Δ=0), Aquila() + ) + sim = @test_nowarn emulate_noisy(ns, 1, mat.([X, Z])) + @test sim[1][1] == 0.0 + @test sim[2][1] == 1.0 +end + +@testset "noisy expectation values" begin + ns = NoisySchrodingerProblem( + zero_state(1), [0.0, 4.0], rydberg_h([(0, 0)], Ω=2π, Δ=0), Aquila() + ) + p01 = Aquila().confusion_mat(1)[2, 1] + sim = emulate_noisy(ns, 1, [mat(Z)]; readout_error=true) + @test sim[1][1] == 1 - 2 * p01 + p = [[.5]; [.5]] + p_ro = Aquila().confusion_mat(1) * p + Zexpec = expectation_value_noisy(Aquila(), p, mat(Z)) + @test Zexpec == p_ro[1] - p_ro[2] + Zexpec = expectation_value_noisy(Aquila(), p, mat(Z), errs = [.05, .05]) + e_t = Aquila().confusion_mat(1) * [[.05]; [.05]] + @test Zexpec.propagated_err == norm(e_t) + Z_shots = expectation_value_noisy(Aquila(), p, mat(Z), 1000) + @test isapprox(Z_shots, Zexpec.expectation, atol = 4/sqrt(1000)) + @test expectation_value_noisy(Aquila(), p, mat(Z), 1000; errs = true).sample_err < .1 +end + +@testset "emulation arguments" begin + h = rydberg_h([(0, 0), (8, 0), (18, 0)], Ω=15, Δ=0) + reg = zero_state(3) + save_times = LinRange(0.0, 1.0, 5) + ns = NoisySchrodingerProblem(reg, save_times, h, Aquila()) + sim1 = @test_nowarn emulate_noisy(ns, 1, [mat(put(3, i => Z)) for i in 1:3]; + report_error=true + ) + sim2 = @test_nowarn emulate_noisy(ns, 2, [mat(put(3, 1 => Z))]; + report_error=true, ensemble_algo=EnsembleThreads() + ) + sim_ro = @test_nowarn emulate_noisy(ns, 2, [mat(put(3, 1 => Z))]; + readout_error=true, report_error=true + ) + sim = @test_nowarn emulate_noisy(ns, 1, [mat(put(3, i => Z)) for i in 1:3]; + readout_error=true, report_error=true, shots=10 + ) +end + +@testset "ensemble analysis" begin + ns = NoisySchrodingerProblem( + zero_state(1), [0.0, 4.0], rydberg_h([(0, 0)], Ω=2π, Δ=0), Aquila() + ) + sim = emulate_noisy(ns, 2, sol -> [abs(u[1])^2 for u in sol]) + @test values = simulation_series_mean(sim; index = 1)[end] == + mean([s[end] for s in sim]) + @test simulation_series_err(sim; index=1, factor=3)[end] == + std([s[end][1] for s in sim]) * 3 / sqrt(2) +end + +@testset "EnsembleProblem integration" begin + ns = NoisySchrodingerProblem( + zero_state(1), [0.0, 4.0], rydberg_h([(0, 0)], Ω=2π, Δ=0), Aquila() + ) + @test_nowarn randomize(ns) + ep = @test_nowarn EnsembleProblem(ns, + prob_func=(prob, i, repeat) -> randomize(ns) + ) + @test_nowarn solve(ep, DP8(); trajectories=1) +end + +@testset "trivial noise model" begin + reg = zero_state(1) + save_times = [0.0, 4.0] + h = rydberg_h([(0, 0)]; Ω=2π) + trivial_error_model = ErrorModel( + n -> I, + n -> [], + h -> (() -> h) + ) + ns = NoisySchrodingerProblem(reg, save_times, h, trivial_error_model) + sim = emulate_noisy(ns, 10, sol -> sol[end]) + ψ = first(solve(SchrodingerProblem(reg, 4, h), DP8()).u) + @test all(map(sim) do u; u ≈ ψ; end) +end + +@testset "custom collapse operators" begin + save_times = [0.0, 4.0] + h = rydberg_h([(0, 0)]; Ω=2π) + rate = 1 / 10 + c_ops = [sqrt(rate) * mat((X + im * Y) / 2)] + @test_nowarn ns = NoisySchrodingerProblem(zero_state(1), save_times, h, c_ops) +end + +@testset "custom error model" begin + confusion_matrix(n) = kronecker([[[0.9 0.1]; [0.1 0.9]] for i in 1:n]...) + bitflip_model(n) = [ + SparseMatrixCSC(sqrt(1 / 10) * mat(put(n, i => X))) for i in 1:n + ] + coherent_noise(h) = () -> ( + (atoms, ϕ, Ω, Δ) = get_rydberg_params(h); + rydberg_h(atoms; Ω=Ω * (1 + 0.08 * randn()), Δ=Δ, ϕ=ϕ) + ) + better_error_model = ErrorModel( + confusion_matrix, + bitflip_model, + coherent_noise + ) + ns = NoisySchrodingerProblem(zero_state(2), LinRange(0,2,100), rydberg_h([(0,),(8,)]; Ω=15), better_error_model) + sim = @test_nowarn emulate_noisy(ns, 1, [mat(put(2, 1 => X)), mat(kron(X, X))]) +end \ No newline at end of file diff --git a/lib/BloqadeNoisy/test/runtests.jl b/lib/BloqadeNoisy/test/runtests.jl new file mode 100644 index 000000000..a7e989660 --- /dev/null +++ b/lib/BloqadeNoisy/test/runtests.jl @@ -0,0 +1,5 @@ +using Test + +@testset "problem" begin + include("problem.jl") +end