Difference between revisions of "Grape hilb.m"

From Spinach Documentation Wiki
Jump to: navigation, search
(Update function See also links and function index membership)
(sync with Spinach main f053e432: Hessian output documented; waveform/drift descriptions and Outputs aligned with source header)
Line 1: Line 1:
 
{{DISPLAYTITLE:grape_hilb.m}} __NOTOC__
 
{{DISPLAYTITLE:grape_hilb.m}} __NOTOC__
−
Gradient Ascent Pulse Engineering objective function and gradient for Hilbert space. Propagates a system through a shaped pulse from an initial state to a target state and returns fidelity and its gradient.
+
Gradient Ascent Pulse Engineering (GRAPE) objective function, gradient and Hessian. Propagates the system through a user-supplied shaped pulse from a given initial state and projects the result onto the given final state. The fidelity is returned, along with its gradient and Hessian with respect to amplitudes of all control operators at every time step of the shaped pulse. Uses Hilbert-space formalism.
  
 
==Syntax==
 
==Syntax==
  
−
 
+
  [traj_data,fidelity,grad,hess]=grape_hilb(spin_system,drifts,controls,...
−
    [traj_data,fidelity,grad,hess]=grape_hilb(spin_system,drifts,controls,...
+
                                      waveform,rho_init,rho_targ,...
−
                                                    waveform,rho_init,rho_targ,...
+
                                      fidelity_type)
−
                                                    fidelity_type)
 
  
 
==Parameters==
 
==Parameters==
  
−
    spin_system        - Spinach data object that has been  
+
  spin_system        - Spinach data object that has been through
−
                          through the optimcon.m problem  
+
                        the [[optimcon.m]] problem setup function.
−
                          setup function
 
 
   
 
   
−
    drifts              - the drift Hamiltonians: a cell array  
+
  drifts              - the drift Hamiltonians: a cell array con-
−
                          containing one matrix (for time-inde-
+
                        taining one matrix (for time-independent
−
                          pendent drift) or multiple matrices  
+
                        drift) or multiple matrices (for time-de-
−
                          (for time-dependent drift)
+
                        pendent drift).
 
   
 
   
−
    controls            - control operators in Hilbert space  
+
  controls            - control operators in Hilbert space (cell
−
                          (cell array of matrices)
+
                        array of matrices).
 
   
 
   
−
    waveform            - control coefficients for each control  
+
  waveform            - control coefficients for each control ope-
−
                          operator (in rows of a matrix), rad/s
+
                        rator (in vertical dimension) at each time
 +
                        step (in horizonal dimension), rad/s
 
   
 
   
−
    rho_init            - initial state of the system as a density  
+
  rho_init            - initial state of the system as a density
−
                          matrix in Hilbert space
+
                        matrix in Hilbert space.
 
   
 
   
−
    rho_targ            - target state of the system as a density  
+
  rho_targ            - target state of the system as a density
−
                          matrix in Hilbert space
+
                        matrix in Hilbert space.
 
   
 
   
−
    fidelity_type      - 'real'  (real part of the overlap)
+
  fidelity_type      - 'real'  (real part of the overlap)
−
                          'imag'  (imaginary part of the overlap)
+
                        'imag'  (imaginary part of the overlap)
−
                          'square' (absolute square of the overlap)
+
                        'square' (absolute square of the overlap)
  
 
==Outputs==
 
==Outputs==
  
−
 
+
  fidelity           - fidelity of the control sequence
−
fidelity         - fidelity of the control sequence
 
 
   
 
   
−
grad             - gradient of the fidelity with respect to the control
+
  grad               - gradient of the fidelity with respect to
−
                    sequence
+
                        the control sequence
 
   
 
   
−
hess             - Hessian of the fidelity with respect to the control
+
  hess               - Hessian of the fidelity with respect to the
−
                    sequence
+
                        control sequence
 
   
 
   
−
traj_data.forward - forward trajectory from the initial condition, as a
+
  traj_data.forward   - forward trajectory from the initial condi-
−
                    stack of state matrices
+
                        tion(a stack of state matrices)
  
 
==Notes==
 
==Notes==

Revision as of 05:51, 30 August 2026

Gradient Ascent Pulse Engineering (GRAPE) objective function, gradient and Hessian. Propagates the system through a user-supplied shaped pulse from a given initial state and projects the result onto the given final state. The fidelity is returned, along with its gradient and Hessian with respect to amplitudes of all control operators at every time step of the shaped pulse. Uses Hilbert-space formalism.

Syntax

 [traj_data,fidelity,grad,hess]=grape_hilb(spin_system,drifts,controls,...
                                      waveform,rho_init,rho_targ,...
                                      fidelity_type)

Parameters

  spin_system         - Spinach data object that has been through
                        the optimcon.m problem setup function.

  drifts              - the drift Hamiltonians: a cell array con-
                        taining one matrix (for time-independent
                        drift) or multiple matrices (for time-de-
                        pendent drift).

  controls            - control operators in Hilbert space (cell
                        array of matrices).

  waveform            - control coefficients for each control ope-
                        rator (in vertical dimension) at each time
                        step (in horizonal dimension), rad/s

  rho_init            - initial state of the system as a density
                        matrix in Hilbert space.

  rho_targ            - target state of the system as a density
                        matrix in Hilbert space.

  fidelity_type       - 'real'   (real part of the overlap)
                        'imag'   (imaginary part of the overlap)
                        'square' (absolute square of the overlap)

Outputs

  fidelity            - fidelity of the control sequence

  grad                - gradient of the fidelity with respect to
                        the control sequence

  hess                - Hessian of the fidelity with respect to the
                        control sequence

  traj_data.forward   - forward trajectory from the initial condi-
                        tion(a stack of state matrices)

Notes

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

See also

grape_xy.m, grape_phase.m, grape_coop.m, grape_curv.m, grape_liouv.m, tgrape.m, Optimal control module

Version 2.11, authors: Ilya Kuprov, Maxi Keitel