| Title: | Certified Partial Eigenvalue and Singular Value Computation |
|---|---|
| Description: | Computes the top-k singular triplets or eigenpairs of large sparse and structured matrices: the computation behind principal component analysis on big sparse data, spectral embeddings, and low-rank approximation. Every result carries a numerical certificate with residuals, a backward-error bound, orthogonality loss, and a pass/fail flag, and bounds that can only be estimated are reported as such rather than passed. Centered, scaled, and composed operators are solved through native 'C++' kernels without forming dense matrices. Drop-in replacements for the 'RSpectra' interface are included. |
| Authors: | Bradley Buchsbaum [aut, cre, cph] |
| Maintainer: | Bradley Buchsbaum <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-07-23 17:12:35 UTC |
| Source: | https://github.com/cran/eigencore |
Return the adjoint operator.
adjoint(x, ...)adjoint(x, ...)
x |
Operator-like object. |
... |
Additional arguments passed to methods. |
An eigencore_operator representing the adjoint map.
Generalized dense-pencil and generalized Schur results store eigenvalues in
homogeneous form as alpha / beta; generalized SVD results use the same
alpha/beta convention for generalized singular values. alpha_beta()
exposes those coordinates along with the finite/infinite/undefined
classification computed by eigencore.
alpha_beta(x, ...)alpha_beta(x, ...)
x |
An eigencore result with homogeneous |
... |
Reserved for future methods. |
A list containing alpha, beta, and any available values,
classification, finite, infinite, and undefined fields. Results
that record how the finite/infinite/undefined labels were decided also
include a classification_policy list with the policy name, the
tolerance, the per-coordinate zero thresholds, and the pencil norms used
for norm-scaled classification.
A <- diag(c(2, 3, 0)) B <- diag(c(1, 0, 0)) fit <- eig_full(A, B = B, structure = general()) alpha_beta(fit)$classificationA <- diag(c(2, 3, 0)) B <- diag(c(1, 0, 0)) fit <- eig_full(A, B = B, structure = general()) alpha_beta(fit)$classification
Convert an object to an eigencore operator.
as_operator(x, ...)as_operator(x, ...)
x |
Object to convert. |
... |
Additional arguments passed to methods. |
An eigencore_operator representation of x.
op <- as_operator(diag(c(3, 2, 1))) op$dim op$structure$kindop <- as_operator(diag(c(3, 2, 1))) op$dim op$structure$kind
Automatic solver choice.
auto()auto()
An eigencore_method descriptor that lets the planner choose a
solver based on problem structure.
Extract backward-error diagnostics.
backward_error(x, ...)backward_error(x, ...)
x |
An eigencore result object. |
... |
Reserved for future methods. |
A numeric vector of per-pair or per-triplet backward-error estimates.
Target both algebraic ends.
both_ends(k_low, k_high)both_ends(k_low, k_high)
k_low |
Number of values to select from the smallest algebraic end. |
k_high |
Number of values to select from the largest algebraic end. |
An eigencore_target descriptor selecting both algebraic ends
(ARPACK BE).
Center an operator by rows or columns.
center( A, rows = FALSE, columns = TRUE, row_means = NULL, col_means = NULL, name = NULL )center( A, rows = FALSE, columns = TRUE, row_means = NULL, col_means = NULL, name = NULL )
A |
Operator-like object. |
rows |
Whether to subtract row means. |
columns |
Whether to subtract column means. |
row_means |
Optional row means. Required for matrix-free row centering when they cannot be derived without densifying. |
col_means |
Optional column means. Required for matrix-free column centering when they cannot be derived without densifying. |
name |
Optional label for the centered operator. |
An eigencore_operator representing the centered linear map.
Extract a result certificate.
certificate(x, ...)certificate(x, ...)
x |
An eigencore result object. |
... |
Reserved for future methods. |
The eigencore_certificate object stored on x, or NULL if the
result does not carry a certificate field.
fit <- eig_partial(diag(c(3, 2, 1)), k = 1, target = largest()) cert <- certificate(fit) cert$passed cert$max_residualfit <- eig_partial(diag(c(3, 2, 1)), k = 1, target = largest()) cert <- certificate(fit) cert$passed cert$max_residual
Check an operator adjoint identity.
check_adjoint(A, trials = 20, tol = 1e-12, seed = NULL)check_adjoint(A, trials = 20, tol = 1e-12, seed = NULL)
A |
Operator-like object. |
trials |
Number of random block trials. |
tol |
Relative tolerance for each adjoint identity check. |
seed |
Optional random seed for reproducible trials. |
An eigencore_adjoint_check list with pass/fail status, tolerance,
maximum relative error, per-trial errors, and trial count.
Compose two operators.
compose(A, B, name = NULL)compose(A, B, name = NULL)
A |
Left operator-like object. |
B |
Right operator-like object. |
name |
Optional label for the composed operator. |
An eigencore_operator representing the composition A %*% B.
Create A^* A as an operator.
crossprod_operator(A, name = NULL)crossprod_operator(A, name = NULL)
A |
Operator-like object with an adjoint implementation. |
name |
Optional label for the cross-product operator. |
A Hermitian eigencore_operator representing A^* A.
Extract diagnostics.
diagnostics(x, ...)diagnostics(x, ...)
x |
An eigencore result object. |
... |
Reserved for future methods. |
A named list of diagnostic fields, including residuals, backward errors, orthogonality diagnostics, iteration counts, method/plan metadata, warnings, and any available left-eigenvector diagnostics.
fit <- eig_partial(diag(c(3, 2, 1)), k = 1, target = largest()) d <- diagnostics(fit) d$nconv d$methodfit <- eig_partial(diag(c(3, 2, 1)), k = 1, target = largest()) d <- diagnostics(fit) d$nconv d$method
eig_full() is the dense/full eigencore surface for standard and
generalized eigenproblems. Sparse and operator inputs are not silently
densified.
eig_full( A, B = NULL, structure = NULL, vectors = TRUE, tol = 1e-08, allow_dense_fallback = c("auto", "never", "always"), ... )eig_full( A, B = NULL, structure = NULL, vectors = TRUE, tol = 1e-08, allow_dense_fallback = c("auto", "never", "always"), ... )
A |
Base dense square matrix. |
B |
Optional base dense square matrix for generalized problems. |
structure |
Optional structure descriptor. Use |
vectors |
Whether to return right eigenvectors. |
tol |
Certification tolerance. |
allow_dense_fallback |
Reserved dense fallback policy. Sparse/operator
inputs still fail unless a future issue explicitly opens an opt-in dense
fallback contract for |
... |
Reserved for future options. |
An eigencore_eigen_result. Dense general-pencil results
additionally carry alpha, beta, classification,
classification_policy, left_vectors (left generalized eigenvectors
satisfying w^H A = lambda w^H B), and conditioning. For real pencils
the decomposition runs through the expert LAPACK driver DGGEVX with
balancing, so conditioning contains reciprocal condition numbers
rconde/rcondv and the balanced pencil norms abnrm/bbnrm. Complex
pencils use ZGGEV (R's bundled LAPACK subset has no ZGGEVX), so they
return left vectors but conditioning$available is FALSE.
A <- diag(c(1, 4, 9)) B <- diag(c(1, 2, 3)) fit <- eig_full(A, B = B) values(fit) certificate(fit)$passed # Force the dense general-pencil path when alpha/beta diagnostics matter. pencil <- eig_full(A, B = B, structure = general()) pencil$alpha pencil$beta pencil$classificationA <- diag(c(1, 4, 9)) B <- diag(c(1, 2, 3)) fit <- eig_full(A, B = B) values(fit) certificate(fit)$passed # Force the dense general-pencil path when alpha/beta diagnostics matter. pencil <- eig_full(A, B = B, structure = general()) pencil$alpha pencil$beta pencil$classification
Compute a partial eigendecomposition.
eig_partial( A, k, target = largest(), B = NULL, method = auto(), tol = 1e-08, maxit = NULL, vectors = TRUE, seed = NULL, certify = TRUE, allow_dense_fallback = c("auto", "never", "always") )eig_partial( A, k, target = largest(), B = NULL, method = auto(), tol = 1e-08, maxit = NULL, vectors = TRUE, seed = NULL, certify = TRUE, allow_dense_fallback = c("auto", "never", "always") )
A |
Matrix or eigencore operator. |
k |
Number of eigenpairs to compute. |
target |
Eigencore eigenvalue target descriptor. |
B |
Optional metric matrix or operator for generalized problems. |
method |
Solver method descriptor. |
tol |
Convergence and certification tolerance. |
maxit |
Optional iteration limit. |
vectors |
Whether to compute vectors. |
seed |
Optional random seed for stochastic solver components. |
certify |
Whether to compute certification diagnostics. |
allow_dense_fallback |
Dense fallback policy. |
An eigencore_eigen_result containing computed values, optional
vectors, certificate diagnostics, method/plan metadata, and convergence
diagnostics.
A <- diag(c(5, 4, 3, 2, 1)) A[1, 2] <- A[2, 1] <- 0.1 fit <- eig_partial(A, k = 2, target = largest()) values(fit) certificate(fit)$passed # Generalized SPD problem A x = lambda B x B <- diag(c(2, 1, 1, 1, 1)) gfit <- eig_partial(A, B = B, k = 2, target = smallest()) values(gfit)A <- diag(c(5, 4, 3, 2, 1)) A[1, 2] <- A[2, 1] <- 0.1 fit <- eig_partial(A, k = 2, target = largest()) values(fit) certificate(fit)$passed # Generalized SPD problem A x = lambda B x B <- diag(c(2, 1, 1, 1, 1)) gfit <- eig_partial(A, B = B, k = 2, target = smallest()) values(gfit)
Define an eigenproblem.
eigen_problem( A, metric = NULL, structure = NULL, target = largest(), transform = NULL )eigen_problem( A, metric = NULL, structure = NULL, target = largest(), transform = NULL )
A |
Matrix or operator defining the linear map. |
metric |
Optional metric operator for generalized eigenproblems. |
structure |
Optional structure descriptor; defaults to the operator structure. |
target |
Eigencore target descriptor. |
transform |
Optional transform method such as |
An eigencore_eigen_problem object containing the operator, optional
metric, structure, target, and transform metadata consumed by
plan_solver() and solve().
A <- diag(c(4, 3, 2, 1)) P <- eigen_problem(A, target = largest()) fit <- solve(P, k = 2) values(fit)A <- diag(c(4, 3, 2, 1)) P <- eigen_problem(A, target = largest()) fit <- solve(P, k = 2) values(fit)
RSpectra-compatible eigen shim.
eigs(A, k, which = "LM", opts = list(), ...)eigs(A, k, which = "LM", opts = list(), ...)
A |
Matrix or eigencore operator. |
k |
Number of eigenpairs to compute. |
which |
RSpectra-style target selector. |
opts |
Compatibility options list; currently accepted for API compatibility and not interpreted directly. |
... |
Additional arguments passed to |
A list compatible with RSpectra::eigs(), including values,
vectors, convergence counts, operation counts, certificate diagnostics,
and left/right vector fields when available.
A <- diag(c(5, 4, 3, 2, 1)) A[1, 2] <- 0.5 res <- eigs(A, k = 2, which = "LM") res$valuesA <- diag(c(5, 4, 3, 2, 1)) A[1, 2] <- 0.5 res <- eigs(A, k = 2, which = "LM") res$values
RSpectra-compatible symmetric eigen shim.
eigs_sym(A, k, which = "LA", opts = list(), ...)eigs_sym(A, k, which = "LA", opts = list(), ...)
A |
Matrix or eigencore operator. |
k |
Number of eigenpairs to compute. |
which |
RSpectra-style target selector. |
opts |
Compatibility options list; currently accepted for API compatibility and not interpreted directly. |
... |
Additional arguments passed to |
A list compatible with RSpectra::eigs_sym(), including values,
vectors, convergence counts, operation counts, certificate diagnostics,
and eigencore diagnostics.
A <- diag(c(5, 4, 3, 2, 1)) res <- eigs_sym(A, k = 2, which = "LA") res$valuesA <- diag(c(5, 4, 3, 2, 1)) res <- eigs_sym(A, k = 2, which = "LA") res$values
Euclidean vector space descriptor.
euclidean(dim, dtype = "double")euclidean(dim, dtype = "double")
dim |
Dimension of the space. |
dtype |
Scalar type (currently only |
An eigencore_space descriptor for the Euclidean space
R^dim or C^dim.
General operator structure descriptor.
general()general()
An eigencore_structure descriptor for general operators.
generalized_schur() is eigencore's dense QZ surface for general matrix
pencils A x = lambda B x. It computes the generalized Schur pair S, T
and, when requested, left/right Schur vectors Q, Z such that
A = Q S Z* and B = Q T Z* for complex inputs, with transpose replacing
conjugate-transpose for real inputs. Sparse and operator inputs are not
silently densified.
generalized_schur(A, B, sort = NULL, vectors = TRUE, ...)generalized_schur(A, B, sort = NULL, vectors = TRUE, ...)
A |
Base dense square matrix. |
B |
Base dense square matrix with the same dimension as |
sort |
Optional LAPACK sorting class. Use |
vectors |
Whether to compute Schur vectors |
... |
Reserved for future options. |
A classed generalized Schur result with fields S, T, Q, Z,
alpha, beta, values, classification, sdim, method, plan, and
certificate.
A <- matrix(c(0, -1, 1, 0), 2, 2) B <- diag(2) qz <- generalized_schur(A, B) values(qz) pencil <- generalized_schur(diag(c(2, 3, 0)), diag(c(1, 0, 0)), sort = "infinite") pencil$classificationA <- matrix(c(0, -1, 1, 0), 2, 2) B <- diag(2) qz <- generalized_schur(A, B) values(qz) pencil <- generalized_schur(diag(c(2, 3, 0)), diag(c(1, 0, 0)), sort = "infinite") pencil$classification
generalized_svd() is eigencore's dense GSVD compatibility surface for
matrix pairs with the same number of columns. The current native path uses
LAPACK dggsvd through R's native LAPACK interface, so it requires a linked
LAPACK that still provides that deprecated routine. Sparse/operator inputs
are not silently densified, and complex GSVD remains explicit future scope
until a complex GSVD driver is available through the eigencore native layer.
generalized_svd(A, B, tol = 1e-08, ...)generalized_svd(A, B, tol = 1e-08, ...)
A |
Base dense real matrix with |
B |
Base dense real matrix with |
tol |
Finite non-negative reconstruction and orthogonality certification tolerance. |
... |
Reserved for future options. |
An eigencore_gsvd_result with fields alpha, beta, values,
classification, U, V, Q, D1, D2, R, zero_R, A_factor,
B_factor, k, l, rank, method, plan, and certificate.
A <- matrix(c(1, 2, 3, 3, 2, 1), nrow = 2, byrow = TRUE) B <- matrix(1:9, nrow = 3) fit <- generalized_svd(A, B) alpha_beta(fit)$values certificate(fit)$passedA <- matrix(c(1, 2, 3, 3, 2, 1), nrow = 2, byrow = TRUE) B <- matrix(1:9, nrow = 3) fit <- generalized_svd(A, B) alpha_beta(fit)$values certificate(fit)$passed
Golub-Kahan bidiagonalization method descriptor.
golub_kahan(max_subspace = NULL, reorthogonalize = TRUE)golub_kahan(max_subspace = NULL, reorthogonalize = TRUE)
max_subspace |
Optional maximum Krylov subspace size. |
reorthogonalize |
Whether to apply full two-sided
reorthogonalization. |
An eigencore_method descriptor selecting Golub-Kahan
bidiagonalization.
Hermitian/symmetric operator structure descriptor.
hermitian()hermitian()
An eigencore_structure descriptor marking an operator as
Hermitian / symmetric.
Hermitian Lanczos method descriptor.
lanczos( max_subspace = NULL, max_restarts = NULL, block = 1L, reorthogonalize = TRUE )lanczos( max_subspace = NULL, max_restarts = NULL, block = 1L, reorthogonalize = TRUE )
max_subspace |
Optional maximum active Krylov subspace size |
max_restarts |
Optional non-negative integer giving the maximum
number of thick-restart cycles allowed before stopping with whatever
has converged. Default |
block |
Native block size. |
reorthogonalize |
Whether to apply full reorthogonalization. The native path always reorthogonalizes (DGKS x2) and ignores this flag; it is preserved for the R reference solver's public API. |
An eigencore_method descriptor selecting Lanczos iteration.
Target the largest algebraic values.
largest()largest()
An eigencore_target descriptor selecting the largest algebraic
eigenvalues or singular values.
Target the largest imaginary part.
largest_imaginary()largest_imaginary()
An eigencore_target descriptor selecting values by largest
Im(x) (ARPACK LI).
Target the largest values by magnitude.
largest_magnitude()largest_magnitude()
An eigencore_target descriptor selecting values with the largest
modulus (ARPACK LM).
Target the largest real part.
largest_real()largest_real()
An eigencore_target descriptor selecting values by largest
Re(x) (ARPACK LR).
For SVD results this returns the left singular vectors U. For
nonsymmetric and dense general-pencil eigen results this returns left
eigenvectors when the solver computed them (for example, the dense
general-pencil eig_full() path, which computes left generalized
eigenvectors satisfying w^H A = lambda w^H B).
left_vectors(x, ...)left_vectors(x, ...)
x |
An eigencore SVD or eigen result object. |
... |
Reserved for future methods. |
A matrix of left singular vectors or left eigenvectors, or NULL
when the result does not contain a left-vector field.
Create a block-native linear operator.
linear_operator( dim, apply, apply_adjoint = NULL, dtype = "double", structure = general(), name = NULL, metadata = list() )linear_operator( dim, apply, apply_adjoint = NULL, dtype = "double", structure = general(), name = NULL, metadata = list() )
dim |
Integer vector of length two giving row and column dimensions. |
apply |
Function implementing block multiplication by the operator. |
apply_adjoint |
Optional function implementing block multiplication by the adjoint operator. |
dtype |
Scalar character type label, currently |
structure |
Eigencore structure descriptor such as |
name |
Optional operator label used in plans and diagnostics. |
metadata |
Optional list of implementation metadata. |
An eigencore_operator list containing dimensions, apply callbacks,
scalar type, structure metadata, a display name, and implementation
metadata.
A <- diag(c(3, 2, 1)) op <- linear_operator( dim = dim(A), apply = function(X, alpha = 1, beta = 0, Y = NULL) { Z <- alpha * (A %*% X) if (is.null(Y) || beta == 0) Z else Z + beta * Y }, structure = hermitian(), metadata = list(frobenius_norm = sqrt(sum(A^2))) ) fit <- eig_partial(op, k = 1, target = largest()) values(fit)A <- diag(c(3, 2, 1)) op <- linear_operator( dim = dim(A), apply = function(X, alpha = 1, beta = 0, Y = NULL) { Z <- alpha * (A %*% X) if (is.null(Y) || beta == 0) Z else Z + beta * Y }, structure = hermitian(), metadata = list(frobenius_norm = sqrt(sum(A^2))) ) fit <- eig_partial(op, k = 1, target = largest()) values(fit)
LOBPCG method descriptor.
lobpcg(maxit = 200L, preconditioner = NULL, constraints = NULL)lobpcg(maxit = 200L, preconditioner = NULL, constraints = NULL)
maxit |
Maximum LOBPCG iterations. |
preconditioner |
Optional function taking a residual block and returning a preconditioned block with the same dimensions. |
constraints |
Optional matrix whose columns span a subspace to deflate.
Iterates are kept orthogonal to this subspace in the Euclidean or
generalized |
An eigencore_method descriptor selecting LOBPCG. Built-in
standard Hermitian dense/CSC operators may use a native prototype;
unsupported cases route to the reference prototype.
Target values nearest a shift.
nearest(sigma)nearest(sigma)
sigma |
Numeric shift used to rank values by distance |
An eigencore_target descriptor for nearest-to-sigma selection.
Plan a solver for a problem.
plan_solver(problem, ...)plan_solver(problem, ...)
problem |
Eigencore eigen or SVD problem object. |
... |
Additional planning arguments passed to methods. |
An eigencore_plan list describing the requested problem, chosen
method label, target, planner reasons, fallback label, and control
metadata used by solver dispatch.
A <- diag(c(4, 3, 2, 1)) plan <- plan_solver(eigen_problem(A), k = 2) plan$method plan$reasonsA <- diag(c(4, 3, 2, 1)) plan <- plan_solver(eigen_problem(A), k = 2) plan$method plan$reasons
Randomized SVD method descriptor.
randomized( oversample = 10, n_iter = 2, block = NULL, normalizer = c("qr", "lu", "none"), refine = TRUE )randomized( oversample = 10, n_iter = 2, block = NULL, normalizer = c("qr", "lu", "none"), refine = TRUE )
oversample |
Number of extra samples beyond the requested rank. |
n_iter |
Number of subspace-iteration refinement passes. |
block |
Optional block size. |
normalizer |
Basis normalizer to use ( |
refine |
Whether to refine with a certified Lanczos pass. |
An eigencore_method descriptor selecting randomized SVD.
Methods for the stats::residuals() generic: return the per-pair (or
per-triplet) residual norms stored in an eigencore result or certificate.
## S3 method for class 'eigencore_eigen_result' residuals(object, ...) ## S3 method for class 'eigencore_svd_result' residuals(object, ...) ## S3 method for class 'eigencore_certificate' residuals(object, ...)## S3 method for class 'eigencore_eigen_result' residuals(object, ...) ## S3 method for class 'eigencore_svd_result' residuals(object, ...) ## S3 method for class 'eigencore_certificate' residuals(object, ...)
object |
An eigencore result or certificate object. |
... |
Reserved for future methods. |
Extract right singular vectors.
right_vectors(x, ...)right_vectors(x, ...)
x |
An eigencore SVD or nonsymmetric eigen result object. |
... |
Reserved for future methods. |
A matrix of right singular vectors or right eigenvectors, or NULL
when the result does not contain a right-vector field.
Scale operator columns.
scale_cols(A, weights, name = NULL)scale_cols(A, weights, name = NULL)
A |
Operator-like object. |
weights |
Numeric vector of column weights. |
name |
Optional label for the scaled operator. |
An eigencore_operator representing column-wise right scaling of
A.
Scale operator rows.
scale_rows(A, weights, name = NULL)scale_rows(A, weights, name = NULL)
A |
Operator-like object. |
weights |
Numeric vector of row weights. |
name |
Optional label for the scaled operator. |
An eigencore_operator representing row-wise left scaling of A.
Shift-invert method descriptor.
shift_invert(sigma, solve = NULL, factorization = NULL)shift_invert(sigma, solve = NULL, factorization = NULL)
sigma |
Shift value |
solve |
Optional user-supplied solve operator for |
factorization |
Optional precomputed factorization handle. |
An eigencore_method descriptor selecting shift-invert.
Shifted Cholesky preconditioner.
shifted_cholesky_preconditioner(A, shift = 0)shifted_cholesky_preconditioner(A, shift = 0)
A |
Symmetric positive semidefinite or positive definite matrix. |
shift |
Non-negative diagonal shift added before factorization. |
A typed preconditioner function mapping residual blocks to preconditioned blocks.
Shifted diagonal preconditioner.
shifted_diagonal_preconditioner(A, shift = 0)shifted_diagonal_preconditioner(A, shift = 0)
A |
Diagonal matrix or numeric vector containing the diagonal entries. |
shift |
Non-negative diagonal shift added before inversion. |
A typed native-backed preconditioner function mapping residual blocks to preconditioned blocks.
Shifted tridiagonal preconditioner.
shifted_tridiagonal_preconditioner(A, shift = 0)shifted_tridiagonal_preconditioner(A, shift = 0)
A |
Real symmetric tridiagonal matrix. |
shift |
Non-negative diagonal shift added to the tridiagonal system. |
A typed preconditioner function mapping residual blocks to preconditioned blocks.
Target the smallest algebraic values.
smallest()smallest()
An eigencore_target descriptor selecting the smallest algebraic
eigenvalues or singular values.
Target the smallest imaginary part.
smallest_imaginary()smallest_imaginary()
An eigencore_target descriptor selecting values by smallest
Im(x) (ARPACK SI).
Target the smallest values by magnitude.
smallest_magnitude()smallest_magnitude()
An eigencore_target descriptor selecting values with the smallest
modulus (ARPACK SM).
Target the smallest real part.
smallest_real()smallest_real()
An eigencore_target descriptor selecting values by smallest
Re(x) (ARPACK SR).
S3 method that runs the planned solver for an eigenproblem built by
eigen_problem(). Most users call eig_partial(), which constructs the
problem and dispatches here; call solve() directly when you want to build
a problem once and reuse or inspect it. Returns a certified partial
eigendecomposition.
## S3 method for class 'eigencore_eigen_problem' solve( a, b, k, method = auto(), tol = 1e-08, maxit = NULL, vectors = TRUE, certify = TRUE, allow_dense_fallback = c("auto", "never", "always"), ... )## S3 method for class 'eigencore_eigen_problem' solve( a, b, k, method = auto(), tol = 1e-08, maxit = NULL, vectors = TRUE, certify = TRUE, allow_dense_fallback = c("auto", "never", "always"), ... )
a |
Eigencore eigen problem object. |
b |
Unused second argument reserved by the base |
k |
Number of eigenpairs to compute. |
method |
Solver method descriptor. |
tol |
Convergence and certification tolerance. |
maxit |
Optional iteration limit. |
vectors |
Whether to compute vectors. |
certify |
Whether to compute certification diagnostics. |
allow_dense_fallback |
Dense fallback policy. |
... |
Reserved for future solver options. |
An eigencore_eigen_result.
S3 method that runs the planned solver for an SVD problem built by
svd_problem(). Most users call svd_partial(), which constructs the
problem and dispatches here; call solve() directly when you want to build
a problem once and reuse or inspect it. Returns a certified partial
singular-value decomposition.
## S3 method for class 'eigencore_svd_problem' solve( a, b, rank, method = auto(), tol = 1e-08, vectors = c("both", "left", "right", "none"), certify = TRUE, allow_dense_fallback = c("auto", "never", "always"), ... )## S3 method for class 'eigencore_svd_problem' solve( a, b, rank, method = auto(), tol = 1e-08, vectors = c("both", "left", "right", "none"), certify = TRUE, allow_dense_fallback = c("auto", "never", "always"), ... )
a |
Eigencore SVD problem object. |
b |
Unused second argument reserved by the base |
rank |
Number of singular values to compute. |
method |
Solver method descriptor. |
tol |
Convergence and certification tolerance. |
vectors |
Which singular-vector sides to compute. |
certify |
Whether to compute certification diagnostics. |
allow_dense_fallback |
Dense fallback policy. |
... |
Reserved for future solver options. |
An eigencore_svd_result.
Compute a partial singular-value decomposition.
svd_partial( A, rank, target = largest(), method = auto(), tol = 1e-08, vectors = c("both", "left", "right", "none"), seed = NULL, certify = TRUE, allow_dense_fallback = c("auto", "never", "always") )svd_partial( A, rank, target = largest(), method = auto(), tol = 1e-08, vectors = c("both", "left", "right", "none"), seed = NULL, certify = TRUE, allow_dense_fallback = c("auto", "never", "always") )
A |
Matrix or eigencore operator. |
rank |
Number of singular values to compute. |
target |
Eigencore singular-value target descriptor. |
method |
Solver method descriptor. |
tol |
Convergence and certification tolerance. |
vectors |
Which singular-vector sides to compute. |
seed |
Optional random seed for stochastic solver components. |
certify |
Whether to compute certification diagnostics. |
allow_dense_fallback |
Dense fallback policy. |
An eigencore_svd_result containing singular values, optional left
and right singular vectors, certificate diagnostics, method/plan metadata,
and convergence diagnostics.
set.seed(1) X <- matrix(rnorm(60), 10, 6) fit <- svd_partial(X, rank = 3) values(fit) certificate(fit)$passedset.seed(1) X <- matrix(rnorm(60), 10, 6) fit <- svd_partial(X, rank = 3) values(fit) certificate(fit)$passed
Define an SVD problem.
svd_problem(A, domain = NULL, codomain = NULL, target = largest())svd_problem(A, domain = NULL, codomain = NULL, target = largest())
A |
Matrix or operator defining the rectangular linear map. |
domain |
Optional domain-space descriptor. |
codomain |
Optional codomain-space descriptor. |
target |
Eigencore singular-value target descriptor. |
An eigencore_svd_problem object containing the operator, domain and
codomain descriptors, and singular-value target consumed by plan_solver()
and solve().
set.seed(1) X <- matrix(rnorm(40), 8, 5) S <- svd_problem(X, target = largest()) fit <- solve(S, rank = 2) values(fit)set.seed(1) X <- matrix(rnorm(40), 8, 5) S <- svd_problem(X, target = largest()) fit <- solve(S, rank = 2) values(fit)
RSpectra-compatible SVD shim.
svds(A, k, nu = k, nv = k, opts = list(), ...)svds(A, k, nu = k, nv = k, opts = list(), ...)
A |
Matrix or eigencore operator. |
k |
Number of singular values to compute. |
nu |
Number of left singular vectors requested. |
nv |
Number of right singular vectors requested. |
opts |
Compatibility options list; currently accepted for API compatibility and not interpreted directly. |
... |
Additional arguments passed to |
A list compatible with RSpectra::svds(), including d, optional
u and v, convergence counts, operation counts, certificate
diagnostics, and eigencore diagnostics.
set.seed(1) X <- matrix(rnorm(60), 10, 6) res <- svds(X, k = 2) res$dset.seed(1) X <- matrix(rnorm(60), 10, 6) res <- svds(X, k = 2) res$d
Mark an operator as symmetric/Hermitian.
symmetric_operator(A, validate = TRUE, tol = 1e-10)symmetric_operator(A, validate = TRUE, tol = 1e-10)
A |
Operator-like object. |
validate |
Whether to check the adjoint identity before marking the operator symmetric. |
tol |
Relative tolerance for the adjoint check. |
An eigencore_operator with Hermitian structure metadata.
Extract computed values.
values(x, ...)values(x, ...)
x |
An eigencore result object. |
... |
Reserved for future methods. |
A numeric or complex vector of computed eigenvalues, singular values, or generalized singular values.
fit <- eig_partial(diag(c(3, 2, 1)), k = 2, target = largest()) values(fit)fit <- eig_partial(diag(c(3, 2, 1)), k = 2, target = largest()) values(fit)
Extract eigenvectors.
vectors(x, ...)vectors(x, ...)
x |
An eigencore eigen result object. |
... |
Reserved for future methods. |
A matrix whose columns are computed right eigenvectors, or NULL
when vectors were not requested or are unavailable.
fit <- eig_partial(diag(c(3, 2, 1)), k = 2, target = largest()) dim(vectors(fit))fit <- eig_partial(diag(c(3, 2, 1)), k = 2, target = largest()) dim(vectors(fit))