From 6a44057f06ace8216dbea1aa6d5f86ae8f0ceaf4 Mon Sep 17 00:00:00 2001 From: Weslley da Silva Pereira Date: Fri, 5 Aug 2022 15:09:37 -0600 Subject: [PATCH 1/4] Revert "SORCSD: fix documentation on matrix dimensions" This reverts commit bdcd890a185482119c52dd7acd9a702f0cad782a. --- SRC/sorbdb2.f | 4 ++-- SRC/sorbdb4.f | 2 +- SRC/sorcsd2by1.f | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SRC/sorbdb2.f b/SRC/sorbdb2.f index 484d352f8c..ad3eb269dd 100644 --- a/SRC/sorbdb2.f +++ b/SRC/sorbdb2.f @@ -122,14 +122,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is REAL array, dimension (P-1) +*> TAUP1 is REAL array, dimension (P) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is REAL array, dimension (Q) +*> TAUP2 is REAL array, dimension (M-P) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/sorbdb4.f b/SRC/sorbdb4.f index 4d664435c1..b18ed3b270 100644 --- a/SRC/sorbdb4.f +++ b/SRC/sorbdb4.f @@ -131,7 +131,7 @@ *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is REAL array, dimension (M-Q) +*> TAUP2 is REAL array, dimension (M-P) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/sorcsd2by1.f b/SRC/sorcsd2by1.f index a2d0163da1..48f33f66db 100644 --- a/SRC/sorcsd2by1.f +++ b/SRC/sorcsd2by1.f @@ -672,7 +672,7 @@ SUBROUTINE SORCSD2BY1( JOBU1, JOBU2, JOBV1T, M, P, Q, X11, LDX11, * Accumulate Householder reflectors * IF( WANTU2 .AND. M-P .GT. 0 ) THEN - CALL SCOPY( M-Q, WORK(IORBDB+P), 1, U2, 1 ) + CALL SCOPY( M-P, WORK(IORBDB+P), 1, U2, 1 ) END IF IF( WANTU1 .AND. P .GT. 0 ) THEN CALL SCOPY( P, WORK(IORBDB), 1, U1, 1 ) From 02836f353df74a70df786e6e1d68d422463685d7 Mon Sep 17 00:00:00 2001 From: Weslley da Silva Pereira Date: Fri, 5 Aug 2022 15:09:52 -0600 Subject: [PATCH 2/4] Revert "SORCSD2BY1: remove dead code" This reverts commit d245b4f6ef5ed18cff4ef53d75a96b49f259bc3a. --- SRC/sorcsd2by1.f | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SRC/sorcsd2by1.f b/SRC/sorcsd2by1.f index 48f33f66db..25c317f6f6 100644 --- a/SRC/sorcsd2by1.f +++ b/SRC/sorcsd2by1.f @@ -676,6 +676,9 @@ SUBROUTINE SORCSD2BY1( JOBU1, JOBU2, JOBV1T, M, P, Q, X11, LDX11, END IF IF( WANTU1 .AND. P .GT. 0 ) THEN CALL SCOPY( P, WORK(IORBDB), 1, U1, 1 ) + DO J = 2, P + U1(1,J) = ZERO + END DO CALL SLACPY( 'L', P-1, M-Q-1, X11(2,1), LDX11, U1(2,2), $ LDU1 ) CALL SORGQR( P, P, M-Q, U1, LDU1, WORK(ITAUP1), From 2beef68075a613252d7c96e226b9407f7a1323e6 Mon Sep 17 00:00:00 2001 From: Weslley da Silva Pereira Date: Fri, 5 Aug 2022 15:35:08 -0600 Subject: [PATCH 3/4] Fix documentation for double, complex and double complex --- SRC/cunbdb2.f | 4 ++-- SRC/cunbdb4.f | 4 ++-- SRC/dorbdb2.f | 4 ++-- SRC/dorbdb4.f | 4 ++-- SRC/sorbdb2.f | 4 ++-- SRC/sorbdb4.f | 4 ++-- SRC/zunbdb2.f | 4 ++-- SRC/zunbdb4.f | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/SRC/cunbdb2.f b/SRC/cunbdb2.f index db238f9256..b45db61003 100644 --- a/SRC/cunbdb2.f +++ b/SRC/cunbdb2.f @@ -122,14 +122,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is COMPLEX array, dimension (P) +*> TAUP1 is COMPLEX array, dimension (P-1) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is COMPLEX array, dimension (M-P) +*> TAUP2 is COMPLEX array, dimension (Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/cunbdb4.f b/SRC/cunbdb4.f index e6afd89c30..117f23d08d 100644 --- a/SRC/cunbdb4.f +++ b/SRC/cunbdb4.f @@ -124,14 +124,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is COMPLEX array, dimension (P) +*> TAUP1 is COMPLEX array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is COMPLEX array, dimension (M-P) +*> TAUP2 is COMPLEX array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/dorbdb2.f b/SRC/dorbdb2.f index 64e4645bcc..a0dacbb16d 100644 --- a/SRC/dorbdb2.f +++ b/SRC/dorbdb2.f @@ -122,14 +122,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is DOUBLE PRECISION array, dimension (P) +*> TAUP1 is DOUBLE PRECISION array, dimension (P-1) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is DOUBLE PRECISION array, dimension (M-P) +*> TAUP2 is DOUBLE PRECISION array, dimension (Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/dorbdb4.f b/SRC/dorbdb4.f index a09568415d..08604be452 100644 --- a/SRC/dorbdb4.f +++ b/SRC/dorbdb4.f @@ -124,14 +124,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is DOUBLE PRECISION array, dimension (P) +*> TAUP1 is DOUBLE PRECISION array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is DOUBLE PRECISION array, dimension (M-P) +*> TAUP2 is DOUBLE PRECISION array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/sorbdb2.f b/SRC/sorbdb2.f index ad3eb269dd..484d352f8c 100644 --- a/SRC/sorbdb2.f +++ b/SRC/sorbdb2.f @@ -122,14 +122,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is REAL array, dimension (P) +*> TAUP1 is REAL array, dimension (P-1) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is REAL array, dimension (M-P) +*> TAUP2 is REAL array, dimension (Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/sorbdb4.f b/SRC/sorbdb4.f index b18ed3b270..bf60fb7bb4 100644 --- a/SRC/sorbdb4.f +++ b/SRC/sorbdb4.f @@ -124,14 +124,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is REAL array, dimension (P) +*> TAUP1 is REAL array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is REAL array, dimension (M-P) +*> TAUP2 is REAL array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/zunbdb2.f b/SRC/zunbdb2.f index 412d8d8d08..46b08aa1ed 100644 --- a/SRC/zunbdb2.f +++ b/SRC/zunbdb2.f @@ -122,14 +122,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is COMPLEX*16 array, dimension (P) +*> TAUP1 is COMPLEX*16 array, dimension (P-1) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is COMPLEX*16 array, dimension (M-P) +*> TAUP2 is COMPLEX*16 array, dimension (Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim diff --git a/SRC/zunbdb4.f b/SRC/zunbdb4.f index b1fcd8bd03..4672cfa67b 100644 --- a/SRC/zunbdb4.f +++ b/SRC/zunbdb4.f @@ -124,14 +124,14 @@ *> *> \param[out] TAUP1 *> \verbatim -*> TAUP1 is COMPLEX*16 array, dimension (P) +*> TAUP1 is COMPLEX*16 array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P1. *> \endverbatim *> *> \param[out] TAUP2 *> \verbatim -*> TAUP2 is COMPLEX*16 array, dimension (M-P) +*> TAUP2 is COMPLEX*16 array, dimension (M-Q) *> The scalar factors of the elementary reflectors that define *> P2. *> \endverbatim From 2ba5e8e042d643156efff8658fbcd88426bb59dd Mon Sep 17 00:00:00 2001 From: Weslley da Silva Pereira Date: Fri, 5 Aug 2022 16:10:06 -0600 Subject: [PATCH 4/4] Fix bug in DORCSD2BY1 (found by doing a diff between single and double precision files) --- SRC/dorcsd2by1.f | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SRC/dorcsd2by1.f b/SRC/dorcsd2by1.f index 06bf53db16..25fab0f33c 100644 --- a/SRC/dorcsd2by1.f +++ b/SRC/dorcsd2by1.f @@ -580,7 +580,7 @@ SUBROUTINE DORCSD2BY1( JOBU1, JOBU2, JOBV1T, M, P, Q, X11, LDX11, * Simultaneously diagonalize X11 and X21. * CALL DBBCSD( JOBV1T, 'N', JOBU1, JOBU2, 'T', M, Q, P, THETA, - $ WORK(IPHI), V1T, LDV1T, DUM2, 1, U1, LDU1, U2, + $ WORK(IPHI), V1T, LDV1T, DUM1, 1, U1, LDU1, U2, $ LDU2, WORK(IB11D), WORK(IB11E), WORK(IB12D), $ WORK(IB12E), WORK(IB21D), WORK(IB21E), $ WORK(IB22D), WORK(IB22E), WORK(IBBCSD), LBBCSD, @@ -635,7 +635,7 @@ SUBROUTINE DORCSD2BY1( JOBU1, JOBU2, JOBV1T, M, P, Q, X11, LDX11, * Simultaneously diagonalize X11 and X21. * CALL DBBCSD( 'N', JOBV1T, JOBU2, JOBU1, 'T', M, M-Q, M-P, - $ THETA, WORK(IPHI), DUM2, 1, V1T, LDV1T, U2, + $ THETA, WORK(IPHI), DUM1, 1, V1T, LDV1T, U2, $ LDU2, U1, LDU1, WORK(IB11D), WORK(IB11E), $ WORK(IB12D), WORK(IB12E), WORK(IB21D), $ WORK(IB21E), WORK(IB22D), WORK(IB22E), @@ -706,7 +706,7 @@ SUBROUTINE DORCSD2BY1( JOBU1, JOBU2, JOBV1T, M, P, Q, X11, LDX11, * Simultaneously diagonalize X11 and X21. * CALL DBBCSD( JOBU2, JOBU1, 'N', JOBV1T, 'N', M, M-P, M-Q, - $ THETA, WORK(IPHI), U2, LDU2, U1, LDU1, DUM2, + $ THETA, WORK(IPHI), U2, LDU2, U1, LDU1, DUM1, $ 1, V1T, LDV1T, WORK(IB11D), WORK(IB11E), $ WORK(IB12D), WORK(IB12E), WORK(IB21D), $ WORK(IB21E), WORK(IB22D), WORK(IB22E),