helper.py¶
Source: tests/helper.py
Helper/Utilities for test functions.
- dotproduct_adjointness_test(operator: Operator, u: torch.Tensor, v: torch.Tensor, relative_tolerance: float = 0.001, absolute_tolerance: float = 1e-05) None
Test the adjointness of linear operator and operator.H.
Test if <Operator(u),v> == <u, Operator^H(v)> for one u ∈ domain and one v ∈ range of Operator. and if the shapes match.
Note: This property should hold for all u and v. Commonly, this function is called with two random vectors u and v.
Parameters ———- operator linear operator u element of the domain of the operator v element of the range of the operator relative_tolerance default is pytorch’s default for float16 absolute_tolerance default is pytorch’s default for float16
Raises —— AssertionError if the adjointness property does not hold AssertionError if the shape of operator(u) and v does not match if the shape of u and operator.H(v) does not match