# hess_reorder.m

From Spinach Documentation Wiki

Revision as of 15:43, 2 September 2016 by Goodwin (talk | contribs) (Created basic page for the hess_reorder.m function)

A utility to reorder a Hessian for use in GRAPE optimal control problems.

## Contents

## Syntax

hess_new=hess_reorder(hess,K,N)

## Description

Swaps the Hessian ordering between control channel and time step variables being first or second. The Hessian elements correspond to the elements of a control waveform array ordered as:

[math]\begin{bmatrix}X_1 & X_2 & \cdots & X_N\\ Y_1 & Y_2 & \cdots & Y_N\\ Z_1 & Z_2 & \cdots & Z_N\end{bmatrix}[/math]

where X,Y,Z are different control channels and the index enumerates the time discretization points. A re-ordered Hessian will correspond to a waveform ordered as:

[math]\begin{bmatrix}X_1 & Y_1 & Z_1\\ X_2 & Y_2 & Z_2\\ \vdots & \vdots & \vdots\\ X_N & Y_N & Z_N\end{bmatrix}[/math]

## Arguments

hess - Hessian matrix, K - number of control channels. N - number of time steps.

## Returns

new_hess - Re-ordered Hessian, with N first and K second (a KxK block matrix with blocks of size NxN).

## See also

*Revision 3400, authors: David Goodwin*