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.197688 -0.0159968 0.205539 … 0.04911 0.00557856 0.0308964
0.0939097 0.0351416 0.145472 -0.0484289 0.00220814 -0.0510617
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
);
controls = :a,
timestep = Δt
)
NamedTrajectories.StructNamedTrajectory.NamedTrajectory{Float64}([1.0 0.9949967235549672 … -0.930361618068493 -0.8809938184002025; 0.0 0.0035082974046344436 … -0.0008095833201210538 0.024115789438831272; … ; 0.19768843522769922 -0.0159968056888817 … 0.005578563127202493 0.030896402650709; 0.09390968674073608 0.03514160133377254 … 0.0022081353755949544 -0.05106168211797251], [1.0, 0.0, 0.0, -0.0, 0.0, 1.0, 0.0, 0.0, 0.19768843522769922, 0.09390968674073608 … -0.8809938184002025, 0.024115789438831272, 0.014591981890067676, 0.472287406887896, -0.024115789438831303, -0.8809938184002025, 0.4722874068878961, -0.014591981890067668, 0.030896402650709, -0.05106168211797251], 100, 0.1, 10, (Ũ⃗ = 8, a = 2, states = 8, controls = 2), NamedTuple(), NamedTuple(), NamedTuple(), NamedTuple(), (Ũ⃗ = 1:8, a = 9:10, states = [1, 2, 3, 4, 5, 6, 7, 8], controls = [9, 10]), NamedTuple(), 0, NamedTuple(), NamedTuple(), (:Ũ⃗, :a), (:Ũ⃗,), (:a,))
Finally we will plot the populations
plot_unitary_populations(traj)

We can also only plot the first column (or any other subset of columns)
plot_unitary_populations(traj; unitary_columns=[1])

This page was generated using Literate.jl.