test_pyshearlab.py 文件源码

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

项目:pyshearlab 作者: stefanloock 项目源码 文件源码
def test_adjoint_of_inverse(dtype, shearletSystem):
    """Validate the adjoint of the inverse."""
    X = np.random.randn(*shearletSystem['size']).astype(dtype)

    # decomposition
    coeffs = pyshearlab.SLsheardec2D(X, shearletSystem)

    # reconstruction
    Xrec = pyshearlab.SLshearrec2D(coeffs, shearletSystem)
    Xrecadj = pyshearlab.SLshearrecadjoint2D(Xrec, shearletSystem)
    assert Xrecadj.dtype == X.dtype
    assert Xrecadj.shape == coeffs.shape

    # <A^-1x, A^-1x> = <A^-* A^-1 x, x>.
    assert (pytest.approx(np.vdot(Xrec, Xrec), rel=1e-3, abs=0) ==
            np.vdot(Xrecadj, coeffs))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号