Changeset e4514d3 in git
- Timestamp:
- Jun 17, 2020, 3:40:00 PM (3 years ago)
- Branches:
- (u'spielwiese', '8d54773d6c9e2f1d2593a28bc68b7eeab54ed529')
- Children:
- ed6f2bb0876535189130e32d71be46f776012a36
- Parents:
- 48e0bcb3839c4f7cc786ac37fa187054f053623902eb92fd41522fc551742fd1c1a368263c5401e9
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/idrec.h
r02eb92 re4514d3 48 48 49 49 idrec() { memset(this,0,sizeof(*this)); } 50 inline void Init() { memset(this,0,sizeof(*this)); } 50 51 idhdl get(const char * s, int lev); 51 52 idhdl get_level(const char * s, int lev); -
Singular/iparith.cc
r02eb92 re4514d3 743 743 syMake(v, v->name, pa); 744 744 memcpy(res, v, sizeof(sleftv)); 745 memset(v, 0, sizeof(sleftv));745 v->Init(); 746 746 } 747 747 break; … … 1410 1410 int i; 1411 1411 sleftv t; 1412 memset(&t,0,sizeof(t));1412 t.Init(); 1413 1413 t.rtyp=INT_CMD; 1414 1414 for (i=0;i<iv->length(); i++) … … 1588 1588 static BOOLEAN jjKLAMMER_rest(leftv res, leftv u, leftv v) 1589 1589 { 1590 leftv tmp=(leftv)omAllocBin(sleftv_bin); 1591 memset(tmp,0,sizeof(sleftv)); 1590 leftv tmp=(leftv)omAlloc0Bin(sleftv_bin); 1592 1591 BOOLEAN b; 1593 1592 if (v->Typ()==INTVEC_CMD) … … 1665 1664 u->next=(leftv)omAlloc(sizeof(sleftv)); 1666 1665 memcpy(u->next,v,sizeof(sleftv)); 1667 memset(v,0,sizeof(sleftv));1666 v->Init(); 1668 1667 BOOLEAN bo=iiExprArithM(res,u,'['); 1669 1668 u->next=NULL; … … 2216 2215 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w); 2217 2216 sleftv tmpW; 2218 memset(&tmpW,0,sizeof(sleftv));2217 tmpW.Init(); 2219 2218 tmpW.rtyp=IDTYP(w); 2220 2219 tmpW.data=IDDATA(w); … … 2513 2512 { 2514 2513 sleftv h; 2515 memset(&h,0,sizeof(sleftv));2514 h.Init(); 2516 2515 h.rtyp=INT_CMD; 2517 2516 h.data=(void *)(long)IDELEMS((ideal)v->Data()); … … 4488 4487 valid bound for the prime factors has been given) */ 4489 4488 sleftv tmp; 4490 memset(&tmp, 0, sizeof(tmp));4489 tmp.Init(); 4491 4490 tmp.rtyp = INT_CMD; 4492 4491 return jjPFAC2(res, v, &tmp); … … 4526 4525 // clean out "_": 4527 4526 sLastPrinted.CleanUp(); 4528 memset(&sLastPrinted,0,sizeof(sleftv));4529 4527 // collect all info: 4530 4528 omUpdateInfo(); … … 5710 5708 static BOOLEAN jjBRACK_Ma_I_IV(leftv res, leftv u, leftv v,leftv w) 5711 5709 { 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 5714 5716 leftv p=NULL; 5715 5717 intvec *iv=(intvec *)w->Data(); 5716 5718 int l; 5717 5719 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; 5724 5721 memcpy(&ut,u,sizeof(ut)); 5725 memset(&t,0,sizeof(t)); 5722 sleftv t; 5723 t.Init(); 5726 5724 t.rtyp=INT_CMD; 5727 5725 for (l=0;l< iv->length(); l++) … … 5760 5758 static BOOLEAN jjBRACK_Ma_IV_I(leftv res, leftv u, leftv v,leftv w) 5761 5759 { 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 } 5764 5765 leftv p=NULL; 5765 5766 intvec *iv=(intvec *)v->Data(); 5766 5767 int l; 5767 5768 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; 5774 5770 memcpy(&ut,u,sizeof(ut)); 5775 memset(&t,0,sizeof(t)); 5771 sleftv t; 5772 t.Init(); 5776 5773 t.rtyp=INT_CMD; 5777 5774 for (l=0;l< iv->length(); l++) … … 5810 5807 static BOOLEAN jjBRACK_Ma_IV_IV(leftv res, leftv u, leftv v,leftv w) 5811 5808 { 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 } 5813 5814 leftv p=NULL; 5814 5815 intvec *vv=(intvec *)v->Data(); … … 5818 5819 BOOLEAN nok; 5819 5820 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; 5825 5822 memcpy(&ut,u,sizeof(ut)); 5826 memset(&t1,0,sizeof(sleftv)); 5827 memset(&t2,0,sizeof(sleftv)); 5823 t1.Init(); 5828 5824 t1.rtyp=INT_CMD; 5825 t2.Init(); 5829 5826 t2.rtyp=INT_CMD; 5830 5827 for (vl=0;vl< vv->length(); vl++) … … 5863 5860 v->next=(leftv)omAllocBin(sleftv_bin); 5864 5861 memcpy(v->next,w,sizeof(sleftv)); 5865 memset(w,0,sizeof(sleftv));5862 w->Init(); 5866 5863 return jjPROC(res,u,v); 5867 5864 } … … 5870 5867 u->next=(leftv)omAlloc(sizeof(sleftv)); 5871 5868 memcpy(u->next,v,sizeof(sleftv)); 5872 memset(v,0,sizeof(sleftv));5869 v->Init(); 5873 5870 u->next->next=(leftv)omAlloc(sizeof(sleftv)); 5874 5871 memcpy(u->next->next,w,sizeof(sleftv)); 5875 memset(w,0,sizeof(sleftv));5872 w->Init(); 5876 5873 BOOLEAN bo=iiExprArithM(res,u,'['); 5877 5874 u->next=NULL; … … 5935 5932 i->m[0]=p; 5936 5933 sleftv t; 5937 memset(&t,0,sizeof(t));5934 t.Init(); 5938 5935 t.data=(char *)i; 5939 5936 t.rtyp=IDEAL_CMD; … … 6610 6607 { 6611 6608 sleftv tmp; 6612 memset(&tmp,0,sizeof(tmp));6609 tmp.Init(); 6613 6610 // do not check the result, conversion from int/number to poly works always 6614 6611 iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp); … … 7180 7177 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w); 7181 7178 sleftv tmpW; 7182 memset(&tmpW,0,sizeof(sleftv));7179 tmpW.Init(); 7183 7180 tmpW.rtyp=IDTYP(w); 7184 7181 tmpW.data=IDDATA(w); … … 7552 7549 } 7553 7550 #else 7554 memset(res,0,sizeof(sleftv));7551 res->Init(); 7555 7552 res->rtyp=NONE; 7556 7553 return TRUE; … … 7564 7561 { 7565 7562 memcpy(res,u,sizeof(sleftv)); 7566 memset(u,0,sizeof(sleftv));7563 u->Init(); 7567 7564 return FALSE; 7568 7565 } … … 8180 8177 if ((rest!=NULL) && (!b)) 8181 8178 { 8182 sleftv tmp_res;8183 8179 leftv tmp_next=res->next; 8184 8180 res->next=rest; 8185 memset(&tmp_res,0,sizeof(tmp_res)); 8181 sleftv tmp_res; 8182 tmp_res.Init(); 8186 8183 b = iiExprArithM(&tmp_res,res,iiOp); 8187 8184 memcpy(res,&tmp_res,sizeof(tmp_res)); … … 8354 8351 const struct sConvertTypes *dConvertTypes) 8355 8352 { 8356 memset(res,0,sizeof(sleftv));8357 8353 BOOLEAN call_failed=FALSE; 8358 8354 … … 8513 8509 const struct sConvertTypes *dConvertTypes) 8514 8510 { 8511 res->Init(); 8515 8512 leftv b=a->next; 8516 8513 a->next=NULL; … … 8523 8520 BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall) 8524 8521 { 8525 memset(res,0,sizeof(sleftv));8522 res->Init(); 8526 8523 8527 8524 if (!errorreported) … … 8582 8579 BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1* dA1, int at, const struct sConvertTypes *dConvertTypes) 8583 8580 { 8584 memset(res,0,sizeof(sleftv));8581 res->Init(); 8585 8582 BOOLEAN call_failed=FALSE; 8586 8583 … … 8712 8709 BOOLEAN iiExprArith1(leftv res, leftv a, int op) 8713 8710 { 8714 memset(res,0,sizeof(sleftv));8711 res->Init(); 8715 8712 8716 8713 if (!errorreported) … … 8773 8770 const struct sConvertTypes *dConvertTypes) 8774 8771 { 8775 memset(res,0,sizeof(sleftv));8776 8772 BOOLEAN call_failed=FALSE; 8777 8773 … … 8925 8921 BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c) 8926 8922 { 8927 memset(res,0,sizeof(sleftv));8923 res->Init(); 8928 8924 8929 8925 if (!errorreported) … … 8980 8976 const struct sConvertTypes *dConvertTypes) 8981 8977 { 8978 res->Init(); 8982 8979 leftv b=a->next; 8983 8980 a->next=NULL; … … 9015 9012 BOOLEAN iiExprArithM(leftv res, leftv a, int op) 9016 9013 { 9017 memset(res,0,sizeof(sleftv));9014 res->Init(); 9018 9015 9019 9016 if (!errorreported) … … 9782 9779 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<'); 9783 9780 sleftv tmp; 9784 memset(&tmp,0,sizeof(sleftv));9781 tmp.Init(); 9785 9782 iiOp='<'; 9786 9783 BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes); -
Singular/ipconv.cc
r02eb92 re4514d3 435 435 BOOLEAN iiConvert (int inputType, int outputType, int index, leftv input, leftv output,const struct sConvertTypes *dConvertTypes) 436 436 { 437 memset(output,0,sizeof(sleftv));437 output->Init(); 438 438 if ((inputType==outputType) 439 439 || (outputType==DEF_CMD) … … 441 441 { 442 442 memcpy(output,input,sizeof(*output)); 443 memset(input,0,sizeof(*input));443 input->Init(); 444 444 return FALSE; 445 445 } -
Singular/ipid.cc
r02eb92 re4514d3 269 269 { 270 270 sleftv tmp; 271 memset(&tmp,0,sizeof(sleftv));271 tmp.Init(); 272 272 tmp.rtyp=IDTYP(this); 273 273 tmp.data=IDDATA(this); -
Singular/iplib.cc
r02eb92 re4514d3 398 398 iiCurrArgs=(leftv)omAllocBin(sleftv_bin); 399 399 memcpy(iiCurrArgs,v,sizeof(sleftv)); // keeps track of v->next etc. 400 memset(v,0,sizeof(sleftv));400 v->Init(); 401 401 } 402 402 else … … 740 740 leftv h=(leftv)omAllocBin(sleftv_bin); 741 741 memcpy(h,&iiRETURNEXPR,sizeof(sleftv)); 742 memset(&iiRETURNEXPR,0,sizeof(sleftv));742 iiRETURNEXPR.Init(); 743 743 return h; 744 744 } … … 1190 1190 char FullName[256]; 1191 1191 1192 memset(FullName,0, 256);1192 memset(FullName,0,sizeof(FullName)); 1193 1193 1194 1194 if( *fullname != '/' && *fullname != '.' ) -
Singular/ipshell.cc
r02eb92 re4514d3 204 204 char *s; 205 205 l=strlen(IDSTRING(h)); 206 memset(buffer,0, 22);206 memset(buffer,0,sizeof(buffer)); 207 207 strncpy(buffer,IDSTRING(h),si_min(l,20)); 208 208 if ((s=strchr(buffer,'\n'))!=NULL) … … 652 652 v=(leftv)omAlloc0Bin(sleftv_bin); 653 653 sleftv tmpW; 654 memset(&tmpW,0,sizeof(sleftv));654 tmpW.Init(); 655 655 tmpW.rtyp=IDTYP(w); 656 656 if (tmpW.rtyp==MAP_CMD) … … 891 891 { 892 892 sleftv tmp; 893 memset(&tmp,0,sizeof(tmp));893 tmp.Init(); 894 894 tmp.rtyp=INT_CMD; 895 895 tmp.data=(void *)1; … … 911 911 l->m[0].attribute=*a; 912 912 sleftv tmp2; 913 memset(&tmp2,0,sizeof(tmp2));913 tmp2.Init(); 914 914 tmp2.rtyp=LIST_CMD; 915 915 tmp2.data=(void *)l; … … 998 998 loop 999 999 { 1000 memset(s,0, 80);1000 memset(s,0,BREAK_LINE_LENGTH+4); 1001 1001 fe_fgets_stdin("",s,BREAK_LINE_LENGTH); 1002 1002 if (s[BREAK_LINE_LENGTH-1]!='\0') … … 1049 1049 hwork = (scfmon)omAlloc(hNexist * sizeof(scmon)); 1050 1050 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)); 1052 1052 hrad = hexist; 1053 1053 hNrad = hNexist; … … 1060 1060 { 1061 1061 hCo = hNvar; 1062 memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));1063 1062 hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure); 1064 1063 hLexR(hrad, hNrad, hvar, hNvar); … … 1130 1129 const char *id = name->name; 1131 1130 1132 memset(sy,0,sizeof(sleftv));1131 sy->Init(); 1133 1132 if ((name->name==NULL)||(isdigit(name->name[0]))) 1134 1133 { … … 1194 1193 return FALSE; 1195 1194 sleftv tmp; 1196 memset(&tmp,0,sizeof(sleftv));1195 tmp.Init(); 1197 1196 tmp.rtyp=at->atyp; 1198 1197 tmp.data=at->CopyA(); … … 1583 1582 { 1584 1583 sLastPrinted.CleanUp(); 1585 memset(&sLastPrinted,0,sizeof(sleftv));1586 1584 } 1587 1585 … … 3182 3180 { 3183 3181 sleftv tmp; 3184 memset(&tmp,0,sizeof(tmp));3182 tmp.Init(); 3185 3183 tmp.rtyp=INT_CMD; 3186 3184 tmp.data=(void *)1; … … 4561 4559 { 4562 4560 sleftv tmp; 4563 memset(&tmp,0,sizeof(tmp));4561 tmp.Init(); 4564 4562 tmp.rtyp=INT_CMD; 4565 /* tmp.data = (void *)0; -- done by memset */4563 /* tmp.data = (void *)0; -- done by Init */ 4566 4564 4567 4565 return semicProc3(res,u,v,&tmp); … … 5140 5138 { 5141 5139 sLastPrinted.CleanUp(); 5142 //memset(&sLastPrinted,0,sizeof(sleftv)); // done by Cleanup,Init5143 5140 } 5144 5141 … … 6283 6280 IDRING(currRingHdl)=currRing; 6284 6281 } 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; 6286 6283 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; 6288 6285 u.name=IDID(h); 6289 6286 6290 sleftv res; memset(&res,0,sizeof(res));6287 sleftv res; res.Init(); 6291 6288 if(jjPROC(&res,&u,&v)) 6292 6289 { … … 6387 6384 for(int i=0;i<aa->length(); i++) 6388 6385 { 6389 memset(&tmp_in,0,sizeof(tmp_in));6386 tmp_in.Init(); 6390 6387 tmp_in.rtyp=INT_CMD; 6391 6388 tmp_in.data=(void*)(long)(*aa)[i]; … … 6429 6426 for(int i=0;i<=aa->nr; i++) 6430 6427 { 6431 memset(&tmp_in,0,sizeof(tmp_in));6428 tmp_in.Init(); 6432 6429 tmp_in.Copy(&(aa->m[i])); 6433 6430 if (proc==NULL) … … 6454 6451 BOOLEAN iiApply(leftv res, leftv a, int op, leftv proc) 6455 6452 { 6456 memset(res,0,sizeof(sleftv));6453 res->Init(); 6457 6454 res->rtyp=a->Typ(); 6458 6455 switch (res->rtyp /*a->Typ()*/) … … 6522 6519 sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1); 6523 6520 } 6524 memset(r,0,sizeof(*r));6521 r->Init(); 6525 6522 // now produce procinfo for PROC_CMD: 6526 6523 r->data = (void *)omAlloc0Bin(procinfo_bin); … … 6542 6539 { 6543 6540 sleftv tmp; 6544 memset(&tmp,0,sizeof(tmp));6541 tmp.Init(); 6545 6542 tmp.rtyp=IDHDL; 6546 6543 idhdl h=rDefault(ring_name); … … 6562 6559 sleftv tmp; 6563 6560 sleftv n; 6564 memset(&n,0,sizeof(n));6561 n.Init(); 6565 6562 n.name=ring_name; 6566 6563 if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE; … … 6637 6634 &&(IDTYP((idhdl)source->data)!=RING_CMD)) 6638 6635 { 6639 memset(&iiRETURNEXPR,0,sizeof(sleftv));6636 iiRETURNEXPR.Init(); 6640 6637 iiRETURNEXPR.rtyp=IDTYP((idhdl)source->data); 6641 6638 iiRETURNEXPR.data=IDDATA((idhdl)source->data); -
Singular/newstruct.cc
r02eb92 re4514d3 59 59 { 60 60 sleftv tmp; 61 memset(&tmp,0,sizeof(tmp));61 tmp.Init(); 62 62 tmp.rtyp=ad->id; 63 63 void * newstruct_Copy(blackbox*, void *); //forward declaration 64 64 tmp.data=(void*)newstruct_Copy(b,d); 65 65 idrec hh; 66 memset(&hh,0,sizeof(hh));66 hh.Init(); 67 67 hh.id=Tok2Cmdname(p->t); 68 68 hh.typ=PROC_CMD; … … 182 182 BOOLEAN sl; 183 183 idrec hh; 184 memset(&hh,0,sizeof(hh));184 hh.Init(); 185 185 hh.id=Tok2Cmdname(p->t); 186 186 hh.typ=PROC_CMD; 187 187 hh.data.pinf=p->p; 188 188 sleftv tmp; 189 memset(&tmp,0,sizeof(sleftv));190 189 tmp.Copy(r); 191 190 sl = iiMake_proc(&hh, NULL, &tmp); … … 259 258 { 260 259 idrec hh; 261 memset(&hh,0,sizeof(hh));260 hh.Init(); 262 261 hh.id=Tok2Cmdname(p->t); 263 262 hh.typ=PROC_CMD; … … 438 437 r->start = nm->pos+1; 439 438 memcpy(res,a1,sizeof(sleftv)); 440 memset(a1,0,sizeof(sleftv));439 a1->Init(); 441 440 if (res->e==NULL) res->e=r; 442 441 else … … 446 445 sh->next=r; 447 446 } 448 //a1->CleanUp();// see memsetabove447 //a1->CleanUp();// see Init() above 449 448 a2->CleanUp(); 450 449 return FALSE; … … 469 468 { 470 469 sleftv tmp; 471 memset(&tmp,0,sizeof(sleftv));472 470 tmp.Copy(a1); 473 471 tmp.next=(leftv)omAlloc0(sizeof(sleftv)); 474 472 tmp.next->Copy(a2); 475 473 idrec hh; 476 memset(&hh,0,sizeof(hh));474 hh.Init(); 477 475 hh.id=Tok2Cmdname(p->t); 478 476 hh.typ=PROC_CMD; … … 517 515 { 518 516 idrec hh; 519 memset(&hh,0,sizeof(hh));517 hh.Init(); 520 518 hh.id=Tok2Cmdname(p->t); 521 519 hh.typ=PROC_CMD; … … 613 611 newstruct_desc dd=(newstruct_desc)b->data; 614 612 sleftv l; 615 memset(&l,0,sizeof(l));613 l.Init(); 616 614 l.rtyp=STRING_CMD; 617 615 l.data=(void*)getBlackboxName(dd->id); … … 684 682 BOOLEAN sl; 685 683 sleftv tmp; 686 memset(&tmp,0,sizeof(tmp));684 tmp.Init(); 687 685 tmp.rtyp=dd->id; 688 686 tmp.data=(void*)newstruct_Copy(b,d); 689 687 idrec hh; 690 memset(&hh,0,sizeof(hh));688 hh.Init(); 691 689 hh.id=Tok2Cmdname(p->t); 692 690 hh.typ=PROC_CMD; -
Singular/subexpr.cc
r02eb92 re4514d3 148 148 { 149 149 PrintNSpaces(spaces); 150 const ring r = ( constring)d;150 const ring r = (ring)d; 151 151 rWrite(r, currRing == r); 152 152 break; … … 1830 1830 v->Init(); 1831 1831 v->req_packhdl = currPack; 1832 idhdl h=NULL;1833 1832 #ifdef SIQ 1834 1833 if (siq<=0) … … 1928 1927 { 1929 1928 memcpy(this,&iiRETURNEXPR,sizeof(sleftv)); 1930 memset(&iiRETURNEXPR,0,sizeof(sleftv));1929 iiRETURNEXPR.Init(); 1931 1930 } 1932 1931 } … … 1973 1972 if (!nok) 1974 1973 { 1975 memset(&d->arg1,0,sizeof(sleftv));1974 d->arg1.Init(); 1976 1975 this->CleanUp(); 1977 1976 rtyp=NONE; -
factory/cf_factor.cc
r02eb92 re4514d3 434 434 if (f.isUnivariate()) 435 435 { 436 #ifdef HAVE_FLINT 436 437 #ifdef HAVE_NTL 437 #ifdef HAVE_FLINT438 438 if (degree (f) < 300) 439 { 439 #endif 440 { 441 // use FLINT 440 442 nmod_poly_t f1; 441 443 convertFacCF2nmod_poly_t (f1, f); … … 446 448 nmod_poly_factor_clear (result); 447 449 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) 475 457 { 476 458 // Specialcase characteristic==2 … … 489 471 // convert back to factory again using the faster conversion routine for vectors over GF2X 490 472 F=convertNTLvec_pair_GF2X_long2FacCFFList(factors,LeadCoeff(f1),f.mvar()); 473 if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF); 474 return F; 491 475 } 492 476 } 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) 494 504 // Use Factory without NTL 495 factoryError ("univariate factorization depends on NTL(missing)");505 factoryError ("univariate factorization depends on FLINT/NTL(missing)"); 496 506 return CFFList (CFFactor (f, 1)); 497 #endif //HAVE_NTL498 } 499 else 500 { 501 #if def HAVE_NTL507 #endif 508 } 509 else 510 { 511 #if defined(HAVE_NTL) || defined(HAVE_FLINT) 502 512 if (issqrfree) 503 513 { … … 520 530 } 521 531 #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)"); 524 534 return CFFList (CFFactor (f, 1)); 525 535 #endif … … 572 582 else 573 583 { 574 #ifdef HAVE_NTL575 584 On (SW_RATIONAL); 576 585 if (issqrfree) … … 584 593 F = ratFactorize (fz); 585 594 Off (SW_RATIONAL); 586 #else587 factoryError ("multivariate factorization depends on NTL(missing)");588 return CFFList (CFFactor (f, 1));589 #endif590 595 } 591 596 … … 607 612 } 608 613 609 //out_cff(F);610 614 if(isOn(SW_USE_NTL_SORT)) F.sort(cmpCF); 611 615 return F; … … 633 637 if (ch>0) 634 638 { 635 if (f.isUnivariate() && (ch>0))639 if (f.isUnivariate()) 636 640 { 637 641 #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) 692 643 { 693 644 // special case : GF2 … … 719 670 // return converted result 720 671 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) 723 730 factoryError ("univariate factorization depends on NTL(missing)"); 724 731 return CFFList (CFFactor (f, 1)); … … 727 734 else 728 735 { 729 #ifdef HAVE_NTL730 736 F= FqFactorize (f, alpha); 731 #else732 ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" );733 factoryError ("multivariate factorization depends on NTL(missing)");734 return CFFList (CFFactor (f, 1));735 #endif736 737 } 737 738 } … … 744 745 else //Q(a)[x1,...,xn] 745 746 { 746 #ifdef HAVE_NTL747 747 F= ratFactorize (f, alpha); 748 #else749 ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" );750 factoryError ("multivariate factorization depends on NTL(missing)");751 return CFFList (CFFactor (f, 1));752 #endif753 748 } 754 749 } -
factory/facMul.cc
r02eb92 re4514d3 32 32 #include <NTL/lzz_pEX.h> 33 33 #include "NTLconvert.h" 34 #endif 34 35 35 36 #ifdef HAVE_FLINT … … 452 453 fq_ctx_clear (fq_con); 453 454 return b (result); 454 #else 455 #endif 456 #ifdef HAVE_NTL 455 457 ZZ_p::init (convertFacCF2NTLZZ (b.getpk())); 456 458 ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (mipo)); … … 489 491 } 490 492 return mulFLINTQ (F, G); 491 #else 493 #endif 494 #ifdef HAVE_NTL 492 495 if (b.getp() != 0) 493 496 { … … 569 572 570 573 return b (result); 571 #else 574 #endif 575 #ifdef HAVE_NTL 572 576 ZZ_p::init (convertFacCF2NTLZZ (b.getpk())); 573 577 ZZ_pX NTLmipo= to_ZZ_pX (convertFacCF2NTLZZX (getMipo (alpha))); … … 607 611 ASSERT (F.isUnivariate() && G.isUnivariate(), "expected univariate polys"); 608 612 ASSERT (F.level() == G.level(), "expected polys of same level"); 613 #ifdef HAVE_NTL 609 614 #if (!defined(HAVE_FLINT) || __FLINT_RELEASE < 20400) 610 615 if (fac_NTL_char != getCharacteristic()) … … 613 618 zz_p::init (getCharacteristic()); 614 619 } 620 #endif 615 621 #endif 616 622 Variable alpha; … … 646 652 nmod_poly_clear (FLINTmipo); 647 653 fq_nmod_ctx_clear (fq_con); 648 #else 654 return result; 655 #elif defined(AHVE_NTL) 649 656 zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha)); 650 657 zz_pE::init (NTLMipo); … … 653 660 mul (NTLF, NTLF, NTLG); 654 661 result= convertNTLzz_pEX2CF(NTLF, F.mvar(), alpha); 662 return result; 655 663 #endif 656 664 } … … 665 673 nmod_poly_clear (FLINTF); 666 674 nmod_poly_clear (FLINTG); 667 #else 675 return result; 676 #endif 677 #ifdef HAVE_NTL 668 678 zz_pX NTLF= convertFacCF2NTLzzpX (F); 669 679 zz_pX NTLG= convertFacCF2NTLzzpX (G); 670 680 mul (NTLF, NTLF, NTLG); 671 re sult=convertNTLzzpX2CF(NTLF, F.mvar());672 #endif 673 } 674 return result;681 return convertNTLzzpX2CF(NTLF, F.mvar()); 682 #endif 683 } 684 return F*G; 675 685 } 676 686 … … 3735 3745 // end division 3736 3746 3737 #endif -
libpolys/polys/Makefile.am
r48e0bcb re4514d3 112 112 113 113 templates/p_Procs.inc: p_Procs_Generate.cc 114 $(MAKE) $(AM_MAKEFLAGS) CXX="$(CXX_FOR_BUILD)" p_Procs_Generate114 $(MAKE) $(AM_MAKEFLAGS) CXX="$(CXX_FOR_BUILD)" CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" LDFLAGS="" LIBS="" p_Procs_Generate 115 115 ./p_Procs_Generate$(BUILD_EXEEXT) > ./templates/p_Procs.inc 116 116 -
m4/ax_prog_cxx_for_build.m4
r48e0bcb re4514d3 32 32 # warranty. 33 33 34 #serial 334 #serial 4 35 35 36 36 AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD]) … … 50 50 pushdef([CXX], CXX_FOR_BUILD)dnl 51 51 pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl 52 pushdef([GXX], GXX_FOR_BUILD)dnl 52 53 pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl 53 54 pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl … … 63 64 pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl 64 65 pushdef([ac_cv_host_os], ac_cv_build_os)dnl 65 pushdef([ac_ cxxcpp], ac_build_cxxcpp)dnl66 pushdef([a c_compile], ac_build_compile)dnl67 pushdef([ ac_link], ac_build_link)dnl66 pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl 67 pushdef([am_cv_CXX_dependencies_compiler_type], am_cv_build_CXX_dependencies_compiler_type)dnl 68 pushdef([cross_compiling], cross_compiling_build)dnl 68 69 69 save_cross_compiling=$cross_compiling 70 save_ac_tool_prefix=$ac_tool_prefix 71 cross_compiling=no 72 ac_tool_prefix= 70 cross_compiling_build=no 73 71 72 ac_build_tool_prefix= 73 AS_IF([test -n "$build"], [ac_build_tool_prefix="$build-"], 74 [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"]) 75 76 AC_LANG_PUSH([C++]) 74 77 AC_PROG_CXX 75 78 AC_PROG_CXXCPP 76 79 77 ac_tool_prefix=$save_ac_tool_prefix78 cross_compiling=$save_cross_compiling79 80 80 dnl Restore the old definitions 81 81 dnl 82 popdef([ ac_link])dnl83 popdef([a c_compile])dnl84 popdef([ac_ cxxcpp])dnl82 popdef([cross_compiling])dnl 83 popdef([am_cv_CXX_dependencies_compiler_type])dnl 84 popdef([ac_tool_prefix])dnl 85 85 popdef([ac_cv_host_os])dnl 86 86 popdef([ac_cv_host_vendor])dnl … … 104 104 popdef([ac_cv_prog_CXXCPP])dnl 105 105 106 dnl restore global variables (dependant on the current 107 dnl language after popping): 108 AC_LANG_POP([C++]) 109 106 110 dnl Finally, set Makefile variables 107 111 dnl -
omalloc/Makefile.am
r48e0bcb re4514d3 41 41 42 42 omTables.inc: 43 $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" omTables43 $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" LDFLAGS="$(LDFLAGS_FOR_BUILD)" omTables 44 44 ./omTables$(BUILD_EXEEXT) > omTables.xx && mv omTables.xx omTables.inc 45 45 46 46 omTables.h: 47 $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" omTables147 $(MAKE) $(AM_MAKEFLAGS) CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" LDFLAGS="$(LDFLAGS_FOR_BUILD)" omTables1 48 48 ./omTables1$(BUILD_EXEEXT) >omTables.yy && mv omTables.yy omTables.h 49 49
Note: See TracChangeset
for help on using the changeset viewer.