#7575: mwrank interface improvements
-------------------------------+--------------------------------------------
 Reporter:  rlm                |         Owner:  cremona      
     Type:  defect             |        Status:  closed       
 Priority:  major              |     Milestone:  sage-4.3.3   
Component:  elliptic curves    |    Resolution:  fixed        
 Keywords:                     |        Author:  Robert Miller
 Upstream:  N/A                |      Reviewer:  John Cremona 
   Merged:  sage-4.3.3.alpha0  |   Work_issues:               
-------------------------------+--------------------------------------------

Comment(by cremona):

 I have made some progress in tracking this down.
     1. When the mwrank shell starts up, it looks to see if there is a file
 in the local directory called PRIMES.  If so, it reads in the contents and
 uses them (without checking their primality) in a trial division stage of
 integer factorization.
     2. The function that does that is called initprimes().  This function
 is wrapped in Sage but as far as I can see is not called when the library
 is used.  This should possibly be changed.
     3. When integers are factored there is an initial trial division
 stage.  Primes which are detected this way (e.g. if trial division goes up
 to their square root) are added to a list which is maintained for the
 session to help in future trial divisions.
     4. On exit, if there are any primes in the maintained list (which
 might be there either because they are read at the start or added when
 found) then that list is output to a file called PRIMES.  In the working
 directory, and created if it does not already exist, or overwritten if it
 does.

 Now, two of the curves in the doctests for ell_rational_field.rank, namely
 [1,0,0,0,37455] and [0,0,1,-79,342], have large primes in their
 discriminants, namely 16180561 and 19047851.  These are added to the
 maintained list of primes when found, and therefore on exit should be
 output to the file PRIMES.

 I do not know why the output file is only being produced when mwrank_lib
 is used.  I would expect it to be the other way round!  The writing to
 file is done by a function called when a global instance of a C++ class
 has its destructor called.  I know that that happens when a normal binary
 finishes executing (since the compiler puts in calls to relevant
 destructors).  But I don't see why those destructors would be called when
 the library is used.  (Until Sage, I had never used my own C++ code as a
 library in this way, so my knowledge of C++ runs out here.)

 One solution would be to *only* output to the file PRIMES if it already
 exists.  That way, users of mwrank can still use the functionality it
 provides (by creating an empty file at the start) but Sage can ignore it.
 This would require a new patch to the eclib code, to be applied after the
 one recently applied (p9).

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