SparseM.ontology(SparseM)
SparseM.ontology()所属R语言包:SparseM
Sparse Matrix Class
稀疏矩阵类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This group of functions evaluates and coerces changes in class structure.
这组函数的计算结果,并且强制阶级结构的变化。
用法----------Usage----------
## S3 method for class 'matrix.csr'
as(x, nrow = 1, ncol = 1, eps = .Machine$double.eps, ...)
## S3 method for class 'matrix.csc'
as(x, nrow = 1, ncol = 1, eps = .Machine$double.eps, ...)
## S3 method for class 'matrix.ssr'
as(x, nrow = 1, ncol = 1, eps = .Machine$double.eps, ...)
## S3 method for class 'matrix.ssc'
as(x, nrow = 1, ncol = 1, eps = .Machine$double.eps, ...)
## S3 method for class 'matrix.csr'
is(x, ...)
## S3 method for class 'matrix.csc'
is(x, ...)
## S3 method for class 'matrix.ssr'
is(x, ...)
## S3 method for class 'matrix.ssc'
is(x, ...)
参数----------Arguments----------
参数:x
is a matrix, or vector object, of either dense or sparse form
是一个矩阵或矢量对象,密集或稀疏的形式
参数:nrow
number of rows of matrix
矩阵的行数
参数:ncol
number of columns of matrix
矩阵的列数
参数:eps
A tolerance parameter: elements of x such that abs(x) < eps set to zero. This argument is only relevant when coercing matrices from dense to sparse form. Defaults to eps = .Machine$double.eps
容差参数元素x使得ABS(X)<EPS设置为零。这种说法是有关强迫矩阵时,从密到疏的形式。默认为eps = .Machine$double.eps
参数:...
other arguments
其他参数
Details
详细信息----------Details----------
The function matrix.csc acts like matrix to coerce a vector object to a sparse matrix object of class matrix.csr. This aspect of the code is in the process of conversion from S3 to S4 classes. For the most part the S3 syntax prevails. An exception is the code to coerce vectors to diagonal matrix form which uses as(v,"matrix.diag.csr". The generic functions as.matrix.xxx coerce a matrix x into a matrix of storage class matrix.xxx. The argument matrix x may be of conventional dense form, or of any of the four supported classes: matrix.csr, matrix.csc, matrix.ssr, matrix.ssc. The generic functions is.matrix.xxx evaluate whether the argument is of class matrix.xxx. The function as.matrix transforms a matrix of any sparse class into conventional dense form. The primary storage class for sparse matrices is the compressed sparse row matrix.csr class. An n by m matrix A with real elements a_{ij}, stored in matrix.csr format consists of three arrays:
函数matrix.csc的作用就像matrix要挟矢量对象的稀疏矩阵对象的类matrix.csr。这方面的代码是在转换的过程中,从S3到S4类。在大多数情况下,S3语法为准。唯一的例外是代码来强制向量的对角矩阵形式,它使用as(v,"matrix.diag.csr"。通用功能as.matrix.xxx要挟矩阵x成一个矩阵存储类matrix.xxx。参数矩阵x可能是传统的密集形式,或任何支持的4类:matrix.csr, matrix.csc, matrix.ssr, matrix.ssc。通用功能is.matrix.xxx评估参数是否是类matrix.xxx。的功能as.matrix变换矩阵任何稀疏的类的常规密集的形式。主存储类稀疏矩阵的压缩稀疏行matrix.csr类。一个n×m矩阵A与现实要素a_{ij},matrix.csr格式存储在由三个数组:
ra: a real array of nnz elements containing the non-zero elements of A, stored in row order. Thus, if i<j, all elements of row i precede elements from row j. The order of elements within the rows is immaterial.
ra:NNZ元素包含的非零元素A,行顺序存储在一个真正的数组。因此,如果I <J,行,我行j的元素之前的所有元素。行内元素的顺序是无关紧要的。
ja: an integer array of nnz elements containing the column indices of the elements stored in ra.
ja:NNZ元素包含列索引的元素的整数数组存储在ra。
ia: an integer array of n+1 elements containing pointers to the beginning of each row in the arrays ra and ja. Thus ia[i] indicates the position in the arrays ra and ja where the ith row begins. The last, (n+1)st, element of ia indicates where the n+1 row would start, if it existed.
ia:整数的n +1个元素的数组的指针阵列ra和ja中的每一行的开头。因此ia[i]表示阵列中的ra和ja其中第i行开始的位置。最后,(N +1)个元素的ia表示,其中N +1行开始,如果它存在。
The compressed sparse column class matrix.csc is defined in an analogous way, as are the matrix.ssr, symmetric sparse row, and matrix.ssc, symmetric sparse column classes.
的压缩稀疏列类的matrix.csc是指在一个类似的方式,matrix.ssr,对称稀疏行,并matrix.ssc,对称稀疏列类。
注意----------Note----------
as.matrix.ssr and as.matrix.ssc should ONLY be used with symmetric matrices.
as.matrix.ssr和as.matrix.ssc应该只可使用对称矩阵。
as.matrix.csr(x), when x is an object of class matrix.csr.chol (that is, an object returned by a call to chol(a) when a is an object of class matrix.csr or matric.csc), by default returns an upper triangular matrix, which is not consistent with the result of chol in the base package. To get an lower triangular matric.csr matrix, use either as.matrix.csr(x, upper.tri = FALSE) or t(as.matrix.csr(x)).
as.matrix.csr(x),当x是类的一个对象matrix.csr.chol(即,通过调用chol(a)返回的对象a是类的一个对象 matrix.csr或matric.csc),默认情况下会返回一个上三角矩阵,这是不符合的结果cholbase包。为了得到一个下三角matric.csr矩阵,使用的是as.matrix.csr(x, upper.tri = FALSE)或t(as.matrix.csr(x))。
参考文献----------References----------
http://www.econ.uiuc.edu/~roger/research
参见----------See Also----------
SparseM.hb for handling Harwell-Boeing sparse matrices.
SparseM.hb哈威尔波音稀疏矩阵处理。
实例----------Examples----------
n1 <- 10
p <- 5
a <- rnorm(n1*p)
a[abs(a)<0.5] <- 0
A <- matrix(a,n1,p)
B <- t(A)%*%A
A.csr <- as.matrix.csr(A)
A.csc <- as.matrix.csc(A)
B.ssr <- as.matrix.ssr(B)
B.ssc <- as.matrix.ssc(B)
is.matrix.csr(A.csr) # -> TRUE[ - > TRUE]
is.matrix.csc(A.csc) # -> TRUE[ - > TRUE]
is.matrix.ssr(B.ssr) # -> TRUE[ - > TRUE]
is.matrix.ssc(B.ssc) # -> TRUE[ - > TRUE]
as.matrix(A.csr)
as.matrix(A.csc)
as.matrix(B.ssr)
as.matrix(B.ssc)
as.matrix.csr(rep(0,9),3,3) #sparse matrix of all zeros[稀疏矩阵的所有零]
as(4,"matrix.diag.csr") #identity matrix of dimension 4[4维的单位矩阵]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|