A
.
It works by apply a fast randomized approximation of the 1-norm,
norm(A,"1")
, through 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)
onenormest()
, where
instead of A
, A.x
and At.x
can be specified,
see there.A
, by
default norm(A, "1")
; may be replaced by an estimate.A
is missing, these two must be given as
functions which compute A %% x
, or t(A) %% x
,
respectively. == nrow(A)
, only needed when A
is not specified.list
;
condest()
with components,The function onenormest()
returns a list with components,condest()
calls lu(A)
, and subsequently
onenormest(A.x = , At.x = )
to compute an approximate norm of
the inverse of A
, $A^{-1}$, in a way which
keeps using sparse matrices efficiently when A
is sparse. Note that onenormest()
uses random vectors and hence
both functions' results are random, i.e., depend on the random
seed, see, e.g., set.seed()
.
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. http://dx.doi.org/10.1137/S0895479899356080
William W. Hager (1984). Condition Estimates. SIAM J. Sci. Stat. Comput. 5, 311--316.
norm
, rcond
.
data(KNex)
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
Run the code above in your browser using DataLab