552SUBROUTINE cgedmdq( JOBS, JOBZ, JOBR, JOBQ, JOBT, JOBF, &
553 WHTSVD, M, N, F, LDF, X, LDX, Y, &
554 LDY, NRNK, TOL, K, EIGS, &
555 Z, LDZ, RES, B, LDB, V, LDV, &
556 S, LDS, ZWORK, LZWORK, WORK, LWORK, &
557 IWORK, LIWORK, INFO )
568 INTEGER,
PARAMETER :: WP = real32
572 CHARACTER,
INTENT(IN) :: JOBS, JOBZ, JOBR, JOBQ, &
574 INTEGER,
INTENT(IN) :: WHTSVD, M, N, LDF, LDX, &
575 LDY, NRNK, LDZ, LDB, LDV, &
576 LDS, LZWORK, LWORK, LIWORK
577 INTEGER,
INTENT(OUT) :: INFO, K
578 REAL(KIND=wp),
INTENT(IN) :: tol
582 COMPLEX(KIND=WP),
INTENT(INOUT) :: F(LDF,*)
583 COMPLEX(KIND=WP),
INTENT(OUT) :: X(LDX,*), Y(LDY,*), &
584 Z(LDZ,*), B(LDB,*), &
586 COMPLEX(KIND=WP),
INTENT(OUT) :: EIGS(*)
587 COMPLEX(KIND=WP),
INTENT(OUT) :: ZWORK(*)
588 REAL(KIND=wp),
INTENT(OUT) :: res(*)
589 REAL(KIND=wp),
INTENT(OUT) :: work(*)
590 INTEGER,
INTENT(OUT) :: IWORK(*)
594 REAL(KIND=wp),
PARAMETER :: one = 1.0_wp
595 REAL(KIND=wp),
PARAMETER :: zero = 0.0_wp
597 COMPLEX(KIND=WP),
PARAMETER :: ZZERO = ( 0.0_wp, 0.0_wp )
601 INTEGER :: IMINWR, INFO1, MINMN, MLRWRK, &
602 MLWDMD, MLWGQR, MLWMQR, MLWORK, &
603 MLWQR, OLWDMD, OLWGQR, OLWMQR, &
605 LOGICAL :: LQUERY, SCCOLX, SCCOLY, WANTQ, &
606 WNTTRF, WNTRES, WNTVEC, WNTVCF, &
607 WNTVCQ, WNTREF, WNTEX
608 CHARACTER(LEN=1) :: JOBVL
622 INTRINSIC max, min, int
626 wntres = lsame(jobr,
'R')
627 sccolx = lsame(jobs,
'S') .OR. lsame( jobs,
'C' )
628 sccoly = lsame(jobs,
'Y')
629 wntvec = lsame(jobz,
'V')
630 wntvcf = lsame(jobz,
'F')
631 wntvcq = lsame(jobz,
'Q')
632 wntref = lsame(jobf,
'R')
633 wntex = lsame(jobf,
'E')
634 wantq = lsame(jobq,
'Q')
635 wnttrf = lsame(jobt,
'R')
638 lquery = ( ( lwork == -1 ) .OR. ( liwork == -1 ) )
640 IF ( .NOT. (sccolx .OR. sccoly .OR. &
641 lsame(jobs,
'N')) )
THEN
643 ELSE IF ( .NOT. (wntvec .OR. wntvcf .OR. wntvcq &
644 .OR. lsame(jobz,
'N')) )
THEN
646 ELSE IF ( .NOT. (wntres .OR. lsame(jobr,
'N')) .OR. &
647 ( wntres .AND. lsame(jobz,
'N') ) )
THEN
649 ELSE IF ( .NOT. (wantq .OR. lsame(jobq,
'N')) )
THEN
651 ELSE IF ( .NOT. ( wnttrf .OR. lsame(jobt,
'N') ) )
THEN
653 ELSE IF ( .NOT. (wntref .OR. wntex .OR. &
654 lsame(jobf,
'N') ) )
THEN
656 ELSE IF ( .NOT. ((whtsvd == 1).OR.(whtsvd == 2).OR. &
657 (whtsvd == 3).OR.(whtsvd == 4)) )
THEN
659 ELSE IF ( m < 0 )
THEN
661 ELSE IF ( ( n < 0 ) .OR. ( n > m+1 ) )
THEN
663 ELSE IF ( ldf < m )
THEN
665 ELSE IF ( ldx < minmn )
THEN
667 ELSE IF ( ldy < minmn )
THEN
669 ELSE IF ( .NOT. (( nrnk == -2).OR.(nrnk == -1).OR. &
670 ((nrnk >= 1).AND.(nrnk <=n ))) )
THEN
672 ELSE IF ( ( tol < zero ) .OR. ( tol >= one ) )
THEN
674 ELSE IF ( ldz < m )
THEN
676 ELSE IF ( (wntref.OR.wntex ).AND.( ldb < minmn ) )
THEN
678 ELSE IF ( ldv < n-1 )
THEN
680 ELSE IF ( lds < n-1 )
THEN
684 IF ( wntvec .OR. wntvcf .OR. wntvcq )
THEN
689 IF ( info == 0 )
THEN
694 IF ( ( n == 0 ) .OR. ( n == 1 ) )
THEN
714 mlwork = max(mlwork,minmn + mlwqr)
717 CALL cgeqrf( m, n, f, ldf, zwork, zwork, -1, &
719 olwqr = int(zwork(1))
720 olwork = max(olwork,minmn + olwqr)
722 CALL cgedmd( jobs, jobvl, jobr, jobf, whtsvd, minmn,&
723 n-1, x, ldx, y, ldy, nrnk, tol, k, &
724 eigs, z, ldz, res, b, ldb, v, ldv, &
725 s, lds, zwork, lzwork, work, -1, iwork,&
727 mlwdmd = int(zwork(1))
728 mlwork = max(mlwork, minmn + mlwdmd)
729 mlrwrk = max(mlrwrk, int(work(1)))
730 iminwr = max(iminwr, iwork(1))
732 olwdmd = int(zwork(2))
733 olwork = max(olwork, minmn+olwdmd)
735 IF ( wntvec .OR. wntvcf )
THEN
737 mlwork = max(mlwork, minmn+mlwmqr)
739 CALL cunmqr(
'L',
'N', m, n, minmn, f, ldf, &
740 zwork, z, ldz, zwork, -1, info1 )
741 olwmqr = int(zwork(1))
742 olwork = max(olwork, minmn+olwmqr)
747 mlwork = max(mlwork, minmn+mlwgqr)
749 CALL cungqr( m, minmn, minmn, f, ldf, zwork, &
751 olwgqr = int(zwork(1))
752 olwork = max(olwork, minmn+olwgqr)
755 IF ( liwork < iminwr .AND. (.NOT.lquery) ) info = -34
756 IF ( lwork < mlrwrk .AND. (.NOT.lquery) ) info = -32
757 IF ( lzwork < mlwork .AND. (.NOT.lquery) ) info = -30
760 CALL xerbla(
'CGEDMDQ', -info )
762 ELSE IF ( lquery )
THEN
777 CALL cgeqrf( m, n, f, ldf, zwork, &
778 zwork(minmn+1), lzwork-minmn, info1 )
784 CALL claset(
'L', minmn, n-1, zzero, zzero, x, ldx )
785 CALL clacpy(
'U', minmn, n-1, f, ldf, x, ldx )
786 CALL clacpy(
'A', minmn, n-1, f(1,2), ldf, y, ldy )
788 CALL claset(
'L', minmn-2, n-2, zzero, zzero, &
793 CALL cgedmd( jobs, jobvl, jobr, jobf, whtsvd, minmn, &
794 n-1, x, ldx, y, ldy, nrnk, tol, k, &
795 eigs, z, ldz, res, b, ldb, v, ldv, &
796 s, lds, zwork(minmn+1), lzwork-minmn, &
797 work, lwork, iwork, liwork, info1 )
798 IF ( info1 == 2 .OR. info1 == 3 )
THEN
810 IF ( m > minmn )
CALL claset(
'A', m-minmn, k, zzero, &
811 zzero, z(minmn+1,1), ldz )
812 CALL cunmqr(
'L',
'N', m, k, minmn, f, ldf, zwork, z, &
813 ldz, zwork(minmn+1), lzwork-minmn, info1 )
814 ELSE IF ( wntvcf )
THEN
821 CALL clacpy(
'A', n, k, x, ldx, z, ldz )
822 IF ( m > n )
CALL claset(
'A', m-n, k, zzero, zzero, &
824 CALL cunmqr(
'L',
'N', m, k, minmn, f, ldf, zwork, z, &
825 ldz, zwork(minmn+1), lzwork-minmn, info1 )
837 CALL claset(
'A', minmn, n, zzero, zzero, y, ldy )
838 CALL clacpy(
'U', minmn, n, f, ldf, y, ldy )
846 CALL cungqr( m, minmn, minmn, f, ldf, zwork, &
847 zwork(minmn+1), lzwork-minmn, info1 )
subroutine xerbla(srname, info)
subroutine cgedmdq(jobs, jobz, jobr, jobq, jobt, jobf, whtsvd, m, n, f, ldf, x, ldx, y, ldy, nrnk, tol, k, eigs, z, ldz, res, b, ldb, v, ldv, s, lds, zwork, lzwork, work, lwork, iwork, liwork, info)
CGEDMDQ computes the Dynamic Mode Decomposition (DMD) for a pair of data snapshot matrices.
subroutine cgedmd(jobs, jobz, jobr, jobf, whtsvd, m, n, x, ldx, y, ldy, nrnk, tol, k, eigs, z, ldz, res, b, ldb, w, ldw, s, lds, zwork, lzwork, rwork, lrwork, iwork, liwork, info)
CGEDMD computes the Dynamic Mode Decomposition (DMD) for a pair of data snapshot matrices.
subroutine cgeqrf(m, n, a, lda, tau, work, lwork, info)
CGEQRF
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine cungqr(m, n, k, a, lda, tau, work, lwork, info)
CUNGQR
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR