18 #ifdef COUNT_AND_PRINT_OPERATIONS 21 long addsPolyForDiv = 0;
23 long multsPolyForDiv = 0;
26 long multsMonForDiv = 0;
28 long savedMultsMFD = 0;
38 printf(
"%s [p+p(div) | p*p(div) | m*m(div, -save) | m/m ]", prefix);
39 printf(
" = [%ld(%ld) | %ld(%ld) | %ld(%d, -%ld) | %ld]\n",
40 addsPoly, addsPolyForDiv, multsPoly, multsPolyForDiv,
41 multsMon, multsMonForDiv, savedMultsMFD, divsMon);
44 multsMon = 0; addsPoly = 0; multsPoly = 0; divsMon = 0;
45 savedMultsMFD = 0; multsMonForDiv = 0; addsPolyForDiv = 0;
66 int numberOfZeros = 0;
67 int bestIndex = 100000;
68 int maxNumberOfZeros = -1;
70 for (
int r = 0;
r <
k;
r++)
75 for (
int c = 0; c <
k; c++)
78 if (isEntryZero(absoluteR, absoluteC)) numberOfZeros++;
80 if (numberOfZeros > maxNumberOfZeros)
83 bestIndex = absoluteR;
84 maxNumberOfZeros = numberOfZeros;
87 for (
int c = 0; c <
k; c++)
91 for (
int r = 0;
r <
k;
r++)
94 if (isEntryZero(absoluteR, absoluteC)) numberOfZeros++;
96 if (numberOfZeros > maxNumberOfZeros)
101 bestIndex = - absoluteC - 1;
102 maxNumberOfZeros = numberOfZeros;
110 _minorSize = minorSize;
116 return setNextKeys(_minorSize);
121 return _minor.getAbsoluteRowIndices(target);
126 return _minor.getAbsoluteColumnIndices(target);
130 const int* rowIndices,
131 const int numberOfColumns,
132 const int* columnIndices)
141 _containerRows = numberOfRows;
142 int highestRowIndex = rowIndices[numberOfRows - 1];
143 int rowBlockCount = (highestRowIndex / 32) + 1;
144 unsigned int *rowBlocks=
new unsigned int[rowBlockCount];
145 for (
int i = 0;
i < rowBlockCount;
i++) rowBlocks[
i] = 0;
146 for (
int i = 0;
i < numberOfRows;
i++)
148 int blockIndex = rowIndices[
i] / 32;
149 int offset = rowIndices[
i] % 32;
150 rowBlocks[blockIndex] += (1 <<
offset);
153 _containerColumns = numberOfColumns;
154 int highestColumnIndex = columnIndices[numberOfColumns - 1];
155 int columnBlockCount = (highestColumnIndex / 32) + 1;
156 unsigned *columnBlocks=
new unsigned[columnBlockCount];
157 for (
int i = 0;
i < columnBlockCount;
i++) columnBlocks[
i] = 0;
158 for (
int i = 0;
i < numberOfColumns;
i++)
160 int blockIndex = columnIndices[
i] / 32;
161 int offset = columnIndices[
i] % 32;
162 columnBlocks[blockIndex] += (1 <<
offset);
165 _container.set(rowBlockCount, rowBlocks, columnBlockCount, columnBlocks);
166 delete[] columnBlocks;
175 if (_minor.compare(
MinorKey(0, 0, 0, 0)) == 0)
179 _minor.selectFirstRows(k, _container);
180 _minor.selectFirstColumns(k, _container);
183 else if (_minor.selectNextColumns(k, _container))
189 else if (_minor.selectNextRows(k, _container))
194 _minor.selectFirstColumns(k, _container);
222 assume( (i >= 0) && (j >= 0) && (i >= j));
223 if (j == 0 || i == j)
return 1;
225 for (
int k = i - j + 1;
k <=
i;
k++) result *=
k;
227 for (
int k = 2;
k <=
j;
k++) result /=
k;
238 for (
int j = 1;
j <=
i;
j++) result *=
j;
244 const int containerMinorSize,
246 const bool multipleMinors)
260 result = IOverJ(rows - minorSize, containerMinorSize - minorSize)
261 * IOverJ(columns - minorSize, containerMinorSize - minorSize)
262 * Faculty(containerMinorSize - minorSize);
270 result = Faculty(containerMinorSize - minorSize);
280 _containerColumns = 0;
297 string s =
"IntMinorProcessor:";
299 sprintf(h,
"%d", _rows); s +=
h;
301 sprintf(h,
"%d", _columns); s +=
h;
302 for (
int r = 0;
r < _rows;
r++)
305 for (
int c = 0; c < _columns; c++)
307 sprintf(h,
"%d", getEntry(
r, c)); t =
h;
308 for (
int k = 0;
k < int(4 - strlen(h));
k++) s +=
" ";
312 int myIndexArray[500];
313 s +=
"\n considered submatrix has row indices: ";
314 _container.getAbsoluteRowIndices(myIndexArray);
315 for (
int k = 0;
k < _containerRows;
k++)
317 if (
k != 0) s +=
", ";
318 sprintf(h,
"%d", myIndexArray[
k]); s +=
h;
320 s +=
" (first row of matrix has index 0)";
321 s +=
"\n considered submatrix has column indices: ";
322 _container.getAbsoluteColumnIndices(myIndexArray);
323 for (
int k = 0;
k < _containerColumns;
k++)
325 if (
k != 0) s +=
", ";
326 sprintf(h,
"%d", myIndexArray[
k]); s +=
h;
328 s +=
" (first column of matrix has index 0)";
329 s +=
"\n size of considered minor(s): ";
330 sprintf(h,
"%d", _minorSize); s +=
h;
339 delete [] _intMatrix; _intMatrix = 0;
343 const int absoluteColumnIndex)
const 345 return getEntry(absoluteRowIndex, absoluteColumnIndex) == 0;
349 const int numberOfColumns,
353 delete [] _intMatrix; _intMatrix = 0;
355 _rows = numberOfRows;
356 _columns = numberOfColumns;
359 int n = _rows * _columns;
360 _intMatrix =
new int[n];
364 for (
int i = 0;
i < n;
i++)
365 _intMatrix[
i] = matrix[
i];
369 const int* rowIndices,
370 const int* columnIndices,
372 const int characteristic,
375 defineSubMatrix(dimension, rowIndices, dimension, columnIndices);
379 return getMinorPrivateLaplace(dimension, _container,
false, c,
380 characteristic, iSB);
384 const int* rowIndices,
385 const int* columnIndices,
386 const int characteristic,
388 const char* algorithm)
390 defineSubMatrix(dimension, rowIndices, dimension, columnIndices);
394 if (strcmp(algorithm,
"Laplace") == 0)
395 return getMinorPrivateLaplace(_minorSize, _container, characteristic,
397 else if (strcmp(algorithm,
"Bareiss") == 0)
398 return getMinorPrivateBareiss(_minorSize, _container, characteristic,
409 const char* algorithm)
412 if (strcmp(algorithm,
"Laplace") == 0)
413 return getMinorPrivateLaplace(_minorSize, _minor, characteristic, iSB);
414 else if (strcmp(algorithm,
"Bareiss") == 0)
415 return getMinorPrivateBareiss(_minorSize, _minor, characteristic, iSB);
425 const int characteristic,
429 return getMinorPrivateLaplace(_minorSize, _minor,
true, c, characteristic,
437 if (i == 0)
return 0;
450 const int characteristic,
460 if (characteristic != 0) e = e % characteristic;
471 int b = getBestLine(k, mk);
475 int s = 0;
int m = 0;
int as = 0;
int am = 0;
479 bool hadNonZeroEntry =
false;
487 for (
int c = 0; c <
k; c++)
490 if (getEntry(b, absoluteC) != 0)
493 hadNonZeroEntry =
true;
497 characteristic, iSB);
504 result += sign * mv.
getResult() * getEntry(b, absoluteC);
506 if (characteristic != 0) result = result % characteristic;
507 s++; m++; as++, am++;
522 for (
int r = 0;
r <
k;
r++)
525 if (getEntry(absoluteR, b) != 0)
528 hadNonZeroEntry =
true;
531 IntMinorValue mv = getMinorPrivateLaplace(k - 1, subMk, characteristic, iSB);
538 result += sign * mv.
getResult() * getEntry(absoluteR, b);
539 if (characteristic != 0) result = result % characteristic;
540 s++; m++; as++, am++;
567 const int characteristic,
575 int e = getEntry(theRows[0], theColumns[0]);
576 if (characteristic != 0) e = e % characteristic;
582 long *tempMatrix=
new long[k *
k];
585 for (
int r = 0;
r <
k;
r++)
586 for (
int c = 0; c <
k; c++)
588 e = getEntry(theRows[
r], theColumns[c]);
589 if (characteristic != 0) e = e % characteristic;
595 int *rowPermutation=
new int[
k];
599 for (
int i = 0; i <
k; i++) rowPermutation[i] = i;
601 for (
int r = 0;
r <= k - 2;
r++)
605 while ((i < k) && (tempMatrix[rowPermutation[i] * k +
r] == 0))
613 int j = rowPermutation[
i];
614 rowPermutation[
i] = rowPermutation[
r];
615 rowPermutation[
r] =
j;
621 if (
r >= 1) divisor = tempMatrix[rowPermutation[
r - 1] * k +
r - 1];
622 for (
int rr =
r + 1; rr <
k; rr++)
623 for (
int cc =
r + 1; cc <
k; cc++)
625 e = rowPermutation[rr] * k + cc;
628 tempMatrix[e] = tempMatrix[e] * tempMatrix[rowPermutation[
r] * k +
r]
629 - tempMatrix[rowPermutation[
r] * k + cc]
630 * tempMatrix[rowPermutation[rr] * k +
r];
633 tempMatrix[e] = tempMatrix[e] / divisor;
634 if (characteristic != 0)
635 tempMatrix[e] = tempMatrix[e] % characteristic;
637 delete[] rowPermutation;
640 int theValue = sign * tempMatrix[rowPermutation[k - 1] * k + k - 1];
645 delete [] theColumns;
650 const int columnIndex)
const 652 return _intMatrix[rowIndex * _columns + columnIndex];
657 const bool multipleMinors,
659 const int characteristic,
const ideal& iSB)
668 if (characteristic != 0) e = e % characteristic;
675 int b = getBestLine(k, mk);
679 int s = 0;
int m = 0;
int as = 0;
int am = 0;
686 bool hadNonZeroEntry =
false;
695 for (
int c = 0; c <
k; c++)
699 if (getEntry(b, absoluteC) != 0)
702 hadNonZeroEntry =
true;
717 mv = getMinorPrivateLaplace(k - 1, subMk, multipleMinors, cch,
718 characteristic, iSB);
731 result += sign * mv.
getResult() * getEntry(b, absoluteC);
732 if (characteristic != 0) result = result % characteristic;
733 s++; m++; as++; am++;
748 for (
int r = 0;
r <
k;
r++)
751 if (getEntry(absoluteR, b) != 0)
754 hadNonZeroEntry =
true;
769 mv = getMinorPrivateLaplace(k - 1, subMk, multipleMinors, cch, characteristic, iSB);
781 result += sign * mv.
getResult() * getEntry(absoluteR, b);
782 if (characteristic != 0) result = result % characteristic;
783 s++; m++; as++; am++;
790 int potentialRetrievals = NumberOfRetrievals(_containerRows,
803 IntMinorValue newMV(result, m, s, am, as, 1, potentialRetrievals);
815 const int columnIndex)
const 817 return _polyMatrix[rowIndex * _columns + columnIndex];
821 const int absoluteColumnIndex)
const 823 return getEntry(absoluteRowIndex, absoluteColumnIndex) ==
NULL;
830 string s =
"PolyMinorProcessor:";
832 sprintf(h,
"%d", _rows); s +=
h;
834 sprintf(h,
"%d", _columns); s +=
h;
835 int myIndexArray[500];
836 s +=
"\n considered submatrix has row indices: ";
837 _container.getAbsoluteRowIndices(myIndexArray);
838 for (
int k = 0;
k < _containerRows;
k++)
840 if (
k != 0) s +=
", ";
841 sprintf(h,
"%d", myIndexArray[
k]); s +=
h;
843 s +=
" (first row of matrix has index 0)";
844 s +=
"\n considered submatrix has column indices: ";
845 _container.getAbsoluteColumnIndices(myIndexArray);
846 for (
int k = 0;
k < _containerColumns;
k++)
848 if (
k != 0) s +=
", ";
849 sprintf(h,
"%d", myIndexArray[
k]); s +=
h;
851 s +=
" (first column of matrix has index 0)";
852 s +=
"\n size of considered minor(s): ";
853 sprintf(h,
"%d", _minorSize); s +=
h;
862 int n = _rows * _columns;
863 for (
int i = 0;
i < n;
i++)
865 delete [] _polyMatrix; _polyMatrix = 0;
869 const int numberOfColumns,
870 const poly* polyMatrix)
873 int n = _rows * _columns;
874 for (
int i = 0;
i < n;
i++)
876 delete [] _polyMatrix; _polyMatrix = 0;
878 _rows = numberOfRows;
879 _columns = numberOfColumns;
880 n = _rows * _columns;
883 _polyMatrix =
new poly[n];
887 for (
int i = 0; i < n; i++)
888 _polyMatrix[i] =
pCopy(polyMatrix[i]);
892 const int* rowIndices,
893 const int* columnIndices,
897 defineSubMatrix(dimension, rowIndices, dimension, columnIndices);
901 return getMinorPrivateLaplace(dimension, _container,
false, c, iSB);
905 const int* rowIndices,
906 const int* columnIndices,
907 const char* algorithm,
910 defineSubMatrix(dimension, rowIndices, dimension, columnIndices);
913 if (strcmp(algorithm,
"Laplace") == 0)
914 return getMinorPrivateLaplace(_minorSize, _container, iSB);
915 else if (strcmp(algorithm,
"Bareiss") == 0)
916 return getMinorPrivateBareiss(_minorSize, _container, iSB);
929 if (strcmp(algorithm,
"Laplace") == 0)
930 return getMinorPrivateLaplace(_minorSize, _minor, iSB);
931 else if (strcmp(algorithm,
"Bareiss") == 0)
932 return getMinorPrivateBareiss(_minorSize, _minor, iSB);
945 return getMinorPrivateLaplace(_minorSize, _minor,
true, c, iSB);
969 int b = getBestLine(k, mk);
973 int s = 0;
int m = 0;
int as = 0;
int am = 0;
977 bool hadNonZeroEntry =
false;
986 for (
int c = 0; c <
k; c++)
989 if (!isEntryZero(b, absoluteC))
992 hadNonZeroEntry =
true;
1002 signPoly =
pISet(sign);
1007 #ifdef COUNT_AND_PRINT_OPERATIONS 1013 s++; m++; as++, am++;
1029 for (
int r = 0;
r <
k;
r++)
1032 if (!isEntryZero(absoluteR, b))
1035 hadNonZeroEntry =
true;
1045 signPoly =
pISet(sign);
1050 #ifdef COUNT_AND_PRINT_OPERATIONS 1056 s++; m++; as++, am++;
1062 if (hadNonZeroEntry)
1065 #ifdef COUNT_AND_PRINT_OPERATIONS 1073 if (iSB != 0) result =
kNF(iSB,
currRing->qideal, result);
1086 const bool multipleMinors,
1098 0, 0, 0, 0, -1, -1);
1104 int b = getBestLine(k, mk);
1108 int s = 0;
int m = 0;
int as = 0;
int am = 0;
1112 bool hadNonZeroEntry =
false;
1122 for (
int c = 0; c <
k; c++)
1125 if (!isEntryZero(b, absoluteC))
1128 hadNonZeroEntry =
true;
1145 mv = getMinorPrivateLaplace(k - 1, subMk, multipleMinors, cch,
1157 signPoly =
pISet(sign);
1162 #ifdef COUNT_AND_PRINT_OPERATIONS 1168 s++; m++; as++; am++;
1184 for (
int r = 0;
r <
k;
r++)
1187 if (!isEntryZero(absoluteR, b))
1190 hadNonZeroEntry =
true;
1206 mv = getMinorPrivateLaplace(k - 1, subMk, multipleMinors, cch,
1218 signPoly =
pISet(sign);
1223 #ifdef COUNT_AND_PRINT_OPERATIONS 1229 s++; m++; as++; am++;
1236 int potentialRetrievals = NumberOfRetrievals(_containerRows,
1241 if (hadNonZeroEntry)
1244 #ifdef COUNT_AND_PRINT_OPERATIONS 1252 if (iSB != 0) result =
kNF(iSB,
currRing->qideal, result);
1253 PolyMinorValue newMV(result, m, s, am, as, 1, potentialRetrievals);
1269 b = f1; a = f2; bLen = aLen;
1289 #ifdef COUNT_AND_PRINT_OPERATIONS 1323 number &c5,
int p5Len)
1325 #ifdef COUNT_AND_PRINT_OPERATIONS 1352 while (bucketLm !=
NULL)
1363 #ifdef COUNT_AND_PRINT_OPERATIONS 1365 multsMonForDiv += p5Len;
1377 helperPoly = bucketLm;
1378 helperPoly->next = p1;
1400 0, 0, 0, 0, -1, -1);
1401 delete[] theColumns;
1411 for (
int r = 0;
r <
k;
r++)
1412 for (
int c = 0; c <
k; c++)
1413 tempMatrix[i++] =
pCopy(getEntry(theRows[
r], theColumns[c]));
1418 int *rowPermutation=
new int[
k];
1421 for (
int i = 0; i <
k; i++) rowPermutation[i] = i;
1423 int divisorLength = 0;
1425 for (
int r = 0; r <= k - 2; r++)
1429 int minComplexity = -1;
int complexity = 0;
int bestRow = -1;
1431 for (
int i = r; i <
k; i++)
1433 pp = tempMatrix[rowPermutation[
i] * k +
r];
1436 if (minComplexity == -1)
1438 minComplexity =
pSize(pp);
1444 while ((pp !=
NULL) && (complexity < minComplexity))
1448 if (complexity < minComplexity)
1450 minComplexity = complexity;
1454 if (minComplexity <= 1)
break;
1460 for (
int i = 0; i < k *
k; i++)
pDelete(&tempMatrix[i]);
1463 pNormalize(tempMatrix[rowPermutation[bestRow] * k + r]);
1467 int j = rowPermutation[bestRow];
1468 rowPermutation[bestRow] = rowPermutation[
r];
1469 rowPermutation[
r] =
j;
1475 #if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 2) 1477 printf(
"matrix after %d steps:\n", r);
1478 for (
int u = 0; u <
k; u++)
1480 for (
int v = 0;
v <
k;
v++)
1482 if ((
v < r) && (u >
v))
1486 w = tempMatrix[rowPermutation[u] * k +
v];
1497 divisor = tempMatrix[rowPermutation[r - 1] * k + r - 1];
1499 divisorLength =
pLength(divisor);
1502 for (
int rr = r + 1; rr <
k; rr++)
1503 for (
int cc = r + 1; cc <
k; cc++)
1507 tempMatrix[rowPermutation[r] * k + r],
1508 tempMatrix[rowPermutation[r] * k + cc],
1509 tempMatrix[rowPermutation[rr] * k + r]);
1512 tempMatrix[rowPermutation[r] * k + r],
1513 tempMatrix[rowPermutation[r] * k + cc],
1514 tempMatrix[rowPermutation[rr] * k + r],
1515 divisor, divisorLC, divisorLength);
1518 #if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 2) 1520 printf(
"matrix after %d steps:\n", k - 1);
1521 for (
int u = 0; u <
k; u++)
1523 for (
int v = 0;
v <
k;
v++)
1525 if ((
v < k - 1) && (u >
v))
1529 w = tempMatrix[rowPermutation[u] * k +
v];
1537 poly result = tempMatrix[rowPermutation[k - 1] * k + k - 1];
1538 if (sign == -1) result =
pNeg(result);
1539 if (iSB != 0) result =
kNF(iSB,
currRing->qideal, result);
1541 for (
int i = 0; i < k *
k; i++)
pDelete(&tempMatrix[i]);
1543 delete[] rowPermutation;
1544 delete[] theColumns;
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
PolyMinorValue getMinorPrivateBareiss(const int k, const MinorKey &mk, const ideal &iSB)
A method for computing the value of a minor, without using a cache.
int getAccumulatedMultiplications() const
A method for accessing the multiplications performed while computing this minor, including all nested...
int getReduction(const int i, const ideal &iSB)
const CanonicalForm int s
static int IOverJ(const int i, const int j)
A static method for computing the binomial coefficient i over j.
bool isEntryZero(const int absoluteRowIndex, const int absoluteColumnIndex) const
A method for testing whether a matrix entry is zero.
IntMinorValue getMinorPrivateLaplace(const int k, const MinorKey &mk, const bool multipleMinors, Cache< MinorKey, IntMinorValue > &c, int characteristic, const ideal &iSB)
A method for computing the value of a minor, using a cache.
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
int getAccumulatedAdditions() const
A method for accessing the additions performed while computing this minor, including all nested addit...
Compatiblity layer for legacy polynomial operations (over currRing)
int getAbsoluteRowIndex(const int i) const
A method for retrieving the (0-based) index of the i-th row in the set of rows encoded in this...
std::string toString() const
A method for providing a printable version of the represented MinorProcessor.
IntMinorValue getMinor(const int dimension, const int *rowIndices, const int *columnIndices, const int characteristic, const ideal &iSB, const char *algorithm)
A method for computing the value of a minor without using a cache.
poly getEntry(const int rowIndex, const int columnIndex) const
A method for retrieving the matrix entry.
#define omFreeSize(addr, size)
const poly kBucketGetLm(kBucket_pt bucket)
virtual std::string toString() const
A method for providing a printable version of the represented MinorProcessor.
MinorKey getSubMinorKey(const int absoluteEraseRowIndex, const int absoluteEraseColumnIndex) const
A method for retrieving a sub-MinorKey resulting from omitting one row and one column of this MinorKe...
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
static int NumberOfRetrievals(const int rows, const int columns, const int containerMinorSize, const int minorSize, const bool multipleMinors)
A static method for computing the maximum number of retrievals of a minor.
Class IntMinorValue is derived from MinorValue and can be used for representing values in a cache for...
MinorProcessor()
The default constructor.
void incrementRetrievals()
A method for incrementing the number of performed retrievals of this instance of MinorValue.
static int pLength(poly a)
void addOperationBucket(poly &f1, poly &f2, kBucket_pt &bucket)
int getAdditions() const
A method for accessing the additions performed while computing this minor.
PolyMinorProcessor()
A constructor for creating an instance.
Class Cache is a template-implementation of a cache with arbitrary classes for representing keys and ...
PolyMinorValue getNextMinor(const char *algorithm, const ideal &iSB)
A method for obtaining the next minor when iterating through all minors of a given size within a pre-...
virtual bool isEntryZero(const int absoluteRowIndex, const int absoluteColumnIndex) const
A method for testing whether a matrix entry is zero.
int getRelativeColumnIndex(const int i) const
A method for retrieving the (0-based) relative index of the i-th column in this MinorKey.
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
IntMinorValue getNextMinor(const int characteristic, const ideal &iSB, const char *algorithm)
A method for obtaining the next minor when iterating through all minors of a given size within a pre-...
bool hasNextMinor()
A method for checking whether there is a next choice of rows and columns when iterating through all m...
poly getResult() const
Accessor for the private field _result.
IntMinorValue getMinorPrivateBareiss(const int k, const MinorKey &mk, const int characteristic, const ideal &iSB)
A method for computing the value of a minor using Bareiss's algorithm.
int getBestLine(const int k, const MinorKey &mk) const
A method for identifying the row or column with the most zeros.
void kBucketDestroy(kBucket_pt *bucket_pt)
~PolyMinorProcessor()
A destructor for deleting an instance.
bool setNextKeys(const int k)
A method for iterating through all possible subsets of k rows and k columns inside a pre-defined subm...
void elimOperationBucketNoDiv(poly &p1, poly &p2, poly &p3, poly &p4)
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 ...
PolyMinorValue getMinor(const int dimension, const int *rowIndices, const int *columnIndices, const char *algorithm, const ideal &iSB)
A method for computing the value of a minor, without using a cache.
bool isEntryZero(const int absoluteRowIndex, const int absoluteColumnIndex) const
A method for testing whether a matrix entry is zero.
static int Faculty(const int i)
A static method for computing the factorial of i.
void elimOperationBucket(poly &p1, poly &p2, poly &p3, poly &p4, poly &p5, number &c5, int p5Len)
static poly pp_Mult_qq(poly p, poly q, const ring r)
int getRelativeRowIndex(const int i) const
A method for retrieving the (0-based) relative index of the i-th row in this MinorKey.
int getAbsoluteColumnIndex(const int i) const
A method for retrieving the (0-based) index of the i-th column in the set of columns encoded in this...
void PrintS(const char *s)
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
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...
Class PolyMinorValue is derived from MinorValue and can be used for representing values in a cache fo...
static poly pReverse(poly p)
void getCurrentColumnIndices(int *const target) const
A method for obtaining the current set of columns corresponding to the current minor when iterating t...
int getMultiplications() const
A method for accessing the multiplications performed while computing this minor.
static void p_Delete(poly *p, const ring r)
const Variable & v
< [in] a sqrfree bivariate poly
void defineMatrix(const int numberOfRows, const int numberOfColumns, const poly *polyMatrix)
A method for defining a matrix with polynomial entries.
BOOLEAN dimension(leftv res, leftv args)
Class MinorKey can be used for representing keys in a cache for sub-determinantes; see class Cache...
void printCounters(char *prefix, bool resetToZero)
void getAbsoluteColumnIndices(int *const target) const
A method for retrieving the 0-based indices of all columns encoded in this MinorKey.
IntMinorProcessor()
A constructor for creating an instance.
void getCurrentRowIndices(int *const target) const
A method for obtaining the current set of rows corresponding to the current minor when iterating thro...
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) ...
bool hasKey(const KeyClass &key) const
Checks whether the cache contains a pair (k –> v) such that k equals the given key.
int getEntry(const int rowIndex, const int columnIndex) const
A method for retrieving the matrix entry.
bool put(const KeyClass &key, const ValueClass &value)
Inserts the pair (key –> value) in the cache.
void setMinorSize(const int minorSize)
Sets the size of the minor(s) of interest.
std::string toString() const
A method for providing a printable version of the represented MinorProcessor.
std::string toString(const gfan::ZCone *const c)
void defineMatrix(const int numberOfRows, const int numberOfColumns, const int *matrix)
A method for defining a matrix with integer entries.
void getAbsoluteRowIndices(int *const target) const
A method for retrieving the 0-based indices of all rows encoded in this MinorKey. ...
static poly p_Add_q(poly p, poly q, const ring r)
void print() const
A method for printing a string representation of the given MinorProcessor to std::cout.
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
ValueClass getValue(const KeyClass &key) const
Returns the value for a given key.
static poly p_Mult_q(poly p, poly q, const ring r)
void defineSubMatrix(const int numberOfRows, const int *rowIndices, const int numberOfColumns, const int *columnIndices)
A method for defining a sub-matrix within a pre-defined matrix.
PolyMinorValue getMinorPrivateLaplace(const int k, const MinorKey &mk, const bool multipleMinors, Cache< MinorKey, PolyMinorValue > &c, const ideal &iSB)
A method for computing the value of a minor, using a cache.
~IntMinorProcessor()
A destructor for deleting an instance.
virtual ~MinorProcessor()
A destructor for deleting an instance.
int getResult() const
Accessor for the private field _result.
#define pCopy(p)
return a copy of the poly