Skip to content

Accept vector right-hand sides in low-rank inverse quadratic forms - #147

Open
antonsoo wants to merge 1 commit into
cornellius-gp:mainfrom
antonsoo:fix/lowrank-vector-quadratic
Open

antonsoo wants to merge 1 commit into
cornellius-gp:mainfrom
antonsoo:fix/lowrank-vector-quadratic

Conversation

@antonsoo

Copy link
Copy Markdown

For an unbatched low-rank-plus-diagonal operator, inv_quad_logdet(y) validates an N-vector but then raises linalg.solve_triangular: The input tensor B must have at least 2 dimensions. The equivalent y[:, None] succeeds.

Normalize the accepted vector to one RHS column after validating its length. This preserves the existing output shapes for both reduce_inv_quad settings and leaves matrix/batched inputs unchanged.

Regression tests compare inverse quadratic forms, optional log determinants and root/diagonal/RHS gradients with an independent dense solve for both reduction settings. They also check exact vector/column equivalence and the existing invalid-length error.

Validation:

  • Full suite: 5,049 tests pass on both PyTorch 2.0 CPU (Python 3.10) and PyTorch 2.14 CPU (Python 3.12).
  • Recorded Diabetes-feature covariance workloads: all 64 vector cases fail before and complete afterward across CPU/CUDA, float32/64, sizes 32-128 and ranks 4/8. Values and gradients agree with dense PyTorch calculations; worst float32 relative error is 3.7e-6, float64 below 4.7e-15. Matrix-input controls are byte-identical across sources.
  • Eight 15-step likelihood-training runs now complete and track independent dense Adam runs (worst float32 absolute trajectory difference 3.1e-4, final-parameter relative difference 4.8e-6). This does not assert bitwise optimizer-state parity or predictive improvement.
  • Configured pre-commit hooks, full flake8 and warnings-as-errors Sphinx build pass.

This concerns LowRankRootAddedDiagLinearOperator; the diagonal-operator change in #140 does not resolve it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant