crossprod {base} | R Documentation |
Given matrices x
and y
as arguments,
crossprod
returns their matrix cross-product.
This is formally equivalent to, but faster than, the
call t(x) %*% y
.
crossprod(x, y = NULL)
x, y |
matrices: y = NULL is taken to be the
same matrix as x . Vectors are promoted to single-column
matrices. |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
(z <- crossprod(1:4)) # = sum(1 + 2^2 + 3^2 + 4^2) drop(z) # scalar