types ¤
Core data structures for Circulax rational fitting.
Classes:
| Name | Description |
|---|---|
FitOptions | Fitting hyperparameters. |
SSModel | State-space model with diagonal A. |
VFModel | Pole-residue model. |
Functions:
| Name | Description |
|---|---|
eval_model | Evaluate model at all frequency points. |
ss_to_vfmodel | Convert SSModel back to VFModel. |
vfmodel_to_ss | Convert VFModel (pole-residue) to SSModel (state-space). |
FitOptions dataclass ¤
FitOptions(
N: int,
asymp: int = 2,
stable: bool = True,
relax: bool = True,
weightparam: int = 1,
Niter1: int = 4,
Niter2: int = 4,
parametertype: str = "Y",
TOLG: float = 1e-06,
TOLD: float = 0.001,
TOLE: float = 1e-12,
Niter_out: int = 20,
passive_DE: bool = False,
nu: float = 0.001,
)
Fitting hyperparameters.
Frozen so the instance can be used as a JIT static argument (it is hashable).
SSModel dataclass ¤
State-space model with diagonal A.
Represents: H(s) = C * diag(1/(s - A)) * B + D + s*E A is stored as a 1-D vector of diagonal entries to avoid materialising the large sparse block-diagonal matrix.
VFModel dataclass ¤
Pole-residue model.
Represents: H(s) = sum_m residues[:, :, m] / (s - poles[m]) + D + s*E
eval_model ¤
Evaluate model at all frequency points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
s | ndarray | (Ns,) complex frequency points (= j*omega). | required |
ss | SSModel | SSModel. | required |
Returns:
| Name | Type | Description |
|---|---|---|
H | ndarray | (Ns, Nc, Nc) complex — model response at each frequency. |
Source code in circulax/fitting/types.py
ss_to_vfmodel ¤
Convert SSModel back to VFModel.
Inverse of vfmodel_to_ss. Equivalent to ss2pr.
Source code in circulax/fitting/types.py
vfmodel_to_ss ¤
Convert VFModel (pole-residue) to SSModel (state-space).
Equivalent to pr2ss.m.
For Nc ports and N poles, the block-diagonal structure is: A (as vector): [poles, poles, ..., poles] (repeated Nc times) → (NcN,) B[nN:(n+1)N, n] = 1, rest 0 (NcN, Nc) C[row, colN:(col+1)N] = residues[row, col, :] (Nc, Nc*N)