Quickstart Guide

Here is a simple example where we set up a NamedTrajectory with some dummy data and plot populations of the columns of the unitary matrix. First we will load some of the necessary packages:

using CairoMakie
using NamedTrajectories
using PiccoloQuantumObjects
using PiccoloPlots

Next we will define some Hamiltonians

H_drives = [PAULIS[:Z], PAULIS[:Y]]
H_drift = PAULIS[:X]
2×2 Matrix{ComplexF64}:
 0.0+0.0im  1.0+0.0im
 1.0+0.0im  0.0+0.0im

Now we will generate some dummy control data

N = 100
Δt = 0.1
ts = 0:Δt:Δt*(N-1)
A = 0.1 * randn(length(H_drives), length(ts))
2×100 Matrix{Float64}:
 -0.0691354  -0.109738   -0.191474  …   0.0652727  -0.00588133  -0.17103
 -0.155649   -0.0854705   0.080649     -0.0370055   0.13235      0.169081

Now we will generate the unitaries

Us = exp.(-im * [(H_drift + sum(A[:, k] .* H_drives)) * ts[k] for k = 1:N])
Us[1]
2×2 Matrix{ComplexF64}:
 1.0+0.0im  0.0+0.0im
 0.0-0.0im  1.0+0.0im

And create the trajectory

traj = NamedTrajectory(
    (
        Ũ⃗ = hcat(operator_to_iso_vec.(Us)...), # here we store the isomorphisms
        a = A,
        Δt = ts
    );
    controls = :a,
    timestep = :Δt
)
T = 100, (Ũ⃗ = 1:8, a = 9:10, → Δt = 11:11)

Finally we will plot the populations

plot_unitary_populations(traj)
Example block output

We can also only plot the first column (or any other subset of columns)

plot_unitary_populations(traj; unitary_columns=[1])
Example block output

This page was generated using Literate.jl.