sparseMatrix-class(Matrix)
sparseMatrix-class()所属R语言包:Matrix
Virtual Class "sparseMatrix" — Mother of Sparse Matrices
虚拟教室“sparseMatrix” - 稀疏矩阵的母亲
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Virtual Mother Class of All Sparse Matrices
所有稀疏矩阵的虚拟妈妈级
插槽----------Slots----------
Dim: Object of class "integer" - the dimensions of the matrix - must be an integer vector with exactly two
Dim"integer" - 矩阵的尺寸 - 必须是一个整数向量正好有两个:对象类
Dimnames: a list of length two - inherited from class
Dimnames:一个长度为2的列表 - 从类继承
延伸----------Extends----------
Class "Matrix", directly.
类"Matrix",直接。
方法----------Methods----------
show (object = "sparseMatrix"): The show method for sparse matrices prints “structural” zeroes as "." using
显示(object = "sparseMatrix"):show稀疏矩阵的方法,打印的“结构性”零"."使用
print signature(x = "sparseMatrix"), ....<br> The print method for sparse matrices by default is the same as show() but can be called with extra optional
打印signature(x = "sparseMatrix"),print默认情况下,稀疏矩阵的方法......参考是相同show(),但可以要求额外的可选
format signature(x = "sparseMatrix"), ....<br> The format method for sparse matrices, see formatSpMatrix() for details such as the extra
格式signature(x = "sparseMatrix"),format方法......参考稀疏矩阵,看到formatSpMatrix()如额外的细节
summary (object = "sparseMatrix"): Returns an object of S3 class "sparseSummary" which is basically a data.frame with columns (i,j,x) (or just (i,j) for nsparseMatrix class objects) with the stored (typically non-zero) entries. The print method resembles Matlab's way of printing sparse matrices, and also the MatrixMarket format, see
摘要(object = "sparseMatrix"):返回一个对象的S3类"sparseSummary"这基本上是一个data.frame列(i,j,x)(或只是(i,j)nsparseMatrix类对象)与存储(通常是非零)项。 print方法类似于Matlab的印刷稀疏矩阵的方式,也MatrixMarket格式,请参阅
cbind2 (x = *, y = *): several methods for binding matrices together, column-wise, see the basic cbind and rbind functions.<br> Note that the result will typically be sparse, even when one argument is dense and larger than the sparse one.
cbind2(x = *, y = *):结合矩阵,列明智的几种方法,看到的基本cbind和rbind功能参考的注意,结果通常会是稀疏的,甚至当一个参数。密集和较大的比稀疏。
rbind2 (x = *, y = *): binding matrices together
rbind2(x = *, y = *):结合矩阵在一起
determinant (x = "sparseMatrix", logarithm=TRUE): determinant() methods for sparse matrices typically
行列式(x = "sparseMatrix", logarithm=TRUE):determinant()方法通常稀疏矩阵
diag (x = "sparseMatrix"): extracts the diagonal of a
诊断(x = "sparseMatrix"):提取的对角线
dim<- signature(x = "sparseMatrix", value = "ANY"): allows to reshape a sparse matrix to a sparse matrix with the same entries but different dimensions. value must be of
昏暗< - signature(x = "sparseMatrix", value = "ANY"):允许相同的项目,但不同的尺寸与重塑一个稀疏矩阵稀疏矩阵。 value必须是
coerce signature(from = "factor", to = "sparseMatrix"): Coercion of a factor to "sparseMatrix" produces the matrix of indicator rows stored as an object of class "dgCMatrix". To obtain columns representing the interaction of the factor and a numeric covariate, replace the "x" slot of the result by the numeric covariate then take the transpose. Missing values (NA) from the factor are translated
要挟signature(from = "factor", to = "sparseMatrix"):强迫一个因素"sparseMatrix"生产指标行的矩阵作为一个对象存储类"dgCMatrix"。为了获得列的因素和一个数字协变量的相互作用,取代数字的协变量的"x"结果槽,然后采取调换。均按缺失值的因素(NA)
See also colSums, norm, ... for methods with separate help pages.
还可以看colSums,norm,...具有独立的帮助页面的方法。
注意----------Note----------
In method selection for multiplication operations (i.e. %*% and the two-argument form of crossprod) the sparseMatrix class takes precedence in the sense that if one operand is a sparse matrix and the other is any type of dense matrix then the dense matrix is coerced to a dgeMatrix and the appropriate sparse matrix method is used.
乘法运算方法的选择(即%*%“两个参数形式crossprod)的sparseMatrix类优先在这个意义上说,如果一个操作数是一个稀疏矩阵和其他任何类型的致密矩阵然后被强迫dgeMatrix和适当的稀疏矩阵方法用于稠密矩阵。
举例----------Examples----------
showClass("sparseMatrix") ## and look at the help() of its subclasses[#看看帮助(及其子类)]
M <- Matrix(0, 10000, 100)
M[1,1] <- M[2,3] <- 3.14
M ## show(.) method suppresses printing of the majority of rows[#显示(...)方法抑制广大行打印]
data(CAex); dim(CAex) # 72 x 72 matrix[72×72矩阵]
determinant(CAex) # works via sparse lu(.)[通过稀疏陆工程()]
## factor -> t( <sparse design matrix> ) :[#因素 - > T(<sparse的设计matrix>):]
(fact <- gl(5, 3, 30, labels = LETTERS[1:5]))
(Xt <- as(fact, "sparseMatrix")) # indicator rows[指示行]
## missing values --> all-0 columns:[#失踪 - >全0列的值:]
f.mis <- fact
i.mis <- c(3:5, 17)
is.na(f.mis) <- i.mis
Xt != (X. <- as(f.mis, "sparseMatrix")) # differ only in columns 3:5,17[唯一不同列3:5,17]
stopifnot(all(X.[,i.mis] == 0), all(Xt[,-i.mis] == X.[,-i.mis]))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|