Bill Allombert on Tue, 28 Feb 2023 21:08:48 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: unable to load a large vector from a file


On Tue, Feb 28, 2023 at 02:30:16PM -0500, Max Alekseyev wrote:
> I have a vector v of size 10^9 with moderately-sized integers, which I
> saved to a file with
> write("myvector.txt",v);
> However, I'm unable to read it back. PARI/GP either runs out of memory
> (even with 96GB memory allocation!) or just killed by the system.

You should use the new fileopen interface to write it and then use readvec
to read the file.

f=fileopen("myvector.txt","w");
for(i=1,#v,filewrite(f,v[i]));
fileclose(f);

and then
readvec("myvector.txt");

Cheers,
Bill