If I have z = cumsum( [ 0, 1, 2, 6, 9 ] ), which gives me z = [ 0, 1, 3, 9, 18 ], how can I get back to the original array [ 0, 1, 2, 6, 9 ]<
z = cumsum( [ 0, 1, 2, 6, 9 ] )
z = [ 0, 1, 3, 9, 18 ]
[ 0, 1, 2, 6, 9 ]<
My favorite:
orig = np.r_[z[0], np.diff(z)]