Skip to content

Hoist rcond_free out of the p+1-column loop in solve_nnqp_eq (exact inner) #18

Description

@tschm

Subcategory: Code structure & readability — score 9 → 10
Source: rhiza_quality assessment

Problem

On the inner="exact" path, solve_nnqp_eq.sub_solve calls the shared _make_free_solve closure once for the v0 right-hand side and once per Schur-complement column — p + 1 calls, all on the same free set idx. The exact branch of _make_free_solve evaluates op.rcond_free(idx) on every call, so the (potentially O(|F|^3)) conditioning estimate is recomputed p + 1 times per free set even though the free block is identical across them.

Where

  • src/nncg/solver.py_make_free_solve, exact branch (the op.rcond_free(idx) guard)
  • Called p + 1 times per free set from solve_nnqp_eq.sub_solve

Done when

The exact equality path evaluates op.rcond_free(idx) at most once per free set (e.g. hoist the guard into sub_solve before the column loop, or memoize on idx), the solve_nnqp path is unaffected, and make test stays green at 100% coverage.

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