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))
评论列表
文章目录