chol(base)
chol()所属R语言包:base
The Choleski Decomposition
Choleski分解
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Compute the Choleski factorization of a real symmetric positive-definite square matrix.
Choleski分解计算实对称正定方阵。
用法----------Usage----------
chol(x, ...)
## Default S3 method:[默认方法]
chol(x, pivot = FALSE, LINPACK = pivot, ...)
参数----------Arguments----------
参数:x
an object for which a method exists. The default method applies to real symmetric, positive-definite matrices.
一个对象的方法存在。默认的方法适用于实对称正定矩阵。
参数:...
arguments to be based to or from methods.
根据或从方法的参数。
参数:pivot
Should pivoting be used?
应枢轴可以使用?
参数:LINPACK
logical. Should LINPACK be used in the non-pivoting case (for compatibility with R < 1.7.0)?
逻辑。 LINPACK性能应该被用在非旋转的情况下(与R <1.7.0兼容)?
Details
详情----------Details----------
chol is generic: the description here applies to the default method.
chol是通用的:这里的描述适用于默认的方法。
This is an interface to the LAPACK routine DPOTRF and the LINPACK routines DPOFA and DCHDC.
这是一个接口的LAPACK的例行DPOTRF的LINPACK例程DPOFA和DCHDC。
Note that only the upper triangular part of x is used, so that R'R = x when x is symmetric.
注意:只有上三角部分x使用,因此,R'R = x时x是对称的。
If pivot = FALSE and x is not non-negative definite an error occurs. If x is positive semi-definite (i.e., some zero eigenvalues) an error will also occur, as a numerical tolerance is used.
如果pivot = FALSE和x是不是非负一定的错误发生。 x如果是半正定(即,一些零特征值)错误也会发生,作为一个数值公差。
If pivot = TRUE, then the Choleski decomposition of a positive semi-definite x can be computed. The rank of x is returned as attr(Q, "rank"), subject to numerical errors. The pivot is returned as attr(Q, "pivot"). It is no longer the case that t(Q) %*% Q equals x. However, setting pivot <- attr(Q, "pivot") and oo <- order(pivot), it is true that t(Q[, oo]) %*% Q[, oo] equals x, or, alternatively, t(Q) %*% Q equals x[pivot, pivot]. See the examples.
如果pivot = TRUE,然后一个半正定x Choleski分解可以计算的。 x排名返回attr(Q, "rank"),数值误差。支点返回attr(Q, "pivot")。它已不再是t(Q) %*% Q等于x。但是,设置pivot <- attr(Q, "pivot")和oo <- order(pivot),这是事实,t(Q[, oo]) %*% Q[, oo]等于x,或者,或者,t(Q) %*% Q等于x[pivot, pivot]的。见的例子。
值----------Value----------
The upper triangular factor of the Choleski decomposition, i.e., the matrix R such that R'R = x (see example).
上三角的Choleski分解的因素,即矩阵R等R'R = x(见示例)。
If pivoting is used, then two additional attributes "pivot" and "rank" are also returned.
如果使用旋转,然后两个附加属性"pivot"和"rank"也返回。
警告----------Warning----------
The code does not check for symmetry.
该代码不检查的对称性。
If pivot = TRUE and x is not non-negative definite then there will be a warning message but a meaningless result will occur. So only use pivot = TRUE when x is non-negative definite by construction.
如果pivot = TRUE和x是不是非负定,然后会有一个警告消息,但一个毫无意义的结果会发生。因此,只有使用pivot = TRUE时x非负的建设明确。
参考文献----------References----------
The New S Language. Wadsworth & Brooks/Cole.
LINPACK Users Guide. Philadelphia: SIAM Publications.
LAPACK Users' Guide. Third Edition. SIAM.<br> Available on-line at http://www.netlib.org/lapack/lug/lapack_lug.html.
参见----------See Also----------
chol2inv for its inverse (without pivoting), backsolve for solving linear systems with upper triangular left sides.
chol2inv其逆(不旋转),backsolve求解线性系统与上三角的左右两侧。
qr, svd for related matrix factorizations.
qr,svd相关的矩阵分解。
举例----------Examples----------
( m <- matrix(c(5,1,1,3),2,2) )
( cm <- chol(m) )
t(cm) %*% cm #-- = 'm'[ - =M]
crossprod(cm) #-- = 'm'[ - =M]
# now for something positive semi-definite[现在一些半正定]
x <- matrix(c(1:5, (1:5)^2), 5, 2)
x <- cbind(x, x[, 1] + 3*x[, 2])
m <- crossprod(x)
qr(m)$rank # is 2, as it should be[2,因为它应该是]
# chol() may fail, depending on numerical rounding:[金正哲()可能会失败,根据数值四舍五入:]
# chol() unlike qr() does not use a tolerance.[金正哲()不像QR()不使用的宽容。]
try(chol(m))
(Q <- chol(m, pivot = TRUE)) # NB wrong rank here - see Warning section.[这里注错排名 - 见警告节。]
## we can use this by[#我们可以使用这]
pivot <- attr(Q, "pivot")
crossprod(Q[, order(pivot)]) # recover m[恢复米]
## now for a non-positive-definite matrix[#现在非正定矩阵]
( m <- matrix(c(5,-5,-5,3),2,2) )
try(chol(m)) # fails[失败]
try(chol(m, LINPACK=TRUE)) # fails[失败]
(Q <- chol(m, pivot = TRUE)) # warning[警告]
crossprod(Q) # not equal to m[不等于m]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|