test_pyshearlab.py 文件源码

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

项目:pyshearlab 作者: stefanloock 项目源码 文件源码
def test_adjoint(dtype, shearletSystem):
    """Validate the adjoint."""
    shape = tuple(shearletSystem['size'])

    # load data
    X = np.random.randn(*shape).astype(dtype)

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

    # adjoint
    Xadj = pyshearlab.SLshearadjoint2D(coeffs, shearletSystem)
    assert Xadj.dtype == X.dtype
    assert Xadj.shape == X.shape

    # <Ax, Ax> should equal <x, AtAx>
    assert (pytest.approx(np.vdot(coeffs, coeffs), rel=1e-3, abs=0) ==
            np.vdot(X, Xadj))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号