I am wondering why numpy.zeros takes up such little space?
x = numpy.zeros(200000000)
This takes up no memory while,
x = numpy.repeat(0,200000000)
takes up around 1.5GB. Does numpy.zeros create an array of empty pointers? If so, is there a way to set the pointer back to empty in the array after changing it in cython? If I use:
x = numpy.zeros(200000000)
x[0:200000000] = 0.0
The memory usage goes way up. Is there a way to change a value, and then change it back to the format numpy.zeros originally had it in python or cython?
x = numpy.zeros(200000000)thenx.nbytesis1600000000on my machine. Forx = numpy.repeat(0, 200000000)half that memory is used (theint32datatype instead of thefloat64datatype is used when creating the array).x[0:10]=1. Does the whole array get allocated or only the required slice? Will check tomorrow :-)