Changeset acccd2 in git
- Timestamp:
- Nov 27, 2014, 5:03:55 PM (9 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 0011f4ba4d5c10c441c70b05f3dd4b8c1e0a263e
- Parents:
- f2ba60d666fcc3a4164b840100f6e982e9749517
- Location:
- Singular
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/grwalk.lib
rf2ba60d racccd2 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, 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); 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 fwalk(I,reduction); 390 391 } 391 392 … … 437 438 } 438 439 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);440 proc pwalk(ideal Go, int n1, int n2, int reduction, int printout, list #) 441 "SYNTAX: pwalk(int d, ideal i, int n1, int n2, int reduction, int printout); 442 pwalk(int d, ideal i, int n1, int n2, int reduction, int printout, intvec v, intvec w); 442 443 TYPE: ideal 443 444 PURPOSE: compute the standard basis of the ideal, calculated via … … 477 478 ideal G = fetch(xR, Go); 478 479 479 G = system("Mpwalk", G, n1, n2, curr_weight, target_weight,nP);480 G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout); 480 481 481 482 setring xR; … … 492 493 ring r = 32003,(z,y,x), lp; 493 494 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); 495 int reduction = 1; 496 int printout = 2; 497 pwalk(I,2,2,reduction,printout); 498 498 } 499 499 -
Singular/LIB/modwalk.lib
rf2ba60d racccd2 30 30 //////////////////////////////////////////////////////////////////////////////// 31 31 32 proc modpWalk(def II, int p, int variant, list #)32 proc modpWalk(def II, int p, int variant, int reduction, list #) 33 33 "USAGE: modpWalk(I,p,#); I ideal, p integer, variant integer 34 34 ASSUME: If size(#) > 0, then … … 86 86 if(size(#)>0) 87 87 { 88 i = rwalk(i,radius,pert_deg, #);89 } 90 else 91 { 92 i = rwalk(i,radius,pert_deg );88 i = rwalk(i,radius,pert_deg,reduction,#); 89 } 90 else 91 { 92 i = rwalk(i,radius,pert_deg,reduction); 93 93 } 94 94 } … … 97 97 if(size(#) == 2) 98 98 { 99 i = gwalk(i, #);100 } 101 else 102 { 103 i = gwalk(i );99 i = gwalk(i,reduction,#); 100 } 101 else 102 { 103 i = gwalk(i,reduction); 104 104 } 105 105 } … … 108 108 if(size(#) == 2) 109 109 { 110 i = frandwalk(i,radius, #);111 } 112 else 113 { 114 i = frandwalk(i,radius );110 i = frandwalk(i,radius,reduction,#); 111 } 112 else 113 { 114 i = frandwalk(i,radius,reduction); 115 115 } 116 116 } … … 130 130 if(size(#) == 2) 131 131 { 132 i=prwalk(i,radius,pert_deg,pert_deg, #);133 } 134 else 135 { 136 i=prwalk(i,radius,pert_deg,pert_deg );132 i=prwalk(i,radius,pert_deg,pert_deg,reduction,#); 133 } 134 else 135 { 136 i=prwalk(i,radius,pert_deg,pert_deg,reduction); 137 137 } 138 138 } … … 141 141 if(size(#) == 2) 142 142 { 143 i=pwalk(i,pert_deg,pert_deg, #);144 } 145 else 146 { 147 i=pwalk(i,pert_deg,pert_deg );143 i=pwalk(i,pert_deg,pert_deg,reduction,#); 144 } 145 else 146 { 147 i=pwalk(i,pert_deg,pert_deg,reduction); 148 148 } 149 149 } … … 162 162 ring ra = 0,x(1..4),(a(a),lp); 163 163 ideal I = std(cyclic(4)); 164 int reduction = 1; 164 165 ring rb = 0,x(1..4),(a(b),lp); 165 166 ideal I = imap(ra,I); 166 modpWalk(I,p,1, a,b);167 modpWalk(I,p,1,reduction,a,b); 167 168 std(I); 168 169 } … … 170 171 //////////////////////////////////////////////////////////////////////////////// 171 172 172 proc modWalk(def II, int variant, list #)173 proc modWalk(def II, int variant, int reduction, list #) 173 174 "USAGE: modWalk(II); II ideal or list(ideal,int) 174 175 ASSUME: If variant = … … 462 463 for(i=1; i<=size(L); i++) 463 464 { 464 Arguments[i] = list(II,L[i],variant, list(curr_weight,target_weight));465 Arguments[i] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 465 466 } 466 467 } … … 469 470 for(i=1; i<=size(L); i++) 470 471 { 471 Arguments[i] = list(II,L[i],variant );472 Arguments[i] = list(II,L[i],variant,reduction); 472 473 } 473 474 } … … 567 568 for(i=j; i<=size(L); i++) 568 569 { 569 Arguments[size(Arguments)+1] = list(II,L[i],variant, list(curr_weight,target_weight));570 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction,list(curr_weight,target_weight)); 570 571 } 571 572 } … … 574 575 for(i=j; i<=size(L); i++) 575 576 { 576 Arguments[size(Arguments)+1] = list(II,L[i],variant );577 Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction); 577 578 } 578 579 } … … 601 602 ring R=0,(x,y,z),lp; 602 603 ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 603 ideal J = modWalk(I,2); 604 int reduction = 0; 605 ideal J = modWalk(I,1,1); 604 606 J; 605 607 } -
Singular/LIB/rwalk.lib
rf2ba60d racccd2 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 … … 314 321 ring r = 0,(z,y,x), lp; 315 322 ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z; 316 frandwalk(I,2); 317 } 323 int reduction = 0; 324 frandwalk(I,2,0); 325 } -
Singular/extra.cc
rf2ba60d racccd2 1777 1777 if (strcmp(sys_cmd, "Mwalk") == 0) 1778 1778 { 1779 const short t[]={ 4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};1779 const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD,INT_CMD,INT_CMD}; 1780 1780 if (!iiCheckTypes(h,t,1)) return TRUE; 1781 1781 if (((intvec*) h->next->Data())->length() != currRing->N && … … 1788 1788 ideal arg1 = (ideal) h->Data(); 1789 1789 intvec* arg2 = (intvec*) h->next->Data(); 1790 intvec* arg3 = (intvec*) h->next->next->Data(); 1791 ring arg4 = (ring) h->next->next->next->Data(); 1792 ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4); 1790 intvec* arg3 = (intvec*) h->next->next->Data(); 1791 ring arg4 = (ring) h->next->next->next->Data(); 1792 int arg5 = (int) (long) h->next->next->next->next->Data(); 1793 int arg6 = (int) (long) h->next->next->next->next->next->Data(); 1794 ideal result = (ideal) Mwalk(arg1, arg2, arg3, arg4, arg5, arg6); 1793 1795 res->rtyp = IDEAL_CMD; 1794 1796 res->data = result; … … 1826 1828 if (strcmp(sys_cmd, "Mpwalk") == 0) 1827 1829 { 1828 const short t[]={ 6,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};1830 const short t[]={8,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD}; 1829 1831 if (!iiCheckTypes(h,t,1)) return TRUE; 1830 1832 if(((intvec*) h->next->next->next->Data())->length() != currRing->N && … … 1840 1842 intvec* arg5 = (intvec*) h->next->next->next->next->Data(); 1841 1843 int arg6 = (int) (long) h->next->next->next->next->next->Data(); 1842 ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5,arg6); 1844 int arg7 = (int) (long) h->next->next->next->next->next->next->Data(); 1845 int arg8 = (int) (long) h->next->next->next->next->next->next->next->Data(); 1846 ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); 1843 1847 res->rtyp = IDEAL_CMD; 1844 1848 res->data = result; … … 1852 1856 if (strcmp(sys_cmd, "Mrwalk") == 0) 1853 1857 { 1854 const short t[]={ 6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};1858 const short t[]={7,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD}; 1855 1859 if (!iiCheckTypes(h,t,1)) return TRUE; 1856 if((( (intvec*) h->next->Data())->length() != currRing->N &&1857 ((intvec*) h->next-> next->Data())->length() != currRing->N) &&1858 (( (intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N)&&1859 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ) )1860 if(((intvec*) h->next->Data())->length() != currRing->N && 1861 ((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) && 1862 ((intvec*) h->next->next->Data())->length() != currRing->N && 1863 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ) 1860 1864 { 1861 1865 Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n", … … 1868 1872 int arg4 = (int)(long) h->next->next->next->Data(); 1869 1873 int arg5 = (int)(long) h->next->next->next->next->Data(); 1870 ring arg6 = (ring) h->next->next->next->next->next->Data(); 1871 ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6); 1874 int arg6 = (int)(long) h->next->next->next->next->next->Data(); 1875 int arg7 = (int)(long) h->next->next->next->next->next->next->Data(); 1876 ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7); 1872 1877 res->rtyp = IDEAL_CMD; 1873 1878 res->data = result; … … 1931 1936 if (strcmp(sys_cmd, "Mfwalk") == 0) 1932 1937 { 1933 const short t[]={ 3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};1938 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD}; 1934 1939 if (!iiCheckTypes(h,t,1)) return TRUE; 1935 1940 if (((intvec*) h->next->Data())->length() != currRing->N && … … 1938 1943 Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n", 1939 1944 currRing->N); 1940 return TRUE;1941 }1942 ideal arg1 = (ideal) h->Data();1943 intvec* arg2 = (intvec*) h->next->Data();1944 intvec* arg3 = (intvec*) h->next->next->Data();1945 ideal result = (ideal) Mfwalk(arg1, arg2, arg3);1946 res->rtyp = IDEAL_CMD;1947 res->data = result;1948 return FALSE;1949 }1950 else1951 #endif1952 /*==================== Mfrwalk =================*/1953 #ifdef HAVE_WALK1954 if (strcmp(sys_cmd, "Mfrwalk") == 0)1955 {1956 const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};1957 if (!iiCheckTypes(h,t,1)) return TRUE;1958 if (((intvec*) h->next->Data())->length() != currRing->N &&1959 ((intvec*) h->next->next->Data())->length() != currRing->N)1960 {1961 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);1962 1945 return TRUE; 1963 1946 } … … 1966 1949 intvec* arg3 = (intvec*) h->next->next->Data(); 1967 1950 int arg4 = (int)(long) h->next->next->next->Data(); 1968 ideal result = (ideal) Mf rwalk(arg1, arg2, arg3, arg4);1951 ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4); 1969 1952 res->rtyp = IDEAL_CMD; 1970 1953 res->data = result; … … 1972 1955 } 1973 1956 else 1957 #endif 1958 /*==================== Mfrwalk =================*/ 1959 #ifdef HAVE_WALK 1960 if (strcmp(sys_cmd, "Mfrwalk") == 0) 1961 { 1962 const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD}; 1963 if (!iiCheckTypes(h,t,1)) return TRUE; 1964 if (((intvec*) h->next->Data())->length() != currRing->N && 1965 ((intvec*) h->next->next->Data())->length() != currRing->N) 1966 { 1967 Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N); 1968 return TRUE; 1969 } 1970 ideal arg1 = (ideal) h->Data(); 1971 intvec* arg2 = (intvec*) h->next->Data(); 1972 intvec* arg3 = (intvec*) h->next->next->Data(); 1973 int arg4 = (int)(long) h->next->next->next->Data(); 1974 int arg5 = (int)(long) h->next->next->next->next->Data(); 1975 ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5); 1976 res->rtyp = IDEAL_CMD; 1977 res->data = result; 1978 return FALSE; 1979 } 1980 else 1974 1981 /*==================== Mprwalk =================*/ 1975 1982 if (strcmp(sys_cmd, "Mprwalk") == 0) 1976 1983 { 1977 const short t[]={ 7,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD,RING_CMD};1984 const short t[]={9,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD,INT_CMD}; 1978 1985 if (!iiCheckTypes(h,t,1)) return TRUE; 1979 if (((intvec*) h->next->Data())->length() != currRing->N && 1980 ((intvec*) h->next->next->Data())->length() != currRing->N ) 1981 { 1982 Werror("system(\"Mrwalk\" ...) intvecs not of length %d\n", 1983 currRing->N); 1986 if((((intvec*) h->next->Data())->length() != currRing->N && 1987 ((intvec*) h->next->next->Data())->length() != currRing->N ) && 1988 (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) && 1989 ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )) 1990 { 1991 Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n", 1992 currRing->N,(currRing->N)*(currRing->N)); 1984 1993 return TRUE; 1985 1994 } … … 1990 1999 int arg5 = (int)(long) h->next->next->next->next->Data(); 1991 2000 int arg6 = (int)(long) h->next->next->next->next->next->Data(); 1992 ring arg7 = (ring) h->next->next->next->next->next->next->Data(); 1993 ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7); 2001 int arg7 = (int)(long) h->next->next->next->next->next->next->Data(); 2002 int arg8 = (int)(long) h->next->next->next->next->next->next->next->Data(); 2003 int arg9 = (int)(long) h->next->next->next->next->next->next->next->next->Data(); 2004 ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); 1994 2005 res->rtyp = IDEAL_CMD; 1995 2006 res->data = result; -
Singular/walk.cc
rf2ba60d racccd2 431 431 #endif 432 432 433 #ifdef CHECK_IDEAL_MWALK433 //#ifdef CHECK_IDEAL_MWALK 434 434 static void idString(ideal L, const char* st) 435 435 { … … 443 443 Print(" %s;", pString(L->m[nL-1])); 444 444 } 445 #endif445 //#endif 446 446 447 447 #if defined(CHECK_IDEAL_MWALK) || defined(ENDWALKS) … … 3155 3155 else 3156 3156 { 3157 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung3157 rChangeCurrRing(VMrDefault(curr_weight)); 3158 3158 } 3159 3159 newRing = currRing; … … 3911 3911 else 3912 3912 { 3913 rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung3913 rChangeCurrRing(VMrDefault(curr_weight)); 3914 3914 } 3915 3915 newRing = currRing; … … 4172 4172 else 4173 4173 { 4174 rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung4174 rChangeCurrRing(VMrDefault(curr_weight)); 4175 4175 } 4176 4176 newRing = currRing; … … 5000 5000 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 5001 5001 delete hilb_func; 5002 #endif // BUCHBERGER_ALG5002 #endif 5003 5003 tstd = tstd + clock() - to; 5004 5004 … … 5009 5009 5010 5010 to = clock(); 5011 // 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. 5011 // compute a representation of the generators of submod (M) with respect 5012 // to those of mod (Gomega). 5013 // Gomega is a reduced Groebner basis w.r.t. the current ring. 5012 5014 F = MLifttwoIdeal(Gomega2, M1, G); 5013 5015 tlift = tlift + clock() - to; … … 5106 5108 * THE GROEBNER WALK ALGORITHM * 5107 5109 *******************************/ 5108 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing) 5110 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, 5111 ring baseRing, int reduction, int printout) 5109 5112 { 5110 5113 BITSET save1 = si_opt_1; // save current options 5111 //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5112 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5113 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5114 if(reduction == 0) 5115 { 5116 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5117 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5118 } 5114 5119 Set_Error(FALSE); 5115 5120 Overflow_Error = FALSE; … … 5152 5157 #endif 5153 5158 rComplete(currRing); 5154 #ifdef CHECK_IDEAL_MWALK 5155 idString(Go,"Go"); 5156 #endif 5159 //#ifdef CHECK_IDEAL_MWALK 5160 if(printout > 2) 5161 { 5162 idString(Go,"//** Mwalk: Go"); 5163 } 5164 //#endif 5157 5165 #ifdef TIME_TEST 5158 5166 to = clock(); … … 5181 5189 to = clock(); 5182 5190 #endif 5183 #ifdef CHECK_IDEAL_MWALK 5184 idString(G,"G"); 5185 #endif 5191 //#ifdef CHECK_IDEAL_MWALK 5192 if(printout > 2) 5193 { 5194 idString(G,"//** Mwalk: G"); 5195 } 5196 //#endif 5186 5197 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5187 5198 #ifdef TIME_TEST 5188 5199 tif = tif + clock()-to; //time for computing initial form ideal 5189 5200 #endif 5190 #ifdef CHECK_IDEAL_MWALK 5191 idString(Gomega,"Gomega"); 5192 #endif 5201 //#ifdef CHECK_IDEAL_MWALK 5202 if(printout > 1) 5203 { 5204 idString(Gomega,"//** Mwalk: Gomega"); 5205 } 5206 //#endif 5193 5207 #ifndef BUCHBERGER_ALG 5194 5208 if(isNolVector(curr_weight) == 0) … … 5240 5254 #endif 5241 5255 idSkipZeroes(M); 5242 #ifdef CHECK_IDEAL_MWALK 5243 PrintS("\n//** Mwalk: computed M.\n"); 5244 idString(M, "M"); 5245 #endif 5256 //#ifdef CHECK_IDEAL_MWALK 5257 if(printout > 2) 5258 { 5259 idString(M, "//** Mwalk: M"); 5260 } 5261 //#endif 5246 5262 //change the ring to baseRing 5247 5263 rChangeCurrRing(baseRing); … … 5258 5274 tlift = tlift + clock() - to; 5259 5275 #endif 5260 #ifdef CHECK_IDEAL_MWALK 5261 idString(F, "F"); 5262 #endif 5276 //#ifdef CHECK_IDEAL_MWALK 5277 if(printout > 2) 5278 { 5279 idString(F, "//** Mwalk: F"); 5280 } 5281 //#endif 5263 5282 idDelete(&Gomega2); 5264 5283 idDelete(&M1); … … 5275 5294 #endif 5276 5295 idSkipZeroes(G); 5277 #ifdef CHECK_IDEAL_MWALK 5278 idString(G, "G"); 5279 #endif 5296 //#ifdef CHECK_IDEAL_MWALK 5297 if(printout > 2) 5298 { 5299 idString(G, "//** Mwalk: G"); 5300 } 5301 //#endif 5280 5302 #ifdef TIME_TEST 5281 5303 to = clock(); … … 5285 5307 tnw = tnw + clock() - to; 5286 5308 #endif 5287 #ifdef PRINT_VECTORS 5288 MivString(curr_weight, target_weight, next_weight); 5289 #endif 5290 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) 5309 //#ifdef PRINT_VECTORS 5310 if(printout > 0) 5311 { 5312 MivString(curr_weight, target_weight, next_weight); 5313 } 5314 //#endif 5315 if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 5291 5316 { 5292 5317 #ifdef CHECK_IDEAL_MWALK … … 5305 5330 Gomega1 = idrMoveR(Gomega, baseRing,currRing); 5306 5331 idDelete(&Gomega); 5307 #ifdef CHECK_IDEAL_MWALK 5308 idString(Gomega1, "Gomega"); 5309 #endif 5332 //#ifdef CHECK_IDEAL_MWALK 5333 if(printout > 1) 5334 { 5335 idString(Gomega1, "//** Mwalk: Gomega"); 5336 } 5337 //#endif 5310 5338 M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL); 5311 #ifdef CHECK_IDEAL_MWALK 5312 idString(M,"M"); 5313 #endif 5339 //#ifdef CHECK_IDEAL_MWALK 5340 if(printout > 1) 5341 { 5342 idString(M,"//** Mwalk: M"); 5343 } 5344 //#endif 5314 5345 rChangeCurrRing(baseRing); 5315 5346 M1 = idrMoveR(M, newRing,currRing); … … 5318 5349 idDelete(&Gomega1); 5319 5350 F = MLifttwoIdeal(Gomega2, M1, G); 5320 #ifdef CHECK_IDEAL_MWALK 5321 idString(F,"F"); 5322 #endif 5351 //#ifdef CHECK_IDEAL_MWALK 5352 if(printout > 2) 5353 { 5354 idString(F,"//** Mwalk: F"); 5355 } 5356 //#endif 5323 5357 idDelete(&Gomega2); 5324 5358 idDelete(&M1); … … 5332 5366 to = clock(); 5333 5367 #endif 5334 // if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5335 // { 5336 G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set 5337 // } 5368 // if(si_opt_1 == (Sy_bit(OPT_REDSB))){ 5369 G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing 5370 // } 5338 5371 #ifdef TIME_TEST 5339 5372 tred = tred + clock() - to; … … 5342 5375 delete next_weight; 5343 5376 break; 5344 #ifdef CHECK_IDEAL_MWALK 5345 PrintS("\n//** Mwalk: last cone.\n"); 5346 #endif 5347 } 5348 #ifdef CHECK_IDEAL_MWALK 5349 PrintS("\n//** Mwalk: update weight vectors.\n"); 5350 #endif 5377 } 5351 5378 for(i=nV-1; i>=0; i--) 5352 5379 { … … 5369 5396 #endif 5370 5397 #ifdef TIME_TEST 5371 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);5372 5398 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep); 5373 Print("\n//** Mwalk: Ergebnis.\n");5374 5399 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 5375 5400 //Print("\n// Overflow_Error? (%d)\n", Overflow_Error); 5376 5401 #endif 5402 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep); 5377 5403 return(result); 5378 5404 } 5379 5405 5380 5406 // 07.11.2012 5381 // THE RANDOM WALK ALGORITHM ideal Go, intvec* orig_M, intvec* target_M, ring baseRing 5382 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, ring baseRing) 5407 // THE RANDOM WALK ALGORITHM 5408 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, 5409 int reduction, int printout) 5383 5410 { 5384 5411 BITSET save1 = si_opt_1; // save current options 5385 //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5386 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5387 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5412 if(reduction == 0) 5413 { 5414 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5415 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5416 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5417 } 5388 5418 Set_Error(FALSE); 5389 5419 Overflow_Error = FALSE; … … 5395 5425 #endif 5396 5426 nstep=0; 5397 int i, nwalk,endwalks = 0;5398 int nV = baseRing->N;5427 int i,polylength,nwalk,endwalks = 0; 5428 int nV = currRing->N; 5399 5429 5400 5430 ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1; 5401 5431 ring newRing; 5402 ring XXRing = baseRing; 5432 ring baseRing = currRing; 5433 ring XXRing = currRing; 5403 5434 intvec* ivNull = new intvec(nV); 5404 5435 intvec* curr_weight = new intvec(nV); … … 5406 5437 intvec* exivlp = Mivlp(nV); 5407 5438 intvec* tmp_weight = new intvec(nV); 5439 intvec* next_weight= new intvec(nV); 5408 5440 for(i=0; i<nV; i++) 5409 5441 { … … 5426 5458 #endif 5427 5459 rComplete(currRing); 5428 #ifdef CHECK_IDEAL_MWALK5429 idString(Go,"Go");5430 #endif5431 5460 #ifdef TIME_TEST 5432 5461 to = clock(); 5433 5462 #endif 5434 5435 5436 5437 5438 5439 5440 5441 5463 if(orig_M->length() == nV) 5464 { 5465 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp) 5466 } 5467 else 5468 { 5469 newRing = VMatrDefault(orig_M); 5470 } 5442 5471 rChangeCurrRing(newRing); 5443 5472 ideal G = MstdCC(idrMoveR(Go,baseRing,currRing)); … … 5455 5484 to = clock(); 5456 5485 #endif 5457 #ifdef CHECK_IDEAL_MWALK 5458 idString(G,"G"); 5459 #endif 5486 //#ifdef CHECK_IDEAL_MWALK 5487 if(printout > 2) 5488 { 5489 idString(G,"//** Mrwalk: G"); 5490 } 5491 //#endif 5460 5492 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5493 //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise 5494 polylength = lengthpoly(Gomega); 5461 5495 #ifdef TIME_TEST 5462 5496 tif = tif + clock()-to; //time for computing initial form ideal 5463 5497 #endif 5464 #ifdef CHECK_IDEAL_MWALK 5465 idString(Gomega,"Gomega"); 5466 #endif 5498 //#ifdef CHECK_IDEAL_MWALK 5499 if(printout > 1) 5500 { 5501 idString(Gomega,"//** Mrwalk: Gomega"); 5502 } 5503 //#endif 5467 5504 #ifndef BUCHBERGER_ALG 5468 5505 if(isNolVector(curr_weight) == 0) … … 5514 5551 #endif 5515 5552 idSkipZeroes(M); 5516 #ifdef CHECK_IDEAL_MWALK 5517 PrintS("\n//** Mwalk: computed M.\n"); 5518 idString(M, "M"); 5519 #endif 5553 //#ifdef CHECK_IDEAL_MWALK 5554 if(printout > 2) 5555 { 5556 idString(M, "//** Mrwalk: M"); 5557 } 5558 //#endif 5520 5559 //change the ring to baseRing 5521 5560 rChangeCurrRing(baseRing); … … 5527 5566 to = clock(); 5528 5567 #endif 5529 // 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 5568 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), 5569 // where Gomega is a reduced Groebner basis w.r.t. the current ring 5530 5570 F = MLifttwoIdeal(Gomega2, M1, G); 5531 5571 #ifdef TIME_TEST 5532 5572 tlift = tlift + clock() - to; 5533 5573 #endif 5534 #ifdef CHECK_IDEAL_MWALK 5535 idString(F, "F"); 5536 #endif 5574 //#ifdef CHECK_IDEAL_MWALK 5575 if(printout > 2) 5576 { 5577 idString(F, "//** Mrwalk: F"); 5578 } 5579 //#endif 5537 5580 idDelete(&Gomega2); 5538 5581 idDelete(&M1); … … 5543 5586 #ifdef TIME_TEST 5544 5587 to = clock(); 5545 #endif5546 //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);5547 #ifdef TIME_TEST5548 5588 tstd = tstd + clock() - to; 5549 5589 #endif 5550 5590 idSkipZeroes(G); 5551 #ifdef CHECK_IDEAL_MWALK 5552 idString(G, "G"); 5553 #endif 5591 //#ifdef CHECK_IDEAL_MWALK 5592 if(printout > 2) 5593 { 5594 idString(G, "//** Mrwalk: G"); 5595 } 5596 //#endif 5554 5597 #ifdef TIME_TEST 5555 5598 to = clock(); 5556 5599 #endif 5557 intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G); 5600 next_weight = MwalkNextWeightCC(curr_weight,target_weight,G); 5601 if(polylength > 0) 5602 { 5603 //there is a polynomial in Gomega with at least 3 monomials, 5604 //low-dimensional facet of the cone 5605 delete next_weight; 5606 next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg); 5607 } 5558 5608 #ifdef TIME_TEST 5559 5609 tnw = tnw + clock() - to; 5560 5610 #endif 5561 #ifdef PRINT_VECTORS 5562 MivString(curr_weight, target_weight, next_weight); 5563 #endif 5611 //#ifdef PRINT_VECTORS 5612 if(printout > 0) 5613 { 5614 MivString(curr_weight, target_weight, next_weight); 5615 } 5616 //#endif 5564 5617 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) 5565 5618 { … … 5568 5621 #endif 5569 5622 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector" 5623 //#ifdef CHECK_IDEAL_MWALK 5624 if(printout > 1) 5625 { 5626 idString(Gomega, "//** Mrwalk: Gomega"); 5627 } 5628 //#endif 5570 5629 if(target_M->length() == nV) 5571 5630 { … … 5579 5638 Gomega1 = idrMoveR(Gomega, baseRing,currRing); 5580 5639 idDelete(&Gomega); 5581 #ifdef CHECK_IDEAL_MWALK5582 idString(Gomega1, "Gomega");5583 #endif5584 5640 M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL); 5585 #ifdef CHECK_IDEAL_MWALK 5586 idString(M,"M"); 5587 #endif 5641 //#ifdef CHECK_IDEAL_MWALK 5642 if(printout > 2) 5643 { 5644 idString(M,"//** Mrwalk: M"); 5645 } 5646 //#endif 5588 5647 rChangeCurrRing(baseRing); 5589 5648 M1 = idrMoveR(M, newRing,currRing); … … 5592 5651 idDelete(&Gomega1); 5593 5652 F = MLifttwoIdeal(Gomega2, M1, G); 5594 #ifdef CHECK_IDEAL_MWALK5595 idString(F,"F");5596 #endif5597 5653 idDelete(&Gomega2); 5598 5654 idDelete(&M1); … … 5601 5657 idDelete(&F); 5602 5658 baseRing = currRing; 5603 si_opt_1 = save1; //set original options, e. g. option(RedSB)5604 5659 idSkipZeroes(G); 5605 5660 #ifdef TIME_TEST 5606 5661 to = clock(); 5607 5662 #endif 5608 // if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5609 // { 5610 //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set 5611 // } 5663 //#ifdef CHECK_IDEAL_MWALK 5664 if(printout > 2) 5665 { 5666 idString(G,"//** Mrwalk: G"); 5667 } 5668 /*#endif 5669 if(si_opt_1 == (Sy_bit(OPT_REDSB))) 5670 {*/ 5671 G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing 5672 // } 5612 5673 #ifdef TIME_TEST 5613 5674 tred = tred + clock() - to; … … 5616 5677 delete next_weight; 5617 5678 break; 5618 #ifdef CHECK_IDEAL_MWALK 5619 PrintS("\n//** Mwalk: last cone.\n"); 5620 #endif 5621 } 5622 #ifdef CHECK_IDEAL_MWALK 5623 PrintS("\n//** Mwalk: update weight vectors.\n"); 5624 #endif 5679 } 5625 5680 for(i=nV-1; i>=0; i--) 5626 5681 { … … 5630 5685 delete next_weight; 5631 5686 } 5687 baseRing = currRing; 5632 5688 rChangeCurrRing(XXRing); 5633 5689 ideal result = idrMoveR(G,baseRing,currRing); 5634 5690 idDelete(&G); 5635 /*#ifdef CHECK_IDEAL_MWALK 5636 pDelete(&p); 5637 #endif*/ 5691 si_opt_1 = save1; //set original options, e. g. option(RedSB) 5638 5692 delete tmp_weight; 5639 5693 delete ivNull; … … 5642 5696 delete last_omega; 5643 5697 #endif 5698 Print("\n//** Mrwalk: Groebner Walk took %d steps.\n", nstep); 5644 5699 #ifdef TIME_TEST 5645 Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);5646 5700 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep); 5647 Print("\n//** Mwalk: Ergebnis.\n");5648 5701 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 5649 5702 //Print("\n// Overflow_Error? (%d)\n", Overflow_Error); … … 5792 5845 // use kStd, if nP = 0, else call LastGB 5793 5846 ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight, 5794 intvec* target_weight, int nP) 5795 { 5847 intvec* target_weight, int nP, int reduction, int printout) 5848 { 5849 BITSET save1 = si_opt_1; // save current options 5850 if(reduction == 0) 5851 { 5852 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 5853 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 5854 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 5855 } 5796 5856 Set_Error(FALSE ); 5797 5857 Overflow_Error = FALSE; … … 5831 5891 ring XXRing = currRing; 5832 5892 5833 5834 5893 to = clock(); 5835 5894 // perturbs the original vector … … 5893 5952 G = idrMoveR(ssG, TargetRing,currRing); 5894 5953 } 5895 /* 5896 Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg); 5897 ivString(curr_weight, "new sigma"); 5898 ivString(target_weight, "new tau"); 5899 */ 5954 if(printout > 0) 5955 { 5956 Print("\n//** Mpwalk: Perturbation Walk of degree (%d,%d):",op_deg,tp_deg); 5957 ivString(curr_weight, "//** Mpwalk: new current weight"); 5958 ivString(target_weight, "//** Mpwalk: new target weight"); 5959 } 5900 5960 while(1) 5901 5961 { … … 5905 5965 "curr_weight" */ 5906 5966 Gomega = MwalkInitialForm(G, curr_weight); 5907 5967 //#ifdef CHECK_IDEAL_MWALK 5968 if(printout > 1) 5969 { 5970 idString(Gomega,"//** Mpwalk: Gomega"); 5971 } 5972 //#endif 5908 5973 5909 5974 #ifdef ENDWALKS 5910 if(endwalks == 1){ 5975 if(endwalks == 1) 5976 { 5911 5977 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 5912 5978 idElements(G, "G"); 5913 // idElements(Gomega, "Gw");5914 5979 headidString(G, "G"); 5915 //headidString(Gomega, "Gw");5916 5980 } 5917 5981 #endif … … 5959 6023 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 5960 6024 delete hilb_func; 5961 #endif // BUCHBERGER_ALG 6025 #endif 6026 //#ifdef CHECK_IDEAL_MWALK 6027 if(printout > 2) 6028 { 6029 idString(M,"//** Mpwalk: M"); 6030 } 6031 //#endif 5962 6032 5963 6033 if(endwalks == 1){ … … 5975 6045 M1 = idrMoveR(M, newRing,currRing); 5976 6046 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 5977 5978 //if(endwalks==1) PrintS("\n// Lifting is working:..");5979 6047 5980 6048 to=clock(); … … 5988 6056 xtlift=clock()-to; 5989 6057 6058 //#ifdef CHECK_IDEAL_MWALK 6059 if(printout > 2) 6060 { 6061 idString(F,"//** Mpwalk: F"); 6062 } 6063 //#endif 6064 5990 6065 idDelete(&M1); 5991 6066 idDelete(&Gomega2); … … 5995 6070 rChangeCurrRing(newRing); 5996 6071 F1 = idrMoveR(F, oldRing,currRing); 5997 5998 //if(endwalks==1)PrintS("\n// InterRed is working now:");5999 6072 6000 6073 to=clock(); … … 6012 6085 6013 6086 to=clock(); 6014 / * compute a next weight vector */6087 // compute a next weight vector 6015 6088 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 6016 6089 tnw=tnw+clock()-to; 6017 #ifdef PRINT_VECTORS 6018 MivString(curr_weight, target_weight, next_weight); 6019 #endif 6090 //#ifdef PRINT_VECTORS 6091 if(printout > 2) 6092 { 6093 MivString(curr_weight, target_weight, next_weight); 6094 } 6095 //#endif 6020 6096 6021 6097 if(Overflow_Error == TRUE) … … 6109 6185 Eresult = idrMoveR(G, newRing,currRing); 6110 6186 } 6187 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6111 6188 delete ivNull; 6112 6189 if(tp_deg != 1) … … 6123 6200 tnw+xtnw); 6124 6201 6125 Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6126 Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6127 #endif 6202 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6203 //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6204 #endif 6205 Print("\n//** Mpwalk: Perturbation Walk took %d steps.\n", nstep); 6206 return(Eresult); 6207 } 6208 6209 /******************************************************* 6210 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT * 6211 *******************************************************/ 6212 ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, 6213 int op_deg, int tp_deg, int nP, int reduction, int printout) 6214 { 6215 BITSET save1 = si_opt_1; // save current options 6216 if(reduction == 0) 6217 { 6218 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 6219 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 6220 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 6221 } 6222 Set_Error(FALSE); 6223 Overflow_Error = FALSE; 6224 //Print("// pSetm_Error = (%d)", ErrorCheck()); 6225 6226 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; 6227 xtextra=0; 6228 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; 6229 tinput = clock(); 6230 6231 clock_t tim; 6232 6233 nstep = 0; 6234 int i, ntwC=1, ntestw=1, polylength, nV = currRing->N; 6235 int endwalks=0; 6236 6237 ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG; 6238 ring newRing, oldRing, TargetRing; 6239 intvec* iv_M_dp; 6240 intvec* iv_M_lp; 6241 intvec* exivlp = Mivlp(nV); 6242 intvec* curr_weight = new intvec(nV); 6243 intvec* target_weight = new intvec(nV); 6244 for(i=0; i<nV; i++) 6245 { 6246 (*curr_weight)[i] = (*orig_M)[i]; 6247 (*target_weight)[i] = (*target_M)[i]; 6248 } 6249 intvec* orig_target = target_weight; 6250 intvec* pert_target_vector = target_weight; 6251 intvec* ivNull = new intvec(nV); 6252 intvec* iv_dp = MivUnit(nV);// define (1,1,...,1) 6253 #ifndef BUCHBERGER_ALG 6254 intvec* hilb_func; 6255 #endif 6256 intvec* next_weight; 6257 6258 // to avoid (1,0,...,0) as the target vector 6259 intvec* last_omega = new intvec(nV); 6260 for(i=nV-1; i>0; i--) 6261 (*last_omega)[i] = 1; 6262 (*last_omega)[0] = 10000; 6263 6264 ring XXRing = currRing; 6265 6266 to = clock(); 6267 // perturbs the original vector 6268 if(orig_M->length() == nV) 6269 { 6270 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp" 6271 { 6272 G = MstdCC(Go); 6273 tostd = clock()-to; 6274 if(op_deg != 1) 6275 { 6276 iv_M_dp = MivMatrixOrderdp(nV); 6277 //ivString(iv_M_dp, "iv_M_dp"); 6278 curr_weight = MPertVectors(G, iv_M_dp, op_deg); 6279 } 6280 } 6281 else 6282 { 6283 //define ring order := (a(curr_weight),lp); 6284 if (rParameter(currRing) != NULL) 6285 DefRingPar(curr_weight); 6286 else 6287 rChangeCurrRing(VMrDefault(curr_weight)); 6288 6289 G = idrMoveR(Go, XXRing,currRing); 6290 G = MstdCC(G); 6291 tostd = clock()-to; 6292 if(op_deg != 1) 6293 { 6294 iv_M_dp = MivMatrixOrder(curr_weight); 6295 curr_weight = MPertVectors(G, iv_M_dp, op_deg); 6296 } 6297 } 6298 } 6299 else 6300 { 6301 rChangeCurrRing(VMatrDefault(orig_M)); 6302 G = idrMoveR(Go, XXRing,currRing); 6303 G = MstdCC(G); 6304 tostd = clock()-to; 6305 if(op_deg != 1) 6306 { 6307 curr_weight = MPertVectors(G, orig_M, op_deg); 6308 } 6309 } 6310 6311 delete iv_dp; 6312 if(op_deg != 1) delete iv_M_dp; 6313 6314 ring HelpRing = currRing; 6315 6316 // perturbs the target weight vector 6317 if(target_M->length() == nV) 6318 { 6319 if(tp_deg > 1 && tp_deg <= nV) 6320 { 6321 if (rParameter(currRing) != NULL) 6322 DefRingPar(target_weight); 6323 else 6324 rChangeCurrRing(VMrDefault(target_weight)); 6325 6326 TargetRing = currRing; 6327 ssG = idrMoveR(G,HelpRing,currRing); 6328 if(MivSame(target_weight, exivlp) == 1) 6329 { 6330 iv_M_lp = MivMatrixOrderlp(nV); 6331 //ivString(iv_M_lp, "iv_M_lp"); 6332 //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg); 6333 target_weight = MPertVectors(ssG, iv_M_lp, tp_deg); 6334 } 6335 else 6336 { 6337 iv_M_lp = MivMatrixOrder(target_weight); 6338 //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg); 6339 target_weight = MPertVectors(ssG, iv_M_lp, tp_deg); 6340 } 6341 delete iv_M_lp; 6342 pert_target_vector = target_weight; 6343 rChangeCurrRing(HelpRing); 6344 G = idrMoveR(ssG, TargetRing,currRing); 6345 } 6346 } 6347 else 6348 { 6349 if(tp_deg > 1 && tp_deg <= nV) 6350 { 6351 rChangeCurrRing(VMatrDefault(target_M)); 6352 TargetRing = currRing; 6353 ssG = idrMoveR(G,HelpRing,currRing); 6354 target_weight = MPertVectors(ssG, target_M, tp_deg); 6355 } 6356 } 6357 if(printout > 0) 6358 { 6359 Print("\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg); 6360 ivString(curr_weight, "//** Mprwalk: new current weight"); 6361 ivString(target_weight, "//** Mprwalk: new target weight"); 6362 } 6363 while(1) 6364 { 6365 nstep ++; 6366 to = clock(); 6367 /* compute an initial form ideal of <G> w.r.t. the weight vector 6368 "curr_weight" */ 6369 Gomega = MwalkInitialForm(G, curr_weight); 6370 //#ifdef CHECK_IDEAL_MWALK 6371 if(printout > 1) 6372 { 6373 idString(Gomega,"//** Mprwalk: Gomega"); 6374 } 6375 //#endif 6376 polylength = lengthpoly(Gomega); 6377 #ifdef ENDWALKS 6378 if(endwalks == 1) 6379 { 6380 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6381 idElements(G, "G"); 6382 headidString(G, "G"); 6383 } 6384 #endif 6385 6386 tif = tif + clock()-to; 6387 6388 #ifndef BUCHBERGER_ALG 6389 if(isNolVector(curr_weight) == 0) 6390 hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing); 6391 else 6392 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing); 6393 #endif // BUCHBERGER_ALG 6394 6395 oldRing = currRing; 6396 6397 if(target_M->length() == nV) 6398 { 6399 // define a new ring with ordering "(a(curr_weight),lp) 6400 if (rParameter(currRing) != NULL) 6401 DefRingPar(curr_weight); 6402 else 6403 rChangeCurrRing(VMrDefault(curr_weight)); 6404 } 6405 else 6406 { 6407 rChangeCurrRing(VMatrRefine(target_M,curr_weight)); 6408 } 6409 newRing = currRing; 6410 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 6411 6412 #ifdef ENDWALKS 6413 if(endwalks==1) 6414 { 6415 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6416 idElements(Gomega1, "Gw"); 6417 headidString(Gomega1, "headGw"); 6418 PrintS("\n// compute a rGB of Gw:\n"); 6419 6420 #ifndef BUCHBERGER_ALG 6421 ivString(hilb_func, "w"); 6422 #endif 6423 } 6424 #endif 6425 6426 tim = clock(); 6427 to = clock(); 6428 /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */ 6429 #ifdef BUCHBERGER_ALG 6430 M = MstdhomCC(Gomega1); 6431 #else 6432 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight); 6433 delete hilb_func; 6434 #endif 6435 //#ifdef CHECK_IDEAL_MWALK 6436 if(printout > 2) 6437 { 6438 idString(M,"//** Mprwalk: M"); 6439 } 6440 //#endif 6441 6442 if(endwalks == 1) 6443 { 6444 xtstd = xtstd+clock()-to; 6445 #ifdef ENDWALKS 6446 Print("\n// time for the last std(Gw) = %.2f sec\n", 6447 ((double) clock())/1000000 -((double)tim) /1000000); 6448 #endif 6449 } 6450 else 6451 tstd=tstd+clock()-to; 6452 6453 /* change the ring to oldRing */ 6454 rChangeCurrRing(oldRing); 6455 M1 = idrMoveR(M, newRing,currRing); 6456 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 6457 6458 to=clock(); 6459 /* compute a representation of the generators of submod (M) 6460 with respect to those of mod (Gomega). 6461 Gomega is a reduced Groebner basis w.r.t. the current ring */ 6462 F = MLifttwoIdeal(Gomega2, M1, G); 6463 if(endwalks != 1) 6464 tlift = tlift+clock()-to; 6465 else 6466 xtlift=clock()-to; 6467 6468 //#ifdef CHECK_IDEAL_MWALK 6469 if(printout > 2) 6470 { 6471 idString(F,"//** Mprwalk: F"); 6472 } 6473 //#endif 6474 6475 idDelete(&M1); 6476 idDelete(&Gomega2); 6477 idDelete(&G); 6478 6479 /* change the ring to newRing */ 6480 rChangeCurrRing(newRing); 6481 F1 = idrMoveR(F, oldRing,currRing); 6482 6483 to=clock(); 6484 /* reduce the Groebner basis <G> w.r.t. new ring */ 6485 G = kInterRedCC(F1, NULL); 6486 if(endwalks != 1) 6487 tred = tred+clock()-to; 6488 else 6489 xtred=clock()-to; 6490 6491 idDelete(&F1); 6492 6493 if(endwalks == 1) 6494 break; 6495 6496 to=clock(); 6497 // compute a next weight vector 6498 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 6499 if(polylength > 0) 6500 { 6501 //there is a polynomial in Gomega with at least 3 monomials, 6502 //low-dimensional facet of the cone 6503 delete next_weight; 6504 next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg); 6505 } 6506 tnw=tnw+clock()-to; 6507 //#ifdef PRINT_VECTORS 6508 if(printout > 2) 6509 { 6510 MivString(curr_weight, target_weight, next_weight); 6511 } 6512 //#endif 6513 6514 if(Overflow_Error == TRUE) 6515 { 6516 ntwC = 0; 6517 //ntestomega = 1; 6518 //Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6519 //idElements(G, "G"); 6520 delete next_weight; 6521 goto FINISH_160302; 6522 } 6523 if(MivComp(next_weight, ivNull) == 1){ 6524 newRing = currRing; 6525 delete next_weight; 6526 //Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6527 break; 6528 } 6529 if(MivComp(next_weight, target_weight) == 1) 6530 endwalks = 1; 6531 6532 for(i=nV-1; i>=0; i--) 6533 (*curr_weight)[i] = (*next_weight)[i]; 6534 6535 delete next_weight; 6536 }//while 6537 6538 if(tp_deg != 1) 6539 { 6540 FINISH_160302: 6541 if(target_M->length() == nV) 6542 { 6543 if(MivSame(orig_target, exivlp) == 1) 6544 if (rParameter(currRing) != NULL) 6545 DefRingParlp(); 6546 else 6547 VMrDefaultlp(); 6548 else 6549 if (rParameter(currRing) != NULL) 6550 DefRingPar(orig_target); 6551 else 6552 rChangeCurrRing(VMrDefault(orig_target)); 6553 } 6554 else 6555 { 6556 rChangeCurrRing(VMatrDefault(target_M)); 6557 } 6558 TargetRing=currRing; 6559 F1 = idrMoveR(G, newRing,currRing); 6560 #ifdef CHECK_IDEAL 6561 headidString(G, "G"); 6562 #endif 6563 6564 // check whether the pertubed target vector stays in the correct cone 6565 if(ntwC != 0){ 6566 ntestw = test_w_in_ConeCC(F1, pert_target_vector); 6567 } 6568 6569 if( ntestw != 1 || ntwC == 0) 6570 { 6571 /* 6572 if(ntestw != 1){ 6573 ivString(pert_target_vector, "tau"); 6574 PrintS("\n// ** perturbed target vector doesn't stay in cone!!"); 6575 Print("\n// ring r%d = %s;\n", nstep, rString(currRing)); 6576 idElements(F1, "G"); 6577 } 6578 */ 6579 // LastGB is "better" than the kStd subroutine 6580 to=clock(); 6581 ideal eF1; 6582 if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1 || target_M->length() != nV){ 6583 // PrintS("\n// ** calls \"std\" to compute a GB"); 6584 eF1 = MstdCC(F1); 6585 idDelete(&F1); 6586 } 6587 else { 6588 // PrintS("\n// ** calls \"LastGB\" to compute a GB"); 6589 rChangeCurrRing(newRing); 6590 ideal F2 = idrMoveR(F1, TargetRing,currRing); 6591 eF1 = LastGB(F2, curr_weight, tp_deg-1); 6592 F2=NULL; 6593 } 6594 xtextra=clock()-to; 6595 ring exTargetRing = currRing; 6596 6597 rChangeCurrRing(XXRing); 6598 Eresult = idrMoveR(eF1, exTargetRing,currRing); 6599 } 6600 else{ 6601 rChangeCurrRing(XXRing); 6602 Eresult = idrMoveR(F1, TargetRing,currRing); 6603 } 6604 } 6605 else { 6606 rChangeCurrRing(XXRing); 6607 Eresult = idrMoveR(G, newRing,currRing); 6608 } 6609 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6610 delete ivNull; 6611 if(tp_deg != 1) 6612 delete target_weight; 6613 6614 if(op_deg != 1 ) 6615 delete curr_weight; 6616 6617 delete exivlp; 6618 delete last_omega; 6619 6620 #ifdef TIME_TEST 6621 TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred, 6622 tnw+xtnw); 6623 6624 //Print("\n// pSetm_Error = (%d)", ErrorCheck()); 6625 //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep, Overflow_Error); 6626 #endif 6627 Print("\n//** Mprwalk: Perturbation Walk took %d steps.\n", nstep); 6128 6628 return(Eresult); 6129 6629 } … … 6856 7356 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 6857 7357 *******************************************************************************/ 6858 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget) 6859 { 7358 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction) 7359 { 7360 BITSET save1 = si_opt_1; // save current options 7361 if(reduction == 0) 7362 { 7363 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 7364 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 7365 //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB)); 7366 } 6860 7367 Set_Error(FALSE); 6861 7368 Overflow_Error = FALSE; … … 6964 7471 idSkipZeroes(resF); 6965 7472 7473 si_opt_1 = save1; //set original options, e. g. option(RedSB) 6966 7474 delete Xivlp; 6967 7475 delete Xsigma; … … 6982 7490 } 6983 7491 6984 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,int weight_rad) 6985 { 7492 /******************************************************************************* 7493 * The implementation of the fractal walk algorithm with random element * 7494 * * 7495 * The main procedur Mfwalk calls the recursive Subroutine * 7496 * rec_r_fractal_call to compute the wanted Groebner basis. * 7497 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast" * 7498 * order, e.g. "dp" and a sequence of weight vectors which are row vectors * 7499 * of a matrix. This matrix defines the given monomial order, e.g. "lp" * 7500 *******************************************************************************/ 7501 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, 7502 int weight_rad, int reduction) 7503 { 7504 BITSET save1 = si_opt_1; // save current options 7505 if(reduction == 0) 7506 { 7507 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis 7508 //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions 7509 } 6986 7510 Set_Error(FALSE); 6987 7511 Overflow_Error = FALSE; … … 7083 7607 ideal resF; 7084 7608 ring helpRing = currRing; 7085 //ideal G, int nlev, intvec* omtmp, int weight_rad) 7609 7086 7610 J = rec_r_fractal_call(J, 1, ivtarget,weight_rad); 7087 7611 … … 7090 7614 idSkipZeroes(resF); 7091 7615 7616 si_opt_1 = save1; //set original options, e. g. option(RedSB) 7092 7617 delete Xivlp; 7093 7618 delete Xsigma; … … 8281 8806 8282 8807 //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error); 8283 8808 Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing)); 8284 8809 return(result); 8285 }8286 8287 /*******************************************************8288 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT *8289 *******************************************************/8290 ideal Mprwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)8291 {8292 BITSET save1 = si_opt_1; // save current options8293 si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis8294 Set_Error(FALSE);8295 Overflow_Error = FALSE;8296 #ifdef TIME_TEST8297 clock_t tinput=0, tostd=0, tif=0, tstd=0, tlift=0, tred=0, tnw=0;8298 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;8299 tinput = clock();8300 clock_t tim;8301 #endif8302 int i,nwalk,nV = baseRing->N;8303 8304 ideal G, Gomega, M, F, Gomega1, Gomega2, M1;8305 ring newRing;8306 ring XXRing = baseRing;8307 intvec* exivlp = Mivlp(nV);8308 intvec* orig_target = target_weight;8309 intvec* pert_target_vector = target_weight;8310 intvec* ivNull = new intvec(nV);8311 intvec* tmp_weight = new intvec(nV);8312 #ifdef CHECK_IDEAL_MWALK8313 poly p;8314 #endif8315 for(i=0; i<nV; i++)8316 {8317 (*tmp_weight)[i] = (*curr_weight)[i];8318 }8319 #ifndef BUCHBERGER_ALG8320 intvec* hilb_func;8321 // to avoid (1,0,...,0) as the target vector8322 intvec* last_omega = new intvec(nV);8323 for(i=0 i<nV; i++)8324 {8325 (*last_omega)[i] = 1;8326 }8327 (*last_omega)[0] = 10000;8328 #endif8329 baseRing = currRing;8330 newRing = VMrDefault(curr_weight);8331 rChangeCurrRing(newRing);8332 G = idrMoveR(Go,baseRing,currRing);8333 #ifdef TIME_TEST8334 to = clock();8335 #endif8336 G = kStd(G,NULL,testHomog,NULL,NULL,0,0,NULL);8337 idSkipZeroes(G);8338 #ifdef TIME_TEST8339 tostd = tostd + to - clock();8340 #endif8341 #ifdef CHECK_IDEAL_MWALK8342 idString(G,"G");8343 #endif8344 if(op_deg >1)8345 {8346 if(MivComp(curr_weight,MivUnit(nV)) == 1) //ring order is "dp"8347 {8348 curr_weight = MPertVectors(G, MivMatrixOrderdp(nV), op_deg);8349 }8350 else //ring order is not "dp"8351 {8352 curr_weight = MPertVectors(G, MivMatrixOrder(curr_weight), op_deg);8353 }8354 }8355 baseRing = currRing;8356 if(tp_deg > 1 && tp_deg <= nV)8357 {8358 pert_target_vector = target_weight;8359 }8360 #ifdef CHECK_IDEAL_MWALK8361 ivString(curr_weight, "new curr_weight");8362 ivString(target_weight, "new target_weight");8363 #endif8364 nwalk = 0;8365 while(1)8366 {8367 nwalk ++;8368 #ifdef TIME_TEST8369 to = clock();8370 #endif8371 Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"8372 #ifdef TIME_TEST8373 tif = tif + clock()-to; //time for computing initial form ideal8374 #endif8375 #ifdef CHECK_IDEAL_MWALK8376 idString(Gomega,"Gomega");8377 #endif8378 #ifndef BUCHBERGER_ALG8379 if(isNolVector(curr_weight) == 0)8380 {8381 hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);8382 }8383 else8384 {8385 hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);8386 }8387 #endif8388 if(nwalk == 1)8389 {8390 newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)8391 }8392 else8393 {8394 newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"8395 }8396 rChangeCurrRing(newRing);8397 Gomega1 = idrMoveR(Gomega, baseRing,currRing);8398 idDelete(&Gomega);8399 // compute a Groebner basis of <Gomega> w.r.t. "newRing"8400 #ifdef TIME_TEST8401 to = clock();8402 #endif8403 #ifndef BUCHBERGER_ALG8404 M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);8405 delete hilb_func;8406 #else8407 M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);8408 #endif8409 idSkipZeroes(M);8410 #ifdef TIME_TEST8411 tstd = tstd + clock() - to;8412 #endif8413 #ifdef CHECK_IDEAL_MWALK8414 idString(M, "M");8415 #endif8416 //change the ring to baseRing8417 rChangeCurrRing(baseRing);8418 M1 = idrMoveR(M, newRing,currRing);8419 idDelete(&M);8420 Gomega2 = idrMoveR(Gomega1, newRing,currRing);8421 idDelete(&Gomega1);8422 to = clock();8423 // 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 ring8424 F = MLifttwoIdeal(Gomega2, M1, G);8425 idSkipZeroes(F);8426 #ifdef TIME_TEST8427 tlift = tlift + clock() - to;8428 #endif8429 #ifdef CHECK_IDEAL_MWALK8430 idString(F,"F");8431 #endif8432 rChangeCurrRing(newRing); // change the ring to newRing8433 G = idrMoveR(F,baseRing,currRing);8434 idDelete(&F);8435 baseRing = currRing; // set baseRing equal to newRing8436 #ifdef CHECK_IDEAL_MWALK8437 idString(G,"G");8438 #endif8439 #ifdef TIME_TEST8440 to = clock();8441 #endif8442 intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);8443 #ifdef TIME_TEST8444 tnw = tnw + clock() - to;8445 #endif8446 #ifdef PRINT_VECTORS8447 MivString(curr_weight, target_weight, next_weight);8448 #endif8449 if(Overflow_Error == TRUE)8450 {8451 PrintS("\n//**Mprwalk: OVERFLOW: The computed vector does not stay in cone, the result may be wrong.\n");8452 delete next_weight;8453 break;8454 }8455 8456 if(test_w_in_ConeCC(G,target_weight) == 1 || MivComp(next_weight, ivNull) == 1)8457 {8458 delete next_weight;8459 break;8460 }8461 //update tmp_weight and curr_weight8462 for(i=nV-1; i>=0; i--)8463 {8464 (*tmp_weight)[i] = (*curr_weight)[i];8465 (*curr_weight)[i] = (*next_weight)[i];8466 }8467 delete next_weight;8468 } //end of while-loop8469 Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));8470 idSkipZeroes(G);8471 si_opt_1 = save1; //set original options, e. g. option(RedSB)8472 baseRing = currRing;8473 rChangeCurrRing(XXRing);8474 ideal Res = idrMoveR(G,baseRing,currRing);8475 delete tmp_weight;8476 delete ivNull;8477 delete exivlp;8478 #ifndef BUCHBERGER_ALG8479 delete last_omega;8480 #endif8481 #ifdef TIME_TEST8482 TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);8483 #endif8484 return(Res);8485 8810 } 8486 8811 -
Singular/walk.h
rf2ba60d racccd2 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); 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); 74 74 75 75 /* Implement Tran's idea */
Note: See TracChangeset
for help on using the changeset viewer.