Changeset e4514d3 in git


Ignore:
Timestamp:
Jun 17, 2020, 3:40:00 PM (4 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'fc741b6502fd8a97288eaa3eba6e5220f3c3df87')
Children:
ed6f2bb0876535189130e32d71be46f776012a36
Parents:
48e0bcb3839c4f7cc786ac37fa187054f053623902eb92fd41522fc551742fd1c1a368263c5401e9
Message:
Merge branch 'mh/fix' of https://github.com/fingolfin/Sources into fingolfin-mh/fix
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • Singular/idrec.h

    r02eb92 re4514d3  
    4848
    4949  idrec() { memset(this,0,sizeof(*this)); }
     50  inline void Init() { memset(this,0,sizeof(*this)); }
    5051  idhdl get(const char * s, int lev);
    5152  idhdl get_level(const char * s, int lev);
  • Singular/iparith.cc

    r02eb92 re4514d3  
    743743        syMake(v, v->name, pa);
    744744        memcpy(res, v, sizeof(sleftv));
    745         memset(v, 0, sizeof(sleftv));
     745        v->Init();
    746746      }
    747747      break;
     
    14101410  int i;
    14111411  sleftv t;
    1412   memset(&t,0,sizeof(t));
     1412  t.Init();
    14131413  t.rtyp=INT_CMD;
    14141414  for (i=0;i<iv->length(); i++)
     
    15881588static BOOLEAN jjKLAMMER_rest(leftv res, leftv u, leftv v)
    15891589{
    1590   leftv tmp=(leftv)omAllocBin(sleftv_bin);
    1591   memset(tmp,0,sizeof(sleftv));
     1590  leftv tmp=(leftv)omAlloc0Bin(sleftv_bin);
    15921591  BOOLEAN b;
    15931592  if (v->Typ()==INTVEC_CMD)
     
    16651664  u->next=(leftv)omAlloc(sizeof(sleftv));
    16661665  memcpy(u->next,v,sizeof(sleftv));
    1667   memset(v,0,sizeof(sleftv));
     1666  v->Init();
    16681667  BOOLEAN bo=iiExprArithM(res,u,'[');
    16691668  u->next=NULL;
     
    22162215    if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
    22172216    sleftv tmpW;
    2218     memset(&tmpW,0,sizeof(sleftv));
     2217    tmpW.Init();
    22192218    tmpW.rtyp=IDTYP(w);
    22202219    tmpW.data=IDDATA(w);
     
    25132512{
    25142513  sleftv h;
    2515   memset(&h,0,sizeof(sleftv));
     2514  h.Init();
    25162515  h.rtyp=INT_CMD;
    25172516  h.data=(void *)(long)IDELEMS((ideal)v->Data());
     
    44884487     valid bound for the prime factors has been given) */
    44894488  sleftv tmp;
    4490   memset(&tmp, 0, sizeof(tmp));
     4489  tmp.Init();
    44914490  tmp.rtyp = INT_CMD;
    44924491  return jjPFAC2(res, v, &tmp);
     
    45264525  // clean out "_":
    45274526  sLastPrinted.CleanUp();
    4528   memset(&sLastPrinted,0,sizeof(sleftv));
    45294527  // collect all info:
    45304528  omUpdateInfo();
     
    57105708static BOOLEAN jjBRACK_Ma_I_IV(leftv res, leftv u, leftv v,leftv w)
    57115709{
    5712   sleftv t;
    5713   sleftv ut;
     5710  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
     5711  {
     5712    WerrorS("cannot build expression lists from unnamed objects");
     5713    return TRUE;
     5714  }
     5715
    57145716  leftv p=NULL;
    57155717  intvec *iv=(intvec *)w->Data();
    57165718  int l;
    57175719  BOOLEAN nok;
    5718 
    5719   if ((u->rtyp!=IDHDL)||(u->e!=NULL))
    5720   {
    5721     WerrorS("cannot build expression lists from unnamed objects");
    5722     return TRUE;
    5723   }
     5720  sleftv ut;
    57245721  memcpy(&ut,u,sizeof(ut));
    5725   memset(&t,0,sizeof(t));
     5722  sleftv t;
     5723  t.Init();
    57265724  t.rtyp=INT_CMD;
    57275725  for (l=0;l< iv->length(); l++)
     
    57605758static BOOLEAN jjBRACK_Ma_IV_I(leftv res, leftv u, leftv v,leftv w)
    57615759{
    5762   sleftv t;
    5763   sleftv ut;
     5760  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
     5761  {
     5762    WerrorS("cannot build expression lists from unnamed objects");
     5763    return TRUE;
     5764  }
    57645765  leftv p=NULL;
    57655766  intvec *iv=(intvec *)v->Data();
    57665767  int l;
    57675768  BOOLEAN nok;
    5768 
    5769   if ((u->rtyp!=IDHDL)||(u->e!=NULL))
    5770   {
    5771     WerrorS("cannot build expression lists from unnamed objects");
    5772     return TRUE;
    5773   }
     5769  sleftv ut;
    57745770  memcpy(&ut,u,sizeof(ut));
    5775   memset(&t,0,sizeof(t));
     5771  sleftv t;
     5772  t.Init();
    57765773  t.rtyp=INT_CMD;
    57775774  for (l=0;l< iv->length(); l++)
     
    58105807static BOOLEAN jjBRACK_Ma_IV_IV(leftv res, leftv u, leftv v,leftv w)
    58115808{
    5812   sleftv t1,t2,ut;
     5809  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
     5810  {
     5811    WerrorS("cannot build expression lists from unnamed objects");
     5812    return TRUE;
     5813  }
    58135814  leftv p=NULL;
    58145815  intvec *vv=(intvec *)v->Data();
     
    58185819  BOOLEAN nok;
    58195820
    5820   if ((u->rtyp!=IDHDL)||(u->e!=NULL))
    5821   {
    5822     WerrorS("cannot build expression lists from unnamed objects");
    5823     return TRUE;
    5824   }
     5821  sleftv t1,t2,ut;
    58255822  memcpy(&ut,u,sizeof(ut));
    5826   memset(&t1,0,sizeof(sleftv));
    5827   memset(&t2,0,sizeof(sleftv));
     5823  t1.Init();
    58285824  t1.rtyp=INT_CMD;
     5825  t2.Init();
    58295826  t2.rtyp=INT_CMD;
    58305827  for (vl=0;vl< vv->length(); vl++)
     
    58635860  v->next=(leftv)omAllocBin(sleftv_bin);
    58645861  memcpy(v->next,w,sizeof(sleftv));
    5865   memset(w,0,sizeof(sleftv));
     5862  w->Init();
    58665863  return jjPROC(res,u,v);
    58675864}
     
    58705867  u->next=(leftv)omAlloc(sizeof(sleftv));
    58715868  memcpy(u->next,v,sizeof(sleftv));
    5872   memset(v,0,sizeof(sleftv));
     5869  v->Init();
    58735870  u->next->next=(leftv)omAlloc(sizeof(sleftv));
    58745871  memcpy(u->next->next,w,sizeof(sleftv));
    5875   memset(w,0,sizeof(sleftv));
     5872  w->Init();
    58765873  BOOLEAN bo=iiExprArithM(res,u,'[');
    58775874  u->next=NULL;
     
    59355932  i->m[0]=p;
    59365933  sleftv t;
    5937   memset(&t,0,sizeof(t));
     5934  t.Init();
    59385935  t.data=(char *)i;
    59395936  t.rtyp=IDEAL_CMD;
     
    66106607{
    66116608  sleftv tmp;
    6612   memset(&tmp,0,sizeof(tmp));
     6609  tmp.Init();
    66136610  // do not check the result, conversion from int/number to poly works always
    66146611  iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
     
    71807177    if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
    71817178    sleftv tmpW;
    7182     memset(&tmpW,0,sizeof(sleftv));
     7179    tmpW.Init();
    71837180    tmpW.rtyp=IDTYP(w);
    71847181    tmpW.data=IDDATA(w);
     
    75527549  }
    75537550  #else
    7554   memset(res,0,sizeof(sleftv));
     7551  res->Init();
    75557552  res->rtyp=NONE;
    75567553  return TRUE;
     
    75647561  {
    75657562    memcpy(res,u,sizeof(sleftv));
    7566     memset(u,0,sizeof(sleftv));
     7563    u->Init();
    75677564    return FALSE;
    75687565  }
     
    81808177  if ((rest!=NULL) && (!b))
    81818178  {
    8182     sleftv tmp_res;
    81838179    leftv tmp_next=res->next;
    81848180    res->next=rest;
    8185     memset(&tmp_res,0,sizeof(tmp_res));
     8181    sleftv tmp_res;
     8182    tmp_res.Init();
    81868183    b = iiExprArithM(&tmp_res,res,iiOp);
    81878184    memcpy(res,&tmp_res,sizeof(tmp_res));
     
    83548351                                    const struct sConvertTypes *dConvertTypes)
    83558352{
    8356   memset(res,0,sizeof(sleftv));
    83578353  BOOLEAN call_failed=FALSE;
    83588354
     
    85138509                                    const struct sConvertTypes *dConvertTypes)
    85148510{
     8511  res->Init();
    85158512  leftv b=a->next;
    85168513  a->next=NULL;
     
    85238520BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
    85248521{
    8525   memset(res,0,sizeof(sleftv));
     8522  res->Init();
    85268523
    85278524  if (!errorreported)
     
    85828579BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1* dA1, int at, const struct sConvertTypes *dConvertTypes)
    85838580{
    8584   memset(res,0,sizeof(sleftv));
     8581  res->Init();
    85858582  BOOLEAN call_failed=FALSE;
    85868583
     
    87128709BOOLEAN iiExprArith1(leftv res, leftv a, int op)
    87138710{
    8714   memset(res,0,sizeof(sleftv));
     8711  res->Init();
    87158712
    87168713  if (!errorreported)
     
    87738770  const struct sConvertTypes *dConvertTypes)
    87748771{
    8775   memset(res,0,sizeof(sleftv));
    87768772  BOOLEAN call_failed=FALSE;
    87778773
     
    89258921BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
    89268922{
    8927   memset(res,0,sizeof(sleftv));
     8923  res->Init();
    89288924
    89298925  if (!errorreported)
     
    89808976                                    const struct sConvertTypes *dConvertTypes)
    89818977{
     8978  res->Init();
    89828979  leftv b=a->next;
    89838980  a->next=NULL;
     
    90159012BOOLEAN iiExprArithM(leftv res, leftv a, int op)
    90169013{
    9017   memset(res,0,sizeof(sleftv));
     9014  res->Init();
    90189015
    90199016  if (!errorreported)
     
    97829779  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
    97839780  sleftv tmp;
    9784   memset(&tmp,0,sizeof(sleftv));
     9781  tmp.Init();
    97859782  iiOp='<';
    97869783  BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
  • Singular/ipconv.cc

    r02eb92 re4514d3  
    435435BOOLEAN iiConvert (int inputType, int outputType, int index, leftv input, leftv output,const struct sConvertTypes *dConvertTypes)
    436436{
    437   memset(output,0,sizeof(sleftv));
     437  output->Init();
    438438  if ((inputType==outputType)
    439439  || (outputType==DEF_CMD)
     
    441441  {
    442442    memcpy(output,input,sizeof(*output));
    443     memset(input,0,sizeof(*input));
     443    input->Init();
    444444    return FALSE;
    445445  }
  • Singular/ipid.cc

    r02eb92 re4514d3  
    269269{
    270270  sleftv tmp;
    271   memset(&tmp,0,sizeof(sleftv));
     271  tmp.Init();
    272272  tmp.rtyp=IDTYP(this);
    273273  tmp.data=IDDATA(this);
  • Singular/iplib.cc

    r02eb92 re4514d3  
    398398    iiCurrArgs=(leftv)omAllocBin(sleftv_bin);
    399399    memcpy(iiCurrArgs,v,sizeof(sleftv)); // keeps track of v->next etc.
    400     memset(v,0,sizeof(sleftv));
     400    v->Init();
    401401  }
    402402  else
     
    740740    leftv h=(leftv)omAllocBin(sleftv_bin);
    741741    memcpy(h,&iiRETURNEXPR,sizeof(sleftv));
    742     memset(&iiRETURNEXPR,0,sizeof(sleftv));
     742    iiRETURNEXPR.Init();
    743743    return h;
    744744  }
     
    11901190  char FullName[256];
    11911191
    1192   memset(FullName,0,256);
     1192  memset(FullName,0,sizeof(FullName));
    11931193
    11941194  if( *fullname != '/' &&  *fullname != '.' )
  • Singular/ipshell.cc

    r02eb92 re4514d3  
    204204                     char *s;
    205205                     l=strlen(IDSTRING(h));
    206                      memset(buffer,0,22);
     206                     memset(buffer,0,sizeof(buffer));
    207207                     strncpy(buffer,IDSTRING(h),si_min(l,20));
    208208                     if ((s=strchr(buffer,'\n'))!=NULL)
     
    652652      v=(leftv)omAlloc0Bin(sleftv_bin);
    653653      sleftv tmpW;
    654       memset(&tmpW,0,sizeof(sleftv));
     654      tmpW.Init();
    655655      tmpW.rtyp=IDTYP(w);
    656656      if (tmpW.rtyp==MAP_CMD)
     
    891891{
    892892  sleftv tmp;
    893   memset(&tmp,0,sizeof(tmp));
     893  tmp.Init();
    894894  tmp.rtyp=INT_CMD;
    895895  tmp.data=(void *)1;
     
    911911  l->m[0].attribute=*a;
    912912  sleftv tmp2;
    913   memset(&tmp2,0,sizeof(tmp2));
     913  tmp2.Init();
    914914  tmp2.rtyp=LIST_CMD;
    915915  tmp2.data=(void *)l;
     
    998998  loop
    999999  {
    1000     memset(s,0,80);
     1000    memset(s,0,BREAK_LINE_LENGTH+4);
    10011001    fe_fgets_stdin("",s,BREAK_LINE_LENGTH);
    10021002    if (s[BREAK_LINE_LENGTH-1]!='\0')
     
    10491049  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
    10501050  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
    1051   hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
     1051  hpure = (scmon)omAlloc0((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
    10521052  hrad = hexist;
    10531053  hNrad = hNexist;
     
    10601060  {
    10611061    hCo = hNvar;
    1062     memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
    10631062    hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
    10641063    hLexR(hrad, hNrad, hvar, hNvar);
     
    11301129  const char *id = name->name;
    11311130
    1132   memset(sy,0,sizeof(sleftv));
     1131  sy->Init();
    11331132  if ((name->name==NULL)||(isdigit(name->name[0])))
    11341133  {
     
    11941193    return FALSE;
    11951194  sleftv tmp;
    1196   memset(&tmp,0,sizeof(sleftv));
     1195  tmp.Init();
    11971196  tmp.rtyp=at->atyp;
    11981197  tmp.data=at->CopyA();
     
    15831582  {
    15841583    sLastPrinted.CleanUp();
    1585     memset(&sLastPrinted,0,sizeof(sleftv));
    15861584  }
    15871585
     
    31823180{
    31833181  sleftv tmp;
    3184   memset(&tmp,0,sizeof(tmp));
     3182  tmp.Init();
    31853183  tmp.rtyp=INT_CMD;
    31863184  tmp.data=(void *)1;
     
    45614559{
    45624560  sleftv tmp;
    4563   memset(&tmp,0,sizeof(tmp));
     4561  tmp.Init();
    45644562  tmp.rtyp=INT_CMD;
    4565   /* tmp.data = (void *)0;  -- done by memset */
     4563  /* tmp.data = (void *)0;  -- done by Init */
    45664564
    45674565  return  semicProc3(res,u,v,&tmp);
     
    51405138    {
    51415139      sLastPrinted.CleanUp();
    5142       //memset(&sLastPrinted,0,sizeof(sleftv)); // done by Cleanup,Init
    51435140    }
    51445141
     
    62836280    IDRING(currRingHdl)=currRing;
    62846281  }
    6285   sleftv v; memset(&v,0,sizeof(v)); v.rtyp=IDEAL_CMD; v.data=(char *) F;
     6282  sleftv v; v.Init(); v.rtyp=IDEAL_CMD; v.data=(char *) F;
    62866283  idhdl h=ggetid("groebner");
    6287   sleftv u; memset(&u,0,sizeof(u)); u.rtyp=IDHDL; u.data=(char *) h;
     6284  sleftv u; u.Init(); u.rtyp=IDHDL; u.data=(char *) h;
    62886285            u.name=IDID(h);
    62896286
    6290   sleftv res; memset(&res,0,sizeof(res));
     6287  sleftv res; res.Init();
    62916288  if(jjPROC(&res,&u,&v))
    62926289  {
     
    63876384  for(int i=0;i<aa->length(); i++)
    63886385  {
    6389     memset(&tmp_in,0,sizeof(tmp_in));
     6386    tmp_in.Init();
    63906387    tmp_in.rtyp=INT_CMD;
    63916388    tmp_in.data=(void*)(long)(*aa)[i];
     
    64296426  for(int i=0;i<=aa->nr; i++)
    64306427  {
    6431     memset(&tmp_in,0,sizeof(tmp_in));
     6428    tmp_in.Init();
    64326429    tmp_in.Copy(&(aa->m[i]));
    64336430    if (proc==NULL)
     
    64546451BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc)
    64556452{
    6456   memset(res,0,sizeof(sleftv));
     6453  res->Init();
    64576454  res->rtyp=a->Typ();
    64586455  switch (res->rtyp /*a->Typ()*/)
     
    65226519    sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
    65236520  }
    6524   memset(r,0,sizeof(*r));
     6521  r->Init();
    65256522  // now produce procinfo for PROC_CMD:
    65266523  r->data = (void *)omAlloc0Bin(procinfo_bin);
     
    65426539  {
    65436540    sleftv tmp;
    6544     memset(&tmp,0,sizeof(tmp));
     6541    tmp.Init();
    65456542    tmp.rtyp=IDHDL;
    65466543    idhdl h=rDefault(ring_name);
     
    65626559    sleftv tmp;
    65636560    sleftv n;
    6564     memset(&n,0,sizeof(n));
     6561    n.Init();
    65656562    n.name=ring_name;
    65666563    if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
     
    66376634      &&(IDTYP((idhdl)source->data)!=RING_CMD))
    66386635      {
    6639         memset(&iiRETURNEXPR,0,sizeof(sleftv));
     6636        iiRETURNEXPR.Init();
    66406637        iiRETURNEXPR.rtyp=IDTYP((idhdl)source->data);
    66416638        iiRETURNEXPR.data=IDDATA((idhdl)source->data);
  • Singular/newstruct.cc

    r02eb92 re4514d3  
    5959    {
    6060      sleftv tmp;
    61       memset(&tmp,0,sizeof(tmp));
     61      tmp.Init();
    6262      tmp.rtyp=ad->id;
    6363      void * newstruct_Copy(blackbox*, void *); //forward declaration
    6464      tmp.data=(void*)newstruct_Copy(b,d);
    6565      idrec hh;
    66       memset(&hh,0,sizeof(hh));
     66      hh.Init();
    6767      hh.id=Tok2Cmdname(p->t);
    6868      hh.typ=PROC_CMD;
     
    182182    BOOLEAN sl;
    183183    idrec hh;
    184     memset(&hh,0,sizeof(hh));
     184    hh.Init();
    185185    hh.id=Tok2Cmdname(p->t);
    186186    hh.typ=PROC_CMD;
    187187    hh.data.pinf=p->p;
    188188    sleftv tmp;
    189     memset(&tmp,0,sizeof(sleftv));
    190189    tmp.Copy(r);
    191190    sl = iiMake_proc(&hh, NULL, &tmp);
     
    259258  {
    260259    idrec hh;
    261     memset(&hh,0,sizeof(hh));
     260    hh.Init();
    262261    hh.id=Tok2Cmdname(p->t);
    263262    hh.typ=PROC_CMD;
     
    438437          r->start = nm->pos+1;
    439438          memcpy(res,a1,sizeof(sleftv));
    440           memset(a1,0,sizeof(sleftv));
     439          a1->Init();
    441440          if (res->e==NULL) res->e=r;
    442441          else
     
    446445            sh->next=r;
    447446          }
    448           //a1->CleanUp();// see memset above
     447          //a1->CleanUp();// see Init() above
    449448          a2->CleanUp();
    450449          return FALSE;
     
    469468  {
    470469    sleftv tmp;
    471     memset(&tmp,0,sizeof(sleftv));
    472470    tmp.Copy(a1);
    473471    tmp.next=(leftv)omAlloc0(sizeof(sleftv));
    474472    tmp.next->Copy(a2);
    475473    idrec hh;
    476     memset(&hh,0,sizeof(hh));
     474    hh.Init();
    477475    hh.id=Tok2Cmdname(p->t);
    478476    hh.typ=PROC_CMD;
     
    517515  {
    518516    idrec hh;
    519     memset(&hh,0,sizeof(hh));
     517    hh.Init();
    520518    hh.id=Tok2Cmdname(p->t);
    521519    hh.typ=PROC_CMD;
     
    613611  newstruct_desc dd=(newstruct_desc)b->data;
    614612  sleftv l;
    615   memset(&l,0,sizeof(l));
     613  l.Init();
    616614  l.rtyp=STRING_CMD;
    617615  l.data=(void*)getBlackboxName(dd->id);
     
    684682    BOOLEAN sl;
    685683    sleftv tmp;
    686     memset(&tmp,0,sizeof(tmp));
     684    tmp.Init();
    687685    tmp.rtyp=dd->id;
    688686    tmp.data=(void*)newstruct_Copy(b,d);
    689687    idrec hh;
    690     memset(&hh,0,sizeof(hh));
     688    hh.Init();
    691689    hh.id=Tok2Cmdname(p->t);
    692690    hh.typ=PROC_CMD;
  • Singular/subexpr.cc

    r02eb92 re4514d3  
    148148        {
    149149          PrintNSpaces(spaces);
    150           const ring r = (const ring)d;
     150          const ring r = (ring)d;
    151151          rWrite(r, currRing == r);
    152152          break;
     
    18301830  v->Init();
    18311831  v->req_packhdl = currPack;
    1832   idhdl h=NULL;
    18331832#ifdef SIQ
    18341833  if (siq<=0)
     
    19281927          {
    19291928            memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
    1930             memset(&iiRETURNEXPR,0,sizeof(sleftv));
     1929            iiRETURNEXPR.Init();
    19311930          }
    19321931        }
     
    19731972          if (!nok)
    19741973          {
    1975             memset(&d->arg1,0,sizeof(sleftv));
     1974            d->arg1.Init();
    19761975            this->CleanUp();
    19771976            rtyp=NONE;
  • factory/cf_factor.cc

    r02eb92 re4514d3  
    434434    if (f.isUnivariate())
    435435    {
     436#ifdef HAVE_FLINT
    436437#ifdef HAVE_NTL
    437 #ifdef HAVE_FLINT
    438438      if (degree (f) < 300)
    439       {
     439#endif
     440      {
     441        // use FLINT
    440442        nmod_poly_t f1;
    441443        convertFacCF2nmod_poly_t (f1, f);
     
    446448        nmod_poly_factor_clear (result);
    447449        nmod_poly_clear (f1);
    448       }
    449       else
    450 #endif
    451       {
    452         // USE NTL
    453         if (getCharacteristic()!=2)
    454         {
    455           if (fac_NTL_char != getCharacteristic())
    456           {
    457             fac_NTL_char = getCharacteristic();
    458             zz_p::init(getCharacteristic());
    459           }
    460 
    461           // convert to NTL
    462           zz_pX f1=convertFacCF2NTLzzpX(f);
    463           zz_p leadcoeff = LeadCoeff(f1);
    464 
    465           //make monic
    466           f1=f1 / LeadCoeff(f1);
    467           // factorize
    468           vec_pair_zz_pX_long factors;
    469           CanZass(factors,f1);
    470 
    471           F=convertNTLvec_pair_zzpX_long2FacCFFList(factors,leadcoeff,f.mvar());
    472           //test_cff(F,f);
    473         }
    474         else /*getCharacteristic()==2*/
     450        if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     451        return F;
     452      }
     453#endif
     454#ifdef HAVE_NTL
     455      {
     456        if (getCharacteristic()==2)
    475457        {
    476458          // Specialcase characteristic==2
     
    489471          // convert back to factory again using the faster conversion routine for vectors over GF2X
    490472          F=convertNTLvec_pair_GF2X_long2FacCFFList(factors,LeadCoeff(f1),f.mvar());
     473          if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     474          return F;
    491475        }
    492476      }
    493 #else
     477#endif
     478#ifdef HAVE_NTL
     479      {
     480        // USE NTL
     481        if (fac_NTL_char != getCharacteristic())
     482        {
     483          fac_NTL_char = getCharacteristic();
     484          zz_p::init(getCharacteristic());
     485        }
     486
     487        // convert to NTL
     488        zz_pX f1=convertFacCF2NTLzzpX(f);
     489        zz_p leadcoeff = LeadCoeff(f1);
     490
     491        //make monic
     492        f1=f1 / LeadCoeff(f1);
     493        // factorize
     494        vec_pair_zz_pX_long factors;
     495        CanZass(factors,f1);
     496
     497        F=convertNTLvec_pair_zzpX_long2FacCFFList(factors,leadcoeff,f.mvar());
     498        //test_cff(F,f);
     499        if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     500        return F;
     501      }
     502#endif
     503#if !defined(HAVE_NTL) && !defined(HAVE_FLINT)
    494504      // Use Factory without NTL
    495       factoryError ("univariate factorization depends on NTL(missing)");
     505      factoryError ("univariate factorization depends on FLINT/NTL(missing)");
    496506      return CFFList (CFFactor (f, 1));
    497 #endif //HAVE_NTL
    498     }
    499     else
    500     {
    501       #ifdef HAVE_NTL
     507#endif
     508    }
     509    else
     510    {
     511      #if defined(HAVE_NTL) || defined(HAVE_FLINT)
    502512      if (issqrfree)
    503513      {
     
    520530      }
    521531      #else
    522       ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" );
    523       factoryError ("multivariate factorization depends on NTL(missing)");
     532      ASSERT( f.isUnivariate(), "multivariate factorization depends on FLINT/NTL(missing)" );
     533      factoryError ("multivariate factorization depends on FLINT/NTL(missing)");
    524534      return CFFList (CFFactor (f, 1));
    525535      #endif
     
    572582    else
    573583    {
    574       #ifdef HAVE_NTL
    575584      On (SW_RATIONAL);
    576585      if (issqrfree)
     
    584593        F = ratFactorize (fz);
    585594      Off (SW_RATIONAL);
    586       #else
    587       factoryError ("multivariate factorization  depends on NTL(missing)");
    588       return CFFList (CFFactor (f, 1));
    589       #endif
    590595    }
    591596
     
    607612  }
    608613
    609   //out_cff(F);
    610614  if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
    611615  return F;
     
    633637  if (ch>0)
    634638  {
    635     if (f.isUnivariate()&& (ch>0))
     639    if (f.isUnivariate())
    636640    {
    637641#ifdef HAVE_NTL
    638       //USE NTL
    639       if (ch>2)
    640       {
    641 #if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
    642         nmod_poly_t FLINTmipo, leadingCoeff;
    643         fq_nmod_ctx_t fq_con;
    644 
    645         nmod_poly_init (FLINTmipo, getCharacteristic());
    646         nmod_poly_init (leadingCoeff, getCharacteristic());
    647         convertFacCF2nmod_poly_t (FLINTmipo, getMipo (alpha));
    648 
    649         fq_nmod_ctx_init_modulus (fq_con, FLINTmipo, "Z");
    650         fq_nmod_poly_t FLINTF;
    651         convertFacCF2Fq_nmod_poly_t (FLINTF, f, fq_con);
    652         fq_nmod_poly_factor_t res;
    653         fq_nmod_poly_factor_init (res, fq_con);
    654         fq_nmod_poly_factor (res, leadingCoeff, FLINTF, fq_con);
    655         F= convertFLINTFq_nmod_poly_factor2FacCFFList (res, f.mvar(), alpha, fq_con);
    656         F.insert (CFFactor (Lc (f), 1));
    657 
    658         fq_nmod_poly_factor_clear (res, fq_con);
    659         fq_nmod_poly_clear (FLINTF, fq_con);
    660         nmod_poly_clear (FLINTmipo);
    661         nmod_poly_clear (leadingCoeff);
    662         fq_nmod_ctx_clear (fq_con);
    663 #else
    664         // First all cases with characteristic !=2
    665         // set remainder
    666         if (fac_NTL_char != getCharacteristic())
    667         {
    668           fac_NTL_char = getCharacteristic();
    669           zz_p::init(getCharacteristic());
    670         }
    671 
    672         // set minimal polynomial in NTL
    673         zz_pX minPo=convertFacCF2NTLzzpX(getMipo(alpha));
    674         zz_pE::init (minPo);
    675 
    676         // convert to NTL
    677         zz_pEX f1=convertFacCF2NTLzz_pEX(f,minPo);
    678         zz_pE leadcoeff= LeadCoeff(f1);
    679 
    680         //make monic
    681         f1=f1 / leadcoeff;
    682 
    683         // factorize using NTL
    684         vec_pair_zz_pEX_long factors;
    685         CanZass(factors,f1);
    686 
    687         // return converted result
    688         F=convertNTLvec_pair_zzpEX_long2FacCFFList(factors,leadcoeff,f.mvar(),alpha);
    689 #endif
    690       }
    691       else if (/*getCharacteristic()*/ch==2)
     642      if (/*getCharacteristic()*/ch==2)
    692643      {
    693644        // special case : GF2
     
    719670        // return converted result
    720671        F=convertNTLvec_pair_GF2EX_long2FacCFFList(factors,f1_coef,f.mvar(),alpha);
    721       }
    722 #else
     672        if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     673        return F;
     674      }
     675#endif
     676#if (HAVE_FLINT && __FLINT_RELEASE >= 20400)
     677      {
     678        // use FLINT
     679        nmod_poly_t FLINTmipo, leadingCoeff;
     680        fq_nmod_ctx_t fq_con;
     681
     682        nmod_poly_init (FLINTmipo, getCharacteristic());
     683        nmod_poly_init (leadingCoeff, getCharacteristic());
     684        convertFacCF2nmod_poly_t (FLINTmipo, getMipo (alpha));
     685
     686        fq_nmod_ctx_init_modulus (fq_con, FLINTmipo, "Z");
     687        fq_nmod_poly_t FLINTF;
     688        convertFacCF2Fq_nmod_poly_t (FLINTF, f, fq_con);
     689        fq_nmod_poly_factor_t res;
     690        fq_nmod_poly_factor_init (res, fq_con);
     691        fq_nmod_poly_factor (res, leadingCoeff, FLINTF, fq_con);
     692        F= convertFLINTFq_nmod_poly_factor2FacCFFList (res, f.mvar(), alpha, fq_con);
     693        F.insert (CFFactor (Lc (f), 1));
     694
     695        fq_nmod_poly_factor_clear (res, fq_con);
     696        fq_nmod_poly_clear (FLINTF, fq_con);
     697        nmod_poly_clear (FLINTmipo);
     698        nmod_poly_clear (leadingCoeff);
     699        fq_nmod_ctx_clear (fq_con);
     700        if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     701        return F;
     702      }
     703#endif
     704#ifdef HAVE_NTL
     705      {
     706        // use NTL
     707        if (fac_NTL_char != getCharacteristic())
     708        {
     709          fac_NTL_char = getCharacteristic();
     710          zz_p::init(getCharacteristic());
     711        }
     712
     713        // convert to NTL
     714        zz_pX f1=convertFacCF2NTLzzpX(f);
     715        zz_p leadcoeff = LeadCoeff(f1);
     716
     717        //make monic
     718        f1=f1 / LeadCoeff(f1);
     719        // factorize
     720        vec_pair_zz_pX_long factors;
     721        CanZass(factors,f1);
     722
     723        F=convertNTLvec_pair_zzpX_long2FacCFFList(factors,leadcoeff,f.mvar());
     724        //test_cff(F,f);
     725        if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF);
     726        return F;
     727      }
     728#endif
     729#if !defined(HAVE_NTL) && !defined(HAVEFLINT)
    723730      factoryError ("univariate factorization  depends on NTL(missing)");
    724731      return CFFList (CFFactor (f, 1));
     
    727734    else
    728735    {
    729 #ifdef HAVE_NTL
    730736      F= FqFactorize (f, alpha);
    731 #else
    732       ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" );
    733       factoryError ("multivariate factorization  depends on NTL(missing)");
    734       return CFFList (CFFactor (f, 1));
    735 #endif
    736737    }
    737738  }
     
    744745    else //Q(a)[x1,...,xn]
    745746    {
    746 #ifdef HAVE_NTL
    747747      F= ratFactorize (f, alpha);
    748 #else
    749       ASSERT( f.isUnivariate(), "multivariate factorization  depends on NTL(missing)" );
    750       factoryError ("multivariate factorization  depends on NTL(missing)");
    751       return CFFList (CFFactor (f, 1));
    752 #endif
    753748    }
    754749  }
  • factory/facMul.cc

    r02eb92 re4514d3  
    3232#include <NTL/lzz_pEX.h>
    3333#include "NTLconvert.h"
     34#endif
    3435
    3536#ifdef HAVE_FLINT
     
    452453        fq_ctx_clear (fq_con);
    453454        return b (result);
    454 #else
     455#endif
     456#ifdef HAVE_NTL
    455457        ZZ_p::init (convertFacCF2NTLZZ (b.getpk()));
    456458        ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (mipo));
     
    489491      }
    490492      return mulFLINTQ (F, G);
    491 #else
     493#endif
     494#ifdef HAVE_NTL
    492495      if (b.getp() != 0)
    493496      {
     
    569572
    570573          return b (result);
    571 #else
     574#endif
     575#ifdef HAVE_NTL
    572576          ZZ_p::init (convertFacCF2NTLZZ (b.getpk()));
    573577          ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (getMipo (alpha)));
     
    607611  ASSERT (F.isUnivariate() && G.isUnivariate(), "expected univariate polys");
    608612  ASSERT (F.level() == G.level(), "expected polys of same level");
     613#ifdef HAVE_NTL
    609614#if (!defined(HAVE_FLINT) ||  __FLINT_RELEASE < 20400)
    610615  if (fac_NTL_char != getCharacteristic())
     
    613618    zz_p::init (getCharacteristic());
    614619  }
     620#endif
    615621#endif
    616622  Variable alpha;
     
    646652    nmod_poly_clear (FLINTmipo);
    647653    fq_nmod_ctx_clear (fq_con);
    648 #else
     654    return result;
     655#elif defined(AHVE_NTL)
    649656    zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
    650657    zz_pE::init (NTLMipo);
     
    653660    mul (NTLF, NTLF, NTLG);
    654661    result= convertNTLzz_pEX2CF(NTLF, F.mvar(), alpha);
     662    return result;
    655663#endif
    656664  }
     
    665673    nmod_poly_clear (FLINTF);
    666674    nmod_poly_clear (FLINTG);
    667 #else
     675    return result;
     676#endif
     677#ifdef HAVE_NTL
    668678    zz_pX NTLF= convertFacCF2NTLzzpX (F);
    669679    zz_pX NTLG= convertFacCF2NTLzzpX (G);
    670680    mul (NTLF, NTLF, NTLG);
    671     result= convertNTLzzpX2CF(NTLF, F.mvar());
    672 #endif
    673   }
    674   return result;
     681    return convertNTLzzpX2CF(NTLF, F.mvar());
     682#endif
     683  }
     684  return F*G;
    675685}
    676686
     
    37353745// end division
    37363746
    3737 #endif
  • libpolys/polys/Makefile.am

    r48e0bcb re4514d3  
    112112
    113113templates/p_Procs.inc: p_Procs_Generate.cc
    114         $(MAKE) $(AM_MAKEFLAGS) CXX="$(CXX_FOR_BUILD)" p_Procs_Generate
     114        $(MAKE) $(AM_MAKEFLAGS) CXX="$(CXX_FOR_BUILD)" CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" LDFLAGS="" LIBS="" p_Procs_Generate
    115115        ./p_Procs_Generate$(BUILD_EXEEXT) > ./templates/p_Procs.inc
    116116
  • m4/ax_prog_cxx_for_build.m4

    r48e0bcb re4514d3  
    3232#   warranty.
    3333
    34 #serial 3
     34#serial 4
    3535
    3636AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD])
     
    5050pushdef([CXX], CXX_FOR_BUILD)dnl
    5151pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl
     52pushdef([GXX], GXX_FOR_BUILD)dnl
    5253pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl
    5354pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
     
    6364pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
    6465pushdef([ac_cv_host_os], ac_cv_build_os)dnl
    65 pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl
    66 pushdef([ac_compile], ac_build_compile)dnl
    67 pushdef([ac_link], ac_build_link)dnl
     66pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
     67pushdef([am_cv_CXX_dependencies_compiler_type], am_cv_build_CXX_dependencies_compiler_type)dnl
     68pushdef([cross_compiling], cross_compiling_build)dnl
    6869
    69 save_cross_compiling=$cross_compiling
    70 save_ac_tool_prefix=$ac_tool_prefix
    71 cross_compiling=no
    72 ac_tool_prefix=
     70cross_compiling_build=no
    7371
     72ac_build_tool_prefix=
     73AS_IF([test -n "$build"],      [ac_build_tool_prefix="$build-"],
     74      [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
     75
     76AC_LANG_PUSH([C++])
    7477AC_PROG_CXX
    7578AC_PROG_CXXCPP
    7679
    77 ac_tool_prefix=$save_ac_tool_prefix
    78 cross_compiling=$save_cross_compiling
    79 
    8080dnl Restore the old definitions
    8181dnl
    82 popdef([ac_link])dnl
    83 popdef([ac_compile])dnl
    84 popdef([ac_cxxcpp])dnl
     82popdef([cross_compiling])dnl
     83popdef([am_cv_CXX_dependencies_compiler_type])dnl
     84popdef([ac_tool_prefix])dnl
    8585popdef([ac_cv_host_os])dnl
    8686popdef([ac_cv_host_vendor])dnl
     
    104104popdef([ac_cv_prog_CXXCPP])dnl
    105105
     106dnl restore global variables (dependant on the current
     107dnl language after popping):
     108AC_LANG_POP([C++])
     109
    106110dnl Finally, set Makefile variables
    107111dnl
  • omalloc/Makefile.am

    r48e0bcb re4514d3  
    4141
    4242omTables.inc:
    43         $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" omTables
     43        $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" LDFLAGS="$(LDFLAGS_FOR_BUILD)" omTables
    4444        ./omTables$(BUILD_EXEEXT) > omTables.xx && mv omTables.xx  omTables.inc
    4545
    4646omTables.h:
    47         $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" omTables1
     47        $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" LDFLAGS="$(LDFLAGS_FOR_BUILD)" omTables1
    4848        ./omTables1$(BUILD_EXEEXT) >omTables.yy && mv omTables.yy omTables.h
    4949
Note: See TracChangeset for help on using the changeset viewer.