Kit wrote:
> This brings about a 20% speed improvement:
> mata:
> XW = X*W
> xwx2 = J(st_nobs(), 1, .)
> for (i=1; i<=st_nobs(); i++) {
> xwx2[i] = XW[i,.] * X[i,.]'
> }
> end
hi kit,
i can invert W, so in the end using similar logic the following one-liner
xwx = rowsum((X*cholesky(W)):^2)
is more than twice as fast as my initial solution
the only disadvantage (apparently also with the rowsum solution) is that it involves a copy of the data area which can become a problem with big datasets
thanks for the help!
regards, edwin
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/