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

Function arrayIsNumberArray

kernel/linear_algebra/MinorInterface.cc:29–66  ·  view source on GitHub ↗

returns true iff the given polyArray has only number entries; if so, the int's corresponding to these numbers will be written into intArray[0..(length-1)]; the method assumes that both polyArray and intArray have valid entries for the indices 0..(length-1); after the call, zeroCounter contains the number of zero entries in the matrix */

Source from the content-addressed store, hash-verified

27 after the call, zeroCounter contains the number of zero entries
28 in the matrix */
29bool arrayIsNumberArray (const poly* polyArray, const ideal iSB,
30 const int length, int* intArray,
31 poly* nfPolyArray, int& zeroCounter)
32{
33 int n = 0; if (currRing != 0) n = currRing->N;
34 zeroCounter = 0;
35 bool result = true;
36
37 for (int i = 0; i < length; i++)
38 {
39 nfPolyArray[i] = pCopy(polyArray[i]);
40 if (iSB != NULL)
41 {
42 poly tmp = kNF(iSB, currRing->qideal, nfPolyArray[i]);
43 pDelete(&nfPolyArray[i]);
44 nfPolyArray[i]=tmp;
45 }
46 if (nfPolyArray[i] == NULL)
47 {
48 intArray[i] = 0;
49 zeroCounter++;
50 }
51 else
52 {
53 bool isConstant = true;
54 for (int j = 1; j <= n; j++)
55 if (pGetExp(nfPolyArray[i], j) > 0)
56 isConstant = false;
57 if (!isConstant) result = false;
58 else
59 {
60 intArray[i] = n_Int(pGetCoeff(nfPolyArray[i]), currRing->cf);
61 if (intArray[i] == 0) zeroCounter++;
62 }
63 }
64 }
65 return result;
66}
67
68/* special implementation for the case that the matrix has only number entries;
69 if i is not the zero pointer, then it is assumed to contain a std basis, and

Callers 2

getMinorIdeal_toBeDoneFunction · 0.85

Calls 2

kNFFunction · 0.85
n_IntFunction · 0.85

Tested by

no test coverage detected