Sunday, 15 June 2014

Can R matrix multiplication be optimised when the result will be symmetrical? -



Can R matrix multiplication be optimised when the result will be symmetrical? -

i need take inner product of every pair of columns in particular matrix, accomplish calculating

t(m) %*% m

however naturally produces symmetrical result, doing on twice necessary work (i don't need diagonal either). break multiply downwards individual inner product operations, there improve way calculate upper triangular part of product?

from description in help("crossprod"):

given matrices x , y arguments, homecoming matrix cross-product. formally equivalent (but faster than) phone call t(x) %*% y (crossprod) or x %*% t(y) (tcrossprod).

thus, utilize crossprod(m).

r matrix-multiplication

No comments:

Post a Comment