| 3374 | } |
| 3375 | |
| 3376 | ideal id_Sat_principal(ideal I, ideal J, const ring origR) |
| 3377 | { |
| 3378 | rRingOrder_t *ord; |
| 3379 | int *block0,*block1; |
| 3380 | int **wv; |
| 3381 | |
| 3382 | // construction extension ring |
| 3383 | ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t)); |
| 3384 | block0=(int*)omAlloc0(4*sizeof(int)); |
| 3385 | block1=(int*)omAlloc0(4*sizeof(int)); |
| 3386 | wv=(int**) omAlloc0(4*sizeof(int**)); |
| 3387 | wv[0]=(int*)omAlloc0((rVar(origR) + 2)*sizeof(int)); |
| 3388 | block0[0] = block0[1] = 1; |
| 3389 | block1[0] = block1[1] = rVar(origR)+1; |
| 3390 | // use this special ordering: like ringorder_a, except that pFDeg, pWeights |
| 3391 | // ignore it |
| 3392 | ord[0] = ringorder_aa; |
| 3393 | wv[0][rVar(origR)]=1; |
| 3394 | BOOLEAN wp=FALSE; |
| 3395 | for (int j=0;j<rVar(origR);j++) |
| 3396 | if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; } |
| 3397 | if (wp) |
| 3398 | { |
| 3399 | wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int)); |
| 3400 | for (int j=0;j<rVar(origR);j++) |
| 3401 | wv[1][j]=p_Weight(j+1,origR); |
| 3402 | ord[1] = ringorder_wp; |
| 3403 | } |
| 3404 | else |
| 3405 | ord[1] = ringorder_dp; |
| 3406 | ord[2] = ringorder_C; |
| 3407 | ord[3] = (rRingOrder_t)0; |
| 3408 | char **names=(char**)omAlloc0((origR->N+1) * sizeof(char *)); |
| 3409 | for (int j=0;j<rVar(origR);j++) |
| 3410 | names[j]=origR->names[j]; |
| 3411 | names[rVar(origR)]=(char*)"@"; |
| 3412 | ring tmpR=rDefault(nCopyCoeff(origR->cf),rVar(origR)+1,names,4,ord,block0,block1,wv); |
| 3413 | omFree(names); |
| 3414 | rComplete(tmpR, 1); |
| 3415 | rChangeCurrRing(tmpR); |
| 3416 | // map I |
| 3417 | ideal II=idrCopyR(I,origR,tmpR); |
| 3418 | // map J |
| 3419 | ideal JJ=idrCopyR(J,origR,tmpR); |
| 3420 | // J[1]*t-1 |
| 3421 | poly t=pOne(); |
| 3422 | p_SetExp(t,rVar(tmpR),1,tmpR); |
| 3423 | p_Setm(t,tmpR); |
| 3424 | poly p=JJ->m[0]; |
| 3425 | p_Norm(p,currRing); |
| 3426 | p=p_Mult_q(p,t,tmpR); |
| 3427 | p=p_Sub(p,pOne(),tmpR); |
| 3428 | JJ->m[0]=p; |
| 3429 | ideal T=id_SimpleAdd(II,JJ,tmpR); |
| 3430 | idTest(T); |
| 3431 | id_Delete(&II,tmpR); |
| 3432 | id_Delete(&JJ,tmpR); |
| 3433 | // elimination |
no test coverage detected