Skip to content

Commit 7b5775d

Browse files
committed
Allow fast poles through in state-space fitting
Remove early termination from the Hankel-SVD order selection loop. Previously, the fitter stopped at the first order exceeding the R² threshold, preventing higher-order fast-decaying poles from being included. Now all orders up to max_order are evaluated and the best R² is kept, reducing the characteristic post-first-lobe lag in time-domain responses.
1 parent ce07b95 commit 7b5775d

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/hydro/radiation/radiation_ss_fitter.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,19 @@ StateSpaceFitResult RadiationStateSpaceFitter::FitKernel(
113113
const Eigen::VectorXd& svh = svd.singularValues();
114114

115115
// =========================================================================
116-
// Try increasing orders, reusing the same SVD decomposition
116+
// Try all orders up to max, keeping the best fit.
117+
//
118+
// We do NOT stop early when R² exceeds the threshold. Higher orders may
119+
// introduce fast-decaying poles (large |Re(λ)|, small magnitude) that
120+
// improve the initial transient accuracy. Stopping early at a "good
121+
// enough" R² prevents these fast poles from getting through, causing a
122+
// characteristic slight lag after the first response lobe.
117123
// =========================================================================
118124
for (int order = 2; order <= max_possible_order; ++order) {
119125
StateSpaceFitResult candidate = FitFromSVD(K, dt, order, y, U, V, svh, hankel_size);
120126

121-
if (candidate.IsValid()) {
127+
if (candidate.IsValid() && candidate.r2 > result.r2) {
122128
result = candidate;
123-
124-
if (result.r2 >= opts_.r2_threshold) {
125-
break;
126-
}
127129
}
128130
}
129131

0 commit comments

Comments
 (0)