You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A NamedTrajectory is created by passing a NamedTuple of components that combines component names with initial data. I recently encountered the scenario that during optimization I wanted to access trajectory data stored under multiple different names using a single reference, e.g.:
# define components
components = (
psi0_iso = rand(2d, T),
psi1_iso = rand(2d, T),
a = rand(2, T),
dts = rand(1, T)
)
# build trajectory
traj = NamedTrajectory(components; timestep=:dts, controls=:a)
# now wishing to access a concatenation of psi0_iso and psi1_iso
# under a virtual reference psi_iso
traj.psi_iso == vcat(traj.psi0_iso, traj.psi1_iso)
An alternative example would be to only access part of a component, e.g.:
traj.psi0_im == traj.psi0_iso[(d+1):end,:]
Such virtual names / references would be helpful for convenience and maybe other purposes. In my case I wanted to use predefined infidelity objectives but on concatenated statevectors.
One way to implement this could be:
# define virtual names and what components + indices they correspond to
vnames = (
psi_iso = [
(:psi0_iso, 1:2d),
(:psi1_iso, 1:2d)
],
psi0_im = [
(:psi0_iso, (d+1):2d)
]
)
# build trajectory with optional arg
traj = NamedTrajectory(components; timestep=:dts, controls=:a, vnames=vnames)
Importance
1 (lowest)
What does this feature affect?
construction
methods
plotting
documentation
tests
other (please specify below)
Other information
No response
The text was updated successfully, but these errors were encountered:
Feature Description
A
NamedTrajectory
is created by passing aNamedTuple
of components that combines component names with initial data. I recently encountered the scenario that during optimization I wanted to access trajectory data stored under multiple different names using a single reference, e.g.:An alternative example would be to only access part of a component, e.g.:
Such virtual names / references would be helpful for convenience and maybe other purposes. In my case I wanted to use predefined infidelity objectives but on concatenated statevectors.
One way to implement this could be:
Importance
1 (lowest)
What does this feature affect?
Other information
No response
The text was updated successfully, but these errors were encountered: