Changeset ca3864 in git
- Timestamp:
- Jan 21, 2015, 2:54:46 PM (9 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 7023cea48460891d8d8145b55190cccabdc80741
- Parents:
- 4083faab6546fc5c3396c90683e190ab3b4d13274e33058a3cced5901e5f2b51d7435047555c71ca
- Files:
-
- 12 added
- 15 deleted
- 63 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
Makefile.am
r4083fa rca3864 8 8 libpolys gfanlib IntegerProgramming \ 9 9 kernel Singular \ 10 dox emacs de bian redhat desktop10 dox emacs desktop 11 11 12 EXTRA_DIST = README README.md autogen.sh git-version-gen doxy12 EXTRA_DIST = README README.md README.pkg autogen.sh git-version-gen doxy singular.spec.in 13 13 14 14 bin_SCRIPTS = libsingular-config -
Singular/LIB/grwalk.lib
r4e3305 rca3864 255 255 } 256 256 257 proc gwalk(ideal Go, list #)258 "SYNTAX: gwalk(ideal i );259 gwalk(ideal i, int vec v, intvec w);257 proc gwalk(ideal Go, int reduction,int printout, list #) 258 "SYNTAX: gwalk(ideal i, int reduction, int printout); 259 gwalk(ideal i, int reduction, int printout, intvec v, intvec w); 260 260 TYPE: ideal 261 261 PURPOSE: compute the standard basis of the ideal, calculated via … … 284 284 //print("//** help ring = " + string(basering)); 285 285 ideal G = fetch(xR, Go); 286 G = system("Mwalk", G, curr_weight, target_weight,basering );286 G = system("Mwalk", G, curr_weight, target_weight,basering,reduction,printout); 287 287 288 288 setring xR; … … 300 300 ring r = 32003,(z,y,x), lp; 301 301 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 302 gwalk(I );302 gwalk(I,0,1); 303 303 } 304 304 … … 346 346 } 347 347 348 proc fwalk(ideal Go, list #)349 "SYNTAX: fwalk(ideal i );350 fwalk(ideal i, int vec v, intvec w);348 proc fwalk(ideal Go, int reduction, int printout, list #) 349 "SYNTAX: fwalk(ideal i,int reductioin); 350 fwalk(ideal i, int reduction intvec v, intvec w); 351 351 TYPE: ideal 352 352 PURPOSE: compute the standard basis of the ideal w.r.t. the … … 372 372 373 373 ideal G = fetch(xR, Go); 374 G = system("Mfwalk", G, curr_weight, target_weight );374 G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout); 375 375 376 376 setring xR; … … 387 387 ring r = 32003,(z,y,x), lp; 388 388 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 389 fwalk(I); 389 int reduction = 1; 390 int printout = 1; 391 fwalk(I,reduction,printout); 390 392 } 391 393 … … 437 439 } 438 440 439 proc pwalk(ideal Go, int n1, int n2, list #)440 "SYNTAX: pwalk(int d, ideal i, int n1, int n2 );441 pwalk(int d, ideal i, int n1, int n2, int vec v, intvec w);441 proc pwalk(ideal Go, int n1, int n2, int reduction, int printout, list #) 442 "SYNTAX: pwalk(int d, ideal i, int n1, int n2, int reduction, int printout); 443 pwalk(int d, ideal i, int n1, int n2, int reduction, int printout, intvec v, intvec w); 442 444 TYPE: ideal 443 445 PURPOSE: compute the standard basis of the ideal, calculated via … … 477 479 ideal G = fetch(xR, Go); 478 480 481 <<<<<<< HEAD 482 G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout); 483 484 ======= 479 485 G = system("Mpwalk", G, n1, n2, curr_weight, target_weight,nP); 480 486 487 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 481 488 setring xR; 482 489 //kill Go; … … 492 499 ring r = 32003,(z,y,x), lp; 493 500 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 494 //I = std(I); 495 //ring rr = 32003,(z,y,x),lp; 496 //ideal I = fetch(r,I); 497 pwalk(I,2,2); 501 int reduction = 1; 502 int printout = 2; 503 pwalk(I,2,2,reduction,printout); 498 504 } 499 505 -
Singular/LIB/modwalk.lib
-
Property
mode
changed from
100644
to100755
r4e3305 rca3864 16 16 17 17 PROCEDURES: 18 modpWalk(ideal,int,int,int[,int,int,int,int]) standard basis conversion of I in prime characteristic 18 19 modWalk(ideal,int,int[,int,int,int,int]); standard basis conversion of I using modular methods (chinese remainder) 19 20 "; … … 29 30 //////////////////////////////////////////////////////////////////////////////// 30 31 31 static proc modpWalk(def II, int p, int variant, list #)32 proc modpWalk(def II, int p, int variant, int reduction, list #) 32 33 "USAGE: modpWalk(I,p,#); I ideal, p integer, variant integer 33 34 ASSUME: If size(#) > 0, then … … 80 81 } 81 82 } 83 <<<<<<< HEAD 84 ======= 82 85 83 86 //------------------------- make i homogeneous ----------------------------- … … 106 109 } 107 110 111 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 108 112 //------------------------- compute a standard basis mod p ----------------------------- 109 110 113 if(variant == 1) 111 114 { 112 115 if(size(#)>0) 113 116 { 114 i = rwalk(i,radius,pert_deg,#); 115 // rwalk(i,radius,pert_deg,#); std(i); 117 i = rwalk(i,radius,pert_deg,reduction,#); 116 118 } 117 119 else 118 120 { 119 i = rwalk(i,radius,pert_deg );121 i = rwalk(i,radius,pert_deg,reduction); 120 122 } 121 123 } … … 124 126 if(size(#) == 2) 125 127 { 126 i = gwalk(i, #);128 i = gwalk(i,reduction,#); 127 129 } 128 130 else 129 131 { 130 i = gwalk(i );132 i = gwalk(i,reduction); 131 133 } 132 134 } … … 135 137 if(size(#) == 2) 136 138 { 137 i = frandwalk(i,radius, #);139 i = frandwalk(i,radius,reduction,#); 138 140 } 139 141 else 140 142 { 141 i = frandwalk(i,radius );143 i = frandwalk(i,radius,reduction); 142 144 } 143 145 } … … 157 159 if(size(#) == 2) 158 160 { 159 i=prwalk(i,radius,pert_deg,pert_deg, #);161 i=prwalk(i,radius,pert_deg,pert_deg,reduction,#); 160 162 } 161 163 else 162 164 { 163 i=prwalk(i,radius,pert_deg,pert_deg );165 i=prwalk(i,radius,pert_deg,pert_deg,reduction); 164 166 } 165 167 } … … 168 170 if(size(#) == 2) 169 171 { 170 i=pwalk(i,pert_deg,pert_deg, #);172 i=pwalk(i,pert_deg,pert_deg,reduction,#); 171 173 } 172 174 else 173 175 { 176 <<<<<<< HEAD 177 i=pwalk(i,pert_deg,pert_deg,reduction); 178 ======= 174 179 i=pwalk(i,pert_deg,pert_deg); 175 180 } … … 189 194 kill HomR; 190 195 } 191 } 192 } 196 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 197 } 198 } 199 193 200 setring R0; 194 201 return(list(fetch(@r,i),p)); … … 204 211 ring ra = 0,x(1..4),(a(a),lp); 205 212 ideal I = std(cyclic(4)); 213 int reduction = 1; 206 214 ring rb = 0,x(1..4),(a(b),lp); 207 215 ideal I = imap(ra,I); 208 modpWalk(I,p,1, a,b);216 modpWalk(I,p,1,reduction,a,b); 209 217 std(I); 210 218 } … … 212 220 //////////////////////////////////////////////////////////////////////////////// 213 221 214 proc modWalk(def II, int variant, list #)222 proc modWalk(def II, int variant, int reduction, list #) 215 223 "USAGE: modWalk(II); II ideal or list(ideal,int) 216 224 ASSUME: If variant = … … 487 495 if(n2 > 4) 488 496 { 489 //L[5] = prime(random(an,en));497 L[5] = prime(random(an,en)); 490 498 } 491 499 if(printlevel >= 10) … … 504 512 for(i=1; i<=size(L); i++) 505 513 { 506 Arguments[i] = list(II,L[i],variant, list(curr_weight,target_weight));514 Arguments[i] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 507 515 } 508 516 } … … 511 519 for(i=1; i<=size(L); i++) 512 520 { 513 Arguments[i] = list(II,L[i],variant );521 Arguments[i] = list(II,L[i],variant,reduction); 514 522 } 515 523 } … … 528 536 //------------------- Now all leading ideals are the same -------------------- 529 537 //------------------- Lift results to basering via farey --------------------- 530 531 538 tt = timer; rt = rtimer; 532 539 N = T2[1]; … … 545 552 546 553 //---------------- Test if we already have a standard basis of I -------------- 547 548 554 tt = timer; rt = rtimer; 549 pTest = pTestSB(I,J,L,variant); 550 //pTest = primeTestSB(I,J,L,variant); 555 pTest = primeTest(J, prime(random(1000000000,2134567879))); 551 556 if(printlevel >= 10) 552 557 { … … 596 601 } 597 602 //-------------- We do not already have a standard basis of I, therefore do the main computation for more primes -------------- 598 599 603 T1 = H; 600 604 T2 = N; … … 613 617 for(i=j; i<=size(L); i++) 614 618 { 615 //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight)); 616 Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight)); 619 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 617 620 } 618 621 } … … 621 624 for(i=j; i<=size(L); i++) 622 625 { 623 //Arguments[i-j+1] = list(II,L[i],variant); 624 Arguments[size(Arguments)+1] = list(II,L[i],variant); 626 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction); 625 627 } 626 628 } … … 632 634 for(i=1; i<=size(PP); i++) 633 635 { 634 //P[size(P) + 1] = PP[i];635 636 T1[size(T1) + 1] = PP[i][1]; 636 637 T2[size(T2) + 1] = bigint(PP[i][2]); … … 649 650 echo = 2; 650 651 ring R=0,(x,y,z),lp; 651 ideal I= -x+y2z-z,xz+1,x2+y2-1;652 // I is a standard basis in dp653 ideal J = modWalk(I,1 );652 ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 653 int reduction = 0; 654 ideal J = modWalk(I,1,1); 654 655 J; 655 656 } … … 772 773 return(J); 773 774 } 774 ////////////////////////////////////////////////////////////////////////////////// 775 static proc primeTestSB(def II, ideal J, list L, int variant, list #) 776 "USAGE: primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 777 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 778 J mod p is (resp. is not) a standard basis of I mod p 779 EXAMPLE: example primeTestSB; shows an example 780 " 781 { 782 if(typeof(II) == "ideal") 783 { 784 ideal I = II; 785 int radius = 2; 786 } 787 if(typeof(II) == "list") 788 { 789 ideal I = II[1]; 790 int radius = II[2]; 791 } 792 793 int i,j,k,p; 794 def R = basering; 795 list r = ringlist(R); 796 797 while(!j) 798 { 799 j = 1; 800 p = prime(random(1000000000,2134567879)); 801 for(i = 1; i <= size(L); i++) 802 { 803 if(p == L[i]) 804 { 805 j = 0; 806 break; 807 } 808 } 809 if(j) 810 { 811 for(i = 1; i <= ncols(I); i++) 812 { 813 for(k = 2; k <= size(I[i]); k++) 814 { 815 if((denominator(leadcoef(I[i][k])) mod p) == 0) 816 { 817 j = 0; 818 break; 819 } 820 } 821 if(!j) 822 { 823 break; 824 } 825 } 826 } 827 if(j) 828 { 829 if(!primeTest(I,p)) 830 { 831 j = 0; 832 } 833 } 834 } 835 r[1] = p; 836 def @R = ring(r); 837 setring @R; 838 ideal I = imap(R,I); 839 ideal J = imap(R,J); 840 attrib(J,"isSB",1); 841 842 int t = timer; 843 j = 1; 844 if(isIncluded(I,J) == 0) 845 { 846 j = 0; 847 } 848 if(printlevel >= 11) 849 { 850 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 851 "j = "+string(j); 852 } 853 t = timer; 854 if(j) 855 { 856 if(size(#) > 0) 857 { 858 ideal K = modpWalk(I,p,variant,#)[1]; 859 } 860 else 861 { 862 ideal K = modpWalk(I,p,variant)[1]; 863 } 864 t = timer; 865 if(isIncluded(J,K) == 0) 866 { 867 j = 0; 868 } 869 if(printlevel >= 11) 870 { 871 "isIncluded(K,J) takes "+string(timer - t)+" seconds"; 872 "j = "+string(j); 873 } 874 } 875 setring R; 876 877 return(j); 878 } 879 example 880 { "EXAMPLE:"; echo = 2; 881 intvec L = 2,3,5; 882 ring r = 0,(x,y,z),lp; 883 ideal I = x+1,x+y+1; 884 ideal J = x+1,y; 885 primeTestSB(I,I,L,1); 886 primeTestSB(I,J,L,1); 887 } 888 889 //////////////////////////////////////////////////////////////////////////////// 890 static proc pTestSB(ideal I, ideal J, list L, int variant, list #) 891 "USAGE: pTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int 892 RETURN: 1 (resp. 0) if for a randomly chosen prime p that is not in L 893 J mod p is (resp. is not) a standard basis of I mod p 894 EXAMPLE: example pTestSB; shows an example 895 " 896 { 897 int i,j,k,p; 898 def R = basering; 899 list r = ringlist(R); 900 901 while(!j) 902 { 903 j = 1; 904 p = prime(random(1000000000,2134567879)); 905 for(i = 1; i <= size(L); i++) 906 { 907 if(p == L[i]) { j = 0; break; } 908 } 909 if(j) 910 { 911 for(i = 1; i <= ncols(I); i++) 912 { 913 for(k = 2; k <= size(I[i]); k++) 914 { 915 if((denominator(leadcoef(I[i][k])) mod p) == 0) { j = 0; break; } 916 } 917 if(!j){ break; } 918 } 919 } 920 if(j) 921 { 922 if(!primeTest(I,p)) { j = 0; } 923 } 924 } 925 r[1] = p; 926 def @R = ring(r); 927 setring @R; 928 ideal I = imap(R,I); 929 ideal J = imap(R,J); 930 attrib(J,"isSB",1); 931 932 int t = timer; 933 j = 1; 934 if(isIncluded(I,J) == 0) { j = 0; } 935 936 if(printlevel >= 11) 937 { 938 "isIncluded(I,J) takes "+string(timer - t)+" seconds"; 939 "j = "+string(j); 940 } 941 942 t = timer; 943 if(j) 944 { 945 if(size(#) > 0) 946 { 947 ideal K = modpStd(I,p,variant,#[1])[1]; 948 } 949 else 950 { 951 ideal K = groebner(I); 952 } 953 t = timer; 954 if(isIncluded(J,K) == 0) { j = 0; } 955 956 if(printlevel >= 11) 957 { 958 "isIncluded(J,K) takes "+string(timer - t)+" seconds"; 959 "j = "+string(j); 960 } 961 } 962 setring R; 963 return(j); 964 } 965 example 966 { "EXAMPLE:"; echo = 2; 967 intvec L = 2,3,5; 968 ring r = 0,(x,y,z),dp; 969 ideal I = x+1,x+y+1; 970 ideal J = x+1,y; 971 pTestSB(I,I,L,2); 972 pTestSB(I,J,L,2); 973 } 775 974 776 //////////////////////////////////////////////////////////////////////////////// 975 777 static proc mixedTest() -
Property
mode
changed from
-
Singular/LIB/normaliz.lib
r4083fa rca3864 1 1 //// Singular library normaliz.lib 2 2 3 version="version normaliz.lib 4.0. 0.0 Jun_2013"; // $Id$3 version="version normaliz.lib 4.0.1.0 Jan_2015 "; // $Id$ 4 4 category="Commutative Algebra"; 5 5 info=" 6 LIBRARY: normaliz.lib Provides an interface for the use of Normaliz 2. 77 within SINGULAR.8 AUTHORS: 9 6 LIBRARY: normaliz.lib Provides an interface for the use of Normaliz 2.8 or 7 newer within SINGULAR. 8 AUTHORS: Winfried Bruns, Winfried.Bruns@Uni-Osnabrueck.de 9 Christof Soeger, Christof.Soeger@Uni-Osnabrueck.de 10 10 11 11 OVERVIEW: 12 The library normaliz.lib provides an interface for the use of Normaliz 2.7 13 within SINGULAR. The exchange of data is via files. 12 @texinfo 13 The library normaliz.lib provides an interface for the use of Normaliz 2.8 or 14 newer within SINGULAR. The exchange of data is via files. 14 15 In addition to the top level 15 16 functions that aim at objects of type ideal or ring, several other auxiliary 16 17 functions allow the user to apply Normaliz to data of type intmat. Therefore 17 18 SINGULAR can be used as a comfortable environment for the work with Normaliz. 18 @* Please see the @code{Normaliz 2.7Documentation.pdf} (included in the Normaliz19 @* Please see the @code{Normaliz.pdf} (included in the Normaliz 19 20 distribution) for a more extensive documentation of Normaliz. 20 @code{nmz_sing.pdf} describes this library version 2.2, but most points are 21 still valid. 22 23 @*Singular and Normaliz exchange data via files. These files are automatically 21 22 Normaliz allows the use of a grading. In the Singular functions that access 23 Normaliz the parameter grading is an intvec that assigns a (not necessarily 24 positive) degree to every variable of the ambient polynomial ring. 25 But it must give positive degrees to the generators given to function. 26 27 Singular and Normaliz exchange data via files. These files are automatically 24 28 created and erased behind the scenes. As long as one wants to use only the 25 29 ring-theoretic functions there is no need for file management. 26 27 30 @*Note that the numerical invariants computed by Normaliz can be 28 31 accessed in this \"automatic file mode\". 29 30 32 @*However, if Singular is used as a frontend for Normaliz or the user 31 33 wants to inspect data not automatically returned to Singular, then … … 34 36 Deletion of the files is left to the user. 35 37 36 @*Use of this library requires the program Normaliz to be installed.38 Use of this library requires the program Normaliz to be installed. 37 39 You can download it from 38 40 @uref{http://www.mathematik.uni-osnabrueck.de/normaliz/}. Please make sure 39 41 that the executables are in the search path or use setNmzExecPath 40 42 (@ref{setNmzExecPath}). 41 42 KEYWORDS: integral closure; normalization 43 @end texinfo 44 45 KEYWORDS: integral closure; normalization; toric ring 43 46 44 47 PROCEDURES: … … 50 53 elements of I 51 54 normalToricRingFromBinomials(ideal I) computes the normalization of the 52 polynomial ring modulo the unique minimal prime 53 ideal of the binomial ideal I 54 ehrhartRing(ideal I) computes the monomials representing the lattice 55 points of the polytop generated leading monomials 56 of the elements of I 57 intclMonIdeal(ideal I) the exponent vectors of the leading monomials of 58 the elements of I are considered as generators of 59 a monomial ideal whose Rees algebra is computed 60 55 polynomial ring modulo the unique minimal binomial 56 prime ideal of the binomial ideal I 57 ehrhartRing(ideal I) considers the exponent vectors of the elements of I 58 as points of a lattice polytope and computes the 59 integral cloure of the polytopal algebra 60 intclMonIdeal(ideal I) Computes the integral closure of the Rees algebra 61 of the ideal generated by the leading monomials of 62 the elements of I 61 63 torusInvariants(intmat T) computes the ring of invariants of a torus action 62 64 finiteDiagInvariants(intmat C) computes the ring of invariants of a finite … … 70 72 intersectionValRingIdeals(intmat V) computes ideals of monomial valuations 71 73 72 showNuminvs() prints the numerical invariants 73 exportNuminvs() exports the numerical invariants 74 showNuminvs() prints the numerical invariants found by Normaliz 75 exportNuminvs() exports the numerical invariants found by Normaliz 74 76 75 77 setNmzOption(string s, int onoff) sets the option s to onoff … … 237 239 desString("nmz_data_path",nmz_data_path_name); 238 240 nmz_data_path=appendSlash(nmz_data_path); 239 }example 241 } 242 example 240 243 { "EXAMPLE:";echo = 2; 241 244 setNmzDataPath("examples/"); … … 395 398 { 396 399 f=getNmzFile()+"."+suffixes[i]; 397 if (fileExists(f)) { dummy=system("sh","rm "+f+ "&> /dev/null"); } 400 if (fileExists(f)) 401 { 402 dummy=system("sh","rm "+f+ "&> /dev/null"); 403 } 398 404 } 399 405 } … … 580 586 for (int k=1; k+1<=size(#); k=k+2) { 581 587 //get data from the parameter list 582 sgr = #[k]; 583 num_rows = nrows(sgr); 584 num_cols = ncols(sgr); 585 n_mode = #[k+1]; 586 587 write(outf,num_rows); 588 write(outf,num_cols); 589 590 for(i=1;i<=nrows(sgr);i++) 591 { 592 s=""; 593 for(j=1;j<=num_cols;j++) 594 { 595 s=s+string(sgr[i,j])+" "; 596 } 597 write(outf,s); 598 } 599 write(outf,n_mode); 600 write(outf,""); 588 n_mode = #[k+1]; 589 if (n_mode != -1) { //skip -1 mode 590 sgr = #[k]; 591 num_rows = nrows(sgr); 592 num_cols = ncols(sgr); 593 594 write(outf,num_rows); 595 write(outf,num_cols); 596 597 for(i=1;i<=nrows(sgr);i++) 598 { 599 s=""; 600 for(j=1;j<=num_cols;j++) 601 { 602 s=s+string(sgr[i,j])+" "; 603 } 604 write(outf,s); 605 } 606 if (n_mode == 20) { 607 write(outf,"grading"); 608 } else { 609 write(outf,n_mode); 610 } 611 write(outf,""); 612 } 601 613 } 602 614 close(outf); 615 } 616 617 618 static proc prepareGrading(list #) 619 { 620 if (size(#)==0) { 621 return(0,-1); // mode -1 specifies discard the matrix 622 } 623 if (size(#)>1) { 624 print(#); 625 ERROR("To many parameters!"); 626 } 627 intmat g = intmat(#[1],1,size(#[1])); 628 return (g,20); 603 629 } 604 630 … … 611 637 mode. See the Normaliz documentation for more information. 612 638 613 It is also possible to give more than one pair of matrix and mode. In 614 this case all matrices and modes are written. This can be used to 615 combine modes 4,5,6. 639 It is also possible to give more than one pair of matrix and mode. In 640 this case all matrices and modes are written. This can be used to 641 combine modes 4,5,6. 642 Use mode=20 to specify a grading. 616 643 NOTE: Needs an explicit filename set. The filename is created from the 617 644 current filename. … … 677 704 (n_cols,p)=getInt(s,p); 678 705 if (n_rows <= 0 || n_cols <= 0) { 679 680 681 } 682 706 intmat empty; 707 return(empty); 708 } 709 intmat nmz_gen[n_rows][n_cols]; 683 710 for(i=1;i<=n_rows;i++) 684 711 { … … 696 723 intmat sgrnormal=normaliz(sgr,0); 697 724 readNmzData("cst"); 698 readNmzData("typ");699 725 } 700 726 … … 714 740 list nmz_options= 715 741 list("supp",0,"-s",0), 716 list("triang",0,"- v",0),717 list("volume",0,"- V",0),742 list("triang",0,"-tT",0), 743 list("volume",0,"-v",0), 718 744 list("hvect",0,"-p",0), 719 list("hvect_l",0,"-P",0),720 745 list("height1",0,"-1",0), 721 746 list("normal",0,"-n",1), 722 747 list("normal_l",0,"-N",1), 723 748 list("hilb",0,"-h",1), 724 list("hilb_l",0,"-H",1),725 749 list("dual",0,"-d",1), 726 750 list("control",0,"-c",2), … … 739 763 The Normaliz options are accessible via the following names: 740 764 @* @code{-s: supp} 741 @* @code{- v: triang}742 @* @code{- V: volume}765 @* @code{-t: triang} 766 @* @code{-v: volume} 743 767 @* @code{-p: hvect} 744 @* @code{-P: hvect_l}745 768 @* @code{-1: height1} 746 769 @* @code{-n: normal} 747 770 @* @code{-N: normal_l} 748 771 @* @code{-h: hilb} 749 @* @code{-H: hilb_l}750 772 @* @code{-d: dual} 751 773 @* @code{-a: allf} … … 788 810 { 789 811 run_options=run_options+nmz_options[i][3]; 790 791 792 793 812 if (nmz_options[i][1]=="threads") { 813 run_options=run_options+string(nmz_options[i][2]); 814 } 815 run_options=run_options+" "; 794 816 if(nmz_options[i][4]!=2) 795 817 { … … 818 840 819 841 820 static proc runNormaliz(intmat sgr, defnmz_mode, list #)842 static proc runNormaliz(intmat sgr, int nmz_mode, list #) 821 843 { 822 844 if(!queryInt("nmz_files_keep_switch")) … … 876 898 877 899 It is also possible to give more than one pair of matrix and mode. In 878 this case all matrices and modes are used. This can be used to 879 combine modes 4,5,6. 900 this case all matrices and modes are used. This can be used to 901 combine modes 4,5,6. 902 Use nmz_mode=20 to specify a grading. 880 903 NOTE: You will find procedures for many applications of Normaliz in this 881 904 library, so the explicit call of this procedure may not be necessary. 882 905 SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal, 883 906 torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings, 884 907 intersectionValRingIdeals 885 908 EXAMPLE: example normaliz; shows an example 886 909 " … … 935 958 name_inv="h_vector"; 936 959 } 937 if(name_inv!="hilbert_polynomial") 960 if(name_inv!="hilbert_polynomial" 961 && name_inv!="hilbert_quasipolynomial") 938 962 { 939 963 for(i=1;i<=v_length;i++) … … 961 985 (sw,p)=nextWord(s,p); 962 986 name_inv=s[sw..p-1]; 963 (dummy_int,p)=getInt(s,p); 964 num_invs=num_invs+list(list(name_inv,dummy_int,"int")); 987 if (name_inv!="hilbert_quasipolynomial_denom") { 988 (dummy_int,p)=getInt(s,p); 989 num_invs=num_invs+list(list(name_inv,dummy_int,"int")); 990 } 965 991 } 966 992 if(type_inv=="boolean") … … 1000 1026 { "EXAMPLE:"; echo=2; 1001 1027 ring R=0,(x,y,z,t),dp; 1002 ideal I=x ^2,y^2,z^3;1028 ideal I=x3,x2y,y3; 1003 1029 list l=intclMonIdeal(I); 1004 1030 showNuminvs(); … … 1029 1055 { "EXAMPLE:"; echo=2; 1030 1056 ring R=0,(x,y,z,t),dp; 1031 ideal I=x ^2,y^2,z^3;1057 ideal I=x3,x2y,y3; 1032 1058 list l=intclMonIdeal(I); 1033 1059 exportNuminvs(); 1034 // now the following variables are set:1060 // for example, now the following variables are set: 1035 1061 nmz_hilbert_basis_elements; 1036 1062 nmz_number_extreme_rays; … … 1038 1064 nmz_index; 1039 1065 nmz_number_support_hyperplanes; 1040 nmz_ homogeneous;1066 nmz_multiplicity; 1041 1067 nmz_primary; 1042 nmz_ideal_multiplicity;1043 1068 } 1044 1069 … … 1137 1162 if(expo_vecs[i,ncols(expo_vecs)]==d) 1138 1163 { 1139 1140 1164 m=1; 1141 1165 for(j=1;j<=ncols(expo_vecs)-1;j++) … … 1146 1170 } 1147 1171 } 1148 1149 1172 mons=simplify(mons,2); // get rid of starting 0 1173 return(mons); 1150 1174 } 1151 1175 … … 1155 1179 RETURN: Returns the intmat whose rows represent the exponents of the 1156 1180 (non-zero) elements of I which have to be binomials. 1157 1181 The length of each row is nvars(basering). 1158 1182 SEE ALSO: mons2intmat, intmat2mons 1159 1183 EXAMPLE: example binomials2intmat; shows an example" 1160 1184 { 1161 int i,j,k; 1162 intmat expo_vecs[size(I)][nvars(basering)]; 1163 intvec expo_v; 1164 1165 k=0; 1166 poly f; 1167 1168 for(i=1; i<=ncols(I); i++) 1169 { 1170 if( I[i] != 0 ) 1171 { 1172 k++; 1173 f = I[i]; 1174 if (leadcoef(f) != 1) {f = -f}; //works in all characteristics 1175 if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1) 1176 { 1177 ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i])); 1178 } 1179 expo_v = leadexp(f)-leadexp(f[2]); 1180 for(j=1;j<=nvars(basering);j++) 1181 { 1182 expo_vecs[k,j]=expo_v[j]; 1183 } 1184 } 1185 } 1186 return(expo_vecs); 1185 int i,j,k; 1186 intmat expo_vecs[size(I)][nvars(basering)]; 1187 intvec expo_v; 1188 1189 k=0; 1190 poly f; 1191 1192 for(i=1; i<=ncols(I); i++) 1193 { 1194 if( I[i] != 0 ) 1195 { 1196 k++; 1197 f = I[i]; 1198 if (leadcoef(f) != 1) {f = -f}; //works in all characteristics 1199 if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1) 1200 { 1201 ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i])); 1202 } 1203 1204 expo_v = leadexp(f)-leadexp(f[2]); 1205 for(j=1;j<=nvars(basering);j++) 1206 { 1207 expo_vecs[k,j]=expo_v[j]; 1208 } 1209 } 1210 } 1211 return(expo_vecs); 1187 1212 } 1188 1213 example … … 1196 1221 // integral closure of rings and ideals 1197 1222 1198 static proc runIntclToricRing(ideal I, int nmz_mode )1223 static proc runIntclToricRing(ideal I, int nmz_mode, list #) 1199 1224 { 1200 1225 intmat expo_vecs=mons2intmat(I); 1201 1226 1202 1227 string dummy=collectNmzOptions(); // only to set GenGen 1203 1204 return( intmat2mons( runNormaliz(expo_vecs,nmz_mode) ) ); 1205 } 1206 1207 proc intclToricRing(ideal I) 1228 return( intmat2mons( runNormaliz(expo_vecs,nmz_mode, prepareGrading(#)) ) ); 1229 } 1230 1231 proc intclToricRing(ideal I, list #) 1208 1232 "USAGE: intclToricRing(ideal I); 1209 RETURN: The toric ring S is the subalgebra of the basering generated by the 1210 leading monomials of the elements of I. The function computes the 1211 integral closure T of S in the basering and returns an ideal listing 1233 intclToricRing(ideal I, intvec grading); 1234 RETURN: The toric ring S is the subalgebra of the basering generated by 1235 the leading monomials of the elements of I (considered as a list 1236 of polynomials). The function computes the integral 1237 closure T of S in the basering and returns an ideal listing 1212 1238 the algebra generators of T over the coefficient field. 1213 1239 @* The function returns the input ideal I if one of the options 1214 @code{supp}, @code{triang}, or @code{hvect} has been activated. 1240 @code{supp}, @code{triang}, @code{volume}, or @code{hseries} 1241 has been activated. 1215 1242 However, in this case some numerical invariants are computed, and 1216 1243 some other data may be contained in files that you can read into … … 1222 1249 " 1223 1250 { 1224 return(runIntclToricRing(I,0 ));1251 return(runIntclToricRing(I,0,#)); 1225 1252 } 1226 1253 example … … 1229 1256 ideal I=x3,x2y,y3; 1230 1257 intclToricRing(I); 1231 } 1232 1233 proc normalToricRing(ideal I) 1258 showNuminvs(); 1259 //now the same example with another grading 1260 intvec grading = 2,3,1; 1261 intclToricRing(I,grading); 1262 showNuminvs(); 1263 1264 } 1265 1266 proc normalToricRing(ideal I, list #) 1234 1267 "USAGE: normalToricRing(ideal I); 1268 normalToricRing(ideal I, intvec grading); 1235 1269 RETURN: The toric ring S is the subalgebra of the basering generated by the 1236 leading monomials of the elements of I. The function computes the 1270 leading monomials of the elements of I (considered as a list of 1271 polynomials). The function computes the 1237 1272 normalisation T of S and returns an ideal listing the algebra 1238 1273 generators of T over the coefficient field. 1239 1274 @* The function returns the input ideal I if one of the options 1240 @code{supp}, @code{triang}, or @code{hvect} has been activated. 1275 @code{supp}, @code{triang}, @code{volume}, or @code{hseries} 1276 has been activated. 1241 1277 However, in this case some numerical invariants are computed, and 1242 1278 some other data may be contained in files that you can read into … … 1248 1284 " 1249 1285 { 1250 return(runIntclToricRing(I,1 ));1286 return(runIntclToricRing(I,1,#)); 1251 1287 } 1252 1288 example … … 1258 1294 1259 1295 1260 proc normalToricRingFromBinomials(ideal I )1296 proc normalToricRingFromBinomials(ideal I, list #) 1261 1297 "USAGE: normalToricRingFromBinomials(ideal I); 1262 RETURN: 1298 normalToricRingFromBinomials(ideal I, intvec grading); 1299 RETURN: @texinfo 1263 1300 @tex 1264 1301 The ideal $I$ is generated by binomials of type $X^a-X^b$ (multiindex notation) … … 1278 1315 generators of the normalization of $K[N]$. 1279 1316 @end tex 1317 @end texinfo 1280 1318 @* The function returns the input ideal I if one of the options 1281 @code{supp}, @code{triang}, or @code{hvect} has been activated. 1319 @code{supp}, @code{triang}, @code{volume}, or @code{hseries} 1320 has been activated. 1282 1321 However, in this case some numerical invariants are computed, and 1283 1322 some other data may be contained in files that you can read into 1284 Singular .1323 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1285 1324 SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal 1286 1325 EXAMPLE: example normalToricRing; shows an example 1287 1326 " 1288 1327 { 1289 1290 1291 intmat result = runNormaliz(expo_vecs,10);1292 1293 1294 1295 1296 1297 1328 intmat expo_vecs = binomials2intmat(I); 1329 string dummy=collectNmzOptions(); // only to set GenGen 1330 intmat result = runNormaliz(expo_vecs,10,prepareGrading(#)); 1331 1332 list baseringlist = ringlist(basering); 1333 ring S = (baseringlist[1]),(x(1..ncols(result))),dp; 1334 ideal I = intmat2mons(result); 1335 export(I); 1336 return (S); 1298 1337 } 1299 1338 example … … 1306 1345 } 1307 1346 1308 static proc runIntclMonIdeal(ideal I, int nmz_mode )1347 static proc runIntclMonIdeal(ideal I, int nmz_mode, list #) 1309 1348 { 1310 1349 intmat expo_vecs=mons2intmat(I); … … 1324 1363 1325 1364 //adjust size of input matrix 1326 if (!last_comp) { // remove last component 1327 intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1] = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)]; 1328 expo_vecs = tmp; 1329 } 1330 intmat nmz_data=runNormaliz(expo_vecs,nmz_mode); 1365 if (!last_comp) { // remove last component 1366 intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1] 1367 = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)]; 1368 expo_vecs = tmp; 1369 } 1370 intmat nmz_data=runNormaliz(expo_vecs,nmz_mode,prepareGrading(#)); 1331 1371 1332 1372 if(last_comp) … … 1346 1386 "USAGE: ehrhartRing(ideal I); 1347 1387 RETURN: The exponent vectors of the leading monomials of the elements of I 1348 are considered as vertices of a lattice polytope P.1388 are considered as points of a lattice polytope P. 1349 1389 The Ehrhart ring of a (lattice) polytope P is the monoid algebra 1350 1390 defined by the monoid of lattice points in the cone over the … … 1355 1395 treated as the auxiliary variable of the Ehrhart ring. The 1356 1396 function returns two ideals, the first containing the monomials 1357 representing the lattice points of the polytope, the second1397 representing all the lattice points of the polytope, the second 1358 1398 containing the algebra generators of the Ehrhart ring over the 1359 1399 coefficient field. 1360 1400 @* (ii) If the last ring variable is used by the monomials, the list 1361 1401 returned contains only one ideal, namely the monomials … … 1363 1403 @* 1364 1404 @* The function returns the a list containing the input ideal I if one 1365 of the options @code{supp}, @code{triang}, or @code{hvect} has been1366 1405 of the options @code{supp}, @code{triang}, @code{volume}, or 1406 @code{hseries} has been activated. 1367 1407 However, in this case some numerical invariants are computed, and 1368 1408 some other data may be contained in files that you can read into 1369 Singular .1409 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1370 1410 NOTE: A mathematical remark: the Ehrhart ring depends on the list of 1371 1411 monomials given, and not only on the ideal they generate! … … 1383 1423 } 1384 1424 1385 proc intclMonIdeal(ideal I )1425 proc intclMonIdeal(ideal I, list #) 1386 1426 "USAGE: intclMonIdeal(ideal I); 1427 intclMonIdeal(ideal I, intvec grading); 1387 1428 RETURN: The exponent vectors of the leading monomials of the elements of I 1388 1429 are considered as generators of a monomial ideal for which the … … 1400 1441 closure of the ideal. 1401 1442 @* The function returns the a list containing the input ideal I if one 1402 of the options @code{supp}, @code{triang}, or @code{hvect} has been1403 1443 of the options @code{supp}, @code{triang}, @code{volume}, or 1444 @code{hseries} has been activated. 1404 1445 However, in this case some numerical invariants are computed, and 1405 1446 some other data may be contained in files that you can read into … … 1409 1450 " 1410 1451 { 1411 return(runIntclMonIdeal(I,3 ));1452 return(runIntclMonIdeal(I,3,#)); 1412 1453 } 1413 1454 example … … 1422 1463 // torus invariants and valuation rings and ideals 1423 1464 1424 proc torusInvariants(intmat E )1465 proc torusInvariants(intmat E, list #) 1425 1466 "USAGE: torusInvariants(intmat A); 1426 RETURN: 1467 torusInvariants(intmat A, intvec grading); 1468 RETURN: @texinfo 1427 1469 Returns an ideal representing the list of monomials generating the ring of 1428 1470 invariants as an algebra over the coefficient field. … … 1430 1472 $R^T$. 1431 1473 @end tex 1432 @*The function returns the ideal given by the input matrix A if one of 1433 the options @code{supp}, @code{triang}, or @code{hvect} has been 1434 activated. 1435 However, in this case some numerical invariants are computed, and 1436 some other data may be contained in files that you can read into 1437 Singular. 1438 BACKGROUND: 1474 @* The function returns the ideal given by the input matrix A if one of 1475 the options @code{supp}, @code{triang}, @code{volume}, or 1476 @code{hseries} has been activated. 1477 However, in this case some numerical invariants are computed, and 1478 some other data may be contained in files that you can read into 1479 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1480 @end texinfo 1481 BACKGROUND: @texinfo 1439 1482 @tex 1440 1483 Let $T = (K^*)^r$ be the $r$-dimensional torus acting on the polynomial ring … … 1447 1490 $A=(a_{i,j})$. 1448 1491 @end tex 1492 @end texinfo 1449 1493 SEE ALSO: diagInvariants, finiteDiagInvariants, intersectionValRings, 1450 1494 intersectionValRingIdeals … … 1459 1503 string dummy=collectNmzOptions(); // only to set GenGen 1460 1504 1461 return( intmat2mons( runNormaliz(E,5 ) ) );1505 return( intmat2mons( runNormaliz(E,5,prepareGrading(#)) ) ); 1462 1506 } 1463 1507 example … … 1468 1512 } 1469 1513 1470 proc finiteDiagInvariants(intmat C )1514 proc finiteDiagInvariants(intmat C, list #) 1471 1515 "USAGE: finiteDiagInvariants(intmat U); 1472 RETURN: 1516 finiteDiagInvariants(intmat U, intvec grading); 1517 RETURN: @texinfo 1473 1518 @tex 1474 1519 This function computes the ring of invariants of a finite abelian group $G$ … … 1485 1530 {$R^G=\{f\in R : g_i f = f$ for all $i=1,\ldots,w\}$}. 1486 1531 @end tex 1487 @*The function returns the ideal given by the input matrix C if one of 1488 the options @code{supp}, @code{triang}, or @code{hvect} has been 1489 activated. 1490 However, in this case some numerical invariants are computed, and 1491 some other data may be contained in files that you can read into 1492 Singular. 1532 @end texinfo 1533 @* The function returns the ideal given by the input matrix C if one of 1534 the options @code{supp}, @code{triang}, @code{volume}, or 1535 @code{hseries} has been activated. 1536 However, in this case some numerical invariants are computed, and 1537 some other data may be contained in files that you can read into 1538 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1493 1539 NOTE: 1494 1540 SEE ALSO: torusInvariants, diagInvariants, intersectionValRings, 1495 intersectionValRingIdeals ,showNuminvs,exportNuminvs1541 intersectionValRingIdeals 1496 1542 EXAMPLE: example finiteDiagInvariants; shows an example 1497 1543 " … … 1504 1550 string dummy=collectNmzOptions(); // only to set GenGen 1505 1551 1506 return( intmat2mons( runNormaliz(C,6 ) ) );1552 return( intmat2mons( runNormaliz(C,6,prepareGrading(#)) ) ); 1507 1553 } 1508 1554 example … … 1513 1559 } 1514 1560 1515 proc diagInvariants(intmat E, intmat C )1561 proc diagInvariants(intmat E, intmat C, list #) 1516 1562 "USAGE: diagInvariants(intmat A, intmat U); 1517 RETURN: 1563 diagInvariants(intmat A, intmat U, intvec grading); 1564 RETURN: @texinfo 1518 1565 @tex 1519 1566 This function computes the ring of invariants of a diagonalizable group … … 1525 1572 monomial ideal listing the algebra generators of the subalgebra of invariants. 1526 1573 @end tex 1527 @*The function returns the ideal given by the input matrix A if one of 1528 the options @code{supp}, @code{triang}, or @code{hvect} has been 1529 activated. 1530 However, in this case some numerical invariants are computed, and 1531 some other data may be contained in files that you can read into 1532 Singular. 1533 SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals,showNuminvs,exportNuminvs 1574 @end texinfo 1575 @* The function returns the ideal given by the input matrix A if one of 1576 the options @code{supp}, @code{triang}, @code{volume}, or 1577 @code{hseries} has been activated. 1578 However, in this case some numerical invariants are computed, and 1579 some other data may be contained in files that you can read into 1580 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1581 SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals 1534 1582 EXAMPLE: example diagInvariants; shows an example 1535 1583 " … … 1542 1590 string dummy=collectNmzOptions(); // only to set GenGen 1543 1591 1544 return( intmat2mons( runNormaliz(E,5,C,6 ) ) );1592 return( intmat2mons( runNormaliz(E,5,C,6,prepareGrading(#)) ) ); 1545 1593 } 1546 1594 example … … 1552 1600 } 1553 1601 1554 proc intersectionValRings(intmat V )1555 "USAGE: intersectionValRings(intmat V );1602 proc intersectionValRings(intmat V, list #) 1603 "USAGE: intersectionValRings(intmat V, intvec grading); 1556 1604 RETURN: The function returns a monomial ideal, to be considered as the list 1557 1605 of monomials generating @math{S} as an algebra over the coefficient 1558 1606 field. 1559 BACKGROUND: 1607 BACKGROUND: @texinfo 1560 1608 @tex 1561 1609 A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by … … 1565 1613 its input. 1566 1614 @end tex 1567 @*The function returns the ideal given by the input matrix V if one of 1568 the options @code{supp}, @code{triang}, or @code{hvect} has been 1569 activated. 1570 However, in this case some numerical invariants are computed, and 1571 some other data may be contained in files that you can read into 1572 Singular. 1573 SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals,showNuminvs,exportNuminvs 1615 @end texinfo 1616 @* The function returns the ideal given by the input matrix V if one of 1617 the options @code{supp}, @code{triang}, @code{volume}, or 1618 @code{hseries} has been activated. 1619 However, in this case some numerical invariants are computed, and 1620 some other data may be contained in files that you can read into 1621 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1622 SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals 1574 1623 EXAMPLE: example intersectionValRings; shows an example 1575 1624 " … … 1601 1650 /* if(!GenGen) // return V 1602 1651 { 1603 runNormaliz(V1,4 );1652 runNormaliz(V1,4,prepareGrading(#)); 1604 1653 return(V); 1605 1654 } 1606 1655 */ 1607 return(intmat2mons(runNormaliz(V1,4 )));1656 return(intmat2mons(runNormaliz(V1,4,prepareGrading(#)))); 1608 1657 } 1609 1658 example … … 1614 1663 } 1615 1664 1616 proc intersectionValRingIdeals(intmat V )1665 proc intersectionValRingIdeals(intmat V, list #) 1617 1666 "USAGE: intersectionValRingIdeals(intmat V); 1667 intersectionValRingIdeals(intmat V, intvec grading); 1618 1668 RETURN: The function returns two ideals, both to be considered as lists of 1619 monomials which generate an algebra over the coefficient field. The1669 monomials. The 1620 1670 first is the system of monomial generators of @math{S}, the second 1621 1671 the system of generators of @math{M}. … … 1626 1676 some other data may be contained in files that you can read into 1627 1677 Singular (see @ref{showNuminvs}, @ref{exportNuminvs}). 1628 BACKGROUND: 1678 BACKGROUND: @texinfo 1629 1679 @tex 1630 1680 A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by … … 1639 1689 The numbers $w_i$ form the $(n+1)$th column of the input matrix. 1640 1690 @end tex 1691 @end texinfo 1641 1692 NOTE: The function also gives an error message if the matrix V has the 1642 1693 wrong number of columns. … … 1671 1722 string dummy=collectNmzOptions(); // only to set GenGen 1672 1723 1673 intmat nmz_data=runNormaliz(V1,4 );1724 intmat nmz_data=runNormaliz(V1,4,prepareGrading(#)); 1674 1725 1675 1726 ideal I1=intmat2monsSel(nmz_data,0); -
Singular/LIB/primdec.lib
r4083fa rca3864 1197 1197 for(@n=1;@n<=size(lres0) div 2;@n++) 1198 1198 { 1199 if(specialIdealsEqual(lres0[2*@n-1],lres0[2*@n])==1) 1200 { 1201 lres0[2*@n-1]=groebner(lres0[2*@n-1]); 1202 lres0[2*@n]=lres0[2*@n-1]; 1203 attrib(lres0[2*@n],"isSB",1); 1204 } 1205 else 1206 { 1207 lres0[2*@n-1]=groebner(lres0[2*@n-1]); 1208 lres0[2*@n]=groebner(lres0[2*@n]); 1209 } 1199 lres0[2*@n-1]=groebner(lres0[2*@n-1]); 1200 lres0[2*@n]=groebner(lres0[2*@n]); 1210 1201 } 1211 1202 } … … 1889 1880 rl[1]=list(p, 1890 1881 list(rl2[nnp+1..nvars(basering)]), 1891 1892 1882 list(list("lp",1:(nvars(basering)-nnp))), 1883 ideal(0)); 1893 1884 rl[2]=list(rl2[1..nnp]); 1894 1885 rl[3]=list(list(order,1:nnp),list("C",0)); … … 1897 1888 { 1898 1889 if (typeof(rl[1])=="list") 1899 list rl1=rl[1]; 1900 list rl2=rl[2]; 1901 rl1[1]=list(rl1[1][1], 1902 rl[1][2]+list(rl2[nnp+1..nvars(basering)]), 1903 list(list("lp",1:(size(rl[1][2])+nvars(basering)-nnp))), 1904 ideal(0)); 1905 rl[1]=rl1; 1906 rl[2]=list(rl2[1..nnp]); 1907 rl[3]=list(list(order,1:nnp),list("C",0)); 1908 } 1890 { 1891 list rl1=rl[1]; 1892 list rl2=rl[2]; 1893 rl1=list(rl1[1][1], 1894 rl[1][2]+list(rl2[nnp+1..nvars(basering)]), 1895 list(list("lp",1:(size(rl[1][2])+nvars(basering)-nnp))), 1896 ideal(0)); 1897 rl[1]=rl1; 1898 rl[2]=list(rl2[1..nnp]); 1899 rl[3]=list(list(order,1:nnp),list("C",0)); 1900 } 1901 else 1902 { 1903 ERROR("Unexpected case in prepareQuotientring. Please inform the authors"); 1904 } 1905 } 1906 1909 1907 def quotring=ring(rl); 1910 1908 return(quotring); … … 1953 1951 i=qr[1]; 1954 1952 1955 execute ("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),(" 1956 +ordstr(basering)+");"); 1957 1953 def gnir=ring(ringlist(@P)); 1954 setring gnir; 1958 1955 1959 1956 ideal i=fetch(@P,i); … … 2425 2422 &&(find(ordstr(basering),"s")==0)) 2426 2423 { 2427 execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),("2428 +ordstr(basering)+");");2424 def gnir=ring(ringlist(basering)); 2425 setring gnir; 2429 2426 ideal i=imap(P,i); 2430 2427 ideal j=i; … … 2530 2527 &&(find(ordstr(basering),"s")==0)) 2531 2528 { 2532 execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),("2533 +ordstr(basering)+");");2529 def gnir=ring(ringlist(basering)); 2530 setring gnir; 2534 2531 ideal i=imap(P,i); 2535 2532 ideal j=i; … … 2644 2641 ASSUME(0, not isQuotientRing(basering) ) ; 2645 2642 ASSUME(0, hasGlobalOrdering(basering) ) ; 2643 2644 // the really needed things: 2645 ASSUME(1, typeof(ringlist(basering)[1])=="list"); // in alg. extension 2646 2646 2647 2647 //reduces primery decomposition over algebraic extensions to … … 2688 2688 } 2689 2689 //---Ende Provisorium 2690 string mp="poly @p="+string(minpoly)+";"; 2691 string gnir="ring RH="+string(char(R))+",("+varstr(R)+","+string(par(1)) 2692 +"),dp;"; 2693 execute(gnir); 2694 execute(mp); 2690 list R_l=ringlist(R); 2691 ideal @p=R_l[1][4]; // minpoly 2692 R_l[2]=R_l[2]+R_l[1][2]; // vars 2693 R_l[1]=R_l[1][1]; // char 2694 R_l[3]=list(list("dp",1:size(R_l[2])),list("C",0)); // ord 2695 def RH=ring(R_l); kill R_l;setring RH; 2696 ideal @pp=imap(R,@p); poly @p=@pp[1]; 2695 2697 ideal i=imap(R,i); 2696 2698 ideal I=subst(i,var(nvars(basering)),0); … … 2704 2706 setring R; 2705 2707 kill RH; 2706 kill gnir; 2707 string gnir="ring RH="+string(char(R))+",("+varstr(R)+"),dp;"; 2708 execute(gnir); 2708 // remove extension, set order to dp: 2709 list R_l=ringlist(R); 2710 R_l[1]=R_l[1][1]; // char 2711 R_l[3]=list(list("dp",1:nvars(R)),list("C",0)); // ord 2712 def RH=ring(R_l); kill R_l; setring RH; 2709 2713 ideal i=imap(R,i); 2710 2714 ideal J; … … 2732 2736 if(n<nvars(basering)) 2733 2737 { 2734 gnir="ring RS="+string(char(R))+",("+varstr(RH) 2735 +"),(dp("+string(n)+"),lp);"; 2736 execute(gnir); 2738 // remove extension, set order to dp(n),lp: 2739 list R_l=ringlist(basering); 2740 if (typeof(R_l[1])=="list") { R_l[1]=R_l[1][1]; } 2741 R_l[3]=list(list("dp",1:n),list("lp",1:(nvars(basering)-n)),list("C",0)); 2742 def RS=ring(R_l); kill R_l; setring RS; 2737 2743 list pr=imap(RH,pr); 2738 2744 ideal K; … … 3136 3142 if(ordstr(@P)[1]=="w") 3137 3143 { 3138 execute("ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),("+ordstr(@P)+");"); 3144 list gnir_l=ringlist(gnir); 3145 list @P_l=ringlist(@P); 3146 gnir_l[3]=@P_l[3]; // ord 3147 def @Phelp=ring(gnir_l); 3148 setring @Phelp; 3149 kill gnir_l,@P_l; 3139 3150 } 3140 3151 else … … 3177 3188 //change the ring 3178 3189 { 3179 execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("3180 +ordstr(basering)+");");3190 def gnir1=ring(ringlist(basering)); 3191 setring gnir1; 3181 3192 ideal @j=fetch(gnir,@j); 3182 3193 attrib(@j,"isSB",1); … … 3492 3503 //change the ring 3493 3504 { 3494 execute("ring gnir1 = ("+charstr(basering)+"),("+3495 varstr(basering)+"),("+ordstr(basering)+");");3505 def gnir1=ring(ringlist(basering)); 3506 setring gnir1; 3496 3507 ideal @j=fetch(gnir,jkeep); 3497 3508 attrib(@j,"isSB",1); … … 3851 3862 3852 3863 /////////////////////////////////////////////////////////////////////////////// 3853 3864 proc zeroRad(ideal I,list #) 3854 3865 "USAGE: zeroRad(I) , I a zero-dimensional ideal 3855 3856 3857 EXAMPLE: example zeroRad; shows an example 3866 RETURN: the radical of I 3867 NOTE: Algorithm of Kemper 3868 EXAMPLE: example zeroRad; shows an example" 3858 3869 { 3859 3870 ASSUME(0, hasFieldCoefficient(basering) ); … … 3891 3902 for(i=1;i<=n;i++) 3892 3903 { 3893 3894 3895 3904 l[i]=sep(F[i],i); 3905 F[i]=l[i][1]; 3906 if(l[i][2]>k){k=l[i][2];} //computation of the maximal k 3896 3907 } 3897 3908 3898 3909 if((k==0)||(m==0)) //the separable case 3899 3910 { 3900 intvec save=option(get);option(redSB); 3901 I=interred(I+F);option(set,save);return(I); 3911 intvec save=option(get); 3912 option(redSB); 3913 I=interred(I+F); 3914 option(set,save); 3915 return(I); 3902 3916 } 3903 3917 //I=simplify(I,1); … … 3912 3926 ideal F=imap(R,F); 3913 3927 3914 string nR1="ring @S1="+string(p)+",("+varstr(R)+","+parstr(R)+",@y(1..m)),dp;"; 3915 execute(nR1); 3916 list lR=ringlist(@S1)[2]; 3917 lR=lR[(size(lR)-m+1)..(size(lR))]; 3918 3919 string nR="ring @S="+string(p)+",("+string(lR)+","+varstr(R)+","+parstr(R)+"),dp;"; 3928 string nR="ring @S="+string(p)+",(@y(1..m),"+varstr(R)+","+parstr(R)+"),dp;"; 3920 3929 execute(nR); 3921 3930 … … 3928 3937 for(i=1;i<=m;i++) 3929 3938 { 3930 3931 3939 J=J,var(i)^k-var(m+n+i); 3940 el=el*var(i); 3932 3941 } 3933 3942 … … 4117 4126 4118 4127 if(n < 0) 4119 { 4120 ideal ann = ideal(1); 4121 return(ann); 4122 } 4128 { 4129 return(ideal(1)); 4130 } 4123 4131 int l = size(re); 4124 4132 4125 4133 if(n < l) 4126 { 4127 matrix f = transpose(re[n+1]); 4128 if(n == 0) 4129 { 4130 matrix g = 0*gen(ncols(f)); 4131 } 4132 else 4133 { 4134 matrix g = transpose(re[n]); 4135 } 4136 module k = syz(f); 4137 ideal ann = quotient1(g,k); 4138 return(ann); 4139 } 4134 { 4135 matrix f = transpose(re[n+1]); 4136 if(n == 0) 4137 { 4138 matrix g = matrix(0,1,ncols(f)); 4139 } 4140 else 4141 { 4142 matrix g = transpose(re[n]); 4143 } 4144 module k = syz(f); 4145 return(quotient1(g,k)); 4146 } 4140 4147 4141 4148 if(n == l) 4142 { 4143 ideal ann = Ann(transpose(re[n])); 4144 return(ann); 4145 } 4146 4147 ideal ann = ideal(1); 4148 return(ann); 4149 { 4150 return(Ann(transpose(re[n]))); 4151 } 4152 4153 return(ideal(1)); 4149 4154 } 4150 4155 /////////////////////////////////////////////////////////////////////////////// … … 6278 6283 //change the ring 6279 6284 { 6280 execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("6281 +ordstr(basering)+");");6285 def gnir1=ring(ringlist(basering)); 6286 setring gnir1; 6282 6287 ideal @j = fetch(@P, I); 6283 6288 attrib(@j, "isSB", 1); … … 6824 6829 matrix n=imap(R,n); 6825 6830 time = timer; 6826 poly charpol=det(n- T*freemodule(d));6831 poly charpol=det(n-var(1)*freemodule(d)); 6827 6832 dbprint(printlevel-voice+2,"// time for computing char poly: "+ 6828 6833 string(timer-time)); … … 6856 6861 option(redSB); 6857 6862 list re1; 6858 ideal new = T-imap(R,p),imap(R,J);6863 ideal new = var(1)-imap(R,p),imap(R,J); 6859 6864 attrib(new, "isSB",1); //we know that new is a standard basis 6860 6865 for(j=1;j<=f;j++) … … 7040 7045 7041 7046 op@P = option(get); 7042 execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),(C,lp);"); 7047 def gnir=changeordTo(basering,"lp"); 7048 setring gnir; 7043 7049 7044 7050 op=option(get); … … 7142 7148 if (intersectOption == "intersect") 7143 7149 { 7144 list pr = result[1];7145 ideal intersection = result[2];7150 list pr = result[1]; 7151 ideal intersection = result[2]; 7146 7152 } 7147 7153 else … … 7338 7344 if(ordstr(@P)[1]=="w") 7339 7345 { 7340 execute("ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),("+ordstr(@P)+");"); 7346 def @Phelp=ring(ringlist(gnir)); 7347 setring @Phelp; 7341 7348 } 7342 7349 else 7343 7350 { 7344 execute( "ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),(C,dp);"); 7351 def @Phelp=changeordTo(gnir,"dp"); 7352 setring @Phelp; 7345 7353 } 7346 7354 … … 7517 7525 //change the ring 7518 7526 { 7519 execute("ring gnir1 = ("+charstr(basering)+"),("+7520 varstr(basering)+"),("+ordstr(basering)+");");7527 def gnir1=ring(ringlist(basering)); 7528 setring gnir1; 7521 7529 ideal @j=fetch(gnir,jkeep); 7522 7530 attrib(@j,"isSB",1); … … 7856 7864 //change the ring 7857 7865 { 7858 execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("7859 +ordstr(basering)+");");7866 def gnir1=ring(ringlist(basering)); 7867 setring gnir1; 7860 7868 ideal @j = fetch(gnir, @j); 7861 7869 attrib(@j,"isSB",1); -
Singular/LIB/ring.lib
r4083fa rca3864 33 33 isQuotientRing(rng) ring is a qotient ring 34 34 isSubModule(I,J) check if I is in J as submodule 35 36 changeordTo(r,o) change the ordering of a ring to a simple one 37 addvarsTo(r,vars,i) add variables to a ring 38 addNvarsTo(r,N,name,i) add N variables to a ring 35 39 "; 36 40 … … 1113 1117 1114 1118 proc changeordTo(def r,string o) 1119 "USAGE: changeordTo(ring, string s); 1120 RETURN: a ring with the oderinging changed to the (simple) ordering s 1121 EXAMPLE: example changeordTo(); shows an example 1122 " 1115 1123 { 1116 1124 list rl=ringlist(r); … … 1121 1129 example 1122 1130 { 1131 "EXAMPLE:"; echo = 2; 1123 1132 ring r=0,(x,y),lp; 1124 def rr=changeordTo Cdp(r,"dp");1133 def rr=changeordTo(r,"dp"); 1125 1134 rr; 1126 1135 } 1127 1136 1137 proc addvarsTo(def r,list vars,int blockorder) 1138 "USAGE: addvarsTo(ring,list_of_strings, int); 1139 int may be: 0:ordering: dp 1140 1:ordering dp,dp 1141 2:oring.ordering,dp 1142 RETURN: a ring with the addtional variables 1143 EXAMPLE: example addvarsTo(); shows an example 1144 " 1145 { 1146 list rl=ringlist(r); 1147 int n=nvars(r); 1148 rl[2]=rl[2]+vars; 1149 if (blockorder==0) 1150 { 1151 rl[3]=list(list("C",0),list("dp",1:(nvars(r)+size(vars)))); 1152 } 1153 else 1154 { 1155 if (blockorder==2) 1156 { 1157 rl[3]=rl[3]+list(list("dp",1:size(vars))); 1158 } 1159 else 1160 { 1161 rl[3]=list(list("C",0),list("dp",1:nvars(r)),list("dp",1:size(vars))); 1162 } 1163 } 1164 def rr=ring(rl); 1165 return(rr); 1166 } 1167 example 1168 { 1169 "EXAMPLE:"; echo = 2; 1170 ring r=0,(x,y),lp; 1171 def rr=addvarsTo(r,list("a","b"),0); 1172 rr; kill rr; 1173 def rr=addvarsTo(r,list("a","b"),1); 1174 rr; kill rr; 1175 def rr=addvarsTo(r,list("a","b"),2); 1176 rr; 1177 } 1178 proc addNvarsTo(def r,int N,string n,int blockorder) 1179 "USAGE: addNvarsTo(ring,int N, string name, int b); 1180 b may be: 0:ordering: dp 1181 1:ordering dp,dp 1182 2:oring.ordering,dp 1183 RETURN: a ring with N addtional variables 1184 EXAMPLE: example addNvarsTo(); shows an example 1185 " 1186 { 1187 list v; 1188 for(int i=N;i>0;i--) { v[i]=n+"("+string(i)+")"; } 1189 return(addvarsTo(r,v,blockorder)); 1190 } 1191 example 1192 { 1193 "EXAMPLE:"; echo = 2; 1194 ring r=0,(x,y),lp; 1195 def rr=addNvarsTo(r,2,"@",0); 1196 rr; kill rr; 1197 def rr=addNvarsTo(r,2,"@",1); 1198 rr; kill rr; 1199 def rr=addNvarsTo(r,2,"@",2); 1200 rr; 1201 } -
Singular/LIB/rinvar.lib
r4083fa rca3864 34 34 LIB "elim.lib"; 35 35 LIB "zeroset.lib"; 36 LIB "ring.lib"; 36 37 37 38 /////////////////////////////////////////////////////////////////////////////// … … 286 287 int i, dbPrt, nrNewVars; 287 288 intvec wt, wth, hs1; 288 string ringSTR1, ringSTR2, order;289 290 289 def RARB = basering; 291 nrNewVars = size(F);290 nrNewVars = ncols(F); 292 291 293 292 dbPrt = printlevel-voice+2; … … 299 298 300 299 string @mPoly = string(minpoly); 301 order = "(dp(" + string(nvars(basering)) + "), dp);"; 302 ringSTR1 = "ring RAR1 = (" + charstr(basering) + "), (" + varstr(basering) + ", Y(1.." + string(nrNewVars) + ")), " + order; 303 ringSTR2 = "ring RAR2 = (" + charstr(basering) + "), Y(1.." + string(nrNewVars) + "), dp;"; 304 execute(ringSTR1); 305 execute("minpoly = number(" + @mPoly + ");"); 300 def RAR1=addNvarsTo(basering,nrNewVars,"Y",1); setring RAR1; 301 string ringSTR2 = "ring RAR2 = (" + charstr(basering) + "), Y(1.." + string(nrNewVars) + "), dp;"; 306 302 307 303 ideal I, J1, J2, Fm; -
Singular/LIB/rwalk.lib
-
Property
mode
changed from
100644
to100755
r4e3305 rca3864 10 10 rwalk(ideal,int,int[,intvec,intvec]); standard basis of ideal via Random Walk algorithm 11 11 rwalk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Perturbation Walk algorithm 12 fr walk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Fractal Walk algorithm12 frandwalk(ideal,int[,intvec,intvec]); standard basis of ideal via Random Fractal Walk algorithm 13 13 "; 14 14 … … 141 141 * Random Walk * 142 142 ****************/ 143 proc rwalk(ideal Go, int radius, int pert_deg, list #)143 proc rwalk(ideal Go, int radius, int pert_deg, int reduction, int printout, list #) 144 144 "SYNTAX: rwalk(ideal i, int radius); 145 145 if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w); 146 intermediate Groebner bases are not reduced if reduction = 0 146 147 TYPE: ideal 147 148 PURPOSE: compute the standard basis of the ideal, calculated via … … 178 179 179 180 ideal G = fetch(xR, Go); 180 G = system("Mrwalk", G, curr_weight, target_weight, radius, pert_deg, basering);181 G = system("Mrwalk", G, curr_weight, target_weight, radius, pert_deg, reduction, printout); 181 182 182 183 setring xR; … … 196 197 int radius = 1; 197 198 int perturb_deg = 2; 198 rwalk(I,radius,perturb_deg); 199 int reduction = 0; 200 int printout = 1; 201 rwalk(I,radius,perturb_deg,reduction,printout); 199 202 } 200 203 … … 202 205 * Perturbation Walk with random element * 203 206 *****************************************/ 204 proc prwalk(ideal Go, int radius, int o_pert_deg, int t_pert_deg, list #)207 proc prwalk(ideal Go, int radius, int o_pert_deg, int t_pert_deg, int reduction, int printout, list #) 205 208 "SYNTAX: rwalk(ideal i, int radius); 206 209 if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w); … … 227 230 OSCTW= OrderStringalp_NP("al", #); 228 231 } 232 int nP = OSCTW[1]; 229 233 string ord_str = OSCTW[2]; 230 234 intvec curr_weight = OSCTW[3]; // original weight vector … … 238 242 239 243 ideal G = fetch(xR, Go); 240 G = system("Mprwalk", G, curr_weight, target_weight, radius, o_pert_deg, t_pert_deg, basering); 244 G = system("Mprwalk", G, curr_weight, target_weight, radius, o_pert_deg, t_pert_deg, 245 nP, reduction, printout); 241 246 242 247 setring xR; … … 257 262 int o_perturb_deg = 2; 258 263 int t_perturb_deg = 2; 259 prwalk(I,radius,o_perturb_deg,t_perturb_deg); 264 int reduction = 0; 265 int printout = 2; 266 prwalk(I,radius,o_perturb_deg,t_perturb_deg,reduction,printout); 260 267 } 261 268 … … 263 270 * Fractal Walk with random element * 264 271 ************************************/ 265 proc frandwalk(ideal Go, int radius, list #)266 "SYNTAX: frwalk(ideal i, int radius );267 frwalk(ideal i, int radius, int vec v, intvec w);272 proc frandwalk(ideal Go, int radius, int reduction, int printout, list #) 273 "SYNTAX: frwalk(ideal i, int radius, int reduction, int printout); 274 frwalk(ideal i, int radius, int reduction, int printout, intvec v, intvec w); 268 275 TYPE: ideal 269 276 PURPOSE: compute the standard basis of the ideal, calculated via … … 299 306 ideal G = fetch(xR, Go); 300 307 int pert_deg = 2; 301 G = system("Mfrwalk", G, curr_weight, target_weight, radius); 308 309 G = system("Mfrwalk", G, curr_weight, target_weight, radius, reduction, printout); 302 310 303 311 setring xR; … … 314 322 ring r = 0,(z,y,x), lp; 315 323 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 316 frandwalk(I,2); 317 } 324 int reduction = 0; 325 frandwalk(I,2,0,1); 326 } -
Property
mode
changed from
-
Singular/LIB/sagbi.lib
r4083fa rca3864 31 31 LIB "toric.lib"; 32 32 LIB "algebra.lib"; 33 LIB "ring.lib"; 33 34 ////////////////////////////////////////////////////////////////////////////// 34 35 … … 1111 1112 1112 1113 //------------- change the basering bsr to bsr[@(0),...,@(z)] ---------- 1113 execute("ring s=("+charstr(basering)+"),("+varstr(basering)+",@(0..z)),dp;");1114 def s=addNvarsTo(basering,z+1,,"@",0); setring s; 1114 1115 // Ev hier die Reihenfolge der Vars aendern. Dazu muss unten aber entsprechend 1115 1116 // geaendert werden: -
Singular/LIB/schreyer.lib
r4083fa rca3864 600 600 } 601 601 602 int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?! 603 604 if( !@IS_A_SB ) 605 { 606 def opts = option(get); 607 option(redSB); option(redTail); 608 M = std(M); 609 option(set, opts); 610 kill opts; 611 } 612 613 M = simplify(M, 1 + 2 + 4 + 32); 602 def opts = option(get); 603 option(redSB); option(redTail); 604 M = simplify(interred(groebner(M)), 1 + 2 + 4 + 32); // NOTE: we require interreduced GB for input 605 option(set, opts); kill opts; 606 607 // int @IS_A_SB = attrib(M, "isSB"); if( !@IS_A_SB ) { } else { } 608 // attrib(M, "isSB", 1); 614 609 615 610 if( @IGNORETAILS ) … … 786 781 attrib(S, "HYBRIDNF", 0); 787 782 } 783 784 if( typeof( attrib(SSinit, "NOCACHING") ) == "int" ) 785 { 786 attrib(S, "NOCACHING", attrib(SSinit, "NOCACHING") ); 787 } else 788 { 789 attrib(S, "NOCACHING", 0); 790 } 791 788 792 789 793 // maybe resetting existing ring attributes! … … 2748 2752 if(size(#) > 0) { DEBUG = #[1]; } 2749 2753 2754 def TREE = 0; 2755 if(size(#) > 1) { TREE = #[2]; } 2756 2750 2757 system("--min-time", "0.01"); 2751 2758 system("--ticks-per-sec", 100); … … 2758 2765 attrib(SSinit, "KERCHECK", (DEBUG > 0) ); 2759 2766 2760 attrib(SSinit, "TREEOUTPUT", 0);2767 attrib(SSinit, "TREEOUTPUT", TREE); 2761 2768 attrib(SSinit, "PROFILE", 0); 2762 2769 attrib(SSinit, "IGNORETAILS", 0); // not only frame 2770 2771 attrib(SSinit, "NOCACHING", 0); 2763 2772 2764 2773 int @treeout = attrib(SSinit, "TREEOUTPUT"); … … 2807 2816 M = a*b+7*a*c-16*b*c-27*a*d+37*b*d-2*c*d, d^3, c*d^2, b*d^2, a*d^2, c^2*d, b*c*d, a*c*d, b^2*d, a^2*d, c^3, b*c^2, a*c^2, b^2*c, a^2*c, b^3, a^3; 2808 2817 TestSSresAttribs(M, "medium: AGR@101n3d004s009%1"); 2818 2819 kill AGR; 2820 2821 2822 string Name = "bordiga"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp; 2823 ideal I = -x2y+26/17xy2+70/17y3+96/121x2z+63/82xyz+115/11y2z-8114xz2-40/79yz2+16/125z3+3023x2u-123/70xyu+3395y2u-81/119xzu-23/66yzu+3626z2u+18/53xu2+111/58yu2-34/39zu2+53/40u3-94/17x2v-10/19xyv+81/88y2v-91/33xzv-9967yzv-103/4z2v-26/109xuv+69/97yuv+92/17zuv-19/96u2v+10/21xv2+6147yv2+32/113zv2-79/82uv2-77/51v3,4347x2y-9017xy2+11327y3+18/79x2z-93/43xyz-35/47y2z+14704xz2+10727yz2-1764z3-612x2u+20/107xyu-103/89y2u-39/2xzu+2345yzu+10251z2u-9984xu2-10299yu2+113/118zu2+37/91u3+2/31x2v+9552xyv-47/100y2v-3242xzv+113/27yzv-11271z2v-13/79xuv+15917yuv+5/114zuv+103/119u2v-21/55xv2-59/19yv2+101/68zv2-7817uv2-112/29v3,7228x2y-111/113xy2+5913y3+6/43x2z-11251xyz+27/121y2z+97/96xz2-7398yz2-97/114z3+38/15x2u+5005xyu-41/126y2u-61/116xzu+89/9yzu-4087z2u+26/15xu2-92/103yu2+21/68zu2-4027u3+97/91x2v+5150xyv-4/47y2v-2310xzv+7307yzv-77/86z2v+30/83xuv+413yuv-50zuv-103/106u2v+105/73xv2-109/98yv2+59/63zv2+715uv2+963v3,x3+3487x2y-9744xy2-13276y3-15213x2z-118/51xyz+101/104y2z+2754xz2+9111yz2-17/94z3+11136x2u-43/82xyu-9/41y2u-7306xzu-6839yzu+5692z2u-14682xu2+37/80yu2-85/97zu2-6186u3+34/15x2v+84/109xyv+5086y2v+27/112xzv-3/40yzv+19/120z2v+11222xuv+38/55yuv-24/83zuv+15814u2v-111/61xv2+49/44yv2+125/81zv2+1933uv2-19/71v3; 2824 TestSSresAttribs(I, Name); 2825 kill @p, Name, R; 2826 2827 string Name = "rat.d8.g6"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp; 2828 ideal I = -19/125x2y2-87/119xy3-97/21y4+36/53x2yz+2069xy2z-59/50y3z-65/33x2z2-14322xyz2+79/60y2z2-9035xz3-14890yz3+87/47z4-23/48x2yu+45/44xy2u+1972y3u+79/118x2zu-5173xyzu+115/121y2zu+1239xz2u-115/17yz2u-15900z3u-78/95x2u2+67/101xyu2-12757y2u2+12752xzu2+68/21yzu2+103/90z2u2-12917xu3+97/92yu3-24/49zu3-13/79u4-51/61x2yv-3103xy2v+77/117y3v+73/115x2zv-79/33xyzv+123/110y2zv+11969xz2v-31/95yz2v-123/95z3v-105/124x2uv+12624xyuv+2/63y2uv+6579xzuv+13/62yzuv+4388z2uv-12747xu2v-26/105yu2v-78/61zu2v-125/53u3v-5/71xyv2+62/77y2v2+21/44xzv2-9806yzv2+3/91z2v2+361xuv2+568yuv2+2926zuv2+53/38u2v2-14523yv3+2082zv3+113/115uv3,108/73x2y2+4028xy3+38/43y4-1944x2yz+39/80xy2z+8/109y3z+52/27x2z2+103/45xyz2+5834y2z2+63/101xz3+107/80yz3+1178z4-1/6x2yu+78/25xy2u-21/43y3u+50/71x2zu-14693xyzu+15074y2zu+9/103xz2u-7396yz2u-14493z3u+93/25x2u2+61/4xyu2-11306y2u2-79/81xzu2+59/82yzu2-5/106z2u2+89/71xu3-34/11yu3+15/103zu3-115/52u4-54/65x2yv+67/16xy2v-7/68y3v-10/13x2zv+32/85xyzv+1/91y2zv+107/118xz2v+7594yz2v-98/103z3v+9919x2uv-965xyuv+53/34y2uv+119/11xzuv-3400yzuv-8329z2uv+75/98xu2v-24yu2v+55/87zu2v-82/71u3v-73/115x2v2+85/19xyv2-213y2v2-7704xzv2-15347yzv2+14960z2v2+15065xuv2-125/17yuv2+32/83zuv2-14/73u2v2-21/44xv3+79/2yv3-61/32zv3+46/119uv3-2082v4,9/20x2y2+113/71xy3-88/65y4+9983x2yz-6722xy2z+87/68y3z+1893x2z2+65/32xyz2+51/55y2z2-102/53xz3+58/5yz3-7187z4-96/7x2yu-14/87xy2u-3532y3u+95/54x2zu+19/65xyzu-6728y2zu+31/121xz2u+73/106yz2u-91/5z3u-12928x2u2+707xyu2-55/48y2u2-96/25xzu2+15869yzu2-20/107z2u2-10030xu3-13786yu3-122/9zu3+19/59u4-7/52x2yv+101/74xy2v+83/6y3v-91/55x2zv-5266xyzv+85/61y2zv+126/95xz2v+56/51yz2v+13073z3v-50/21x2uv-13553xyuv-116/53y2uv+68/71xzuv-111/98yzuv-11037z2uv+68/121xu2v-124/53yu2v+54/55zu2v+5862u3v+12318x2v2-119/29xyv2+101/17y2v2-51/40xzv2-82/33yzv2-30/41z2v2-29/52xuv2+7817yuv2+8121zuv2-28/99u2v2+1125xv3-73/55yv3-14141zv3+8742uv3-1203v4,x2y2+11357xy3+295y4+144x2yz-31/54xy2z+89/119y3z+1/46x2z2+29/26xyz2+1384y2z2+1461xz3+113/91yz3+9494z4-7/32x2yu+12850xy2u-3626y3u-33/106x2zu-7/60xyzu-5935y2zu-8597xz2u+5527yz2u+1708z3u+6182x2u2-15780xyu2+4669y2u2-38/69xzu2+8412yzu2+9265z2u2-5679xu3-67/18yu3-34/67zu3-7178u4+113/56x2yv-3669xy2v+17/113y3v-87/35x2zv-4871xyzv-111/11y2zv-1131xz2v-72/13yz2v+838z3v-115/4x2uv+3395xyuv-43/68y2uv-82/13xzuv+7042yzuv-88/119z2uv+100/19xu2v+24/11yu2v+89/3zu2v+7395u3v-119/109x2v2+1/104xyv2+18/25y2v2+700xzv2-59/9yzv2-92/87z2v2+2486xuv2-67/103yuv2+1469zuv2-101/91u2v2-79/33xv3+10838yv3+81/4zv3-11843uv3+7204v4,19/125x3-15698x2y-22/117xy2-95/107y3+2027x2z-7750xyz+85/104y2z-15326xz2+31/101yz2+67/81z3-7879x2u-112/115xyu+124/81y2u+99/61xzu-7458yzu+40/33z2u-1502xu2+6591yu2-7/73zu2-42/95u3+93/83x2v-15/112xyv-84/95y2v+35/36xzv+5/24yzv-12768z2v+13232xuv-76/103yuv-79/52zuv-7217u2v+75/92xv2-49/64yv2+17/14zv2-6109uv2+1695v3; 2829 TestSSresAttribs(I, Name); 2830 kill R, Name, @p; 2831 2809 2832 2810 2833 if( @treeout) -
Singular/LIB/solve.lib
r4083fa rca3864 23 23 24 24 LIB "triang.lib"; // needed for triang_solve 25 LIB "ring.lib"; // needed for changeordTo 25 26 26 27 /////////////////////////////////////////////////////////////////////////////// … … 692 693 if (sb==0) 693 694 { 694 execute("ring dphom=("+charstr(rin)+"),("+ 695 varstr(rin)+"),dp;"); 695 def dphom=changeordTo(rin,"dp"); setring dphom; 696 696 ideal G = std(imap(rin,G)); 697 697 if (dim(G)!=0){ERROR("ideal not zero-dimensional");} … … 736 736 if (sb==0) 737 737 { 738 execute("ring dphilb=("+charstr(rin)+"),("+ varstr(rin)+"),dp;");738 def dphilb=changeordTo(rin,"dp"); setring dphilb; 739 739 ideal G = imap(rin,G); 740 740 G = std(G); … … 747 747 attrib(G,"isSB",1); 748 748 } 749 execute("ring lexhilb=("+charstr(rin)+"),("+ varstr(rin)+"),lp;");749 def lexhilb=changeordTo(rin,"lp"); setring lexhilb; 750 750 option(redTail); 751 751 ideal H = fglm(dphilb,G); … … 755 755 else 756 756 { 757 execute("ring lplex=("+charstr(rin)+"),("+varstr(rin)+"),lp;");757 def lplex=changeordTo(rin,"lp"); setring lplex; 758 758 } 759 759 ideal H = imap(lexhilb,H); -
Singular/LIB/swalk.lib
-
Property
mode
changed from
100644
to100755
-
Property
mode
changed from
-
Singular/LIB/tropical.lib
r4083fa rca3864 208 208 LIB "absfact.lib"; 209 209 LIB "hnoether.lib"; 210 LIB "ring.lib"; 210 211 ////////////////////////////////////////////////////////////////////////////// 211 212 … … 1019 1020 { 1020 1021 def GLOBALRING=basering; 1021 number mp=minpoly;1022 execute("ring LOCALRING=("+charstr(basering)+"),("+varstr(basering)+"),ds;");1022 def LOCALRING=changeordTo(GLOBALRING,"ds"); 1023 setring LOCALRING; 1023 1024 poly f=imap(GLOBALRING,f); 1024 minpoly=imap(GLOBALRING,mp);1025 1025 } 1026 1026 // check if a substitution is necessary … … 7154 7154 NOTE: the procedure is called by texDrawTropical" 7155 7155 { 7156 execute("ring REALRING=(real,50,100),x,lp;");7156 ring REALRING=(real,50,100),x,lp; 7157 7157 execute("number aa,bb,cc="+AA[1]+","+AA[2]+","+AA[3]+";"); 7158 7158 number ascale,bscale=1,1; … … 7187 7187 NOTE: the procedure is called by texDrawTropical" 7188 7188 { 7189 execute("ring REALRING=(real,50,100),x,lp;");7189 ring REALRING=(real,50,100),x,lp; 7190 7190 execute("poly aa,bb="+a+","+b+";"); 7191 7191 if (aa<bb) -
Singular/dyn_modules/Order/nforder_elt.cc
r4083fa rca3864 143 143 } 144 144 /// convertion to int, 0 if impossible 145 static intEltInt(number &n, const coeffs r)145 static long EltInt(number &n, const coeffs r) 146 146 147 147 { -
Singular/dyn_modules/syzextra/mod_main.cc
r4083fa rca3864 315 315 const ring save = currRing; 316 316 const ring r = syzstr->syRing; 317 const ring rr = (r != NULL) ? r: save;317 // const ring rr = (r != NULL) ? r: save; 318 318 319 319 -
Singular/dyn_modules/syzextra/syzextra.cc
r4083fa rca3864 1793 1793 if( UNLIKELY( !( (!OPT__TAILREDSYZ) || m_lcm.Check(multiplier) )) ) 1794 1794 { 1795 if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) ) ++ m_stat[5]; // PrintS("%"); // check LCM ! 1796 1795 if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) ) 1796 { 1797 ++ m_stat[5]; // PrintS("%"); // check LCM ! 1798 #ifndef SING_NDEBUG 1799 if( OPT__DEBUG ) 1800 { 1801 PrintS("\nTT,%:"); dPrint(multiplier, r, r, 0); 1802 PrintS(", * :"); dPrint(tail, r, r, 0); 1803 PrintLn(); 1804 } 1805 #endif 1806 } 1797 1807 return NULL; 1798 1808 } … … 1956 1966 if( s == NULL ) // No Reducer? 1957 1967 { 1958 if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) ) ++ m_stat[5]; // PrintS("%"); // check LCM ! 1968 if( UNLIKELY( OPT__TAILREDSYZ && OPT__PROT) ) 1969 { 1970 ++ m_stat[5]; // PrintS("%"); // check LCM ! 1971 #ifndef SING_NDEBUG 1972 if( OPT__DEBUG ) 1973 { 1974 PrintS("\n%: RedTail("); dPrint(multiplier, r, r, 0); 1975 PrintS(" * : "); dPrint(term4reduction, r,r,0 ); 1976 PrintS(", { "); dPrint(syztermCheck,r,r,0 ); 1977 PrintS(" }) "); PrintLn(); 1978 } 1979 #endif 1980 } 1959 1981 return NULL; 1960 1982 } … … 2016 2038 OPT__TREEOUTPUT( atGetInt(rootRingHdl, "TREEOUTPUT", 0) ), 2017 2039 OPT__SYZCHECK( atGetInt(rootRingHdl, "SYZCHECK", 0) ), 2040 OPT__PROT(TEST_OPT_PROT), 2018 2041 OPT__NOCACHING( atGetInt(rootRingHdl, "NOCACHING", 0) ), 2019 OPT__PROT(TEST_OPT_PROT),2020 2042 m_rBaseRing( rootRingHdl->data.uring ) 2021 2043 { -
Singular/dyn_modules/syzextra/test.sh
r4083fa rca3864 4 4 #"$SINGULAR_EXECUTABLE" -teq "$srcdir/ederc.tst" || exit 1 5 5 #"$SINGULAR_EXECUTABLE" -teq "$srcdir/syzextra.tst" || exit 1 6 "$SINGULAR_EXECUTABLE" -tec 'LIB "schreyer.lib"; listvar(Top); proc T(){ Schreyer::testSimple(1 ); /* Schreyer::testAGR(0); Schreyer::testAGRhard(0); */ } T(); $' || exit 16 "$SINGULAR_EXECUTABLE" -tec 'LIB "schreyer.lib"; listvar(Top); proc T(){ Schreyer::testSimple(1, 0); /* Schreyer::testAGR(0); Schreyer::testAGRhard(0); */ } T(); $' || exit 1 -
Singular/emacs.cc
r4083fa rca3864 9 9 10 10 11 #include <kernel/mod2.h> 12 #include <omalloc/omalloc.h> 13 #include <resources/feResource.h> 14 #include <Singular/feOpt.h> 15 11 16 #ifdef __CYGWIN__ 12 17 #define BOOLEAN boolean 13 18 #endif 14 #include <kernel/mod2.h>15 16 19 17 20 #include <stdio.h> … … 30 33 #endif 31 34 32 #include <omalloc/omalloc.h>33 #include <resources/feResource.h>34 #include <Singular/feOpt.h>35 35 36 36 #if !defined(TSINGULAR) && !defined(ESINGULAR) … … 63 63 } 64 64 #else 65 void error(c har* fmt, ...)65 void error(const char* fmt, ...) 66 66 { 67 67 char buf[4096]; -
Singular/extra.cc
r4083fa rca3864 712 712 { 713 713 WerrorS("field required"); 714 714 return TRUE; 715 715 } 716 716 matrix pMat = (matrix)h->Data(); … … 3736 3736 else 3737 3737 #endif 3738 /*==================== test64 =================*/ 3739 #if 0 3740 if(strcmp(sys_cmd,"test64")==0) 3741 { 3742 long l=8;int i; 3743 for(i=1;i<62;i++) 3744 { 3745 l=l<<1; 3746 number n=n_Init(l,coeffs_BIGINT); 3747 Print("%ld= ",l);n_Print(n,coeffs_BIGINT); 3748 CanonicalForm nn=n_convSingNFactoryN(n,TRUE,coeffs_BIGINT); 3749 n_Delete(&n,coeffs_BIGINT); 3750 n=n_convFactoryNSingN(nn,coeffs_BIGINT); 3751 PrintS(" F:"); 3752 n_Print(n,coeffs_BIGINT); 3753 PrintLn(); 3754 n_Delete(&n,coeffs_BIGINT); 3755 } 3756 Print("SIZEOF_LONG=%d\n",SIZEOF_LONG); 3757 return FALSE; 3758 } 3759 else 3760 #endif 3738 3761 /*==================== Error =================*/ 3739 3762 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented ); -
Singular/iparith.cc
r4083fa rca3864 239 239 240 240 /*=================== simple helpers =================*/ 241 static int iin_Int(number &n,coeffs cf) 242 { 243 long l=n_Int(n,cf); 244 int i=(int)l; 245 if ((long)i==l) return l; 246 return 0; 247 } 241 248 poly pHeadProc(poly p) 242 249 { … … 4708 4715 return TRUE; 4709 4716 } 4710 res->data = (char *)(long) n_Int(pGetCoeff(p),currRing->cf);4717 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf); 4711 4718 return FALSE; 4712 4719 } … … 5405 5412 { 5406 5413 number n=(number)u->CopyD(); // n_Int may call n_Normalize 5407 res->data=(char *)(long) n_Int(n,currRing->cf);5414 res->data=(char *)(long)iin_Int(n,currRing->cf); 5408 5415 n_Delete(&n,currRing->cf); 5409 5416 return FALSE; … … 5412 5419 { 5413 5420 number n=(number)u->Data(); 5414 res->data=(char *)(long) n_Int(n,coeffs_BIGINT );5421 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT ); 5415 5422 return FALSE; 5416 5423 } -
Singular/ipshell.cc
r4083fa rca3864 1219 1219 //Print("branchTo: %s\n",h->Name()); 1220 1220 iiCurrProc=(idhdl)h->data; 1221 err=iiAllStart(IDPROC(iiCurrProc),IDPROC(iiCurrProc)->data.s.body,BT_proc,IDPROC(iiCurrProc)->data.s.body_lineno-(iiCurrArgs==NULL)); 1221 procinfo * pi=IDPROC(iiCurrProc); 1222 if( pi->data.s.body==NULL ) 1223 { 1224 iiGetLibProcBuffer(pi); 1225 if (pi->data.s.body==NULL) return TRUE; 1226 } 1227 if ((pi->pack!=NULL)&&(currPack!=pi->pack)) 1228 { 1229 currPack=pi->pack; 1230 iiCheckPack(currPack); 1231 currPackHdl=packFindHdl(currPack); 1232 //Print("set pack=%s\n",IDID(currPackHdl)); 1233 } 1234 err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL)); 1222 1235 exitBuffer(BT_proc); 1223 1236 if (iiCurrArgs!=NULL) … … 5318 5331 //ringtype = 1; // Use Z/2^ch 5319 5332 cf=nInitChar(n_Z2m,(void*)(long)modExponent); 5320 5333 mpz_clear(modBase); 5321 5334 omFreeSize (modBase, sizeof (mpz_t)); 5322 5335 } -
Singular/test.cc
r4083fa rca3864 376 376 errorreported = 0; // reset error handling 377 377 else 378 printf("typeof returned type %d, >>%s<<\n",r1.Typ(), r1.Data());378 printf("typeof returned type %d, >>%s<<\n",r1.Typ(),(char*)r1.Data()); 379 379 380 380 // clean up r1: -
Singular/walk.cc
-
Property
mode
changed from
100644
to100755
r4e3305 rca3864 429 429 #endif 430 430 431 #ifdef CHECK_IDEAL_MWALK431 //#ifdef CHECK_IDEAL_MWALK 432 432 static void idString(ideal L, const char* st) 433 433 { … … 441 441 Print(" %s;", pString(L->m[nL-1])); 442 442 } 443 #endif443 //#endif 444 444 445 445 #if defined(CHECK_IDEAL_MWALK) || defined(ENDWALKS) … … 558 558 } 559 559 return p0; 560 } 561 562 /***************************************************************************** 563 * compute the gcd of the entries of the vectors curr_weight and diff_weight * 564 *****************************************************************************/ 565 static int simplify_gcd(intvec* curr_weight, intvec* diff_weight) 566 { 567 int j; 568 int nRing = currRing->N; 569 int gcd_tmp = (*curr_weight)[0]; 570 for (j=1; j<nRing; j++) 571 { 572 gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]); 573 if(gcd_tmp == 1) 574 { 575 break; 576 } 577 } 578 if(gcd_tmp != 1) 579 { 580 for (j=0; j<nRing; j++) 581 { 582 gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]); 583 if(gcd_tmp == 1) 584 { 585 break; 586 } 587 } 588 } 589 return gcd_tmp; 560 590 } 561 591 … … 953 983 } 954 984 955 /***************************************************************************** 956 * create a weight matrix order as intvec of an extra weight vector (a(iv), lp)*957 ****************************************************************************** /985 /********************************************************************************* 986 * create a weight matrix order as intvec of an extra weight vector (a(iv),M(iw)) * 987 **********************************************************************************/ 958 988 intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw) 959 989 { 990 <<<<<<< HEAD 991 assume((iv->length())*(iv->length()) == iw->length()); 992 int i,j, nR = iv->length(); 993 994 ======= 960 995 assume(iv->length() == iw->length()); 961 996 int i, nR = iv->length(); 962 997 998 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 963 999 intvec* ivm = new intvec(nR*nR); 964 1000 … … 966 1002 { 967 1003 (*ivm)[i] = (*iv)[i]; 968 (*ivm)[i+nR] = (*iw)[i]; 969 } 970 for(i=2; i<nR; i++) 971 { 972 (*ivm)[i*nR+i-2] = 1; 1004 } 1005 for(i=1; i<nR; i++) 1006 { 1007 for(j=0; j<nR; j++) 1008 { 1009 (*ivm)[j+i*nR] = (*iw)[j+i*nR]; 1010 } 973 1011 } 974 1012 return ivm; … … 1859 1897 } 1860 1898 1899 1900 /************************************************************** 1901 * Look for the position of the smallest absolut value in vec * 1902 **************************************************************/ 1903 static int MivAbsMaxArg(intvec* vec) 1904 { 1905 int k = MivAbsMax(vec); 1906 int i=0; 1907 while(1) 1908 { 1909 if((*vec)[i] == k || (*vec)[i] == -k) 1910 { 1911 break; 1912 } 1913 i++; 1914 } 1915 return i; 1916 } 1917 1918 1861 1919 /********************************************************************** 1862 1920 * Compute a next weight vector between curr_weight and target_weight * … … 1873 1931 1874 1932 int nRing = currRing->N; 1875 int checkRed, j, kkk,nG = IDELEMS(G);1933 int checkRed, j, nG = IDELEMS(G); 1876 1934 intvec* ivtemp; 1877 1935 … … 1911 1969 mpz_init(dcw); 1912 1970 1913 //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;1914 1971 int gcd_tmp; 1915 1972 intvec* diff_weight = MivSub(target_weight, curr_weight); … … 1917 1974 intvec* diff_weight1 = MivSub(target_weight, curr_weight); 1918 1975 poly g; 1919 //poly g, gw; 1976 1920 1977 for (j=0; j<nG; j++) 1921 1978 { … … 1979 2036 } 1980 2037 } 1981 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));2038 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t)); 1982 2039 mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t)); 1983 2040 1984 2041 1985 // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector 2042 // there is no 0<t<1 and define the next weight vector that is equal 2043 // to the current weight vector 1986 2044 if(mpz_cmp(t_nenner, t_null) == 0) 1987 2045 { … … 2054 2112 #endif 2055 2113 2056 // BOOLEAN isdwpos; 2057 2058 // construct a new weight vector 2114 // construct a new weight vector and check whether vec[j] is overflow, 2115 // i.e. vec[j] > 2^31. 2116 // If vec[j] doesn't overflow, define a weight vector. Otherwise, 2117 // report that overflow appears. In the second case, test whether the 2118 // the correctness of the new vector plays an important role 2119 2059 2120 for (j=0; j<nRing; j++) 2060 2121 { … … 2100 2161 } 2101 2162 } 2102 2163 // reduce the vector with the gcd 2164 if(mpz_cmp_si(ggt,1) != 0) 2165 { 2166 for (j=0; j<nRing; j++) 2167 { 2168 mpz_divexact(vec[j], vec[j], ggt); 2169 } 2170 } 2103 2171 #ifdef NEXT_VECTORS_CC 2104 2172 PrintS("\n// gcd of elements of the vector: "); … … 2106 2174 #endif 2107 2175 2108 /**********************************************************************2109 * construct a new weight vector and check whether vec[j] is overflow, *2110 * i.e. vec[j] > 2^31. *2111 * If vec[j] doesn't overflow, define a weight vector. Otherwise, *2112 * report that overflow appears. In the second case, test whether the *2113 * the correctness of the new vector plays an important role *2114 **********************************************************************/2115 kkk=0;2116 2176 for(j=0; j<nRing; j++) 2117 2177 { … … 2129 2189 2130 2190 REDUCTION: 2191 checkRed = 1; 2131 2192 for (j=0; j<nRing; j++) 2132 2193 { 2133 (*diff_weight)[j] = mpz_get_si(vec[j]); 2134 } 2135 while(MivAbsMax(diff_weight) >= 5) 2136 { 2137 for (j=0; j<nRing; j++) 2138 { 2139 if(mpz_cmp_si(ggt,1)==0) 2140 { 2141 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2142 // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]); 2143 } 2144 else 2145 { 2146 mpz_divexact(vec[j], vec[j], ggt); 2147 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2148 // Print("\n// vector[%d] = %d \n",j+1, (*diff_weight1)[j]); 2149 } 2150 /* 2151 if((*diff_weight1)[j] == 0) 2152 { 2153 kkk = kkk + 1; 2154 } 2155 */ 2156 } 2157 2158 2159 /* 2160 if(kkk > nRing - 1) 2161 { 2162 // diff_weight was reduced to zero 2163 // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n"); 2164 goto TEST_OVERFLOW; 2165 } 2166 */ 2167 2168 if(test_w_in_ConeCC(G,diff_weight1) != 0) 2169 { 2170 Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n"); 2171 for (j=0; j<nRing; j++) 2172 { 2173 (*diff_weight)[j] = (*diff_weight1)[j]; 2174 } 2175 if(MivAbsMax(diff_weight) < 5) 2176 { 2177 checkRed = 1; 2178 goto SIMPLIFY_GCD; 2179 } 2180 } 2181 else 2182 { 2183 // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n"); 2184 break; 2185 } 2194 (*diff_weight1)[j] = mpz_get_si(vec[j]); 2195 } 2196 while(test_w_in_ConeCC(G,diff_weight1)) 2197 { 2198 for(j=0; j<nRing; j++) 2199 { 2200 (*diff_weight)[j] = (*diff_weight1)[j]; 2201 mpz_set_si(vec[j], (*diff_weight)[j]); 2202 } 2203 for(j=0; j<nRing; j++) 2204 { 2205 (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5); 2206 } 2207 } 2208 if(MivAbsMax(diff_weight)>10000) 2209 { 2210 for(j=0; j<nRing; j++) 2211 { 2212 (*diff_weight1)[j] = (*diff_weight)[j]; 2213 } 2214 j = 0; 2215 while(test_w_in_ConeCC(G,diff_weight1)) 2216 { 2217 (*diff_weight)[j] = (*diff_weight1)[j]; 2218 mpz_set_si(vec[j], (*diff_weight)[j]); 2219 j = MivAbsMaxArg(diff_weight1); 2220 (*diff_weight1)[j] = floor(0.1*(*diff_weight1)[j] + 0.5); 2221 } 2222 goto SIMPLIFY_GCD; 2186 2223 } 2187 2224 … … 2222 2259 mpz_clear(t_null); 2223 2260 2224 2225 2226 2261 if(Overflow_Error == FALSE) 2227 2262 { 2228 2263 Overflow_Error = nError; 2229 2264 } 2230 rComplete(currRing);2231 for( kkk=0; kkk<IDELEMS(G);kkk++)2232 { 2233 poly p=G->m[ kkk];2265 rComplete(currRing); 2266 for(j=0; j<IDELEMS(G); j++) 2267 { 2268 poly p=G->m[j]; 2234 2269 while(p!=NULL) 2235 2270 { … … 2271 2306 } 2272 2307 2273 /************************************************************** 2308 /******************************************************************** 2274 2309 * define and execute a new ring which order is (a(vb),a(va),lp,C) * 2275 * ************************************************************ /2310 * ******************************************************************/ 2276 2311 static void VMrHomogeneous(intvec* va, intvec* vb) 2277 2312 { … … 2425 2460 //rChangeCurrRing(r); 2426 2461 } 2427 2462 //unused 2463 #if 0 2428 2464 static ring VMrDefault1(intvec* va) 2429 2465 { … … 2496 2532 return r; 2497 2533 } 2498 2534 #endif 2499 2535 /**************************************************************** 2500 2536 * define and execute a new ring with ordering (a(va),Wp(vb),C) * … … 3126 3162 else 3127 3163 { 3128 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung3164 rChangeCurrRing(VMrDefault(curr_weight)); 3129 3165 } 3130 3166 newRing = currRing; … … 3882 3918 else 3883 3919 { 3884 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung3920 rChangeCurrRing(VMrDefault(curr_weight)); 3885 3921 } 3886 3922 newRing = currRing; … … 4143 4179 else 4144 4180 { 4145 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4181 rChangeCurrRing(VMrDefault(curr_weight)); 4146 4182 } 4147 4183 newRing = currRing; … … 4285 4321 intvec* Xivlp; 4286 4322 4287 #if 04288 /********************************4289 * compute a next weight vector *4290 ********************************/4291 static intvec* MWalkRandomNextWeight(ideal G, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg)4292 {4293 int i, weight_norm;4294 int nV = currRing->N;4295 intvec* next_weight2;4296 intvec* next_weight22 = new intvec(nV);4297 intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);4298 if(MivComp(next_weight, target_weight) == 1)4299 {4300 return(next_weight);4301 }4302 else4303 {4304 //compute a perturbed next weight vector "next_weight1"4305 intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G);4306 //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1)));4307 4308 //compute a random next weight vector "next_weight2"4309 while(1)4310 {4311 weight_norm = 0;4312 while(weight_norm == 0)4313 {4314 for(i=0; i<nV; i++)4315 {4316 //Print("\n// next_weight[%d] = %d", i, (*next_weight)[i]);4317 (*next_weight22)[i] = rand() % 60000 - 30000;4318 weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];4319 }4320 weight_norm = 1 + floor(sqrt(weight_norm));4321 }4322 4323 for(i=nV-1; i>=0; i--)4324 {4325 if((*next_weight22)[i] < 0)4326 {4327 (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);4328 }4329 else4330 {4331 (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);4332 }4333 //Print("\n// next_weight22[%d] = %d", i, (*next_weight22)[i]);4334 }4335 4336 if(test_w_in_ConeCC(G, next_weight22) == 1)4337 {4338 //Print("\n//MWalkRandomNextWeight: next_weight2 im Kegel\n");4339 next_weight2 = MkInterRedNextWeight(next_weight22, target_weight, G);4340 delete next_weight22;4341 break;4342 }4343 }4344 intvec* result = new intvec(nV);4345 ideal G_test = MwalkInitialForm(G, next_weight);4346 ideal G_test1 = MwalkInitialForm(G, next_weight1);4347 ideal G_test2 = MwalkInitialForm(G, next_weight2);4348 4349 // compare next_weights4350 if(IDELEMS(G_test1) < IDELEMS(G_test))4351 {4352 if(IDELEMS(G_test2) <= IDELEMS(G_test1)) // |G_test2| <= |G_test1| < |G_test|4353 {4354 for(i=0; i<nV; i++)4355 {4356 (*result)[i] = (*next_weight2)[i];4357 }4358 }4359 else // |G_test1| < |G_test|, |G_test1| < |G_test2|4360 {4361 for(i=0; i<nV; i++)4362 {4363 (*result)[i] = (*next_weight1)[i];4364 }4365 }4366 }4367 else4368 {4369 if(IDELEMS(G_test2) <= IDELEMS(G_test)) // |G_test2| <= |G_test| <= |G_test1|4370 {4371 for(i=0; i<nV; i++)4372 {4373 (*result)[i] = (*next_weight2)[i];4374 }4375 }4376 else // |G_test| <= |G_test1|, |G_test| < |G_test2|4377 {4378 for(i=0; i<nV; i++)4379 {4380 (*result)[i] = (*next_weight)[i];4381 }4382 }4383 }4384 delete next_weight;4385 delete next_weight1;4386 idDelete(&G_test);4387 idDelete(&G_test1);4388 idDelete(&G_test2);4389 if(test_w_in_ConeCC(G, result) == 1)4390 {4391 delete next_weight2;4392 return result;4393 }4394 else4395 {4396 delete result;4397 return next_weight2;4398 }4399 }4400 }4401 #endif4402 4323 4403 4324 /******************************** … … 4414 4335 4415 4336 //compute a perturbed next weight vector "next_weight1" 4416 //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);4417 4337 intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G); 4418 4338 //compute a random next weight vector "next_weight2" … … 4443 4363 { 4444 4364 next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G); 4365 if(MivAbsMax(next_weight2)>1147483647) 4366 { 4367 for(i=0; i<nV; i++) 4368 { 4369 (*next_weight22)[i] = (*next_weight2)[i]; 4370 } 4371 i = 0; 4372 while(test_w_in_ConeCC(G,next_weight22)) 4373 { 4374 (*next_weight2)[i] = (*next_weight22)[i]; 4375 i = MivAbsMaxArg(next_weight22); 4376 (*next_weight22)[i] = floor(0.1*(*next_weight22)[i] + 0.5); 4377 } 4378 } 4445 4379 delete next_weight22; 4446 4380 break; … … 4573 4507 else 4574 4508 { 4575 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4509 rChangeCurrRing(VMrDefault(orig_target_weight)); 4576 4510 } 4577 4511 TargetRing = currRing; … … 4644 4578 else 4645 4579 { 4646 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4580 rChangeCurrRing(VMrDefault(curr_weight)); 4647 4581 } 4648 4582 newRing = currRing; … … 4753 4687 else 4754 4688 { 4755 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4689 rChangeCurrRing(VMrDefault(orig_target_weight)); 4756 4690 } 4757 4691 F1 = idrMoveR(G, newRing,currRing); … … 4784 4718 else 4785 4719 { 4786 rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung4720 rChangeCurrRing(VMrDefault(orig_target_weight)); 4787 4721 } 4788 4722 KSTD_Finish: … … 4882 4816 tim = clock(); 4883 4817 /* 4884 Print("\n// **** Gr ᅵbnerwalk took %d steps and ", nwalk);4818 Print("\n// **** Groebnerwalk took %d steps and ", nwalk); 4885 4819 PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:"); 4886 4820 idElements(Gomega, "G_omega"); … … 4912 4846 oldRing = currRing; 4913 4847 4914 / * create a new ring newRing */4848 // create a new ring newRing 4915 4849 if (rParameter(currRing) != NULL) 4916 4850 { … … 4919 4853 else 4920 4854 { 4921 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4855 rChangeCurrRing(VMrDefault(curr_weight)); 4922 4856 } 4923 4857 newRing = currRing; … … 4945 4879 else 4946 4880 { 4947 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung4881 rChangeCurrRing(VMrDefault(curr_weight)); 4948 4882 } 4949 4883 newRing = currRing; … … 4957 4891 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 4958 4892 delete hilb_func; 4959 #endif // BUCHBERGER_ALG4893 #endif 4960 4894 tstd = tstd + clock() - to; 4961 4895 … … 4966 4900 4967 4901 to = clock(); 4968 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega). Gomega is a reduced Groebner basis w.r.t. the current ring. 4902 // compute a representation of the generators of submod (M) with respect 4903 // to those of mod (Gomega). 4904 // Gomega is a reduced Groebner basis w.r.t. the current ring. 4969 4905 F = MLifttwoIdeal(Gomega2, M1, G); 4970 4906 tlift = tlift + clock() - to; … … 5016 4952 else 5017 4953 { 5018 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung4954 rChangeCurrRing(VMrDefault(target_weight)); 5019 4955 } 5020 4956 F1 = idrMoveR(G, newRing,currRing); … … 5063 4999 * THE GROEBNER WALK ALGORITHM * 5064 5000 *******************************/ 5065 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing) 5001 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, 5002 ring baseRing, int reduction, int printout) 5066 5003 { 5067 BITSET save1 = si_opt_1; // save current options 5068 //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5069 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5070 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5004 // save current options 5005 BITSET save1 = si_opt_1; 5006 if(reduction == 0) 5007 { 5008 // no reduced Groebner basis 5009 si_opt_1 &= (~Sy_bit(OPT_REDSB)); 5010 // not tail reductions 5011 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); 5012 } 5071 5013 Set_Error(FALSE); 5072 5014 Overflow_Error = FALSE; … … 5109 5051 #endif 5110 5052 rComplete(currRing); 5111 #ifdef CHECK_IDEAL_MWALK 5112 idString(Go,"Go"); 5113 #endif 5053 //#ifdef CHECK_IDEAL_MWALK 5054 if(printout > 2) 5055 { 5056 idString(Go,"//** Mwalk: Go"); 5057 } 5058 //#endif 5114 5059 #ifdef TIME_TEST 5115 5060 to = clock(); 5116 5061 #endif 5117 if(orig_M->length() == nV) 5118 { 5119 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5120 } 5121 else 5122 { 5123 newRing = VMatrDefault(orig_M); 5124 } 5062 if(orig_M->length() == nV) 5063 { 5064 // define a new ring with ordering "(a(curr_weight),lp) 5065 newRing = VMrDefault(curr_weight); 5066 } 5067 else 5068 { 5069 newRing = VMatrDefault(orig_M); 5070 } 5125 5071 rChangeCurrRing(newRing); 5126 5072 ideal G = MstdCC(idrMoveR(Go,baseRing,currRing)); … … 5138 5084 to = clock(); 5139 5085 #endif 5140 #ifdef CHECK_IDEAL_MWALK 5141 idString(G,"G"); 5142 #endif 5143 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5086 //#ifdef CHECK_IDEAL_MWALK 5087 if(printout > 2) 5088 { 5089 idString(G,"//** Mwalk: G"); 5090 } 5091 //#endif 5092 // compute an initial form ideal of <G> w.r.t. "curr_vector" 5093 Gomega = MwalkInitialForm(G, curr_weight); 5144 5094 #ifdef TIME_TEST 5145 tif = tif + clock()-to; //time for computing initial form ideal 5146 #endif 5147 #ifdef CHECK_IDEAL_MWALK 5148 idString(Gomega,"Gomega"); 5149 #endif 5095 //time for computing initial form ideal 5096 tif = tif + clock()-to; 5097 #endif 5098 //#ifdef CHECK_IDEAL_MWALK 5099 if(printout > 1) 5100 { 5101 idString(Gomega,"//** Mwalk: Gomega"); 5102 } 5103 //#endif 5150 5104 #ifndef BUCHBERGER_ALG 5151 5105 if(isNolVector(curr_weight) == 0) … … 5162 5116 if(orig_M->length() == nV) 5163 5117 { 5164 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5118 // define a new ring with ordering "(a(curr_weight),lp) 5119 newRing = VMrDefault(curr_weight); 5165 5120 } 5166 5121 else … … 5173 5128 if(target_M->length() == nV) 5174 5129 { 5175 newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5130 //define a new ring with ordering "(a(curr_weight),Wp(target_weight))" 5131 newRing = VMrRefine(curr_weight,target_weight); 5176 5132 } 5177 5133 else 5178 5134 { 5135 //define a new ring with matrix ordering 5179 5136 newRing = VMatrRefine(target_M,curr_weight); 5180 5137 } … … 5197 5154 #endif 5198 5155 idSkipZeroes(M); 5199 #ifdef CHECK_IDEAL_MWALK 5200 PrintS("\n//** Mwalk: computed M.\n"); 5201 idString(M, "M"); 5202 #endif 5156 //#ifdef CHECK_IDEAL_MWALK 5157 if(printout > 2) 5158 { 5159 idString(M, "//** Mwalk: M"); 5160 } 5161 //#endif 5203 5162 //change the ring to baseRing 5204 5163 rChangeCurrRing(baseRing); … … 5210 5169 to = clock(); 5211 5170 #endif 5212 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring 5171 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), 5172 // where Gomega is a reduced Groebner basis w.r.t. the current ring 5213 5173 F = MLifttwoIdeal(Gomega2, M1, G); 5214 5174 #ifdef TIME_TEST 5215 5175 tlift = tlift + clock() - to; 5216 5176 #endif 5217 #ifdef CHECK_IDEAL_MWALK 5218 idString(F, "F"); 5219 #endif 5177 //#ifdef CHECK_IDEAL_MWALK 5178 if(printout > 2) 5179 { 5180 idString(F, "//** Mwalk: F"); 5181 } 5182 //#endif 5220 5183 idDelete(&Gomega2); 5221 5184 idDelete(&M1); … … 5227 5190 to = clock(); 5228 5191 #endif 5229 //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL); 5192 5230 5193 #ifdef TIME_TEST 5231 5194 tstd = tstd + clock() - to; 5232 5195 #endif 5233 5196 idSkipZeroes(G); 5234 #ifdef CHECK_IDEAL_MWALK 5235 idString(G, "G"); 5236 #endif 5197 //#ifdef CHECK_IDEAL_MWALK 5198 if(printout > 2) 5199 { 5200 idString(G, "//** Mwalk: G"); 5201 } 5202 //#endif 5237 5203 #ifdef TIME_TEST 5238 5204 to = clock(); … … 5242 5208 tnw = tnw + clock() - to; 5243 5209 #endif 5244 #ifdef PRINT_VECTORS 5245 MivString(curr_weight, target_weight, next_weight); 5246 #endif 5247 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1) 5248 { 5249 #ifdef CHECK_IDEAL_MWALK 5250 PrintS("\n//** Mwalk: entering last cone.\n"); 5251 #endif 5210 //#ifdef PRINT_VECTORS 5211 if(printout > 0) 5212 { 5213 MivString(curr_weight, target_weight, next_weight); 5214 } 5215 //#endif 5216 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || test_w_in_ConeCC(G, target_weight) == 1) 5217 { 5218 //#ifdef CHECK_IDEAL_MWALK 5219 if(printout > 0) 5220 { 5221 PrintS("\n//** Mwalk: entering last cone.\n"); 5222 } 5223 //#endif 5252 5224 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5253 5225 if(target_M->length() == nV) … … 5262 5234 Gomega1 = idrMoveR(Gomega, baseRing,currRing); 5263 5235 idDelete(&Gomega); 5264 #ifdef CHECK_IDEAL_MWALK 5265 idString(Gomega1, "Gomega"); 5266 #endif 5236 //#ifdef CHECK_IDEAL_MWALK 5237 if(printout > 1) 5238 { 5239 idString(Gomega1, "//** Mwalk: Gomega"); 5240 } 5241 //#endif 5267 5242 M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL); 5268 #ifdef CHECK_IDEAL_MWALK 5269 idString(M,"M"); 5270 #endif 5243 //#ifdef CHECK_IDEAL_MWALK 5244 if(printout > 1) 5245 { 5246 idString(M,"//** Mwalk: M"); 5247 } 5248 //#endif 5271 5249 rChangeCurrRing(baseRing); 5272 5250 M1 = idrMoveR(M, newRing,currRing); … … 5275 5253 idDelete(&Gomega1); 5276 5254 F = MLifttwoIdeal(Gomega2, M1, G); 5277 #ifdef CHECK_IDEAL_MWALK 5278 idString(F,"F"); 5279 #endif 5255 //#ifdef CHECK_IDEAL_MWALK 5256 if(printout > 2) 5257 { 5258 idString(F,"//** Mwalk: F"); 5259 } 5260 //#endif 5280 5261 idDelete(&Gomega2); 5281 5262 idDelete(&M1); … … 5289 5270 to = clock(); 5290 5271 #endif 5291 // if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5292 // { 5293 G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set 5294 // } 5272 //interreduce the Groebner basis <G> w.r.t. currRing 5273 G = kInterRedCC(G,NULL); 5295 5274 #ifdef TIME_TEST 5296 5275 tred = tred + clock() - to; … … 5299 5278 delete next_weight; 5300 5279 break; 5301 #ifdef CHECK_IDEAL_MWALK 5302 PrintS("\n//** Mwalk: last cone.\n"); 5303 #endif 5304 } 5305 #ifdef CHECK_IDEAL_MWALK 5306 PrintS("\n//** Mwalk: update weight vectors.\n"); 5307 #endif 5280 } 5308 5281 for(i=nV-1; i>=0; i--) 5309 5282 { … … 5316 5289 ideal result = idrMoveR(G,baseRing,currRing); 5317 5290 idDelete(&G); 5318 /*#ifdef CHECK_IDEAL_MWALK5319 pDelete(&p);5320 #endif*/5321 5291 delete tmp_weight; 5322 5292 delete ivNull; … … 5326 5296 #endif 5327 5297 #ifdef TIME_TEST 5328 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);5329 5298 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep); 5330 Print("\n//** Mwalk: Ergebnis.\n");5331 5299 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 5332 5300 //Print("\n// Overflow_Error? (%d)\n", Overflow_Error); 5333 5301 #endif 5302 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep); 5334 5303 return(result); 5335 5304 } 5336 5305 5337 // 07.11.20125338 // THE RANDOM WALK ALGORITHM ideal Go, intvec* orig_M, intvec* target_M, ring baseRing 5339 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, ring baseRing)5306 // THE RANDOM WALK ALGORITHM 5307 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, 5308 int reduction, int printout) 5340 5309 { 5341 5310 BITSET save1 = si_opt_1; // save current options 5342 //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5343 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5344 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5311 if(reduction == 0) 5312 { 5313 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5314 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5315 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5316 } 5345 5317 Set_Error(FALSE); 5346 5318 Overflow_Error = FALSE; … … 5352 5324 #endif 5353 5325 nstep=0; 5354 int i, nwalk,endwalks = 0;5355 int nV = baseRing->N;5326 int i,polylength,nwalk,endwalks = 0; 5327 int nV = currRing->N; 5356 5328 5357 5329 ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1; 5358 5330 ring newRing; 5359 ring XXRing = baseRing; 5331 ring baseRing = currRing; 5332 ring XXRing = currRing; 5360 5333 intvec* ivNull = new intvec(nV); 5361 5334 intvec* curr_weight = new intvec(nV); … … 5363 5336 intvec* exivlp = Mivlp(nV); 5364 5337 intvec* tmp_weight = new intvec(nV); 5338 intvec* next_weight= new intvec(nV); 5365 5339 for(i=0; i<nV; i++) 5366 5340 { … … 5383 5357 #endif 5384 5358 rComplete(currRing); 5385 #ifdef CHECK_IDEAL_MWALK5386 idString(Go,"Go");5387 #endif5388 5359 #ifdef TIME_TEST 5389 5360 to = clock(); 5390 5361 #endif 5391 5392 5393 5394 5395 5396 5397 5398 5362 if(orig_M->length() == nV) 5363 { 5364 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5365 } 5366 else 5367 { 5368 newRing = VMatrDefault(orig_M); 5369 } 5399 5370 rChangeCurrRing(newRing); 5400 5371 ideal G = MstdCC(idrMoveR(Go,baseRing,currRing)); … … 5412 5383 to = clock(); 5413 5384 #endif 5414 #ifdef CHECK_IDEAL_MWALK 5415 idString(G,"G"); 5416 #endif 5385 //#ifdef CHECK_IDEAL_MWALK 5386 if(printout > 2) 5387 { 5388 idString(G,"//** Mrwalk: G"); 5389 } 5390 //#endif 5417 5391 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5392 //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise 5393 polylength = lengthpoly(Gomega); 5418 5394 #ifdef TIME_TEST 5419 5395 tif = tif + clock()-to; //time for computing initial form ideal 5420 5396 #endif 5421 #ifdef CHECK_IDEAL_MWALK 5422 idString(Gomega,"Gomega"); 5423 #endif 5397 //#ifdef CHECK_IDEAL_MWALK 5398 if(printout > 1) 5399 { 5400 idString(Gomega,"//** Mrwalk: Gomega"); 5401 } 5402 //#endif 5424 5403 #ifndef BUCHBERGER_ALG 5425 5404 if(isNolVector(curr_weight) == 0) … … 5471 5450 #endif 5472 5451 idSkipZeroes(M); 5473 #ifdef CHECK_IDEAL_MWALK 5474 PrintS("\n//** Mwalk: computed M.\n"); 5475 idString(M, "M"); 5476 #endif 5452 //#ifdef CHECK_IDEAL_MWALK 5453 if(printout > 2) 5454 { 5455 idString(M, "//** Mrwalk: M"); 5456 } 5457 //#endif 5477 5458 //change the ring to baseRing 5478 5459 rChangeCurrRing(baseRing); … … 5484 5465 to = clock(); 5485 5466 #endif 5486 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring 5467 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), 5468 // where Gomega is a reduced Groebner basis w.r.t. the current ring 5487 5469 F = MLifttwoIdeal(Gomega2, M1, G); 5488 5470 #ifdef TIME_TEST 5489 5471 tlift = tlift + clock() - to; 5490 5472 #endif 5491 #ifdef CHECK_IDEAL_MWALK 5492 idString(F, "F"); 5493 #endif 5473 //#ifdef CHECK_IDEAL_MWALK 5474 if(printout > 2) 5475 { 5476 idString(F, "//** Mrwalk: F"); 5477 } 5478 //#endif 5494 5479 idDelete(&Gomega2); 5495 5480 idDelete(&M1); … … 5500 5485 #ifdef TIME_TEST 5501 5486 to = clock(); 5502 #endif5503 //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);5504 #ifdef TIME_TEST5505 5487 tstd = tstd + clock() - to; 5506 5488 #endif 5507 5489 idSkipZeroes(G); 5508 #ifdef CHECK_IDEAL_MWALK 5509 idString(G, "G"); 5510 #endif 5490 //#ifdef CHECK_IDEAL_MWALK 5491 if(printout > 2) 5492 { 5493 idString(G, "//** Mrwalk: G"); 5494 } 5495 //#endif 5511 5496 #ifdef TIME_TEST 5512 5497 to = clock(); 5513 5498 #endif 5514 intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G); 5499 next_weight = MwalkNextWeightCC(curr_weight,target_weight,G); 5500 if(polylength > 0) 5501 { 5502 //there is a polynomial in Gomega with at least 3 monomials, 5503 //low-dimensional facet of the cone 5504 delete next_weight; 5505 next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg); 5506 } 5515 5507 #ifdef TIME_TEST 5516 5508 tnw = tnw + clock() - to; 5517 5509 #endif 5518 #ifdef PRINT_VECTORS 5519 MivString(curr_weight, target_weight, next_weight); 5520 #endif 5510 //#ifdef PRINT_VECTORS 5511 if(printout > 0) 5512 { 5513 MivString(curr_weight, target_weight, next_weight); 5514 } 5515 //#endif 5521 5516 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1) 5522 5517 { … … 5525 5520 #endif 5526 5521 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5522 //#ifdef CHECK_IDEAL_MWALK 5523 if(printout > 1) 5524 { 5525 idString(Gomega, "//** Mrwalk: Gomega"); 5526 } 5527 //#endif 5527 5528 if(target_M->length() == nV) 5528 5529 { … … 5536 5537 Gomega1 = idrMoveR(Gomega, baseRing,currRing); 5537 5538 idDelete(&Gomega); 5538 #ifdef CHECK_IDEAL_MWALK5539 idString(Gomega1, "Gomega");5540 #endif5541 5539 M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL); 5542 #ifdef CHECK_IDEAL_MWALK 5543 idString(M,"M"); 5544 #endif 5540 //#ifdef CHECK_IDEAL_MWALK 5541 if(printout > 2) 5542 { 5543 idString(M,"//** Mrwalk: M"); 5544 } 5545 //#endif 5545 5546 rChangeCurrRing(baseRing); 5546 5547 M1 = idrMoveR(M, newRing,currRing); … … 5549 5550 idDelete(&Gomega1); 5550 5551 F = MLifttwoIdeal(Gomega2, M1, G); 5551 #ifdef CHECK_IDEAL_MWALK5552 idString(F,"F");5553 #endif5554 5552 idDelete(&Gomega2); 5555 5553 idDelete(&M1); … … 5558 5556 idDelete(&F); 5559 5557 baseRing = currRing; 5560 si_opt_1 = save1; //set original options, e. g. option(RedSB)5561 5558 idSkipZeroes(G); 5562 5559 #ifdef TIME_TEST 5563 5560 to = clock(); 5564 5561 #endif 5565 // if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5566 // { 5567 //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set 5568 // } 5562 //#ifdef CHECK_IDEAL_MWALK 5563 if(printout > 2) 5564 { 5565 idString(G,"//** Mrwalk: G"); 5566 } 5567 /*#endif 5568 if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5569 {*/ 5570 G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing 5571 // } 5569 5572 #ifdef TIME_TEST 5570 5573 tred = tred + clock() - to; … … 5573 5576 delete next_weight; 5574 5577 break; 5575 #ifdef CHECK_IDEAL_MWALK 5576 PrintS("\n//** Mwalk: last cone.\n"); 5577 #endif 5578 } 5579 #ifdef CHECK_IDEAL_MWALK 5580 PrintS("\n//** Mwalk: update weight vectors.\n"); 5581 #endif 5578 } 5582 5579 for(i=nV-1; i>=0; i--) 5583 5580 { … … 5587 5584 delete next_weight; 5588 5585 } 5586 baseRing = currRing; 5589 5587 rChangeCurrRing(XXRing); 5590 5588 ideal result = idrMoveR(G,baseRing,currRing); 5591 5589 idDelete(&G); 5592 /*#ifdef CHECK_IDEAL_MWALK 5593 pDelete(&p); 5594 #endif*/ 5590 si_opt_1 = save1; //set original options, e. g. option(RedSB) 5595 5591 delete tmp_weight; 5596 5592 delete ivNull; … … 5599 5595 delete last_omega; 5600 5596 #endif 5597 Print("\n//** Mrwalk: Groebner Walk took %d steps.\n", nstep); 5601 5598 #ifdef TIME_TEST 5602 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);5603 5599 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep); 5604 Print("\n//** Mwalk: Ergebnis.\n");5605 5600 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 5606 5601 //Print("\n// Overflow_Error? (%d)\n", Overflow_Error); … … 5749 5744 // use kStd, if nP = 0, else call LastGB 5750 5745 ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight, 5751 intvec* target_weight, int nP )5746 intvec* target_weight, int nP, int reduction, int printout) 5752 5747 { 5748 BITSET save1 = si_opt_1; // save current options 5749 if(reduction == 0) 5750 { 5751 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5752 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5753 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5754 } 5753 5755 Set_Error(FALSE ); 5754 5756 Overflow_Error = FALSE; … … 5788 5790 ring XXRing = currRing; 5789 5791 5790 5791 5792 to = clock(); 5792 / * perturbs the original vector */5793 // perturbs the original vector 5793 5794 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp" 5794 5795 { … … 5807 5808 DefRingPar(curr_weight); 5808 5809 else 5809 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 15810 rChangeCurrRing(VMrDefault(curr_weight)); 5810 5811 5811 5812 G = idrMoveR(Go, XXRing,currRing); … … 5822 5823 ring HelpRing = currRing; 5823 5824 5824 / * perturbs the target weight vector */5825 // perturbs the target weight vector 5825 5826 if(tp_deg > 1 && tp_deg <= nV) 5826 5827 { … … 5828 5829 DefRingPar(target_weight); 5829 5830 else 5830 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 25831 rChangeCurrRing(VMrDefault(target_weight)); 5831 5832 5832 5833 TargetRing = currRing; … … 5850 5851 G = idrMoveR(ssG, TargetRing,currRing); 5851 5852 } 5852 /* 5853 Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg); 5854 ivString(curr_weight, "new sigma"); 5855 ivString(target_weight, "new tau"); 5856 */ 5853 if(printout > 0) 5854 { 5855 Print("\n//** Mpwalk: Perturbation Walk of degree (%d,%d):",op_deg,tp_deg); 5856 ivString(curr_weight, "//** Mpwalk: new current weight"); 5857 ivString(target_weight, "//** Mpwalk: new target weight"); 5858 } 5857 5859 while(1) 5858 5860 { … … 5862 5864 "curr_weight" */ 5863 5865 Gomega = MwalkInitialForm(G, curr_weight); 5864 5866 //#ifdef CHECK_IDEAL_MWALK 5867 if(printout > 1) 5868 { 5869 idString(Gomega,"//** Mpwalk: Gomega"); 5870 } 5871 //#endif 5865 5872 5866 5873 #ifdef ENDWALKS 5867 if(endwalks == 1){ 5874 if(endwalks == 1) 5875 { 5868 5876 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 5869 5877 idElements(G, "G"); 5870 // idElements(Gomega, "Gw");5871 5878 headidString(G, "G"); 5872 //headidString(Gomega, "Gw");5873 5879 } 5874 5880 #endif … … 5889 5895 DefRingPar(curr_weight); 5890 5896 else 5891 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 35897 rChangeCurrRing(VMrDefault(curr_weight)); 5892 5898 5893 5899 newRing = currRing; … … 5916 5922 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 5917 5923 delete hilb_func; 5918 #endif // BUCHBERGER_ALG 5924 #endif 5925 //#ifdef CHECK_IDEAL_MWALK 5926 if(printout > 2) 5927 { 5928 idString(M,"//** Mpwalk: M"); 5929 } 5930 //#endif 5919 5931 5920 5932 if(endwalks == 1){ … … 5932 5944 M1 = idrMoveR(M, newRing,currRing); 5933 5945 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 5934 5935 //if(endwalks==1) PrintS("\n// Lifting is working:..");5936 5946 5937 5947 to=clock(); … … 5945 5955 xtlift=clock()-to; 5946 5956 5957 //#ifdef CHECK_IDEAL_MWALK 5958 if(printout > 2) 5959 { 5960 idString(F,"//** Mpwalk: F"); 5961 } 5962 //#endif 5963 5947 5964 idDelete(&M1); 5948 5965 idDelete(&Gomega2); … … 5952 5969 rChangeCurrRing(newRing); 5953 5970 F1 = idrMoveR(F, oldRing,currRing); 5954 5955 //if(endwalks==1)PrintS("\n// InterRed is working now:");5956 5971 5957 5972 to=clock(); … … 5969 5984 5970 5985 to=clock(); 5971 / * compute a next weight vector */5986 // compute a next weight vector 5972 5987 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 5973 5988 tnw=tnw+clock()-to; 5974 #ifdef PRINT_VECTORS 5975 MivString(curr_weight, target_weight, next_weight); 5976 #endif 5989 //#ifdef PRINT_VECTORS 5990 if(printout > 2) 5991 { 5992 MivString(curr_weight, target_weight, next_weight); 5993 } 5994 //#endif 5977 5995 5978 5996 if(Overflow_Error == TRUE) … … 6012 6030 DefRingPar(orig_target); 6013 6031 else 6014 rChangeCurrRing(VMrDefault(orig_target)); //Aenderung6032 rChangeCurrRing(VMrDefault(orig_target)); 6015 6033 6016 6034 TargetRing=currRing; … … 6066 6084 Eresult = idrMoveR(G, newRing,currRing); 6067 6085 } 6086 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6068 6087 delete ivNull; 6069 6088 if(tp_deg != 1) … … 6080 6099 tnw+xtnw); 6081 6100 6082 Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6083 Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6084 #endif 6101 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6102 //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6103 #endif 6104 Print("\n//** Mpwalk: Perturbation Walk took %d steps.\n", nstep); 6105 return(Eresult); 6106 } 6107 6108 /******************************************************* 6109 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT * 6110 *******************************************************/ 6111 ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, 6112 int op_deg, int tp_deg, int nP, int reduction, int printout) 6113 { 6114 BITSET save1 = si_opt_1; // save current options 6115 if(reduction == 0) 6116 { 6117 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 6118 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 6119 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 6120 } 6121 Set_Error(FALSE); 6122 Overflow_Error = FALSE; 6123 //Print("// pSetm_Error = (%d)", ErrorCheck()); 6124 6125 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; 6126 xtextra=0; 6127 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; 6128 tinput = clock(); 6129 6130 clock_t tim; 6131 6132 nstep = 0; 6133 int i, ntwC=1, ntestw=1, polylength, nV = currRing->N; 6134 int endwalks=0; 6135 6136 ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG; 6137 ring newRing, oldRing, TargetRing; 6138 intvec* iv_M_dp; 6139 intvec* iv_M_lp; 6140 intvec* exivlp = Mivlp(nV); 6141 intvec* curr_weight = new intvec(nV); 6142 intvec* target_weight = new intvec(nV); 6143 for(i=0; i<nV; i++) 6144 { 6145 (*curr_weight)[i] = (*orig_M)[i]; 6146 (*target_weight)[i] = (*target_M)[i]; 6147 } 6148 intvec* orig_target = target_weight; 6149 intvec* pert_target_vector = target_weight; 6150 intvec* ivNull = new intvec(nV); 6151 intvec* iv_dp = MivUnit(nV);// define (1,1,...,1) 6152 #ifndef BUCHBERGER_ALG 6153 intvec* hilb_func; 6154 #endif 6155 intvec* next_weight; 6156 6157 // to avoid (1,0,...,0) as the target vector 6158 intvec* last_omega = new intvec(nV); 6159 for(i=nV-1; i>0; i--) 6160 (*last_omega)[i] = 1; 6161 (*last_omega)[0] = 10000; 6162 6163 ring XXRing = currRing; 6164 6165 to = clock(); 6166 // perturbs the original vector 6167 if(orig_M->length() == nV) 6168 { 6169 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp" 6170 { 6171 G = MstdCC(Go); 6172 tostd = clock()-to; 6173 if(op_deg != 1) 6174 { 6175 iv_M_dp = MivMatrixOrderdp(nV); 6176 //ivString(iv_M_dp, "iv_M_dp"); 6177 curr_weight = MPertVectors(G, iv_M_dp, op_deg); 6178 } 6179 } 6180 else 6181 { 6182 //define ring order := (a(curr_weight),lp); 6183 if (rParameter(currRing) != NULL) 6184 DefRingPar(curr_weight); 6185 else 6186 rChangeCurrRing(VMrDefault(curr_weight)); 6187 6188 G = idrMoveR(Go, XXRing,currRing); 6189 G = MstdCC(G); 6190 tostd = clock()-to; 6191 if(op_deg != 1) 6192 { 6193 iv_M_dp = MivMatrixOrder(curr_weight); 6194 curr_weight = MPertVectors(G, iv_M_dp, op_deg); 6195 } 6196 } 6197 } 6198 else 6199 { 6200 rChangeCurrRing(VMatrDefault(orig_M)); 6201 G = idrMoveR(Go, XXRing,currRing); 6202 G = MstdCC(G); 6203 tostd = clock()-to; 6204 if(op_deg != 1) 6205 { 6206 curr_weight = MPertVectors(G, orig_M, op_deg); 6207 } 6208 } 6209 6210 delete iv_dp; 6211 if(op_deg != 1) delete iv_M_dp; 6212 6213 ring HelpRing = currRing; 6214 6215 // perturbs the target weight vector 6216 if(target_M->length() == nV) 6217 { 6218 if(tp_deg > 1 && tp_deg <= nV) 6219 { 6220 if (rParameter(currRing) != NULL) 6221 DefRingPar(target_weight); 6222 else 6223 rChangeCurrRing(VMrDefault(target_weight)); 6224 6225 TargetRing = currRing; 6226 ssG = idrMoveR(G,HelpRing,currRing); 6227 if(MivSame(target_weight, exivlp) == 1) 6228 { 6229 iv_M_lp = MivMatrixOrderlp(nV); 6230 //ivString(iv_M_lp, "iv_M_lp"); 6231 //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg); 6232 target_weight = MPertVectors(ssG, iv_M_lp, tp_deg); 6233 } 6234 else 6235 { 6236 iv_M_lp = MivMatrixOrder(target_weight); 6237 //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg); 6238 target_weight = MPertVectors(ssG, iv_M_lp, tp_deg); 6239 } 6240 delete iv_M_lp; 6241 pert_target_vector = target_weight; 6242 rChangeCurrRing(HelpRing); 6243 G = idrMoveR(ssG, TargetRing,currRing); 6244 } 6245 } 6246 else 6247 { 6248 if(tp_deg > 1 && tp_deg <= nV) 6249 { 6250 rChangeCurrRing(VMatrDefault(target_M)); 6251 TargetRing = currRing; 6252 ssG = idrMoveR(G,HelpRing,currRing); 6253 target_weight = MPertVectors(ssG, target_M, tp_deg); 6254 } 6255 } 6256 if(printout > 0) 6257 { 6258 Print("\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg); 6259 ivString(curr_weight, "//** Mprwalk: new current weight"); 6260 ivString(target_weight, "//** Mprwalk: new target weight"); 6261 } 6262 while(1) 6263 { 6264 nstep ++; 6265 to = clock(); 6266 /* compute an initial form ideal of <G> w.r.t. the weight vector 6267 "curr_weight" */ 6268 Gomega = MwalkInitialForm(G, curr_weight); 6269 //#ifdef CHECK_IDEAL_MWALK 6270 if(printout > 1) 6271 { 6272 idString(Gomega,"//** Mprwalk: Gomega"); 6273 } 6274 //#endif 6275 polylength = lengthpoly(Gomega); 6276 #ifdef ENDWALKS 6277 if(endwalks == 1) 6278 { 6279 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6280 idElements(G, "G"); 6281 headidString(G, "G"); 6282 } 6283 #endif 6284 6285 tif = tif + clock()-to; 6286 6287 #ifndef BUCHBERGER_ALG 6288 if(isNolVector(curr_weight) == 0) 6289 hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing); 6290 else 6291 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 6292 #endif // BUCHBERGER_ALG 6293 6294 oldRing = currRing; 6295 6296 if(target_M->length() == nV) 6297 { 6298 // define a new ring with ordering "(a(curr_weight),lp) 6299 if (rParameter(currRing) != NULL) 6300 DefRingPar(curr_weight); 6301 else 6302 rChangeCurrRing(VMrDefault(curr_weight)); 6303 } 6304 else 6305 { 6306 rChangeCurrRing(VMatrRefine(target_M,curr_weight)); 6307 } 6308 newRing = currRing; 6309 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 6310 6311 #ifdef ENDWALKS 6312 if(endwalks==1) 6313 { 6314 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6315 idElements(Gomega1, "Gw"); 6316 headidString(Gomega1, "headGw"); 6317 PrintS("\n// compute a rGB of Gw:\n"); 6318 6319 #ifndef BUCHBERGER_ALG 6320 ivString(hilb_func, "w"); 6321 #endif 6322 } 6323 #endif 6324 6325 tim = clock(); 6326 to = clock(); 6327 /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */ 6328 #ifdef BUCHBERGER_ALG 6329 M = MstdhomCC(Gomega1); 6330 #else 6331 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 6332 delete hilb_func; 6333 #endif 6334 //#ifdef CHECK_IDEAL_MWALK 6335 if(printout > 2) 6336 { 6337 idString(M,"//** Mprwalk: M"); 6338 } 6339 //#endif 6340 6341 if(endwalks == 1) 6342 { 6343 xtstd = xtstd+clock()-to; 6344 #ifdef ENDWALKS 6345 Print("\n// time for the last std(Gw) = %.2f sec\n", 6346 ((double) clock())/1000000 -((double)tim) /1000000); 6347 #endif 6348 } 6349 else 6350 tstd=tstd+clock()-to; 6351 6352 /* change the ring to oldRing */ 6353 rChangeCurrRing(oldRing); 6354 M1 = idrMoveR(M, newRing,currRing); 6355 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 6356 6357 to=clock(); 6358 /* compute a representation of the generators of submod (M) 6359 with respect to those of mod (Gomega). 6360 Gomega is a reduced Groebner basis w.r.t. the current ring */ 6361 F = MLifttwoIdeal(Gomega2, M1, G); 6362 if(endwalks != 1) 6363 tlift = tlift+clock()-to; 6364 else 6365 xtlift=clock()-to; 6366 6367 //#ifdef CHECK_IDEAL_MWALK 6368 if(printout > 2) 6369 { 6370 idString(F,"//** Mprwalk: F"); 6371 } 6372 //#endif 6373 6374 idDelete(&M1); 6375 idDelete(&Gomega2); 6376 idDelete(&G); 6377 6378 /* change the ring to newRing */ 6379 rChangeCurrRing(newRing); 6380 F1 = idrMoveR(F, oldRing,currRing); 6381 6382 to=clock(); 6383 /* reduce the Groebner basis <G> w.r.t. new ring */ 6384 G = kInterRedCC(F1, NULL); 6385 if(endwalks != 1) 6386 tred = tred+clock()-to; 6387 else 6388 xtred=clock()-to; 6389 6390 idDelete(&F1); 6391 6392 if(endwalks == 1) 6393 break; 6394 6395 to=clock(); 6396 // compute a next weight vector 6397 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 6398 if(polylength > 0) 6399 { 6400 //there is a polynomial in Gomega with at least 3 monomials, 6401 //low-dimensional facet of the cone 6402 delete next_weight; 6403 next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg); 6404 } 6405 tnw=tnw+clock()-to; 6406 //#ifdef PRINT_VECTORS 6407 if(printout > 2) 6408 { 6409 MivString(curr_weight, target_weight, next_weight); 6410 } 6411 //#endif 6412 6413 if(Overflow_Error == TRUE) 6414 { 6415 ntwC = 0; 6416 //ntestomega = 1; 6417 //Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6418 //idElements(G, "G"); 6419 delete next_weight; 6420 goto FINISH_160302; 6421 } 6422 if(MivComp(next_weight, ivNull) == 1){ 6423 newRing = currRing; 6424 delete next_weight; 6425 //Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6426 break; 6427 } 6428 if(MivComp(next_weight, target_weight) == 1) 6429 endwalks = 1; 6430 6431 for(i=nV-1; i>=0; i--) 6432 (*curr_weight)[i] = (*next_weight)[i]; 6433 6434 delete next_weight; 6435 }//while 6436 6437 if(tp_deg != 1) 6438 { 6439 FINISH_160302: 6440 if(target_M->length() == nV) 6441 { 6442 if(MivSame(orig_target, exivlp) == 1) 6443 if (rParameter(currRing) != NULL) 6444 DefRingParlp(); 6445 else 6446 VMrDefaultlp(); 6447 else 6448 if (rParameter(currRing) != NULL) 6449 DefRingPar(orig_target); 6450 else 6451 rChangeCurrRing(VMrDefault(orig_target)); 6452 } 6453 else 6454 { 6455 rChangeCurrRing(VMatrDefault(target_M)); 6456 } 6457 TargetRing=currRing; 6458 F1 = idrMoveR(G, newRing,currRing); 6459 #ifdef CHECK_IDEAL 6460 headidString(G, "G"); 6461 #endif 6462 6463 // check whether the pertubed target vector stays in the correct cone 6464 if(ntwC != 0){ 6465 ntestw = test_w_in_ConeCC(F1, pert_target_vector); 6466 } 6467 6468 if( ntestw != 1 || ntwC == 0) 6469 { 6470 /* 6471 if(ntestw != 1){ 6472 ivString(pert_target_vector, "tau"); 6473 PrintS("\n// ** perturbed target vector doesn't stay in cone!!"); 6474 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6475 idElements(F1, "G"); 6476 } 6477 */ 6478 // LastGB is "better" than the kStd subroutine 6479 to=clock(); 6480 ideal eF1; 6481 if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1 || target_M->length() != nV){ 6482 // PrintS("\n// ** calls \"std\" to compute a GB"); 6483 eF1 = MstdCC(F1); 6484 idDelete(&F1); 6485 } 6486 else { 6487 // PrintS("\n// ** calls \"LastGB\" to compute a GB"); 6488 rChangeCurrRing(newRing); 6489 ideal F2 = idrMoveR(F1, TargetRing,currRing); 6490 eF1 = LastGB(F2, curr_weight, tp_deg-1); 6491 F2=NULL; 6492 } 6493 xtextra=clock()-to; 6494 ring exTargetRing = currRing; 6495 6496 rChangeCurrRing(XXRing); 6497 Eresult = idrMoveR(eF1, exTargetRing,currRing); 6498 } 6499 else{ 6500 rChangeCurrRing(XXRing); 6501 Eresult = idrMoveR(F1, TargetRing,currRing); 6502 } 6503 } 6504 else { 6505 rChangeCurrRing(XXRing); 6506 Eresult = idrMoveR(G, newRing,currRing); 6507 } 6508 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6509 delete ivNull; 6510 if(tp_deg != 1) 6511 delete target_weight; 6512 6513 if(op_deg != 1 ) 6514 delete curr_weight; 6515 6516 delete exivlp; 6517 delete last_omega; 6518 6519 #ifdef TIME_TEST 6520 TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred, 6521 tnw+xtnw); 6522 6523 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6524 //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6525 #endif 6526 Print("\n//** Mprwalk: Perturbation Walk took %d steps.\n", nstep); 6085 6527 return(Eresult); 6086 6528 } … … 6108 6550 * Perturb the start weight vector at the top level, i.e. nlev = 1 * 6109 6551 ***********************************************************************/ 6110 static ideal rec_fractal_call(ideal G, int nlev, intvec* omtmp)6552 static ideal rec_fractal_call(ideal G, int nlev, intvec* ivtarget, int printout) 6111 6553 { 6112 6554 Overflow_Error = FALSE; … … 6125 6567 intvec* next_vect; 6126 6568 intvec* omega2 = new intvec(nV); 6569 intvec* omtmp = new intvec(nV); 6127 6570 intvec* altomega = new intvec(nV); 6128 6571 6572 for(i = nV -1; i>0; i--) 6573 { 6574 (*omtmp)[i] = (*ivtarget)[i]; 6575 } 6129 6576 //BOOLEAN isnewtarget = FALSE; 6130 6577 … … 6167 6614 NEXT_VECTOR_FRACTAL: 6168 6615 to=clock(); 6169 / * determine the next border */6616 // determine the next border 6170 6617 next_vect = MkInterRedNextWeight(omega,omega2,G); 6171 6618 xtnw=xtnw+clock()-to; 6172 #ifdef PRINT_VECTORS 6173 MivString(omega, omega2, next_vect); 6174 #endif 6619 6175 6620 oRing = currRing; 6176 6621 6177 / * We only perturb the current target vector at the recursion level 1 */6622 // We only perturb the current target vector at the recursion level 1 6178 6623 if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3 6179 6624 if (MivComp(next_vect, omega2) == 1) 6180 6625 { 6181 /* to dispense with taking initial (and lifting/interreducing 6182 after the call of recursion */ 6183 //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev); 6184 //idElements(G, "G"); 6626 // to dispense with taking initial (and lifting/interreducing 6627 // after the call of recursion 6628 if(printout > 0) 6629 { 6630 Print("\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev); 6631 //idElements(G, "G"); 6632 } 6185 6633 6186 6634 Xngleich = 1; 6187 6635 nlev +=1; 6188 6636 6189 if (rParameter(currRing) != NULL) 6190 DefRingPar(omtmp); 6637 if(ivtarget->length() == nV) 6638 { 6639 if (rParameter(currRing) != NULL) 6640 DefRingPar(omtmp); 6641 else 6642 rChangeCurrRing(VMrDefault(omtmp)); 6643 } 6191 6644 else 6192 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3 6193 6645 { 6646 rChangeCurrRing(VMatrDefault(ivtarget)); 6647 } 6194 6648 testring = currRing; 6195 6649 Gt = idrMoveR(G, oRing,currRing); 6196 6650 6197 /* perturb the original target vector w.r.t. the current GB */ 6198 delete Xtau; 6199 Xtau = NewVectorlp(Gt); 6651 // perturb the original target vector w.r.t. the current GB 6652 if(ivtarget->length() == nV) 6653 { 6654 delete Xtau; 6655 Xtau = NewVectorlp(Gt); 6656 } 6657 else 6658 { 6659 delete Xtau; 6660 Xtau = Mfpertvector(Gt,ivtarget); 6661 } 6200 6662 6201 6663 rChangeCurrRing(oRing); 6202 6664 G = idrMoveR(Gt, testring,currRing); 6203 6665 6204 / * perturb the current vector w.r.t. the current GB */6666 // perturb the current vector w.r.t. the current GB 6205 6667 Mwlp = MivWeightOrderlp(omega); 6206 6668 Xsigma = Mfpertvector(G, Mwlp); … … 6220 6682 next_vect = MkInterRedNextWeight(omega,omega2,G); 6221 6683 xtnw=xtnw+clock()-to; 6222 6223 #ifdef PRINT_VECTORS 6684 } 6685 //#ifdef PRINT_VECTORS 6686 if(printout > 0) 6687 { 6224 6688 MivString(omega, omega2, next_vect); 6225 #endif 6226 } 6227 6689 } 6690 //#endif 6228 6691 6229 6692 /* check whether the the computed vector is in the correct cone */ … … 6234 6697 { 6235 6698 delete next_vect; 6236 if (rParameter(currRing) != NULL) 6237 { 6238 DefRingPar(omtmp); 6699 if(ivtarget->length() == nV) 6700 { 6701 if (rParameter(currRing) != NULL) 6702 DefRingPar(omtmp); 6703 else 6704 rChangeCurrRing(VMrDefault(omtmp)); 6239 6705 } 6240 6706 else 6241 6707 { 6242 rChangeCurrRing(VM rDefault1(omtmp)); // Aenderung46708 rChangeCurrRing(VMatrDefault(ivtarget)); 6243 6709 } 6244 6710 #ifdef TEST_OVERFLOW … … 6246 6712 Gt = NULL; return(Gt); 6247 6713 #endif 6248 6249 //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing)); 6714 if(printout > 0) 6715 { 6716 Print("\n//** rec_fractal_call: applying Buchberger's algorithm in ring r = %s;", 6717 rString(currRing)); 6718 } 6250 6719 to=clock(); 6251 6720 Gt = idrMoveR(G, oRing,currRing); … … 6256 6725 delete omega2; 6257 6726 delete altomega; 6258 6259 //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks); 6260 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6727 if(printout > 0) 6728 { 6729 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6730 nlev, nwalks); 6731 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6732 } 6733 6261 6734 nnflow ++; 6262 6735 … … 6275 6748 if (MivComp(next_vect, XivNull) == 1) 6276 6749 { 6277 if (rParameter(currRing) != NULL) 6278 DefRingPar(omtmp); 6750 if(ivtarget->length() == nV) 6751 { 6752 if (rParameter(currRing) != NULL) 6753 DefRingPar(omtmp); 6754 else 6755 rChangeCurrRing(VMrDefault(omtmp)); 6756 } 6279 6757 else 6280 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5 6758 { 6759 rChangeCurrRing(VMatrDefault(ivtarget)); 6760 } 6281 6761 6282 6762 testring = currRing; … … 6287 6767 delete next_vect; 6288 6768 delete altomega; 6289 //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks); 6290 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6291 6769 if(printout > 0) 6770 { 6771 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6772 nlev, nwalks); 6773 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6774 } 6292 6775 return (Gt); 6293 6776 } … … 6300 6783 //07.08.03 6301 6784 //ivString(Xtau, "old Xtau"); 6302 intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 6785 intvec* Xtautmp; 6786 if(ivtarget->length() == nV) 6787 { 6788 Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 6789 } 6790 else 6791 { 6792 Xtautmp = Mfpertvector(Gt, ivtarget); 6793 } 6303 6794 #ifdef TEST_OVERFLOW 6304 6795 if(Overflow_Error == TRUE) … … 6328 6819 6329 6820 FRACTAL_MSTDCC: 6330 //Print("\n// apply BB-Alg in ring = %s;", rString(currRing)); 6821 if(printout > 0) 6822 { 6823 Print("\n//** rec_fractal_call: apply Buchberger's algorithm in ring = %s.\n", 6824 rString(currRing)); 6825 } 6331 6826 to=clock(); 6332 6827 G = MstdCC(Gt); … … 6336 6831 6337 6832 // update the original target vector w.r.t. the current GB 6338 if(MivSame(Xivinput, Xivlp) == 1) 6339 if (rParameter(currRing) != NULL) 6340 DefRingParlp(); 6833 if(ivtarget->length() == nV) 6834 { 6835 if(MivSame(Xivinput, Xivlp) == 1) 6836 if (rParameter(currRing) != NULL) 6837 DefRingParlp(); 6838 else 6839 VMrDefaultlp(); 6341 6840 else 6342 VMrDefaultlp(); 6841 if (rParameter(currRing) != NULL) 6842 DefRingPar(Xivinput); 6843 else 6844 rChangeCurrRing(VMrDefault(Xivinput)); 6845 } 6343 6846 else 6344 if (rParameter(currRing) != NULL) 6345 DefRingPar(Xivinput); 6346 else 6347 rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6 6348 6847 { 6848 rChangeCurrRing(VMatrRefine(ivtarget,Xivinput)); 6849 } 6349 6850 testring = currRing; 6350 6851 Gt = idrMoveR(G, oRing,currRing); … … 6359 6860 delete next_vect; 6360 6861 delete altomega; 6361 /* 6362 Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks); 6363 Print(" ** Overflow_Error? (%d)", Overflow_Error); 6364 */ 6862 if(printout > 0) 6863 { 6864 Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n", 6865 nlev, nwalks); 6866 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6867 } 6365 6868 if(Overflow_Error == TRUE) 6366 6869 nnflow ++; … … 6381 6884 Gomega = MwalkInitialForm(G, omega); 6382 6885 xtif=xtif+clock()-to; 6383 6886 if(printout > 1) 6887 { 6888 idString(Gomega,"//** rec_fractal_call: Gomega"); 6889 } 6384 6890 #ifndef BUCHBERGER_ALG 6385 6891 if(isNolVector(omega) == 0) … … 6388 6894 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 6389 6895 #endif // BUCHBERGER_ALG 6390 6391 if (rParameter(currRing) != NULL) 6392 DefRingPar(omega); 6896 if(ivtarget->length() == nV) 6897 { 6898 if (rParameter(currRing) != NULL) 6899 DefRingPar(omega); 6900 else 6901 rChangeCurrRing(VMrDefault(omega)); 6902 } 6393 6903 else 6394 rChangeCurrRing(VMrDefault1(omega)); //Aenderung7 6395 6904 { 6905 rChangeCurrRing(VMatrRefine(ivtarget,omega)); 6906 } 6396 6907 Gomega1 = idrMoveR(Gomega, oRing,currRing); 6397 6908 6398 / * Maximal recursion depth, to compute a red. GB */6399 / * Fractal walk with the alternative recursion */6400 / * alternative recursion */6909 // Maximal recursion depth, to compute a red. GB 6910 // Fractal walk with the alternative recursion 6911 // alternative recursion 6401 6912 // if(nlev == nV || lengthpoly(Gomega1) == 0) 6402 6913 if(nlev == Xnlev || lengthpoly(Gomega1) == 0) 6403 6914 //if(nlev == nV) // blind recursion 6404 6915 { 6405 /*6406 if(Xnlev != nV)6407 {6408 Print("\n// ** Xnlev = %d", Xnlev);6409 ivString(Xtau, "Xtau");6410 }6411 */6412 6916 to=clock(); 6413 6917 #ifdef BUCHBERGER_ALG … … 6419 6923 xtstd=xtstd+clock()-to; 6420 6924 } 6421 else { 6925 else 6926 { 6422 6927 rChangeCurrRing(oRing); 6423 6928 Gomega1 = idrMoveR(Gomega1, oRing,currRing); 6424 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega); 6425 } 6426 6427 //convert a Groebner basis from a ring to another ring, 6929 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout); 6930 } 6931 if(printout > 2) 6932 { 6933 idString(Gresult,"//** rec_fractal_call: M"); 6934 } 6935 //convert a Groebner basis from a ring to another ring 6428 6936 new_ring = currRing; 6429 6937 … … 6433 6941 6434 6942 to=clock(); 6435 / * Lifting process */6943 // Lifting process 6436 6944 F = MLifttwoIdeal(Gomega2, Gresult1, G); 6437 6945 xtlift=xtlift+clock()-to; 6946 if(printout > 2) 6947 { 6948 idString(F,"//** rec_fractal_call: F"); 6949 } 6438 6950 idDelete(&Gresult1); 6439 6951 idDelete(&Gomega2); … … 6454 6966 * Perturb the start weight vector at the top level with random element * 6455 6967 ************************************************************************/ 6456 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* omtmp, int weight_rad) 6968 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* ivtarget, 6969 int weight_rad, int printout) 6457 6970 { 6458 6971 Overflow_Error = FALSE; 6459 6972 //Print("\n\n// Entering the %d-th recursion:", nlev); 6460 6973 6461 int i, nV = currRing->N;6974 int i, polylength, nV = currRing->N; 6462 6975 ring new_ring, testring; 6463 6976 //ring extoRing; … … 6471 6984 intvec* next_vect; 6472 6985 intvec* omega2 = new intvec(nV); 6986 intvec* omtmp = new intvec(nV); 6473 6987 intvec* altomega = new intvec(nV); 6474 6988 6475 6989 //BOOLEAN isnewtarget = FALSE; 6476 6990 6991 for(i = nV -1; i>0; i--) 6992 { 6993 (*omtmp)[i] = (*ivtarget)[i]; 6994 } 6477 6995 // to avoid (1,0,...,0) as the target vector (Hans) 6478 6996 intvec* last_omega = new intvec(nV); … … 6514 7032 to=clock(); 6515 7033 /* determine the next border */ 6516 next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev); 6517 //next_vect = MkInterRedNextWeight(omega,omega2,G); 7034 next_vect = MkInterRedNextWeight(omega,omega2,G); 7035 if(polylength > 0) 7036 { 7037 //there is a polynomial in Gomega with at least 3 monomials, 7038 //low-dimensional facet of the cone 7039 delete next_vect; 7040 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev); 7041 if(isNolVector(next_vect)) 7042 { 7043 delete next_vect; 7044 next_vect = MkInterRedNextWeight(omega,omega2,G); 7045 } 7046 } 6518 7047 xtnw=xtnw+clock()-to; 6519 #ifdef PRINT_VECTORS 6520 MivString(omega, omega2, next_vect); 6521 #endif 7048 6522 7049 oRing = currRing; 6523 7050 6524 / * We only perturb the current target vector at the recursion level 1 */7051 // We only perturb the current target vector at the recursion level 1 6525 7052 if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3 6526 7053 if (MivComp(next_vect, omega2) == 1) 6527 7054 { 6528 /* to dispense with taking initial (and lifting/interreducing 6529 after the call of recursion */ 6530 //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev); 6531 //idElements(G, "G"); 6532 7055 // to dispense with taking initials and lifting/interreducing 7056 // after the call of recursion. 7057 if(printout > 0) 7058 { 7059 Print("\n//** rec_r_fractal_call: Perturb the both vectors with degree %d.",nlev); 7060 //idElements(G, "G"); 7061 } 6533 7062 Xngleich = 1; 6534 7063 nlev +=1; 6535 6536 if (rParameter(currRing) != NULL) 6537 DefRingPar(omtmp); 7064 if(ivtarget->length() == nV) 7065 { 7066 if (rParameter(currRing) != NULL) 7067 DefRingPar(omtmp); 7068 else 7069 rChangeCurrRing(VMrDefault(omtmp)); 7070 } 6538 7071 else 6539 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3 6540 7072 { 7073 rChangeCurrRing(VMatrDefault(ivtarget)); 7074 } 6541 7075 testring = currRing; 6542 7076 Gt = idrMoveR(G, oRing,currRing); 6543 7077 6544 /* perturb the original target vector w.r.t. the current GB */ 6545 delete Xtau; 6546 Xtau = NewVectorlp(Gt); 7078 // perturb the original target vector w.r.t. the current GB 7079 if(ivtarget->length() == nV) 7080 { 7081 delete Xtau; 7082 Xtau = NewVectorlp(Gt); 7083 } 7084 else 7085 { 7086 delete Xtau; 7087 Xtau = Mfpertvector(Gt,ivtarget); 7088 } 6547 7089 6548 7090 rChangeCurrRing(oRing); 6549 G = idrMoveR(Gt, 6550 6551 / * perturb the current vector w.r.t. the current GB */7091 G = idrMoveR(Gt,testring,currRing); 7092 7093 // perturb the current vector w.r.t. the current GB 6552 7094 Mwlp = MivWeightOrderlp(omega); 7095 if(ivtarget->length() > nV) 7096 { 7097 delete Mwlp; 7098 Mwlp = MivMatrixOrderRefine(omega,ivtarget); 7099 } 6553 7100 Xsigma = Mfpertvector(G, Mwlp); 6554 7101 delete Mwlp; … … 6566 7113 6567 7114 next_vect = MkInterRedNextWeight(omega,omega2,G); 7115 if(polylength > 0) 7116 { 7117 //there is a polynomial in Gomega with at least 3 monomials, 7118 //low-dimensional facet of the cone 7119 delete next_vect; 7120 next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev); 7121 if(isNolVector(next_vect)) 7122 { 7123 delete next_vect; 7124 next_vect = MkInterRedNextWeight(omega,omega2,G); 7125 } 7126 } 6568 7127 xtnw=xtnw+clock()-to; 6569 6570 #ifdef PRINT_VECTORS 7128 } 7129 //#ifdef PRINT_VECTORS 7130 if(printout > 0) 7131 { 6571 7132 MivString(omega, omega2, next_vect); 6572 #endif 6573 } 6574 6575 6576 /* check whether the the computed vector is in the correct cone */ 6577 /* If no, the reduced GB of an omega-homogeneous ideal will be 7133 } 7134 //#endif 7135 7136 /* check whether the the computed vector is in the correct cone 7137 If no, the reduced GB of an omega-homogeneous ideal will be 6578 7138 computed by Buchberger algorithm and stop this recursion step*/ 6579 7139 //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6 … … 6581 7141 { 6582 7142 delete next_vect; 6583 if (rParameter(currRing) != NULL) 6584 { 6585 DefRingPar(omtmp); 7143 if(ivtarget->length() == nV) 7144 { 7145 if (rParameter(currRing) != NULL) 7146 { 7147 DefRingPar(omtmp); 7148 } 7149 else 7150 { 7151 rChangeCurrRing(VMrDefault(omtmp)); 7152 } 6586 7153 } 6587 7154 else 6588 7155 { 6589 rChangeCurrRing(VM rDefault1(omtmp)); // Aenderung47156 rChangeCurrRing(VMatrDefault(ivtarget)); 6590 7157 } 6591 7158 #ifdef TEST_OVERFLOW 6592 7159 Gt = idrMoveR(G, oRing,currRing); 6593 Gt = NULL; return(Gt); 6594 #endif 6595 6596 //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing)); 7160 Gt = NULL; 7161 return(Gt); 7162 #endif 7163 if(printout > 0) 7164 { 7165 Print("\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;", 7166 rString(currRing)); 7167 } 6597 7168 to=clock(); 6598 7169 Gt = idrMoveR(G, oRing,currRing); … … 6603 7174 delete omega2; 6604 7175 delete altomega; 6605 6606 //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks); 6607 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7176 if(printout > 0) 7177 { 7178 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7179 nlev, nwalks); 7180 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7181 } 6608 7182 nnflow ++; 6609 6610 7183 Overflow_Error = FALSE; 6611 7184 return (G1); 6612 7185 } 6613 6614 6615 /* If the perturbed target vector stays in the correct cone, 6616 return the current GB, 6617 otherwise, return the computed GB by the Buchberger-algorithm. 6618 Then we update the perturbed target vectors w.r.t. this GB. */ 6619 6620 /* the computed vector is equal to the origin vector, since 6621 t is not defined */ 7186 /* 7187 If the perturbed target vector stays in the correct cone, 7188 return the current Groebner basis. 7189 Otherwise, return the Groebner basis computed with Buchberger's 7190 algorithm. 7191 Then we update the perturbed target vectors w.r.t. this GB. 7192 */ 6622 7193 if (MivComp(next_vect, XivNull) == 1) 6623 7194 { 6624 if (rParameter(currRing) != NULL) 6625 DefRingPar(omtmp); 7195 // The computed vector is equal to the origin vector, 7196 // because t is not defined 7197 if(ivtarget->length() == nV) 7198 { 7199 if (rParameter(currRing) != NULL) 7200 DefRingPar(omtmp); 7201 else 7202 rChangeCurrRing(VMrDefault(omtmp)); 7203 } 6626 7204 else 6627 rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5 6628 7205 { 7206 rChangeCurrRing(VMatrDefault(ivtarget)); 7207 } 6629 7208 testring = currRing; 6630 7209 Gt = idrMoveR(G, oRing,currRing); 6631 7210 6632 if(test_w_in_ConeCC(Gt, omega2) == 1) { 7211 if(test_w_in_ConeCC(Gt, omega2) == 1) 7212 { 6633 7213 delete omega2; 6634 7214 delete next_vect; 6635 7215 delete altomega; 6636 //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks); 6637 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 6638 7216 if(printout > 0) 7217 { 7218 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7219 nlev, nwalks); 7220 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7221 } 6639 7222 return (Gt); 6640 7223 } 6641 7224 else 6642 { 6643 //ivString(omega2, "tau'"); 6644 //Print("\n// tau' doesn't stay in the correct cone!!"); 6645 7225 { 7226 if(printout > 0) 7227 { 7228 Print("\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n"); 7229 } 6646 7230 #ifndef MSTDCC_FRACTAL 6647 //07.08.036648 7231 //ivString(Xtau, "old Xtau"); 6649 intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 7232 intvec* Xtautmp; 7233 if(ivtarget->length() == nV) 7234 { 7235 Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp)); 7236 } 7237 else 7238 { 7239 Xtautmp = Mfpertvector(Gt, ivtarget); 7240 } 6650 7241 #ifdef TEST_OVERFLOW 6651 7242 if(Overflow_Error == TRUE) … … 6675 7266 6676 7267 FRACTAL_MSTDCC: 6677 //Print("\n// apply BB-Alg in ring = %s;", rString(currRing)); 7268 if(printout > 0) 7269 { 7270 Print("\n//** rec_r_fractal_call: apply Buchberge's algorithm in ring = %s.\n", 7271 rString(currRing)); 7272 } 6678 7273 to=clock(); 6679 7274 G = MstdCC(Gt); … … 6683 7278 6684 7279 // update the original target vector w.r.t. the current GB 6685 if(MivSame(Xivinput, Xivlp) == 1) 6686 if (rParameter(currRing) != NULL) 6687 DefRingParlp(); 7280 if(ivtarget->length() == nV) 7281 { 7282 if(MivSame(Xivinput, Xivlp) == 1) 7283 if (rParameter(currRing) != NULL) 7284 DefRingParlp(); 7285 else 7286 VMrDefaultlp(); 6688 7287 else 6689 VMrDefaultlp(); 7288 if (rParameter(currRing) != NULL) 7289 DefRingPar(Xivinput); 7290 else 7291 rChangeCurrRing(VMrDefault(Xivinput)); 7292 } 6690 7293 else 6691 if (rParameter(currRing) != NULL) 6692 DefRingPar(Xivinput); 6693 else 6694 rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6 6695 7294 { 7295 rChangeCurrRing(VMatrRefine(ivtarget,Xivinput)); 7296 } 6696 7297 testring = currRing; 6697 7298 Gt = idrMoveR(G, oRing,currRing); … … 6706 7307 delete next_vect; 6707 7308 delete altomega; 6708 /* 6709 Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks); 6710 Print(" ** Overflow_Error? (%d)", Overflow_Error); 6711 */ 7309 if(printout > 0) 7310 { 7311 Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n", 7312 nlev,nwalks); 7313 //Print(" ** Overflow_Error? (%d)", Overflow_Error); 7314 } 6712 7315 if(Overflow_Error == TRUE) 6713 7316 nnflow ++; … … 6725 7328 6726 7329 to=clock(); 6727 / * Take the initial form of <G> w.r.t. omega */7330 // Take the initial form of <G> w.r.t. omega 6728 7331 Gomega = MwalkInitialForm(G, omega); 6729 7332 xtif=xtif+clock()-to; 6730 7333 //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise 7334 polylength = lengthpoly(Gomega); 7335 if(printout > 1) 7336 { 7337 idString(Gomega,"//** rec_r_fractal_call: Gomega"); 7338 } 6731 7339 #ifndef BUCHBERGER_ALG 6732 7340 if(isNolVector(omega) == 0) … … 6734 7342 else 6735 7343 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 6736 #endif // BUCHBERGER_ALG 6737 6738 if (rParameter(currRing) != NULL) 6739 DefRingPar(omega); 7344 #endif 7345 if(ivtarget->length() == nV) 7346 { 7347 if (rParameter(currRing) != NULL) 7348 DefRingPar(omega); 7349 else 7350 rChangeCurrRing(VMrDefault(omega)); 7351 } 6740 7352 else 6741 rChangeCurrRing(VMrDefault1(omega)); //Aenderung7 6742 7353 { 7354 rChangeCurrRing(VMatrRefine(ivtarget,omega)); 7355 } 6743 7356 Gomega1 = idrMoveR(Gomega, oRing,currRing); 6744 7357 6745 /* Maximal recursion depth, to compute a red. GB */ 6746 /* Fractal walk with the alternative recursion */ 6747 /* alternative recursion */ 6748 // if(nlev == nV || lengthpoly(Gomega1) == 0) 7358 // Maximal recursion depth, to compute a red. GB 7359 // Fractal walk with the alternative recursion 7360 // alternative recursion 6749 7361 if(nlev == Xnlev || lengthpoly(Gomega1) == 0) 6750 //if(nlev == nV) // blind recursion 6751 { 6752 /* 6753 if(Xnlev != nV) 6754 { 6755 Print("\n// ** Xnlev = %d", Xnlev); 6756 ivString(Xtau, "Xtau"); 6757 } 6758 */ 7362 { 6759 7363 to=clock(); 6760 7364 #ifdef BUCHBERGER_ALG … … 6763 7367 Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega); 6764 7368 delete hilb_func; 6765 #endif // BUCHBERGER_ALG7369 #endif 6766 7370 xtstd=xtstd+clock()-to; 6767 7371 } 6768 else { 7372 else 7373 { 6769 7374 rChangeCurrRing(oRing); 6770 7375 Gomega1 = idrMoveR(Gomega1, oRing,currRing); 6771 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega); 6772 } 6773 6774 //convert a Groebner basis from a ring to another ring, 7376 Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout); 7377 } 7378 if(printout > 2) 7379 { 7380 idString(Gresult,"//** rec_r_fractal_call: M"); 7381 } 7382 //convert a Groebner basis from a ring to another ring 6775 7383 new_ring = currRing; 6776 7384 … … 6780 7388 6781 7389 to=clock(); 6782 / * Lifting process */7390 // Lifting process 6783 7391 F = MLifttwoIdeal(Gomega2, Gresult1, G); 6784 7392 xtlift=xtlift+clock()-to; 7393 7394 if(printout > 2) 7395 { 7396 idString(F,"//** rec_r_fractal_call: F"); 7397 } 7398 6785 7399 idDelete(&Gresult1); 6786 7400 idDelete(&Gomega2); … … 6791 7405 6792 7406 to=clock(); 6793 / * Interreduce G */7407 // Interreduce G 6794 7408 G = kInterRedCC(F1, NULL); 6795 7409 xtred=xtred+clock()-to; … … 6797 7411 } 6798 7412 } 6799 6800 6801 7413 6802 7414 … … 6805 7417 * * 6806 7418 * The main procedur Mfwalk calls the recursive Subroutine * 6807 * rec_fractal_call to compute the wanted Gr ᅵbner basis.*6808 * At the main procedur we compute the reduced Gr ᅵbner basis w.r.t. a "fast"*7419 * rec_fractal_call to compute the wanted Groebner basis. * 7420 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast" * 6809 7421 * order, e.g. "dp" and a sequence of weight vectors which are row vectors * 6810 7422 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 6811 7423 *******************************************************************************/ 6812 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget) 7424 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, 7425 int reduction, int printout) 6813 7426 { 7427 BITSET save1 = si_opt_1; // save current options 7428 if(reduction == 0) 7429 { 7430 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 7431 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 7432 } 6814 7433 Set_Error(FALSE); 6815 7434 Overflow_Error = FALSE; … … 6846 7465 intvec* iv_dp = MivUnit(nV); // define (1,1,...,1) 6847 7466 intvec* Mdp; 6848 6849 if(MivSame(ivstart, iv_dp) != 1) 6850 Mdp = MivWeightOrderdp(ivstart); 7467 if(ivstart->length() == nV) 7468 { 7469 if(MivSame(ivstart, iv_dp) != 1) 7470 Mdp = MivWeightOrderdp(ivstart); 7471 else 7472 Mdp = MivMatrixOrderdp(nV); 7473 } 6851 7474 else 6852 Mdp = MivMatrixOrderdp(nV); 7475 { 7476 Mdp = ivstart; 7477 } 6853 7478 6854 7479 Xsigma = Mfpertvector(I, Mdp); … … 6867 7492 Xivlp = Mivlp(nV); 6868 7493 6869 if(MivComp(ivtarget, Xivlp) != 1) 6870 { 6871 if (rParameter(currRing) != NULL) 6872 DefRingPar(ivtarget); 7494 if(ivtarget->length() == nV) 7495 { 7496 if(MivComp(ivtarget, Xivlp) != 1) 7497 { 7498 if (rParameter(currRing) != NULL) 7499 DefRingPar(ivtarget); 7500 else 7501 rChangeCurrRing(VMrDefault(ivtarget)); 7502 7503 I1 = idrMoveR(I, oldRing,currRing); 7504 Mlp = MivWeightOrderlp(ivtarget); 7505 Xtau = Mfpertvector(I1, Mlp); 7506 } 6873 7507 else 6874 rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1 6875 6876 I1 = idrMoveR(I, oldRing,currRing); 6877 Mlp = MivWeightOrderlp(ivtarget); 6878 Xtau = Mfpertvector(I1, Mlp); 7508 { 7509 if (rParameter(currRing) != NULL) 7510 DefRingParlp(); 7511 else 7512 VMrDefaultlp(); 7513 7514 I1 = idrMoveR(I, oldRing,currRing); 7515 Mlp = MivMatrixOrderlp(nV); 7516 Xtau = Mfpertvector(I1, Mlp); 7517 } 6879 7518 } 6880 7519 else 6881 7520 { 6882 if (rParameter(currRing) != NULL) 6883 DefRingParlp(); 6884 else 6885 VMrDefaultlp(); 6886 6887 I1 = idrMoveR(I, oldRing,currRing); 6888 Mlp = MivMatrixOrderlp(nV); 7521 rChangeCurrRing(VMatrDefault(ivtarget)); 7522 I1 = idrMoveR(I,oldRing,currRing); 7523 Mlp = ivtarget; 6889 7524 Xtau = Mfpertvector(I1, Mlp); 6890 7525 } … … 6897 7532 id_Delete(&I, oldRing); 6898 7533 ring tRing = currRing; 6899 6900 if (rParameter(currRing) != NULL) 6901 DefRingPar(ivstart); 7534 if(ivtarget->length() == nV) 7535 { 7536 if (rParameter(currRing) != NULL) 7537 DefRingPar(ivstart); 7538 else 7539 rChangeCurrRing(VMrDefault(ivstart)); 7540 } 6902 7541 else 6903 rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2 7542 { 7543 rChangeCurrRing(VMatrDefault(ivstart)); 7544 } 6904 7545 6905 7546 I = idrMoveR(I1,tRing,currRing); … … 6912 7553 ring helpRing = currRing; 6913 7554 6914 J = rec_fractal_call(J, 1, ivtarget);7555 J = rec_fractal_call(J,1,ivtarget,printout); 6915 7556 6916 7557 rChangeCurrRing(oldRing); … … 6918 7559 idSkipZeroes(resF); 6919 7560 7561 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6920 7562 delete Xivlp; 6921 7563 delete Xsigma; … … 6936 7578 } 6937 7579 6938 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,int weight_rad) 7580 /******************************************************************************* 7581 * The implementation of the fractal walk algorithm with random element * 7582 * * 7583 * The main procedur Mfwalk calls the recursive Subroutine * 7584 * rec_r_fractal_call to compute the wanted Groebner basis. * 7585 * At the main procedure we compute the reduced Groebner basis w.r.t. a "fast" * 7586 * order, e.g. "dp" and a sequence of weight vectors which are row vectors * 7587 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 7588 *******************************************************************************/ 7589 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, 7590 int weight_rad, int reduction, int printout) 6939 7591 { 7592 BITSET save1 = si_opt_1; // save current options 7593 if(reduction == 0) 7594 { 7595 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 7596 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 7597 } 6940 7598 Set_Error(FALSE); 6941 7599 Overflow_Error = FALSE; … … 6972 7630 intvec* iv_dp = MivUnit(nV); // define (1,1,...,1) 6973 7631 intvec* Mdp; 6974 6975 if(MivSame(ivstart, iv_dp) != 1) 6976 Mdp = MivWeightOrderdp(ivstart); 7632 if(ivstart->length() == nV) 7633 { 7634 if(MivSame(ivstart, iv_dp) != 1) 7635 Mdp = MivWeightOrderdp(ivstart); 7636 else 7637 Mdp = MivMatrixOrderdp(nV); 7638 } 6977 7639 else 6978 Mdp = MivMatrixOrderdp(nV); 7640 { 7641 Mdp = ivstart; 7642 } 6979 7643 6980 7644 Xsigma = Mfpertvector(I, Mdp); … … 6993 7657 Xivlp = Mivlp(nV); 6994 7658 6995 if(MivComp(ivtarget, Xivlp) != 1) 6996 { 6997 if (rParameter(currRing) != NULL) 6998 DefRingPar(ivtarget); 7659 if(ivtarget->length() == nV) 7660 { 7661 if(MivComp(ivtarget, Xivlp) != 1) 7662 { 7663 if (rParameter(currRing) != NULL) 7664 DefRingPar(ivtarget); 7665 else 7666 rChangeCurrRing(VMrDefault(ivtarget)); 7667 7668 I1 = idrMoveR(I, oldRing,currRing); 7669 Mlp = MivWeightOrderlp(ivtarget); 7670 Xtau = Mfpertvector(I1, Mlp); 7671 } 6999 7672 else 7000 rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1 7001 7002 I1 = idrMoveR(I, oldRing,currRing); 7003 Mlp = MivWeightOrderlp(ivtarget); 7004 Xtau = Mfpertvector(I1, Mlp); 7673 { 7674 if (rParameter(currRing) != NULL) 7675 DefRingParlp(); 7676 else 7677 VMrDefaultlp(); 7678 7679 I1 = idrMoveR(I, oldRing,currRing); 7680 Mlp = MivMatrixOrderlp(nV); 7681 Xtau = Mfpertvector(I1, Mlp); 7682 } 7005 7683 } 7006 7684 else 7007 7685 { 7008 if (rParameter(currRing) != NULL) 7009 DefRingParlp(); 7010 else 7011 VMrDefaultlp(); 7012 7013 I1 = idrMoveR(I, oldRing,currRing); 7014 Mlp = MivMatrixOrderlp(nV); 7686 rChangeCurrRing(VMatrDefault(ivtarget)); 7687 I1 = idrMoveR(I,oldRing,currRing); 7688 Mlp = ivtarget; 7015 7689 Xtau = Mfpertvector(I1, Mlp); 7016 7690 } … … 7023 7697 id_Delete(&I, oldRing); 7024 7698 ring tRing = currRing; 7025 7026 if (rParameter(currRing) != NULL) 7027 DefRingPar(ivstart); 7699 if(ivtarget->length() == nV) 7700 { 7701 if (rParameter(currRing) != NULL) 7702 DefRingPar(ivstart); 7703 else 7704 rChangeCurrRing(VMrDefault(ivstart)); 7705 } 7028 7706 else 7029 rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2 7707 { 7708 rChangeCurrRing(VMatrDefault(ivstart)); 7709 } 7030 7710 7031 7711 I = idrMoveR(I1,tRing,currRing); … … 7037 7717 ideal resF; 7038 7718 ring helpRing = currRing; 7039 //ideal G, int nlev, intvec* omtmp, int weight_rad) 7040 J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);7719 7720 J = rec_r_fractal_call(J,1,ivtarget,weight_rad,printout); 7041 7721 7042 7722 rChangeCurrRing(oldRing); … … 7044 7724 idSkipZeroes(resF); 7045 7725 7726 si_opt_1 = save1; //set original options, e. g. option(RedSB) 7046 7727 delete Xivlp; 7047 7728 delete Xsigma; … … 7099 7780 intvec* hilb_func; 7100 7781 #endif 7101 / * to avoid (1,0,...,0) as the target vector */7782 // to avoid (1,0,...,0) as the target vector 7102 7783 intvec* last_omega = new intvec(nV); 7103 7784 for(i=nV-1; i>0; i--) … … 7114 7795 7115 7796 to=clock(); 7116 / * compute a red. GB w.r.t. the help ring */7797 // compute a red. GB w.r.t. the help ring 7117 7798 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp" 7118 7799 G = MstdCC(G); … … 7123 7804 DefRingPar(curr_weight); 7124 7805 else 7125 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 47806 rChangeCurrRing(VMrDefault(curr_weight)); 7126 7807 G = idrMoveR(G, XXRing,currRing); 7127 7808 G = MstdCC(G); … … 7149 7830 DefRingPar(curr_weight); 7150 7831 else 7151 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 57832 rChangeCurrRing(VMrDefault(curr_weight)); 7152 7833 to=clock(); 7153 7834 Gw = idrMoveR(G, exring,currRing); … … 7184 7865 DefRingPar(curr_weight); 7185 7866 else 7186 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 67867 rChangeCurrRing(VMrDefault(curr_weight)); 7187 7868 7188 7869 newRing = currRing; … … 7269 7950 DefRingPar(target_tmp); 7270 7951 else 7271 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 87952 rChangeCurrRing(VMrDefault(target_tmp)); 7272 7953 7273 7954 lpRing = currRing; … … 7329 8010 DefRingPar(target_tmp); 7330 8011 else 7331 rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 98012 rChangeCurrRing(VMrDefault(target_tmp)); 7332 8013 7333 8014 lpRing = currRing; … … 7532 8213 else 7533 8214 { 7534 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 108215 rChangeCurrRing(VMrDefault(curr_weight)); 7535 8216 } 7536 8217 G = idrMoveR(G, XXRing,currRing); … … 7565 8246 else 7566 8247 { 7567 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 118248 rChangeCurrRing(VMrDefault(curr_weight)); 7568 8249 } 7569 8250 to=clock(); … … 7608 8289 else 7609 8290 { 7610 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 128291 rChangeCurrRing(VMrDefault(curr_weight)); 7611 8292 } 7612 8293 newRing = currRing; … … 7777 8458 else 7778 8459 { 7779 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 138460 rChangeCurrRing(VMrDefault(target_tmp)); 7780 8461 } 7781 8462 } … … 7850 8531 else 7851 8532 { 7852 rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 148533 rChangeCurrRing(VMrDefault(target_tmp)); 7853 8534 } 7854 8535 } … … 8093 8774 else 8094 8775 { 8095 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 158776 rChangeCurrRing(VMrDefault(curr_weight)); 8096 8777 } 8097 8778 newRing = currRing; … … 8235 8916 8236 8917 //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error); 8918 <<<<<<< HEAD 8919 ======= 8237 8920 8238 8921 return(result); … … 8421 9104 delete next_weight; 8422 9105 } //end of while-loop 9106 >>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596 8423 9107 Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing)); 8424 idSkipZeroes(G); 8425 si_opt_1 = save1; //set original options, e. g. option(RedSB) 8426 baseRing = currRing; 8427 rChangeCurrRing(XXRing); 8428 ideal Res = idrMoveR(G,baseRing,currRing); 8429 delete tmp_weight; 8430 delete ivNull; 8431 delete exivlp; 8432 #ifndef BUCHBERGER_ALG 8433 delete last_omega; 8434 #endif 8435 #ifdef TIME_TEST 8436 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep); 8437 #endif 8438 return(Res); 9108 return(result); 8439 9109 } 8440 9110 … … 8515 9185 else 8516 9186 { 8517 rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 169187 rChangeCurrRing(VMrDefault(cw_tmp)); 8518 9188 } 8519 9189 G = idrMoveR(Go, XXRing,currRing); … … 8589 9259 else 8590 9260 { 8591 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 179261 rChangeCurrRing(VMrDefault(curr_weight)); 8592 9262 } 8593 9263 newRing = currRing; … … 8651 9321 else 8652 9322 { 8653 rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 189323 rChangeCurrRing(VMrDefault(target_weight)); 8654 9324 } 8655 9325 F1 = idrMoveR(G, newRing,currRing); -
Property
mode
changed from
-
Singular/walk.h
-
Property
mode
changed from
100644
to100755
r4e3305 rca3864 54 54 // compute a Groebner basis of an ideal G w.r.t. lexicographic order 55 55 //ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M); 56 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing );56 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing, int reduction, int printout); 57 57 58 58 // random walk algorithm to compute a Groebner basis 59 ideal Mrwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg, ring baseRing); 59 60 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, int reduction, int printout); 60 61 61 62 /* the perturbation walk algorithm */ 62 63 63 ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,intvec* target_weight, int nP );64 ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,intvec* target_weight, int nP, int reduction, int printout); 64 65 65 66 /* the perturbation walk algorithm with random element */ 66 67 ideal Mprwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing); 67 ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout); 68 68 69 69 /* The fractal walk algorithm */ 70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget );70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction, int printout); 71 71 72 72 /* The fractal walk algorithm with random element */ 73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad);73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction, int printout); 74 74 75 75 /* Implement Tran's idea */ -
Property
mode
changed from
-
Tst/Long/std_l.res.gz.uu
r4083fa rca3864 1 begin 644 std_l.res.gz 2 M'XL(")L9OU```W-T9%]L+G)E<P#L_5N3),F5'@B^YZ_P!45F*\+2T:%V<8]@ 3 M-R"R2[Y09&5>."+[$)+5`@+%9J$+!1`HDNC9F?^^;F9Z.9?O'#7W\(CTR-!Z 4 MR`HWO1\]>F[ZJ>I__C_^XW_ZWW>[7?CM[A_^8?>W7_[PSS_]^I>__;+;[W<_ 5 M_?GG?]G]\L/??OG;[K_^^:]SVJ?_''/WOYYS_X^__?"WW5]__V^__^G'W^]^ 6 M^/OO_O27GTX?_NM?__RGW7_ZS__Y__4?_I]/C[N__.XO/_PUEQM^O<M_C[_> 7 M_7_^T_][]ZM3:[_^Z<?_\JM_S"G3;W>GC__\X\\__O+=W3]^FO^_^^UO8^=^ 8 M_N%__?IOO_SNEYS[\-M2Y_'7N[_\]<^_W_WI;S_\\M<??_Z7[W[\^9?=[__; 9 M[_[ZN]]_WLU___P_/Y_JF9-V?_[K'WZ8_[C+I1]_O?O_Y1]/OS[]\\/??_C] 10 M__CEA^]^M93XZ^XWNU_MNEC!=VN]=Z</O_K\]^_"KW]-TG[^G\OWN\]S@51G 11 M"'.=J=TY_1]_=?>/N?=AF)/_]8<?_K*VE@D2IE_O_N_\@XPWI/'^L$["/_^X 12 M#/C'=:R___.?_O*W/+I`1Q>6T<V9_OAY]Z^?=S_EMOJECW_Y\T__MOO+Y]U_ 13 M+]_)U/73G&?FB>_^^)OPC[L__M-OEK9.?W5=;K`_SKERD_W2Y&[WWT]$#+G: 14 M(:Q??SI]_6/Y.JQ?ER;^=6[B7__I-S^>_B75#].:)S<P'-</:Q/_?7?_/W_W 15 MU^]^NBN5/J7TN;&?3N1?.YW2Q]B53.DQ]N(OI^Q_.64OQ!B7MDO&I>6__O#+ 16 M__CKS[OO_E*:')_(Q$T/OSWERK]"G+J_HJD[=?UO:!*GGDSB-%B3.$UX$J=C 17 MF<3I:<LD'@*;Q,.`)O$PH4D\'.N3>'@2DW@,_B0>AY3^XW_=?7=J\#<+K7*% 18 MQRFEERHS7ZP]+/T^9H[(D_28V__AI[_]D+\.JM;'B=<Z\U.I^?&H:WX2[/44 19 M+/9Z&AA[/4T&>ST="7L]/1:Y\/0DF&L5A`97A8>'PE7A8>G6CW_XX7<_G?[] 20 MQ_PY,]N/Y=O2L?SKF!GJQWFV?_RGN;W3_\M\AX<GRDXA1!+\^(?G'[^<R$#6 21 MPN?8V[6GN<G`2!-FR9C_9JOPQS^00F09AOXATRGT:1'^R]HPH=)//YZ4X+_+ 22 M'>_)P@O]2HL3`\YY=_^T"R7?Q`;81SY8\OUFU^<NK=(P=VH5@WEF=BM7Y]RK 23 M/(QZZU]__/D/LR+Z^5<EG9!A%8-SY_[VX__YPW?_[F[WV]U#[M_`)R#)O#G[ 24 M+__VEQ_^_%^_^W?/X<O=O*Y^M;;WJUPVR<-2.J^!N?Q<<"GWUU_M_J__:Y=_ 25 M_C=20UX6I8Z\!G=I9'/)/+0I+\A,K(G)@#+*,@N3D@)A(E*`C;:/HST1_U>[ 26 M_^U_V\U?YLKRW__$)$R82(=S[8=0/N[R',[%\T`.0\F2AW*8U.B2V"P?8H-$ 27 M((4D)G,'N%Q44SD/+H]`R\AP%-19)B\3(2@B'!$1'@TBD-E\1$2@HM2:T<<C 28 M:O")-KCVN^<\V"L>?&*]S'4]#?0SX44RA4\3S9/[_W0$@WI2NJ5_$`9&_\"$ 29 M6?]05G'_D%?QTI'_!QM#S\5HG\1HMGK_Y:<__Y??_?3/LX&:Y&C\E(W>?\R% 30 M>2?",D;":WTX\L:>:HUUP6ENM2]S<\2L[%?9F>W?__*[ORUE2]$CR?M$M111 31 M'?_R'=(;_4#,6FH#](/6:ST1I_W`)V)EIIFW\L^?R[QPZ=HGZ4IUXF^44NRE 32 M7.V+7%UM@_N9K-_]6$8S"AG1)REZ4J1S_;,N_4O./1$A3P:1VY]D^T5\DOKR 33 MG_NE-^M$WWU/]50_R7Y-6G;U!R&[^B(987-EKI*TS-6OLK+\?"KSMDI(8`WT 34 MLZC,18[C;TN1*5D#/_S\PU]_]\L/__R_?OCQ7_[;+_]\4H2+9?#'3++CH9@# 35 M_2H\.0NM`C)J[+_^\+>YCEEI?Y>5=K^*R_QKD-;3'SF7/#++HD\"L=2=_LH^ 36 MZ(^K:TI:9$9'_\1(I(K_<?5@?U4H]T0I]T0H]Y0H]\/??_GAYS_D9?^W[Q8S 37 MZL_SOZOA64CX1$GX!$CXE'W4WV<6&!Z*H=27C]0\^C/)/-'O)/^1?A_*]Z7% 38 MI<L_9V=J6*5KS%TX8O[U&\@J?[PK99>>_3F<<BY$(+IP6"5M5GA+.E-Z`Y>\ 39 M0Y*\?^YS=44Y#3U9Y;S"/E?8BY4^]'FE_WG(E0ZD4K&@AUXOZ&$0"WH8!E`K 40 MZ>H@UO$PL'4\K&*4-C$R-W1($G.E1)GP)#C79LEW7G^Q.=.7543^PS_L?O>' 41 M/\0YSG&:OY5<ZVPN#!*'=5HB\_^^^]7_]R]S](>QQ^?=K_Z7_EJ88RIJ9DB2 42 M,_\NWGE2'&12F608N(\^)''Z\^R6_OQ3ZN$Z"S]^.?7JN__P>>Y6^K(N\_G[ 43 M[]'W7"^S?O)_)Y$FRGS^#VMMZOOOB3`9N.P>B.P>CG0V3G+E#__C]V0Z<J[L 44 MA?V1K9HC$Y1#,FU_/R_"/^[^\./_+&[8D.S8N993AF[)]9LBI89'R=O%@OW] 45 MS'Q$-#U*KDXBFC+RHPAX#,4<C?71.,*0K-)<9S)!Q>1&8L^%US]3B#+$,.2O 46 MNGFQR-1^3273Y=<PV#64B4WF\#Q_/__A\ZP3_OJ[M*C^YP^__^7/?\U9GXS1 47 M_$XMFU65[>`P-G9Q'N12,13:^W"7F]"5T"8TC305Q@=FYXX/Q<X='U@\Y^>? 48 M2*$CR46"%F,H08LQI*#%G_ZMA.3'0`(48\A&[2\SU__RXY]^R-'D<=4[?_CA 49 MOYYLK'\^:?U3AE,]J[-8,BV36$J?K+Y?0DG-JCFKZW'5/[':Q=#^36R`*+VQ 50 M5V;.*M?6G%RPC3R8,B9EQ.I?_NI22S^2ELC2)DV<LC"=.&;M5:3O6!383S_\ 51 M[@^DY&?QX406D>.41;26>R35WCAH`3$.0D",8Q80>HRC$`\C#TR/J]Z+5"JE 52 MEB:6'99_^?G/?_WANU].#MNOYFDF_+MJ1)+I3S_\Z<]__;?OPKREL?Y-<Q/+ 53 M<)R*93A.Q*;^_9__\F_Y.['^QE7YK:PC(@;CE%GM9^&.CX=L"_[XN<2=QU7_ 54 M_>FD-7[Z8?>G\ID&*\=5^^1?AK:=W0;&D4>F:L<4=?G3&KY<PIBYP11F82'V 55 MGUEX?4S*J=2839-8YY]6Y7DBWVR0W^]$(X\BIC`^,G=^?&2RYD]EQAY)['A\ 56 M?"1;$^-C4<7CTT.<OWGS;;7N?SBQX>]^_I<?%I=HWNQ;+?M?_AQ#RW&W;;7\ 57 MD]+.(Y[U71[M4Y]F\%_I##Z-V0[/QE:JJ&0ZS)E(\&'6GDO;)<MC'L@TQ[CS 58 M7L3<ZV4[XI<_L_V(Z:&G\SL]C-&>C+U0[DW^Z_/N7S-MIX>#FOG=/_UFQPRX 59 M/])6'SD73.$A<8&(HV1K^H^9!:;0I\QY!:5P]HFJP^<Y&%;Z%L;,8+/ZH)[Q 60 M%`X\+:[94Y[/)X%)\CVF?/_ZXT\_J4#-U#\4NO>Y=TOXX;?93IOZW),\[CYW 61 M``UF'];A_#<RG/ZQE-`#&AYDJC6DH2\Y\:"&W-W_.W\Z_%I\>*2+;QH??DU^ 62 MA"P5I[$GJ^KRQ33-\C\3;QS18IK&0WTQ3>-C;3%-TP.1F-/4;UE.T\B6TW3F 63 MNICDNCB<LRX.9ZV+@[,N#@>?WP]$SAP?+'X_]HK?C^.Y_'X\>/Q^?*QQ\>.# 64 MXN+'7G#QX\BX^/%`N/CQ6+CX\=3:S&Z<;8;^X6$H[3W]-H5.])3]Z@]_R<&I 65 MZ:F8N-.L)/[A'_[\EU]^_///WYT6RB]EB+/*B`FS67*BVH\__T"2!U++:1P+ 66 MQXN6_Q:;/I'VI^7?_[C^_;?YWS\L__['OY&.3:3*0YGIV<\!6K'_O#M\7JF@ 67 MPN!S0/KO)Q.J^_MW)P.TOU_^GO]W^G5REXJU]>]G:VSW[__][D^_^]/O_M?_ 68 M^.7__/</(L-J@K$L_?CP.(Z/2POWL\%P<DO6-I9?)Q=F_$1^]W?=2%-C1VA: 69 MG]*NW+L]&?_^BN/O3^9/?^GX]VS\^^N/O_3NM>9?CY^,2(U>SW?AA=<<_=O- 70 M_MX9_MX9_CN>_.>YVB^[Y[G:+Z<Q/[.&/N<.?'E7DYI&M1?#VI-A[5]C6&^W 71 M4F])4G^-M?JA)?5IQ/MP>'@(=-"<"$M?H/".O8PI[Y,!SB;`GA%@_WH$:!*@ 72 M28!FJS5;K=EJS59KDKI)ZF:K-5NM28`/+0&:K=9LM6:KW?!D-4G=)'6SU6[9 73 M5NO71C^MK75K=Z[<`ET!O5@!QBKOG-5QY=[MR?CWMS+^/5?EKSG^MYM_S?D]