# Difference between revisions of "Grape.m"

(Updated to the current doc style and updated to current syntax + options) |
m |
||

Line 60: | Line 60: | ||

− | '' | + | ''Version 1.9, authors: [[Ilya Kuprov]], [[David Goodwin]]'' |

## Revision as of 13:49, 3 January 2017

Gradient Ascent Pulse Engineering (GRAPE) fidelity, 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 real part of the projection is returned, along with its gradient and Hessian with respect to amplitudes of all operators in every time step of the shaped pulse.

## Syntax

[diag_data,fidelity,total_grad,total_hess]=grape(spin_sys,ctrl_sys,drift,waveform)

## Description

Four derivative calculation methods are available: Hausdorff series, second order central finite difference, fourth order central finite difference and Sophie Schirmer's expm algorithm. The default (Sophie's algorithm) is fast and accurate to machine precision. Sophie Schirmer’s expm algorithm is the only option for the Newton‐Raphson method..

## Arguments

spin_sys - spin system ctrl_sys - control system drift - Drift Hamiltonian. The "drift" Liouvillian: couplings, relaxation and other things that continue operating while the pulse is being executed. waveform - matrix of doubles with n_controls rows and n_steps columns, where n_controls is the number of control operators and n_steps is the number of steps in the waveform. The waveform should be specified as fractions of the total power level, which is specified separately.

## Returns

diag_data - diagnostics data structure, containing complete information about the calculation. It has the following self‐explanatory fields: diag_data.current_state diag_data.rho diag_data.target diag_data.total_objective diag_data.spin_system diag_data.power_level diag_data.trajectory diag_data.total_grad diag_data.total_hess diag_data.dt diag_data.controls diag_data.waveform diag_data.nsteps diag_data.drift fidelity - the value of the GRAPE objective function. total_grad - the gradient of the objective function with respect to control amplitudes. total_hess - the Hessian of the objective function with respect to control amplitudes.

## Notes

## See also

dirdiff.m, step.m, control_sys.m

*Version 1.9, authors: Ilya Kuprov, David Goodwin*