#8042: problem with modular symbols in eclib
-----------------------------+----------------------------------------------
Reporter: wuthrich | Owner: craigcitro
Type: defect | Status: new
Priority: major | Milestone: sage-4.3.2
Component: modular forms | Keywords: eclib modular symbols
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-----------------------------+----------------------------------------------
Comment(by craigcitro):
Well, I can tell you what's going wrong here, and ways to work around it
-- but I'll wait until I'm more coherent to post a patch.
Here's what's happening: despite the fact that you're on a 64-bit machine,
C says `sizeof(int)` is still `4`. However, Python knows it's a 64-bit
box, so Python's `int` type is now a full 64 bits. So in the bit of code
you called, and in several places in the NTL interface, we convert from
Python `int`s to C `int`s. That's the underlying problem: we really want
to be using `long` in this case, because it actually has room to store the
values we care about. The NTL `ZZ` constructor is more than happy to take
a long as input, so there's also no problem there.
The easiest fix is just to switch the type of the constructor in
`sage/libs/cremona/defs.pxi` ... here's a diff:
{{{
diff -r 868098cc41e9 sage/libs/cremona/defs.pxi
--- a/sage/libs/cremona/defs.pxi Sat Jan 23 00:06:24 2010 -0800
+++ b/sage/libs/cremona/defs.pxi Sat Jan 23 00:18:48 2010 -0800
@@ -1,7 +1,7 @@
cdef extern from "eclib/interface.h":
ctypedef struct bigint: #eclib uses NTL in Sage -- we call Cremona's
"bigint" ZZ_c.
pass
- ZZ_c new_bigint "to_ZZ"(int)
+ ZZ_c new_bigint "to_ZZ"(long)
int I2int(ZZ_c)
cdef extern from "eclib/bigrat.h":
}}}
That fixes the issue.
However, I suspect that this is something that pops up elsewhere -- so I'd
like to at least look a few other places and fix this issue there, too.
For instance, we have exactly the same issue in the NTL interface ... and
it's easy enough to fix there, too.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8042#comment:1>
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.