clarzb.c
Go to the documentation of this file.
00001 /* clarzb.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 complex c_b1 = {1.f,0.f};
00019 static integer c__1 = 1;
00020 
00021 /* Subroutine */ int clarzb_(char *side, char *trans, char *direct, char *
00022         storev, integer *m, integer *n, integer *k, integer *l, complex *v, 
00023         integer *ldv, complex *t, integer *ldt, complex *c__, integer *ldc, 
00024         complex *work, integer *ldwork)
00025 {
00026     /* System generated locals */
00027     integer c_dim1, c_offset, t_dim1, t_offset, v_dim1, v_offset, work_dim1, 
00028             work_offset, i__1, i__2, i__3, i__4, i__5;
00029     complex q__1;
00030 
00031     /* Local variables */
00032     integer i__, j, info;
00033     extern /* Subroutine */ int cgemm_(char *, char *, integer *, integer *, 
00034             integer *, complex *, complex *, integer *, complex *, integer *, 
00035             complex *, complex *, integer *);
00036     extern logical lsame_(char *, char *);
00037     extern /* Subroutine */ int ccopy_(integer *, complex *, integer *, 
00038             complex *, integer *), ctrmm_(char *, char *, char *, char *, 
00039             integer *, integer *, complex *, complex *, integer *, complex *, 
00040             integer *), clacgv_(integer *, 
00041             complex *, integer *), xerbla_(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 /*  CLARZB applies a complex block reflector H or its transpose H**H */
00058 /*  to a complex 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' (Conjugate 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) COMPLEX 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) COMPLEX 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) COMPLEX 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) COMPLEX 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_("CLARZB", &i__1);
00178         return 0;
00179     }
00180 
00181     if (lsame_(trans, "N")) {
00182         *(unsigned char *)transt = 'C';
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 ) = conjg( C( 1:k, 1:n )' ) */
00192 
00193         i__1 = *k;
00194         for (j = 1; j <= i__1; ++j) {
00195             ccopy_(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 /*                        conjg( C( m-l+1:m, 1:n )' ) * V( 1:k, 1:l )' */
00201 
00202         if (*l > 0) {
00203             cgemm_("Transpose", "Conjugate transpose", n, k, l, &c_b1, &c__[*
00204                     m - *l + 1 + c_dim1], ldc, &v[v_offset], ldv, &c_b1, &
00205                     work[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         ctrmm_("Right", "Lower", transt, "Non-unit", n, k, &c_b1, &t[t_offset]
00211 , ldt, &work[work_offset], ldwork);
00212 
00213 /*        C( 1:k, 1:n ) = C( 1:k, 1:n ) - conjg( 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                 i__3 = i__ + j * c_dim1;
00220                 i__4 = i__ + j * c_dim1;
00221                 i__5 = j + i__ * work_dim1;
00222                 q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[i__4].i - 
00223                         work[i__5].i;
00224                 c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00225 /* L20: */
00226             }
00227 /* L30: */
00228         }
00229 
00230 /*        C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ... */
00231 /*                    conjg( V( 1:k, 1:l )' ) * conjg( W( 1:n, 1:k )' ) */
00232 
00233         if (*l > 0) {
00234             q__1.r = -1.f, q__1.i = -0.f;
00235             cgemm_("Transpose", "Transpose", l, n, k, &q__1, &v[v_offset], 
00236                     ldv, &work[work_offset], ldwork, &c_b1, &c__[*m - *l + 1 
00237                     + c_dim1], ldc);
00238         }
00239 
00240     } else if (lsame_(side, "R")) {
00241 
00242 /*        Form  C * H  or  C * H' */
00243 
00244 /*        W( 1:m, 1:k ) = C( 1:m, 1:k ) */
00245 
00246         i__1 = *k;
00247         for (j = 1; j <= i__1; ++j) {
00248             ccopy_(m, &c__[j * c_dim1 + 1], &c__1, &work[j * work_dim1 + 1], &
00249                     c__1);
00250 /* L40: */
00251         }
00252 
00253 /*        W( 1:m, 1:k ) = W( 1:m, 1:k ) + ... */
00254 /*                        C( 1:m, n-l+1:n ) * conjg( V( 1:k, 1:l )' ) */
00255 
00256         if (*l > 0) {
00257             cgemm_("No transpose", "Transpose", m, k, l, &c_b1, &c__[(*n - *l 
00258                     + 1) * c_dim1 + 1], ldc, &v[v_offset], ldv, &c_b1, &work[
00259                     work_offset], ldwork);
00260         }
00261 
00262 /*        W( 1:m, 1:k ) = W( 1:m, 1:k ) * conjg( T )  or */
00263 /*                        W( 1:m, 1:k ) * conjg( T' ) */
00264 
00265         i__1 = *k;
00266         for (j = 1; j <= i__1; ++j) {
00267             i__2 = *k - j + 1;
00268             clacgv_(&i__2, &t[j + j * t_dim1], &c__1);
00269 /* L50: */
00270         }
00271         ctrmm_("Right", "Lower", trans, "Non-unit", m, k, &c_b1, &t[t_offset], 
00272                  ldt, &work[work_offset], ldwork);
00273         i__1 = *k;
00274         for (j = 1; j <= i__1; ++j) {
00275             i__2 = *k - j + 1;
00276             clacgv_(&i__2, &t[j + j * t_dim1], &c__1);
00277 /* L60: */
00278         }
00279 
00280 /*        C( 1:m, 1:k ) = C( 1:m, 1:k ) - W( 1:m, 1:k ) */
00281 
00282         i__1 = *k;
00283         for (j = 1; j <= i__1; ++j) {
00284             i__2 = *m;
00285             for (i__ = 1; i__ <= i__2; ++i__) {
00286                 i__3 = i__ + j * c_dim1;
00287                 i__4 = i__ + j * c_dim1;
00288                 i__5 = i__ + j * work_dim1;
00289                 q__1.r = c__[i__4].r - work[i__5].r, q__1.i = c__[i__4].i - 
00290                         work[i__5].i;
00291                 c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00292 /* L70: */
00293             }
00294 /* L80: */
00295         }
00296 
00297 /*        C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ... */
00298 /*                            W( 1:m, 1:k ) * conjg( V( 1:k, 1:l ) ) */
00299 
00300         i__1 = *l;
00301         for (j = 1; j <= i__1; ++j) {
00302             clacgv_(k, &v[j * v_dim1 + 1], &c__1);
00303 /* L90: */
00304         }
00305         if (*l > 0) {
00306             q__1.r = -1.f, q__1.i = -0.f;
00307             cgemm_("No transpose", "No transpose", m, l, k, &q__1, &work[
00308                     work_offset], ldwork, &v[v_offset], ldv, &c_b1, &c__[(*n 
00309                     - *l + 1) * c_dim1 + 1], ldc);
00310         }
00311         i__1 = *l;
00312         for (j = 1; j <= i__1; ++j) {
00313             clacgv_(k, &v[j * v_dim1 + 1], &c__1);
00314 /* L100: */
00315         }
00316 
00317     }
00318 
00319     return 0;
00320 
00321 /*     End of CLARZB */
00322 
00323 } /* clarzb_ */


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