Skip to content
Get started

eqiora.solve

← Python API index

Linear, nonlinear, and eigenvalue solver settings.

View source

Example: configure linear and nonlinear tolerances

Section titled “Example: configure linear and nonlinear tolerances”
python
from eqiora import solve
linear = solve.Linear(objective=solve.Robust, relative_tolerance=1e-10, absolute_tolerance=1e-12,
maximum_iterations=1000)
nonlinear = solve.Newton(linear=linear, absolute_tolerance=1e-10,
maximum_iterations=20)
print(nonlinear.maximum_iterations)

Pass linear or nonlinear as solve= in eqiora.resolve. Newton uses the nested linear policy for each update. A smaller tolerance requests a more accurate algebraic solve; mesh refinement and time-step accuracy are separate choices. See modeling for full solver setups.

Absolute tolerances for constraint operands, in physical units.

python
@final
class ConstraintTolerance:
@staticmethod
def inequality(reference: ConstraintRef, value: float, dimension: Dimension) -> ConstraintTolerance: ...
@staticmethod
def complementarity(reference: ConstraintRef, left_value: float, left_dimension: Dimension, right_value: float, right_dimension: Dimension) -> ConstraintTolerance: ...
@property
def reference(self) -> ConstraintRef: ...
@property
def left_value(self) -> float: ...
@property
def left_dimension(self) -> Dimension: ...
@property
def right_value(self) -> float | None: ...
@property
def right_dimension(self) -> Dimension | None: ...

Enforce affine inequality constraints with an active-set method.

python
@final
class ActiveSet:
def __new__(cls, *, tolerances: tuple[ConstraintTolerance, ...], max_active_sets: int) -> Self: ...
@property
def tolerances(self) -> tuple[ConstraintTolerance, ...]: ...
@property
def model_digest(self) -> str: ...
@property
def max_active_sets(self) -> int: ...

Keep a nonlinear solve strictly inside its inequality constraints, by explicit positive margins.

python
@final
class StrictInterior:
def __new__(cls, *, margins: tuple[ConstraintTolerance, ...]) -> Self: ...
@property
def margins(self) -> tuple[ConstraintTolerance, ...]: ...
@property
def model_digest(self) -> str: ...

Objective used by the automatic (serial, CPU) solver planner.

python
@final
class SolverPlanningObjective:
Robust: ClassVar[SolverPlanningObjective]
Fast: ClassVar[SolverPlanningObjective]
LowMemory: ClassVar[SolverPlanningObjective]
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...

Prefer a solver with reproducible reductions.

python
Robust: Final[SolverPlanningObjective]

Prefer fast reductions, then a direct solver.

python
Fast: Final[SolverPlanningObjective]

Prefer iterative solvers over direct factorization. Memory use is not guaranteed to be lower.

python
LowMemory: Final[SolverPlanningObjective]

Linear solve settings for the Model operator.

Either give an objective and let the planner choose, or give all of algorithm, preconditioner, reduction, and provider. Partial or mixed settings are rejected before resolution.

python
@final
class Linear:
def __new__(cls, *, relative_tolerance: float, absolute_tolerance: float, maximum_iterations: int, objective: SolverPlanningObjective | None=None, algorithm: LinearSolver | None=None, preconditioner: Preconditioner | None=None, reduction: Reduction | None=None, provider: SolverProvider | None=None) -> Self: ...
@property
def relative_tolerance(self) -> float: ...
@property
def absolute_tolerance(self) -> float: ...
@property
def maximum_iterations(self) -> int: ...
@property
def objective(self) -> SolverPlanningObjective | None: ...
@property
def algorithm(self) -> LinearSolver | None: ...
@property
def preconditioner(self) -> Preconditioner | None: ...
@property
def reduction(self) -> Reduction | None: ...
@property
def provider(self) -> SolverProvider | None: ...
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...

Dense Hermitian eigenvalue solve with an explicit provider and settings.

python
@final
class HermitianEigen:
def __new__(cls, *, count: int, provider: SolverProvider, residual_tolerance: float, normalization_tolerance: float, target: tuple[float, Dimension] | None=None, interval: tuple[tuple[float, Dimension], tuple[float, Dimension]] | None=None) -> HermitianEigen: ...
@property
def count(self) -> int: ...
@property
def provider(self) -> SolverProvider: ...
@property
def residual_tolerance(self) -> float: ...
@property
def normalization_tolerance(self) -> float: ...
@property
def target(self) -> tuple[float, Dimension] | None: ...
@property
def interval(self) -> tuple[tuple[float, Dimension], tuple[float, Dimension]] | None: ...

Resolved Hermitian eigenproblem: where each matrix comes from and how coordinates map to the model.

python
@final
class EigenPlanView:
@property
def mode_field(self) -> FieldRef: ...
@property
def eigenvalue_field(self) -> FieldRef: ...
@property
def coordinate_embeddings(self) -> tuple[EigenCoordinateMap, ...]: ...
@property
def excluded_space(self) -> EigenExclusion | None: ...

One coordinate relation target = mapping * coordinate from the model.

python
@final
class EigenCoordinateMap:
@property
def relation_id(self) -> str: ...
@property
def target_field(self) -> FieldRef: ...
@property
def coordinate_field(self) -> FieldRef: ...
@property
def mapping(self) -> Any: ...
@property
def mapping_type(self) -> ValueType: ...

Directions removed from the eigenproblem, with separate nullspace tests for the operator and the metric.

Defects are normalized Frobenius norms of the operator or metric acting on the excluded directions. The null flags compare them with the Plan’s residual tolerance; they do not identify a physical gauge. The dimensionless projector can be oblique in coefficient space.

python
@final
class EigenExclusion:
@property
def dimension(self) -> int: ...
@property
def projector(self) -> Any: ...
@property
def projector_type(self) -> ValueType: ...
@property
def operator_defect(self) -> float: ...
@property
def metric_defect(self) -> float: ...
@property
def tolerance(self) -> float: ...
@property
def is_operator_null(self) -> bool: ...
@property
def is_metric_null(self) -> bool: ...

Resolved finite algebraic solve, including the list of unknowns.

python
@final
class AlgebraicPlanView:
@property
def kind(self) -> str: ...
@property
def unknown_count(self) -> int: ...

Linear solver algorithm.

python
@final
class LinearSolver:
ConjugateGradient: ClassVar[LinearSolver]
MinimumResidual: ClassVar[LinearSolver]
BiConjugateGradientStabilized: ClassVar[LinearSolver]
SparseLu: ClassVar[LinearSolver]
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...

Preconditioner.

python
@final
class Preconditioner:
Identity: ClassVar[Preconditioner]
Jacobi: ClassVar[Preconditioner]
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...

Floating-point reduction order for the linear solve.

Reproducible fixes the order; Fast uses the backend-native order.

python
@final
class Reduction:
Reproducible: ClassVar[Reduction]
Fast: ClassVar[Reduction]
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...

A compiled solver backend, identified by name and release.

python
@final
class SolverProvider:
@staticmethod
def reference() -> SolverProvider: ...
@staticmethod
def faer() -> SolverProvider: ...
@property
def id(self) -> str: ...
@property
def implementation_version(self) -> str: ...
@property
def libraries(self) -> list[tuple[str, str]]: ...
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...

Newton solver settings, including the nested linear solve.

Resolution may require the nested linear tolerances to be at least as strict as the Newton absolute tolerance, so that an unconverged iteration cannot stop on a zero correction.

python
@final
class Newton:
def __new__(cls, *, linear: Linear, relative_tolerance: float=1e-09, absolute_tolerance: float=1e-11, maximum_iterations: int=16, maximum_line_search_steps: int=12) -> Self: ...
@property
def linear(self) -> Linear: ...
@property
def relative_tolerance(self) -> float: ...
@property
def absolute_tolerance(self) -> float: ...
@property
def maximum_iterations(self) -> int: ...
@property
def maximum_line_search_steps(self) -> int: ...
def __eq__(self, other: object, /) -> bool: ...
def __hash__(self) -> int: ...
def __repr__(self) -> str: ...

Linear algorithm, operator class, and provider chosen during resolution.

python
@final
class ResolvedLinear:
@property
def algorithm(self) -> str: ...
@property
def preconditioner(self) -> str: ...
@property
def reduction(self) -> str: ...
@property
def relative_tolerance(self) -> float: ...
@property
def absolute_tolerance(self) -> float: ...
@property
def maximum_iterations(self) -> int: ...
@property
def operator(self) -> str: ...
@property
def backend(self) -> str: ...
@property
def backend_version(self) -> str: ...
@property
def provider(self) -> SolverProvider: ...
@property
def objective(self) -> SolverPlanningObjective | None: ...
@property
def planning_policy_id(self) -> str | None: ...
@property
def selected_candidate_id(self) -> str | None: ...
@property
def selected_evidence_case(self) -> str | None: ...
@property
def planning_reasons(self) -> list[tuple[str, str]]: ...
def __repr__(self) -> str: ...

Newton settings and the nested linear solver chosen during resolution.

python
@final
class ResolvedNewton:
@property
def linear(self) -> ResolvedLinear: ...
@property
def relative_tolerance(self) -> float: ...
@property
def absolute_tolerance(self) -> float: ...
@property
def maximum_iterations(self) -> int: ...
@property
def maximum_line_search_steps(self) -> int: ...
def __repr__(self) -> str: ...