| 1 | /* lapack/single/sggsvd.f -- translated by f2c (version 20050501). |
| 2 | You must link the resulting object file with libf2c: |
| 3 | on Microsoft Windows system, link with libf2c.lib; |
| 4 | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
| 5 | or, if you install libf2c.a in a standard place, with -lf2c -lm |
| 6 | -- in that order, at the end of the command line, as in |
| 7 | cc *.o -lf2c -lm |
| 8 | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
| 9 | |
| 10 | http://www.netlib.org/f2c/libf2c.zip |
| 11 | */ |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/ |
| 17 | |
| 18 | /* Table of constant values */ |
| 19 | |
| 20 | static integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! c__1cxx . . $ c__1. = 1; |
| 21 | |
| 22 | /*< >*/ |
| 23 | /* Subroutine */ int sggsvd_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:243:9`!(const char *jobu, const char *jobv, const char *jobq, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *m, |
| 24 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *p, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *k, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *l, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *a, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *lda, |
| 25 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *b, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ldb, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *alpha, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *beta, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *u, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! * |
| 26 | ldu, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *v, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ldv, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *q, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ldq, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *work, |
| 27 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *iwork, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *info, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`! jobu_len, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`! jobv_len, |
| 28 | ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`! jobq_len) |
| 29 | { |
| 30 | /* System generated locals */ |
| 31 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! a_dim1, a_offset, b_dim1, b_offset, q_dim1, q_offset, u_dim1, |
| 32 | u_offset, v_dim1, v_offset, i__1, i__2; |
| 33 | |
| 34 | /* Local variables */ |
| 35 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__, j; |
| 36 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! ulp; |
| 37 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! ibnd; |
| 38 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! tola; |
| 39 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! isub; |
| 40 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! tolb, unfl, temp, smax; |
| 41 | extern logicalcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:65:9`! lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(const char *, const char *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!); |
| 42 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! anorm, bnorm; |
| 43 | logicalcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:65:9`! wantq; |
| 44 | extern /* Subroutine */ int scopy_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:230:9`!(integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, |
| 45 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *); |
| 46 | logicalcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:65:9`! wantu, wantv; |
| 47 | extern doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! slamch_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:253:9`!(char *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!), slange_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:254:9`!(char *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, |
| 48 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!); |
| 49 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! ncycle; |
| 50 | extern /* Subroutine */ int xerbla_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:303:9`!(char *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!), stgsja_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:289:9`!( |
| 51 | const char *, const char *, const char *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! * |
| 52 | , integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, |
| 53 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, |
| 54 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!), |
| 55 | sggsvp_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:244:9`!(const char *, const char *, const char *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, |
| 56 | realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, |
| 57 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! * |
| 58 | , integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!, ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!); |
| 59 | (void)jobu_len; |
| 60 | (void)jobv_len; |
| 61 | (void)jobq_len; |
| 62 | |
| 63 | /* -- LAPACK driver routine (version 3.0) -- */ |
| 64 | /* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */ |
| 65 | /* Courant Institute, Argonne National Lab, and Rice University */ |
| 66 | /* June 30, 1999 */ |
| 67 | |
| 68 | /* .. Scalar Arguments .. */ |
| 69 | /*< CHARACTER JOBQ, JOBU, JOBV >*/ |
| 70 | /*< INTEGER INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P >*/ |
| 71 | /* .. */ |
| 72 | /* .. Array Arguments .. */ |
| 73 | /*< INTEGER IWORK( * ) >*/ |
| 74 | /*< >*/ |
| 75 | /* .. */ |
| 76 | |
| 77 | /* Purpose */ |
| 78 | /* ======= */ |
| 79 | |
| 80 | /* SGGSVD computes the generalized singular value decomposition (GSVD) */ |
| 81 | /* of an M-by-N real matrix A and P-by-N real matrix B: */ |
| 82 | |
| 83 | /* U'*A*Q = D1*( 0 R ), V'*B*Q = D2*( 0 R ) */ |
| 84 | |
| 85 | /* where U, V and Q are orthogonal matrices, and Z' is the transpose */ |
| 86 | /* of Z. Let K+L = the effective numerical rank of the matrix (A',B')', */ |
| 87 | /* then R is a K+L-by-K+L nonsingular upper triangular matrix, D1 and */ |
| 88 | /* D2 are M-by-(K+L) and P-by-(K+L) "diagonal" matrices and of the */ |
| 89 | /* following structures, respectively: */ |
| 90 | |
| 91 | /* If M-K-L >= 0, */ |
| 92 | |
| 93 | /* K L */ |
| 94 | /* D1 = K ( I 0 ) */ |
| 95 | /* L ( 0 C ) */ |
| 96 | /* M-K-L ( 0 0 ) */ |
| 97 | |
| 98 | /* K L */ |
| 99 | /* D2 = L ( 0 S ) */ |
| 100 | /* P-L ( 0 0 ) */ |
| 101 | |
| 102 | /* N-K-L K L */ |
| 103 | /* ( 0 R ) = K ( 0 R11 R12 ) */ |
| 104 | /* L ( 0 0 R22 ) */ |
| 105 | |
| 106 | /* where */ |
| 107 | |
| 108 | /* C = diag( ALPHA(K+1), ... , ALPHA(K+L) ), */ |
| 109 | /* S = diag( BETA(K+1), ... , BETA(K+L) ), */ |
| 110 | /* C**2 + S**2 = I. */ |
| 111 | |
| 112 | /* R is stored in A(1:K+L,N-K-L+1:N) on exit. */ |
| 113 | |
| 114 | /* If M-K-L < 0, */ |
| 115 | |
| 116 | /* K M-K K+L-M */ |
| 117 | /* D1 = K ( I 0 0 ) */ |
| 118 | /* M-K ( 0 C 0 ) */ |
| 119 | |
| 120 | /* K M-K K+L-M */ |
| 121 | /* D2 = M-K ( 0 S 0 ) */ |
| 122 | /* K+L-M ( 0 0 I ) */ |
| 123 | /* P-L ( 0 0 0 ) */ |
| 124 | |
| 125 | /* N-K-L K M-K K+L-M */ |
| 126 | /* ( 0 R ) = K ( 0 R11 R12 R13 ) */ |
| 127 | /* M-K ( 0 0 R22 R23 ) */ |
| 128 | /* K+L-M ( 0 0 0 R33 ) */ |
| 129 | |
| 130 | /* where */ |
| 131 | |
| 132 | /* C = diag( ALPHA(K+1), ... , ALPHA(M) ), */ |
| 133 | /* S = diag( BETA(K+1), ... , BETA(M) ), */ |
| 134 | /* C**2 + S**2 = I. */ |
| 135 | |
| 136 | /* (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), and R33 is stored */ |
| 137 | /* ( 0 R22 R23 ) */ |
| 138 | /* in B(M-K+1:L,N+M-K-L+1:N) on exit. */ |
| 139 | |
| 140 | /* The routine computes C, S, R, and optionally the orthogonal */ |
| 141 | /* transformation matrices U, V and Q. */ |
| 142 | |
| 143 | /* In particular, if B is an N-by-N nonsingular matrix, then the GSVD of */ |
| 144 | /* A and B implicitly gives the SVD of A*inv(B): */ |
| 145 | /* A*inv(B) = U*(D1*inv(D2))*V'. */ |
| 146 | /* If ( A',B')' has orthonormal columns, then the GSVD of A and B is */ |
| 147 | /* also equal to the CS decomposition of A and B. Furthermore, the GSVD */ |
| 148 | /* can be used to derive the solution of the eigenvalue problem: */ |
| 149 | /* A'*A x = lambda* B'*B x. */ |
| 150 | /* In some literature, the GSVD of A and B is presented in the form */ |
| 151 | /* U'*A*X = ( 0 D1 ), V'*B*X = ( 0 D2 ) */ |
| 152 | /* where U and V are orthogonal and X is nonsingular, D1 and D2 are */ |
| 153 | /* ``diagonal''. The former GSVD form can be converted to the latter */ |
| 154 | /* form by taking the nonsingular matrix X as */ |
| 155 | |
| 156 | /* X = Q*( I 0 ) */ |
| 157 | /* ( 0 inv(R) ). */ |
| 158 | |
| 159 | /* Arguments */ |
| 160 | /* ========= */ |
| 161 | |
| 162 | /* JOBU (input) CHARACTER*1 */ |
| 163 | /* = 'U': Orthogonal matrix U is computed; */ |
| 164 | /* = 'N': U is not computed. */ |
| 165 | |
| 166 | /* JOBV (input) CHARACTER*1 */ |
| 167 | /* = 'V': Orthogonal matrix V is computed; */ |
| 168 | /* = 'N': V is not computed. */ |
| 169 | |
| 170 | /* JOBQ (input) CHARACTER*1 */ |
| 171 | /* = 'Q': Orthogonal matrix Q is computed; */ |
| 172 | /* = 'N': Q is not computed. */ |
| 173 | |
| 174 | /* M (input) INTEGER */ |
| 175 | /* The number of rows of the matrix A. M >= 0. */ |
| 176 | |
| 177 | /* N (input) INTEGER */ |
| 178 | /* The number of columns of the matrices A and B. N >= 0. */ |
| 179 | |
| 180 | /* P (input) INTEGER */ |
| 181 | /* The number of rows of the matrix B. P >= 0. */ |
| 182 | |
| 183 | /* K (output) INTEGER */ |
| 184 | /* L (output) INTEGER */ |
| 185 | /* On exit, K and L specify the dimension of the subblocks */ |
| 186 | /* described in the Purpose section. */ |
| 187 | /* K + L = effective numerical rank of (A',B')'. */ |
| 188 | |
| 189 | /* A (input/output) REAL array, dimension (LDA,N) */ |
| 190 | /* On entry, the M-by-N matrix A. */ |
| 191 | /* On exit, A contains the triangular matrix R, or part of R. */ |
| 192 | /* See Purpose for details. */ |
| 193 | |
| 194 | /* LDA (input) INTEGER */ |
| 195 | /* The leading dimension of the array A. LDA >= max(1,M). */ |
| 196 | |
| 197 | /* B (input/output) REAL array, dimension (LDB,N) */ |
| 198 | /* On entry, the P-by-N matrix B. */ |
| 199 | /* On exit, B contains the triangular matrix R if M-K-L < 0. */ |
| 200 | /* See Purpose for details. */ |
| 201 | |
| 202 | /* LDB (input) INTEGER */ |
| 203 | /* The leading dimension of the array B. LDA >= max(1,P). */ |
| 204 | |
| 205 | /* ALPHA (output) REAL array, dimension (N) */ |
| 206 | /* BETA (output) REAL array, dimension (N) */ |
| 207 | /* On exit, ALPHA and BETA contain the generalized singular */ |
| 208 | /* value pairs of A and B; */ |
| 209 | /* ALPHA(1:K) = 1, */ |
| 210 | /* BETA(1:K) = 0, */ |
| 211 | /* and if M-K-L >= 0, */ |
| 212 | /* ALPHA(K+1:K+L) = C, */ |
| 213 | /* BETA(K+1:K+L) = S, */ |
| 214 | /* or if M-K-L < 0, */ |
| 215 | /* ALPHA(K+1:M)=C, ALPHA(M+1:K+L)=0 */ |
| 216 | /* BETA(K+1:M) =S, BETA(M+1:K+L) =1 */ |
| 217 | /* and */ |
| 218 | /* ALPHA(K+L+1:N) = 0 */ |
| 219 | /* BETA(K+L+1:N) = 0 */ |
| 220 | |
| 221 | /* U (output) REAL array, dimension (LDU,M) */ |
| 222 | /* If JOBU = 'U', U contains the M-by-M orthogonal matrix U. */ |
| 223 | /* If JOBU = 'N', U is not referenced. */ |
| 224 | |
| 225 | /* LDU (input) INTEGER */ |
| 226 | /* The leading dimension of the array U. LDU >= max(1,M) if */ |
| 227 | /* JOBU = 'U'; LDU >= 1 otherwise. */ |
| 228 | |
| 229 | /* V (output) REAL array, dimension (LDV,P) */ |
| 230 | /* If JOBV = 'V', V contains the P-by-P orthogonal matrix V. */ |
| 231 | /* If JOBV = 'N', V is not referenced. */ |
| 232 | |
| 233 | /* LDV (input) INTEGER */ |
| 234 | /* The leading dimension of the array V. LDV >= max(1,P) if */ |
| 235 | /* JOBV = 'V'; LDV >= 1 otherwise. */ |
| 236 | |
| 237 | /* Q (output) REAL array, dimension (LDQ,N) */ |
| 238 | /* If JOBQ = 'Q', Q contains the N-by-N orthogonal matrix Q. */ |
| 239 | /* If JOBQ = 'N', Q is not referenced. */ |
| 240 | |
| 241 | /* LDQ (input) INTEGER */ |
| 242 | /* The leading dimension of the array Q. LDQ >= max(1,N) if */ |
| 243 | /* JOBQ = 'Q'; LDQ >= 1 otherwise. */ |
| 244 | |
| 245 | /* WORK (workspace) REAL array, */ |
| 246 | /* dimension (max(3*N,M,P)+N) */ |
| 247 | |
| 248 | /* IWORK (workspace/output) INTEGER array, dimension (N) */ |
| 249 | /* On exit, IWORK stores the sorting information. More */ |
| 250 | /* precisely, the following loop will sort ALPHA */ |
| 251 | /* for I = K+1, min(M,K+L) */ |
| 252 | /* swap ALPHA(I) and ALPHA(IWORK(I)) */ |
| 253 | /* endfor */ |
| 254 | /* such that ALPHA(1) >= ALPHA(2) >= ... >= ALPHA(N). */ |
| 255 | |
| 256 | /* INFO (output)INTEGER */ |
| 257 | /* = 0: successful exit */ |
| 258 | /* < 0: if INFO = -i, the i-th argument had an illegal value. */ |
| 259 | /* > 0: if INFO = 1, the Jacobi-type procedure failed to */ |
| 260 | /* converge. For further details, see subroutine STGSJA. */ |
| 261 | |
| 262 | /* Internal Parameters */ |
| 263 | /* =================== */ |
| 264 | |
| 265 | /* TOLA REAL */ |
| 266 | /* TOLB REAL */ |
| 267 | /* TOLA and TOLB are the thresholds to determine the effective */ |
| 268 | /* rank of (A',B')'. Generally, they are set to */ |
| 269 | /* TOLA = MAX(M,N)*norm(A)*MACHEPS, */ |
| 270 | /* TOLB = MAX(P,N)*norm(B)*MACHEPS. */ |
| 271 | /* The size of TOLA and TOLB may affect the size of backward */ |
| 272 | /* errors of the decomposition. */ |
| 273 | |
| 274 | /* Further Details */ |
| 275 | /* =============== */ |
| 276 | |
| 277 | /* 2-96 Based on modifications by */ |
| 278 | /* Ming Gu and Huan Ren, Computer Science Division, University of */ |
| 279 | /* California at Berkeley, USA */ |
| 280 | |
| 281 | /* ===================================================================== */ |
| 282 | |
| 283 | /* .. Local Scalars .. */ |
| 284 | /*< LOGICAL WANTQ, WANTU, WANTV >*/ |
| 285 | /*< INTEGER I, IBND, ISUB, J, NCYCLE >*/ |
| 286 | /*< REAL ANORM, BNORM, SMAX, TEMP, TOLA, TOLB, ULP, UNFL >*/ |
| 287 | /* .. */ |
| 288 | /* .. External Functions .. */ |
| 289 | /*< LOGICAL LSAME >*/ |
| 290 | /*< REAL SLAMCH, SLANGE >*/ |
| 291 | /*< EXTERNAL LSAME, SLAMCH, SLANGE >*/ |
| 292 | /* .. */ |
| 293 | /* .. External Subroutines .. */ |
| 294 | /*< EXTERNAL SCOPY, SGGSVP, STGSJA, XERBLA >*/ |
| 295 | /* .. */ |
| 296 | /* .. Intrinsic Functions .. */ |
| 297 | /*< INTRINSIC MAX, MIN >*/ |
| 298 | /* .. */ |
| 299 | /* .. Executable Statements .. */ |
| 300 | |
| 301 | /* Test the input parameters */ |
| 302 | |
| 303 | /*< WANTU = LSAME( JOBU, 'U' ) >*/ |
| 304 | /* Parameter adjustments */ |
| 305 | a_dim1 = *lda; |
| 306 | a_offset = 1 + a_dim1; |
| 307 | a -= a_offset; |
| 308 | b_dim1 = *ldb; |
| 309 | b_offset = 1 + b_dim1; |
| 310 | b -= b_offset; |
| 311 | --alpha; |
| 312 | --beta; |
| 313 | u_dim1 = *ldu; |
| 314 | u_offset = 1 + u_dim1; |
| 315 | u -= u_offset; |
| 316 | v_dim1 = *ldv; |
| 317 | v_offset = 1 + v_dim1; |
| 318 | v -= v_offset; |
| 319 | q_dim1 = *ldq; |
| 320 | q_offset = 1 + q_dim1; |
| 321 | q -= q_offset; |
| 322 | --work; |
| 323 | --iwork; |
| 324 | |
| 325 | /* Function Body */ |
| 326 | wantu = lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobu, "U", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 327 | /*< WANTV = LSAME( JOBV, 'V' ) >*/ |
| 328 | wantv = lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobv, "V", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 329 | /*< WANTQ = LSAME( JOBQ, 'Q' ) >*/ |
| 330 | wantq = lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobq, "Q", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 331 | |
| 332 | /*< INFO = 0 >*/ |
| 333 | *info = 0; |
| 334 | /*< IF( .NOT.( WANTU .OR. LSAME( JOBU, 'N' ) ) ) THEN >*/ |
| 335 | if (! (wantu || lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobu, "N", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1))) { |
| 336 | /*< INFO = -1 >*/ |
| 337 | *info = -1; |
| 338 | /*< ELSE IF( .NOT.( WANTV .OR. LSAME( JOBV, 'N' ) ) ) THEN >*/ |
| 339 | } else if (! (wantv || lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobv, "N", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1))) { |
| 340 | /*< INFO = -2 >*/ |
| 341 | *info = -2; |
| 342 | /*< ELSE IF( .NOT.( WANTQ .OR. LSAME( JOBQ, 'N' ) ) ) THEN >*/ |
| 343 | } else if (! (wantq || lsame_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:194:9`!(jobq, "N", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1))) { |
| 344 | /*< INFO = -3 >*/ |
| 345 | *info = -3; |
| 346 | /*< ELSE IF( M.LT.0 ) THEN >*/ |
| 347 | } else if (*m < 0) { |
| 348 | /*< INFO = -4 >*/ |
| 349 | *info = -4; |
| 350 | /*< ELSE IF( N.LT.0 ) THEN >*/ |
| 351 | } else if (*n < 0) { |
| 352 | /*< INFO = -5 >*/ |
| 353 | *info = -5; |
| 354 | /*< ELSE IF( P.LT.0 ) THEN >*/ |
| 355 | } else if (*p < 0) { |
| 356 | /*< INFO = -6 >*/ |
| 357 | *info = -6; |
| 358 | /*< ELSE IF( LDA.LT.MAX( 1, M ) ) THEN >*/ |
| 359 | } else if (*lda < maxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:160:9`!(1,*m)) { |
| 360 | /*< INFO = -10 >*/ |
| 361 | *info = -10; |
| 362 | /*< ELSE IF( LDB.LT.MAX( 1, P ) ) THEN >*/ |
| 363 | } else if (*ldb < maxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:160:9`!(1,*p)) { |
| 364 | /*< INFO = -12 >*/ |
| 365 | *info = -12; |
| 366 | /*< ELSE IF( LDU.LT.1 .OR. ( WANTU .AND. LDU.LT.M ) ) THEN >*/ |
| 367 | } else if (*ldu < 1 || (wantu && *ldu < *m)) { |
| 368 | /*< INFO = -16 >*/ |
| 369 | *info = -16; |
| 370 | /*< ELSE IF( LDV.LT.1 .OR. ( WANTV .AND. LDV.LT.P ) ) THEN >*/ |
| 371 | } else if (*ldv < 1 || (wantv && *ldv < *p)) { |
| 372 | /*< INFO = -18 >*/ |
| 373 | *info = -18; |
| 374 | /*< ELSE IF( LDQ.LT.1 .OR. ( WANTQ .AND. LDQ.LT.N ) ) THEN >*/ |
| 375 | } else if (*ldq < 1 || (wantq && *ldq < *n)) { |
| 376 | /*< INFO = -20 >*/ |
| 377 | *info = -20; |
| 378 | /*< END IF >*/ |
| 379 | } |
| 380 | /*< IF( INFO.NE.0 ) THEN >*/ |
| 381 | if (*info != 0) { |
| 382 | /*< CALL XERBLA( 'SGGSVD', -INFO ) >*/ |
| 383 | i__1 = -(*info); |
| 384 | xerbla_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:303:9`!("SGGSVD", &i__1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)6); |
| 385 | /*< RETURN >*/ |
| 386 | return 0; |
| 387 | /*< END IF >*/ |
| 388 | } |
| 389 | |
| 390 | /* Compute the Frobenius norm of matrices A and B */ |
| 391 | |
| 392 | /*< ANORM = SLANGE( '1', M, N, A, LDA, WORK ) >*/ |
| 393 | anorm = slange_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:254:9`!("1", m, n, &a[a_offset], lda, &work[1], (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 394 | /*< BNORM = SLANGE( '1', P, N, B, LDB, WORK ) >*/ |
| 395 | bnorm = slange_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:254:9`!("1", p, n, &b[b_offset], ldb, &work[1], (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 396 | |
| 397 | /* Get machine precision and set up threshold for determining */ |
| 398 | /* the effective numerical rank of the matrices A and B. */ |
| 399 | |
| 400 | /*< ULP = SLAMCH( 'Precision' ) >*/ |
| 401 | ulp = slamch_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:253:9`!("Precision", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)9); |
| 402 | /*< UNFL = SLAMCH( 'Safe Minimum' ) >*/ |
| 403 | unfl = slamch_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:253:9`!("Safe Minimum", (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)12); |
| 404 | /*< TOLA = MAX( M, N )*MAX( ANORM, UNFL )*ULP >*/ |
| 405 | tola = maxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:160:9`!(*m,*n) * dmaxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:162:9`!(anorm,unfl) * ulp; |
| 406 | /*< TOLB = MAX( P, N )*MAX( BNORM, UNFL )*ULP >*/ |
| 407 | tolb = maxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:160:9`!(*p,*n) * dmaxcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:162:9`!(bnorm,unfl) * ulp; |
| 408 | |
| 409 | /* Preprocessing */ |
| 410 | |
| 411 | /*< >*/ |
| 412 | sggsvp_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:244:9`!(jobu, jobv, jobq, m, p, n, &a[a_offset], lda, &b[b_offset], ldb, & |
| 413 | tola, &tolb, k, l, &u[u_offset], ldu, &v[v_offset], ldv, &q[ |
| 414 | q_offset], ldq, &iwork[1], &work[1], &work[*n + 1], info, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!) |
| 415 | 1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 416 | |
| 417 | /* Compute the GSVD of two upper "triangular" matrices */ |
| 418 | |
| 419 | /*< >*/ |
| 420 | stgsja_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:289:9`!(jobu, jobv, jobq, m, p, n, k, l, &a[a_offset], lda, &b[b_offset], |
| 421 | ldb, &tola, &tolb, &alpha[1], &beta[1], &u[u_offset], ldu, &v[ |
| 422 | v_offset], ldv, &q[q_offset], ldq, &work[1], &ncycle, info, ( |
| 423 | ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1, (ftnlencxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:60:9`!)1); |
| 424 | |
| 425 | /* Sort the singular values and store the pivot indices in IWORK */ |
| 426 | /* Copy ALPHA to WORK, then sort ALPHA in WORK */ |
| 427 | |
| 428 | /*< CALL SCOPY( N, ALPHA, 1, WORK, 1 ) >*/ |
| 429 | scopy_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:230:9`!(n, &alpha[1], &c__1cxx . . $ c__1., &work[1], &c__1cxx . . $ c__1.); |
| 430 | /*< IBND = MIN( L, M-K ) >*/ |
| 431 | /* Computing MIN */ |
| 432 | i__1 = *l, i__2 = *m - *k; |
| 433 | ibnd = mincxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:159:9`!(i__1,i__2); |
| 434 | /*< DO 20 I = 1, IBND >*/ |
| 435 | i__1 = ibnd; |
| 436 | for (i__ = 1; i__ <= i__1; ++i__) { |
| 437 | |
| 438 | /* Scan for largest ALPHA(K+I) */ |
| 439 | |
| 440 | /*< ISUB = I >*/ |
| 441 | isub = i__; |
| 442 | /*< SMAX = WORK( K+I ) >*/ |
| 443 | smax = work[*k + i__]; |
| 444 | /*< DO 10 J = I + 1, IBND >*/ |
| 445 | i__2 = ibnd; |
| 446 | for (j = i__ + 1; j <= i__2; ++j) { |
| 447 | /*< TEMP = WORK( K+J ) >*/ |
| 448 | temp = work[*k + j]; |
| 449 | /*< IF( TEMP.GT.SMAX ) THEN >*/ |
| 450 | if (temp > smax) { |
| 451 | /*< ISUB = J >*/ |
| 452 | isub = j; |
| 453 | /*< SMAX = TEMP >*/ |
| 454 | smax = temp; |
| 455 | /*< END IF >*/ |
| 456 | } |
| 457 | /*< 10 CONTINUE >*/ |
| 458 | /* L10: */ |
| 459 | } |
| 460 | /*< IF( ISUB.NE.I ) THEN >*/ |
| 461 | if (isub != i__) { |
| 462 | /*< WORK( K+ISUB ) = WORK( K+I ) >*/ |
| 463 | work[*k + isub] = work[*k + i__]; |
| 464 | /*< WORK( K+I ) = SMAX >*/ |
| 465 | work[*k + i__] = smax; |
| 466 | /*< IWORK( K+I ) = K + ISUB >*/ |
| 467 | iwork[*k + i__] = *k + isub; |
| 468 | /*< ELSE >*/ |
| 469 | } else { |
| 470 | /*< IWORK( K+I ) = K + I >*/ |
| 471 | iwork[*k + i__] = *k + i__; |
| 472 | /*< END IF >*/ |
| 473 | } |
| 474 | /*< 20 CONTINUE >*/ |
| 475 | /* L20: */ |
| 476 | } |
| 477 | |
| 478 | /*< RETURN >*/ |
| 479 | return 0; |
| 480 | |
| 481 | /* End of SGGSVD */ |
| 482 | |
| 483 | /*< END >*/ |
| 484 | } /* sggsvd_ */ |
| 485 | |
| 486 | #ifdef __cplusplus |
| 487 | } |
| 488 | #endif |