Changeset a0e0258 in git
- Timestamp:
- Mar 16, 2016, 12:09:05 PM (8 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4bd32dfef92ec9f5ed8dceee82d14318ae147107')
- Children:
- 536e0345b0ecea04de0317c030a9643c6a8ed988
- Parents:
- 58399e5955b89ce4f0005174693ea0831df58d45
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/customstd/customstd.cc
r58399e ra0e0258 49 49 { 50 50 poly p=strat->P.p; 51 if (pNext(p)==NULL)52 {53 // if a term is contained in the ideal, abort std computation54 // and store the whole ring in idealCache to be returned55 while ((strat->Ll >= 0))56 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);57 idealCache = idInit(1);58 idealCache->m[0] = p_One(currRing);59 return FALSE;60 }61 51 62 52 // iterate over all terms of p and … … 65 55 int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int)); 66 56 p_GetExpV(p,mm,currRing); 67 bool nonTrivialSaturationToBeDone= false;57 bool nonTrivialSaturationToBeDone=true; 68 58 for (p=pNext(p); p!=NULL; pIter(p)) 69 59 { … … 83 73 // std::cout << "simplifying!" << std::endl; 84 74 p=p_Copy(strat->P.p,currRing); 75 memset(&strat->P,0,sizeof(strat->P)); 76 strat->P.tailRing = strat->tailRing; 85 77 strat->P.p=p; 86 78 while(p!=NULL) 87 79 { 88 for (int i= 1; i<satstdSaturatingVariables.size(); i++)80 for (int i=0; i<satstdSaturatingVariables.size(); i++) 89 81 { 90 82 int li = satstdSaturatingVariables[i]; … … 102 94 { 103 95 poly p=strat->P.t_p; 104 if (pNext(p)==NULL)105 {106 // if a term is contained in the ideal, abort std computation107 // and store the output in idealCache to be returned108 while ((strat->Ll >= 0))109 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);110 idealCache = idInit(1);111 idealCache->m[0] = p_One(currRing);112 return FALSE;113 }114 96 115 97 // iterate over all terms of p and … … 118 100 int *m0=(int*)omAlloc((1+rVar(currRing))*sizeof(int)); 119 101 p_GetExpV(p,mm,strat->tailRing); 120 bool nonTrivialSaturationToBeDone= false;102 bool nonTrivialSaturationToBeDone=true; 121 103 for (p = pNext(p); p!=NULL; pIter(p)) 122 104 { … … 135 117 { 136 118 p=p_Copy(strat->P.t_p,strat->tailRing); 119 memset(&strat->P,0,sizeof(strat->P)); 120 strat->P.tailRing = strat->tailRing; 137 121 strat->P.t_p=p; 138 strat->P.p=NULL;139 122 while(p!=NULL) 140 123 { 141 for(int i=1;i<=rVar(currRing);i++) 142 p_SubExp(p,i,mm[i],strat->tailRing); 124 for(int i=0; i<satstdSaturatingVariables.size(); i++) 125 { 126 int li = satstdSaturatingVariables[i]; 127 p_SubExp(p,li,mm[li],strat->tailRing); 128 } 143 129 p_Setm(p,strat->tailRing); 144 130 pIter(p); … … 174 160 175 161 // check that remaining variables have zero exponent 176 for ( i++; i<=rVar(r); i++)162 for (l=i+1; l<=rVar(r); l++) 177 163 { 178 if (p_GetExp(x, i,r)>0)164 if (p_GetExp(x,l,r)>0) 179 165 return 0; 180 166 } 181 167 182 return l; 183 } 184 185 //------------------------------------------------------------------------ 186 // routine that simplifies the ideal dividing each generator by the maximal monomial dividing it 187 // in particular returns 1 if a generator is a term 188 // to be used before starting saturation with respect to all variables 189 static void satSimplify(ideal I, const ring r) 190 { 191 idSkipZeroes(I); 192 int k = IDELEMS(I); 193 int *mm=(int*)omAlloc((1+rVar(r))*sizeof(int)); 194 int *m0=(int*)omAlloc((1+rVar(r))*sizeof(int)); 195 for (int i=0; i<k; i++) 196 { 197 poly p = I->m[i]; 198 if (p != NULL) 199 { 200 // check whether p is a term, return 1 if true 201 if (p->next == NULL) 202 { 203 p_Delete(&I->m[0],r); 204 I->m[0] = p_One(r); 205 for (int j=1; j<k; j++) 206 { 207 p_Delete(&I->m[j],r); 208 I->m[j] = NULL; 209 } 210 idSkipZeroes(I); 211 omFree(mm); 212 omFree(m0); 213 return; 214 } 215 216 // check whether p is divisible by a monomial 217 // divide if true 218 p_GetExpV(p,mm,r); 219 bool satNecessary=false; 220 for (; p!=NULL; pIter(p)) 221 { 222 satNecessary=false; 223 p_GetExpV(p,m0,r); 224 for(int i=1;i<=rVar(r);i++) 225 { 226 mm[i]=si_min(mm[i],m0[i]); 227 if (mm[i]>0) 228 satNecessary=true; 229 } 230 if (satNecessary==false) 231 break; 232 } 233 if (satNecessary==true) 234 { 235 for (p=I->m[i]; p!=NULL; pIter(p)) 236 { 237 for (int i=1; i<=rVar(r); i++) 238 p_SubExp(p,i,mm[i],r); 239 p_Setm(p,r); 240 } 241 } 242 } 243 } 244 omFree(mm); 245 omFree(m0); 168 return i; 246 169 } 247 170 … … 289 212 290 213 ideal I = (ideal) u->Data(); 291 satSimplify(I,currRing);292 214 293 215 idealCache = NULL;
Note: See TracChangeset
for help on using the changeset viewer.