我正在尝试用Python实现缩放和平方的集成方法,如Moler和Van Loan,2003年所述; Arsigny等,2006b,a。该方法基本上指出,如果时间步长是2的幂,则可以通过缩放和平方方法确定解决方案。附件https://ufile.io/8xdx7的第3页中提供了该方法的说明。
P.S:这不是功课之类的东西。我只是想优化我的已经使用Euler方法但很慢的功能代码。
shape = image.shape
dx = np.random.normal(0, 10, shape)
dy = np.random.normal(0, 1, shape)
dx = gaussian_filter(dx, 10)
dy = gaussian_filter(dy, 10)
# dx = gaussian_filter((random_state.rand(*shape) * 2 - 1), sigma, mode="constant", cval=0) * alpha
# dy = gaussian_filter((random_state.rand(*shape) * 2 - 1), sigma, mode="constant", cval=0) * alpha
han_window_1 = np.hanning(shape[0])
han_window_2 = np.hanning(shape[1])
for i in range(0, shape[1]):
dy[:,i] = dy[:,i] * han_window_1
for i in range(0, shape[0]):
dx[i,:] = dx[i,:] * han_window_2
# here I want to integrate dx and dy using the aforementioned method instead of Euler's method.