# arnoldi: Arnoldi Iteration In pracma: Practical Numerical Math Functions

 arnoldi R Documentation

## Arnoldi Iteration

### Description

Arnoldi iteration generates an orthonormal basis of the Krylov space and a Hessenberg matrix.

### Usage

``````arnoldi(A, q, m)
``````

### Arguments

 `A` a square n-by-n matrix. `q` a vector of length n. `m` an integer.

### Details

`arnoldi(A, q, m)` carries out `m` iterations of the Arnoldi iteration with n-by-n matrix `A` and starting vector `q` (which need not have unit 2-norm). For `m < n` it produces an n-by-(m+1) matrix `Q` with orthonormal columns and an (m+1)-by-m upper Hessenberg matrix `H` such that `A*Q[,1:m] = Q[,1:m]*H[1:m,1:m] + H[m+1,m]*Q[,m+1]*t(E_m)`, where `E_m` is the m-th column of the m-by-m identity matrix.

### Value

Returns a list with two elements:

`Q` A matrix of orthonormal columns that generate the Krylov space `(A, A q, A^2 q, ...)`.

`H` A Hessenberg matrix such that `A = Q * H * t(Q)`.

### References

Nicholas J. Higham (2008). Functions of Matrices: Theory and Computation, SIAM, Philadelphia.

`hessenberg`

### Examples

``````A <- matrix(c(-149,   -50,  -154,
537,   180,   546,
-27,    -9,   -25), nrow = 3, byrow = TRUE)
a <- arnoldi(A, c(1,0,0))
a
## \$Q
##      [,1]       [,2]       [,3]
## [1,]    1  0.0000000  0.0000000
## [2,]    0  0.9987384 -0.0502159
## [3,]    0 -0.0502159 -0.9987384
##
## \$H
##           [,1]         [,2]        [,3]
## [1,] -149.0000 -42.20367124  156.316506
## [2,]  537.6783 152.55114875 -554.927153
## [3,]    0.0000   0.07284727    2.448851

a\$Q %*% a\$H %*% t(a\$Q)
##      [,1] [,2] [,3]
## [1,] -149  -50 -154
## [2,]  537  180  546
## [3,]  -27   -9  -25
``````

pracma documentation built on Nov. 10, 2023, 1:14 a.m.