Skip to content

Commit bd8b98f

Browse files
committed
Remove comparison example script; warn at TPI start if sparse falls back to dense
1 parent 6adc9dd commit bd8b98f

2 files changed

Lines changed: 5 additions & 254 deletions

File tree

examples/run_sparse_FOC_jac_compare.py

Lines changed: 0 additions & 254 deletions
This file was deleted.

ogcore/TPI.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def _detect_jac_sparsity(fun, x0, args, thr_rel=1e-9):
9595
groups = group_columns(P)
9696
if int(groups.max()) + 1 < n // 2:
9797
result = (P, groups)
98+
# else: pattern not sparse enough to benefit (expected at small
99+
# firstdoughnutring dims); silently return None so the caller uses
100+
# dense FD without surfacing a noisy notice.
98101
except Exception:
99102
result = None
100103
_BANDED_JAC_CACHE[key] = result
@@ -734,6 +737,8 @@ def run_TPI(p, client=None):
734737
results
735738
736739
"""
740+
if p.use_sparse_FOC_jac and not _HAVE_SPARSE_FD:
741+
print("[TPI] sparse FOC jacobian unavailable; using dense")
737742
# unpack tuples of parameters
738743
initial_values, ss_vars, theta, baseline_values = get_initial_SS_values(p)
739744
B0, b_sinit, b_splus1init, factor, initial_b, initial_n = initial_values

0 commit comments

Comments
 (0)