powered by
For an input matrix X, This function computes UU' = tcrossprod(U) where U = scale(X) in a memory efficient way.
XXt.compute( X, meanX = NULL, varX = NULL, ncores = 4, check = TRUE, chunksize = 1000 )
a nrow(X) x nrow(X) dense symmetric matrix.
The input matrix of type `matrix' or `dgCMatrix'. No need to center or scale X as that would be done implicitly.
Vector of column means of X. Will be computed if not provided.
Vector of column variances of X. Will be computed if not provided.
the number of cores to be used. Default is 1.
check for zero variances.
When using openmp parallelization, this would be the chunk size under a dynamic scheduling.
Somak Dutta
Maintainer: Somak Dutta <somakd@iastate.edu>
require("Matrix") set.seed(123) x <- rsparsematrix(100,100,density = 0.3) norm(XXt.compute(x) - tcrossprod(scale(x))) # (4.783951e-13 on my machine)
Run the code above in your browser using DataLab