Skip to content

Dense and operator RS/RF/QB/RSVD duplicate numerical logic #182

Open

Description

@rileyjmurray

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.

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 LinearOperator concept; the dense entry points wrap the buffer in DenseLinOp and gain the lda parameter 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, mn extra memory), while implicit deflation applies A - QB through the operator (about 2(m+n)rb extra flops per operator application, with r the accepted rank and b the block size). Explicit is cheaper once r > 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_linops are 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions