Difference between revisions of "Penalty.m"
(Sync syntax/arguments/outputs with current Spinach source) |
(Restore pre-bulk-edit wiki content) |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:penalty.m}} __NOTOC__ | {{DISPLAYTITLE:penalty.m}} __NOTOC__ | ||
| − | + | Penalty terms for the Optimal Control module. Returns the penalty function and its gradient for the waveform, which should be supplied as row vector or a horizontal stack thereof. | |
| − | Penalty terms for the Optimal Control module. Returns the penalty function and its gradient for the waveform, which should be supplied as row vector or a horizontal stack thereof. | ||
==Syntax== | ==Syntax== | ||
| − | [pen_term,pen_grad,pen_hess]=penalty(wf,type,fb,cb) | + | [pen_term,pen_grad,pen_hess]=penalty(wf,type,fb,cb) |
==Arguments== | ==Arguments== | ||
| − | wf - control sequence waveform | + | wf - control sequence waveform |
type='none' - no waveform penalty. | type='none' - no waveform penalty. | ||
| Line 44: | Line 43: | ||
==Outputs== | ==Outputs== | ||
| − | pen_term - value of the penalty term | + | pen_term - value of the penalty term |
| − | + | ||
pen_grad - gradient of the penalty term with | pen_grad - gradient of the penalty term with | ||
respect to the waveform vector | respect to the waveform vector | ||
| − | + | ||
pen_hess - Hessian of the penalty term with | pen_hess - Hessian of the penalty term with | ||
| − | respect to the waveform vector | + | respect to the waveform vector |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
==Notes== | ==Notes== | ||
| − | |||
The waveforms on different channels are assumed to be stored in the rows of the input array. The Hessian elements correspond to the elements of the waveform array ordered as: | The waveforms on different channels are assumed to be stored in the rows of the input array. The Hessian elements correspond to the elements of the waveform array ordered as: | ||
| Line 74: | Line 59: | ||
==See also== | ==See also== | ||
| − | |||
[[Optimal control module]] | [[Optimal control module]] | ||
''Version 2.11, authors: [[Ilya Kuprov]], [[David Goodwin]]'' | ''Version 2.11, authors: [[Ilya Kuprov]], [[David Goodwin]]'' | ||
Revision as of 14:49, 5 April 2026
Penalty terms for the Optimal Control module. Returns the penalty function and its gradient for the waveform, which should be supplied as row vector or a horizontal stack thereof.
Syntax
[pen_term,pen_grad,pen_hess]=penalty(wf,type,fb,cb)
Arguments
wf - control sequence waveform
type='none' - no waveform penalty.
type='NS' - norm square, designed to favour
low-power waveforms over high-
power ones.
type='DNS' - derivative norm square, desig-
ned to favour smooth waveforms
over jagged ones.
type='SNS' - spillout norm square, NS appli-
ed to the part of the waveform
with values outside the floor
and ceiling bounds.
type='SNSA' - SNS applied after a transform to
amplitude-phase representation
Penalises amplitude values outs-
ide the ceiling bound. Requires
even number of control channels
with waveform rows ordered as:
[Xa Ya Xb Yb ... Xn Yn]
fb - floor bound, the lower bound on
waveform used in the SNS penal-
ty function.
cb - ceiling bound, the upper bound
on waveform used in the SNS and
SNSA penalty functions.
Outputs
pen_term - value of the penalty term
pen_grad - gradient of the penalty term with
respect to the waveform vector
pen_hess - Hessian of the penalty term with
respect to the waveform vector
Notes
The waveforms on different channels are assumed to be stored in the rows of the input array. The Hessian elements correspond to the elements of the waveform array ordered as:
[X1 Y1 Z1 X2 Y2 Z2 ... Xn Yn Zn]
where X,Y,Z are different control channels and the index enumerates the time discretization points. Gradient dimensions and element order are the same as the input waveform dimensions and element order.
See also
Version 2.11, authors: Ilya Kuprov, David Goodwin