Resize array
| 71 | |
| 72 | // Resize array |
| 73 | void Array2::resize(int nrows, int ncols, long* data) |
| 74 | { |
| 75 | if (nrows < 0) throw std::invalid_argument("Array2 nrows less than 0"); |
| 76 | if (ncols < 0) throw std::invalid_argument("Array2 ncols less than 0"); |
| 77 | if (nrows == _nrows && ncols == _ncols) return; |
| 78 | deallocateMemory(); |
| 79 | _nrows = nrows; |
| 80 | _ncols = ncols; |
| 81 | if (!data) |
| 82 | { |
| 83 | allocateMemory(); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | _ownData = false; |
| 88 | _buffer = data; |
| 89 | allocateRows(); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | void Array2::resize(int nrows, int ncols) |
| 94 | { |