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.Thu, 13 Jan 2022 19:01:24 +0100Matrix constructor runs out of memoryhttps://ask.sagemath.org/question/60673/matrix-constructor-runs-out-of-memory/I am trying to construct a matrix with entries in $\mathbb{Q}(q)$, from a list of Sage vectors. I do this using
`A = matrix(QQ['q'].fraction_field(), relations)
`
where the vectors in the list `relations` are Sage vectors over `QQ['q'].fraction_field()`.
The list `relations` is generated by a subroutine involving some randomness, and in many cases the above works fine but sometimes my script uses too much memory and is killed by the operating system. Tracing the memory allocation it is clear that the problem occurs at the given line where I construct the matrix from the list of vectors.
The sorts of matrices for which the script fails are tend to have about 100 columns and 50-100 rows. They are sparse (each row has <= 4 nonzero entries) and the nonzero entries are of the form `-2/q^x + 2` where `x` is in the range `10000 - 100000`.
It seems clear that when some combination of the order of magnitude of the exponents `x` and the matrix size is reached, then the matrix constructor uses too much memory. I wondered if there is a solution anyone can suggest, or even just explain a bit more about why this constructor seems to max out on memory?
(P.S. I plan to re-implement things using sparse matrices, and maybe this will help, though I'd still like to understand better why the dense version fails.)PatrickKinnearThu, 13 Jan 2022 19:01:24 +0100https://ask.sagemath.org/question/60673/Goppa Codes: Cannot create decoder with large parametershttps://ask.sagemath.org/question/56410/goppa-codes-cannot-create-decoder-with-large-parameters/ Hello,
I've been playing around with linear error-correcting codes with the intention of programming a demonstration of McEliece's Cryptosystem, which utilises Goppa codes.
I've been following the format outlined in the SAGE tutorial. I can't post the link for some reason, but it can be found by searching "sagemath Goppa codes". I have no issue running the following code to create a Goppa code over field GF(2^4) and its corresponding decoder.
F = GF(2^4)
R.<x> = F[]
g = x^2+x+1
L = [a for a in F.list if g(a) != 0]
C = codes.GoppaCode(g,L)
D = C.decoder()
However, the cryposystem I'm trying to program requires parameters higher than this, specifically over the field of GF(2^10). The code that I've used to create this Goppa code and its decoder are therefore as follows.
F = GF(2^10)
R.<x> = F[]
g = x^50+x^3+1
L = [a for a in F.list if g(a) != 0]
C = codes.GoppaCode(g,L)
D = C.decoder()
This creates a [1024, 524] Goppa code over GF(2) and there's no issue in generating the code C, or even using it to encode a message vector (of length 524).
Unfortunately, I seem to encounter a memory issue when I run the final line to create the decoder D. My initial response was to try it on a machine with larger memory (64GB), but I had no luck there. I assume it's because the code that I'm trying to create is pretty huge, but it would be really helpful if there's somehow a way around the problem to allow me implement this Goppa code and generate its decoder.
Any help would be greatly appreciated and I'm happy to provide more details if needed.
Thank you very much!!StudentSat, 27 Mar 2021 14:54:58 +0100https://ask.sagemath.org/question/56410/little code which produces memory overflowhttps://ask.sagemath.org/question/52065/little-code-which-produces-memory-overflow/ HI
UBUNTU 18.04 Sagemath 9.1 notebook.
just for information:
this little code saturates my computer memory if executed 3 or 4 times. if I run it 2 times the memory goes up 2 times and if I reset the kernel the occupied memory goes back down. if I saturate the PC memory by executing this code 3 or 4 times then my PC becomes unusable and I have to turn off my PC and turn it back on.
import sys
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from matplotlib.pyplot import figure
figS=100
figure(num=None, figsize=(figS, 2*figS), dpi=150, facecolor='w', edgecolor='k')
#
![image description](/upfiles/15924682665808095.png)ortolljThu, 18 Jun 2020 10:18:58 +0200https://ask.sagemath.org/question/52065/How to increase ECL/maxima memory limits in SageMath?https://ask.sagemath.org/question/47203/how-to-increase-eclmaxima-memory-limits-in-sagemath/ I am looking for a symbolic solution of a linear system 10x10. The coefficients and the right-hand sides are symbolic expressions, and it is critical for my. After one hour run with ~5 GB memory consumption I get an error message:
"TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the memory limits before executing the program again."
My Windows-10 PC has 64 GB, so it is definitely not the physical memory limitation. According to my Google search results, there are deliberately tight default memory limits in the Embeddable Common Lisp (ECL), which is used in Maxima. This page
"https://trac.sagemath.org/ticket/6772"
suggests to increase the ECL heap size to 1 GB by adding a line
"(ext:set-limit 'ext:heap-size (* 1024 1024 1024))"
to the file "maxima/src/ecl-port.lisp". I have found this file under "C:\Program Files\SageMath 8.7\runtime\opt\sagemath-8.7\local\share\maxima\5.41.0\src" and added such line with the 8 GB limit (* 2048 2048 2048). This had absolutely no effect, the same error message appeared after the same run time.
I see two such questions answered in this forum. However both answers suggest to reformulate the original problem, which is not what I need. I will appreciate an explanation of how to increase the ECL memory limits in SageMath. Is there something like ".eclrc" configuration file in SageMath? May be, I have to install Maxima standalone and try it there?SevasThu, 18 Jul 2019 11:15:50 +0200https://ask.sagemath.org/question/47203/