My Project
Loading...
Searching...
No Matches
Functions
MinorProcessor.cc File Reference
#include "kernel/mod2.h"
#include "kernel/linear_algebra/MinorProcessor.h"
#include "polys/kbuckets.h"
#include "kernel/structs.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/ideals.h"

Go to the source code of this file.

Functions

int getReduction (const int i, const ideal &iSB)
 
static void addOperationBucket (poly f1, poly f2, kBucket_pt bucket)
 
static void elimOperationBucketNoDiv (poly &p1, poly p2, poly p3, poly p4)
 
void elimOperationBucket (poly &p1, poly &p2, poly &p3, poly &p4, poly &p5, number &c5, int p5Len)
 

Function Documentation

◆ addOperationBucket()

static void addOperationBucket ( poly  f1,
poly  f2,
kBucket_pt  bucket 
)
static

Definition at line 1264 of file MinorProcessor.cc.

1265{
1266 /* fills all terms of f1 * f2 into the bucket */
1267 poly a = f1; poly b = f2;
1268 int aLen = pLength(a); int bLen = pLength(b);
1269 if (aLen > bLen)
1270 {
1271 b = f1; a = f2; bLen = aLen;
1272 }
1273 pNormalize(b);
1274
1275 while (a != NULL)
1276 {
1277 /* The next line actually uses only LT(a): */
1278 kBucket_Plus_mm_Mult_pp(bucket, a, b, bLen);
1279 a = pNext(a);
1280 }
1281}
CanonicalForm b
Definition: cfModGcd.cc:4103
void kBucket_Plus_mm_Mult_pp(kBucket_pt bucket, poly m, poly p, int l)
Bpoly == Bpoly + m*p; where m is a monom Does not destroy p and m assume (l <= 0 || pLength(p) == l)
Definition: kbuckets.cc:815
#define pNext(p)
Definition: monomials.h:36
#define NULL
Definition: omList.c:12
static int pLength(poly a)
Definition: p_polys.h:188
#define pNormalize(p)
Definition: polys.h:317

◆ elimOperationBucket()

void elimOperationBucket ( poly &  p1,
poly &  p2,
poly &  p3,
poly &  p4,
poly &  p5,
number &  c5,
int  p5Len 
)

Definition at line 1324 of file MinorProcessor.cc.

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;
1382
1383 bucketLm = pCopy(kBucketGetLm(myBucket));
1384 }
1385 p1 = pReverse(p1);
1386 kBucketDestroy(&myBucket);
1387}
static void addOperationBucket(poly f1, poly f2, kBucket_pt bucket)
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
Definition: kbuckets.cc:722
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:216
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:209
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:506
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define nDiv(a, b)
Definition: numbers.h:32
#define nNormalize(n)
Definition: numbers.h:30
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition: p_polys.h:1438
static poly pReverse(poly p)
Definition: p_polys.h:333
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pDelete(p_ptr)
Definition: polys.h:186
#define pNeg(p)
Definition: polys.h:198
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ elimOperationBucketNoDiv()

static void elimOperationBucketNoDiv ( poly &  p1,
poly  p2,
poly  p3,
poly  p4 
)
static

Definition at line 1289 of file MinorProcessor.cc.

1290{
1291#ifdef COUNT_AND_PRINT_OPERATIONS
1292 if ((pLength(p1) != 0) && (pLength(p2) != 0))
1293 {
1294 multsPoly++;
1295 multsMon += pLength(p1) * pLength(p2);
1296 }
1297 if ((pLength(p3) != 0) && (pLength(p4) != 0))
1298 {
1299 multsPoly++;
1300 multsMon += pLength(p3) * pLength(p4);
1301 }
1302 if ((pLength(p1) != 0) && (pLength(p2) != 0) &&
1303 (pLength(p3) != 0) && (pLength(p4) != 0))
1304 addsPoly++;
1305#endif
1306 kBucket_pt myBucket = kBucketCreate(currRing);
1307 addOperationBucket(p1, p2, myBucket);
1308 poly p3Neg = pNeg(pCopy(p3));
1309 addOperationBucket(p3Neg, p4, myBucket);
1310 pDelete(&p3Neg);
1311 pDelete(&p1);
1312 p1 = kBucketClear(myBucket);
1313 kBucketDestroy(&myBucket);
1314}
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:521

◆ getReduction()

int getReduction ( const int  i,
const ideal &  iSB 
)

Definition at line 437 of file MinorProcessor.cc.

438{
439 if (i == 0) return 0;
440 poly f = pISet(i);
441 poly g = kNF(iSB, currRing->qideal, f);
442 int result = 0;
443 if (g != NULL) result = n_Int(pGetCoeff(g), currRing->cf);
444 pDelete(&f);
445 pDelete(&g);
446 return result;
447}
int i
Definition: cfEzgcd.cc:132
g
Definition: cfModGcd.cc:4090
FILE * f
Definition: checklibs.c:9
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:544
return result
Definition: facAbsBiFact.cc:75
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3182
#define pISet(i)
Definition: polys.h:312