crossprod | R Documentation |
Matrix Crossproduct
## S4 method for signature 'AbstractLazyArray,AbstractLazyArray'
crossprod(x, y = NULL, weights = NULL, ...)
## S4 method for signature 'AbstractLazyArray,'NULL''
crossprod(x, y = NULL, weights = NULL, ...)
## S4 method for signature 'AbstractLazyArray,missing'
crossprod(x, y = NULL, weights = NULL, ...)
## S4 method for signature 'AbstractLazyArray,matrix'
crossprod(x, y = NULL, weights = NULL, ...)
x |
a |
y |
|
weights |
numeric vector used as weight |
... |
passed to further methods |
Matrix of cross product if data is small, or LazyMatrix
if
matrix is too large
x <- matrix(1:100, 50)
crossprod(x)
lazy_x <- as.lazymatrix(x)
crossprod(lazy_x)[]
weights <- (1:50)/50
t(x) %*% diag(weights) %*% x
crossprod(lazy_x, weights = weights)
## Not run:
# large data set ~ 1.6GB
x <- as.lazymatrix(matrix(rnorm(2e8), ncol = 2))
crossprod(x)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.