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

Function getMinorIdealCache_Poly

kernel/linear_algebra/MinorInterface.cc:360–422  ·  view source on GitHub ↗

special implementation for the case that the matrix has non-number, i.e. real poly entries; if i is not the zero pointer, then it is assumed to contain a std basis, and the entries of the matrix are then assumed to be reduced w.r.t. i */

Source from the content-addressed store, hash-verified

358 if i is not the zero pointer, then it is assumed to contain a std basis,
359 and the entries of the matrix are then assumed to be reduced w.r.t. i */
360ideal getMinorIdealCache_Poly(const poly* polyMatrix, const int rowCount,
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)
365{
366 /* setting up a MinorProcessor for matrices with polynomial entries: */
367 PolyMinorProcessor mp;
368 mp.defineMatrix(rowCount, columnCount, polyMatrix);
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);
374 mp.setMinorSize(minorSize);
375 MinorValue::SetRankingStrategy(cacheStrategy);
376 Cache<MinorKey, PolyMinorValue> cch(cacheN, cacheW);
377
378 /* containers for all upcoming results: */
379 PolyMinorValue theMinor;
380 poly f = NULL;
381 int collectedMinors = 0;
382
383 /* the ideal to be returned: */
384 ideal iii = idInit(1);
385
386 bool zeroOk = ((k < 0) ? true : false); /* for k = 0, all minors are
387 requested, omitting zero minors */
388 bool duplicatesOk = (allDifferent ? false : true);
389 int kk = ABS(k); /* absolute value of k */
390#ifdef COUNT_AND_PRINT_OPERATIONS
391 printCounters ("starting", true);
392 int qqq = 0;
393#endif
394 /* looping over all minors: */
395 while (mp.hasNextMinor() && ((kk == 0) || (collectedMinors < kk)))
396 {
397 /* retrieving the next minor: */
398 theMinor = mp.getNextMinor(cch, i);
399#if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1)
400 qqq++;
401 Print("after %d", qqq);
402 printCounters ("-th minor", false);
403#endif
404 f = theMinor.getResult();
405 if (idInsertPolyWithTests(iii, collectedMinors, pCopy(f), zeroOk,
406 duplicatesOk))
407 collectedMinors++;
408 }
409#ifdef COUNT_AND_PRINT_OPERATIONS
410 printCounters ("ending", true);
411#endif
412
413 /* before we return the result, let's omit zero generators
414 in iii which come after the computed minors */
415 ideal jjj;
416 if (collectedMinors == 0) jjj = idInit(1);
417 else jjj = idCopyFirstK(iii, collectedMinors);

Callers 2

getMinorIdealCacheFunction · 0.85

Calls 12

idInitFunction · 0.85
ABSFunction · 0.85
printCountersFunction · 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
PrintFunction · 0.50

Tested by

no test coverage detected