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