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

Function getMinorIdeal_Int

kernel/linear_algebra/MinorInterface.cc:74–123  ·  view source on GitHub ↗

special implementation for the case that the matrix has only number entries; if i is not the zero pointer, then it is assumed to contain a std basis, and the number entries of the matrix are then assumed to be reduced w.r.t. i and modulo the characteristic of the gound field/ring; this method should also work when currRing == null, i.e. when no ring has been declared */

Source from the content-addressed store, hash-verified

72 this method should also work when currRing == null, i.e. when no ring has
73 been declared */
74ideal getMinorIdeal_Int (const int* intMatrix, const int rowCount,
75 const int columnCount, const int minorSize,
76 const int k, const char* algorithm,
77 const ideal i, const bool allDifferent)
78{
79 /* setting up a MinorProcessor for matrices with integer entries: */
80 IntMinorProcessor mp;
81 mp.defineMatrix(rowCount, columnCount, intMatrix);
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);
87 mp.setMinorSize(minorSize);
88
89 /* containers for all upcoming results: */
90 IntMinorValue theMinor;
91 // int value = 0;
92 int collectedMinors = 0;
93 int characteristic = 0; if (currRing != 0) characteristic = rChar(currRing);
94
95 /* the ideal to be returned: */
96 ideal iii = idInit(1);
97
98 bool zeroOk = ((k < 0) ? true : false); /* for k = 0, all minors are requested,
99 omitting zero minors */
100 bool duplicatesOk = (allDifferent ? false : true);
101 int kk = ABS(k); /* absolute value of k */
102
103 /* looping over all minors: */
104 while (mp.hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
105 {
106 /* retrieving the next minor: */
107 theMinor = mp.getNextMinor(characteristic, i, algorithm);
108 poly f = NULL;
109 if (theMinor.getResult() != 0) f = pISet(theMinor.getResult());
110 if (idInsertPolyWithTests(iii, collectedMinors, f, zeroOk, duplicatesOk))
111 collectedMinors++;
112 }
113
114 /* before we return the result, let's omit zero generators
115 in iii which come after the computed minors */
116 ideal jjj;
117 if (collectedMinors == 0) jjj = idInit(1);
118 else jjj = idCopyFirstK(iii, collectedMinors);
119 idDelete(&iii);
120 omFree(myColumnIndices);
121 omFree(myRowIndices);
122 return jjj;
123}
124
125/* special implementation for the case that the matrix has non-number,
126 i.e., actual polynomial entries;

Callers 1

getMinorIdeal_toBeDoneFunction · 0.85

Calls 11

rCharFunction · 0.85
idInitFunction · 0.85
ABSFunction · 0.85
idInsertPolyWithTestsFunction · 0.85
idCopyFirstKFunction · 0.85
defineMatrixMethod · 0.80
defineSubMatrixMethod · 0.80
setMinorSizeMethod · 0.80
hasNextMinorMethod · 0.80
getNextMinorMethod · 0.80
getResultMethod · 0.80

Tested by

no test coverage detected