MCPcopy Create free account
hub / github.com/Singular/Singular / idInitializeQuot

Function idInitializeQuot

kernel/ideals.cc:1401–1501  ·  view source on GitHub ↗

2 *computes the quotient of h1,h2 : internal routine for idQuot *BEWARE: the returned ideals may contain incorrectly ordered polys ! * */

Source from the content-addressed store, hash-verified

1399*
1400*/
1401static ideal idInitializeQuot (ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
1402{
1403 idTest(h1);
1404 idTest(h2);
1405
1406 ideal temph1;
1407 poly p,q = NULL;
1408 int i,l,ll,k,kkk,kmax;
1409 int j = 0;
1410 int k1 = id_RankFreeModule(h1,currRing);
1411 int k2 = id_RankFreeModule(h2,currRing);
1412 tHomog hom=isNotHomog;
1413 k=si_max(k1,k2);
1414 if (k==0)
1415 k = 1;
1416 if ((k2==0) && (k>1)) *addOnlyOne = FALSE;
1417 intvec * weights;
1418 hom = (tHomog)idHomModule(h1,currRing->qideal,&weights);
1419 if /**addOnlyOne &&*/ (/*(*/ !h1IsStb /*)*/)
1420 temph1 = kStd(h1,currRing->qideal,hom,&weights,NULL);
1421 else
1422 temph1 = idCopy(h1);
1423 if (weights!=NULL) delete weights;
1424 idTest(temph1);
1425/*--- making a single vector from h2 ---------------------*/
1426 for (i=0; i<IDELEMS(h2); i++)
1427 {
1428 if (h2->m[i] != NULL)
1429 {
1430 p = pCopy(h2->m[i]);
1431 if (k2 == 0)
1432 p_Shift(&p,j*k+1,currRing);
1433 else
1434 p_Shift(&p,j*k,currRing);
1435 q = pAdd(q,p);
1436 j++;
1437 }
1438 }
1439 *kkmax = kmax = j*k+1;
1440/*--- adding a monomial for the result (syzygy) ----------*/
1441 p = q;
1442 while (pNext(p)!=NULL) pIter(p);
1443 pNext(p) = pOne();
1444 pIter(p);
1445 pSetComp(p,kmax);
1446 pSetmComp(p);
1447/*--- constructing the big matrix ------------------------*/
1448 ideal h4 = idInit(k,kmax+k-1);
1449 h4->m[0] = q;
1450 if (k2 == 0)
1451 {
1452 for (i=1; i<k; i++)
1453 {
1454 if (h4->m[i-1]!=NULL)
1455 {
1456 p = p_Copy_noCheck(h4->m[i-1], currRing); /*h4->m[i-1]!=NULL*/
1457 p_Shift(&p,1,currRing);
1458 h4->m[i] = p;

Callers 1

idQuotFunction · 0.85

Calls 10

si_maxFunction · 0.85
idHomModuleFunction · 0.85
kStdFunction · 0.85
idCopyFunction · 0.85
p_ShiftFunction · 0.85
idInitFunction · 0.85
p_Copy_noCheckFunction · 0.85
idSkipZeroesFunction · 0.85
pEnlargeSetFunction · 0.85
id_RankFreeModuleFunction · 0.50

Tested by

no test coverage detected