當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R condest 計算(大)矩陣的近似條件數和 1-範數

R語言 condest 位於 Matrix 包(package)。

說明

“Estimate”,即近似計算(可能很大,通常稀疏)矩陣 A 的 CONDition 數。它的工作原理是應用 1-範數 norm(A,"1")onenormest(.) 的快速隨機近似。

用法

condest(A, t = min(n, 5), normA = norm(A, "1"),
        silent = FALSE, quiet = TRUE)

onenormest(A, t = min(n, 5), A.x, At.x, n,
           silent = FALSE, quiet = silent,
           iter.max = 10, eps = 4 * .Machine$double.eps)

參數

A

方陣,對於 onenormest() 是可選的,其中可以指定 A.xAt.x,而不是 A ,請參閱此處。

t

迭代中使用的列數。

normA

數字; A 的 1-範數(估計),默認為 norm(A, "1") ;可以用估計值代替。

silent

邏輯指示是否應顯示警告和(默認情況下)收斂消息。

quiet

邏輯指示是否應顯示收斂消息。

A.x , At.x

A 丟失時,這兩個必須分別作為計算 A %% xt(A) %% x 的函數給出。

n

== nrow(A) ,僅在未指定A 時需要。

iter.max

1-範數估計器的最大迭代次數。

eps

被認為不相關的相對變化。

細節

condest() 調用 lu(A) ,隨後調用 onenormest(A.x = , At.x = ) 來計算 A 的逆的近似範數,從而在 A 稀疏時保持有效使用稀疏矩陣。

請注意, onenormest() 使用隨機向量,因此兩個函數的結果都是隨機的,即取決於隨機種子,請參見 set.seed()

兩個函數都返回 listcondest() 帶有組件,

est

數字 ,估計的(1-範數)條件數 ;當 rcond(A) ,

v

最大 列,縮放至norm(v) = 1。因此, ;當est很大時,v是近似零向量。

函數 onenormest() 返回一個包含組件的列表,

est

一個數字 ,估計的 norm(A, "1")

v

0-1 整數向量長度 n ,索引 j 處有 1,最大列 A[,j] 位於 中。

w

數值向量,找到的最大的

iter

使用的迭代次數。

例子


data(KNex, package = "Matrix")
mtm <- with(KNex, crossprod(mm))
system.time(ce <- condest(mtm))
sum(abs(ce$v)) ## || v ||_1  == 1
## Prove that  || A v || = || A || / est  (as ||v|| = 1):
stopifnot(all.equal(norm(mtm %*% ce$v),
                    norm(mtm) / ce$est))

## reciprocal
1 / ce$est
system.time(rc <- rcond(mtm)) # takes ca  3 x  longer
rc
all.equal(rc, 1/ce$est) # TRUE -- the approxmation was good

one <- onenormest(mtm)
str(one) ## est = 12.3
## the maximal column:
which(one$v == 1) # mostly 4, rarely 1, depending on random seed

作者

This is based on octave's condest() and onenormest() implementations with original author Jason Riedy, U Berkeley; translation to R and adaption by Martin Maechler.

參考

Nicholas J. Higham and Françoise Tisseur (2000). A Block Algorithm for Matrix 1-Norm Estimation, with an Application to 1-Norm Pseudospectra. SIAM J. Matrix Anal. Appl. 21, 4, 1185-1201.

William W. Hager (1984). Condition Estimates. SIAM J. Sci. Stat. Comput. 5, 311-316.

也可以看看

normrcond

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Compute Approximate CONDition number and 1-Norm of (Large) Matrices。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。