Changeset dc0f002 in git
- Timestamp:
- Jun 1, 2018, 8:40:44 PM (6 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- 6762a65369cd0f5360fcace6708a983889b21d71
- Parents:
- f5850b632ea8ec8eaa23aca3fefbf32685cac3be
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/GBEngine/kInline.h
rf5850b rdc0f002 26 26 #include "kernel/polys.h" 27 27 28 #include "kernel/GBEngine/shiftgb.h" 28 29 29 30 #define HAVE_TAIL_BIN … … 591 592 // tailRing->p_Procs->p_Minus_mm_Mult_qq(pNext(_p), m, q, shorter,spNoether, tailRing, last); 592 593 // pLength += lq - shorter; 593 }594 }595 596 KINLINE void sLObject::Tail_Minus_mm1_Mult_qq_Mult_mm2(poly m1, poly q, poly m2, int lq, poly spNoether)597 {598 if (bucket != NULL)599 {600 kBucket_Minus_m1_Mult_p_Mult_m2(bucket, m1, q, m2, &lq, NULL); // check if we need noether601 }602 else603 {604 if (lq<=0) lq= ::pLength(q);605 poly _p = (t_p != NULL ? t_p : p);606 assume(_p != NULL);607 608 int lp=pLength-1;609 pNext(_p) = p_Minus_mm_Mult_qq( pNext(_p), m1, p_Mult_mm(q, m2, tailRing), lp, lq,610 spNoether, tailRing );611 pLength=lp+1;612 return;613 594 } 614 595 } -
kernel/GBEngine/kspoly.cc
rf5850b rdc0f002 20 20 #include "kernel/polys.h" 21 21 #endif 22 #include "kernel/GBEngine/shiftgb.h" 22 23 23 24 #ifdef KDEBUG … … 123 124 } 124 125 125 int holeStart = tailRing->isLPring * p_mFirstVblock(p2, tailRing->isLPring, tailRing);126 // n1 and n2 is already set to 1127 poly n1 = p_GetExp_k_n(lm, holeStart, tailRing->N, tailRing);128 poly n2 = p_GetExp_k_n(lm, 1, holeStart, tailRing);126 poly lmRight; 127 if (tailRing->isLPring) { 128 k_SplitFrame(p2, lm, lmRight, tailRing); 129 } 129 130 130 131 // take care of coef buisness … … 135 136 int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC 136 137 p_SetCoeff(lm, bn, tailRing); 137 p_SetCoeff(n1, bn, tailRing);138 138 if ((ct == 0) || (ct == 2)) 139 139 PR->Tail_Mult_nn(an); … … 143 143 else 144 144 { 145 p_SetCoeff(n1, pGetCoeff(lm), tailRing);146 145 if (coef != NULL) *coef = n_Init(1, tailRing->cf); 147 146 } 147 148 148 149 149 // and finally, 150 150 if (tailRing->isLPring) { 151 PR->Tail_Minus_mm 1_Mult_qq_Mult_mm2(n1, t2, n2, pLength(t2), spNoether);151 PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether); 152 152 } else { 153 153 PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether); … … 265 265 } 266 266 267 poly lmRight; 268 if (tailRing->isLPring) { 269 k_SplitFrame(p2, lm, lmRight, tailRing); 270 } 271 267 272 // take care of coef buisness 268 273 if (! n_IsOne(pGetCoeff(p2), tailRing)) … … 284 289 285 290 // and finally, 286 PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether); 291 if (tailRing->isLPring) { 292 PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether); 293 } else { 294 PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether); 295 } 287 296 assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p)); 288 297 PR->LmDeleteAndIter(); … … 471 480 } 472 481 482 poly lmRight; 483 if (tailRing->isLPring) { 484 k_SplitFrame(p2, lm, lmRight, tailRing); 485 } 486 473 487 // take care of coef buisness 474 488 if (! n_IsOne(pGetCoeff(p2), tailRing->cf)) … … 490 504 491 505 // and finally, 492 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether); 506 if (tailRing->isLPring) { 507 PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether); 508 } else { 509 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether); 510 } 493 511 assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p)); 494 512 PR->LmDeleteAndIter(); … … 709 727 } 710 728 } 729 730 poly lmRight; 731 if (tailRing->isLPring) { 732 k_SplitFrame(p2, lm, lmRight, tailRing); 733 } 734 711 735 // take care of coef buisness 712 736 if(rField_is_Ring(currRing)) … … 735 759 736 760 // and finally, 737 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether); 761 if (tailRing->isLPring) { 762 PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether); 763 } else { 764 PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether); 765 } 738 766 assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p)); 739 767 PR->LmDeleteAndIter(); … … 812 840 k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing); 813 841 842 poly m12, m22; 843 if (tailRing->isLPring) 844 { 845 k_SplitFrame(p1, m1, m12, tailRing); 846 k_SplitFrame(p1, m2, m22, tailRing); 847 // manually free the coeffs, because pSetCoeff0 is used in the next step 848 n_Delete(&(m1->coef), tailRing->cf); 849 n_Delete(&(m2->coef), tailRing->cf); 850 } 851 814 852 pSetCoeff0(m1, lc2); 815 853 pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2) … … 843 881 } 844 882 else 845 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing); 883 if (tailRing->isLPring) { 884 // m2*a2*m22 885 a2 = tailRing->p_Procs->pp_Mult_mm(tailRing->p_Procs->pp_mm_Mult(a2, m2, tailRing), m22, tailRing); 886 } else { 887 a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing); 888 } 846 889 #ifdef HAVE_RINGS 847 890 if (!(rField_is_Domain(currRing))) l2 = pLength(a2); … … 850 893 Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing); 851 894 852 // get m2*a2 - m1*a1 853 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether); 895 if (tailRing->isLPring) { 896 // get m2*a2*m22 - m1*a1*m12 897 Pair->Tail_Minus_mm_Mult_qq(m1, tailRing->p_Procs->p_Mult_mm(a1, m12, tailRing), l1, spNoether); 898 } else { 899 // get m2*a2 - m1*a1 900 Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether); 901 } 854 902 855 903 // Clean-up time 856 904 Pair->LmDeleteAndIter(); 857 905 p_LmDelete(m1, tailRing); 906 if (tailRing->isLPring) { 907 p_LmDelete(m12, tailRing); 908 p_LmDelete(m22, tailRing); 909 } 858 910 859 911 if (co != 0) -
kernel/GBEngine/kutil.h
rf5850b rdc0f002 212 212 int use_bucket, ring r); 213 213 KINLINE void Tail_Minus_mm_Mult_qq(poly m, poly qq, int lq, poly spNoether); 214 KINLINE void Tail_Minus_mm1_Mult_qq_Mult_mm2(poly m1, poly qq, poly m2, int lq, poly spNoether);215 214 KINLINE void Tail_Mult_nn(number n); 216 215 // deletes bucket, makes sure that p and t_p exists -
kernel/GBEngine/shiftgb.cc
rf5850b rdc0f002 98 98 /* p is a monomial from the ring r */ 99 99 100 if (sh == 0 || p == NULL ) return(p); /* the zero shift */100 if (sh == 0 || p == NULL || p_LmIsConstant(p,r)) return(p); 101 101 102 102 int L = p_mLastVblock(p,lV,r); 103 103 assume(L+sh>=1); 104 104 assume(L+sh<=uptodeg); 105 if (!(L+sh<=uptodeg)){ 106 int i = 5; 107 } 105 108 106 109 int *e=(int *)omAlloc0((r->N+1)*sizeof(int)); … … 465 468 466 469 #endif 470 471 // splits a frame (e.g. x(1)*y(5)) m1 into m1 and m2 (e.g. m1=x(1) and m2=y(1)) according to p 472 void k_SplitFrame(const poly p, poly &m1, poly &m2, const ring r) { 473 int lV = r->isLPring; 474 int uptodeg = r->N/lV; 475 476 number m1Coeff = pGetCoeff(m1); 477 478 int hole = lV * p_mFirstVblock(p, lV, r); 479 m2 = p_GetExp_k_n(m1, 1, hole, r); 480 m1 = p_GetExp_k_n(m1, hole, r->N, r); 481 482 p_LPshift(m2, 1 - p_mFirstVblock(m2, lV, r), uptodeg, lV, r); 483 p_SetCoeff(m1, m1Coeff, r); 484 } -
kernel/GBEngine/shiftgb.h
rf5850b rdc0f002 46 46 int itoInsert(poly p, int uptodeg, int lV, const ring r); 47 47 48 void k_SplitFrame(const poly p, poly &m1, poly &m2, const ring r); 48 49 #endif 49 50 #endif -
libpolys/polys/kbuckets.cc
rf5850b rdc0f002 724 724 { 725 725 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); 726 p1= pp_Mult_mm(p,m,r);726 p1=r->p_Procs->pp_mm_Mult(p,m,r); 727 727 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); 728 728 l1=pLength(p1); … … 766 766 else 767 767 { 768 p1 = r->p_Procs->pp_ Mult_mm(p1, m, r);768 p1 = r->p_Procs->pp_mm_Mult(p1, m, r); 769 769 } 770 770 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); … … 791 791 #else // HAVE_PSEUDO_BUCKETS 792 792 bucket->p = p_Minus_mm_Mult_qq(bucket->p, m, p, 793 bucket->l, l1,794 spNoether, r);795 #endif796 }797 798 //////////////////////////////////////////////////////////////////////////799 ///800 /// Bpoly == Bpoly - m1*p*m2; where m1 and m2 are monoms801 /// Does not destroy p, m1 and m2802 /// assume (*l <= 0 || pLength(p) == *l)803 void kBucket_Minus_m1_Mult_p_Mult_m2(kBucket_pt bucket, poly m1, poly p, poly m2, int *l, poly spNoether)804 {805 assume(*l <= 0 || pLength(p) == *l);806 int i, l1;807 poly p1 = p;808 ring r = bucket->bucket_ring;809 810 if (*l <= 0)811 {812 l1 = pLength(p1);813 *l = l1;814 }815 else816 l1 = *l;817 818 if (m1 == NULL || m2 == NULL || p == NULL) return;819 820 #ifndef HAVE_PSEUDO_BUCKETS821 kBucketMergeLm(bucket);822 kbTest(bucket);823 i = pLogLength(l1);824 825 #if defined(HAVE_PLURAL)826 if ((rField_is_Ring(r) && !(rField_is_Domain(r)))827 ||(rIsPluralRing(r)))828 {829 pSetCoeff0(m1, n_InpNeg(pGetCoeff(m1),r->cf));830 p1=pp_Mult_mm(r->p_Procs->pp_mm_Mult(p, m1, r),m2,r);831 pSetCoeff0(m1, n_InpNeg(pGetCoeff(m1),r->cf));832 l1=pLength(p1);833 i = pLogLength(l1);834 }835 else836 #endif837 {838 if ((i <= bucket->buckets_used) && (bucket->buckets[i] != NULL))839 {840 assume(pLength(bucket->buckets[i])==(unsigned)bucket->buckets_length[i]);841 //#ifdef USE_COEF_BUCKETS842 // if(bucket->coef[i]!=NULL)843 // {844 // poly mult=p_Mult_mm(bucket->coef[i],m,r);845 // bucket->coef[i]=NULL;846 // p1 = p_Minus_mm_Mult_qq(bucket->buckets[i], mult, p1,847 // bucket->buckets_length[i], l1,848 // spNoether, r);849 // }850 // else851 //#endif852 MULTIPLY_BUCKET(bucket,i);853 p1 = p_Minus_mm_Mult_qq(bucket->buckets[i], m1, p_Mult_mm(p1, m2, r),854 bucket->buckets_length[i], l1,855 spNoether, r);856 l1 = bucket->buckets_length[i];857 bucket->buckets[i] = NULL;858 bucket->buckets_length[i] = 0;859 i = pLogLength(l1);860 }861 else862 {863 pSetCoeff0(m1, n_InpNeg(pGetCoeff(m1),r->cf));864 if (spNoether != NULL)865 {866 l1 = -1;867 p1 = r->p_Procs->pp_Mult_mm_Noether(r->p_Procs->pp_mm_Mult(p1, m1, r), m2, spNoether, l1, r);868 i = pLogLength(l1);869 }870 else871 {872 p1 = r->p_Procs->pp_Mult_mm(r->p_Procs->pp_mm_Mult(p1, m1, r), m2, r);873 }874 pSetCoeff0(m1, n_InpNeg(pGetCoeff(m1),r->cf));875 }876 }877 878 while (bucket->buckets[i] != NULL)879 {880 //kbTest(bucket);881 MULTIPLY_BUCKET(bucket,i);882 p1 = p_Add_q(p1, bucket->buckets[i],883 l1, bucket->buckets_length[i], r);884 bucket->buckets[i] = NULL;885 bucket->buckets_length[i] = 0;886 i = pLogLength(l1);887 }888 889 bucket->buckets[i] = p1;890 bucket->buckets_length[i]=l1;891 if (i >= bucket->buckets_used)892 bucket->buckets_used = i;893 else894 kBucketAdjustBucketsUsed(bucket);895 #else // HAVE_PSEUDO_BUCKETS896 bucket->p = p_Minus_mm_Mult_qq(bucket->p, m1, p_Mult_mm(p, m2, r),897 793 bucket->l, l1, 898 794 spNoether, r); -
libpolys/polys/kbuckets.h
rf5850b rdc0f002 134 134 ////////////////////////////////////////////////////////////////////////// 135 135 /// 136 /// Bpoly == Bpoly - m1*p*m2; where m1 and m2 are monoms137 /// Does not destroy p, m1 and m2 (TODO: rename into kBucket_Minus_mm1_Mult_pp_Mult_mm2!?)138 /// assume (*l <= 0 || pLength(p) == *l)139 void kBucket_Minus_m1_Mult_p_Mult_m2(kBucket_pt bucket, poly m1, poly p, poly m2, int *l, poly spNother = NULL);140 141 //////////////////////////////////////////////////////////////////////////142 ///143 136 /// Bpoly == Bpoly + m*p; where m is a monom 144 137 /// Does not destroy p and m -
libpolys/polys/shiftop.cc
rf5850b rdc0f002 1 1 #include "shiftop.h" 2 2 3 #define SHIFT_MULT_DEBUG 3 /* #define SHIFT_MULT_DEBUG */ 4 #define SHIFT_MULT_WARNINGS 4 5 5 6 #ifdef SHIFT_MULT_DEBUG … … 14 15 15 16 int lV = ri->isLPring; 16 if (p_mFirstVblock(m,lV,ri) < p_mFirstVblock(p,lV,ri)) {17 // TODO remove this18 PrintS("WARNING: auto switch to shift_pp_mm_Mult");19 return shift_pp_mm_Mult(p, m, ri);20 }21 17 22 18 // we just shift m and then call the commutative multiplication … … 24 20 int pshift = p_LastVblock(p, lV, ri); 25 21 int mshift = p_mFirstVblock(m, lV, ri) - 1; 26 #ifdef SHIFT_MULT_DEBUG 22 #ifdef SHIFT_MULT_WARNINGS 23 // only needed because our examples still use x(1)*y(2) etc on the interface level 27 24 if (mshift > 0) { 28 25 PrintLn(); … … 53 50 54 51 int lV = ri->isLPring; 55 if (p_mFirstVblock(m,lV,ri) < p_mFirstVblock(p,lV,ri)) {56 // TODO remove this57 Print("WARNING: auto switch to shift_p_mm_Mult");58 return shift_p_mm_Mult(p, m, ri);59 }60 52 61 53 // we just shift m and then call the commutative multiplication … … 63 55 int pshift = p_LastVblock(p, lV, ri); 64 56 int mshift = p_mFirstVblock(m, lV, ri) - 1; 65 #ifdef SHIFT_MULT_DEBUG 57 #ifdef SHIFT_MULT_WARNINGS 58 // only needed because our examples still use x(1)*y(2) etc on the interface level 66 59 if (mshift > 0) { 67 60 PrintLn(); Print("WARNING: m is already shifted"); PrintLn(); … … 90 83 91 84 int lV = ri->isLPring; 92 if (p_mFirstVblock(p,lV,ri) < p_mFirstVblock(m,lV,ri)) {93 // TODO remove this94 PrintS("WARNING: auto switch to shift_pp_Mult_mm");95 return shift_pp_Mult_mm(p, m, ri);96 }97 85 98 86 // we just shift m and then call the commutative multiplication … … 100 88 int mshift = p_mLastVblock(m, lV, ri); 101 89 int pshift = p_FirstVblock(p, lV, ri) - 1; 102 #ifdef SHIFT_MULT_DEBUG 90 #ifdef SHIFT_MULT_WARNINGS 91 // only needed because our examples still use x(1)*y(2) etc on the interface level 103 92 if (pshift > 0) { 104 93 PrintLn(); PrintS("WARNING: p is already shifted"); PrintLn(); … … 128 117 129 118 int lV = ri->isLPring; 130 if (p_mFirstVblock(p,lV,ri) < p_mFirstVblock(m,lV,ri)) {131 // TODO remove this132 Print("WARNING: auto switch to shift_p_Mult_mm");133 return shift_p_Mult_mm(p, m, ri);134 }135 119 136 120 // we just shift m and then call the commutative multiplication … … 138 122 int mshift = p_mLastVblock(m, lV, ri); 139 123 int pshift = p_FirstVblock(p, lV, ri) - 1; 140 #ifdef SHIFT_MULT_DEBUG 124 #ifdef SHIFT_MULT_WARNINGS 125 // only needed because our examples still use x(1)*y(2) etc on the interface level 141 126 if (pshift > 0) { 142 127 PrintLn(); PrintS("WARNING: p is already shifted"); PrintLn();
Note: See TracChangeset
for help on using the changeset viewer.