| 2227 | |
| 2228 | #ifdef HAVE_SHIFTBBA |
| 2229 | ideal idModuloLP (ideal h2,ideal h1, tHomog, intvec ** w, matrix *T, GbVariant alg) |
| 2230 | { |
| 2231 | intvec *wtmp=NULL; |
| 2232 | if (T!=NULL) idDelete((ideal*)T); |
| 2233 | |
| 2234 | int i,k,rk,flength=0,slength,length; |
| 2235 | poly p,q; |
| 2236 | |
| 2237 | if (idIs0(h2)) |
| 2238 | return idFreeModule(si_max(1,h2->ncols)); |
| 2239 | if (!idIs0(h1)) |
| 2240 | flength = id_RankFreeModule(h1,currRing); |
| 2241 | slength = id_RankFreeModule(h2,currRing); |
| 2242 | length = si_max(flength,slength); |
| 2243 | if (length==0) |
| 2244 | { |
| 2245 | length = 1; |
| 2246 | } |
| 2247 | ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2)); |
| 2248 | if ((w!=NULL)&&((*w)!=NULL)) |
| 2249 | { |
| 2250 | //Print("input weights:");(*w)->show(1);PrintLn(); |
| 2251 | int d; |
| 2252 | int k; |
| 2253 | wtmp=new intvec(length+IDELEMS(h2)); |
| 2254 | for (i=0;i<length;i++) |
| 2255 | ((*wtmp)[i])=(**w)[i]; |
| 2256 | for (i=0;i<IDELEMS(h2);i++) |
| 2257 | { |
| 2258 | poly p=h2->m[i]; |
| 2259 | if (p!=NULL) |
| 2260 | { |
| 2261 | d = p_Deg(p,currRing); |
| 2262 | k= pGetComp(p); |
| 2263 | if (slength>0) k--; |
| 2264 | d +=((**w)[k]); |
| 2265 | ((*wtmp)[i+length]) = d; |
| 2266 | } |
| 2267 | } |
| 2268 | //Print("weights:");wtmp->show(1);PrintLn(); |
| 2269 | } |
| 2270 | for (i=0;i<IDELEMS(h2);i++) |
| 2271 | { |
| 2272 | temp->m[i] = pCopy(h2->m[i]); |
| 2273 | q = pOne(); |
| 2274 | // non multiplicative variable |
| 2275 | pSetExp(q, currRing->isLPring - currRing->LPncGenCount + i + 1, 1); |
| 2276 | p_Setm(q, currRing); |
| 2277 | pSetComp(q,i+1+length); |
| 2278 | pSetmComp(q); |
| 2279 | if(temp->m[i]!=NULL) |
| 2280 | { |
| 2281 | if (slength==0) p_Shift(&(temp->m[i]),1,currRing); |
| 2282 | p = temp->m[i]; |
| 2283 | temp->m[i] = pAdd(p, q); |
| 2284 | } |
| 2285 | else |
| 2286 | temp->m[i]=q; |
no test coverage detected