Changeset c5dc3d in git
- Timestamp:
- Nov 18, 1999, 7:43:58 PM (24 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- b47732ef9f553140e8a89c34abf89d850c8cf74f
- Parents:
- 66502b8276a2e9122fc865791501fa86a14f2749
- Location:
- Singular
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/syz.cc
r66502b8 rc5dc3d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz.cc,v 1. 29 1999-11-16 12:39:31 obachmanExp $ */4 /* $Id: syz.cc,v 1.30 1999-11-18 18:43:57 siebert Exp $ */ 5 5 6 6 /* … … 408 408 BOOLEAN completeMinim; 409 409 BOOLEAN oldDegBound=TEST_OPT_DEGBOUND; 410 BOOLEAN setRegularity=TRUE; 410 411 int wlength=*length; 411 412 … … 458 459 if (w!=NULL) { delete w;w=NULL; } 459 460 w = w1; 461 j = 0; 462 while ((j<IDELEMS(res[0])) && (res[0]->m[j]==NULL)) j++; 463 if (j<IDELEMS(res[0])) 464 { 465 if (pFDeg(res[0]->m[j])!=pTotaldegree(res[0]->m[j])) 466 setRegularity = FALSE; 467 } 468 } 469 else 470 { 471 setRegularity = FALSE; 460 472 } 461 473 … … 484 496 } 485 497 /*--- interreducing first -----------------------------------*/ 498 if (syzIndex>0) 499 { 500 int rkI=idRankFreeModule(res[syzIndex]); 501 rSetSyzComp(rkI); 502 } 486 503 if (minim || (syzIndex!=0)) 487 504 { 488 if (syzIndex>0)489 {490 int rkI=idRankFreeModule(res[syzIndex]);491 rSetSyzComp(rkI);492 }493 505 temp = kInterRed(res[syzIndex],currQuotient); 494 506 idDelete(&res[syzIndex]); … … 500 512 if ((currQuotient==NULL)&&(syzIndex==0)&& (!TEST_OPT_DEGBOUND)) 501 513 { 502 res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE, TRUE,&Kstd1_deg);514 res[/*syzIndex+*/1] = idSyzygies(res[0/*syzIndex*/],hom,&w,FALSE,setRegularity,&Kstd1_deg); 503 515 if ((!TEST_OPT_NOTREGULARITY) && (Kstd1_deg>0)) test |= Sy_bit(OPT_DEGBOUND); 504 516 } -
Singular/syz0.cc
r66502b8 rc5dc3d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz0.cc,v 1.2 5 1999-11-15 17:20:53 obachmanExp $ */4 /* $Id: syz0.cc,v 1.26 1999-11-18 18:43:57 siebert Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 185 185 186 186 /*-------------initializing the sets--------------------*/ 187 ideal idF=(ideal)Alloc SizeOf(ip_sideal);187 ideal idF=(ideal)Alloc0SizeOf(ip_sideal); 188 188 ST=(polyset)Alloc0(Fl*sizeof(poly)); 189 189 S=(polyset)Alloc0(Fl*sizeof(poly)); … … 198 198 tmax = 2*Fl; 199 199 idF->m=F;IDELEMS(idF)=Fmax; 200 idF->nrows=1; 200 201 rkF=idRankFreeModule(idF); 201 FreeSizeOf((ADDRESS)idF,ip_sideal);202 202 /*-------------sorting of F for index handling------------*/ 203 203 if (noSort) … … 206 206 F=syInitSort(F,rkF,Fmax,1,&modcomp); 207 207 } 208 #ifndef __OPTIMIZE__ 209 Print("Neue Anordnung: "); 210 idF->m=F;IDELEMS(idF)=Fmax; 211 idF->nrows=1; 212 idPrint(idF); 213 FreeSizeOf((ADDRESS)idF,ip_sideal); 214 #endif 208 215 /*----------------construction of the new ordering----------*/ 209 216 pSetSchreyerOrdM(F,Fl,rkF); … … 910 917 if ((currRing->OrdSgn != 1) && (hom!=isHomog)) 911 918 { 912 for (i=0; i<IDELEMS(res[ 1]); i++)913 { 914 res[ 1]->m[i] = prMoveR( res[1]->m[i], origR);919 for (i=0; i<IDELEMS(res[0]); i++) 920 { 921 res[0]->m[i] = prMoveR( res[0]->m[i], origR); 915 922 } 916 923 } … … 922 929 } 923 930 } 924 idTest(res[ 1]);931 idTest(res[0]); 925 932 } 926 933 } -
Singular/syz2.cc
r66502b8 rc5dc3d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: syz2.cc,v 1. 8 1999-11-15 17:20:54 obachmanExp $ */4 /* $Id: syz2.cc,v 1.9 1999-11-18 18:43:58 siebert Exp $ */ 5 5 /* 6 6 * ABSTRACT: resolutions … … 46 46 #define USE_HEURISTIC2 47 47 48 extern void rSetmS(poly p, int* Components, long* ShiftedComponents);49 48 #ifdef SHOW_CRIT 50 49 static int crit; … … 127 126 p = pOne(); 128 127 pLcm((syzstr->resPairs[index])[i].p,toHandle,p); 129 rSetmS(p,Components, ShiftedComponents);128 pSetm(p); 130 129 j = 0; 131 130 while (j<i) … … 232 231 tso.p = NULL; 233 232 tso.length = -1; 234 currcomponents = syzstr->truecomponents[index];235 currShiftedComponents = syzstr->ShiftedComponents[index];236 rChangeSComps(currcomponents,237 currShiftedComponents,238 IDELEMS(syzstr->res[index])); // actueller index239 233 number coefgcd = 240 234 nGcd(pGetCoeff(tso.p1),pGetCoeff(tso.p2)); … … 252 246 tso.syz = pAdd(pp,tso.syz); 253 247 nDelete(&coefgcd); 254 currcomponents = syzstr->truecomponents[index-1];255 currShiftedComponents = syzstr->ShiftedComponents[index-1];256 248 pSetComp(tso.lcm,pGetComp((syzstr->resPairs[index])[r1].syz)); 257 rChangeSComps(currcomponents,258 currShiftedComponents,259 IDELEMS(syzstr->res[index])); // actueller index260 249 #ifdef SHOW_PROT 261 250 Print("erzeuge Paar im Modul %d,%d mit: \n",index,tso.order); … … 292 281 * set the vectors of truecomponents 293 282 */ 294 static BOOLEAN syOrder_Hilb(poly p,syStrategy syzstr,int index, 295 int realcomp) 296 { 297 int i=IDELEMS(syzstr->res[index-1])+1,j=0,k,tc,orc,ie; 298 int *trind1=syzstr->truecomponents[index-1]; 299 int *trind=syzstr->truecomponents[index]; 300 long *shind=syzstr->ShiftedComponents[index]; 301 poly pp; 302 polyset o_r=syzstr->orderedRes[index]->m; 303 BOOLEAN ret = FALSE; 304 305 // if != 0, then new element can go into same component 306 // i.e., we do not need to leave space in shifted components 307 long same_comp = 0; 308 309 if (p==NULL) return FALSE; 310 if (realcomp==0) realcomp=1; 311 ie = IDELEMS(syzstr->orderedRes[index]); 312 while ((ie>0) && (syzstr->orderedRes[index]->m[ie-1]==NULL)) ie--; 313 if (ie==0) 314 { 315 j = 0; 316 } 317 else 318 { 319 if (index>1) 320 tc = trind1[pGetComp(p)]; 321 else 322 tc = pGetComp(p); 323 loop 324 { 325 orc = pGetComp(o_r[j]); 326 if (trind1[orc]>tc+1) break; 327 else if (trind1[orc] == tc+1) 328 { 329 same_comp = 1; 330 } 331 j++; 332 if (j==ie) break; 333 } 334 } 335 if (j == ie) 336 { 337 // new element is the last in ordered module 338 if (same_comp == 0) 339 same_comp = SYZ_SHIFT_BASE; 340 341 // test wheter we have enough space for new shifted component 342 if ((LONG_MAX - same_comp) <= shind[ie]) 343 { 344 long new_space = syReorderShiftedComponents(shind, ie+1); 345 assume((LONG_MAX - same_comp) > shind[ie]); 346 ret = TRUE; 347 if (TEST_OPT_PROT) Print("(T%u)", new_space); 348 } 349 350 // yes, then set new shifted component 351 assume(ie == 0 || shind[ie] > 0); 352 shind[ie+1] = shind[ie] + same_comp; 353 } 354 else 355 { 356 // new element must come in between 357 // i.e. at place j+1 358 long prev, next; 359 360 // test whether new component can get shifted value 361 prev = shind[j]; 362 next = shind[j+1]; 363 assume(next > prev); 364 if ((same_comp && prev + 2 >= next) || (!same_comp && next - prev < 4)) 365 { 366 long new_space = syReorderShiftedComponents(shind, ie+1); 367 prev = shind[j]; 368 next = shind[j+1]; 369 assume((same_comp && prev + 2 < next) || (!same_comp && next - prev >= 4)); 370 ret = TRUE; 371 if (TEST_OPT_PROT) Print("(B%u)", new_space); 372 } 373 374 // make room for insertion of j+1 shifted component 375 for (k=ie+1; k > j+1; k--) shind[k] = shind[k-1]; 376 377 if (same_comp) 378 { 379 // can simply add one 380 shind[j+1] = prev + 1; 381 assume(shind[j+1] + 1 < shind[j+2]); 382 } 383 else 384 { 385 // need to leave more breathing room - i.e. value goes in 386 // between 387 shind[j+1] = prev + ((next - prev) >> 1); 388 assume (shind[j] + 1 < shind[j+1] && shind[j+1] + 1 < shind[j+2]); 389 } 390 } 391 392 if (o_r[j]!=NULL) 393 { 394 for (k=ie;k>j;k--) 395 { 396 o_r[k] = o_r[k-1]; 397 } 398 } 399 o_r[j] = p; 400 for (k=0;k<IDELEMS((syzstr->res)[index]);k++) 401 { 402 if (trind[k]>j) 403 trind[k] += 1; 404 } 405 for (k=IDELEMS((syzstr->res)[index])-1;k>realcomp;k--) 406 trind[k] = trind[k-1]; 407 trind[realcomp] = j+1; 408 return ret; 283 static void syOrder_Hilb(poly p,syStrategy syzstr,int index) 284 { 285 int i=IDELEMS(syzstr->orderedRes[index]); 286 287 while ((i>0) && (syzstr->orderedRes[index]->m[i-1]==NULL)) i--; 288 syzstr->orderedRes[index]->m[i] = p; 409 289 } 410 290 … … 435 315 tso.syz = pHead(syz); 436 316 pSetComp(tso.syz,newEl+1); 317 pSetm(tso.syz); 437 318 tso.lcm = pHead(tso.syz); 438 319 tso.length = pLength(syz); 439 if (syOrder_Hilb(syz,syzstr,index,newEl+1)) 440 syResetShiftedComponents(syzstr, index+1,1); 441 rSetmS(tso.syz,syzstr->truecomponents[index],syzstr->ShiftedComponents[index]); 320 syOrder_Hilb(syz,syzstr,index); 442 321 #ifdef SHOW_PROT 443 322 Print("erzeuge Halbpaar im Module %d,%d mit: \n",index,tso.order); … … 742 621 Print("syz: ");pWrite(redset[j].syz); 743 622 #endif 744 currcomponents = syzstr->truecomponents[index];745 currShiftedComponents = syzstr->ShiftedComponents[index];746 rChangeSComps(currcomponents,747 currShiftedComponents,748 IDELEMS(syzstr->res[index]));749 623 sySPRedSyz(syzstr,redset[j],q); 750 currcomponents = syzstr->truecomponents[index-1];751 currShiftedComponents = syzstr->ShiftedComponents[index-1];752 rChangeSComps(currcomponents,753 currShiftedComponents,754 IDELEMS(syzstr->res[index-1]));755 624 number up = kBucketPolyRed(syzstr->bucket,redset[j].p, 756 625 redset[j].length, NULL); … … 771 640 } 772 641 kBucketClear(syzstr->bucket,&tso.p,&tso.length); 773 currcomponents = syzstr->truecomponents[index];774 currShiftedComponents = syzstr->ShiftedComponents[index];775 rChangeSComps(currcomponents,776 currShiftedComponents,777 IDELEMS(syzstr->res[index]));778 642 int il; 779 643 kBucketClear(syzstr->syz_bucket,&tso.syz,&il); 780 currcomponents = syzstr->truecomponents[index-1];781 currShiftedComponents = syzstr->ShiftedComponents[index-1];782 rChangeSComps(currcomponents,783 currShiftedComponents,784 IDELEMS(syzstr->res[index-1]));785 644 } 786 645 #ifdef SHOW_PROT … … 816 675 if (ks==IDELEMS(syzstr->res[index+1])) 817 676 syEnlargeFields(syzstr,index+1); 818 currcomponents = syzstr->truecomponents[index];819 currShiftedComponents = syzstr->ShiftedComponents[index];820 rChangeSComps(currcomponents,821 currShiftedComponents,822 IDELEMS(syzstr->res[index]));823 677 syzstr->res[index+1]->m[ks] = syRed_Hilb(tso.syz,syzstr,index+1); 824 currcomponents = syzstr->truecomponents[index-1];825 currShiftedComponents = syzstr->ShiftedComponents[index-1];826 rChangeSComps(currcomponents,827 currShiftedComponents,828 IDELEMS(syzstr->res[index-1]));829 678 if (syzstr->res[index+1]->m[ks]!=NULL) 830 679 { … … 1104 953 1105 954 // Creare dp,S ring and change to it 1106 syzstr->syRing = rCurrRingAssure_dp_ S();955 syzstr->syRing = rCurrRingAssure_dp_C(); 1107 956 assume(syzstr->syRing != origR); 1108 957 … … 1110 959 currcomponents = (int*)Alloc0((arg->rank+1)*sizeof(int)); 1111 960 currShiftedComponents = (long*)Alloc0((arg->rank+1)*sizeof(long)); 1112 for (i=0;i<=arg->rank;i++)1113 {1114 currShiftedComponents[i] = (i)*SYZ_SHIFT_BASE;1115 currcomponents[i] = i;1116 }1117 rChangeSComps(currcomponents, currShiftedComponents, arg->rank);1118 961 1119 962 /*--- initializes the data structures---------------*/ … … 1168 1011 else 1169 1012 i = syInitSyzMod(syzstr,index); 1170 currcomponents = syzstr->truecomponents[max(index-1,0)];1171 currShiftedComponents = syzstr->ShiftedComponents[max(index-1,0)];1172 rChangeSComps(currcomponents, currShiftedComponents,1173 IDELEMS(syzstr->res[max(index-1,0)]));1174 1013 j = syInitSyzMod(syzstr,index+1); 1175 1014 if (index>0)
Note: See TracChangeset
for help on using the changeset viewer.