Complex operator from its real and imaginary parts.
Source:R/complex_hermitian.R
complex_operator.RdBuilds an eigencore operator for the complex matrix re + 1i * im from
two real matrices of the same dimensions, each dense or sparse (any
Matrix class). This is how complex sparse matrices enter eigencore:
the Matrix package has no complex sparse classes (zgCMatrix and
friends are not implemented), so a complex sparse Hermitian matrix is
passed as a symmetric real part and a skew-symmetric imaginary part.
Arguments
- re
Real part: a numeric matrix or a real
Matrixobject.- im
Imaginary part with the dimensions of
re;NULLmeans zero.- structure
Optional structure descriptor. By default the operator is
hermitian()whenreis symmetric andimskew-symmetric (to a relative tolerance ofsqrt(.Machine$double.eps)), elsegeneral().
Details
A Hermitian operator (re symmetric, im skew-symmetric) is solved by
eig_partial() on the real symmetric 2n x 2n embedding
[re -im; im re], kept sparse: native block Lanczos, CHOLMOD LDL'
shift-invert and inertia counts all run on the real sparse embedding, and
the eigenpairs are mapped back to complex vectors and certified on the
complex operator.
Examples
re <- Matrix::sparseMatrix(i = c(1, 2, 3, 1), j = c(1, 2, 3, 2),
x = c(2, 3, 4, 1), dims = c(3, 3), symmetric = TRUE)
im <- Matrix::sparseMatrix(i = c(1, 2), j = c(2, 1), x = c(0.5, -0.5),
dims = c(3, 3))
op <- complex_operator(re, im)
fit <- eig_partial(op, k = 1, target = largest())
values(fit)
#> [1] 4