spam(spam)
spam()所属R语言包:spam
Sparse Matrix Class
稀疏矩阵类
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This group of functions evaluates and coerces changes in class structure.
这组函数的计算结果,并且强制阶级结构的变化。
用法----------Usage----------
spam(x, nrow = 1, ncol = 1, eps = .Spam$eps)
as.spam(x, eps = .Spam$eps)
is.spam(x)
参数----------Arguments----------
参数:x
is a matrix (of either dense or sparse form), a list, vector object or a distance object
是一个矩阵(任密集或稀疏的形式),一个列表,矢量对象或距离对象
参数: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. Defaults to eps = .Spam$eps
容差参数:xabs(x) < eps设置为0的元素。默认为eps = .Spam$eps
Details
详细信息----------Details----------
The functions spam and as.spam act like matrix and as.matrix to coerce an object to a sparse matrix object of class spam.
的功能spam和as.spam就像matrix和as.matrix要挟对象的稀疏矩阵对象的类spam。
If x is a list, it should contain either two or three elements. In case of the former, the list should contain a n by two matrix of indicies (called ind) and the values. In case of the latter, the list should contain three vectors containing the row, column indices (called i and j) and the values. In both cases partial matching is done. In case there are several triplets with the same i, j, the values are added.
如果x是一个列表,它应该包含两个或三个元素。在前者的情况下,列表应包含一个n的序号为两个矩阵(称为ind)的值。在后一种情况下,列表应包含三个向量包含行,列索引(i和j)和值。在这两种情况下的部分进行匹配。的情况下有几个三胞胎同样的i,j的值被添加。
eps should be at least as large as .Machine$double.eps.
eps应该在至少一样大的.Machine$double.eps。
值----------Value----------
A valid spam object.<br>
有效的spam对象。<BR>
注意----------Note----------
The zero matrix has the element zero stored in (1,1).<br>
零矩阵具有(1,1)中存储的元素为零。<br>物理化学学报
The functions do not test the presence of NA/NaN/Inf. Virtually all call a Fortran routine with the NAOK=!.Spam$safemode[3] argument, which defaults to FALSE resulting in an error. Hence, the NaN do not always properly propagate through (i.e. spam is not IEEE-754 compliant).
该功能没有测试存在的NA/NaN/Inf。几乎所有的调用的Fortran例程的NAOK=!.Spam$safemode[3]的说法,默认为FALSE导致错误。因此,NaN不总是正确地传播到(即spam是不符合IEEE-754)。
(作者)----------Author(s)----------
Reinhard Furrer
参考文献----------References----------
<h3>See Also</h3> <code>SPAM</code> for a general overview of the package; <code>spam.options</code> for details about the <code>safemode</code> flag; <code>read.MM</code> and <code>foreign</code> to create <code>spam</code> matrices from MatrixMarket files and from certain <code>Matrix</code> or <code>SparseM</code> formats.
实例----------Examples----------
# old message, do not loop, when you create a large sparse matrix[旧的消息,不循环,当你创建一个大型稀疏矩阵]
set.seed(13)
nz <- 128
ln <- nz^2
smat <- spam(0,ln,ln)
is <- sample(ln,nz)
js <- sample(ln,nz)
system.time(for (i in 1:nz) smat[is[i], js[i]] <- i)
system.time(smat[cbind(is,js)] <- 1:nz)
getClass("spam")
try(as.spam.numeric(NA))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|