creating (non)zero vector

Max Alekseyev <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <CAJkPp5MseqS9Gby9v+q4DSDscsBxpxGDEZegiX94WezbZok_qA@mail.gmail.com>
Hello,

I thought that creating nonzero vector (say, of all 1s) like

allocatemem(2^31);
V = vector(10^8,i,1);

is more efficient than first creating a zero vector and then filling it
with the required values:

allocatemem(2^31);
V = vector(10^8);
for(i=1,#V,V[i]=1);

In reality, the latter code works fine, but the former one results in "the
PARI stack overflows" error, which is quite counterintuitive.
Is such behavior expected?

Regards,
Max
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.