Changeset 733b51 in git for kernel/linear_algebra/MinorInterface.cc
- Timestamp:
- Mar 16, 2017, 4:29:28 PM (7 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
- Children:
- f1cee38cd6cac02cfd2e0311e88e6d0feaf11505
- Parents:
- 4fbbedd2f732aad850d2db9352ecc293ba229165
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2017-03-16 16:29:28+01:00
- git-committer:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2017-03-16 16:48:34+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/linear_algebra/MinorInterface.cc
r4fbbed r733b51 19 19 20 20 using namespace std; 21 22 static inline bool currRingIsOverIntegralDomain ()23 {24 return rField_is_Domain(currRing);25 }26 27 bool currRingIsOverField ()28 {29 if (rField_is_Ring_PtoM(currRing)) return false;30 if (rField_is_Ring_2toM(currRing)) return false;31 if (rField_is_Ring_ModN(currRing)) return false;32 if (rField_is_Ring_Z(currRing)) return false;33 return true;34 }35 21 36 22 /* returns true iff the given polyArray has only number entries; … … 53 39 { 54 40 nfPolyArray[i] = pCopy(polyArray[i]); 55 if (iSB != 0) nfPolyArray[i] = kNF(iSB, currRing->qideal, nfPolyArray[i]); 41 if (iSB != NULL) 42 { 43 poly tmp = kNF(iSB, currRing->qideal, nfPolyArray[i]); 44 pDelete(&nfPolyArray[i]); 45 nfPolyArray[i]=tmp; 46 } 56 47 if (nfPolyArray[i] == NULL) 57 48 { … … 91 82 IntMinorProcessor mp; 92 83 mp.defineMatrix(rowCount, columnCount, intMatrix); 93 int *myRowIndices= new int[rowCount];84 int *myRowIndices=(int*)omAlloc(rowCount*sizeof(int)); 94 85 for (int j = 0; j < rowCount; j++) myRowIndices[j] = j; 95 int *myColumnIndices= new int[columnCount];86 int *myColumnIndices=(int*)omAlloc(columnCount*sizeof(int)); 96 87 for (int j = 0; j < columnCount; j++) myColumnIndices[j] = j; 97 88 mp.defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices); … … 129 120 else jjj = idCopyFirstK(iii, collectedMinors); 130 121 idDelete(&iii); 131 delete[] myColumnIndices;132 delete[] myRowIndices;122 omFree(myColumnIndices); 123 omFree(myRowIndices); 133 124 return jjj; 134 125 } … … 146 137 PolyMinorProcessor mp; 147 138 mp.defineMatrix(rowCount, columnCount, polyMatrix); 148 int *myRowIndices= new int[rowCount];139 int *myRowIndices=(int*)omAlloc(rowCount*sizeof(int)); 149 140 for (int j = 0; j < rowCount; j++) myRowIndices[j] = j; 150 int *myColumnIndices= new int[columnCount];141 int *myColumnIndices=(int*)omAlloc(columnCount*sizeof(int)); 151 142 for (int j = 0; j < columnCount; j++) myColumnIndices[j] = j; 152 143 mp.defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices); … … 191 182 in iii which come after the computed minors */ 192 183 idKeepFirstK(iii, collectedMinors); 193 delete[] myColumnIndices;194 delete[] myRowIndices;184 omFree(myColumnIndices); 185 omFree(myRowIndices); 195 186 return(iii); 196 187 } … … 208 199 /* divert to special implementations for pure number matrices and actual 209 200 polynomial matrices: */ 210 int* myIntMatrix = new int [rowCount * columnCount];211 poly* nfPolyMatrix = new poly[rowCount * columnCount];201 int* myIntMatrix = (int*)omAlloc(rowCount * columnCount *sizeof(int)); 202 poly* nfPolyMatrix = (poly*)omAlloc(rowCount * columnCount *sizeof(poly)); 212 203 if (arrayIsNumberArray(myPolyMatrix, i, rowCount * columnCount, 213 204 myIntMatrix, nfPolyMatrix, zz)) … … 235 226 236 227 /* clean up */ 237 delete [] myIntMatrix;228 omFree(myIntMatrix); 238 229 for (int j = 0; j < rowCount * columnCount; j++) pDelete(&nfPolyMatrix[j]); 239 delete [] nfPolyMatrix;230 omFree(nfPolyMatrix); 240 231 241 232 return iii; … … 279 270 (if iSB is present, i.e., not the NULL pointer) */ 280 271 281 poly* nfPolyMatrix = new poly[length];272 poly* nfPolyMatrix = (poly*)omAlloc(length*sizeof(poly)); 282 273 if (iSB != NULL) 283 274 { … … 299 290 /* clean up */ 300 291 for (int j = length-1; j>=0; j--) pDelete(&nfPolyMatrix[j]); 301 delete [] nfPolyMatrix;292 omFree(nfPolyMatrix); 302 293 } 303 294 … … 320 311 IntMinorProcessor mp; 321 312 mp.defineMatrix(rowCount, columnCount, intMatrix); 322 int *myRowIndices= new int[rowCount];313 int *myRowIndices=(int*)omAlloc(rowCount*sizeof(int)); 323 314 for (int j = 0; j < rowCount; j++) myRowIndices[j] = j; 324 int *myColumnIndices= new int[columnCount];315 int *myColumnIndices=(int*)omAlloc(columnCount*sizeof(int)); 325 316 for (int j = 0; j < columnCount; j++) myColumnIndices[j] = j; 326 317 mp.defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices); … … 360 351 else jjj = idCopyFirstK(iii, collectedMinors); 361 352 idDelete(&iii); 362 delete[] myColumnIndices;363 delete[] myRowIndices;353 omFree(myColumnIndices); 354 omFree(myRowIndices); 364 355 return jjj; 365 356 } … … 378 369 PolyMinorProcessor mp; 379 370 mp.defineMatrix(rowCount, columnCount, polyMatrix); 380 int *myRowIndices= new int[rowCount];371 int *myRowIndices=(int*)omAlloc(rowCount*sizeof(int)); 381 372 for (int j = 0; j < rowCount; j++) myRowIndices[j] = j; 382 int *myColumnIndices= new int[columnCount];373 int *myColumnIndices=(int*)omAlloc(columnCount*sizeof(int)); 383 374 for (int j = 0; j < columnCount; j++) myColumnIndices[j] = j; 384 375 mp.defineSubMatrix(rowCount, myRowIndices, columnCount, myColumnIndices); … … 428 419 else jjj = idCopyFirstK(iii, collectedMinors); 429 420 idDelete(&iii); 430 delete[] myColumnIndices;431 delete[] myRowIndices;421 omFree(myColumnIndices); 422 omFree(myRowIndices); 432 423 return jjj; 433 424 } … … 446 437 /* divert to special implementation when myPolyMatrix has only number 447 438 entries: */ 448 int* myIntMatrix = new int [rowCount * columnCount];449 poly* nfPolyMatrix = new poly[rowCount * columnCount];439 int* myIntMatrix = (int*)omAlloc(rowCount * columnCount *sizeof(int)); 440 poly* nfPolyMatrix = (poly*)omAlloc(rowCount * columnCount *sizeof(poly)); 450 441 if (arrayIsNumberArray(myPolyMatrix, iSB, rowCount * columnCount, 451 442 myIntMatrix, nfPolyMatrix, zz)) … … 459 450 460 451 /* clean up */ 461 delete [] myIntMatrix;452 omFree(myIntMatrix); 462 453 for (int j = 0; j < rowCount * columnCount; j++) pDelete(&nfPolyMatrix[j]); 463 delete [] nfPolyMatrix;454 omFree(nfPolyMatrix); 464 455 465 456 return iii; … … 480 471 poly* myPolyMatrix = (poly*)(mat->m); 481 472 int length = rowCount * columnCount; 482 poly* nfPolyMatrix = new poly[length];473 poly* nfPolyMatrix = (poly*)omAlloc(length*sizeof(poly)); 483 474 ideal iii; /* the ideal to be filled and returned */ 484 475 … … 487 478 for (int i = 0; i < length; i++) 488 479 { 489 nfPolyMatrix[i] = pCopy(myPolyMatrix[i]); 490 if (iSB != 0) nfPolyMatrix[i] = kNF(iSB, currRing->qideal, 491 nfPolyMatrix[i]); 480 if (iSB==NULL) 481 nfPolyMatrix[i] = pCopy(myPolyMatrix[i]); 482 else 483 nfPolyMatrix[i] = kNF(iSB, currRing->qideal, myPolyMatrix[i]); 492 484 } 493 485 … … 498 490 /* clean up */ 499 491 for (int j = 0; j < length; j++) pDelete(&nfPolyMatrix[j]); 500 delete [] nfPolyMatrix;492 omFree(nfPolyMatrix); 501 493 502 494 return iii; … … 534 526 bool l = false; /* Laplace without caching */ 535 527 // bool c = false; /* Laplace with caching */ 536 if ( currRingIsOverIntegralDomain())528 if (rField_is_Domain(currRing)) 537 529 { /* the field case or ring Z */ 538 530 if (minorSize <= 2) b = true; 539 531 else if (vars <= 2) b = true; 540 else if ( currRingIsOverField() && (vars == 3)532 else if ((!rField_is_Ring(currRing)) && (vars == 3) 541 533 && (currRing->cf->ch >= 2) && (currRing->cf->ch <= NV_MAX_PRIME)) 542 534 b = true; … … 547 539 else 548 540 { /* k == 0, i.e., all minors are requested */ 549 int minorCount = binom(rowCount, minorSize); 550 minorCount *= binom(columnCount, minorSize); 551 // if ((minorSize >= 3) && (vars <= 4) 552 // && (minorCount >= 100)) c = true; 553 // else if ((minorSize >= 3) && (vars >= 5) 554 // && (minorCount >= 40)) c = true; 555 /*else*/ l = true; 541 l = true; 556 542 } 557 543 }
Note: See TracChangeset
for help on using the changeset viewer.