tests_inversion.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:stfinv 作者: seismology 项目源码 文件源码
def test_create_Toeplitz():
    from stfinv.utils.inversion import _create_Toeplitz
    # even length
    d1 = np.array([1., 0., 0., 0., 1., 2., 1., 0., 0., 1])
    d2 = np.array([0., 0., 1., 3., 2., 1., 0., 0., 0., 0])

    G = _create_Toeplitz(d2)
    npt.assert_allclose(np.matmul(G, d1),
                        np.convolve(d1, d2, 'same'),
                        atol=1e-7, rtol=1e-7)

    # odd length
    d1 = np.array([1., 0., 0., 0., 1., 2., 1., 0., 0.])
    d2 = np.array([0., 0., 1., 3., 2., 1., 0., 0., 0.])

    G = _create_Toeplitz(d2)
    npt.assert_allclose(np.matmul(G, d1),
                        np.convolve(d1, d2, 'same'),
                        atol=1e-7, rtol=1e-7)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号