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

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

[复制链接]
发表于 2012-2-17 09:44:06 | 显示全部楼层 |阅读模式
nsparseMatrix-classes(Matrix)
nsparseMatrix-classes()所属R语言包:Matrix

                                        Sparse "pattern" Matrices
                                         稀疏的“模式”矩阵

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

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

The nsparseMatrix class is a virtual class of sparse “pattern” matrices, i.e., binary matrices conceptually with TRUE/FALSE entries.  Only the positions of the elements that are TRUE are stored.  These can be stored in the “triplet” form (classes ngTMatrix, nsTMatrix, and ntTMatrix which really contain pairs, not triplets) or in compressed column-oriented form (classes ngCMatrix, nsCMatrix, and ntCMatrix) or in compressed row-oriented form (classes ngRMatrix, nsRMatrix, and ntRMatrix).  The second letter in the name of these non-virtual classes indicates general, symmetric, or triangular.
nsparseMatrix类TRUE/FALSE项概念是一个虚拟的“模式”稀疏矩阵,即,二进制矩阵的类。只有位置的元素是TRUE存储。这些都可以存储在“三重”的形式(类ngTMatrix,nsTMatrix,ntTMatrix这确实包含对,而不是三胞胎)或压缩面向列的形式(类ngCMatrix,nsCMatrix,ntCMatrix)或压缩面向行的形式(类ngRMatrix,nsRMatrix,ntRMatrix)。在这些非虚拟类的名称的第二个字母表示general的,symmetric,或triangular的。


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

Objects can be created by calls of the form new("ngCMatrix",     ...) and so on.  More frequently objects are created by coercion of a numeric sparse matrix to the pattern 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 numeric sparse matrices can be treated as sparse pattern matrices.
创建对象可以通过电话的形式new("ngCMatrix",     ...)等。更频繁的对象创建一个数字的稀疏矩阵稀疏矩阵算法涉及的象征性分析阶段使用的模式形式的胁迫。这样的算法往往涉及两个阶段:一个象征性的阶段,其中在非0的位置确定和计算的实际结果是其中一个数字阶段。在象征性的阶段,只有在任何操作数非零元素的位置的利益,因此数字稀疏矩阵可以被视为稀疏模式矩阵。


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




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 =         "ngCMatrix"), and many similar ones; typically you should coerce to "nsparseMatrix" (or "nMatrix").  Note that coercion to a sparse pattern matrix records all the potential non-zero entries, i.e., explicit (“non-structural”) zeroes are coerced to TRUE, not FALSE, see the example.
要挟signature(from = "dgCMatrix", to =         "ngCMatrix"),和许多类似的,通常你应该强迫"nsparseMatrix"("nMatrix")。请注意,强迫稀疏模式矩阵记录所有潜在的非零项,即明确零(“非结构性”)被裹挟TRUE,而不是FALSE,看到的例子。




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




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)))
## ``extract the nonzero-pattern of (m) into an nMatrix'':[#提取非零模式到nMatrix(M)“:]
nm &lt;- as(m, "nsparseMatrix") ## -&gt; will be a "ngCMatrix"[# - >将是一个“ngCMatrix”]
str(nm) # no 'x' slot[没有X槽]
nnm &lt;- !nm     # no longer sparse[不再稀疏]
(nnm &lt;- as(nnm, "sparseMatrix"))# "lgCMatrix"[“lgCMatrix”]
## consistency check:[#一致性检查:]
stopifnot(xor(as( nm, "matrix"),
              as(nnm, "matrix")))

## low-level way of adding "non-structural zeros" :[#加入“非结构性零”的低层次的方式:]
nnm@x[2:4] <- c(FALSE,NA,NA)
nnm
as(nnm, "nMatrix") # NAs *and* non-structural 0  |---&gt;  'TRUE'[定居*和*非结构性0 | --->“TRUE”]

data(KNex)
nmm <- as(KNex $ mm, "ngCMatrix")
str(xlx &lt;- crossprod(nmm))# "nsCMatrix"[“nsCMatrix”]
stopifnot(isSymmetric(xlx))
image(xlx, main=paste("crossprod(nmm) : Sparse", class(xlx)))

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


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

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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