- Timestamp:
- Oct 23, 2018, 12:28:23 AM (6 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
- Children:
- c1a0fc472e1b2a3117380bb8870a7b353858901c
- Parents:
- bf2a471a7ccc420f3cf5a55dd1454967b35fd623
- Location:
- libpolys/polys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/polys0.cc
rbf2a471 r4ab28ee 14 14 #include "polys/monomials/ring.h" 15 15 #include "polys/monomials/p_polys.h" 16 #ifdef HAVE_SHIFTBBA 17 #include "polys/shiftop.h" 18 #endif 16 19 17 20 /*2 … … 24 27 const coeffs C = r->cf; 25 28 assume(C != NULL); 29 30 #ifdef HAVE_SHIFTBBA 31 if (r->isLPring) 32 { 33 if (!p_mIsInV(p, r)) 34 { 35 /* 36 * the monomial is not a valid letterplace monomial 37 * without this warning one cannot distinguish between 38 * x(1)*x(3) and x(1)*x(2) because they would both be displayed 39 * as x*x 40 */ 41 int *expV = (int *) omAlloc((r->N+1)*sizeof(int)); 42 p_GetExpV(p, expV, r); 43 char* s = LPExpVString(expV, r); 44 Warn("invalid letterplace monomial: (%s)", s); 45 omFreeSize((ADDRESS) expV, (r->N+1)*sizeof(int)); 46 omFree(s); 47 } 48 } 49 #endif 26 50 27 51 BOOLEAN wroteCoef=FALSE,writeGen=FALSE; -
libpolys/polys/shiftop.cc
rbf2a471 r4ab28ee 5 5 #include "templates/p_MemCopy.h" 6 6 #include "monomials/p_polys.h" 7 #include "polys/simpleideals.h" 7 8 8 9 /* #define SHIFT_MULT_DEBUG */ … … 551 552 void WriteLPExpV(int *expV, ring ri) 552 553 { 554 char *s = LPExpVString(expV, ri); 555 PrintS(s); 556 omFree(s); 557 } 558 559 char* LPExpVString(int *expV, ring ri) 560 { 561 StringSetS(""); 553 562 for (int i = 0; i <= ri->N; ++i) 554 563 { 555 Print("%d", expV[i]);564 StringAppend("%d", expV[i]); 556 565 if (i == 0) 557 566 { 558 Print("| ");567 StringAppendS("| "); 559 568 } 560 569 if (i % ri->isLPring == 0) 561 570 { 562 Print(" "); 563 } 564 } 565 } 566 567 #endif 571 StringAppendS(" "); 572 } 573 } 574 return StringEndS(); 575 } 576 577 /* tests whether each polynomial of an ideal I lies in in V */ 578 int id_IsInV(ideal I, const ring r) 579 { 580 int i; 581 int s = IDELEMS(I)-1; 582 for(i = 0; i <= s; i++) 583 { 584 if ( !p_IsInV(I->m[i], r) ) 585 { 586 return(0); 587 } 588 } 589 return(1); 590 } 591 592 /* tests whether the whole polynomial p in in V */ 593 int p_IsInV(poly p, const ring r) 594 { 595 poly q = p; 596 while (q!=NULL) 597 { 598 if ( !p_mIsInV(q, r) ) 599 { 600 return(0); 601 } 602 q = pNext(q); 603 } 604 return(1); 605 } 606 607 /* there should be two routines: */ 608 /* 1. test place-squarefreeness: in homog this suffices: isInV */ 609 /* 2. test the presence of a hole -> in the tail??? */ 610 611 int p_mIsInV(poly p, const ring r) 612 { 613 int lV = r->isLPring; 614 /* investigate only the leading monomial of p in currRing */ 615 if ( p_Totaldegree(p, r)==0 ) return(1); 616 /* returns 1 iff p is in V */ 617 /* that is in each block up to a certain one there is only one nonzero exponent */ 618 /* lV = the length of V = the number of orig vars */ 619 int *e = (int *)omAlloc0((r->N+1)*sizeof(int)); 620 int b = (int)((r->N+lV-1)/lV); /* the number of blocks */ 621 //int b = (int)(currRing->N)/lV; 622 int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */ 623 p_GetExpV(p,e,r); 624 int i,j; 625 for (j=1; j<=b; j++) 626 { 627 /* we go through all the vars */ 628 /* by blocks in lV vars */ 629 for (i=(j-1)*lV + 1; i<= j*lV; i++) 630 { 631 if (e[i]) B[j] = B[j]+1; 632 } 633 } 634 // j = b; 635 // while ( (!B[j]) && (j>=1)) j--; 636 for (j=b; j>=1; j--) 637 { 638 if (B[j]!=0) break; 639 } 640 /* do not need e anymore */ 641 omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int)); 642 643 if (j==0) goto ret_true; 644 // { 645 // /* it is a zero exp vector, which is in V */ 646 // freeT(B, b); 647 // return(1); 648 // } 649 /* now B[j] != 0 and we test place-squarefreeness */ 650 for (; j>=1; j--) 651 { 652 if (B[j]!=1) 653 { 654 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 655 return(0); 656 } 657 } 658 ret_true: 659 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 660 return(1); 661 } 662 663 #endif -
libpolys/polys/shiftop.h
rbf2a471 r4ab28ee 39 39 40 40 void WriteLPExpV(int *expV, ring ri); 41 char* LPExpVString(int *expV, ring ri); 42 43 int id_IsInV(ideal I, const ring r); 44 int p_IsInV(poly p, const ring r); 45 int p_mIsInV(poly p, const ring r); 46 #define idIsInV(I) id_IsInV(I, currRing) 47 #define pIsInV(p) p_IsInV(p, currRing) 48 #define pmIsInV(p) p_mIsInV(p, currRing) 41 49 42 50 #endif
Note: See TracChangeset
for help on using the changeset viewer.