Changeset 733b51 in git for kernel/linear_algebra/Minor.cc
- Timestamp:
- Mar 16, 2017, 4:29:28 PM (7 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
- 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/Minor.cc
r4fbbed r733b51 15 15 _numberOfRowBlocks = 0; 16 16 _numberOfColumnBlocks = 0; 17 delete [] _rowKey;18 delete [] _columnKey;19 _rowKey = 0;20 _columnKey = 0;17 omFree(_rowKey); 18 _rowKey = NULL; 19 omFree(_columnKey); 20 _columnKey = NULL; 21 21 } 22 22 … … 27 27 28 28 /* allocate memory for new entries in _rowKey and _columnKey */ 29 _rowKey = new unsigned int[_numberOfRowBlocks];30 _columnKey = new unsigned int[_numberOfColumnBlocks];29 _rowKey = (unsigned*)omAlloc(_numberOfRowBlocks*sizeof(unsigned)); 30 _columnKey = (unsigned*)omAlloc(_numberOfColumnBlocks*sizeof(unsigned)); 31 31 32 32 /* copying values from parameter arrays to private arrays */ … … 39 39 MinorKey& MinorKey::operator=(const MinorKey& mk) 40 40 { 41 if (_numberOfRowBlocks != 0) delete [] _rowKey;42 if (_numberOfColumnBlocks != 0) delete [] _columnKey;41 omfree(_rowKey); _rowKey = NULL; 42 omfree(_columnKey); _columnKey = NULL; 43 43 _numberOfRowBlocks = 0; 44 44 _numberOfColumnBlocks = 0; 45 _rowKey = 0;46 _columnKey = 0;47 45 48 46 _numberOfRowBlocks = mk.getNumberOfRowBlocks(); … … 50 48 51 49 /* allocate memory for new entries in _rowKey and _columnKey */ 52 _rowKey = new unsigned int[_numberOfRowBlocks];53 _columnKey = new unsigned int[_numberOfColumnBlocks];50 _rowKey = (unsigned*)omalloc(_numberOfRowBlocks*sizeof(unsigned)); 51 _columnKey = (unsigned*)omalloc(_numberOfColumnBlocks*sizeof(unsigned)); 54 52 55 53 /* copying values from parameter arrays to private arrays */ … … 67 65 { 68 66 /* free memory of _rowKey and _columnKey */ 69 if (_numberOfRowBlocks > 0) { delete [] _rowKey; }70 if (_numberOfColumnBlocks > 0) { delete [] _columnKey; }67 if (_numberOfRowBlocks > 0) { omFree(_rowKey); } 68 if (_numberOfColumnBlocks > 0) { omFree(_columnKey); } 71 69 72 70 _numberOfRowBlocks = lengthOfRowArray; … … 74 72 75 73 /* allocate memory for new entries in _rowKey and _columnKey; */ 76 _rowKey = new unsigned int[_numberOfRowBlocks];77 _columnKey = new unsigned int[_numberOfColumnBlocks];74 _rowKey = (unsigned*)omAlloc(_numberOfRowBlocks*sizeof(unsigned)); 75 _columnKey = (unsigned*)omAlloc(_numberOfColumnBlocks*sizeof(unsigned)); 78 76 79 77 /* copying values from parameter arrays to private arrays */ … … 93 91 94 92 /* allocate memory for new entries in _rowKey and _columnKey */ 95 _rowKey = new unsigned int[_numberOfRowBlocks];96 _columnKey = new unsigned int[_numberOfColumnBlocks];93 _rowKey = (unsigned*)omalloc(_numberOfRowBlocks*sizeof(unsigned)); 94 _columnKey = (unsigned*)omalloc(_numberOfColumnBlocks*sizeof(unsigned)); 97 95 98 96 /* copying values from parameter arrays to private arrays */ … … 108 106 _numberOfRowBlocks = 0; 109 107 _numberOfColumnBlocks = 0; 110 delete [] _rowKey; 111 delete [] _columnKey; 112 _rowKey = 0; 113 _columnKey = 0; 108 omfree(_rowKey); _rowKey = NULL; 109 omfree(_columnKey); _columnKey = NULL; 114 110 } 115 111 … … 487 483 } 488 484 /* free old memory */ 489 delete [] _rowKey; _rowKey = 0; 485 omfree(_rowKey); 486 _rowKey = NULL; 490 487 _numberOfRowBlocks = blockIndex + 1; 491 488 /* allocate memory for new entries in _rowKey; */ 492 _rowKey = new unsigned int[_numberOfRowBlocks];489 _rowKey = (unsigned*)omAlloc(_numberOfRowBlocks*sizeof(unsigned)); 493 490 /* copying values from mk to this MinorKey */ 494 491 for (int r = 0; r < blockIndex; r++) … … 527 524 } 528 525 /* free old memory */ 529 delete [] _columnKey; _columnKey = 0;526 omfree(_columnKey); _columnKey = NULL; 530 527 _numberOfColumnBlocks = blockIndex + 1; 531 528 /* allocate memory for new entries in _columnKey; */ 532 _columnKey = new unsigned int[_numberOfColumnBlocks];529 _columnKey = (unsigned*)omAlloc(_numberOfColumnBlocks*sizeof(unsigned)); 533 530 /* copying values from mk to this MinorKey */ 534 531 for (int c = 0; c < blockIndex; c++) … … 607 604 { /* In this case, _rowKey is too small. */ 608 605 /* free old memory */ 609 delete [] _rowKey; _rowKey = 0;606 omFree(_rowKey); _rowKey = NULL; 610 607 _numberOfRowBlocks = newBitBlockIndex + 1; 611 608 /* allocate memory for new entries in _rowKey; */ 612 _rowKey = new unsigned int[_numberOfRowBlocks];609 _rowKey = (unsigned*)omAlloc(_numberOfRowBlocks*sizeof(unsigned)); 613 610 /* initializing entries to zero */ 614 611 for (int r = 0; r < _numberOfRowBlocks; r++) _rowKey[r] = 0; … … 739 736 { /* In this case, _columnKey is too small. */ 740 737 /* free old memory */ 741 delete [] _columnKey; _columnKey = 0;738 omFree( _columnKey); _columnKey = NULL; 742 739 _numberOfColumnBlocks = newBitBlockIndex + 1; 743 740 /* allocate memory for new entries in _columnKey; */ 744 _columnKey = new unsigned int[_numberOfColumnBlocks];741 _columnKey = (unsigned*)omAlloc(_numberOfColumnBlocks*sizeof(unsigned)); 745 742 /* initializing entries to zero */ 746 743 for (int c = 0; c < _numberOfColumnBlocks; c++) _columnKey[c] = 0;
Note: See TracChangeset
for help on using the changeset viewer.