Changeset b8f562 in git
- Timestamp:
- Mar 13, 2014, 1:32:13 PM (10 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- b9cb8c8a040ef87acfc952d2d3984a3574c8d888
- Parents:
- 4e56502b6def8f585d698b2aeb301eaf4058b84f12f99241d3dee1439cdbdb7ec86a393c468c17fe
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/grobcov.lib
r12f992 rb8f562 196 196 def RR=basering; 197 197 def @R=basering; // must be of the form K[a][x], a=parameters, x=variables 198 defRx=ringlist(RR);198 list Rx=ringlist(RR); 199 199 def @P=ring(Rx[1]); 200 200 list Lx; … … 210 210 exportto(Top,@RP); // global ring K[x,a] with product order 211 211 setring(RR); 212 } ;212 } 213 213 example 214 214 { "EXAMPLE:"; echo = 2; … … 253 253 if(te){kill @R; kill @RP; kill @P;} 254 254 return(Jc); 255 } ;255 } 256 256 257 257 proc memberpos(f,J) … … 705 705 if(te==0){kill @R; kill @RP; kill @P;} 706 706 return(f2) 707 } ;707 } 708 708 example 709 709 { "EXAMPLE:"; echo = 2; … … 752 752 } 753 753 } 754 } ;754 } 755 755 756 756 // delfromideal: deletes the i-th polynomial from the ideal F … … 857 857 if(te==1){setglobalrings();} 858 858 return(G); 859 } ;859 } 860 860 861 861 // eliminates repeated elements form an ideal or matrix or module or intmat or bigintmat … … 2499 2499 def LP=imap(RR,LPr); 2500 2500 int j; poly p; 2501 defF=ideal(1);2501 ideal F=ideal(1); 2502 2502 poly f; 2503 2503 poly fn; … … 2565 2565 setring(@R); 2566 2566 def ff=imap(RR,f); 2567 defl=factorize(ff,0);2567 list l=factorize(ff,0); 2568 2568 poly f1=1; 2569 2569 for(i=2;i<=size(l[1]);i++) … … 2574 2574 def f2=imap(@R,f1); 2575 2575 return(f2); 2576 } ;2576 } 2577 2577 2578 2578 //Auxiliary routine -
Singular/cntrlc.cc
r12f992 rb8f562 148 148 #else 149 149 struct sigaction new_action,old_action; 150 memset(&new_action, 0, sizeof(struct sigaction)); 150 151 151 152 /* Set up the structure to specify the new action. */ -
Singular/extra.cc
r4e5650 rb8f562 3588 3588 { 3589 3589 #ifdef HAVE_PLURAL 3590 Print("NTL_0:%d (use NTL for gcd of polynomials in char 0)\n",isOn(SW_USE_NTL_GCD_0));3591 Print("NTL_p:%d (use NTL for gcd of polynomials in char p)\n",isOn(SW_USE_NTL_GCD_P));3592 3590 Print("EZGCD:%d (use EZGCD for gcd of polynomials in char 0)\n",isOn(SW_USE_EZGCD)); 3593 3591 Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P)); … … 3605 3603 char *s=(char *)h->Data(); 3606 3604 #ifdef HAVE_PLURAL 3607 if (strcmp(s,"NTL_0")==0) { if (d) On(SW_USE_NTL_GCD_0); else Off(SW_USE_NTL_GCD_0); } else3608 if (strcmp(s,"NTL_p")==0) { if (d) On(SW_USE_NTL_GCD_P); else Off(SW_USE_NTL_GCD_P); } else3609 3605 if (strcmp(s,"EZGCD")==0) { if (d) On(SW_USE_EZGCD); else Off(SW_USE_EZGCD); } else 3610 3606 if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else -
Singular/misc_ip.cc
r4e5650 rb8f562 1168 1168 { 1169 1169 // factory default settings: ----------------------------------------------- 1170 On(SW_USE_NTL);1171 On(SW_USE_NTL_GCD_0); // On -> seg11 in Old/algnorm, Old/factor...1172 On(SW_USE_NTL_GCD_P); // On -> cyle in Short/brnoeth_s: fixed1173 1170 On(SW_USE_EZGCD); 1174 1171 On(SW_USE_CHINREM_GCD); -
Singular/table.h
r12f992 rb8f562 160 160 ,{D(jjidMaxIdeal), MAXID_CMD, IDEAL_CMD, INT_CMD , ALLOW_PLURAL |ALLOW_RING} 161 161 ,{D(jjMEMORY), MEMORY_CMD, BIGINT_CMD, INT_CMD , ALLOW_PLURAL |ALLOW_RING} 162 ,{D(jjidMinBase), MINBASE_CMD, XS(IDEAL_CMD), IDEAL_CMD , NO_PLURAL | ALLOW_RING}163 ,{D(jjidMinBase), MINBASE_CMD, XS(MODUL_CMD), MODUL_CMD , NO_PLURAL | ALLOW_RING}162 ,{D(jjidMinBase), MINBASE_CMD, XS(IDEAL_CMD), IDEAL_CMD , NO_PLURAL |NO_RING} 163 ,{D(jjidMinBase), MINBASE_CMD, XS(MODUL_CMD), MODUL_CMD , NO_PLURAL |NO_RING} 164 164 ,{D(jjMINRES), MINRES_CMD, LIST_CMD, LIST_CMD , ALLOW_PLURAL |ALLOW_RING} 165 165 ,{D(jjMINRES_R), MINRES_CMD, RESOLUTION_CMD, RESOLUTION_CMD, ALLOW_PLURAL |ALLOW_RING} -
factory/cf_chinese.cc
r4e5650 rb8f562 212 212 { 213 213 #ifdef HAVE_NTL 214 if (c.inZ() && isOn (SW_USE_NTL))214 if (c.inZ()) 215 215 { 216 216 ZZ NTLc= convertFacCF2NTLZZ (c); -
factory/cf_defs.h
r4e5650 rb8f562 27 27 const int SW_RATIONAL = 0; 28 28 const int SW_SYMMETRIC_FF = 1; 29 const int SW_BERLEKAMP = 2; 30 const int SW_FAC_QUADRATICLIFT = 3; 31 const int SW_USE_EZGCD = 4; 32 const int SW_USE_EZGCD_P = 5; 33 const int SW_USE_NTL=6; 34 const int SW_USE_NTL_GCD_0=7; 35 const int SW_USE_NTL_GCD_P=8; 36 const int SW_USE_NTL_SORT=9; 37 const int SW_USE_CHINREM_GCD=10; 38 const int SW_USE_QGCD=11; 39 const int SW_USE_FF_MOD_GCD=12; 29 const int SW_USE_EZGCD = 2; 30 const int SW_USE_EZGCD_P = 3; 31 const int SW_USE_NTL_SORT=4; 32 const int SW_USE_CHINREM_GCD=5; 33 const int SW_USE_QGCD=6; 34 const int SW_USE_FF_MOD_GCD=7; 40 35 //}}} 41 36 -
factory/cf_factor.cc
r4e5650 rb8f562 389 389 if ( f.inCoeffDomain() ) 390 390 return CFFList( f ); 391 #ifndef NOASSERT 392 Variable a; 393 ASSERT (!hasFirstAlgVar (f, a), "f has an algebraic variable use factorize \ 394 ( const CanonicalForm & f, const Variable & alpha ) instead"); 395 #endif 391 396 //out_cf("factorize:",f,"==================================\n"); 392 397 if (! f.isUnivariate() ) … … 441 446 else 442 447 #endif 443 if (isOn(SW_USE_NTL) && (isPurePoly(f)))444 448 { 445 449 // USE NTL … … 484 488 } 485 489 } 486 else 490 #else 491 // Use Factory without NTL 492 factoryError ("univariate factorization depends on NTL(missing)"); 493 return CFFList (CFFactor (f, 1)); 487 494 #endif //HAVE_NTL 488 { // Use Factory without NTL489 factoryError ("uniivariate factorization not implemented");490 return CFFList (CFFactor (f, 1));491 }492 495 } 493 496 else … … 518 521 } 519 522 #else 520 ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );521 factoryError ("multivariate factorization not implemented");523 ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" ); 524 factoryError ("multivariate factorization depends on NTL(missing)"); 522 525 return CFFList (CFFactor (f, 1)); 523 526 #endif … … 534 537 { 535 538 #ifdef HAVE_NTL 536 if ((isOn(SW_USE_NTL)) && (isPurePoly(f)))537 {538 //USE NTL539 CanonicalForm ic=icontent(fz);540 fz/=ic;541 ZZ c;542 vec_pair_ZZX_long factors;543 //factorize the converted polynomial 544 factor(c,factors,convertFacCF2NTLZZX(fz));545 546 //convert the result back to Factory547 F=convertNTLvec_pair_ZZX_long2FacCFFList(factors,c,fz.mvar());548 if ( ! ic.isOne() )539 //USE NTL 540 CanonicalForm ic=icontent(fz); 541 fz/=ic; 542 ZZ c; 543 vec_pair_ZZX_long factors; 544 //factorize the converted polynomial 545 factor(c,factors,convertFacCF2NTLZZX(fz)); 546 547 //convert the result back to Factory 548 F=convertNTLvec_pair_ZZX_long2FacCFFList(factors,c,fz.mvar()); 549 if ( ! ic.isOne() ) 550 { 551 if ( F.getFirst().factor().inCoeffDomain() ) 549 552 { 550 if ( F.getFirst().factor().inCoeffDomain() ) 551 { 552 CFFactor new_first( F.getFirst().factor() * ic ); 553 F.removeFirst(); 554 F.insert( new_first ); 555 } 556 else 557 F.insert( CFFactor( ic ) ); 553 CFFactor new_first( F.getFirst().factor() * ic ); 554 F.removeFirst(); 555 F.insert( new_first ); 558 556 } 559 557 else 558 F.insert( CFFactor( ic ) ); 559 } 560 else 561 { 562 if ( !F.getFirst().factor().inCoeffDomain() ) 560 563 { 561 if ( !F.getFirst().factor().inCoeffDomain() ) 562 { 563 CFFactor new_first( 1 ); 564 F.insert( new_first ); 565 } 564 CFFactor new_first( 1 ); 565 F.insert( new_first ); 566 566 } 567 567 } 568 568 #else 569 { 570 factoryError ("univariate factorization over Z not implemented"); 571 return CFFList (CFFactor (f, 1)); 572 } 569 factoryError ("univariate factorization over Z depends on NTL(missing)"); 570 return CFFList (CFFactor (f, 1)); 573 571 #endif 574 572 } … … 588 586 Off (SW_RATIONAL); 589 587 #else 590 factoryError ("multivariate factorization not implemented");588 factoryError ("multivariate factorization depends on NTL(missing)"); 591 589 return CFFList (CFFactor (f, 1)); 592 590 #endif … … 621 619 //out_cf("factorize:",f,"==================================\n"); 622 620 //out_cf("mipo:",getMipo(alpha),"\n"); 621 623 622 CFFList F; 624 ASSERT( alpha.level() < 0, "not an algebraic extension" ); 623 ASSERT( alpha.level() < 0 && getReduce (alpha), "not an algebraic extension" ); 624 #ifndef NOASSERT 625 Variable beta; 626 if (hasFirstAlgVar(f, beta)) 627 ASSERT (!hasFirstAlgVar (f, beta == alpha), "f has an algebraic variable that \ 628 does not coincide with alpha"); 629 #endif 625 630 int ch=getCharacteristic(); 626 631 if (f.isUnivariate()&& (ch>0)) 627 632 { 628 #ifdef HAVE_NTL 629 if (isOn(SW_USE_NTL)) 630 { 631 //USE NTL 632 if (ch>2) 633 { 633 #ifdef HAVE_NTL 634 //USE NTL 635 if (ch>2) 636 { 634 637 #if (HAVE_FLINT && __FLINT_VERSION_MINOR >= 4) 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 638 nmod_poly_t FLINTmipo, leadingCoeff; 639 fq_nmod_ctx_t fq_con; 640 641 nmod_poly_init (FLINTmipo, getCharacteristic()); 642 nmod_poly_init (leadingCoeff, getCharacteristic()); 643 convertFacCF2nmod_poly_t (FLINTmipo, getMipo (alpha)); 644 645 fq_nmod_ctx_init_modulus (fq_con, FLINTmipo, "Z"); 646 fq_nmod_poly_t FLINTF; 647 convertFacCF2Fq_nmod_poly_t (FLINTF, f, fq_con); 648 fq_nmod_poly_factor_t res; 649 fq_nmod_poly_factor_init (res, fq_con); 650 fq_nmod_poly_factor (res, leadingCoeff, FLINTF, fq_con); 651 F= convertFLINTFq_nmod_poly_factor2FacCFFList (res, f.mvar(), alpha, fq_con); 652 F.insert (CFFactor (Lc (f), 1)); 653 654 fq_nmod_poly_factor_clear (res, fq_con); 655 fq_nmod_poly_clear (FLINTF, fq_con); 656 nmod_poly_clear (FLINTmipo); 657 nmod_poly_clear (leadingCoeff); 658 fq_nmod_ctx_clear (fq_con); 656 659 #else 657 // First all cases with characteristic !=2 658 // set remainder 659 if (fac_NTL_char != getCharacteristic()) 660 { 661 fac_NTL_char = getCharacteristic(); 662 zz_p::init(getCharacteristic()); 663 } 664 665 // set minimal polynomial in NTL 666 zz_pX minPo=convertFacCF2NTLzzpX(getMipo(alpha)); 667 zz_pE::init (minPo); 668 669 // convert to NTL 670 zz_pEX f1=convertFacCF2NTLzz_pEX(f,minPo); 671 zz_pE leadcoeff= LeadCoeff(f1); 672 673 //make monic 674 f1=f1 / leadcoeff; 675 676 // factorize using NTL 677 vec_pair_zz_pEX_long factors; 678 CanZass(factors,f1); 679 680 // return converted result 681 F=convertNTLvec_pair_zzpEX_long2FacCFFList(factors,leadcoeff,f.mvar(),alpha); 682 #endif 683 } 684 else if (/*getCharacteristic()*/ch==2) 685 { 686 // special case : GF2 687 688 // remainder is two ==> nothing to do 689 690 // set minimal polynomial in NTL using the optimized conversion routines for characteristic 2 691 GF2X minPo=convertFacCF2NTLGF2X(getMipo(alpha,f.mvar())); 692 GF2E::init (minPo); 693 694 // convert to NTL again using the faster conversion routines 695 GF2EX f1; 696 if (isPurePoly(f)) 697 { 698 GF2X f_tmp=convertFacCF2NTLGF2X(f); 699 f1=to_GF2EX(f_tmp); 700 } 701 else 702 { 703 f1=convertFacCF2NTLGF2EX(f,minPo); 704 } 705 706 // make monic (in Z/2(a)) 707 GF2E f1_coef=LeadCoeff(f1); 708 MakeMonic(f1); 709 710 // factorize using NTL 711 vec_pair_GF2EX_long factors; 712 CanZass(factors,f1); 713 714 // return converted result 715 F=convertNTLvec_pair_GF2EX_long2FacCFFList(factors,f1_coef,f.mvar(),alpha); 660 // First all cases with characteristic !=2 661 // set remainder 662 if (fac_NTL_char != getCharacteristic()) 663 { 664 fac_NTL_char = getCharacteristic(); 665 zz_p::init(getCharacteristic()); 666 } 667 668 // set minimal polynomial in NTL 669 zz_pX minPo=convertFacCF2NTLzzpX(getMipo(alpha)); 670 zz_pE::init (minPo); 671 672 // convert to NTL 673 zz_pEX f1=convertFacCF2NTLzz_pEX(f,minPo); 674 zz_pE leadcoeff= LeadCoeff(f1); 675 676 //make monic 677 f1=f1 / leadcoeff; 678 679 // factorize using NTL 680 vec_pair_zz_pEX_long factors; 681 CanZass(factors,f1); 682 683 // return converted result 684 F=convertNTLvec_pair_zzpEX_long2FacCFFList(factors,leadcoeff,f.mvar(),alpha); 685 #endif 686 } 687 else if (/*getCharacteristic()*/ch==2) 688 { 689 // special case : GF2 690 691 // remainder is two ==> nothing to do 692 693 // set minimal polynomial in NTL using the optimized conversion routines for characteristic 2 694 GF2X minPo=convertFacCF2NTLGF2X(getMipo(alpha,f.mvar())); 695 GF2E::init (minPo); 696 697 // convert to NTL again using the faster conversion routines 698 GF2EX f1; 699 if (isPurePoly(f)) 700 { 701 GF2X f_tmp=convertFacCF2NTLGF2X(f); 702 f1=to_GF2EX(f_tmp); 716 703 } 717 704 else 718 { 719 } 720 } 721 else 722 #endif 723 { 724 factoryError ("univariate factorization not implemented"); 725 return CFFList (CFFactor (f, 1)); 726 } 705 f1=convertFacCF2NTLGF2EX(f,minPo); 706 707 // make monic (in Z/2(a)) 708 GF2E f1_coef=LeadCoeff(f1); 709 MakeMonic(f1); 710 711 // factorize using NTL 712 vec_pair_GF2EX_long factors; 713 CanZass(factors,f1); 714 715 // return converted result 716 F=convertNTLvec_pair_GF2EX_long2FacCFFList(factors,f1_coef,f.mvar(),alpha); 717 } 718 #else 719 factoryError ("univariate factorization depends on NTL(missing)"); 720 return CFFList (CFFactor (f, 1)); 721 #endif //HAVE_NTL 727 722 } 728 723 else if (ch>0) … … 731 726 F= FqFactorize (f, alpha); 732 727 #else 733 ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );734 factoryError ("multivariate factorization not implemented");728 ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" ); 729 factoryError ("multivariate factorization depends on NTL(missing)"); 735 730 return CFFList (CFFactor (f, 1)); 736 731 #endif … … 746 741 F= ratFactorize (f, alpha); 747 742 #else 748 ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );749 factoryError ("multivariate factorization not implemented");743 ASSERT( f.isUnivariate(), "multivariate factorization depends on NTL(missing)" ); 744 factoryError ("multivariate factorization depends on NTL(missing)"); 750 745 return CFFList (CFFactor (f, 1)); 751 746 #endif -
factory/cf_gcd.cc
r4e5650 rb8f562 336 336 } 337 337 #else 338 if ( isOn(SW_USE_NTL_GCD_P) &&( getCharacteristic() > 0 ) && (CFFactory::gettype() != GaloisFieldDomain)338 if (( getCharacteristic() > 0 ) && (CFFactory::gettype() != GaloisFieldDomain) 339 339 && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g)) 340 340 { … … 377 377 } 378 378 #else 379 if ( isOn(SW_USE_NTL_GCD_0) &&( getCharacteristic() ==0)379 if (( getCharacteristic() ==0) 380 380 && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g)) 381 381 { … … 400 400 else 401 401 { 402 Off(SW_USE_NTL_GCD_0); 403 r=extgcd(f,g,a,b); 404 if (isOn(SW_RATIONAL)) 405 { 406 a/=r.lc(); 407 b/=r.lc(); 408 r/=r.lc(); 409 } 410 On(SW_USE_NTL_GCD_0); 402 F1 /= R; 403 G1 /= R; 404 XGCD (RR, A,B,F1,G1,1); 405 rr=convertZZ2CF(RR); 406 a=convertNTLZZX2CF(A,f.mvar())*(fc/rr); 407 b=convertNTLZZX2CF(B,f.mvar())*(gc/rr); 411 408 } 412 409 } … … 422 419 else 423 420 { 424 Off(SW_USE_NTL_GCD_0); 425 r=extgcd(f,g,a,b); 426 if (isOn(SW_RATIONAL)) 427 { 428 a/=r.lc(); 429 b/=r.lc(); 430 r/=r.lc(); 431 } 432 On(SW_USE_NTL_GCD_0); 421 F1 /= R; 422 G1 /= R; 423 XGCD (RR, A,B,F1,G1,1); 424 rr=convertZZ2CF(RR); 425 a=convertNTLZZX2CF(A,f.mvar())*(fc/rr); 426 b=convertNTLZZX2CF(B,f.mvar())*(gc/rr); 433 427 } 434 428 return r; … … 675 669 #else 676 670 #ifdef HAVE_NTL 677 if ( isOn(SW_USE_NTL_GCD_P) &&bpure && (CFFactory::gettype() != GaloisFieldDomain))671 if (bpure && (CFFactory::gettype() != GaloisFieldDomain)) 678 672 return gcd_univar_ntlp(pi, pi1 ) * C; 679 673 #endif … … 794 788 #else 795 789 #ifdef HAVE_NTL 796 if ( isOn(SW_USE_NTL_GCD_0) &&isPurePoly(pi) && isPurePoly(pi1) )790 if (isPurePoly(pi) && isPurePoly(pi1) ) 797 791 return gcd_univar_ntl0(pi, pi1 ) * C; 798 792 #endif -
factory/cf_switches.cc
r4e5650 rb8f562 30 30 // and set the default (recommended) On-values: 31 31 #ifdef HAVE_NTL 32 On(SW_USE_NTL);33 32 On(SW_USE_CHINREM_GCD); 34 //Off(SW_USE_NTL_GCD_0);35 //Off(SW_USE_NTL_GCD_P);36 33 //Off(SW_USE_NTL_SORT); 37 34 #endif -
factory/cf_switches.h
r4e5650 rb8f562 18 18 // 19 19 //}}} 20 const int CFSwitchesMax = 13;20 const int CFSwitchesMax = 8; 21 21 //}}} 22 22 -
libpolys/coeffs/numbers.cc
r12f992 rb8f562 508 508 { 509 509 nInitCharTable=(cfInitCharProc*)omAlloc0( 510 nLastCoeffs*sizeof(cfInitCharProc));510 ((int)nLastCoeffs+1)*sizeof(cfInitCharProc)); 511 511 memcpy(nInitCharTable,nInitCharTableDefault, 512 ( nLastCoeffs-1)*sizeof(cfInitCharProc));512 ((int)nLastCoeffs)*sizeof(cfInitCharProc)); 513 513 } 514 514 else 515 515 { 516 516 nInitCharTable=(cfInitCharProc*)omReallocSize(nInitCharTable, 517 (( (int)nLastCoeffs)-1)*sizeof(cfInitCharProc),518 (( int)nLastCoeffs)*sizeof(cfInitCharProc));517 ((int)nLastCoeffs)*sizeof(cfInitCharProc), 518 (((int)nLastCoeffs)+1)*sizeof(cfInitCharProc)); 519 519 } 520 520 -
libpolys/reporter/reporter.cc
r12f992 rb8f562 135 135 feBufferStart=feBuffer; 136 136 feBuffer_cnt++; 137 assume(feBuffer_cnt<8); 137 138 int l; 138 139 long more; … … 152 153 char *r=feBuffer; 153 154 feBuffer_cnt--; 155 assume(feBuffer_cnt >=0); 154 156 feBuffer=feBuffer_save[feBuffer_cnt]; 155 157 feBufferLength=feBufferLength_save[feBuffer_cnt];
Note: See TracChangeset
for help on using the changeset viewer.