Changeset fd1101 in git
 Timestamp:
 Nov 21, 2013, 4:33:34 PM (9 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
 Children:
 2e10a09e739396e2397d3b2288761c701dce9d66
 Parents:
 e212bd68feb2c9b1d4a81fd65f7b8f304908a7b9
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/hilb.cc
re212bd rfd1101 228 228 //  ADICHANGES  229 229 //!!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!! 230 void PutInVector(int degvalue, int oldposition, int where)230 static void PutInVector(int degvalue, int oldposition, int where) 231 231 { 232 232 hilbertpowerssorted.resize(hilbertpowerssorted.size()+2); … … 240 240 } 241 241 242 void SortPowerVec()242 static void SortPowerVec() 243 243 { 244 244 int i,j; … … 256 256 PutInVector(hilbertpowers[i], i, 0); 257 257 } 258 if( hilbertpowers[i]>=hilbertpowerssorted[hilbertpowerssorted.size()2])258 if((hilbertpowers[i]>=hilbertpowerssorted[hilbertpowerssorted.size()2]) && (flag == TRUE)) 259 259 { 260 260 flag=FALSE; … … 281 281 } 282 282 283 int DegMon(poly p, ring tailRing)283 static int DegMon(poly p, ring tailRing) 284 284 { 285 285 int i,deg; 286 286 deg = 0; 287 for(i= 0;i<=tailRing>N;i++)287 for(i=1;i<=tailRing>N;i++) 288 288 { 289 289 deg = deg + p_GetExp(p, i, tailRing); … … 292 292 } 293 293 294 poly SearchP(ideal I, ring tailRing)294 static poly SearchP(ideal I, ring tailRing) 295 295 { 296 296 int i,j,exp; … … 302 302 res = p_ISet(1, tailRing); 303 303 res = p_Copy(I>m[i], tailRing); 304 for(j= 0;j<=tailRing>N;j++)304 for(j=1;j<=tailRing>N;j++) 305 305 { 306 306 exp = p_GetExp(I>m[i], j, tailRing); … … 316 316 } 317 317 318 poly ChoosePVar (ideal I, ring tailRing)318 static poly ChoosePVar (ideal I, ring tailRing) 319 319 { 320 320 bool flag=TRUE; … … 344 344 } 345 345 346 ideal idSimplify(ideal I, ring tailRing)346 static ideal idSimplify(ideal I, ring tailRing) 347 347 { 348 348 int i,j; 349 349 bool flag; 350 350 /*std::vector<int> var; 351 for(i= 0;i<=tailRing>N;i++)351 for(i=1;i<=tailRing>N;i++) 352 352 { 353 353 if(p_GetExp(I>[IDELEMS(I)1], tailRing)>0) … … 361 361 { 362 362 flag=TRUE; 363 for(j= 0;(j<=tailRing>N)&&(flag);j++)363 for(j=1;(j<=tailRing>N)&&(flag);j++) 364 364 { 365 365 if(p_GetExp(I>m[i], j, tailRing) < p_GetExp(I>m[IDELEMS(I)1], j, tailRing)) … … 378 378 379 379 380 void eulerchar (ideal I, ring tailRing)380 /*static void eulerchar (ideal I, ring tailRing) 381 381 { 382 382 //gmp_printf("\nEuler char: %Zd\n", ec); … … 385 385 { 386 386 mpz_init(dummy); 387 //change: era 1 in loc de 0388 387 mpz_set_si(dummy, 1); 389 388 mpz_sub(ec, ec, dummy); … … 394 393 if(!p_IsOne(I>m[0], tailRing)) 395 394 { 396 //aici nu era nimic397 //mpz_set_si(dummy, 1);398 //mpz_add(ec, ec, dummy);399 395 return; 400 396 } … … 421 417 ideal Iplusp = id_Add(I,p,tailRing); 422 418 Iplusp=idSimplify(Iplusp, tailRing); 423 //mpz_t i,j;424 //i = eulerchar(Ip, ec, tailRing);425 //j = eulerchar(Iplusp, ec, tailRing);426 //mpz_add(ec, i,j);427 419 eulerchar(Ip, tailRing); 428 420 eulerchar(Iplusp, tailRing); 429 421 return; 430 } 431 432 poly SqFree (ideal I, ring tailRing) 422 }*/ 423 424 static bool JustVar(ideal I, ring tailRing) 425 { 426 int i,j; 427 bool foundone; 428 for(i=0;i<=IDELEMS(I)1;i++) 429 { 430 foundone = FALSE; 431 for(j = 1;j<=tailRing>N;j++) 432 { 433 if(p_GetExp(I>m[i], j, tailRing)>0) 434 { 435 if(foundone == TRUE) 436 { 437 return(FALSE); 438 } 439 foundone = TRUE; 440 } 441 } 442 } 443 return(TRUE); 444 } 445 446 static void eulerchar (ideal I, ring tailRing, int variables) 447 { 448 //gmp_printf("\nEuler char: %Zd\n", ec); 449 mpz_t dummy; 450 if(JustVar(I, tailRing) == TRUE) 451 { 452 if(IDELEMS(I) == variables) 453 { 454 mpz_init(dummy); 455 if((variables % 2) == 0) 456 {mpz_set_si(dummy, 1);} 457 else 458 {mpz_set_si(dummy, 1);} 459 mpz_add(ec, ec, dummy); 460 } 461 return; 462 } 463 ideal p = idInit(1,1); 464 p>m[0] = SearchP(I, tailRing); 465 //idPrint(I); 466 //printf("\nSearchP founded: \n");pWrite(p>m[0]); 467 ideal Ip = idQuot(I,p,TRUE,TRUE); 468 ideal Iplusp = id_Add(I,p,tailRing); 469 Iplusp=idSimplify(Iplusp, tailRing); 470 int i,howmanyvarinp = 0; 471 for(i = 1;i<=tailRing>N;i++) 472 { 473 if(p_GetExp(p>m[0],i,tailRing)>0) 474 { 475 howmanyvarinp++; 476 } 477 } 478 eulerchar(Ip, tailRing, variableshowmanyvarinp); 479 eulerchar(Iplusp, tailRing, variables); 480 return; 481 } 482 483 static poly SqFree (ideal I, ring tailRing) 433 484 { 434 485 int i,j; … … 437 488 for(i=IDELEMS(I)1;(i>=0)&&(flag);i) 438 489 { 439 for(j= 0;(j<=tailRing>N)&&(flag);j++)490 for(j=1;(j<=tailRing>N)&&(flag);j++) 440 491 { 441 492 if(p_GetExp(I>m[i],j,tailRing)>1) … … 450 501 } 451 502 452 void rouneslice(ideal I, ideal S, poly q, ring tailRing, poly x)503 static void rouneslice(ideal I, ideal S, poly q, ring tailRing, poly x) 453 504 { 454 505 int i,j; … … 474 525 { 475 526 m = p_Copy(I>m[i],tailRing); 476 for(j= 0;j<=tailRing>N;j++)527 for(j=1;j<=tailRing>N;j++) 477 528 { 478 529 dummy = p_GetExp(m,j,tailRing); … … 507 558 } 508 559 m = p_ISet(1,tailRing); 509 for(i= 0;i<=tailRing>N;i++)560 for(i=1;i<=tailRing>N;i++) 510 561 { 511 562 dummy=0; … … 538 589 m = p_ISet(1,tailRing); 539 590 //m = p_Divide(x,I>m[i],tailRing); 540 for(j=tailRing>N; j>=0; j) 591 // THIS IS FOR THE OTHER IDEA FOR COMPUTING THE EULER CHARACTERISTIC!!!! INSTEAD 592 m = I>m[i]; 593 /*for(j=tailRing>N; j>=1; j) 541 594 { 542 595 p_SetExp(m,j, p_GetExp(x,j,tailRing) p_GetExp(I>m[i],j,tailRing),tailRing); 543 } 596 }*/ 597 544 598 printf(" "); 545 599 p_Setm(m, tailRing); … … 549 603 printf("\n Euler Characteristic = "); 550 604 mpz_init(dummympz); 551 eulerchar(koszsimp, tailRing );605 eulerchar(koszsimp, tailRing, tailRing>N); 552 606 //gmp_printf("dummy %Zd \n", dummympz); 553 607 gmp_printf("ec %Zd \n", ec); … … 583 637 } 584 638 585 void slicehilb(ideal I, ring tailRing)639 static void slicehilb(ideal I, ring tailRing) 586 640 { 587 641 printf("Adi changes are here: \n");
Note: See TracChangeset
for help on using the changeset viewer.