First time here? Check out the FAQ!

Ask Your Question
1

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

asked 13 years ago

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)
Preview: (hide)

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 ( 13 years ago )

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 ( 13 years ago )

1 Answer

Sort by » oldest newest most voted
3

answered 13 years ago

Jason Grout gravatar image

updated 13 years ago

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.

Preview: (hide)
link

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 ( 13 years ago )

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

DSM gravatar imageDSM ( 13 years ago )

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: 13 years ago

Seen: 537 times

Last updated: Nov 04 '11