2013-04-04 20 views
3

我是R中的新用戶。請您介紹一下在計算R中的QR分解時參數tol的參數嗎?QR分解中tol參數的作用

例如什麼是該兩行的區別:

qr(A, tol=1e-07) #Doesn't work 

qr(A, tol=1e-20) #Works 

爲什麼我得到我想要的resullt與tol這麼小的值,但與更大的價值?

+0

你看過'qr()'的文檔嗎? – Stedy 2013-04-04 00:17:54

+0

是的,但我沒有失去它。這就是爲什麼我問問題。 – rose 2013-04-04 00:21:31

回答

5

tol參數控制qr是否會爲列返回值,具體取決於列是否被判斷爲線性相關。我認爲將價值降至1e-16以下的做法將會破壞檢查的目的。 (這是在雙精度數學的零相當多的實際的定義。)

首先看qr.default,然後找到FORTRAN代碼:

http://svn.r-project.org/R/trunk/src/appl/dqrdc2.f

這是描述了FORTRAN程序註釋邏輯:

c  cycle the columns from l to p left-to-right until one 
c  with non-negligible norm is located. a column is considered 
c  to have become negligible if its norm has fallen below 
c  tol times its original norm. the check for l .le. k 
c  avoids infinite cycling.