ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 08 Nov 2011 06:38:19 +0100memory increasing when generating lots of hyperelliptic curves (without storing them)https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/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)
Fri, 04 Nov 2011 10:59:41 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/Comment by DSM for <p>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.)</p>
<p>Here an example code:</p>
<pre><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)
</code></pre>
https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20962#post-id-20962I 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.Fri, 04 Nov 2011 14:37:59 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20962#post-id-20962Comment by Daniel Krenn for <p>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.)</p>
<p>Here an example code:</p>
<pre><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)
</code></pre>
https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20949#post-id-20949The 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...Tue, 08 Nov 2011 06:38:19 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20949#post-id-20949Answer by Jason Grout for <p>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.)</p>
<p>Here an example code:</p>
<pre><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)
</code></pre>
https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?answer=12850#post-id-12850This 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](http://docs.python.org/library/itertools.html#itertools.product).
Fri, 04 Nov 2011 14:21:42 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?answer=12850#post-id-12850Comment by Daniel Krenn for <p>This isn't an answer, I know, but you could make your code a lot simpler:</p>
<pre><code>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)
</code></pre>
<p>See the documentation for <a href="http://docs.python.org/library/itertools.html#itertools.product">product</a>.</p>
https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20964#post-id-20964Thank 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)Fri, 04 Nov 2011 14:27:33 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20964#post-id-20964Comment by DSM for <p>This isn't an answer, I know, but you could make your code a lot simpler:</p>
<pre><code>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)
</code></pre>
<p>See the documentation for <a href="http://docs.python.org/library/itertools.html#itertools.product">product</a>.</p>
https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20963#post-id-20963Hmmph. +1 for beating me to the flatter recommendation (I used CartesianProduct). :-)Fri, 04 Nov 2011 14:37:32 +0100https://ask.sagemath.org/question/8437/memory-increasing-when-generating-lots-of-hyperelliptic-curves-without-storing-them/?comment=20963#post-id-20963