Changeset 98d6c3 in git


Ignore:
Timestamp:
May 31, 2012, 3:45:28 PM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
510dbc222823c06af5c391eca075c45c04553e14
Parents:
06c0b34bdca32ebe70f5b9ed855251d51dbb263e17642b3261157040015bc8ef3c5a395ba70f33cb
Message:
Merge pull request #124 from mmklee/changes_sw

Changes sw
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • Singular/blackbox.h

    r17642b r98d6c3  
    6060BOOLEAN blackbox_default_OpM(int op,leftv l, leftv r);
    6161
     62/// default procedure to print this blackbox
     63void blackbox_default_Print(blackbox *b,void *d);
     64
    6265/// return the structure to the type given by t
    6366blackbox* getBlackboxStuff(const int t);
  • Singular/ipshell.cc

    r17642b r98d6c3  
    113113    default:          return Tok2Cmdname(t);
    114114  }
     115}
     116
     117int iiOpsTwoChar(const char *s)
     118{
     119/* not handling: &&, ||, ** */
     120  if (s[1]=='\0') return s[0];
     121  else if (s[2]!='\0') return 0;
     122  switch(s[0])
     123  {
     124    case '.': if (s[1]=='.') return DOTDOT;
     125              else           return 0;
     126    case ':': if (s[1]==':') return COLONCOLON;
     127              else           return 0;
     128    case '-': if (s[1]=='-') return COLONCOLON;
     129              else           return 0;
     130    case '+': if (s[1]=='+') return PLUSPLUS;
     131              else           return 0;
     132    case '=': if (s[1]=='=') return EQUAL_EQUAL;
     133              else           return 0;
     134    case '<': if (s[1]=='=') return LE;
     135              else if (s[1]=='>') return NOTEQUAL;
     136              else           return 0;
     137    case '>': if (s[1]=='=') return GE;
     138              else           return 0;
     139    case '!': if (s[1]=='=') return NOTEQUAL;
     140              else           return 0;
     141  }
     142  return 0;
    115143}
    116144
     
    17361764  const coeffs C = r->cf;
    17371765  assume( C != NULL );
    1738  
     1766
    17391767  // sanity check: require currRing==r for rings with polynomial data
    1740   if ( (r!=currRing) && ( 
    1741            (nCoeff_is_algExt(C) && (C != currRing->cf))
    1742         || (r->qideal != NULL)           
     1768  if ( (r!=currRing) && (
     1769           (nCoeff_is_algExt(C) && (C != currRing->cf))
     1770        || (r->qideal != NULL)
    17431771#ifdef HAVE_PLURAL
    17441772        || (rIsPluralRing(r))
     
    21922220          TransExtInfo extParam;
    21932221          extParam.r = extRing;
    2194           assume( extRing->qideal == NULL );
     2222          assume( extRing->qideal == NULL );
    21952223
    21962224          R->cf = nInitChar(n_transExt, &extParam);
  • Singular/ipshell.h

    r17642b r98d6c3  
    5252const char *  Tok2Cmdname(int i);
    5353const char *  iiTwoOps(int t);
     54int           iiOpsTwoChar(const char *s);
     55
    5456int     IsPrime(int i);
    5557
  • Singular/newstruct.cc

    r17642b r98d6c3  
    2020};
    2121
     22struct newstruct_proc_s;
     23typedef struct newstruct_proc_a *newstruct_proc;
     24struct  newstruct_proc_a
     25{
     26  newstruct_proc next;
     27  int            t; /*tok id */
     28  int            args; /* number of args */
     29  procinfov      p;
     30};
     31
    2232struct newstruct_desc_s
    2333{
    2434  newstruct_member member;
    2535  newstruct_desc   parent;
     36  newstruct_proc   procs;
    2637  int            size; // number of mebers +1
    2738  int            id;   // the type id assigned to this bb
     
    96107      }
    97108    }
     109    else if(L->m[n].rtyp==LIST_CMD)
     110    {
     111      N->m[n].rtyp=L->m[n].rtyp;
     112      N->m[n].data=(void *)lCopy((lists)(L->m[n].data));
     113    }
    98114    else if(L->m[n].rtyp>MAX_TOK)
    99115    {
     
    102118      N->m[n].data=(void *)b->blackbox_Copy(b,L->m[n].data);
    103119    }
    104     else if(L->m[n].rtyp==LIST_CMD)
    105     {
    106       N->m[n].rtyp=L->m[n].rtyp;
    107       N->m[n].data=(void *)lCopy((lists)(L->m[n].data));
    108     }
    109120    else
    110121      N->m[n].Copy(&L->m[n]);
     
    113124  return N;
    114125}
    115 void * newstruct_Copy(blackbox*b, void *d)
     126void * newstruct_Copy(blackbox*, void *d)
    116127{
    117128  lists n1=(lists)d;
     
    121132BOOLEAN newstruct_Assign(leftv l, leftv r)
    122133{
    123   blackbox *ll=getBlackboxStuff(l->Typ());
    124134  if (r->Typ()>MAX_TOK)
    125135  {
     
    169179BOOLEAN newstruct_Op2(int op, leftv res, leftv a1, leftv a2)
    170180{
    171   // interpreter: a1 is newstruct
     181  // interpreter: a1 or a2 is newstruct
    172182  blackbox *a=getBlackboxStuff(a1->Typ());
    173   newstruct_desc nt=(newstruct_desc)a->data;
     183  newstruct_desc nt;
    174184  lists al=(lists)a1->Data();
    175   switch(op)
    176   {
    177     case '.':
    178     {
    179       if (a2->name!=NULL)
    180       {
    181         BOOLEAN search_ring=FALSE;
    182         newstruct_member nm=nt->member;
    183         while ((nm!=NULL)&&(strcmp(nm->name,a2->name)!=0)) nm=nm->next;
    184         if ((nm==NULL) && (strncmp(a2->name,"r_",2)==0))
     185  if (a!=NULL)
     186  {
     187    nt=(newstruct_desc)a->data;
     188    switch(op)
     189    {
     190      case '.':
     191      {
     192        if (a2->name!=NULL)
    185193        {
    186           nm=nt->member;
    187           while ((nm!=NULL)&&(strcmp(nm->name,a2->name+2)!=0)) nm=nm->next;
    188           if ((nm!=NULL)&&(RingDependend(nm->typ)))
    189             search_ring=TRUE;
     194          BOOLEAN search_ring=FALSE;
     195          newstruct_member nm=nt->member;
     196          while ((nm!=NULL)&&(strcmp(nm->name,a2->name)!=0)) nm=nm->next;
     197          if ((nm==NULL) && (strncmp(a2->name,"r_",2)==0))
     198          {
     199            nm=nt->member;
     200            while ((nm!=NULL)&&(strcmp(nm->name,a2->name+2)!=0)) nm=nm->next;
     201            if ((nm!=NULL)&&(RingDependend(nm->typ)))
     202              search_ring=TRUE;
     203            else
     204              nm=NULL;
     205          }
     206          if (nm==NULL)
     207          {
     208            Werror("member %s nor found", a2->name);
     209            return TRUE;
     210          }
     211          if (search_ring)
     212          {
     213            ring r;
     214            res->rtyp=RING_CMD;
     215            res->data=al->m[nm->pos-1].data;
     216            r=(ring)res->data;
     217            if (r==NULL) { res->data=(void *)currRing; r=currRing; }
     218            if (r!=NULL) r->ref++;
     219            else Werror("ring of this member is not set and no basering found");
     220            return r==NULL;
     221          }
     222          else if (RingDependend(nm->typ))
     223          {
     224            if (al->m[nm->pos].data==NULL)
     225            {
     226              // NULL belongs to any ring
     227              ring r=(ring)al->m[nm->pos-1].data;
     228              if (r!=NULL)
     229              {
     230                r->ref--;
     231                al->m[nm->pos-1].data=NULL;
     232                al->m[nm->pos-1].rtyp=DEF_CMD;
     233              }
     234            }
     235            else
     236            {
     237              //Print("checking ring at pos %d for dat at pos %d\n",nm->pos-1,nm->pos);
     238              if ((al->m[nm->pos-1].data!=(void *)currRing)
     239              &&(al->m[nm->pos-1].data!=(void*)0L))
     240              {
     241                Werror("different ring %lx(data) - %lx(basering)",
     242                  (long unsigned)(al->m[nm->pos-1].data),(long unsigned)currRing);
     243                return TRUE;
     244              }
     245            }
     246            if ((currRing!=NULL)&&(al->m[nm->pos-1].data==NULL))
     247            {
     248              // remember the ring, if not already set
     249              al->m[nm->pos-1].data=(void *)currRing;
     250              al->m[nm->pos-1].rtyp=RING_CMD;
     251              currRing->ref++;
     252            }
     253          }
     254          Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
     255          r->start = nm->pos+1;
     256          memcpy(res,a1,sizeof(sleftv));
     257          memset(a1,0,sizeof(sleftv));
     258          if (res->e==NULL) res->e=r;
    190259          else
    191             nm=NULL;
     260          {
     261            Subexpr sh=res->e;
     262            while (sh->next != NULL) sh=sh->next;
     263            sh->next=r;
     264          }
     265          return FALSE;
    192266        }
    193         if (nm==NULL)
     267        else
    194268        {
    195           Werror("member %s nor found", a2->name);
     269          WerrorS("name expected");
    196270          return TRUE;
    197271        }
    198         if (search_ring)
    199         {
    200           ring r;
    201           res->rtyp=RING_CMD;
    202           res->data=al->m[nm->pos-1].data;
    203           r=(ring)res->data;
    204           if (r==NULL) { res->data=(void *)currRing; r=currRing; }
    205           if (r!=NULL) r->ref++;
    206           else Werror("ring of this member is not set and no basering found");
    207           return r==NULL;
    208         }
    209         else if (RingDependend(nm->typ))
    210         {
    211           if (al->m[nm->pos].data==NULL)
    212           {
    213             // NULL belongs to any ring
    214             ring r=(ring)al->m[nm->pos-1].data;
    215             if (r!=NULL)
    216             {
    217               r->ref--;
    218               al->m[nm->pos-1].data=NULL;
    219               al->m[nm->pos-1].rtyp=DEF_CMD;
    220             }
    221           }
    222           else
    223           {
    224             //Print("checking ring at pos %d for dat at pos %d\n",nm->pos-1,nm->pos);
    225             if ((al->m[nm->pos-1].data!=(void *)currRing)
    226             &&(al->m[nm->pos-1].data!=(void*)0L))
    227             {
    228               Werror("different ring %lx(data) - %lx(basering)",
    229                 (long unsigned)(al->m[nm->pos-1].data),(long unsigned)currRing);
    230               return TRUE;
    231             }
    232           }
    233           if ((currRing!=NULL)&&(al->m[nm->pos-1].data==NULL))
    234           {
    235             // remember the ring, if not already set
    236             al->m[nm->pos-1].data=(void *)currRing;
    237             al->m[nm->pos-1].rtyp=RING_CMD;
    238             currRing->ref++;
    239           }
    240         }
    241         Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
    242         r->start = nm->pos+1;
    243         memcpy(res,a1,sizeof(sleftv));
    244         memset(a1,0,sizeof(sleftv));
    245         if (res->e==NULL) res->e=r;
    246         else
    247         {
    248           Subexpr sh=res->e;
    249           while (sh->next != NULL) sh=sh->next;
    250           sh->next=r;
    251         }
    252         return FALSE;
    253       }
    254       else
    255       {
    256         WerrorS("name expected");
    257         return TRUE;
    258       }
     272      }
     273    }
     274  }
     275  else
     276  {
     277    a=getBlackboxStuff(a2->Typ());
     278    nt=(newstruct_desc)a->data;
     279    al=(lists)a2->Data();
     280  }
     281  newstruct_proc p=nt->procs;
     282  while((p!=NULL) &&(p->t=op)&&(p->args!=2)) p=p->next;
     283  if (p!=NULL)
     284  {
     285    leftv sl;
     286    sleftv tmp;
     287    memset(&tmp,0,sizeof(sleftv));
     288    tmp.Copy(a1);
     289    tmp.next=(leftv)omAlloc0(sizeof(sleftv));
     290    tmp.next->Copy(a2);
     291    idrec hh;
     292    memset(&hh,0,sizeof(hh));
     293    hh.id=Tok2Cmdname(p->t);
     294    hh.typ=PROC_CMD;
     295    hh.data.pinf=p->p;
     296    sl=iiMake_proc(&hh,NULL,&tmp);
     297    if (sl==NULL) return TRUE;
     298    else
     299    {
     300      res->Copy(sl);
     301      return FALSE;
    259302    }
    260303  }
     
    267310  // interpreter: args->1. arg is newstruct
    268311  blackbox *a=getBlackboxStuff(args->Typ());
     312  newstruct_desc nt=(newstruct_desc)a->data;
    269313  switch(op)
    270314  {
     
    276320    }
    277321    default:
    278       return blackbox_default_OpM(op,res,args);
    279322      break;
    280323  }
    281   return TRUE;
     324  newstruct_proc p=nt->procs;
     325  while((p!=NULL) &&(p->t=op)&&(p->args!=4)) p=p->next;
     326  if (p!=NULL)
     327  {
     328    leftv sl;
     329    sleftv tmp;
     330    memset(&tmp,0,sizeof(sleftv));
     331    tmp.Copy(args);
     332    idrec hh;
     333    memset(&hh,0,sizeof(hh));
     334    hh.id=Tok2Cmdname(p->t);
     335    hh.typ=PROC_CMD;
     336    hh.data.pinf=p->p;
     337    sl=iiMake_proc(&hh,NULL,&tmp);
     338    if (sl==NULL) return TRUE;
     339    else
     340    {
     341      res->Copy(sl);
     342      return FALSE;
     343    }
     344  }
     345  return blackbox_default_OpM(op,res,args);
     346}
     347
     348void lClean_newstruct(lists l)
     349{
     350  if (l->nr>=0)
     351  {
     352    int i;
     353    ring r=NULL;
     354    for(i=l->nr;i>=0;i--)
     355    {
     356      if ((i>0) && (l->m[i-1].rtyp==RING_CMD))
     357        r=(ring)(l->m[i-1].data);
     358      else
     359        r=NULL;
     360      l->m[i].CleanUp(r);
     361    }
     362    omFreeSize((ADDRESS)l->m, (l->nr+1)*sizeof(sleftv));
     363    l->nr=-1;
     364  }
     365  omFreeBin((ADDRESS)l,slists_bin);
    282366}
    283367
     
    287371  {
    288372    lists n=(lists)d;
    289     n->Clean();
     373    lClean_newstruct(n);
    290374  }
    291375}
     
    355439}
    356440
     441void newstruct_Print(blackbox *b,void *d)
     442{
     443  newstruct_desc dd=(newstruct_desc)b->data;
     444  newstruct_proc p=dd->procs;
     445  while((p!=NULL)&&(p->t!=PRINT_CMD))
     446    p=p->next;
     447  if (p!=NULL)
     448  {
     449    leftv sl;
     450    sleftv tmp;
     451    memset(&tmp,0,sizeof(tmp));
     452    tmp.rtyp=dd->id;
     453    tmp.data=(void*)newstruct_Copy(b,d);
     454    idrec hh;
     455    memset(&hh,0,sizeof(hh));
     456    hh.id=Tok2Cmdname(p->t);
     457    hh.typ=PROC_CMD;
     458    hh.data.pinf=p->p;
     459    sl=iiMake_proc(&hh,NULL,&tmp);
     460  }
     461  else
     462    blackbox_default_Print(b,d);
     463}
    357464void newstruct_setup(const char *n, newstruct_desc d )
    358465{
    359466  blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox));
    360467  // all undefined entries will be set to default in setBlackboxStuff
    361   // the default Print is quite usefule,
     468  // the default Print is quite useful,
    362469  // all other are simply error messages
    363470  b->blackbox_destroy=newstruct_destroy;
    364471  b->blackbox_String=newstruct_String;
    365   //b->blackbox_Print=blackbox_default_Print;
     472  b->blackbox_Print=newstruct_Print;//blackbox_default_Print;
    366473  b->blackbox_Init=newstruct_Init;
    367474  b->blackbox_Copy=newstruct_Copy;
     
    490597  return scanNewstructFromString(s,res);
    491598}
     599void newstructShow(newstruct_desc d)
     600{
     601  newstruct_member elem;
     602  Print("id: %d\n",d->id);
     603  elem=d->member;
     604  while (elem!=NULL)
     605  {
     606    Print(">>%s<< at pos %d, type %d\n",elem->name,elem->pos,elem->typ);
     607    elem=elem->next;
     608  }
     609}
     610
     611BOOLEAN newstruct_set_proc(const char *bbname,const char *func, int args,procinfov pr)
     612{
     613  int id=0;
     614  blackboxIsCmd(bbname,id);
     615  blackbox *bb=getBlackboxStuff(id);
     616  newstruct_desc desc=(newstruct_desc)bb->data;
     617  newstruct_proc p=(newstruct_proc)omAlloc(sizeof(*p));
     618  p->next=desc->procs; desc->procs=p;
     619  if(!IsCmd(func,p->t))
     620  {
     621    int t=0;
     622    if (func[1]=='\0') p->t=func[0];
     623    else if((t=iiOpsTwoChar(func))!=0)
     624    {
     625      p->t=t;
     626    }
     627    else
     628    {
     629      Werror(">>%s<< is not a kernel command",func);
     630      return TRUE;
     631    }
     632  }
     633  p->args=args;
     634  p->p=pr; pr->ref++;
     635  return FALSE;
     636}
  • Singular/newstruct.h

    r17642b r98d6c3  
    77newstruct_desc newstructFromString(const char *s);
    88newstruct_desc newstructChildFromString(const char *p, const char *s);
     9BOOLEAN newstruct_set_proc(const char *name,const char *func,int args, procinfov p);
     10void newstructShow(newstruct_desc d);
    911
    1012#endif
  • Tst/Short/gcd5primtest.res.gz.uu

    r06c0b3 r98d6c3  
    11begin 644 gcd5primtest.res.gz
    2 M'XL("%2EHD\``V=C9#5P<FEM=&5S="YR97,`C91=3X,P%(;O]RM.%B\8FTC+
     2M'XL("$\EQD\``V=C9#5P<FEM=&5S="YR97,`C91=3X,P%(;O]RM.%B\8FTC+
    33MUPR6"^/-$N/-O#=S?*3)!,(PSAC_NVV'/86Q:9:PMN]Y3Q]X"^OGA]43`)`$
    44M'E?W,&WWK;/CK]-8#%YXR5MK%D_D/R0)%-LTJ!O^UF:BJLP^G'V[:2?KK@5-
    5 MH&ZJ+4A5E8'%RQ;JF:[P'/C2$]\1EX:7!30,O`4<+.(XA,P6D-:QK@IE55WM
     5MH&ZJ+4A5E8'%RQ;JF:[P'/C2$]\1EX:7!30,Z@4<+.(XA,P6D-:QK@IE55WM
    66M/B$E3-;,4%NB1J5&42.NUO*ACU#43GR^UHH3'[(4)SZ#A0E4.Z5P#43KU.!A
    77M`LG.*<R!HHY,!1-;VX7T&[KBDE8[Q44%).O-122108C(F,P-K'Q1(*^G>'1!
    8 M-[C999MT6V4Y6-V*X:"&`YBX2904G,R:XYIBRZM&'`(1;PP<[A@0(@;SN3X1
     8M-[C999MT6V4Y6-V*X:"&`YBX2904G,R:XYIBRZM&'`(&7@P<[A@0(@;SN3X1
    99MGH+59\)75*#B3*E]L#CN[].C)B/+AYI_U&0LQ5`+CYJ>+[L]QF(*.H#1C(*.
    1010M8#2@P$>GD480HL=<[B`N)!2Z@Y)_9!32GJ>?4J@(O_54D.$D2O0#"@6;\0I[
    1111MHCT9^?U6WR8@/Q7R2_"^MY`E<A.SC>^Y`;G<*B+G6M%>*_>/-MZY-GY/,-[L
    12 .*$C@:O(#]O].@PL%````
     12.*$C@:O(#_Z\+1@L%````
    1313`
    1414end
  • Tst/Short/gcd5primtest.stat

    r06c0b3 r98d6c3  
    1 1 >> tst_memory_0 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:299584
    2 1 >> tst_memory_1 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2367488
    3 1 >> tst_memory_2 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2398048
    4 1 >> tst_timer :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:7
    5 2 >> tst_memory_0 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:301424
    6 2 >> tst_memory_1 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2367488
    7 2 >> tst_memory_2 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2398048
    8 2 >> tst_timer :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:6
    9 3 >> tst_memory_0 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:302668
    10 3 >> tst_memory_1 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2367488
    11 3 >> tst_memory_2 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2398048
    12 3 >> tst_timer :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:4
    13 4 >> tst_memory_0 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:302796
    14 4 >> tst_memory_1 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2367488
    15 4 >> tst_memory_2 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:2398048
    16 4 >> tst_timer_1 :: 1336059219:3143- exported :3-1-4:ix86-Linux:mamawutz:18
     11 >> tst_memory_0 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:299584
     21 >> tst_memory_1 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2367488
     31 >> tst_memory_2 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2398048
     41 >> tst_timer :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:7
     52 >> tst_memory_0 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:301144
     62 >> tst_memory_1 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2367488
     72 >> tst_memory_2 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2399076
     82 >> tst_timer :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:5
     93 >> tst_memory_0 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:306644
     103 >> tst_memory_1 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2367488
     113 >> tst_memory_2 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2399076
     123 >> tst_timer :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:12
     134 >> tst_memory_0 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:306772
     144 >> tst_memory_1 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2367488
     154 >> tst_memory_2 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:2399076
     164 >> tst_timer_1 :: 1338385743:3144- exported :3-1-4:ix86-Linux:mamawutz:26
  • Tst/Short/gcd5primtest.tst

    r06c0b3 r98d6c3  
    22proc test5prim (int p)
    33{
    4   ring r= 3, x(1..11), dp;
     4  ring r= p, x(1..11), dp;
    55  poly d1= x(1);
    66  poly d2= x(2);
  • factory/facBivar.cc

    r06c0b3 r98d6c3  
    2727
    2828#ifdef HAVE_NTL
    29 TIMING_DEFINE_PRINT(uni_factorize)
    30 TIMING_DEFINE_PRINT(hensel_lift12)
     29TIMING_DEFINE_PRINT(fac_uni_factorizer)
     30TIMING_DEFINE_PRINT(fac_bi_hensel_lift)
     31TIMING_DEFINE_PRINT(fac_bi_factor_recombination)
    3132
    3233// bound on coeffs of f (cf. Musser: Multivariate Polynomial Factorization,
     
    705706  bool earlySuccess= false;
    706707  CFList earlyFactors;
    707   TIMING_START (fac_hensel_lift);
     708  TIMING_START (fac_bi_hensel_lift);
    708709  uniFactors= henselLiftAndEarly
    709710              (A, earlySuccess, earlyFactors, degs, liftBound,
    710711               uniFactors, dummy, evaluation, b);
    711   TIMING_END_AND_PRINT (fac_hensel_lift, "time for hensel lifting: ");
     712  TIMING_END_AND_PRINT (fac_bi_hensel_lift, "time for hensel lifting: ");
    712713  DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    713714
  • factory/facFactorize.cc

    r06c0b3 r98d6c3  
    113113  Variable v;
    114114  CFList factors;
    115   for (int j= 0; j < A.level() - 2; j++)
    116   {
    117     if (!Aeval[j].isEmpty())
    118     {
    119       v= Variable (Aeval[j].getFirst().level());
    120 
    121       factors= ratBiSqrfFactorize (Aeval[j].getFirst(), w);
    122 
    123       if (factors.getFirst().inCoeffDomain())
    124         factors.removeFirst();
    125 
    126       if (minFactorsLength == 0)
    127         minFactorsLength= factors.length();
    128       else
    129         minFactorsLength= tmin (minFactorsLength, factors.length());
    130 
    131       if (factors.length() == 1)
    132       {
    133         irred= true;
    134         return;
    135       }
    136       sortList (factors, x);
    137       Aeval [j]= factors;
    138     }
     115  CanonicalForm LCA= LC (A,1);
     116  if (!LCA.inCoeffDomain())
     117  {
     118    for (int j= 0; j < A.level() - 2; j++)
     119    {
     120      if (!Aeval[j].isEmpty() && (degree (LCA, j+3) > 0))
     121      {
     122        v= Variable (Aeval[j].getFirst().level());
     123
     124        factors= ratBiSqrfFactorize (Aeval[j].getFirst(), w);
     125
     126        if (factors.getFirst().inCoeffDomain())
     127          factors.removeFirst();
     128
     129        if (minFactorsLength == 0)
     130          minFactorsLength= factors.length();
     131        else
     132          minFactorsLength= tmin (minFactorsLength, factors.length());
     133
     134        if (factors.length() == 1)
     135        {
     136          irred= true;
     137          return;
     138        }
     139        sortList (factors, x);
     140        Aeval [j]= factors;
     141      }
     142      else if (!Aeval[j].isEmpty())
     143      {
     144        Aeval[j]=CFList();
     145      }
     146    }
     147  }
     148  else
     149  {
     150    for (int j= 0; j < A.level() - 2; j++)
     151      Aeval[j]= CFList();
    139152  }
    140153}
  • factory/facFqBivar.cc

    r06c0b3 r98d6c3  
    4545#endif
    4646
    47 TIMING_DEFINE_PRINT(fac_uni_factorizer)
    48 TIMING_DEFINE_PRINT(fac_hensel_lift12)
     47TIMING_DEFINE_PRINT(fac_fq_uni_factorizer)
     48TIMING_DEFINE_PRINT(fac_fq_bi_hensel_lift)
     49TIMING_DEFINE_PRINT(fac_fq_bi_factor_recombination)
    4950
    5051CanonicalForm prodMod0 (const CFList& L, const CanonicalForm& M, const modpk& b)
     
    59125913
    59135914    // univariate factorization
    5914     TIMING_START (fac_uni_factorizer);
     5915    TIMING_START (fac_fq_uni_factorizer);
    59155916    bufUniFactors= uniFactorizer (bufAeval, alpha, GF);
    5916     TIMING_END_AND_PRINT (fac_uni_factorizer,
     5917    TIMING_END_AND_PRINT (fac_fq_uni_factorizer,
    59175918                          "time for univariate factorization: ");
    59185919    DEBOUTLN (cerr, "Lc (bufAeval)*prod (bufUniFactors)== bufAeval " <<
     
    59215922    if (!derivXZero && !fail2)
    59225923    {
    5923       TIMING_START (fac_uni_factorizer);
     5924      TIMING_START (fac_fq_uni_factorizer);
    59245925      bufUniFactors2= uniFactorizer (bufAeval2, alpha, GF);
    5925       TIMING_END_AND_PRINT (fac_uni_factorizer,
     5926      TIMING_END_AND_PRINT (fac_fq_uni_factorizer,
    59265927                            "time for univariate factorization in y: ");
    59275928      DEBOUTLN (cerr, "Lc (bufAeval2)*prod (bufUniFactors2)== bufAeval2 " <<
     
    60846085    bool earlySuccess= false;
    60856086    CFList earlyFactors;
    6086     TIMING_START (fac_hensel_lift12);
     6087    TIMING_START (fac_fq_bi_hensel_lift);
    60876088    uniFactors= henselLiftAndEarly
    60886089               (A, earlySuccess, earlyFactors, degs, liftBound,
    60896090                uniFactors, info, evaluation);
    6090     TIMING_END_AND_PRINT (fac_hensel_lift12, "time for hensel lifting: ");
     6091    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
    60916092    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    60926093
     
    61076108  else if (degree (A) > 4 && beta.level() == 1 && (2*minBound)/degMipo < 32)
    61086109  {
    6109     TIMING_START (fac_hensel_lift12);
     6110    TIMING_START (fac_fq_bi_hensel_lift);
    61106111    if (extension)
    61116112    {
     
    61256126      factors= Union (lll, factors);
    61266127    }
    6127     TIMING_END_AND_PRINT (fac_hensel_lift12, "time for hensel lifting: ");
     6128    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
    61286129    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    61296130  }
     
    61326133    bool earlySuccess= false;
    61336134    CFList earlyFactors;
    6134     TIMING_START (fac_hensel_lift12);
     6135    TIMING_START (fac_fq_bi_hensel_lift);
    61356136    uniFactors= henselLiftAndEarly
    61366137               (A, earlySuccess, earlyFactors, degs, liftBound,
    61376138                uniFactors, info, evaluation);
    6138     TIMING_END_AND_PRINT (fac_hensel_lift12, "time for hensel lifting: ");
     6139    TIMING_END_AND_PRINT (fac_fq_bi_hensel_lift, "time for hensel lifting: ");
    61396140    DEBOUTLN (cerr, "lifted factors= " << uniFactors);
    61406141
  • factory/facFqFactorize.cc

    r06c0b3 r98d6c3  
    3737#include "NTLconvert.h"
    3838
    39 TIMING_DEFINE_PRINT(fac_bi_factorizer)
    40 TIMING_DEFINE_PRINT(fac_hensel_lift)
    41 TIMING_DEFINE_PRINT(fac_factor_recombination)
     39TIMING_DEFINE_PRINT(fac_fq_bi_factorizer)
     40TIMING_DEFINE_PRINT(fac_fq_hensel_lift)
     41TIMING_DEFINE_PRINT(fac_fq_factor_recombination)
    4242
    4343static inline
     
    24122412    bufLift= degree (A, y) + 1 + degree (LC(A, x), y);
    24132413
    2414     TIMING_START (fac_bi_factorizer);
     2414    TIMING_START (fac_fq_bi_factorizer);
    24152415    if (!GF && alpha.level() == 1)
    24162416      bufBiFactors= FpBiSqrfFactorize (bufAeval.getFirst());
     
    24192419    else
    24202420      bufBiFactors= FqBiSqrfFactorize (bufAeval.getFirst(), alpha);
    2421     TIMING_END_AND_PRINT (fac_bi_factorizer,
     2421    TIMING_END_AND_PRINT (fac_fq_bi_factorizer,
    24222422                          "time for bivariate factorization: ");
    24232423    bufBiFactors.removeFirst();
     
    27162716    bool earlySuccess;
    27172717    CFList earlyFactors, liftedFactors;
    2718     TIMING_START (fac_hensel_lift);
     2718    TIMING_START (fac_fq_hensel_lift);
    27192719    liftedFactors= henselLiftAndEarly
    27202720                   (A, MOD, liftBounds, earlySuccess, earlyFactors,
    27212721                    Aeval, biFactors, evaluation, info);
    2722     TIMING_END_AND_PRINT (fac_hensel_lift, "time for hensel lifting: ");
     2722    TIMING_END_AND_PRINT (fac_fq_hensel_lift, "time for hensel lifting: ");
    27232723
    27242724    if (!extension)
    27252725    {
    2726       TIMING_START (fac_factor_recombination);
     2726      TIMING_START (fac_fq_factor_recombination);
    27272727      factors= factorRecombination (A, liftedFactors, MOD);
    2728       TIMING_END_AND_PRINT (fac_factor_recombination,
     2728      TIMING_END_AND_PRINT (fac_fq_factor_recombination,
    27292729                            "time for factor recombination: ");
    27302730    }
    27312731    else
    27322732    {
    2733       TIMING_START (fac_factor_recombination);
     2733      TIMING_START (fac_fq_factor_recombination);
    27342734      factors= extFactorRecombination (liftedFactors, A, MOD, info, evaluation);
    2735       TIMING_END_AND_PRINT (fac_factor_recombination,
     2735      TIMING_END_AND_PRINT (fac_fq_factor_recombination,
    27362736                            "time for factor recombination: ");
    27372737    }
Note: See TracChangeset for help on using the changeset viewer.