Opened 10 years ago

Closed 9 years ago

#11832 closed defect (fixed)

bug fixes for profile functions for the Steenrod algebra

Reported by: jhpalmieri Owned by: AlexGhitza
Priority: critical Milestone: sage-5.0
Component: algebra Keywords:
Cc: Merged in: sage-5.0.beta12
Authors: John Palmieri Reviewers: William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps: #12700

Status badges

Description

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

Attachments (1)

trac_11832-steenrod-profile.patch (11.5 KB) - added by jhpalmieri 10 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 10 years ago by jhpalmieri

  • Status changed from new to needs_review

Changed 10 years ago by jhpalmieri

comment:2 Changed 9 years ago by jhpalmieri

  • Stopgaps set to #12700

comment:3 Changed 9 years ago by jhpalmieri

  • Priority changed from minor to critical

comment:4 Changed 9 years ago by was

  • Status changed from needs_review to positive_review

I don't know what a "profile" is, and maybe no other Sage developers do. But the code looks good and works. I think it makes sense to just trust our resident algebraic topologist in this case.

comment:5 Changed 9 years ago by jdemeyer

  • Reviewers set to William Stein

comment:6 Changed 9 years ago by jdemeyer

  • Merged in set to sage-5.0.beta12
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.