drop0(Matrix)
drop0()所属R语言包:Matrix
Drop "Explicit Zeroes" from a Sparse Matrix
从稀疏矩阵下降“显零点”
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Returns a sparse matrix with no “explicit zeroes”, i.e., all zero or FALSE entries are dropped from the explicitly indexed matrix entries.
返回没有“明确的零”,即所有的零或FALSE条目明确索引矩阵条目下降一个稀疏矩阵。
用法----------Usage----------
drop0(x, tol = 0, is.Csparse = NA)
参数----------Arguments----------
参数:x
a Matrix, typically sparse, i.e., inheriting from sparseMatrix.
矩阵,通常稀疏,即从sparseMatrix继承。
参数:tol
non-negative number to be used as tolerance for checking if an entry x[i,j] should be considered to be zero.
作为用于检查如果一个条目x[i,j]应该被认为是零容忍的非负数。
参数:is.Csparse
logical indicating prior knowledge about the “Csparseness” of x. This exists for possible speedup reasons only.
表示“Csparseness”x的先验知识的逻辑。这存在只可能加速的原因。
值----------Value----------
a Matrix like x but with no explicit zeros, i.e., !any(x@x == 0), always inheriting from CsparseMatrix.
像x但没有明确的零,即矩阵,!any(x@x == 0),始终继承CsparseMatrix。
注意----------Note----------
When a sparse matrix is the result of matrix multiplications, you may want to consider combining drop0() with zapsmall(), see the example.
当稀疏矩阵是矩阵乘法的结果,你可能要考虑结合drop0()zapsmall(),看到的例子。
参见----------See Also----------
spMatrix, class sparseMatrix
spMatrix类sparseMatrix
举例----------Examples----------
m <- spMatrix(10,20, i= 1:8, j=2:9,
x = c(0:2,3:-1))
m
drop0(m)
## A larger example:[#一个更大的例子:]
t5 <- new("dtCMatrix", Dim = c(5L, 5L), uplo = "L",
x = c(10, 1, 3, 10, 1, 10, 1, 10, 10),
i = c(0L,2L,4L, 1L, 3L,2L,4L, 3L, 4L),
p = c(0L, 3L, 5L, 7:9))
TT <- kronecker(t5, kronecker(kronecker(t5,t5), t5))
IT <- solve(TT)
I. <- TT %*% IT ; nnzero(I.) # 697 ( = 625 + 72 )[697(= 625 + 72)]
I.0 <- drop0(zapsmall(I.))
stopifnot(all(I.0 == Diagonal(625)))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|