代码之家  ›  专栏  ›  技术社区  ›  azal

用标度平方法代替欧拉法的积分

  •  0
  • azal  · 技术社区  · 6 年前

    我试图在python中实现moler和van loan,2003;arsigny等人,2006b,a.中描述的用于集成的缩放和平方方法。该方法基本上说明,如果时间步数是2的幂,那么可以通过缩放和平方方法来确定解。有关该方法的说明,见附文第3页。 https://ufile.io/8xdx7 是的。

    附言:不是家庭作业什么的。我只是想优化我已经使用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.
    
    0 回复  |  直到 6 年前