#11832: bug fixes for profile functions for the Steenrod algebra
--------------------------+-------------------------------------------------
   Reporter:  jhpalmieri  |          Owner:  AlexGhitza   
       Type:  defect      |         Status:  new          
   Priority:  minor       |      Milestone:  sage-4.7.2   
  Component:  algebra     |       Keywords:               
Work_issues:              |       Upstream:  N/A          
   Reviewer:              |         Author:  John Palmieri
     Merged:              |   Dependencies:               
--------------------------+-------------------------------------------------
 Profile functions for the Steenrod algebra, especially at odd primes, are
 a little buggy:
 {{{
 sage: P3 = SteenrodAlgebra(p=3, profile=(lambda n: Infinity, lambda n: 1))
 sage: P3._has_nontrivial_profile()
 False
 }}}
 This should be `True`.
 {{{
 sage: P3._profile
 ((+Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity, +Infinity, +Infinity, +Infinity,
 +Infinity, +Infinity, +Infinity), (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))
 }}}
 All of the "Infinity"s should be omitted.
 {{{
 sage: SteenrodAlgebra(p=3, profile=((3,2,1), lambda n: 1))
 Traceback (most recent call last)
 ...
 TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
 }}}
 This error shouldn't happen.

 These bugs are in the function
 `steenrod_algebra_misc.normalize_profile_function` and in the method
 `_has_nontrivial_profile` in `steenrod_algebra.SteenrodAlgebra_generic`.
 The attached patch fixes these, and it also speeds up
 `steenrod_algebra_misc.is_valid_profile:
 {{{
 sage: sage: from sage.algebras.steenrod.steenrod_algebra_misc import
 is_valid_profile, normalize_profile
 sage: pro = normalize_profile(lambda n: n)
 sage: timeit('is_valid_profile(pro[0], pro[1], p=2)') # before
 5 loops, best of 3: 334 ms per loop

 sage: timeit('is_valid_profile(pro[0], pro[1], p=2)') # after
 125 loops, best of 3: 3.99 ms per loop
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11832>
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