pymor.solvers.interface¶
Module Contents¶
- class pymor.solvers.interface.AdjointSolver(solver)[source]¶
Bases:
SolverEquation solver.
Solves operator equations of the form
\[A(U; \mu) = V\]The operator \(A\) can be linear or non-linear. When \(A\) is linear, a solver can also be used to solve the adjoint equation
\[A^H(V; \mu) = U\]for \(U\).
When
least_squaresisTrue, the equations are solved in a least-squares sense:\[\operatorname{argmin}_{U} \|A(U; \mu) - V\|^2 \quad\text{or}\quad \operatorname{argmin}_{V} \|A^H(V; \mu) - U\|^2\]Solvers will typically only work for certain classes of
Operators. In most cases, solvers are invoked by theapply_inverseandapply_inverse_adjointmethods ofOperators. If anOperatorhas no associated solver,DefaultSolveris used.
- class pymor.solvers.interface.Solver[source]¶
Bases:
pymor.core.base.ImmutableObjectEquation solver.
Solves operator equations of the form
\[A(U; \mu) = V\]The operator \(A\) can be linear or non-linear. When \(A\) is linear, a solver can also be used to solve the adjoint equation
\[A^H(V; \mu) = U\]for \(U\).
When
least_squaresisTrue, the equations are solved in a least-squares sense:\[\operatorname{argmin}_{U} \|A(U; \mu) - V\|^2 \quad\text{or}\quad \operatorname{argmin}_{V} \|A^H(V; \mu) - U\|^2\]Solvers will typically only work for certain classes of
Operators. In most cases, solvers are invoked by theapply_inverseandapply_inverse_adjointmethods ofOperators. If anOperatorhas no associated solver,DefaultSolveris used.Methods
Solve operator equation.
Solve adjoint operator equation.
- jacobian_solver = None[source]¶
If not
None, aSolverfor solving linearized equations.Used by
NewtonSolver. Ifopis anOperatorwithop.solvernotNone, thenop.jacobian(U, mu)will inhert thejacobian_solverofop.solver.
- solve(operator, V, mu=None, initial_guess=None, return_info=False)[source]¶
Solve operator equation.
- Parameters:
operator – The
Operator\(A\).V – The right-hand side
VectorArray\(V\).mu – The
parameter valuesfor which to solve the equation.initial_guess –
VectorArraywith the same length asVcontaining initial guesses for the solution. Some solvers ignore this parameter. IfNone, a solver-dependent default is used.return_info – If
True, return a dict with additional information on the solution process (runtime, iterations, residuals, etc.) as a second return value.
- Returns:
U –
VectorArraycontaining the solutions.info – Dict with additional information. Only returned when
return_infoisTrue.
- Raises:
InversionError – The equation could not be solved.
- solve_adjoint(operator, U, mu=None, initial_guess=None, return_info=False)[source]¶
Solve adjoint operator equation.
- Parameters:
operator – The
Operator\(A\).U – The right-hand side
VectorArray\(U\).mu – The
parameter valuesfor which to solve the equation.initial_guess –
VectorArraywith the same length asUcontaining initial guesses for the solution. Some solvers ignore this parameter. IfNone, a solver-dependent default is used.return_info – If
True, return a dict with additional information on the solution process (runtime, iterations, residuals, etc.) as a second return value.
- Returns:
V –
VectorArraycontaining the solutions.info – Dict with additional information. Only returned when
return_infoisTrue.
- Raises:
InversionError – The equation could not be solved.