eigen: Spectral decomposition

View source: R/S3_eigen.R

eigenR Documentation

Spectral decomposition

Description

Overrides base::eigen() to dispatch on HDF5Matrix objects. For plain R matrices the call is forwarded to base::eigen().

Usage

eigen(x, symmetric, ...)

## Default S3 method:
eigen(
  x,
  symmetric = !isSymmetric(x),
  only.values = FALSE,
  EISPACK = FALSE,
  ...
)

## S3 method for class 'HDF5Matrix'
eigen(x, symmetric = TRUE, ...)

Arguments

x

An HDF5Matrix or any R object accepted by base::eigen().

symmetric

Logical. Whether to assume x is symmetric. Passed to base::eigen() for plain R objects.

...

For HDF5Matrix: named arguments forwarded to x$eigen()k (integer, number of eigenvalues), which (character, "LM"/"SM"/etc.), compute_vectors (logical), tolerance (numeric), max_iter (integer), overwrite (logical), threads (integer). Ignored for eigen.default.

only.values

Logical. Ignored; present for compatibility with base::eigen.

EISPACK

Logical. Ignored; present for compatibility with base::eigen.

Value

For HDF5Matrix: a named list with elements values (numeric vector), vectors (HDF5Matrix or NULL), values_imag, and is_symmetric. For other objects: the result of base::eigen().

See Also

svd.HDF5Matrix, prcomp.HDF5Matrix

Examples


tmp <- tempfile(fileext = ".h5")
m   <- crossprod(matrix(rnorm(400), 20, 20))
X   <- hdf5_create_matrix(tmp, "data/M", data = m)
ev  <- eigen(X, symmetric = TRUE, k = 5L)
ev$values
close(ev$vectors)
close(X)
unlink(tmp)


BigDataStatMeth documentation built on May 15, 2026, 1:07 a.m.