R 語言中的 chol() 函數用於計算實對稱 positive-definite 方陣的 Choleski 分解。
用法: chol(x, …)
參數:
x: an object for which a method exists. The default method applies to real symmetric, positive-definite matrices
範例1:
Python3
# R program to illustrate
# chol function
# Initializing a matrix with
# 2 rows and 2 columns
x <- matrix(c(8, 1, 1, 4), 2, 2)
# Getting the matrix representation
x
# Calling the chol() function
y <- chol(x)
# Getting the Choleski factorization
# of the specified matrix
y
輸出:
[, 1] [, 2] [1, ] 8 1 [2, ] 1 4 [, 1] [, 2] [1, ] 2.828427 0.3535534 [2, ] 0.000000 1.9685020
範例2:
Python3
# R program to illustrate
# chol function
# Initializing a matrix with
# 2 rows and 2 columns
x <- matrix(c(1, 2, 3, 4), 2, 2)
# Getting the matrix representation
x
# Calling the chol() function
y <- chol(x)
# Getting the Choleski factorization
# of the specified matrix
y
輸出:
[, 1] [, 2] [1, ] 1 3 [2, ] 2 4 Error in chol.default(x): the leading minor of order 2 is not positive definite Calls:chol -> chol.default Execution halted
相關用法
- R語言 dunif()用法及代碼示例
- R語言 lgamma()用法及代碼示例
- R語言 digamma()用法及代碼示例
- R語言 trigamma()用法及代碼示例
- R語言 qcauchy()用法及代碼示例
- R語言 qlogis()用法及代碼示例
- R語言 qlnorm()用法及代碼示例
- R語言 qpois()用法及代碼示例
- R語言 qnbinom()用法及代碼示例
- R語言 ecdf()用法及代碼示例
- R語言 pf()用法及代碼示例
- R語言 qf()用法及代碼示例
- R語言 qweibull()用法及代碼示例
- R語言 qtukey()用法及代碼示例
- R語言 qsignrank()用法及代碼示例
- R語言 qwilcox()用法及代碼示例
- R語言 integrate()用法及代碼示例
- R語言 qgeom()用法及代碼示例
- R語言 qunif()用法及代碼示例
- R語言 rf()用法及代碼示例
- R語言 cospi()用法及代碼示例
注:本文由純淨天空篩選整理自Kanchan_Ray大神的英文原創作品 Compute Choleski factorization of a Matrix in R Programming – chol() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。