Difference between revisions of "Ensemble.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Sync syntax/arguments/outputs with current Spinach source)
(sync with Spinach main 3975f139: per-worker case blocks and ens_block.m)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:ensemble.m}} __NOTOC__
 
{{DISPLAYTITLE:ensemble.m}} __NOTOC__
−
 
 
A parallel wrapper around GRAPE that enables ensemble optimal control optimisations. This function handles systems with multiple control power levels, multiple resonance offsets, multistate transfers, and ensembles of drift Liouvillians.
 
A parallel wrapper around GRAPE that enables ensemble optimal control optimisations. This function handles systems with multiple control power levels, multiple resonance offsets, multistate transfers, and ensembles of drift Liouvillians.
  
 
==Syntax==
 
==Syntax==
  
−
[traj_data,fidelity,gradient,hessian]=ensemble(waveform,spin_system)
 
  
−
==Outputs==
+
    [traj_data,fidelity,gradient,hessian]=ensemble(waveform,spin_system)
  
−
traj_data    - trajectory data for subsequent diagnostic plotting
 
  
−
  fidelity    - figure of merit for the overlap of the current state
+
==Parameters==
−
                  of the system and the desired state(s). When penalty
 
−
                  methods are specified, fidelity is returned as an ar-
 
−
                  ray separating the penalties from the simulation
 
−
                  fidelity.
 
  
−
   gradient    - gradient of the fidelity with respect to the control
+
   waveform  - control coefficients for each control operator, rad/s
−
                  sequence. When penalty methods are specified, gradi-
+
 
−
                  ent is returned as an array separating penalty gra-
+
==Outputs==
−
                  dients from the fidelity gradient.
 
  
−
  hessian      - Hessian of the fidelity with respect to the control
 
−
                  sequence. When penalty methods are specified, gradi-
 
−
                  ent is returned as an array separating penalty Hes-
 
−
                  sians from the fidelity Hessian.
 
  
−
  david.goodwin@inano.au.dk
+
  traj_data - trajectory data for subsequent diagnostic plotting
−
  ilya.kuprov@weizmann.ac.il
+
−
  m.keitel@soton.ac.uk
+
fidelity  - figure of merit for the overlap of the current state of the
 +
            system and the desired state(s). When penalty methods are
 +
            specified, fidelity is returned as an array separating the
 +
            penalties from the simulation fidelity
 +
 +
gradient  - gradient of the fidelity with respect to the control sequence.
 +
            When penalty methods are specified, gradient is returned as an
 +
            array separating penalty gradients from the fidelity gradient
 +
   
 +
  hessian  - Hessian of the fidelity with respect to the control sequence.
 +
            When penalty methods are specified, hessian is returned as an
 +
            array separating penalty Hessians from the fidelity Hessian
  
 
==Notes==
 
==Notes==
 +
This is a low level function that is not designed to be called directly. Use [[grape_xy.m]] and [[grape_phase.m]] instead.
  
−
This is a low level function that is not designed to be called directly. Use [[grape_xy.m]] and [[grape_phase.m]] instead.
+
The ensemble cases enumerated in spin_system.control.catalog are processed in the contiguous per-worker blocks assigned by [[optimcon.m]] in spin_system.control.worker_cases. Each worker holds the common frozen problem and the drift generators of its own block, published by [[optimcon.m]] as pool constants; the per-case physics runs in [[ens_block.m]] on each worker, so only the waveform and the live control fields travel at each objective evaluation, and the gradient, the Hessian, and averaged trajectories are summed on the workers. This function must be called from the client, on the pool that was open when [[optimcon.m]] ran: a worker holds only its own block.
  
 
==See also==
 
==See also==
−
 
+
[[grape_xy.m]], [[grape_phase.m]], [[alpha_conds.m]], [[aux_mat.m]], [[bfgs.m]], [[cubic_interp.m]], [[dirdiff.m]], [[drifts.m]], [[ens_block.m]], [[hess_reorder.m]], [[objeval.m]], [[optimcon.m]], [[trapdiff.m]], [[Optimal control module]]
−
[[Optimal control module]]
 
−
 
 
  
 
''Version 2.0, authors: [[Ilya Kuprov]], [[David Goodwin]]''
 
''Version 2.0, authors: [[Ilya Kuprov]], [[David Goodwin]]''
−
 
−
==Parameters==
 
−
 
−
waveform  - control coefficients for each control operator, rad/s
 

Latest revision as of 10:59, 18 September 2026

A parallel wrapper around GRAPE that enables ensemble optimal control optimisations. This function handles systems with multiple control power levels, multiple resonance offsets, multistate transfers, and ensembles of drift Liouvillians.

Syntax

    [traj_data,fidelity,gradient,hessian]=ensemble(waveform,spin_system)


Parameters

  waveform  - control coefficients for each control operator, rad/s

Outputs

traj_data - trajectory data for subsequent diagnostic plotting

fidelity  - figure of merit for the overlap of the current state of the
           system and the desired state(s). When penalty methods are
           specified, fidelity is returned as an array separating the
           penalties from the simulation fidelity

gradient  - gradient of the fidelity with respect to the control sequence.
           When penalty methods are specified, gradient is returned as an
           array separating penalty gradients from the fidelity gradient

hessian   - Hessian of the fidelity with respect to the control sequence.
           When penalty methods are specified, hessian is returned as an
           array separating penalty Hessians from the fidelity Hessian

Notes

This is a low level function that is not designed to be called directly. Use grape_xy.m and grape_phase.m instead.

The ensemble cases enumerated in spin_system.control.catalog are processed in the contiguous per-worker blocks assigned by optimcon.m in spin_system.control.worker_cases. Each worker holds the common frozen problem and the drift generators of its own block, published by optimcon.m as pool constants; the per-case physics runs in ens_block.m on each worker, so only the waveform and the live control fields travel at each objective evaluation, and the gradient, the Hessian, and averaged trajectories are summed on the workers. This function must be called from the client, on the pool that was open when optimcon.m ran: a worker holds only its own block.

See also

grape_xy.m, grape_phase.m, alpha_conds.m, aux_mat.m, bfgs.m, cubic_interp.m, dirdiff.m, drifts.m, ens_block.m, hess_reorder.m, objeval.m, optimcon.m, trapdiff.m, Optimal control module

Version 2.0, authors: Ilya Kuprov, David Goodwin