Ask Your Question
1

memory increasing when generating lots of hyperelliptic curves (without storing them)

asked 2011-11-04 10:59:41 +0200

Daniel Krenn gravatar image

Executing the code given below (it generates hyperelliptic curves), the used memory increases all the time. Since nothing is stored permanently, this should not happen. How do I avoid it? (It is not really a problem with the example given, but using more loops, it becomes a problem.)

Here an example code:

F = GF(4, 'a')
R.<t> = PolynomialRing(F)

for x in F:
    for y in F:
        for z in F:
            h = x*t^2 + y*t + z

            for a in F:
                for b in F:
                    for c in F:
                        for d in F:
                            for e in F:
                                f = t^5 + a*t^4 + b*t^3 + c*t^2 + d*t + e

                                C = HyperellipticCurve(f,h)
edit retag flag offensive close merge delete

Comments

I can reproduce on test.sagenb.org, but not locally on 4.7.1 or 4.7.2.alpha3 on OS X 10.6.8, the only two versions I have easy access to at the moment.

DSM gravatar imageDSM ( 2011-11-04 14:37:59 +0200 )edit

The problem appears on my system with 4.7.1, but now with the upgrade to 4.7.2 it seems that the problem is gone. I will run some more tests...

Daniel Krenn gravatar imageDaniel Krenn ( 2011-11-08 06:38:19 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2011-11-04 14:21:42 +0200

Jason Grout gravatar image

updated 2011-11-04 14:24:08 +0200

This isn't an answer, I know, but you could make your code a lot simpler:

F = GF(4, 'a')
R.<t> = PolynomialRing(F)
from itertools import product
for x,y,z in product(F,repeat=3):
    h = x*t^2 + y*t + z
    for a,b,c,d,e in product(F,repeat=5):
        f = t^5 + a*t^4 + b*t^3 + c*t^2 + d*t + e
        C = HyperellipticCurve(f,h)

See the documentation for product.

edit flag offensive delete link more

Comments

Thank you for that, I didn't know. (In my original code, the generation of f and h works different than in the minimal example posted, so I won't need it there, but it's good to know)

Daniel Krenn gravatar imageDaniel Krenn ( 2011-11-04 14:27:33 +0200 )edit

Hmmph. +1 for beating me to the flatter recommendation (I used CartesianProduct). :-)

DSM gravatar imageDSM ( 2011-11-04 14:37:32 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-11-04 10:59:41 +0200

Seen: 425 times

Last updated: Nov 04 '11