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

Function elimOperationBucket

kernel/linear_algebra/MinorProcessor.cc:1324–1387  ·  view source on GitHub ↗

computes the polynomial (p1 * p2 - p3 * p4) / p5 and puts result into p1; the method destroys the old value of p1; p2, p3, p4, and p5 may be pNormalize-d but must, apart from that, not be changed; c5 is assumed to be the leading coefficient of p5; p5Len is assumed to be the length of p5; This can only be used in the case of coefficients coming from a field or at least an integ

Source from the content-addressed store, hash-verified

1322 This can only be used in the case of coefficients coming from a field
1323 or at least an integral domain. */
1324void elimOperationBucket(poly &p1, poly &p2, poly &p3, poly &p4, poly &p5,
1325 number &c5, int p5Len)
1326{
1327#ifdef COUNT_AND_PRINT_OPERATIONS
1328 if ((pLength(p1) != 0) && (pLength(p2) != 0))
1329 {
1330 multsPoly++;
1331 multsMon += pLength(p1) * pLength(p2);
1332 }
1333 if ((pLength(p3) != 0) && (pLength(p4) != 0))
1334 {
1335 multsPoly++;
1336 multsMon += pLength(p3) * pLength(p4);
1337 }
1338 if ((pLength(p1) != 0) && (pLength(p2) != 0) &&
1339 (pLength(p3) != 0) && (pLength(p4) != 0))
1340 addsPoly++;
1341#endif
1342 kBucket_pt myBucket = kBucketCreate(currRing);
1343 addOperationBucket(p1, p2, myBucket);
1344 poly p3Neg = pNeg(pCopy(p3));
1345 addOperationBucket(p3Neg, p4, myBucket);
1346 pDelete(&p3Neg);
1347
1348 /* Now, myBucket contains all terms of p1 * p2 - p3 * p4.
1349 Now we need to perform the polynomial division myBucket / p5
1350 which is known to work without remainder: */
1351 pDelete(&p1); poly helperPoly = NULL;
1352
1353 poly bucketLm = pCopy(kBucketGetLm(myBucket));
1354 while (bucketLm != NULL)
1355 {
1356 /* divide bucketLm by the leading term of p5 and put result into bucketLm;
1357 we start with the coefficients;
1358 note that bucketLm will always represent a term */
1359 number coeff = nDiv(pGetCoeff(bucketLm), c5);
1360 nNormalize(coeff);
1361 pSetCoeff(bucketLm, coeff);
1362 /* subtract exponent vector of p5 from that of quotient; modifies
1363 quotient */
1364 p_ExpVectorSub(bucketLm, p5, currRing);
1365#ifdef COUNT_AND_PRINT_OPERATIONS
1366 divsMon++;
1367 multsMonForDiv += p5Len;
1368 multsMon += p5Len;
1369 savedMultsMFD++;
1370 multsPoly++;
1371 multsPolyForDiv++;
1372 addsPoly++;
1373 addsPolyForDiv++;
1374#endif
1375 kBucket_Minus_m_Mult_p(myBucket, bucketLm, p5, &p5Len);
1376 /* The following lines make bucketLm the new leading term of p1,
1377 i.e., put bucketLm in front of everything which is already in p1.
1378 Thus, after the while loop, we need to revert p1. */
1379 helperPoly = bucketLm;
1380 helperPoly->next = p1;
1381 p1 = helperPoly;

Callers 1

Calls 8

pLengthFunction · 0.85
kBucketCreateFunction · 0.85
addOperationBucketFunction · 0.85
p_ExpVectorSubFunction · 0.85
kBucket_Minus_m_Mult_pFunction · 0.85
pReverseFunction · 0.85
kBucketDestroyFunction · 0.85
kBucketGetLmFunction · 0.50

Tested by

no test coverage detected