Utilities

pytential.solve.gmres(op, rhs, restart=None, tol=None, x0=None, inner_product=None, maxiter=None, hard_failure=None, no_progress_factor=None, stall_iterations=None, callback=None, progress=False, require_monotonicity=True)[source]

Solve a linear system Ax=b by means of GMRES with restarts.

Parameters
  • op – a callable to evaluate A(x)

  • b – the right hand side

  • restart – the maximum number of iteration after which GMRES algorithm needs to be restarted

  • tol – the required decrease in residual norm

  • inner_product – Must have an interface compatible with numpy.vdot(). Must return a host scalar.

  • maxiter – the maximum number of iteration permitted

  • hard_failure – If True, raise GMRESError in case of failure.

  • stall_iterations – Number of iterations with residual decrease below no_progress_factor indicates stall. Set to 0 to disable stall detection.

Returns

a GMRESResult

class pytential.solve.GMRESResult[source]
solution
residual_norms
iteration_count
success

a bool indicating whether the iteration succeeded

state

a verbal description of the outcome of the iteration

exception pytential.solve.GMRESError[source]
class pytential.solve.ResidualPrinter(inner_product=None)[source]