Remy Cano on Sun, 08 Jun 2014 05:55:12 +0200


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

Bug in t_list under gp2c?


Greetings!.

First than all my sincere congratulations for such nice and formidable work you keep with PARI-GP.

Let me as something from my limited experience as scripter.

The first time I used gp2c for speeding up my scripts I forgot to call init.....()
after the installation procedure. It crashed talking about a bug and requesting to report.

Well, all fine. I found out and realized my own fault there.

This time this it is not the case. I install the dot "so" and call init.....(), 

But gp still being crashed if I try to use the routine A080575byRows()

(Here in the attachment).

It is based on t_list and I know the no few problems and headaches that code written in C/C++ uses to imply.

I would like to have a better idea about what is happening there.

(Built-in Garbage collection failing... segmentation faults faked or not properly triggered... what, and if possible why?)

I love PARI-GP, and care and distress about this.

Also at purpose, without a gp2c translation the code works perfectly.

It is sure, I need more than moral support. A gun with a bullet in the chamber is not an alternative hehehe.

SOS!. 

Cheers, 

Remy (https://oeis.org/wiki/User:R._J._Cano)

P.S.: The gp2cTroublemaker code is in the attached file.
/* R. J. Cano, Jun 6 2014 */

A080575byRows(m,seq=1)={
  my(n=0,l0,l1,l2,l3);
  l0=listcreate();
  listput(l0,[1,vector(1)]);
  l3=listcreate();
  while(n++<=m,
    l1=listcreate();
    l2=listcreate();
    for(k=1,#l0,listput(l1,[1,vector(n)]);listput(l2,[1,vector(n)]);l1[k][1]=l0[k][1];l2[k][1]=l0[k][1];for(j=1,n-1,l1[k][2][j+1]=l0[k][2][j];l2[k][2][j+1]=l0[k][2][j]));
    l0=listcreate();
    for(k=1,#l1,forstep(j=#l1[k][2],1,-1,if(l1[k][2][j],listput(l0,l1[k]);l0[#l0][1]*=l0[#l0][2][j];l0[#l0][2][j]--;if(j>1,l0[#l0][2][(j-1)]++)));l2[k][2][n]++;listput(l0,l2[k]));
    for(u=1,#l0-1,forstep(w=#l0,u+1,-1,if(l0[u][2]==l0[w][2],l0[u][1]+=l0[w][1];l0[w]*=0)));
    l1=l0;
    l0=listcreate();
    for(k=1,#l1,if(l1[k][1],listput(l0,l1[k])));
    if(seq,for(k=1,#l0,listput(l3,l0[k][1])));
  );
  if(seq,l3,l0);
}

/* Note(s):
 * 
 * If seq then #A080575byRows() will be: sum(k=1,m,numbpart(k)); Else it will be simply: numbpart(m);
 * 
 */