Open btel opened 12 years ago
This is because np.diff
is not keeping the length of the output the same than operands. This is not easily supported by a blocking technique, and should be implemented as 'toplevel' function.
Anyway, meanwhile this should raise a NotImplementedError
at very least.
A possible implementation of np.diff for carray could be:
l = len(carr)-1 diff_arr = ca.fromiter((carr[i+1] - carr[i] for i in xrange(l)), 'f8', l)
which is about a 30% faster than np.diff on my machine (but the above only supports unidimensional arrays).
When calculating array derivative (diff) carray shortens the array:
This returns on my computer:
Derivatives calculated with ndarray and carray have different lengths.