30 const int length,
int* intArray,
31 poly* nfPolyArray,
int& zeroCounter)
40 nfPolyArray[
i] =
pCopy(polyArray[
i]);
47 if (nfPolyArray[
i] ==
NULL)
54 bool isConstant =
true;
55 for (
int j = 1;
j <= n;
j++)
58 if (!isConstant)
result =
false;
62 if (characteristic != 0) intArray[
i] = intArray[
i] % characteristic;
63 if (intArray[
i] == 0) zeroCounter++;
77 const int columnCount,
const int minorSize,
78 const int k,
const char* algorithm,
79 const ideal
i,
const bool allDifferent)
84 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
85 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
86 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
87 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
88 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
94 int collectedMinors = 0;
100 bool zeroOk = ((
k < 0) ?
true :
false);
102 bool duplicatesOk = (allDifferent ?
false :
true);
106 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
119 if (collectedMinors == 0) jjj =
idInit(1);
132 const int columnCount,
const int minorSize,
133 const int k,
const char* algorithm,
134 const ideal
i,
const bool allDifferent)
139 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
140 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
141 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
142 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
143 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
149 int collectedMinors = 0;
154 bool zeroOk = ((
k < 0) ?
true :
false);
156 bool duplicatesOk = (allDifferent ?
false :
true);
158#ifdef COUNT_AND_PRINT_OPERATIONS
163 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
167#if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1)
169 Print(
"after %d", qqq);
174 zeroOk, duplicatesOk))
177#ifdef COUNT_AND_PRINT_OPERATIONS
190 const int k,
const char* algorithm,
191 const ideal
i,
const bool allDifferent)
193 int rowCount = mat->
nrows;
194 int columnCount = mat->
ncols;
195 poly* myPolyMatrix = (poly*)(mat->
m);
201 int* myIntMatrix = (
int*)
omAlloc(rowCount * columnCount *
sizeof(
int));
202 poly* nfPolyMatrix = (poly*)
omAlloc(rowCount * columnCount *
sizeof(poly));
204 myIntMatrix, nfPolyMatrix, zz))
206 algorithm,
i, allDifferent);
209 if ((
k == 0) && (strcmp(algorithm,
"Bareiss") == 0)
223 k, algorithm,
i, allDifferent);
229 for (
int j = 0;
j < rowCount * columnCount;
j++)
pDelete(&nfPolyMatrix[
j]);
241 const char* algorithm,
const ideal iSB,
242 const bool allDifferent)
249 int rowCount = mat->
nrows;
250 int columnCount = mat->
ncols;
251 poly* myPolyMatrix = (poly*)(mat->
m);
252 int length = rowCount * columnCount;
255 if ((
k == 0) && (strcmp(algorithm,
"Bareiss") == 0)
277 nfPolyMatrix[
i] =
kNF(iSB,
currRing->qideal,myPolyMatrix[
i]);
284 nfPolyMatrix[
i] =
pCopy(myPolyMatrix[
i]);
288 k, algorithm, iSB, allDifferent);
305 const int columnCount,
const int minorSize,
306 const int k,
const ideal
i,
307 const int cacheStrategy,
const int cacheN,
308 const int cacheW,
const bool allDifferent)
313 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
314 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
315 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
316 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
317 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
325 int collectedMinors = 0;
331 bool zeroOk = ((
k < 0) ?
true :
false);
333 bool duplicatesOk = (allDifferent ?
false :
true);
337 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
350 if (collectedMinors == 0) jjj =
idInit(1);
363 const int columnCount,
const int minorSize,
364 const int k,
const ideal
i,
365 const int cacheStrategy,
const int cacheN,
366 const int cacheW,
const bool allDifferent)
371 int *myRowIndices=(
int*)
omAlloc(rowCount*
sizeof(
int));
372 for (
int j = 0;
j < rowCount;
j++) myRowIndices[
j] =
j;
373 int *myColumnIndices=(
int*)
omAlloc(columnCount*
sizeof(
int));
374 for (
int j = 0;
j < columnCount;
j++) myColumnIndices[
j] =
j;
375 mp.
defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices);
383 int collectedMinors = 0;
388 bool zeroOk = ((
k < 0) ?
true :
false);
390 bool duplicatesOk = (allDifferent ?
false :
true);
392#ifdef COUNT_AND_PRINT_OPERATIONS
397 while (mp.
hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
401#if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1)
403 Print(
"after %d", qqq);
411#ifdef COUNT_AND_PRINT_OPERATIONS
418 if (collectedMinors == 0) jjj =
idInit(1);
427 const int k,
const ideal iSB,
428 const int cacheStrategy,
const int cacheN,
429 const int cacheW,
const bool allDifferent)
431 int rowCount = mat->
nrows;
432 int columnCount = mat->
ncols;
433 poly* myPolyMatrix = (poly*)(mat->
m);
439 int* myIntMatrix = (
int*)
omAlloc(rowCount * columnCount *
sizeof(
int));
440 poly* nfPolyMatrix = (poly*)
omAlloc(rowCount * columnCount *
sizeof(poly));
442 myIntMatrix, nfPolyMatrix, zz))
444 minorSize,
k, iSB, cacheStrategy, cacheN,
445 cacheW, allDifferent);
448 minorSize,
k, iSB, cacheStrategy, cacheN,
449 cacheW, allDifferent);
453 for (
int j = 0;
j < rowCount * columnCount;
j++)
pDelete(&nfPolyMatrix[
j]);
460 const ideal iSB,
const int cacheStrategy,
461 const int cacheN,
const int cacheW,
462 const bool allDifferent)
469 int rowCount = mat->
nrows;
470 int columnCount = mat->
ncols;
471 poly* myPolyMatrix = (poly*)(mat->
m);
472 int length = rowCount * columnCount;
481 nfPolyMatrix[
i] =
pCopy(myPolyMatrix[
i]);
483 nfPolyMatrix[
i] =
kNF(iSB,
currRing->qideal, myPolyMatrix[
i]);
487 minorSize,
k, iSB, cacheStrategy,
488 cacheN, cacheW, allDifferent);
498 const int k,
const ideal iSB,
499 const bool allDifferent)
528 if (minorSize <= 2)
b =
true;
529 else if (vars <= 2)
b =
true;
536 if (
k != 0)
l =
true;
548 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 ...
Compatiblity 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