#6391: libGAP!  -- create a Cython library interface to gap
----------------------------------------------------------------------------+
       Reporter:  was                                                       |   
      Owner:  was                                                     
           Type:  enhancement                                               |   
     Status:  needs_review                                            
       Priority:  major                                                     |   
  Milestone:  sage-5.3                                                
      Component:  group theory                                              |   
 Resolution:                                                          
       Keywords:                                                            |   
Work issues:                                                          
Report Upstream:  N/A                                                       |   
  Reviewers:  Dima Pasechnik, Ivan Andrus, Volker Braun, William Stein
        Authors:  Dima Pasechnik, Ivan Andrus, Volker Braun, William Stein  |   
  Merged in:                                                          
   Dependencies:  #13211                                                    |   
   Stopgaps:                                                          
----------------------------------------------------------------------------+

Comment (by vbraun):

 After considerable despair I finally realized that Python called the
 libgap initialization from a higher stack frame than where `c.Order()` was
 executing. One peculiarities of the GAP memory manager is that it trawls
 the stack for pointers into its memory pool and keeps these alive (so you
 can just work with local stack-allocated GAP objects and not worry). While
 its easy to figure out the highest stack frame (its you, the currently
 executing function) we must take care to inform GAP about the lowest stack
 frame that can hold a pointer to a memory bag!

 Now Miguel's example runs perfectly! For the record, you can use the
 following syntactic sugar to make the code look nicer:
 {{{
     sage: G =libgap.FreeGroup(2)
     sage: a,b = G.GeneratorsOfGroup()
     sage: rel = libgap([a^2, b^2, a*b*a*b])
     sage: H = G / rel
     sage: c = H.GeneratorsOfGroup()[0]
     sage: for i in range(300000):
     ...       n = c.Order()
 }}}

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