linalg
Linear algebra utilities (numpy / cupy compatible).
Functions#
truncated_qr #
truncated_qr(
matrix: NDArray, cutoff: float, xp: ModuleType = np
) -> NDArray
QR with SVD-based rank truncation, returning only the isometry.
Decomposes matrix = Q @ R, then truncates via SVD on R,
discarding singular values below cutoff * sigma_max.
When cutoff <= 0 this falls back to a plain QR (no truncation).
| PARAMETER | DESCRIPTION |
|---|---|
matrix
|
Input matrix of shape (m, n).
TYPE:
|
cutoff
|
Relative singular-value threshold. Singular values
satisfying
TYPE:
|
xp
|
Array module (
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
NDArray
|
The truncated isometry Q of shape |
Source code in src/src_method/utils/linalg.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |