conatus.expert.HillBlocks¶
- class conatus.expert.HillBlocks(*, diag, couplings, Nh, size, label, omega=1.0, notes=(), mass=None)[source]¶
Bases:
objectBlock-banded Hill matrix M(μ) with half-width M = max |m| of the couplings.
diag(μ, n) -> (m, m) block of harmonic n (includes (μ + i n ω) M); couplings[m] couples x_{n-m} into block row n (m ≠ 0, constant in μ). Nh >= M is required.
- Parameters:
diag (Callable[[complex, int], np.ndarray])
couplings (Mapping[int, np.ndarray])
Nh (int)
size (int)
label (str)
omega (float)
notes (tuple[str, ...])
mass (np.ndarray | None)
- property harmonics: list[int]¶
- factor(mu)[source]¶
Block-Thomas on super-blocks: S_k = D_k - L_k S_{k-1}⁻¹ U_{k-1} (partial-pivot LU inside each super-block, no pivoting across them).
Block-Thomas needs every intermediate Schur complement S_k (k < last) to be well conditioned: a regular Hill matrix can have a singular S_k (finding 11: det -2j, cond 4.98, and slogdet / solve came back NaN). When the reciprocal condition of an intermediate S_k is below
THOMAS_RCOND_MIN, the whole matrix is factored instead by a banded LU with partial pivoting across super-blocks (LAPACK gbtrf, still linear in Nh);factorization.methodsays which one ran. The last S_k may be singular: then M(μ) is (μ is an exponent).- Parameters:
mu (complex)
- Return type:
HillFactorization | BandedHillFactorization
- solve(mu, rhs)[source]¶
M(μ) x = rhs with its normwise backward error checked: above
SOLVE_BACKWARD_ERROR_MAXthe banded pivoted LU is tried, then NumericalError (never a NaN or an inaccurate solution passed on).- Parameters:
mu (complex)
rhs (ndarray)
- Return type:
ndarray
- backward_error(mu, x, rhs)[source]¶
‖M x - b‖∞ / (‖M‖∞ ‖x‖∞ + ‖b‖∞) (normwise backward error; NaN -> inf).
- Parameters:
mu (complex)
x (ndarray)
rhs (ndarray)
- Return type:
float
- matvec(mu, x)[source]¶
M(μ) x for x of shape (2Nh+1, size).
- Parameters:
mu (complex)
x (ndarray)
- Return type:
ndarray
- dense(mu)[source]¶
Assembled M(μ), small problems and oracles only.
- Parameters:
mu (complex)
- Return type:
ndarray
- winding(center, radius, n_points)[source]¶
Winding number of det M on |μ - center| = radius (an integer, certified by the adaptive walk of
conatus.floquet.roots.adaptive_winding(); ConvergenceError when the walk cannot certify it).n_points: initial points on the circle.- Parameters:
center (complex)
radius (float)
n_points (int)
- Return type:
float