I have a script that generates a bunch of locally isomorphic quadratic forms and then tests them for global isometry. This script is too slow. Looking at profiling data much of the runtime is spent in the Quadratic forms class computing the useless local invariants and very little in the Pari qfisom calls. What can I do to cut down on this overhead?

edit retag close merge delete

Sort by » oldest newest most voted

So I solved the problem by going straight to Pari's qfisom routine that the is_globally_isomorphic routine eventually calls. The script generates the p-neighbors and checks for isometry, so all the forms are positive definite, but determining this is extremely expensive as currently implemented and overshadows the cost of the isomorphism testing.

To do this if $q1$ and $q2$ are the Gram matricies I write:

T = g1.__pari()__.qfisom(g2.__pari__())


and T is either False or the transformation matrix I want.

more

Additionally, it might entice someone to make Sage faster at this task!

NB: To display inline code, use backticks. To display blocks of code or error messages, separate them by a blank line from the rest of the text, and indent them with 4 spaces, or select code lines and click the "code" button (the icon with '101 010').

For instance, typing

To do this, if g_1 and g_2 are the Gram matrices, I write:

T = g1.__pari()__.qfisom(g2.__pari__())

and T is either False or the transformation matrix I want.


will produce:

To do this, if q_1 and q_2 are the Gram matrices, I write:

T = g1.__pari()__.qfisom(g2.__pari__())


and T is either False or the transformation matrix I want.