# Simulate a 100-by-100 matrix of random Poisson data
X = matrix(rpois(10000, lambda=2), nrow=100)
# Create a random sparsity structure for 100-by-5 random test matrix; half elements will be 0
sparsity.structure = sample(1:500, 250, replace=TRUE)
# Compute rank 5 estimate of column space of X using a sparse test matrix
Q = randomColumnSpace(X,k=5,sparsity.structure=sparsity.structure)
# Compute using a dense test matrix with U(0,1) RVs
Q = randomColumnSpace(X,k=5,test.dist="uniform")
Run the code above in your browser using DataLab