#16953: Faster enumeration of points for toric varieties
-------------------------------------+-------------------------------------
       Reporter:  vbraun             |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.4
      Component:  algebraic          |   Resolution:
  geometry                           |    Merged in:
       Keywords:                     |    Reviewers:
        Authors:  Volker Braun       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  49a72410a19784c05c9fe320e28382df7e5b7338
  u/vbraun/faster_enumeration        |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * status:  needs_review => needs_work


Comment:

 Hello,

 Some quick comments (I will not be able to check most of the mathematical
 contents of the code).

 Some cached method are really not needed. The multiplicative generator of
 finite field is already cached. So you could remove the
 `FiniteFieldPointEnumerator.multiplicative_generator`. And the
 multiplicative order of the multiplicative generator is `q-1` (where `q`
 is the cardinality of the field), isn't it?

 Instead of using `CartesianProduct`, use `itertools.product` (actually
 this is indirectely used). `CartesianProduct` is about to disappear.

 If you want to copy a list, the fastest is by far `zero[:]` and not
 `copy(zero)`.
 {{{
 sage: timeit("copy(zero)")
 625 loops, best of 3: 2.59 µs per loop
 sage: timeit("zero[:]")
 625 loops, best of 3: 248 ns per loop
 }}}

 The fastest way for zero test is `X.is_zero()` and not `X == 0`. The
 latter might involves coercion.
 {{{
 sage: K = GF(53**3, 'a')
 sage: b = K('a')+3*K('a')**2+12
 sage: timeit("b == 0")
 625 loops, best of 3: 2.17 µs per loop
 sage: timeit("b.is_zero()")
 625 loops, best of 3: 317 ns per loop
 }}}

 Vincent

 PS: the hook for modifying the category code was very funny! Hopefully I
 erase the `Sets.ParentMethods.cardinality` before this ticket gets in ;-)

--
Ticket URL: <http://trac.sagemath.org/ticket/16953#comment:12>
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