30 const int length,
int* intArray,
31 poly* nfPolyArray,
int& zeroCounter)
39 nfPolyArray[
i] =
pCopy(polyArray[
i]);
46 if (nfPolyArray[
i] ==
NULL)
53 bool isConstant =
true;
54 for (
int j = 1;
j <= n;
j++)
57 if (!isConstant)
result =
false;
61 if (intArray[
i] == 0) zeroCounter++;
75 const int columnCount,
const int minorSize,
76 const int k,
const char* algorithm,
77 const ideal
i,
const bool allDifferent)
82 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
83 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
84 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
85 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
86 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
92 int collectedMinors = 0;
98 bool zeroOk = ((
k < 0) ?
true :
false);
100 bool duplicatesOk = (allDifferent ?
false :
true);
104 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
117 if (collectedMinors == 0) jjj =
idInit(1);
130 const int columnCount,
const int minorSize,
131 const int k,
const char* algorithm,
132 const ideal
i,
const bool allDifferent)
137 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
138 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
139 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
140 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
141 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
147 int collectedMinors = 0;
152 bool zeroOk = ((
k < 0) ?
true :
false);
154 bool duplicatesOk = (allDifferent ?
false :
true);
156#ifdef COUNT_AND_PRINT_OPERATIONS
161 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
165#if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1)
167 Print(
"after %d", qqq);
172 zeroOk, duplicatesOk))
175#ifdef COUNT_AND_PRINT_OPERATIONS
188 const int k,
const char* algorithm,
189 const ideal
i,
const bool allDifferent)
191 int rowCount = mat->
nrows;
192 int columnCount = mat->
ncols;
193 poly* myPolyMatrix = (poly*)(mat->
m);
199 int* myIntMatrix = (
int*)
omAlloc(rowCount * columnCount *
sizeof(
int));
200 poly* nfPolyMatrix = (poly*)
omAlloc(rowCount * columnCount *
sizeof(poly));
202 myIntMatrix, nfPolyMatrix, zz))
204 algorithm,
i, allDifferent);
207 if ((
k == 0) && (strcmp(algorithm,
"Bareiss") == 0)
221 k, algorithm,
i, allDifferent);
227 for (
int j = 0;
j < rowCount * columnCount;
j++)
pDelete(&nfPolyMatrix[
j]);
239 const char* algorithm,
const ideal iSB,
240 const bool allDifferent)
247 int rowCount = mat->
nrows;
248 int columnCount = mat->
ncols;
249 poly* myPolyMatrix = (poly*)(mat->
m);
250 int length = rowCount * columnCount;
253 if ((
k == 0) && (strcmp(algorithm,
"Bareiss") == 0)
275 nfPolyMatrix[
i] =
kNF(iSB,
currRing->qideal,myPolyMatrix[
i]);
282 nfPolyMatrix[
i] =
pCopy(myPolyMatrix[
i]);
286 k, algorithm, iSB, allDifferent);
303 const int columnCount,
const int minorSize,
304 const int k,
const ideal
i,
305 const int cacheStrategy,
const int cacheN,
306 const int cacheW,
const bool allDifferent)
311 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
312 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
313 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
314 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
315 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
323 int collectedMinors = 0;
329 bool zeroOk = ((
k < 0) ?
true :
false);
331 bool duplicatesOk = (allDifferent ?
false :
true);
335 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
348 if (collectedMinors == 0) jjj =
idInit(1);
361 const int columnCount,
const int minorSize,
362 const int k,
const ideal
i,
363 const int cacheStrategy,
const int cacheN,
364 const int cacheW,
const bool allDifferent)
369 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
370 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
371 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
372 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
373 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
381 int collectedMinors = 0;
386 bool zeroOk = ((
k < 0) ?
true :
false);
388 bool duplicatesOk = (allDifferent ?
false :
true);
390#ifdef COUNT_AND_PRINT_OPERATIONS
395 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
399#if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1)
401 Print(
"after %d", qqq);
409#ifdef COUNT_AND_PRINT_OPERATIONS
416 if (collectedMinors == 0) jjj =
idInit(1);
425 const int k,
const ideal iSB,
426 const int cacheStrategy,
const int cacheN,
427 const int cacheW,
const bool allDifferent)
429 int rowCount = mat->
nrows;
430 int columnCount = mat->
ncols;
431 poly* myPolyMatrix = (poly*)(mat->
m);
437 int* myIntMatrix = (
int*)
omAlloc(rowCount * columnCount *
sizeof(
int));
438 poly* nfPolyMatrix = (poly*)
omAlloc(rowCount * columnCount *
sizeof(poly));
440 myIntMatrix, nfPolyMatrix, zz))
442 minorSize,
k, iSB, cacheStrategy, cacheN,
443 cacheW, allDifferent);
446 minorSize,
k, iSB, cacheStrategy, cacheN,
447 cacheW, allDifferent);
451 for (
int j = 0;
j < rowCount * columnCount;
j++)
pDelete(&nfPolyMatrix[
j]);
458 const ideal iSB,
const int cacheStrategy,
459 const int cacheN,
const int cacheW,
460 const bool allDifferent)
467 int rowCount = mat->
nrows;
468 int columnCount = mat->
ncols;
469 poly* myPolyMatrix = (poly*)(mat->
m);
470 int length = rowCount * columnCount;
479 nfPolyMatrix[
i] =
pCopy(myPolyMatrix[
i]);
481 nfPolyMatrix[
i] =
kNF(iSB,
currRing->qideal, myPolyMatrix[
i]);
485 minorSize,
k, iSB, cacheStrategy,
486 cacheN, cacheW, allDifferent);
496 const int k,
const ideal iSB,
497 const bool allDifferent)
526 if (minorSize <= 2)
b =
true;
527 else if (vars <= 2)
b =
true;
534 if (
k != 0)
l =
true;
546 3, 200, 100000, allDifferent);
ideal getMinorIdealCache_Int(const int *intMatrix, const int rowCount, const int columnCount, const int minorSize, const int k, const ideal i, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
ideal getMinorIdealCache_toBeDone(const matrix mat, const int minorSize, const int k, const ideal iSB, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
ideal getMinorIdeal_Poly(const poly *polyMatrix, const int rowCount, const int columnCount, const int minorSize, const int k, const char *algorithm, const ideal i, const bool allDifferent)
ideal getMinorIdealCache(const matrix mat, const int minorSize, const int k, const ideal iSB, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
ideal getMinorIdeal_Int(const int *intMatrix, const int rowCount, const int columnCount, const int minorSize, const int k, const char *algorithm, const ideal i, const bool allDifferent)
ideal getMinorIdeal(const matrix mat, const int minorSize, const int k, const char *algorithm, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
bool arrayIsNumberArray(const poly *polyArray, const ideal iSB, const int length, int *intArray, poly *nfPolyArray, int &zeroCounter)
ideal getMinorIdealCache_Poly(const poly *polyMatrix, const int rowCount, const int columnCount, const int minorSize, const int k, const ideal i, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
ideal getMinorIdeal_toBeDone(const matrix mat, const int minorSize, const int k, const char *algorithm, const ideal i, const bool allDifferent)
ideal getMinorIdealHeuristic(const matrix mat, const int minorSize, const int k, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
void printCounters(char *prefix, bool resetToZero)
Class Cache is a template-implementation of a cache with arbitrary classes for representing keys and ...
Class IntMinorProcessor is derived from class MinorProcessor.
void defineMatrix(const int numberOfRows, const int numberOfColumns, const int *matrix)
A method for defining a matrix with integer entries.
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-...
Class IntMinorValue is derived from MinorValue and can be used for representing values in a cache for...
int getResult() const
Accessor for the private field _result.
void setMinorSize(const int minorSize)
Sets the size of the minor(s) of interest.
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.
bool hasNextMinor()
A method for checking whether there is a next choice of rows and columns when iterating through all m...
static void SetRankingStrategy(const int rankingStrategy)
A method for determining the value ranking strategy.
Class PolyMinorProcessor is derived from class MinorProcessor.
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-...
void defineMatrix(const int numberOfRows, const int numberOfColumns, const poly *polyMatrix)
A method for defining a matrix with polynomial entries.
Class PolyMinorValue is derived from MinorValue and can be used for representing values in a cache fo...
poly getResult() const
Accessor for the private field _result.
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 ....
ideal idMinors(matrix a, int ar, ideal R)
compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R ...
void idKeepFirstK(ideal id, const int k)
keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero....
#define idDelete(H)
delete an ideal
BOOLEAN idInsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
static ideal idCopyFirstK(const ideal ide, const int k)
static BOOLEAN length(leftv result, leftv arg)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing)
#define pGetExp(p, i)
Exponent.
#define pCopy(p)
return a copy of the poly
static BOOLEAN rField_is_Z(const ring r)
static BOOLEAN rField_is_Domain(const ring r)
#define rField_is_Ring(R)
ideal idInit(int idsize, int rank)
initialise an ideal / module