dlarzb.c
Go to the documentation of this file.
00001 /* dlarzb.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 doublereal c_b13 = 1.;
00020 static doublereal c_b23 = -1.;
00021 
00022 /* Subroutine */ int dlarzb_(char *side, char *trans, char *direct, char *
00023         storev, integer *m, integer *n, integer *k, integer *l, doublereal *v, 
00024          integer *ldv, doublereal *t, integer *ldt, doublereal *c__, integer *
00025         ldc, doublereal *work, integer *ldwork)
00026 {
00027     /* System generated locals */
00028     integer c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset, work_dim1, 
00029             work_offset, i__1, i__2;
00030 
00031     /* Local variables */
00032     integer i__, j, info;
00033     extern /* Subroutine */ int dgemm_(char *, char *, integer *, integer *, 
00034             integer *, doublereal *, doublereal *, integer *, doublereal *, 
00035             integer *, doublereal *, doublereal *, integer *);
00036     extern logical lsame_(char *, char *);
00037     extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, 
00038             doublereal *, integer *), dtrmm_(char *, char *, char *, char *, 
00039             integer *, integer *, doublereal *, doublereal *, integer *, 
00040             doublereal *, integer *), xerbla_(
00041             char *, integer *);
00042     char transt[1];
00043 
00044 
00045 /*  -- LAPACK routine (version 3.2) -- */
00046 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00047 /*     November 2006 */
00048 
00049 /*     .. Scalar Arguments .. */
00050 /*     .. */
00051 /*     .. Array Arguments .. */
00052 /*     .. */
00053 
00054 /*  Purpose */
00055 /*  ======= */
00056 
00057 /*  DLARZB applies a real block reflector H or its transpose H**T to */
00058 /*  a real distributed M-by-N  C from the left or the right. */
00059 
00060 /*  Currently, only STOREV = 'R' and DIRECT = 'B' are supported. */
00061 
00062 /*  Arguments */
00063 /*  ========= */
00064 
00065 /*  SIDE    (input) CHARACTER*1 */
00066 /*          = 'L': apply H or H' from the Left */
00067 /*          = 'R': apply H or H' from the Right */
00068 
00069 /*  TRANS   (input) CHARACTER*1 */
00070 /*          = 'N': apply H (No transpose) */
00071 /*          = 'C': apply H' (Transpose) */
00072 
00073 /*  DIRECT  (input) CHARACTER*1 */
00074 /*          Indicates how H is formed from a product of elementary */
00075 /*          reflectors */
00076 /*          = 'F': H = H(1) H(2) . . . H(k) (Forward, not supported yet) */
00077 /*          = 'B': H = H(k) . . . H(2) H(1) (Backward) */
00078 
00079 /*  STOREV  (input) CHARACTER*1 */
00080 /*          Indicates how the vectors which define the elementary */
00081 /*          reflectors are stored: */
00082 /*          = 'C': Columnwise                        (not supported yet) */
00083 /*          = 'R': Rowwise */
00084 
00085 /*  M       (input) INTEGER */
00086 /*          The number of rows of the matrix C. */
00087 
00088 /*  N       (input) INTEGER */
00089 /*          The number of columns of the matrix C. */
00090 
00091 /*  K       (input) INTEGER */
00092 /*          The order of the matrix T (= the number of elementary */
00093 /*          reflectors whose product defines the block reflector). */
00094 
00095 /*  L       (input) INTEGER */
00096 /*          The number of columns of the matrix V containing the */
00097 /*          meaningful part of the Householder reflectors. */
00098 /*          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */
00099 
00100 /*  V       (input) DOUBLE PRECISION array, dimension (LDV,NV). */
00101 /*          If STOREV = 'C', NV = K; if STOREV = 'R', NV = L. */
00102 
00103 /*  LDV     (input) INTEGER */
00104 /*          The leading dimension of the array V. */
00105 /*          If STOREV = 'C', LDV >= L; if STOREV = 'R', LDV >= K. */
00106 
00107 /*  T       (input) DOUBLE PRECISION array, dimension (LDT,K) */
00108 /*          The triangular K-by-K matrix T in the representation of the */
00109 /*          block reflector. */
00110 
00111 /*  LDT     (input) INTEGER */
00112 /*          The leading dimension of the array T. LDT >= K. */
00113 
00114 /*  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N) */
00115 /*          On entry, the M-by-N matrix C. */
00116 /*          On exit, C is overwritten by H*C or H'*C or C*H or C*H'. */
00117 
00118 /*  LDC     (input) INTEGER */
00119 /*          The leading dimension of the array C. LDC >= max(1,M). */
00120 
00121 /*  WORK    (workspace) DOUBLE PRECISION array, dimension (LDWORK,K) */
00122 
00123 /*  LDWORK  (input) INTEGER */
00124 /*          The leading dimension of the array WORK. */
00125 /*          If SIDE = 'L', LDWORK >= max(1,N); */
00126 /*          if SIDE = 'R', LDWORK >= max(1,M). */
00127 
00128 /*  Further Details */
00129 /*  =============== */
00130 
00131 /*  Based on contributions by */
00132 /*    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
00133 
00134 /*  ===================================================================== */
00135 
00136 /*     .. Parameters .. */
00137 /*     .. */
00138 /*     .. Local Scalars .. */
00139 /*     .. */
00140 /*     .. External Functions .. */
00141 /*     .. */
00142 /*     .. External Subroutines .. */
00143 /*     .. */
00144 /*     .. Executable Statements .. */
00145 
00146 /*     Quick return if possible */
00147 
00148     /* Parameter adjustments */
00149     v_dim1 = *ldv;
00150     v_offset = 1 + v_dim1;
00151     v -= v_offset;
00152     t_dim1 = *ldt;
00153     t_offset = 1 + t_dim1;
00154     t -= t_offset;
00155     c_dim1 = *ldc;
00156     c_offset = 1 + c_dim1;
00157     c__ -= c_offset;
00158     work_dim1 = *ldwork;
00159     work_offset = 1 + work_dim1;
00160     work -= work_offset;
00161 
00162     /* Function Body */
00163     if (*m <= 0 || *n <= 0) {
00164         return 0;
00165     }
00166 
00167 /*     Check for currently supported options */
00168 
00169     info = 0;
00170     if (! lsame_(direct, "B")) {
00171         info = -3;
00172     } else if (! lsame_(storev, "R")) {
00173         info = -4;
00174     }
00175     if (info != 0) {
00176         i__1 = -info;
00177         xerbla_("DLARZB", &i__1);
00178         return 0;
00179     }
00180 
00181     if (lsame_(trans, "N")) {
00182         *(unsigned char *)transt = 'T';
00183     } else {
00184         *(unsigned char *)transt = 'N';
00185     }
00186 
00187     if (lsame_(side, "L")) {
00188 
00189 /*        Form  H * C  or  H' * C */
00190 
00191 /*        W( 1:n, 1:k ) = C( 1:k, 1:n )' */
00192 
00193         i__1 = *k;
00194         for (j = 1; j <= i__1; ++j) {
00195             dcopy_(n, &c__[j + c_dim1], ldc, &work[j * work_dim1 + 1], &c__1);
00196 /* L10: */
00197         }
00198 
00199 /*        W( 1:n, 1:k ) = W( 1:n, 1:k ) + ... */
00200 /*                        C( m-l+1:m, 1:n )' * V( 1:k, 1:l )' */
00201 
00202         if (*l > 0) {
00203             dgemm_("Transpose", "Transpose", n, k, l, &c_b13, &c__[*m - *l + 
00204                     1 + c_dim1], ldc, &v[v_offset], ldv, &c_b13, &work[
00205                     work_offset], ldwork);
00206         }
00207 
00208 /*        W( 1:n, 1:k ) = W( 1:n, 1:k ) * T'  or  W( 1:m, 1:k ) * T */
00209 
00210         dtrmm_("Right", "Lower", transt, "Non-unit", n, k, &c_b13, &t[
00211                 t_offset], ldt, &work[work_offset], ldwork);
00212 
00213 /*        C( 1:k, 1:n ) = C( 1:k, 1:n ) - W( 1:n, 1:k )' */
00214 
00215         i__1 = *n;
00216         for (j = 1; j <= i__1; ++j) {
00217             i__2 = *k;
00218             for (i__ = 1; i__ <= i__2; ++i__) {
00219                 c__[i__ + j * c_dim1] -= work[j + i__ * work_dim1];
00220 /* L20: */
00221             }
00222 /* L30: */
00223         }
00224 
00225 /*        C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ... */
00226 /*                            V( 1:k, 1:l )' * W( 1:n, 1:k )' */
00227 
00228         if (*l > 0) {
00229             dgemm_("Transpose", "Transpose", l, n, k, &c_b23, &v[v_offset], 
00230                     ldv, &work[work_offset], ldwork, &c_b13, &c__[*m - *l + 1 
00231                     + c_dim1], ldc);
00232         }
00233 
00234     } else if (lsame_(side, "R")) {
00235 
00236 /*        Form  C * H  or  C * H' */
00237 
00238 /*        W( 1:m, 1:k ) = C( 1:m, 1:k ) */
00239 
00240         i__1 = *k;
00241         for (j = 1; j <= i__1; ++j) {
00242             dcopy_(m, &c__[j * c_dim1 + 1], &c__1, &work[j * work_dim1 + 1], &
00243                     c__1);
00244 /* L40: */
00245         }
00246 
00247 /*        W( 1:m, 1:k ) = W( 1:m, 1:k ) + ... */
00248 /*                        C( 1:m, n-l+1:n ) * V( 1:k, 1:l )' */
00249 
00250         if (*l > 0) {
00251             dgemm_("No transpose", "Transpose", m, k, l, &c_b13, &c__[(*n - *
00252                     l + 1) * c_dim1 + 1], ldc, &v[v_offset], ldv, &c_b13, &
00253                     work[work_offset], ldwork);
00254         }
00255 
00256 /*        W( 1:m, 1:k ) = W( 1:m, 1:k ) * T  or  W( 1:m, 1:k ) * T' */
00257 
00258         dtrmm_("Right", "Lower", trans, "Non-unit", m, k, &c_b13, &t[t_offset]
00259 , ldt, &work[work_offset], ldwork);
00260 
00261 /*        C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k ) */
00262 
00263         i__1 = *k;
00264         for (j = 1; j <= i__1; ++j) {
00265             i__2 = *m;
00266             for (i__ = 1; i__ <= i__2; ++i__) {
00267                 c__[i__ + j * c_dim1] -= work[i__ + j * work_dim1];
00268 /* L50: */
00269             }
00270 /* L60: */
00271         }
00272 
00273 /*        C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ... */
00274 /*                            W( 1:m, 1:k ) * V( 1:k, 1:l ) */
00275 
00276         if (*l > 0) {
00277             dgemm_("No transpose", "No transpose", m, l, k, &c_b23, &work[
00278                     work_offset], ldwork, &v[v_offset], ldv, &c_b13, &c__[(*n 
00279                     - *l + 1) * c_dim1 + 1], ldc);
00280         }
00281 
00282     }
00283 
00284     return 0;
00285 
00286 /*     End of DLARZB */
00287 
00288 } /* dlarzb_ */


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