chol(spam)
chol()所属R语言包:spam
Cholesky Factorization for Sparse Matrices
稀疏矩阵的Cholesky分解
译者:生物统计家园网 机器人LoveR
描述----------Description----------
chol performs a Cholesky decomposition of a symmetric positive definite sparse matrix x
chol进行Cholesky分解,对称正定稀疏矩阵x
用法----------Usage----------
# chol(x, \dots)
## S3 method for class 'spam'
chol(x, pivot = "MMD", method = "NgPeyton", memory =
list(), eps = .Spam$eps, ...)
# update.spam.chol.NgPeyton(object, x,...)
## S3 method for class 'spam.chol.NgPeyton'
update(object, x,...)
参数----------Arguments----------
参数:x
symmetric positive definite matrix of class spam.
对称正定矩阵类spam。
参数:pivot
should the matrix be permuted, and if, with what algorithm, see "Details" below.
应被排列在矩阵,用什么算法,见下面“详细资料”。
参数:method
Currently, only NgPeyton is implemented.
目前,仅是NgPeyton实施。
参数:memory
Parameters specific to the method, see "Details" below.
具体的方法的参数,请参阅下面的“详细信息”。
参数:eps
threshold to test symmetry. Defaults to .Spam$eps.
阈值测试的对称性。默认为.Spam$eps的。
参数:...
further arguments passed to or from other methods.
进一步的参数传递给其他方法。
参数:object
an object from a previous call to chol.
对象从以前调用chol。
Details
详细信息----------Details----------
chol performs a Cholesky decomposition of a symmetric positive definite sparse matrix x of class spam. Currently, there is only the block sparse Cholesky algorithm of Ng and Peyton (1993) implemented (method="NgPeyton").
chol进行Cholesky分解,对称正定稀疏矩阵x类spam。目前,只有块稀疏的Cholesky算法的吴和佩顿(1993)实施(method="NgPeyton")。
To pivot/permute the matrix, you can choose between the multiple minimum degree (pivot="MMD") or reverse Cuthill-Mckee (pivot="RCM") from George and Lui (1981). It is also possible to furnish a specific permutation in which case pivot is a vector. For compatibility reasons, pivot can also take a logical in which for FALSE no permutation is done and for TRUE is equivalent to MMD.<br>
枢轴/表,改变基质,您可以选择的多最小程度(pivot="MMD")或反转Cuthill - 麦基(pivot="RCM")从乔治和Lui(1981)。另外,也可以在这种情况下,pivot是一个向量时可提供特定的排列。由于兼容性的原因,pivot也可以采取一个逻辑FALSE没有置换和TRUE是相当于MMD。<BR>的
Often the sparsity structure is fixed and does not change, but the entries do. In those cases, we can update the Cholesky factor with update.spam.chol.NgPeyton by suppling a Cholesky factor and the updated matrix.
通常的稀疏结构是固定的,并不会改变,但做的项目。在这种情况下,我们可以更新的Cholesky因子update.spam.chol.NgPeyton,suppling一个的Cholesky因子和更新的矩阵。
The option cholupdatesingular determines how singular matrices are handled by update. The function hands back an error ("error"), a warning ("warning") or the value NULL ("null").<br>
选项“cholupdatesingular决定如何处理update奇异矩阵。函数传递一个错误("error"),警告("warning")或值NULL("null")。<BR>的
The Cholesky decompositions requires parameters, linked to memory allocation. If the default values are too small the Fortran routine returns an error to R, which allocates more space and calls the Fortran routine again. The user can also pass better estimates of the allocation sizes to chol with the argument memory=list(nnzR=..., nnzcolindices=...). The minimal sizes for a fixed sparsity structure can be obtained from a summary call, see "Examples".<br>
的Cholesky分解需要的参数,内存分配。如果默认值太小,Fortran例程返回一个错误,R,分配更多的空间,并再次调用的Fortran例程。用户还可以通过更好的分配大小的估计chol的说法memory=list(nnzR=..., nnzcolindices=...)。可以得到一个固定的稀疏结构的最小尺寸,从一个summary“打检测,看的例子”。<BR>
The output of chol can be used with forwardsolve and backsolve to solve a system of linear equations.<br>
输出作为chol可以使用forwardsolve和backsolve解决线性方程组的系统。<BR>
Notice that the Cholesky factorization of the package SparseM is also based on the algorithm of Ng and Peyton (1993). Whereas the Cholesky routine of the package Matrix are based on CHOLMOD by Timothy A. Davis (C code).
请注意,Cholesky分解法的套件“SparseM也是基于算法的吴和佩顿(1993)。而进行Cholesky常规的包Matrix的基础上,CHOLMOD,由Timothy A.戴维斯(C代码)。
值----------Value----------
The function returns the Cholesky factor in an object of class spam.chol.method. Recall that the latter is the Cholesky factor of a reordered matrix x, see also ordering.
该函数返回的Cholesky因子对象类spam.chol.方法。回想一下,后者则是Cholesky因子的重新排序矩阵x,请参阅ordering。
注意----------Note----------
Although the symmetric structure of x is needed, only the upper diagonal entries are used. By default, the code does check for symmetry (contrarily to base:::chol). However, depending on the matrix size, this is a time consuming test. A test is ignored if spam.options( "cholsymmetrycheck") is set to FALSE.
尽管对称结构中x需要,只有上对角线的项使用。默认情况下,代码不检查对称(反之base:::chol)。然而,根据上的矩阵的大小,这是一个费时的测试。一个测试被忽略,如果spam.options( "cholsymmetrycheck")设置为FALSE。
If a permutation is supplied with pivot, spam.options( "cholpivotcheck") determines if the permutation is tested for validity (defaults to TRUE).
如果排列与pivot,spam.options( "cholpivotcheck")确定的排列进行测试的有效性(默认为TRUE)。
(作者)----------Author(s)----------
Reinhard Furrer, based on Ng and Peyton (1993) Fortran routines
参考文献----------References----------
on advanced uniprocessor computers, SIAM J. Sci. Comput., 14, 1034–1056.
Computer Solution of Large Sparse Positive Definite Systems, Prentice Hall.
参见----------See Also----------
det, solve, forwardsolve, backsolve and ordering.
det,solve,forwardsolve,backsolve和ordering。
实例----------Examples----------
# generate multivariate normals:[生成多元法线:]
set.seed(13)
n <- 25 # dimension[尺寸]
N <- 1000 # sample size[样本量]
Sigma <- .25^abs(outer(1:n,1:n,"-"))
Sigma <- as.spam( Sigma, eps=1e-4)
cholS <- chol( Sigma)
# cholS is the upper triangular part of the permutated matrix Sigma[cholS是上三角部分置换的矩阵西格玛]
iord <- ordering(cholS, inv=TRUE)
R <- as.spam(cholS)
mvsample <- ( array(rnorm(N*n),c(N,n)) %*% R)[,iord]
# It is often better to order the sample than the matrix[比基体,它往往是更好的订购样品]
# R itself. [R本身。]
# 'mvsample' is of class 'spam'. We need to transform it to a[mvsample“类”垃圾邮件“。我们需要把它转换成一个]
# regular matrix, as there is no method 'var' for 'spam' (should there?).[正规矩阵,有没有方法VAR为垃圾邮件(应该有)。]
norm( var( as.matrix( mvsample)) - Sigma, type='m')
norm( t(R) %*% R - Sigma)
# To speed up factorizations, memory allocations can be optimized:[要加快因式分解,可以优化内存分配:]
opt <- summary(cholS)
# here, some elements of Sigma may be changed...[在这里,一些元素可以改变的Sigma ...]
cholS <- chol( Sigma, memory=list(nnzR=opt$nnzR,nnzcolindices=opt$nnzc))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|