[Numpy-discussion] RAM problem during code execution - Numpya arrays
Fri Aug 23 11:15:33 CDT 2013
On 23 August 2013 16:59, Benjamin Root <email@example.com> wrote:
> A lot of the code you have here can be greatly simplified. I would start
> with just trying to get rid of appends as much as possible and use
> preallocated arrays with np.empty() or np.ones() or the likes.
Also, if you don't know beforehand the final size of the array (I find
difficult to follow the flow of the program, it is quite lengthy), you
can use lists as a temporary thing:
results = 
results = np.array(res)
Also, it may also help to trace things down encapsulate pieces of code
inside functions. There are two reasons for this: it will make the
code more readable, easier to test, and you could run independently
pieces of code to find where is your memory growing.
I hope it is of any help.
More information about the NumPy-Discussion