Changeset bc947c9 in git
- Timestamp:
- Apr 25, 2019, 7:55:05 PM (4 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 7ea5de9643c52c85381a5d31f1c56130fc656ff9
- Parents:
- 1a4a5cca1fc236a8841234e826efbd00bbc02b4c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/freealgebra/freealgebra.cc
r1a4a5cc rbc947c9 81 81 } 82 82 83 static BOOLEAN p_LPDivisibleBy(ideal I, poly p, ring r) 84 { 85 for(int i = 0; i < IDELEMS(I); i++) 86 { 87 if (p_LPDivisibleBy(I->m[i], p, r)) 88 { 89 return TRUE; 90 } 91 } 92 return FALSE; 93 } 94 83 95 static BOOLEAN lpLmDivides(leftv res, leftv h) 84 96 { … … 98 110 poly q=(poly)h->next->Data(); 99 111 res->rtyp = INT_CMD; 100 for(int i=0;i<IDELEMS(I);i++) 101 { 102 if (p_LPDivisibleBy(I->m[i],q, currRing)) 103 { 104 res->data=(void*)(long)1; 105 return FALSE; 106 } 107 } 108 res->data=(void*)(long)0; 112 res->data=(void*)(long) p_LPDivisibleBy(I, q, currRing); 109 113 return FALSE; 110 114 } … … 124 128 } 125 129 else return TRUE; 130 } 131 132 static void _computeStandardWords(ideal words, int n, ideal M, int& last) 133 { 134 if (n <= 0){ 135 words->m[0] = pOne(); 136 last = 0; 137 return; 138 } 139 140 _computeStandardWords(words, n - 1, M, last); 141 142 int nVars = currRing->isLPring; 143 144 for (int j = nVars - 1; j >= 0; j--) 145 { 146 for (int i = last; i >= 0; i--) 147 { 148 int index = (j * (last + 1)) + i; 149 150 if (words->m[i] != NULL) 151 { 152 if (j > 0) { 153 words->m[index] = pCopy(words->m[i]); 154 } 155 156 int varOffset = ((n - 1) * nVars) + 1; 157 pSetExp(words->m[index], varOffset + j, 1); 158 pSetm(words->m[index]); 159 pTest(words->m[index]); 160 161 if (p_LPDivisibleBy(M, words->m[index], currRing)) 162 { 163 pDelete(&words->m[index]); 164 words->m[index] = NULL; 165 } 166 } 167 } 168 } 169 170 last = nVars * last + nVars - 1; 171 } 172 173 static ideal computeStandardWords(int n, ideal M) 174 { 175 int nVars = currRing->isLPring; 176 177 int maxElems = 1; 178 for (int i = 0; i < n; i++) // maxElems = nVars^n 179 maxElems *= nVars; 180 ideal words = idInit(maxElems); 181 int last; 182 _computeStandardWords(words, n, M, last); 183 idSkipZeroes(words); 184 return words; 126 185 } 127 186 … … 140 199 int lV = currRing->isLPring; 141 200 142 ideal words = idMaxIdeal(l); 143 ideal standardWords = kNF(G, currRing->qideal, words); 144 idSkipZeroes(standardWords); 201 ideal standardWords = computeStandardWords(l, G); 145 202 146 203 int n = IDELEMS(standardWords); … … 278 335 279 336 // -1 is infinity, -2 is error 280 static int id_LPGkDim(const ideal _G)337 static int gkDim(const ideal _G) 281 338 { 282 339 if (rField_is_Ring(currRing)) { … … 338 395 ideal G = (ideal) h->Data(); 339 396 res->rtyp = INT_CMD; 340 res->data = (void*)(long) id_LPGkDim(G);397 res->data = (void*)(long) gkDim(G); 341 398 if (errorreported) return TRUE; 342 399 return FALSE; -
libpolys/polys/shiftop.cc
r1a4a5cc rbc947c9 718 718 BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r) 719 719 { 720 if(p_LmIsConstantComp(a, r))721 return TRUE;722 720 #ifdef SHIFT_MULT_COMPAT_MODE 723 721 a = p_Head(a, r); … … 726 724 p_mLPunshift(b, r); 727 725 #endif 728 int i = (r->N / r->isLPring) - p_LastVblock(a, r); 729 do { 730 int j = r->N - (i * r->isLPring); 726 for (int i = (r->N / r->isLPring) - p_LastVblock(a, r); i >= 0; i--) 727 { 731 728 bool divisible = true; 732 do729 for (int j = r->N - (i * r->isLPring); j >= 0; j--) 733 730 { 734 731 if (p_GetExp(a, j, r) > p_GetExp(b, j + (i * r->isLPring), r)) … … 737 734 break; 738 735 } 739 j--; 740 } 741 while (j); 736 } 742 737 if (divisible) return TRUE; 743 i--; 744 } 745 while (i > -1); 738 } 746 739 #ifdef SHIFT_MULT_COMPAT_MODE 747 740 p_Delete(&a, r);
Note: See TracChangeset
for help on using the changeset viewer.