13 Jul
2004
13 Jul
'04
9:01 a.m.
Mike Zingale wrote:
Hi, I am trying to efficiently compute a difference of two 2-d flux arrays, as arises quite commonly in finite-difference/finite-volume methods. Ex:
a = arange(64) a.shape = (8,8)
I want to do create a new array, b, of shape such that
b[i,j] = a[i,j] - a[i-1,j]
for 1 <= i < 8 0 <= i < 8
Try b = a[1:] - a[:-1] -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter