MCPcopy Create free account
hub / github.com/numpy/numpy / resize

Method resize

tools/swig/test/Array2.cxx:73–91  ·  view source on GitHub ↗

Resize array

Source from the content-addressed store, hash-verified

71
72// Resize array
73void 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
93void Array2::resize(int nrows, int ncols)
94{

Callers 1

allocateRowsMethod · 0.45

Calls 1

resizeFunction · 0.50

Tested by

no test coverage detected