R: Eigenvalues for Sparse Matrices

eigen {spam} | R Documentation

## Eigenvalues for Sparse Matrices

### Description

Functions to calculate eigenvalues and eigenvectors of `sparse` matrices. It uses the value of `spam.options("inefficiencywarning")` to dispatch between `base::eigen()` or the Implicitly Restarted Arnoldi Process, using 'ARPACK'.

`eigen.spam` is a wrapper function of `eigen_approx` and transforms its output to `base::eigen` like.

### Usage

    eigen.spam(x, nev = 10, symmetric, only.values = FALSE, control = list())
    eigen_approx(x, nev, ncv, nitr, mode, only.values = FALSE, verbose = FALSE, f_routine)

### Arguments

`x` | a matrix of class `spam` whose `nev` eigenvalues and eigenvectors are to be computed.
`nev` | number of eigenvalues to calculate.
`symmetric` | if TRUE, the matrix is assumed to be symmetric.
`only.values` | if TRUE, only `nev` eigenvalues are computed and returned, otherwise `nev` eigenvalues and eigenvectors are returned.
`control` | additional options, see ‘Details’.
`ncv` | see ‘Details’, use the `control` option for `eigen.spam`.
`nitr` | see ‘Details’, use the `control` option for `eigen.spam`.
`mode` | see ‘Details’, use the `control` option for `eigen.spam`.
`verbose` | see ‘Details’, use the `control` option for `eigen.spam`.
`f_routine` | only for `eigen_approx`, to call the Fortran routine for symmetric matrices set this option to "ds_eigen_f" and for non symmetric to "dn_eigen_f".

### Details

`mode = "LM"`:

  there are different modes available for this function, each mode returns a different range of eigenvalues. Also the available modes are dependent, whether the input matrix is symmetric or not:

  `"LM"`:

    Eigenvalues with largest magnitude (sym, non sym), that is, largest eigenvalues in the Euclidean norm of complex numbers.

  `"SM"`:

    Eigenvalues with smallest magnitude (sym, non sym), that is, smallest eigenvalues in the Euclidean norm of complex numbers.

  `"LR"`:

    Eigenvalues with largest real part (non sym).

  `"SR"`:

    Eigenvalues with smallest real part (non sym).

  `"LI"`:

    Eigenvalues with largest imaginary part (non sym).

  `"SI"`:

    Eigenvalues with smallest imaginary part (non sym).

  `"LA"`:

    Eigenvalues with largest algebraic value (sym), that is, largest eigenvalues inclusive of any negative sign.

  `"SA"`:

    Eigenvalues with smallest algebraic value (syn), that is, smallest eigenvalues inclusive of any negative sign.

`ncv`:

  the largest number of basis vectors that will be used in the Implicitly Restarted Arnoldi Process. Work per major iteration is proportional to x@dimension[1]*ncv*ncv. The default is set if `symmetric` to min(x@dimension[1] + 1, max(2 * nev + 1, 200)) or else to min(x@dimension[1] - 1, max(2 * nev + 1, 100)). Note, this value should not be chosen arbitrary large, but slightly larger than `nev`. Otherwise it could lead to memory allocation problems.

`nitr`:

  the maximum number of iterations. The default is set to `ncv + 1000`

`spamflag = FALSE`:

  if TRUE, the Implicitly Restarted Arnoldi Process is used, independent of the dimension of the respective matrix.

`verbose = FALSE`:

  print additional information.

`cmplxeps`:

  threshold to determine whether a double value is zero, while transforming the ARPACK output to R class complex. The default is set to `.Machine$double.eps`.

### Value

A vector of the length corresponding to the dimension of the input matrix. Containing the required `nev` eigenvalues. If requested also the corresponding eigenvectors. In the non symmetric case, the eigenvalues are returned in a matrix with a column containing the real parts and a column containing the imaginary parts of the eigenvalues. The eigenvectors are then returned in two matrices.

### Note

For non symmetric matrices it can not be guaranteed, that the Fortran code is stable. The user is advised to choose the `control` options carefully, see ‘Details’ for more information.

### Author(s)

Roman Flury

### References

Lehoucq, R. B. and Sorensen, D. C. and Yang, C. (1997) ARPACK Users Guide: Solution of Large Scale Eigenvalue Problems by Implicitly Restarted Arnoldi Methods.

### See Also

Option `"inefficiencywarning"` in `spam.options`.

### Examples

    gmrf <- precmat.GMRFreglat(50, 50, c(.4,.3,.2,.1),'m2p4')
    eigen.spam(gmrf, nev = 50, control = list(mode = "LM"))

[Package spam version 2.3-0 Index]