SRC: detect all-zero Y columns in GEDMD scaling#1243
SRC: detect all-zero Y columns in GEDMD scaling#1243nakatamaho wants to merge 3 commits intoReference-LAPACK:masterfrom
Conversation
Add the missing all-zero column check to the JOBS='Y' scaling path in the GEDMD routines. The existing JOBS='S'/'C' path detects when all columns of X are zero and returns INFO=-8, but the corresponding JOBS='Y' path did not count zero columns of Y or return early when all Y columns are zero. Return INFO=-10 for the all-zero Y case, matching Y as the 10th argument and the existing SCCOLY error handling. Update the routine documentation to describe this condition.
|
From: Zlatko Drmac First a summary:
However, if scaling options are active, the subroutine uses the opportunity to check for some inconsistencies - like all If scaling of So, this is something I call "a political decision" - the roles of So, I would say it is OK to return an error code if (For So, in the end, it is a "political decision" 😀 |
|
From: Zlatko Drmac It is indeed important to discuss all aspects of such "singularities". Well designed behaviour for singular cases may save the day in mission critical applications. If |
|
Framing this as a "political decision" makes me wonder if the change would break existing user code. Returning early if no useful work can be done is one thing, but erroring out in what I assume to be a benign case (continuing would not cause an exception or loop(?) ) would only put unexpected burden on users to check their inputs (making the added code in LAPACK redundant) or to catch the error. |
Treat the all-zero Y case in the JOBS='Y' scaling path as a degenerate input diagnostic instead of an illegal argument. Previously this path returned INFO = -10 and called XERBLA, which made the condition look like an invalid tenth argument. However, an all-zero Y matrix is not an illegal argument by itself; it is a degenerate data case detected under the JOBS='Y' scaling semantics. Introduce INFO = 5 for this early-return condition and document it as a positive diagnostic code. The GEDMDQ wrappers now propagate INFO = 5 as a terminal diagnostic from the underlying GEDMD call.
|
Thanks, I agree that treating the all-zero I have updated the change accordingly. The The motivation is to keep the explicit detection of the degenerate I also chose not to reuse Finally, I updated the corresponding |
Add regression coverage for the JOBS='Y' scaling path when all columns of Y are zero. The test drivers now check that xGEDMD returns early with K = 0 and INFO = 5 for this degenerate input case, rather than treating Y as an illegal argument. The xGEDMDQ drivers also check that the same diagnostic is propagated from the underlying xGEDMD call. Separate failure counters are used for the GEDMD and GEDMDQ diagnostic checks so the summaries report the affected routine clearly.
This PR adds the missing all-zero column check to the
JOBS='Y'scaling path in the GEDMD routines.
In the existing implementation, the
JOBS='S'/JOBS='C'pathnormalizes the columns of
Xand counts zero columns while doing so.If all columns of
Xare zero, the routine returns early withINFO = -8, sinceXis the 8th argument.The corresponding
JOBS='Y'path normalizes the columns ofY, but itdid not count zero columns of
Yand therefore did not return earlywhen all columns of
Ywere zero. This made the handling of theSCCOLYpath asymmetric with the existingSCCOLXpath.This PR updates the
JOBS='Y'path to:YYYare zeroINFO = -10, matchingYas the 10th argumentUpdated routines:
SRC/sgedmd.f90SRC/dgedmd.f90SRC/cgedmd.f90SRC/zgedmd.f90This is intended to make the input validation and scaling behavior of
the
JOBS='Y'path consistent with the existingJOBS='S'/JOBS='C'path. It also avoids continuing the computation after detecting that
the requested
Y-based column scaling cannot be performed because allcolumns of
Yare zero.