#11900: Serious regression caused by #9138
----------------------------------------------------------------------------------------+
   Reporter:  SimonKing                                                         
        |          Owner:  tbd                  
       Type:  defect                                                            
        |         Status:  needs_work           
   Priority:  critical                                                          
        |      Milestone:  sage-4.8             
  Component:  performance                                                       
        |       Keywords:  categories regression
Work_issues:  Laurent series rings are fields. Add docs. Don't use is_ring and 
friends  |       Upstream:  N/A                  
   Reviewer:  Jeroen Demeyer, Nicolas M. ThiƩry                                 
        |         Author:  Simon King           
     Merged:                                                                    
        |   Dependencies:  #9138 #11911         
----------------------------------------------------------------------------------------+

Comment(by SimonKing):

 Hmm. This will be more difficult than I thought: There are lots of
 `is_field` methods in Sage. Apparently some of them are not cached. It
 would probably not be feasible to have a custom `category()` method in all
 cases.

 What could one do instead?

 I see the following options:

  1. We could remove the custom `__contains__` method and restrict
 ourselves to fixing the case of `PolynomialQuotientRing` in the way I
 indicated. After all, this is the only case of failing doctests.
  1. We could remove the custom `__contains__` method and the category
 stuff for all parents with an `is_field()` method.
  1. We could preserve the custom `__contains__` method of `Fields()`, but
 ensure that the potentially time-consuming additional tests are cached.
 Instead of caching all `is_field()` methods (there are quite many), I
 suggest to use a cache on the function `sage.rings.field.is_Field`.
 Namely, this is what is really called in the custom `__contains__` method.

 I think the first solution is not really a solution. The second is too
 much for this ticket. The third seems fine to me, though. What do you
 think?

 In more detail: We introduce the `_refine_category()` method to
 `CategoryObject`. We impose a cache on `sage.rings.field.is_Field`. In
 `sage.rings.field.is_Field`, we use `_refine_category()` on those rings
 that were found to be a field.

 Since `is_Field` is cached, the `_refine_category()` method will be called
 at most once, and `sage.categories.fields.Fields.__contains__` will also
 be faster because of the cache.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11900#comment:118>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to