TESTING: scale the xGEDMDQ residual check by SINGVQX(KQ) - #1342
Merged
Merged
Conversation
SINGVQX is only filled to KQ, so SINGVQX(K) read uninitialized memory whenever DGEDMD's rank K exceeded DGEDMDQ's KQ -- harmless in the default API by luck, an abort in the _64 build. cchkdmd/zchkdmd already use KQ. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
langou
reviewed
Jul 30, 2026
| DO i = 1, KQ | ||
| TMP = MAX( TMP, ABS(RES(i) - RES1(i)) * & | ||
| SINGVQX(K)/(ANORM*SINGVQX(1)) ) | ||
| SINGVQX(KQ)/(ANORM*SINGVQX(1)) ) |
Contributor
There was a problem hiding this comment.
Yes, 'KQ' here, not 'K', correct.
langou
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
dchkdmd/schkdmdscale the xGEDMDQ residual-consistency check bySINGVQX(K),but
SINGVQXis only filled up toKQ:SINGVQX(1:KQ) = WORK(...)—KQis the rank xGEDMDQ returns(
dchkdmd.f90:574)... * SINGVQX(K)/(ANORM*SINGVQX(1))—Kis the rank xGEDMD returns(
dchkdmd.f90:653)Whenever
K > KQthe scale factor is read from memory that xGEDMDQ never wrote.The surrounding code already knows the two ranks differ —
dchkdmd.f90:577counts
KQ /= Koccurrences and the singular-value comparison atdchkdmd.f90:582correctly bounds itself withMIN(K,KQ).cchkdmd/zchkdmdalready use
SINGVQX(KQ); this brings the real precisions in line.How it surfaced. The extended-API double-precision DMD test reported 6 fewer
tests than the default API.
xdmdeigtstd_64aborted at the last size(M=50, N=20) with
................ DGEDMDQ_64 FAILED!Check the code for implementation errors., printing none of the six verdict lines the summaryscript counts. Because the
STOPatdchkdmd.f90:660is a bareSTOP, theprocess exit status was 0 and CTest recorded a pass — the only visible symptom
was the test-count mismatch.
Evidence. Both builds were instrumented to trace all 4608 xGEDMDQ residual
checks:
_64)RES,RES1,TMPK,KQK > KQK=16–18,KQ=15)SINGVQX(K)thereTMPvsTOL2=2.2e-12STOPsThe arithmetic is identical between the two builds; only the uninitialized value
differs. Filling
SINGVQXwith a sentinel afterALLOCATEmakes both buildsfail the same 48 checks, which confirms the read is uninitialized rather than an
ILP64 numerical difference. Note the consequence: which API fails is down to heap
contents, so on another platform or build type the default API could be the one
that aborts.
schkdmdhas the identical wrong index and identical partial fill. It currentlypasses only because its uninitialized values happen to be harmless in both APIs.