diff --git a/SRC/cgedmd.f90 b/SRC/cgedmd.f90 index 9cc23e81e..67de2db1c 100644 --- a/SRC/cgedmd.f90 +++ b/SRC/cgedmd.f90 @@ -117,6 +117,8 @@ !> 'Y' :: The data snapshots matrices X and Y are multiplied !> by a diagonal matrix D so that Y*D has unit !> nonzero columns (in the Euclidean 2-norm) +!> If all columns of Y are zero, the procedure returns +!> with INFO = -10. !> 'N' :: No data scaling. !> \endverbatim !..... @@ -467,7 +469,8 @@ !> \verbatim !> INFO (output) INTEGER !> -i < 0 :: On entry, the i-th argument had an -!> illegal value +!> illegal value. If JOBS == 'Y' and all columns +!> of Y are zero, INFO = -10. !> = 0 :: Successful return. !> = 1 :: Void input. Quick exit (M=0 or N=0). !> = 2 :: The SVD computation of X did not converge. @@ -833,6 +836,7 @@ SUBROUTINE CGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & ! The columns of Y will be normalized. ! To prevent overflows, the column norms of Y are ! carefully computed using CLASSQ. + K = 0 DO i = 1, N !RWORK(i) = SCNRM2( M, Y(1,i), 1 ) SSUM = ONE @@ -868,8 +872,17 @@ SUBROUTINE CGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & END IF ELSE RWORK(i) = ZERO + K = K + 1 END IF END DO + IF ( K == N ) THEN + ! All columns of Y are zero. Return error code -10. + ! (the 10th input variable had an illegal value) + K = 0 + INFO = -10 + CALL XERBLA('CGEDMD',-INFO) + RETURN + END IF DO i = 1, N ! Now, apply the same scaling to the columns of X. IF ( RWORK(i) > ZERO ) THEN diff --git a/SRC/dgedmd.f90 b/SRC/dgedmd.f90 index 642e2d61b..e356ffa32 100644 --- a/SRC/dgedmd.f90 +++ b/SRC/dgedmd.f90 @@ -115,6 +115,8 @@ !> 'Y' :: The data snapshots matrices X and Y are multiplied !> by a diagonal matrix D so that Y*D has unit !> nonzero columns (in the Euclidean 2-norm) +!> If all columns of Y are zero, the procedure returns +!> with INFO = -10. !> 'N' :: No data scaling. !> \endverbatim !..... @@ -501,7 +503,8 @@ !> \verbatim !> INFO (output) INTEGER !> -i < 0 :: On entry, the i-th argument had an -!> illegal value +!> illegal value. If JOBS == 'Y' and all columns +!> of Y are zero, INFO = -10. !> = 0 :: Successful return. !> = 1 :: Void input. Quick exit (M=0 or N=0). !> = 2 :: The SVD computation of X did not converge. @@ -854,6 +857,7 @@ SUBROUTINE DGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & ! The columns of Y will be normalized. ! To prevent overflows, the column norms of Y are ! carefully computed using DLASSQ. + K = 0 DO i = 1, N !WORK(i) = DNRM2( M, Y(1,i), 1 ) SSUM = ONE @@ -889,8 +893,17 @@ SUBROUTINE DGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & END IF ELSE WORK(i) = ZERO + K = K + 1 END IF END DO + IF ( K == N ) THEN + ! All columns of Y are zero. Return error code -10. + ! (the 10th input variable had an illegal value) + K = 0 + INFO = -10 + CALL XERBLA('DGEDMD',-INFO) + RETURN + END IF DO i = 1, N ! Now, apply the same scaling to the columns of X. IF ( WORK(i) > ZERO ) THEN diff --git a/SRC/sgedmd.f90 b/SRC/sgedmd.f90 index 68e85d821..60b177dc5 100644 --- a/SRC/sgedmd.f90 +++ b/SRC/sgedmd.f90 @@ -116,6 +116,8 @@ !> 'Y' :: The data snapshots matrices X and Y are multiplied !> by a diagonal matrix D so that Y*D has unit !> nonzero columns (in the Euclidean 2-norm) +!> If all columns of Y are zero, the procedure returns +!> with INFO = -10. !> 'N' :: No data scaling. !> \endverbatim !..... @@ -501,7 +503,8 @@ !> \verbatim !> INFO (output) INTEGER !> -i < 0 :: On entry, the i-th argument had an -!> illegal value +!> illegal value. If JOBS == 'Y' and all columns +!> of Y are zero, INFO = -10. !> = 0 :: Successful return. !> = 1 :: Void input. Quick exit (M=0 or N=0). !> = 2 :: The SVD computation of X did not converge. @@ -854,6 +857,7 @@ SUBROUTINE SGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & ! The columns of Y will be normalized. ! To prevent overflows, the column norms of Y are ! carefully computed using SLASSQ. + K = 0 DO i = 1, N !WORK(i) = DNRM2( M, Y(1,i), 1 ) SSUM = ONE @@ -889,8 +893,17 @@ SUBROUTINE SGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & END IF ELSE WORK(i) = ZERO + K = K + 1 END IF END DO + IF ( K == N ) THEN + ! All columns of Y are zero. Return error code -10. + ! (the 10th input variable had an illegal value) + K = 0 + INFO = -10 + CALL XERBLA('SGEDMD',-INFO) + RETURN + END IF DO i = 1, N ! Now, apply the same scaling to the columns of X. IF ( WORK(i) > ZERO ) THEN diff --git a/SRC/zgedmd.f90 b/SRC/zgedmd.f90 index 7e40a3f1b..2b84942e5 100644 --- a/SRC/zgedmd.f90 +++ b/SRC/zgedmd.f90 @@ -117,6 +117,8 @@ !> 'Y' :: The data snapshots matrices X and Y are multiplied !> by a diagonal matrix D so that Y*D has unit !> nonzero columns (in the Euclidean 2-norm) +!> If all columns of Y are zero, the procedure returns +!> with INFO = -10. !> 'N' :: No data scaling. !> \endverbatim !..... @@ -467,7 +469,8 @@ !> \verbatim !> INFO (output) INTEGER !> -i < 0 :: On entry, the i-th argument had an -!> illegal value +!> illegal value. If JOBS == 'Y' and all columns +!> of Y are zero, INFO = -10. !> = 0 :: Successful return. !> = 1 :: Void input. Quick exit (M=0 or N=0). !> = 2 :: The SVD computation of X did not converge. @@ -833,6 +836,7 @@ SUBROUTINE ZGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & ! The columns of Y will be normalized. ! To prevent overflows, the column norms of Y are ! carefully computed using ZLASSQ. + K = 0 DO i = 1, N !RWORK(i) = DZNRM2( M, Y(1,i), 1 ) SSUM = ONE @@ -868,8 +872,17 @@ SUBROUTINE ZGEDMD( JOBS, JOBZ, JOBR, JOBF, WHTSVD, & END IF ELSE RWORK(i) = ZERO + K = K + 1 END IF END DO + IF ( K == N ) THEN + ! All columns of Y are zero. Return error code -10. + ! (the 10th input variable had an illegal value) + K = 0 + INFO = -10 + CALL XERBLA('ZGEDMD',-INFO) + RETURN + END IF DO i = 1, N ! Now, apply the same scaling to the columns of X. IF ( RWORK(i) > ZERO ) THEN