dopmtr.c
Go to the documentation of this file.
00001 /* dopmtr.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 
00020 /* Subroutine */ int dopmtr_(char *side, char *uplo, char *trans, integer *m, 
00021         integer *n, doublereal *ap, doublereal *tau, doublereal *c__, integer 
00022         *ldc, doublereal *work, integer *info)
00023 {
00024     /* System generated locals */
00025     integer c_dim1, c_offset, i__1, i__2;
00026 
00027     /* Local variables */
00028     integer i__, i1, i2, i3, ic, jc, ii, mi, ni, nq;
00029     doublereal aii;
00030     logical left;
00031     extern /* Subroutine */ int dlarf_(char *, integer *, integer *, 
00032             doublereal *, integer *, doublereal *, doublereal *, integer *, 
00033             doublereal *);
00034     extern logical lsame_(char *, char *);
00035     logical upper;
00036     extern /* Subroutine */ int xerbla_(char *, integer *);
00037     logical notran, forwrd;
00038 
00039 
00040 /*  -- LAPACK routine (version 3.2) -- */
00041 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00042 /*     November 2006 */
00043 
00044 /*     .. Scalar Arguments .. */
00045 /*     .. */
00046 /*     .. Array Arguments .. */
00047 /*     .. */
00048 
00049 /*  Purpose */
00050 /*  ======= */
00051 
00052 /*  DOPMTR overwrites the general real M-by-N matrix C with */
00053 
00054 /*                  SIDE = 'L'     SIDE = 'R' */
00055 /*  TRANS = 'N':      Q * C          C * Q */
00056 /*  TRANS = 'T':      Q**T * C       C * Q**T */
00057 
00058 /*  where Q is a real orthogonal matrix of order nq, with nq = m if */
00059 /*  SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of */
00060 /*  nq-1 elementary reflectors, as returned by DSPTRD using packed */
00061 /*  storage: */
00062 
00063 /*  if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1); */
00064 
00065 /*  if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1). */
00066 
00067 /*  Arguments */
00068 /*  ========= */
00069 
00070 /*  SIDE    (input) CHARACTER*1 */
00071 /*          = 'L': apply Q or Q**T from the Left; */
00072 /*          = 'R': apply Q or Q**T from the Right. */
00073 
00074 /*  UPLO    (input) CHARACTER*1 */
00075 /*          = 'U': Upper triangular packed storage used in previous */
00076 /*                 call to DSPTRD; */
00077 /*          = 'L': Lower triangular packed storage used in previous */
00078 /*                 call to DSPTRD. */
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 /*  AP      (input) DOUBLE PRECISION array, dimension */
00091 /*                               (M*(M+1)/2) if SIDE = 'L' */
00092 /*                               (N*(N+1)/2) if SIDE = 'R' */
00093 /*          The vectors which define the elementary reflectors, as */
00094 /*          returned by DSPTRD.  AP is modified by the routine but */
00095 /*          restored on exit. */
00096 
00097 /*  TAU     (input) DOUBLE PRECISION array, dimension (M-1) if SIDE = 'L' */
00098 /*                                     or (N-1) if SIDE = 'R' */
00099 /*          TAU(i) must contain the scalar factor of the elementary */
00100 /*          reflector H(i), as returned by DSPTRD. */
00101 
00102 /*  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N) */
00103 /*          On entry, the M-by-N matrix C. */
00104 /*          On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q. */
00105 
00106 /*  LDC     (input) INTEGER */
00107 /*          The leading dimension of the array C. LDC >= max(1,M). */
00108 
00109 /*  WORK    (workspace) DOUBLE PRECISION array, dimension */
00110 /*                                   (N) if SIDE = 'L' */
00111 /*                                   (M) if SIDE = 'R' */
00112 
00113 /*  INFO    (output) INTEGER */
00114 /*          = 0:  successful exit */
00115 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00116 
00117 /*  ===================================================================== */
00118 
00119 /*     .. Parameters .. */
00120 /*     .. */
00121 /*     .. Local Scalars .. */
00122 /*     .. */
00123 /*     .. External Functions .. */
00124 /*     .. */
00125 /*     .. External Subroutines .. */
00126 /*     .. */
00127 /*     .. Intrinsic Functions .. */
00128 /*     .. */
00129 /*     .. Executable Statements .. */
00130 
00131 /*     Test the input arguments */
00132 
00133     /* Parameter adjustments */
00134     --ap;
00135     --tau;
00136     c_dim1 = *ldc;
00137     c_offset = 1 + c_dim1;
00138     c__ -= c_offset;
00139     --work;
00140 
00141     /* Function Body */
00142     *info = 0;
00143     left = lsame_(side, "L");
00144     notran = lsame_(trans, "N");
00145     upper = lsame_(uplo, "U");
00146 
00147 /*     NQ is the order of Q */
00148 
00149     if (left) {
00150         nq = *m;
00151     } else {
00152         nq = *n;
00153     }
00154     if (! left && ! lsame_(side, "R")) {
00155         *info = -1;
00156     } else if (! upper && ! lsame_(uplo, "L")) {
00157         *info = -2;
00158     } else if (! notran && ! lsame_(trans, "T")) {
00159         *info = -3;
00160     } else if (*m < 0) {
00161         *info = -4;
00162     } else if (*n < 0) {
00163         *info = -5;
00164     } else if (*ldc < max(1,*m)) {
00165         *info = -9;
00166     }
00167     if (*info != 0) {
00168         i__1 = -(*info);
00169         xerbla_("DOPMTR", &i__1);
00170         return 0;
00171     }
00172 
00173 /*     Quick return if possible */
00174 
00175     if (*m == 0 || *n == 0) {
00176         return 0;
00177     }
00178 
00179     if (upper) {
00180 
00181 /*        Q was determined by a call to DSPTRD with UPLO = 'U' */
00182 
00183         forwrd = left && notran || ! left && ! notran;
00184 
00185         if (forwrd) {
00186             i1 = 1;
00187             i2 = nq - 1;
00188             i3 = 1;
00189             ii = 2;
00190         } else {
00191             i1 = nq - 1;
00192             i2 = 1;
00193             i3 = -1;
00194             ii = nq * (nq + 1) / 2 - 1;
00195         }
00196 
00197         if (left) {
00198             ni = *n;
00199         } else {
00200             mi = *m;
00201         }
00202 
00203         i__1 = i2;
00204         i__2 = i3;
00205         for (i__ = i1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00206             if (left) {
00207 
00208 /*              H(i) is applied to C(1:i,1:n) */
00209 
00210                 mi = i__;
00211             } else {
00212 
00213 /*              H(i) is applied to C(1:m,1:i) */
00214 
00215                 ni = i__;
00216             }
00217 
00218 /*           Apply H(i) */
00219 
00220             aii = ap[ii];
00221             ap[ii] = 1.;
00222             dlarf_(side, &mi, &ni, &ap[ii - i__ + 1], &c__1, &tau[i__], &c__[
00223                     c_offset], ldc, &work[1]);
00224             ap[ii] = aii;
00225 
00226             if (forwrd) {
00227                 ii = ii + i__ + 2;
00228             } else {
00229                 ii = ii - i__ - 1;
00230             }
00231 /* L10: */
00232         }
00233     } else {
00234 
00235 /*        Q was determined by a call to DSPTRD with UPLO = 'L'. */
00236 
00237         forwrd = left && ! notran || ! left && notran;
00238 
00239         if (forwrd) {
00240             i1 = 1;
00241             i2 = nq - 1;
00242             i3 = 1;
00243             ii = 2;
00244         } else {
00245             i1 = nq - 1;
00246             i2 = 1;
00247             i3 = -1;
00248             ii = nq * (nq + 1) / 2 - 1;
00249         }
00250 
00251         if (left) {
00252             ni = *n;
00253             jc = 1;
00254         } else {
00255             mi = *m;
00256             ic = 1;
00257         }
00258 
00259         i__2 = i2;
00260         i__1 = i3;
00261         for (i__ = i1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
00262             aii = ap[ii];
00263             ap[ii] = 1.;
00264             if (left) {
00265 
00266 /*              H(i) is applied to C(i+1:m,1:n) */
00267 
00268                 mi = *m - i__;
00269                 ic = i__ + 1;
00270             } else {
00271 
00272 /*              H(i) is applied to C(1:m,i+1:n) */
00273 
00274                 ni = *n - i__;
00275                 jc = i__ + 1;
00276             }
00277 
00278 /*           Apply H(i) */
00279 
00280             dlarf_(side, &mi, &ni, &ap[ii], &c__1, &tau[i__], &c__[ic + jc * 
00281                     c_dim1], ldc, &work[1]);
00282             ap[ii] = aii;
00283 
00284             if (forwrd) {
00285                 ii = ii + nq - i__ + 1;
00286             } else {
00287                 ii = ii - nq + i__ - 2;
00288             }
00289 /* L20: */
00290         }
00291     }
00292     return 0;
00293 
00294 /*     End of DOPMTR */
00295 
00296 } /* dopmtr_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:47