Skip to content

Fix save_abc dropping the last a coefficient#27

Merged
mesonepigreco merged 1 commit into
SSCHAcode:mainfrom
SorBalda:fix/save-abc-last-acoeff
Apr 20, 2026
Merged

Fix save_abc dropping the last a coefficient#27
mesonepigreco merged 1 commit into
SSCHAcode:mainfrom
SorBalda:fix/save-abc-last-acoeff

Conversation

@SorBalda
Copy link
Copy Markdown
Contributor

Summary

  • save_abc() used len(c_coeffs) as the array dimension, but in the biconjugate Lanczos (run_FT) len(a_coeffs) = N while len(b_coeffs) = len(c_coeffs) = N-1, so the last diagonal coefficient a[N-1] was silently dropped.
  • Now uses len(a_coeffs) as the leading dimension and fills b/c only for the available rows. The last row has b = c = 0, consistent with the termination of the continued fraction.

Test plan

  • Verified on LaAlO3 T=200K IR calculation (nconf=10000, 3 polarizations, 2nd order) that save_abc now writes all coefficients and the resulting spectrum is correct.

🤖 Generated with Claude Code

In run_FT, a_coeffs is appended at every iteration while b_coeffs and
c_coeffs are appended only when the algorithm has not converged, so
len(a) = N and len(b) = len(c) = N-1.  save_abc used len(c_coeffs) as
the array size, silently truncating the last diagonal element of the
continued fraction.

Use len(a_coeffs) as the leading dimension and fill b/c only for the
rows that exist.  The last row gets b = c = 0, consistent with the
termination of the continued fraction.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mesonepigreco mesonepigreco self-requested a review April 20, 2026 09:29
Copy link
Copy Markdown
Collaborator

@mesonepigreco mesonepigreco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good

@mesonepigreco mesonepigreco merged commit 99edc39 into SSCHAcode:main Apr 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants