00001 /* sormhr.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Table of constant values */ 00017 00018 static integer c__1 = 1; 00019 static integer c_n1 = -1; 00020 static integer c__2 = 2; 00021 00022 /* Subroutine */ int sormhr_(char *side, char *trans, integer *m, integer *n, 00023 integer *ilo, integer *ihi, real *a, integer *lda, real *tau, real * 00024 c__, integer *ldc, real *work, integer *lwork, integer *info) 00025 { 00026 /* System generated locals */ 00027 address a__1[2]; 00028 integer a_dim1, a_offset, c_dim1, c_offset, i__1[2], i__2; 00029 char ch__1[2]; 00030 00031 /* Builtin functions */ 00032 /* Subroutine */ int s_cat(char *, char **, integer *, integer *, ftnlen); 00033 00034 /* Local variables */ 00035 integer i1, i2, nb, mi, nh, ni, nq, nw; 00036 logical left; 00037 extern logical lsame_(char *, char *); 00038 integer iinfo; 00039 extern /* Subroutine */ int xerbla_(char *, integer *); 00040 extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 00041 integer *, integer *); 00042 integer lwkopt; 00043 logical lquery; 00044 extern /* Subroutine */ int sormqr_(char *, char *, integer *, integer *, 00045 integer *, real *, integer *, real *, real *, integer *, real *, 00046 integer *, integer *); 00047 00048 00049 /* -- LAPACK routine (version 3.2) -- */ 00050 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00051 /* November 2006 */ 00052 00053 /* .. Scalar Arguments .. */ 00054 /* .. */ 00055 /* .. Array Arguments .. */ 00056 /* .. */ 00057 00058 /* Purpose */ 00059 /* ======= */ 00060 00061 /* SORMHR overwrites the general real M-by-N matrix C with */ 00062 00063 /* SIDE = 'L' SIDE = 'R' */ 00064 /* TRANS = 'N': Q * C C * Q */ 00065 /* TRANS = 'T': Q**T * C C * Q**T */ 00066 00067 /* where Q is a real orthogonal matrix of order nq, with nq = m if */ 00068 /* SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of */ 00069 /* IHI-ILO elementary reflectors, as returned by SGEHRD: */ 00070 00071 /* Q = H(ilo) H(ilo+1) . . . H(ihi-1). */ 00072 00073 /* Arguments */ 00074 /* ========= */ 00075 00076 /* SIDE (input) CHARACTER*1 */ 00077 /* = 'L': apply Q or Q**T from the Left; */ 00078 /* = 'R': apply Q or Q**T from the Right. */ 00079 00080 /* TRANS (input) CHARACTER*1 */ 00081 /* = 'N': No transpose, apply Q; */ 00082 /* = 'T': Transpose, apply Q**T. */ 00083 00084 /* M (input) INTEGER */ 00085 /* The number of rows of the matrix C. M >= 0. */ 00086 00087 /* N (input) INTEGER */ 00088 /* The number of columns of the matrix C. N >= 0. */ 00089 00090 /* ILO (input) INTEGER */ 00091 /* IHI (input) INTEGER */ 00092 /* ILO and IHI must have the same values as in the previous call */ 00093 /* of SGEHRD. Q is equal to the unit matrix except in the */ 00094 /* submatrix Q(ilo+1:ihi,ilo+1:ihi). */ 00095 /* If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and */ 00096 /* ILO = 1 and IHI = 0, if M = 0; */ 00097 /* if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and */ 00098 /* ILO = 1 and IHI = 0, if N = 0. */ 00099 00100 /* A (input) REAL array, dimension */ 00101 /* (LDA,M) if SIDE = 'L' */ 00102 /* (LDA,N) if SIDE = 'R' */ 00103 /* The vectors which define the elementary reflectors, as */ 00104 /* returned by SGEHRD. */ 00105 00106 /* LDA (input) INTEGER */ 00107 /* The leading dimension of the array A. */ 00108 /* LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'. */ 00109 00110 /* TAU (input) REAL array, dimension */ 00111 /* (M-1) if SIDE = 'L' */ 00112 /* (N-1) if SIDE = 'R' */ 00113 /* TAU(i) must contain the scalar factor of the elementary */ 00114 /* reflector H(i), as returned by SGEHRD. */ 00115 00116 /* C (input/output) REAL array, dimension (LDC,N) */ 00117 /* On entry, the M-by-N matrix C. */ 00118 /* On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q. */ 00119 00120 /* LDC (input) INTEGER */ 00121 /* The leading dimension of the array C. LDC >= max(1,M). */ 00122 00123 /* WORK (workspace/output) REAL array, dimension (MAX(1,LWORK)) */ 00124 /* On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */ 00125 00126 /* LWORK (input) INTEGER */ 00127 /* The dimension of the array WORK. */ 00128 /* If SIDE = 'L', LWORK >= max(1,N); */ 00129 /* if SIDE = 'R', LWORK >= max(1,M). */ 00130 /* For optimum performance LWORK >= N*NB if SIDE = 'L', and */ 00131 /* LWORK >= M*NB if SIDE = 'R', where NB is the optimal */ 00132 /* blocksize. */ 00133 00134 /* If LWORK = -1, then a workspace query is assumed; the routine */ 00135 /* only calculates the optimal size of the WORK array, returns */ 00136 /* this value as the first entry of the WORK array, and no error */ 00137 /* message related to LWORK is issued by XERBLA. */ 00138 00139 /* INFO (output) INTEGER */ 00140 /* = 0: successful exit */ 00141 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00142 00143 /* ===================================================================== */ 00144 00145 /* .. Local Scalars .. */ 00146 /* .. */ 00147 /* .. External Functions .. */ 00148 /* .. */ 00149 /* .. External Subroutines .. */ 00150 /* .. */ 00151 /* .. Intrinsic Functions .. */ 00152 /* .. */ 00153 /* .. Executable Statements .. */ 00154 00155 /* Test the input arguments */ 00156 00157 /* Parameter adjustments */ 00158 a_dim1 = *lda; 00159 a_offset = 1 + a_dim1; 00160 a -= a_offset; 00161 --tau; 00162 c_dim1 = *ldc; 00163 c_offset = 1 + c_dim1; 00164 c__ -= c_offset; 00165 --work; 00166 00167 /* Function Body */ 00168 *info = 0; 00169 nh = *ihi - *ilo; 00170 left = lsame_(side, "L"); 00171 lquery = *lwork == -1; 00172 00173 /* NQ is the order of Q and NW is the minimum dimension of WORK */ 00174 00175 if (left) { 00176 nq = *m; 00177 nw = *n; 00178 } else { 00179 nq = *n; 00180 nw = *m; 00181 } 00182 if (! left && ! lsame_(side, "R")) { 00183 *info = -1; 00184 } else if (! lsame_(trans, "N") && ! lsame_(trans, 00185 "T")) { 00186 *info = -2; 00187 } else if (*m < 0) { 00188 *info = -3; 00189 } else if (*n < 0) { 00190 *info = -4; 00191 } else if (*ilo < 1 || *ilo > max(1,nq)) { 00192 *info = -5; 00193 } else if (*ihi < min(*ilo,nq) || *ihi > nq) { 00194 *info = -6; 00195 } else if (*lda < max(1,nq)) { 00196 *info = -8; 00197 } else if (*ldc < max(1,*m)) { 00198 *info = -11; 00199 } else if (*lwork < max(1,nw) && ! lquery) { 00200 *info = -13; 00201 } 00202 00203 if (*info == 0) { 00204 if (left) { 00205 /* Writing concatenation */ 00206 i__1[0] = 1, a__1[0] = side; 00207 i__1[1] = 1, a__1[1] = trans; 00208 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2); 00209 nb = ilaenv_(&c__1, "SORMQR", ch__1, &nh, n, &nh, &c_n1); 00210 } else { 00211 /* Writing concatenation */ 00212 i__1[0] = 1, a__1[0] = side; 00213 i__1[1] = 1, a__1[1] = trans; 00214 s_cat(ch__1, a__1, i__1, &c__2, (ftnlen)2); 00215 nb = ilaenv_(&c__1, "SORMQR", ch__1, m, &nh, &nh, &c_n1); 00216 } 00217 lwkopt = max(1,nw) * nb; 00218 work[1] = (real) lwkopt; 00219 } 00220 00221 if (*info != 0) { 00222 i__2 = -(*info); 00223 xerbla_("SORMHR", &i__2); 00224 return 0; 00225 } else if (lquery) { 00226 return 0; 00227 } 00228 00229 /* Quick return if possible */ 00230 00231 if (*m == 0 || *n == 0 || nh == 0) { 00232 work[1] = 1.f; 00233 return 0; 00234 } 00235 00236 if (left) { 00237 mi = nh; 00238 ni = *n; 00239 i1 = *ilo + 1; 00240 i2 = 1; 00241 } else { 00242 mi = *m; 00243 ni = nh; 00244 i1 = 1; 00245 i2 = *ilo + 1; 00246 } 00247 00248 sormqr_(side, trans, &mi, &ni, &nh, &a[*ilo + 1 + *ilo * a_dim1], lda, & 00249 tau[*ilo], &c__[i1 + i2 * c_dim1], ldc, &work[1], lwork, &iinfo); 00250 00251 work[1] = (real) lwkopt; 00252 return 0; 00253 00254 /* End of SORMHR */ 00255 00256 } /* sormhr_ */