-
-
Notifications
You must be signed in to change notification settings - Fork 660
Closed
Milestone
Description
Currently, solving binary quadratic forms uses a straightforward exponential-time search: https://github.com/sagemath/sage-prod/blob/9.4/src/sage/quadratic_forms/binary_qf.py#L1469
This patch calls PARI's qfbsolve()
instead, which is exponentially faster in many cases.
Sage 9.4:
sage: %timeit BinaryQF([randrange(1,10^4), 0, randrange(1,10^4)]).solve_integer(randrange(10^7))
1.86 ms ± 552 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
Using qfbsolve()
:
sage: %timeit BinaryQF([randrange(1,10^4), 0, randrange(1,10^4)]).solve_integer(randrange(10^7))
38.4 µs ± 673 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
CC: @collares
Component: quadratic forms
Author: Lorenz Panny
Branch: a1f7cb5
Reviewer: Samuel Lelièvre
Issue created by migration from https://trac.sagemath.org/ticket/32782