ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 06 Dec 2017 01:27:38 -0600Overhead of isometry testing of quadratic formshttp://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/ 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?
Tue, 05 Dec 2017 15:22:06 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/Comment by tmonteil for <p>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?</p>
http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39959#post-id-39959It will be hard to answer without more information. Could you tell more about the contents script ?Tue, 05 Dec 2017 16:25:54 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39959#post-id-39959Answer by watson_ladd for <p>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?</p>
http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?answer=39962#post-id-39962So 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.Tue, 05 Dec 2017 20:39:33 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?answer=39962#post-id-39962Comment by slelievre for <p>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.</p>
<p>To do this if $q1$ and $q2$ are the Gram matricies I write:</p>
<pre><code>T = g1.__pari()__.qfisom(g2.__pari__())
</code></pre>
<p>and T is either False or the transformation matrix I want.</p>
http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39965#post-id-39965NB: 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.Wed, 06 Dec 2017 01:27:38 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39965#post-id-39965Comment by slelievre for <p>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.</p>
<p>To do this if $q1$ and $q2$ are the Gram matricies I write:</p>
<pre><code>T = g1.__pari()__.qfisom(g2.__pari__())
</code></pre>
<p>and T is either False or the transformation matrix I want.</p>
http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39964#post-id-39964Additionally, it might entice someone to make Sage faster at this task!Wed, 06 Dec 2017 01:26:52 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39964#post-id-39964Comment by slelievre for <p>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.</p>
<p>To do this if $q1$ and $q2$ are the Gram matricies I write:</p>
<pre><code>T = g1.__pari()__.qfisom(g2.__pari__())
</code></pre>
<p>and T is either False or the transformation matrix I want.</p>
http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39963#post-id-39963Great! I turned your comment into an answer. Could you edit your question
and your answer to provide your code? This would make this more useful
for anyone reading the question and its answer. Thanks in advance!Wed, 06 Dec 2017 01:25:37 -0600http://ask.sagemath.org/question/39957/overhead-of-isometry-testing-of-quadratic-forms/?comment=39963#post-id-39963