# #——回声= FALSE,结果=“隐藏”,消息= FALSE ------------------------------- 需要(knitr)美元opts_chunk组(错误= FALSE,消息= FALSE,警告= FALSE) # #——头 ------------------------------------------------------------------ 系统。文件(包括包=“beachmat”。 ") ## ----------------------------------------------------------------------------- column_sums(矩阵(rnorm (1000), ncol = 10 )) ## ----------------------------------------------------------------------------- # 整数column_sums(矩阵(rpois(1000年,10),ncol = 10)) #逻辑column_sums(矩阵(rbinom (1000, 0.5) = = 1, ncol = 10)) #稀疏column_sums(矩阵::rsparsematrix(100年100.1 )) ## ----------------------------------------------------------------------------- column_sums_sparse(矩阵::rsparsematrix(100, 0.1)) #错误作为一个普通的矩阵并不是稀疏的:试(column_sums_sparse(矩阵(rpois(1000年,10),ncol = 10 ))) ## ----------------------------------------------------------------------------- column_sums_flexible(矩阵::rsparsematrix (100, 0.1)) column_sums_flexible(矩阵(rpois(1000年,10),ncol = 10 )) ## ----------------------------------------------------------------------------- generate_sparse_general () ## ----------------------------------------------------------------------------- 库(矩阵)垫< - rsparsematrix(10、10、0.1)generate_sparse_specific(垫 ) ## ----------------------------------------------------------------------------- 库(beachmat) blockedColSums < -函数(x,…){< - colBlockApply (= column_sums x,有趣,unlist(out) #跨块合并结果。} ## ----------------------------------------------------------------------------- # 普通的矩阵:x1 < -矩阵(rnorm (1000), ncol = 20) blockedColSums (x1) #适合矩阵类:x2 <——矩阵(x1) blockedColSums (x2) #适合DelayedMatrix对象:图书馆(DelayedArray) x3 < DelayedArray (x1) blockedColSums (x3 ) ## ---- eval = .Platform $ OS。类型= =“unix "------------------------------------------ 库(BiocParallel) blockedColSums (x3, BPPARAM = MulticoreParam (2 )) ## ----------------------------------------------------------------------------- sessionInfo ()