Skip to content

Commit 0383447

Browse files
committed
SRC: report all-zero Y in GEDMD scaling as diagnostic
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.
1 parent efdff96 commit 0383447

File tree

8 files changed

+56
-36
lines changed

8 files changed

+56
-36
lines changed

SRC/cgedmd.f90

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
!> by a diagonal matrix D so that Y*D has unit
119119
!> nonzero columns (in the Euclidean 2-norm)
120120
!> If all columns of Y are zero, the procedure returns
121-
!> with INFO = -10.
121+
!> with INFO = 5.
122122
!> 'N' :: No data scaling.
123123
!> \endverbatim
124124
!.....
@@ -469,8 +469,7 @@
469469
!> \verbatim
470470
!> INFO (output) INTEGER
471471
!> -i < 0 :: On entry, the i-th argument had an
472-
!> illegal value. If JOBS == 'Y' and all columns
473-
!> of Y are zero, INFO = -10.
472+
!> illegal value.
474473
!> = 0 :: Successful return.
475474
!> = 1 :: Void input. Quick exit (M=0 or N=0).
476475
!> = 2 :: The SVD computation of X did not converge.
@@ -485,6 +484,10 @@
485484
!> to zero if JOBS=='C'. The computation proceeds
486485
!> with original or modified data and warning
487486
!> flag is set with INFO=4.
487+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
488+
!> the procedure returns early with K = 0. This is
489+
!> reported as a degenerate input diagnostic, not
490+
!> as an illegal argument.
488491
!> \endverbatim
489492
!
490493
! Authors:
@@ -876,11 +879,9 @@ SUBROUTINE CGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, &
876879
END IF
877880
END DO
878881
IF ( K == N ) THEN
879-
! All columns of Y are zero. Return error code -10.
880-
! (the 10th input variable had an illegal value)
882+
! All columns of Y are zero. Return diagnostic code 5.
881883
K = 0
882-
INFO = -10
883-
CALL XERBLA('CGEDMD',-INFO)
884+
INFO = 5
884885
RETURN
885886
END IF
886887
DO i = 1, N

SRC/cgedmdq.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@
538538
!> to zero if JOBS=='C'. The computation proceeds
539539
!> with original or modified data and warning
540540
!> flag is set with INFO=4.
541+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
542+
!> the procedure returns early with K = 0. This is
543+
!> reported as a degenerate input diagnostic, not
544+
!> as an illegal argument.
541545
!> \endverbatim
542546
!
543547
! Authors:
@@ -795,8 +799,8 @@ SUBROUTINE CGEDMDQ( JOBS, JOBZ, JOBR, JOBQ, JOBT, JOBF, &
795799
EIGS, Z, LDZ, RES, B, LDB, V, LDV, &
796800
S, LDS, ZWORK(MINMN+1), LZWORK-MINMN, &
797801
WORK, LWORK, IWORK, LIWORK, INFO1 )
798-
IF ( INFO1 == 2 .OR. INFO1 == 3 ) THEN
799-
! Return with error code. See CGEDMD for details.
802+
IF ( INFO1 == 2 .OR. INFO1 == 3 .OR. INFO1 == 5 ) THEN
803+
! Return with terminal diagnostic or error code.
800804
INFO = INFO1
801805
RETURN
802806
ELSE

SRC/dgedmd.f90

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
!> by a diagonal matrix D so that Y*D has unit
117117
!> nonzero columns (in the Euclidean 2-norm)
118118
!> If all columns of Y are zero, the procedure returns
119-
!> with INFO = -10.
119+
!> with INFO = 5.
120120
!> 'N' :: No data scaling.
121121
!> \endverbatim
122122
!.....
@@ -503,8 +503,7 @@
503503
!> \verbatim
504504
!> INFO (output) INTEGER
505505
!> -i < 0 :: On entry, the i-th argument had an
506-
!> illegal value. If JOBS == 'Y' and all columns
507-
!> of Y are zero, INFO = -10.
506+
!> illegal value.
508507
!> = 0 :: Successful return.
509508
!> = 1 :: Void input. Quick exit (M=0 or N=0).
510509
!> = 2 :: The SVD computation of X did not converge.
@@ -519,6 +518,10 @@
519518
!> to zero if JOBS=='C'. The computation proceeds
520519
!> with original or modified data and warning
521520
!> flag is set with INFO=4.
521+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
522+
!> the procedure returns early with K = 0. This is
523+
!> reported as a degenerate input diagnostic, not
524+
!> as an illegal argument.
522525
!> \endverbatim
523526
!
524527
! Authors:
@@ -897,11 +900,9 @@ SUBROUTINE DGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, &
897900
END IF
898901
END DO
899902
IF ( K == N ) THEN
900-
! All columns of Y are zero. Return error code -10.
901-
! (the 10th input variable had an illegal value)
903+
! All columns of Y are zero. Return diagnostic code 5.
902904
K = 0
903-
INFO = -10
904-
CALL XERBLA('DGEDMD',-INFO)
905+
INFO = 5
905906
RETURN
906907
END IF
907908
DO i = 1, N

SRC/dgedmdq.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@
557557
!> to zero if JOBS=='C'. The computation proceeds
558558
!> with original or modified data and warning
559559
!> flag is set with INFO=4.
560+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
561+
!> the procedure returns early with K = 0. This is
562+
!> reported as a degenerate input diagnostic, not
563+
!> as an illegal argument.
560564
!> \endverbatim
561565
!
562566
! Authors:
@@ -807,8 +811,8 @@ SUBROUTINE DGEDMDQ( JOBS, JOBZ, JOBR, JOBQ, JOBT, JOBF, &
807811
REIG, IMEIG, Z, LDZ, RES, B, LDB, V, &
808812
LDV, S, LDS, WORK(MINMN+1), LWORK-MINMN, &
809813
IWORK, LIWORK, INFO1 )
810-
IF ( INFO1 == 2 .OR. INFO1 == 3 ) THEN
811-
! Return with error code. See DGEDMD for details.
814+
IF ( INFO1 == 2 .OR. INFO1 == 3 .OR. INFO1 == 5 ) THEN
815+
! Return with terminal diagnostic or error code.
812816
INFO = INFO1
813817
RETURN
814818
ELSE

SRC/sgedmd.f90

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
!> by a diagonal matrix D so that Y*D has unit
118118
!> nonzero columns (in the Euclidean 2-norm)
119119
!> If all columns of Y are zero, the procedure returns
120-
!> with INFO = -10.
120+
!> with INFO = 5.
121121
!> 'N' :: No data scaling.
122122
!> \endverbatim
123123
!.....
@@ -503,8 +503,7 @@
503503
!> \verbatim
504504
!> INFO (output) INTEGER
505505
!> -i < 0 :: On entry, the i-th argument had an
506-
!> illegal value. If JOBS == 'Y' and all columns
507-
!> of Y are zero, INFO = -10.
506+
!> illegal value.
508507
!> = 0 :: Successful return.
509508
!> = 1 :: Void input. Quick exit (M=0 or N=0).
510509
!> = 2 :: The SVD computation of X did not converge.
@@ -519,6 +518,10 @@
519518
!> to zero if JOBS=='C'. The computation proceeds
520519
!> with original or modified data and warning
521520
!> flag is set with INFO=4.
521+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
522+
!> the procedure returns early with K = 0. This is
523+
!> reported as a degenerate input diagnostic, not
524+
!> as an illegal argument.
522525
!> \endverbatim
523526
!
524527
! Authors:
@@ -897,11 +900,9 @@ SUBROUTINE SGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, &
897900
END IF
898901
END DO
899902
IF ( K == N ) THEN
900-
! All columns of Y are zero. Return error code -10.
901-
! (the 10th input variable had an illegal value)
903+
! All columns of Y are zero. Return diagnostic code 5.
902904
K = 0
903-
INFO = -10
904-
CALL XERBLA('SGEDMD',-INFO)
905+
INFO = 5
905906
RETURN
906907
END IF
907908
DO i = 1, N

SRC/sgedmdq.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@
557557
!> to zero if JOBS=='C'. The computation proceeds
558558
!> with original or modified data and warning
559559
!> flag is set with INFO=4.
560+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
561+
!> the procedure returns early with K = 0. This is
562+
!> reported as a degenerate input diagnostic, not
563+
!> as an illegal argument.
560564
!> \endverbatim
561565
!
562566
! Authors:
@@ -806,8 +810,8 @@ SUBROUTINE SGEDMDQ( JOBS, JOBZ, JOBR, JOBQ, JOBT, JOBF, &
806810
REIG, IMEIG, Z, LDZ, RES, B, LDB, V, &
807811
LDV, S, LDS, WORK(MINMN+1), LWORK-MINMN, IWORK, &
808812
LIWORK, INFO1 )
809-
IF ( INFO1 == 2 .OR. INFO1 == 3 ) THEN
810-
! Return with error code.
813+
IF ( INFO1 == 2 .OR. INFO1 == 3 .OR. INFO1 == 5 ) THEN
814+
! Return with terminal diagnostic or error code.
811815
INFO = INFO1
812816
RETURN
813817
ELSE

SRC/zgedmd.f90

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
!> by a diagonal matrix D so that Y*D has unit
119119
!> nonzero columns (in the Euclidean 2-norm)
120120
!> If all columns of Y are zero, the procedure returns
121-
!> with INFO = -10.
121+
!> with INFO = 5.
122122
!> 'N' :: No data scaling.
123123
!> \endverbatim
124124
!.....
@@ -469,8 +469,7 @@
469469
!> \verbatim
470470
!> INFO (output) INTEGER
471471
!> -i < 0 :: On entry, the i-th argument had an
472-
!> illegal value. If JOBS == 'Y' and all columns
473-
!> of Y are zero, INFO = -10.
472+
!> illegal value.
474473
!> = 0 :: Successful return.
475474
!> = 1 :: Void input. Quick exit (M=0 or N=0).
476475
!> = 2 :: The SVD computation of X did not converge.
@@ -485,6 +484,10 @@
485484
!> to zero if JOBS=='C'. The computation proceeds
486485
!> with original or modified data and warning
487486
!> flag is set with INFO=4.
487+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
488+
!> the procedure returns early with K = 0. This is
489+
!> reported as a degenerate input diagnostic, not
490+
!> as an illegal argument.
488491
!> \endverbatim
489492
!
490493
! Authors:
@@ -876,11 +879,9 @@ SUBROUTINE ZGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, &
876879
END IF
877880
END DO
878881
IF ( K == N ) THEN
879-
! All columns of Y are zero. Return error code -10.
880-
! (the 10th input variable had an illegal value)
882+
! All columns of Y are zero. Return diagnostic code 5.
881883
K = 0
882-
INFO = -10
883-
CALL XERBLA('ZGEDMD',-INFO)
884+
INFO = 5
884885
RETURN
885886
END IF
886887
DO i = 1, N

SRC/zgedmdq.f90

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@
537537
!> to zero if JOBS=='C'. The computation proceeds
538538
!> with original or modified data and warning
539539
!> flag is set with INFO=4.
540+
!> = 5 :: If JOBS == 'Y' and all columns of Y are zero,
541+
!> the procedure returns early with K = 0. This is
542+
!> reported as a degenerate input diagnostic, not
543+
!> as an illegal argument.
540544
!> \endverbatim
541545
!
542546
! Authors:
@@ -796,8 +800,8 @@ SUBROUTINE ZGEDMDQ( JOBS, JOBZ, JOBR, JOBQ, JOBT, JOBF, &
796800
EIGS, Z, LDZ, RES, B, LDB, V, LDV, &
797801
S, LDS, ZWORK(MINMN+1), LZWORK-MINMN, &
798802
WORK, LWORK, IWORK, LIWORK, INFO1 )
799-
IF ( INFO1 == 2 .OR. INFO1 == 3 ) THEN
800-
! Return with error code. See ZGEDMD for details.
803+
IF ( INFO1 == 2 .OR. INFO1 == 3 .OR. INFO1 == 5 ) THEN
804+
! Return with terminal diagnostic or error code.
801805
INFO = INFO1
802806
RETURN
803807
ELSE

0 commit comments

Comments
 (0)