| dcrossprod | R Documentation |
Return the diagonal of the cross-product
t(X) %*% X for a given matrix
X. As is well-known the cross-product is
computed by the single argument of crossprod; however we
often have to compute only the diagonal of the
cross-product. For instance, the variance of a kriging predition
may have to be computed without formin the covariance.
dcrossprod(X)
X |
A numeric matrix. |
Several methods can be used to compute the result in R (using
apply, ...). To our best knowledge the method used here is
the most efficient in general framework.
The diagonal vector of crossprod(X).
Thanks to Clément Walter for comparisons and the suggested code.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.