#16953: Faster enumeration of points for toric varieties
-------------------------------------+-------------------------------------
       Reporter:  vbraun             |        Owner:
           Type:  enhancement        |       Status:  needs_review
       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:                     |
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Replying to [comment:18 vbraun]:
 > Replying to [comment:17 vdelecroix]:
 > > What about all your useless `cached_method`?
 >
 > They give names to quantities. Its true that you can replace the
 multiplicative order with q-1 everywhere, but it is not true that q-1 in a
 formula always refers to the order. Giving names to quantities makes code
 more readable as it explains the "why".

 What annoys me is that you add 20 lines of code + documentation + a non
 documented function for something which can be replaced by
 {{{self.ring.cardinality() - 1}}} and
 {{{self.ring.multiplicative_generator()}}} for which the names are not at
 all mysterious.

 > And I'm using the general pattern of caching frequently-accessed
 methods, an extra `cached_method` has no performance impact but a
 forgotten `cached_method` can be very bad.

 `cached_method` can also have '''negative''' impact on performances (for
 not that frequently-accessed methods). Creating dictionaries is costly,
 object creation is costly, function call is costly.

 > Also, why should you have to read the finite fields implementation just
 to decide whether to cache something in this module?

 Hopefully I did it for you. It is clear that `multiplicative_generator` is
 something critical in many application and it looks natural to cache this
 method at the level of finite fields. And as a finite field is mostly
 defined by its cardinality, you can expect the method `cardinality` to be
 fast.

 Vincent

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