low_rank_toolbox.randomized.generalized_nystrom
- low_rank_toolbox.randomized.generalized_nystrom(X, r, oversampling_params=(10, 15), epsilon=None, seed=1234, **extra_data)[source]
Generalized Nyström method
- Reference:
“Fast and stable randomized low-rank matrix approximation” Nakatsukasa, 2019
- Approximation with formula
X ~= X J (K^T X J)^{dagger} K^T X
- Parameters:
X (LinearOperator) – Matrix to approximate (real-valued only, complex matrices not supported)
r (int) – Rank of approximation, must be positive
oversampling_params (tuple, optional) – Oversampling parameters (p1, p2) for the two sketch matrices (default: (10, 15))
epsilon (float, optional) – When given, perform stable GN with epsilon-truncation for SVD (default: None)
seed (int, optional) – Random seed for reproducibility (default: 1234)
**extra_data (dict) – Additional arguments passed to QuasiSVD constructor
- Returns:
Near optimal best rank r approximation of X in QuasiSVD format
- Return type:
Notes
This method returns a QuasiSVD (not SVD) because the middle matrix S is typically inverted, making it non-diagonal. Convert to SVD if needed:
result = generalized_nystrom(X, r).to_svd()