| gmd_spectra | R Documentation |
Computes the generalized SVD of X with row metric Q and column metric R,
equivalent to the eigendecomposition used by genpca with
method = "eigen". The metrics are factored once (Q = F_Q F_Q',
R = F_R F_R'; diagonal, dense or sparse Cholesky, or an eigen factor for
singular metrics) and the top-k singular triplets of the implicit operator
F_Q' X F_R are computed with eigencore; a dense SVD is used when
few components are not requested or the iterative solver does not
converge. gmd_fast_cpp() is an alias kept for existing callers.
gmd_spectra(
X,
Q,
R,
k,
tol = 1e-09,
maxit = 1000L,
seed = 1234L,
topk = TRUE,
cache = TRUE,
auto_topk = TRUE,
topk_ratio = 0.08,
topk_min_dim = 200L,
diag_fast = TRUE,
rank_rtol = 1e-06,
metric_rtol = .metric_rtol_default(),
dense_maxn = 5000L
)
gmd_fast_cpp(
X,
Q,
R,
k,
tol = 1e-09,
maxit = 1000L,
seed = 1234L,
topk = TRUE,
cache = TRUE,
auto_topk = TRUE,
topk_ratio = 0.08,
topk_min_dim = 200L,
diag_fast = TRUE,
rank_rtol = 1e-06,
metric_rtol = .metric_rtol_default(),
dense_maxn = 5000L
)
X |
numeric matrix (n x p) |
Q, R |
constraints (weights/metrics) for rows/cols. Must be symmetric positive (semi-)definite. Can be dense matrices, sparse matrices, or diagonal matrices. |
k |
number of components to extract (must be >= 1 and <= min(n, p)) |
tol |
convergence tolerance of the iterative solver. Default 1e-9. |
maxit |
unused (kept for compatibility). |
seed |
unused (kept for compatibility); results do not depend on the R random stream. |
topk |
logical; use the iterative top-k solver when |
cache |
logical; cache dense Cholesky factors across calls.
Defaults to TRUE. Use |
auto_topk |
logical; when TRUE (default), use top-k only when
|
topk_ratio |
threshold used by |
topk_min_dim |
minimum |
diag_fast |
logical; if TRUE (default) and both constraints are diagonal, use a weighted-SVD fast path. |
rank_rtol |
relative cutoff on singular values: components with
|
metric_rtol |
relative tolerance for metric validation and null-space
detection. Default |
dense_maxn |
a singular general metric on the small side of X needs a
dense eigendecomposition; refuse it above this many rows (the
|
A list with components:
n x k matrix of metric-weighted scores Q ou D
p x k matrix of components R ov
metric-orthonormal factors
length-k vector of singular values
number of components returned (may be < requested if rank-deficient)
k << min(n, p): only the top-k triplets are computed
Repeated calls with the same dense Q or R: Cholesky factors are cached
Sparse metrics: only sparse factors and products are formed
A positive definite metric on the big side of X costs one Cholesky of that dimension; a singular one is never factored (symmetric small-side form).
genpca for the high-level interface,
gmd_clear_cache to clear the Cholesky cache
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.