getgrad()

function grad=getgrad(W)

Input:

Output:

Using the expression in Eq. (3) and your H() operator above, produce a function of the above prototype in the file ``getgrad.m''.
Hint: Matrix multiplication is associative, so that the final result of a matrix product $ABC$ does not depend on the order in which the product is formed, $A(BC)$ or $(AB)C$. However, the dimensions of the intermediate values can be quite different. For instance $({\bf O}W
U^{-1} W^\dagger) (HW)$ is the product of a $\prod S_k \, \times \, \prod S_k$ matrix with a $\prod S_k \, \times N_s$ matrix, while $({\bf O}W U^{-1/2}) (W^\dagger HW)$ is the product of a $\prod S_k\,\times\,N_s$ matrix with an $N_s\,\times\,N_s$ matrix. The former will likely overflow the memory, whereas the latter will fit nicely. Thus, in evaluating Eq. (3) in octave, you may wish to include some ``extra'' parentheses.



Subsections

Tomas Arias 2006-04-26