Skip to content

Commit e44b6da

Browse files
authored
Regselect: catch errors in refit() (#77)
* catch error in refit() during regselect() * test on Python 3.13 * allow Tikhonov regularizations to be None at initialization * regselect: ensure ROM is fit() once correctly * Hyeonghun pre-print * small TimedBlock test coverage * POD method of snapshots warning * update version and changelog
1 parent b1c2385 commit e44b6da

File tree

12 files changed

+279
-82
lines changed

12 files changed

+279
-82
lines changed

.github/workflows/test_src.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- "3.10"
2727
- "3.11"
2828
- "3.12"
29+
- "3.13"
2930
runs-on: ${{ matrix.os }}
3031
steps:
3132
- uses: actions/checkout@v4

docs/literature.bib

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,3 +656,13 @@ @article{vijaywargiya2025tensoropinf
656656
doi = {10.48550/arXiv.2502.10888},
657657
category = {structure}
658658
}
659+
660+
@article{kang2025semiconductor,
661+
title = {Parametric {O}perator {I}nference to simulate the purging process in semiconductor manufacturing},
662+
author = {Seunghyon Kang and Hyeonghun Kim and Boris Kramer},
663+
journal = {arXiv},
664+
volume = {2504.03990},
665+
year = {2025},
666+
doi = {10.48550/arXiv.2504.03990},
667+
category = {application}
668+
}

docs/source/opinf/changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
New versions may introduce substantial new features or API adjustments.
66
:::
77

8+
## Version 0.5.14
9+
10+
- Catch any errors in `fit_regselect*()` that occur when the model uses `refit()`.
11+
- Tikhonov-type least-squares solvers do not require the regularizer in the constructor but will raise an `AttributeError` in `solve()` (and other methods) if the regularizer is not set. This makes using `fit_regselect_*()` much less cumbersome.
12+
- `PODBasis.fit(Q)` raises a warning when using the `"method-of-snapshots"`/`"eigh"` strategy if $n < k$ for $\mathbf{Q}\in\mathbb{R}^{n \times k}.$ In this case, calculating the $n \times k$ SVD is likely more efficient than the $k \times k$ eigenvalue problem.
13+
- Added Python 3.13 to list of tests.
14+
815
## Version 0.5.13
916

1017
Bayesian operator inference:

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ dependencies = [
3939
[project.optional-dependencies]
4040
dev = [
4141
"bibtexparser>=2.0.0b7",
42-
"tox>=4",
43-
"pre-commit>=3.7.1",
44-
"flake8==7.0.0",
4542
"black==24.4.2",
43+
"flake8==7.0.0",
4644
"jupyterlab",
47-
"pandas",
4845
"notebook",
46+
"pandas",
47+
"pre-commit>=3.7.1",
48+
"tox>=4",
4949
]
5050

5151
[project.urls]

src/opinf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
https://github.com/Willcox-Research-Group/rom-operator-inference-Python3
88
"""
99

10-
__version__ = "0.5.13"
10+
__version__ = "0.5.14"
1111

1212
from . import (
1313
basis,

src/opinf/basis/_pod.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def method_of_snapshots(
7272
----------
7373
states : (n, k) ndarray,
7474
Snapshot matrix :math:`\Q` from which to compute the POD vectors.
75+
This method is computationally efficient when n >> k.
7576
inner_product_matrix : (n, n) sparse SPD matrix or None
7677
Spatial inner product matrix :math:`\W` for measuring how different
7778
indices in the snapshot matrix interact with each other.
@@ -100,7 +101,13 @@ def method_of_snapshots(
100101
any negative eigenvalues, then ``minthresh`` is increased to the absolute
101102
value of the most negative eigenvalue.
102103
"""
103-
n_states = states.shape[1]
104+
state_dimension, n_states = states.shape
105+
if n_states > state_dimension:
106+
warnings.warn(
107+
"state dimension < number of states, "
108+
"method-of-snapshots / eigh may be inefficient",
109+
errors.OpInfWarning,
110+
)
104111
if inner_product_matrix is None:
105112
gramian = states.T @ (states / n_states)
106113
else:
@@ -113,7 +120,7 @@ def method_of_snapshots(
113120
eigvals = eigvals[::-1]
114121
eigvecs = eigvecs[:, ::-1]
115122

116-
# NOTE: By definition the Gramian is symmetric positive semi-definite.
123+
# By definition the Gramian is symmetric positive semi-definite.
117124
# If any eigenvalues are smaller than zero, they are only measuring
118125
# numerical error and can be truncated.
119126
positives = eigvals > max(minthresh, abs(np.min(eigvals)))

0 commit comments

Comments
 (0)