Repository navigation
fix(billing): include rank-dependent work in truncated SVD prices - #318
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Truncated SVD previously billed only
4mnkwhile returning exact economy-SVD factors. Near-full-rank calls could recover the missing triplet in quadratic work, or zero-pad a matrix and request all its original components, for substantially less than the full-SVD price.Use the approved rank-dependent formulas for
1 <= k < b, witha=max(m,n)andb=min(m,n):min(4mnk + 6(m+n)k² + 20k³, 6ab² + 20b³)min(4mnk + 2(m+n)k² + 2k³, 2ab² + 2b³)The shared cost helper drives
svd,svd(compute_uv=False),svdvals, and analytical cost queries. Full calls and their existing thin/full-vector/values-only prices remain unchanged, as do exact numerical outputs, upfront budget checks, dtype/complex/weight factors, and batch multiplication. This does not depend on other open PRs and does not bump or publish a package version.The formulas are analytical pricing conventions, not literal counts of the NumPy backend. They close the reported large-matrix near-full-rank/padding discounts, but do not establish a universal lower bound on small-matrix or composite reconstruction algorithms. Documentation removes that earlier absolute claim.
Validation
Tests exercise the reported complement and zero-padding routes, rectangular/transposed shapes, small-matrix residual behavior, both values-only entry points, production float/complex multipliers, and rejection before backend execution when the new price exceeds budget.
Cost model, public docstrings/examples, registry notes, generated ops.json and the Unreleased billing-impact notes are updated. Per-command hooks were bypassed to avoid resyncing a shared virtualenv; the direct checks above were executed on this branch. GitHub CI will verify the supported-version matrix.