找回密码
 注册
查看: 1508|回复: 0

R语言:lsparseMatrix-classes()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 21:35:40 | 显示全部楼层 |阅读模式
lsparseMatrix-classes(Matrix)
lsparseMatrix-classes()所属R语言包:Matrix

                                        Sparse logical matrices
                                         稀疏的逻辑矩阵

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

The lsparseMatrix class is a virtual class of sparse matrices with TRUE/FALSE entries.  Only the positions of the elements that are TRUE are stored.  These can be stored in the “triplet” form (classes lgTMatrix, lsTMatrix, and ltTMatrix which really contain pairs, not triplets) or in compressed column-oriented form (classes lgCMatrix, lsCMatrix, and ltCMatrix) or in compressed row-oriented form (classes lgRMatrix, lsRMatrix, and ltRMatrix).  The second letter in the name of these non-virtual classes indicates general, symmetric, or triangular.
lsparseMatrix类TRUE/FALSE条目稀疏矩阵是虚拟类。只有位置的元素是TRUE存储。这些都可以存储在“三重”的形式(类lgTMatrix,lsTMatrix,ltTMatrix这确实包含对,而不是三胞胎)或压缩面向列的形式(类lgCMatrix,lsCMatrix,ltCMatrix)或压缩面向行的形式(类lgRMatrix,lsRMatrix,ltRMatrix)。在这些非虚拟类的名称的第二个字母表示general的,symmetric,或triangular的。


类的对象----------Objects from the Class----------

Objects can be created by calls of the form new("lgCMatrix",     ...) and so on.  More frequently objects are created by coercion of a numeric sparse matrix to the logical form for use in the symbolic analysis phase of an algorithm involving sparse matrices.  Such algorithms often involve two phases: a symbolic phase wherein the positions of the non-zeros in the result are determined and a numeric phase wherein the actual results are calculated.  During the symbolic phase only the positions of the non-zero elements in any operands are of interest, hence any numeric sparse matrices can be treated as logical sparse matrices.
创建对象可以通过电话的形式new("lgCMatrix",     ...)等。更频繁的对象创建一个数字的稀疏矩阵稀疏矩阵算法涉及的象征性分析阶段使用的逻辑形式的胁迫。这样的算法往往涉及两个阶段:一个象征性的阶段,其中在非0的位置确定和计算的实际结果是其中一个数字阶段。在象征性的阶段,只有在任何操作数非零元素的位置的利益,因此任何数字稀疏矩阵可以被视为逻辑稀疏矩阵。


插槽----------Slots----------




x: Object of class "logical", i.e., either
x:对象类的"logical",即要么




uplo: Object of class "character". Must be either "U", for upper triangular, and "L", for lower triangular. Present in the triangular and symmetric classes but not
uplo类"character"的对象。必须是“U”型,上三角和“L”,为下三角。呈现在三角形和对称的类,但不




diag: Object of class "character". Must be either "U", for unit triangular (diagonal is all ones), or "N" for non-unit.  The implicit diagonal elements are not explicitly stored when diag is "U".  Present in the
diag类"character"的对象。必须要么"U",单元三角形(对角线是所有的),或"N"非单位。隐含的对角线上的元素没有明确存储时diag是"U"。目前在




p: Object of class "integer" of pointers, one for each column (row), to the initial (zero-based) index of elements in the column.  Present in compressed column-oriented and compressed
p:Object类的"integer"指针,为每列(行),初始(从零开始)列中的元素的索引。目前面向列在压缩和压缩




i: Object of class "integer" of length nnzero (number of non-zero elements).  These are the row numbers for each TRUE element in the matrix.  All other elements are FALSE.
i:Object类的"integer"长度nnzero的(非零元素的数目)。这些都为TRUE,矩阵中的每个元素的行号。所有其他元素都是假的。




j: Object of class "integer" of length nnzero (number of non-zero elements).  These are the column numbers for each TRUE element in the matrix.  All other elements are FALSE.
j:Object类的"integer"长度nnzero的(非零元素的数目)。这是每个真元在矩阵的列数。所有其他元素都是假的。




Dim: Object of class "integer" - the dimensions
Dim类"integer"对象 - 尺寸


方法----------Methods----------




coerce signature(from = "dgCMatrix", to = "lgCMatrix")
强制signature(from = "dgCMatrix", to = "lgCMatrix")




t signature(x = "lgCMatrix"): returns the transpose
Tsignature(x = "lgCMatrix"):返回转




which signature(x = "lsparseMatrix"), semantically equivalent to base function which(x, arr.ind);
signature(x = "lsparseMatrix"),语义上等同于base函数which(x, arr.ind);


参见----------See Also----------

the class dgCMatrix
类dgCMatrix


举例----------Examples----------


(m <- Matrix(c(0,0,2:0), 3,5, dimnames=list(LETTERS[1:3],NULL)))
(lm &lt;- (m &gt; 1)) # lgC[LGC]
!lm     # no longer sparse[不再稀疏]
stopifnot(is(lm,"lsparseMatrix"),
          identical(!lm, m <= 1))

data(KNex)
str(mmG.1 &lt;- (KNex $ mm) &gt; 0.1)# "lgC..."[“LGC ...”]
table(mmG.1@x)# however with many ``non-structural zeros''[然而许多“非结构性零]
## from logical to nz_pattern -- okay when there are no NA's :[#逻辑没关系nz_pattern  - 当有不适用的:]
nmG.1 &lt;- as(mmG.1, "nMatrix") # &lt;&lt;&lt; has "TRUE" also where mmG.1 had FALSE[<<<有“真”也,其中mmG.1假]
## from logical to "double"[#从逻辑的“双”]
dmG.1 &lt;- as(mmG.1, "dMatrix") # has '0' and back:[0和背部:]
lmG.1 &lt;- as(dmG.1, "lMatrix") # has no extra FALSE, i.e. drop0() included[已没有多余的FALSE,即drop0()]
stopifnot(identical(nmG.1, as((KNex $ mm) != 0,"nMatrix")),
          validObject(lmG.1), all(lmG.1@x),
          # same "logical" but lmG.1 has no 'FALSE' in x slot:[相同的“逻辑”,但lmG.1有没有假X插槽:]
          all(lmG.1 == mmG.1))

class(xnx &lt;- crossprod(nmG.1))# "nsC.."[“NSC ......”]
class(xlx &lt;- crossprod(mmG.1))# "dsC.." : numeric[“DSC ......” :数字]
is0 <- (xlx == 0)
mean(as.vector(is0))# 99.3% zeros: quite sparse, but[99.3%的零:很稀疏,但]
table(xlx@x == 0)# more than half of the entries are (non-structural!) 0[超过一半的条目(non-structural!)0]
stopifnot(isSymmetric(xlx), isSymmetric(xnx),
          ## compare xnx and xlx : have the *same* non-structural 0s :[#比较xNx混心连心:有*同*非结构性0:]
          sapply(slotNames(xnx),
                 function(n) identical(slot(xnx, n), slot(xlx, n))))

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-23 15:02 , Processed in 0.020693 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表