Repository navigation
Description
The following was prepared by GPT-6 Astra, without direct review by Riley
PR #180 added operator implementations alongside the existing dense RS, RF, QB, and RSVD routines. Changes to their shared numerical logic need both implementations updated and both entry points covered by tests. API stability is not currently a constraint, so the cleanup can change the strategy interfaces.
- RS's duplication comment and operator implementation explicitly require algorithmic and numerical changes to be mirrored in the dense implementation.
- RF's duplication comment and operator implementation explain that preserving the dense virtual interface caused the duplication.
- QB's duplication comment lists shared iteration, orthogonality, stopping, and return-code logic.
Failure handling already differs. Dense QB discards the reorthogonalizer's return value, whereas operator QB propagates failure. Likewise, dense RSVD discards QB's status, while operator RSVD checks it before attempting the SVD. The dense behavior predates #180; these examples show how fixes in one implementation can leave the other unchanged.
Start by sharing the RS and RF kernels, then share QB/RSVD orchestration where their contracts agree. Dense QB's explicit residual updates and operator QB's implicit deflation have different storage and arithmetic costs; retain that distinction while factoring the common work. Classes can remain useful for configuration and diagnostics.
Validation should exercise both entry points with reconstruction and orthogonality checks, odd/even pass counts, partial blocks, and deterministic component failures. Shared failure behavior should be explicit, and numerical comparisons should allow for the different rounding paths of explicit and implicit deflation.
Plan (2026-10-29)
- RS, RF and RSVD get one implementation over the
LinearOperatorconcept; the dense entry points wrap the buffer inDenseLinOpand gain theldaparameter they lack today. - QB keeps one loop with a deflation option, because the two paths really are different algorithms: explicit deflation copies A and subtracts each
Q_i B_i(needs dense storage,mnextra memory), while implicit deflation appliesA - QBthrough the operator (about2(m+n)rbextra flops per operator application, with r the accepted rank and b the block size). Explicit is cheaper oncer > mn/((p+2)(m+n)). The default keeps today's behavior: explicit for the dense entry point, implicit for operators. - The dense and operator calls then share one failure-handling path, so the status discards described above disappear.
- No other routine needs this unification: BK, ABRIK, SYPS, SYRF and REVD2 already wrap dense input in an operator, and CQRRT and
CQRRT_linopsare different algorithms. - Tests: dense vs operator agreement, odd and even pass counts, partial last blocks, and every component status.
Blocked on: the conventions PR #268 (with the coverage PR #266 it is stacked on) merged, and randlapack-bindings #3 merged (the bindings' RSVD wrapper changes with this API, and #3 introduces the RandLAPACK pin it needs).
Activity