#16964: Speed up comparisons in QQbar
----------------------------------------------+------------------------
       Reporter:  gagern                      |        Owner:
           Type:  defect                      |       Status:  new
       Priority:  critical                    |    Milestone:  sage-6.5
      Component:  number fields               |   Resolution:
       Keywords:  variety qqbar cmp singular  |    Merged in:
        Authors:                              |    Reviewers:
Report Upstream:  N/A                         |  Work issues:
         Branch:                              |       Commit:
   Dependencies:                              |     Stopgaps:
----------------------------------------------+------------------------
Changes (by jdemeyer):

 * milestone:  sage-6.4 => sage-6.5


Old description:

> I just spent 8 hours in an attempt to solve a polynomial system of
> equations using ideal.variety(). After these 8 hours I was left with the
> following error message:
>
> {{{
>   File "sage/rings/polynomial/multi_polynomial_ideal.py", line 604, in
> __call__
>     return self.f(self._instance, *args, **kwds)
>   File "sage/rings/polynomial/multi_polynomial_ideal.py", line 2671, in
> variety
>     V.sort()
>   File "sage/rings/qqbar.py", line 3889, in __cmp__
>     rcmp = cmp(self.real(), other.real())
>   File "sage/rings/qqbar.py", line 4529, in __cmp__
>     return self._sub_(other).sign()
>   File "sage/rings/qqbar.py", line 4864, in sign
>     return self.sign()
>   File "sage/rings/qqbar.py", line 4867, in sign
>     self.exactify()
>   File "sage/rings/qqbar.py", line 3600, in exactify
>     self._set_descr(self._descr.exactify())
>   File "sage/rings/qqbar.py", line 7849, in exactify
>     left.exactify()
>   File "sage/rings/qqbar.py", line 3600, in exactify
>     self._set_descr(self._descr.exactify())
>   File "sage/rings/qqbar.py", line 7594, in exactify
>     rv.exactify()
>   File "sage/rings/qqbar.py", line 3600, in exactify
>     self._set_descr(self._descr.exactify())
>   File "sage/rings/qqbar.py", line 7849, in exactify
>     left.exactify()
>   File "sage/rings/qqbar.py", line 3600, in exactify
>     self._set_descr(self._descr.exactify())
>   File "sage/rings/qqbar.py", line 7851, in exactify
>     gen = left._exact_field().union(right._exact_field())
>   File "sage/rings/qqbar.py", line 2362, in union
>     newpol, self_pol, k = pari_nf.rnfequation(my_factor, 1)
>   File "gen.pyx", line 7454, in sage.libs.pari.gen.gen.rnfequation
> (build/cythonized/sage/libs/pari/gen.c:37964)
>   File "handle_error.pyx", line 90, in
> sage.libs.pari.handle_error._pari_handle_exception
> (build/cythonized/sage/libs/pari/handle_error.c:1181)
> sage.libs.pari.gen.PariError: not enough precomputed primes
> }}}
>
> This is extremely annoying, since apparently the result of the
> computation was available at that point, and it was only sorting the
> result which failed. Neither the unsorted result nor the triangular
> decomposition had been cached, throwing away 8 hours worth of
> computation. So I suggest
>
> 1. wrap that sorting into a try-except block to return the result
> unsorted if there is any problem sorting things.
> 2. perhaps provide a switch to disable sorting up front, since repeated
> exactification might cost time.
> 3. Try to work out why exactly the comparison fails here, and avoid this
> error in the first place.
>
> The system of equations in this exact form was written by someone else,
> so I'll have to either reproduce this with my own (equivalent) system or
> request permission to post that code. In any case, it's rather lengthy.
>
> I'll also try to run the code on a modified sage which simply disables
> the sort in order to get my hands on the bare QQbar descriptions behind
> the failed computation.

New description:

 I just spent 8 hours in an attempt to solve a polynomial system of
 equations using ideal.variety(). After these 8 hours I was left with the
 following error message:

 {{{
   File "sage/rings/polynomial/multi_polynomial_ideal.py", line 604, in
 __call__
     return self.f(self._instance, *args, **kwds)
   File "sage/rings/polynomial/multi_polynomial_ideal.py", line 2671, in
 variety
     V.sort()
   File "sage/rings/qqbar.py", line 3889, in __cmp__
     rcmp = cmp(self.real(), other.real())
   File "sage/rings/qqbar.py", line 4529, in __cmp__
     return self._sub_(other).sign()
   File "sage/rings/qqbar.py", line 4864, in sign
     return self.sign()
   File "sage/rings/qqbar.py", line 4867, in sign
     self.exactify()
   File "sage/rings/qqbar.py", line 3600, in exactify
     self._set_descr(self._descr.exactify())
   File "sage/rings/qqbar.py", line 7849, in exactify
     left.exactify()
   File "sage/rings/qqbar.py", line 3600, in exactify
     self._set_descr(self._descr.exactify())
   File "sage/rings/qqbar.py", line 7594, in exactify
     rv.exactify()
   File "sage/rings/qqbar.py", line 3600, in exactify
     self._set_descr(self._descr.exactify())
   File "sage/rings/qqbar.py", line 7849, in exactify
     left.exactify()
   File "sage/rings/qqbar.py", line 3600, in exactify
     self._set_descr(self._descr.exactify())
   File "sage/rings/qqbar.py", line 7851, in exactify
     gen = left._exact_field().union(right._exact_field())
   File "sage/rings/qqbar.py", line 2362, in union
     newpol, self_pol, k = pari_nf.rnfequation(my_factor, 1)
   File "gen.pyx", line 7454, in sage.libs.pari.gen.gen.rnfequation
 (build/cythonized/sage/libs/pari/gen.c:37964)
   File "handle_error.pyx", line 90, in
 sage.libs.pari.handle_error._pari_handle_exception
 (build/cythonized/sage/libs/pari/handle_error.c:1181)
 sage.libs.pari.gen.PariError: not enough precomputed primes
 }}}

 This is extremely annoying, since apparently the result of the computation
 was available at that point, and it was only sorting the result which
 failed.

--

--
Ticket URL: <http://trac.sagemath.org/ticket/16964#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to