fips.linalg.dottest#

fips.linalg.dottest(op, rtol=1e-12, seed=0)[source]#

Check that op.rmatvec is the adjoint of op.matvec.

For random x and y, <op x, y> must equal <x, op^T y> to within rtol of |op x| |y| + |x| |op^T y|, the size of the terms the two inner products are summed from.

Parameters:
  • op (LinearOperator) – The operator to test: any SciPy linear operator, a fips form among them.

  • rtol (float) – Relative tolerance.

  • seed (int | None) – Seed of the random vectors.

Returns:

True if the two inner products agree.

Return type:

bool

Examples

>>> import numpy as np
>>> from fips.linalg import DenseOperator, dottest
>>> dottest(DenseOperator(np.arange(6.0).reshape(2, 3)))
True