python - How to get the cumulative sum of numpy array in-place -
i want compute integral image. example
a=array([(1,2,3),(4,5,6)]) b = a.cumsum(axis=0)
this generate array b.can execute cumsum
in-place. if not . there other methods that
you have pass argument out
:
np.cumsum(a, axis=1, out=a)
obs: array 2-d array, can use axis=0
sum along rows , axis=1
sum along columns.
Comments
Post a Comment