getgrad()

function grad=getgrad(W)

Input:

Output:

Global variable:

Modify getgrad() as above to employ the appropriate formula for the case of variable fillings,

\begin{displaymath}
\nabla_{W^\dagger} E = \left(H(W)-O(W) N^{-1} \left(W^\dagge...
...O(W)
\left(N^{-\frac{1}{2}} Q_N(\tilde{H}F-F\tilde{H})\right),
\end{displaymath}

where $N\equiv W^\dagger O(W)$, $\tilde{H} \equiv N^{-\frac{1}{2}}
\left( W^\dagger H(W) \right) N^{-\frac{1}{2}}$, $F\equiv \mbox{\bf
Diag\,} \vec f$, and $Q_N({\bf A})$ is the operator which the function in Appendix A computes.1 Note that the parentheses have been arranged here again to minimize the size and cost of the calculation of intermediate expressions and that $N^{-\frac{1}{2}}$ may be computed in octave as sqrtm(inv(N)).



Subsections

Tomas Arias 2005-05-04