Opened 9 years ago
Closed 9 years ago
#4001 closed defect (fixed)
[with patch, with positive review] ZZ['x'].gen()^(2^20) should work but doesn't
Reported by: | malb | Owned by: | somebody |
---|---|---|---|
Priority: | major | Milestone: | sage-3.1.2 |
Component: | basic arithmetic | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
On [sage-devel] Bill Hart wrote:
I don't seem to be able to create large polynomials in SAGE currently. If I try to create a polynomial f(x)=x^{220} where I am working in a
genuine univariate polynomial ring over ZZ, it just tells me it is out
of memory.
It looks like a message from the memory manager from FLINT, but FLINT really has no problem creating polynomials of this size. So I'm a bit puzzled as to what is going on there.
Magma, by the way, can create polynomials up to length about 2^{28} and can store polynomials (as a result of a computation) up to about length 2^{30}.
I was interested in seeing if SAGE could do better than that. However, not being able to create a polynomial of length 1 million seems really limiting to me. Does someone know why this is?
Attachments (3)
Change History (10)
Changed 9 years ago by
comment:1 Changed 9 years ago by
- Summary changed from [with patch, needs review] ZZ['x'].gen()^(2^20) should work but doesn't to [with patch, negative review] ZZ['x'].gen()^(2^20) should work but doesn't
comment:2 Changed 9 years ago by
Wow, I even doctested the wrong behavior. No clue, how I managed to miss that. Sorry. New patch coming up.
Changed 9 years ago by
comment:3 Changed 9 years ago by
- Summary changed from [with patch, negative review] ZZ['x'].gen()^(2^20) should work but doesn't to [with patch, needs review] ZZ['x'].gen()^(2^20) should work but doesn't
Actually, It was only a copy'n'paste error in the doctest, the actual implementation was fine. I was just too lazy to run the doctest afterwards, that should teach me.
comment:4 follow-up: ↓ 5 Changed 9 years ago by
- Summary changed from [with patch, needs review] ZZ['x'].gen()^(2^20) should work but doesn't to [with patch, with review] ZZ['x'].gen()^(2^20) should work but doesn't
... and to be honest I had not applied the patch, just read it!
Patch applies ok to 3.1.2.alpha2, doctests in sage.rings.polynomial all pass.
By the way, x^(2^25)
works ok too, but x^(2^30)
causes Sage to crash:
------------------------------------------------------------ Unhandled SIGSEGV: A segmentation fault occured in SAGE. This probably occured because a *compiled* component of SAGE has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run SAGE under gdb with 'sage -gdb' to debug this. SAGE will now terminate (sorry). ------------------------------------------------------------
Does that mean that your new special code should have _sig_on, _sig_off?
Changed 9 years ago by
comment:5 in reply to: ↑ 4 Changed 9 years ago by
Replying to cremona:
Does that mean that your new special code should have _sig_on, _sig_off?
Yes, I've just updated the patch. I'm not going to write a doctest for this, since it unnecessarily slows down the user's computer by filling up his/her RAM ... on a related note: Incredible in how many ways I can screw up such a short patch.
comment:6 Changed 9 years ago by
- Summary changed from [with patch, with review] ZZ['x'].gen()^(2^20) should work but doesn't to [with patch, with positive review] ZZ['x'].gen()^(2^20) should work but doesn't
Looks good to me. Note for mabshoff: apply *only* the last of the three patches.
comment:7 Changed 9 years ago by
- Resolution set to fixed
- Status changed from new to closed
Merged 4001_flint_gen_power.3.patch in Sage 3.1.2.alpha3
I think you have set the 1st coefficient to exp instead of the other way round!