Internal utility modules
These helpers are shared across algorithms, problem classes, and analysis/solver modules.
Public API docs using these helpers are surfaced through Solver backends and API reference.
Module map
Module |
Responsibility |
|---|---|
Scalar, index, and finite-array validation helpers. |
|
Symmetric-matrix construction helpers. |
|
Protocol-based structural typing aliases for optional solver backends. |
Package namespace
Validation helpers
Validation helpers shared across algorithms and problem classes.
- autolyap.utils.validation.ensure_finite_array( ) None[source]
Raise if array contains non-finite entries (NaN or inf).
- autolyap.utils.validation.ensure_index_list( ) List[int][source]
Validate a sorted, duplicate-free component-index list.
The returned list is guaranteed to contain integers in
[1, m]in strictly increasing order.
- autolyap.utils.validation.ensure_integral(
- value: int | float | integer | floating,
- name: str,
- minimum: int | None = None,
- maximum: int | None = None,
Validate and normalize an integer-valued scalar.
Rejects booleans explicitly and optionally enforces lower/upper bounds.
- autolyap.utils.validation.ensure_m_bar_list( ) List[int][source]
Validate per-component evaluation counts.
Ensures the sequence length equals
mand every entry is an integer strictly greater than zero.
- autolyap.utils.validation.ensure_real_number(
- value: int | float | integer | floating,
- name: str,
- finite: bool = False,
- minimum: float | None = None,
- maximum: float | None = None,
Validate and normalize a real-valued scalar.
Rejects booleans and NaNs explicitly. Optional flags enforce finiteness and lower/upper bounds.
Symmetric-matrix helpers
- autolyap.utils.helper_functions.create_symmetric_matrix(
- upper_triangle_values: UpperTriangleValuesProtocol,
- n: int,
Convert a list of upper triangle values to a symmetric matrix.
Parameters
upper_triangle_values: List of length \(n(n+1)/2\) containing the upper triangle and diagonal values.
n: Size of the symmetric matrix.
Returns
Symmetric matrix of size \(n \times n\).
Raises
ValueError: If the length of upper_triangle_values is not \(n(n+1)/2\).
- autolyap.utils.helper_functions.create_symmetric_matrix_expression(
- Xij: MosekUpperTriangleVectorProtocol,
- n: int,
Convert a list of upper triangle variables to a symmetric matrix expression.
Parameters
Xij: MOSEK variable containing the upper triangle and diagonal values.
n: Size of the symmetric matrix.
Returns
Symmetric matrix expression of size \(n \times n\).
Backend typing protocols
Shared structural typing protocols for optional solver backends.
- class autolyap.utils.backend_types.CvxpyModuleProtocol(
- *args,
- **kwargs,
Subset of the CVXPY module API used by AutoLyap.
- class autolyap.utils.backend_types.CvxpyStatusModuleProtocol(
- *args,
- **kwargs,
Subset of CVXPY status constants used by AutoLyap.
- class autolyap.utils.backend_types.CvxpyValueHandleProtocol(
- *args,
- **kwargs,
Protocol for solved CVXPY handles exposing
value.
- class autolyap.utils.backend_types.MosekExprProtocol(
- *args,
- **kwargs,
Subset of
mosek.fusion.Exprused in helper builders.
- class autolyap.utils.backend_types.MosekFusionModuleProtocol(
- *args,
- **kwargs,
Subset of MOSEK Fusion module attributes used by AutoLyap.
- class autolyap.utils.backend_types.MosekLevelHandleProtocol(
- *args,
- **kwargs,
Protocol for solved MOSEK handles exposing
level().
- class autolyap.utils.backend_types.MosekModelProtocol(
- *args,
- **kwargs,
Protocol for MOSEK Fusion model parameter forwarding.
- class autolyap.utils.backend_types.MosekUpperTriangleSolutionHandleProtocol(
- *args,
- **kwargs,
Protocol for MOSEK upper-triangle handles reused after solve.
- class autolyap.utils.backend_types.MosekUpperTriangleVectorProtocol(
- *args,
- **kwargs,
Protocol for MOSEK upper-triangle vector handles.
- class autolyap.utils.backend_types.SupportsScalarProduct(
- *args,
- **kwargs,
Protocol for scalar-like symbols participating in backend products.