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) U^{-1} \left(W^\dagge...
...O(W)
\left(U^{-\frac{1}{2}} Q_U(\tilde{H}F-F\tilde{H})\right),
\end{displaymath}

where $U\equiv W^\dagger O(W)$, $\tilde{H} \equiv U^{-\frac{1}{2}}
\left( W^\dagger H(W) \right) U^{-\frac{1}{2}}$, $F\equiv \mbox{\bf
Diag\,} \vec f$, and $Q_U({\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 $U^{-\frac{1}{2}}$ may be computed in octave as sqrtm(inv(U)). (Don't forget the ``m'' in ``sqrtm''! It specifies the matrix-square root as opposed to simply taking the square root of each element of the matrix.)



Subsections

Tomas Arias 2006-04-26