zlarz.c
Go to the documentation of this file.
00001 /* zlarz.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 doublecomplex c_b1 = {1.,0.};
00019 static integer c__1 = 1;
00020 
00021 /* Subroutine */ int zlarz_(char *side, integer *m, integer *n, integer *l, 
00022         doublecomplex *v, integer *incv, doublecomplex *tau, doublecomplex *
00023         c__, integer *ldc, doublecomplex *work)
00024 {
00025     /* System generated locals */
00026     integer c_dim1, c_offset;
00027     doublecomplex z__1;
00028 
00029     /* Local variables */
00030     extern logical lsame_(char *, char *);
00031     extern /* Subroutine */ int zgerc_(integer *, integer *, doublecomplex *, 
00032             doublecomplex *, integer *, doublecomplex *, integer *, 
00033             doublecomplex *, integer *), zgemv_(char *, integer *, integer *, 
00034             doublecomplex *, doublecomplex *, integer *, doublecomplex *, 
00035             integer *, doublecomplex *, doublecomplex *, integer *), 
00036             zgeru_(integer *, integer *, doublecomplex *, doublecomplex *, 
00037             integer *, doublecomplex *, integer *, doublecomplex *, integer *)
00038             , zcopy_(integer *, doublecomplex *, integer *, doublecomplex *, 
00039             integer *), zaxpy_(integer *, doublecomplex *, doublecomplex *, 
00040             integer *, doublecomplex *, integer *), zlacgv_(integer *, 
00041             doublecomplex *, integer *);
00042 
00043 
00044 /*  -- LAPACK routine (version 3.2) -- */
00045 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00046 /*     November 2006 */
00047 
00048 /*     .. Scalar Arguments .. */
00049 /*     .. */
00050 /*     .. Array Arguments .. */
00051 /*     .. */
00052 
00053 /*  Purpose */
00054 /*  ======= */
00055 
00056 /*  ZLARZ applies a complex elementary reflector H to a complex */
00057 /*  M-by-N matrix C, from either the left or the right. H is represented */
00058 /*  in the form */
00059 
00060 /*        H = I - tau * v * v' */
00061 
00062 /*  where tau is a complex scalar and v is a complex vector. */
00063 
00064 /*  If tau = 0, then H is taken to be the unit matrix. */
00065 
00066 /*  To apply H' (the conjugate transpose of H), supply conjg(tau) instead */
00067 /*  tau. */
00068 
00069 /*  H is a product of k elementary reflectors as returned by ZTZRZF. */
00070 
00071 /*  Arguments */
00072 /*  ========= */
00073 
00074 /*  SIDE    (input) CHARACTER*1 */
00075 /*          = 'L': form  H * C */
00076 /*          = 'R': form  C * H */
00077 
00078 /*  M       (input) INTEGER */
00079 /*          The number of rows of the matrix C. */
00080 
00081 /*  N       (input) INTEGER */
00082 /*          The number of columns of the matrix C. */
00083 
00084 /*  L       (input) INTEGER */
00085 /*          The number of entries of the vector V containing */
00086 /*          the meaningful part of the Householder vectors. */
00087 /*          If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0. */
00088 
00089 /*  V       (input) COMPLEX*16 array, dimension (1+(L-1)*abs(INCV)) */
00090 /*          The vector v in the representation of H as returned by */
00091 /*          ZTZRZF. V is not used if TAU = 0. */
00092 
00093 /*  INCV    (input) INTEGER */
00094 /*          The increment between elements of v. INCV <> 0. */
00095 
00096 /*  TAU     (input) COMPLEX*16 */
00097 /*          The value tau in the representation of H. */
00098 
00099 /*  C       (input/output) COMPLEX*16 array, dimension (LDC,N) */
00100 /*          On entry, the M-by-N matrix C. */
00101 /*          On exit, C is overwritten by the matrix H * C if SIDE = 'L', */
00102 /*          or C * H if SIDE = 'R'. */
00103 
00104 /*  LDC     (input) INTEGER */
00105 /*          The leading dimension of the array C. LDC >= max(1,M). */
00106 
00107 /*  WORK    (workspace) COMPLEX*16 array, dimension */
00108 /*                         (N) if SIDE = 'L' */
00109 /*                      or (M) if SIDE = 'R' */
00110 
00111 /*  Further Details */
00112 /*  =============== */
00113 
00114 /*  Based on contributions by */
00115 /*    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
00116 
00117 /*  ===================================================================== */
00118 
00119 /*     .. Parameters .. */
00120 /*     .. */
00121 /*     .. External Subroutines .. */
00122 /*     .. */
00123 /*     .. External Functions .. */
00124 /*     .. */
00125 /*     .. Executable Statements .. */
00126 
00127     /* Parameter adjustments */
00128     --v;
00129     c_dim1 = *ldc;
00130     c_offset = 1 + c_dim1;
00131     c__ -= c_offset;
00132     --work;
00133 
00134     /* Function Body */
00135     if (lsame_(side, "L")) {
00136 
00137 /*        Form  H * C */
00138 
00139         if (tau->r != 0. || tau->i != 0.) {
00140 
00141 /*           w( 1:n ) = conjg( C( 1, 1:n ) ) */
00142 
00143             zcopy_(n, &c__[c_offset], ldc, &work[1], &c__1);
00144             zlacgv_(n, &work[1], &c__1);
00145 
00146 /*           w( 1:n ) = conjg( w( 1:n ) + C( m-l+1:m, 1:n )' * v( 1:l ) ) */
00147 
00148             zgemv_("Conjugate transpose", l, n, &c_b1, &c__[*m - *l + 1 + 
00149                     c_dim1], ldc, &v[1], incv, &c_b1, &work[1], &c__1);
00150             zlacgv_(n, &work[1], &c__1);
00151 
00152 /*           C( 1, 1:n ) = C( 1, 1:n ) - tau * w( 1:n ) */
00153 
00154             z__1.r = -tau->r, z__1.i = -tau->i;
00155             zaxpy_(n, &z__1, &work[1], &c__1, &c__[c_offset], ldc);
00156 
00157 /*           C( m-l+1:m, 1:n ) = C( m-l+1:m, 1:n ) - ... */
00158 /*                               tau * v( 1:l ) * conjg( w( 1:n )' ) */
00159 
00160             z__1.r = -tau->r, z__1.i = -tau->i;
00161             zgeru_(l, n, &z__1, &v[1], incv, &work[1], &c__1, &c__[*m - *l + 
00162                     1 + c_dim1], ldc);
00163         }
00164 
00165     } else {
00166 
00167 /*        Form  C * H */
00168 
00169         if (tau->r != 0. || tau->i != 0.) {
00170 
00171 /*           w( 1:m ) = C( 1:m, 1 ) */
00172 
00173             zcopy_(m, &c__[c_offset], &c__1, &work[1], &c__1);
00174 
00175 /*           w( 1:m ) = w( 1:m ) + C( 1:m, n-l+1:n, 1:n ) * v( 1:l ) */
00176 
00177             zgemv_("No transpose", m, l, &c_b1, &c__[(*n - *l + 1) * c_dim1 + 
00178                     1], ldc, &v[1], incv, &c_b1, &work[1], &c__1);
00179 
00180 /*           C( 1:m, 1 ) = C( 1:m, 1 ) - tau * w( 1:m ) */
00181 
00182             z__1.r = -tau->r, z__1.i = -tau->i;
00183             zaxpy_(m, &z__1, &work[1], &c__1, &c__[c_offset], &c__1);
00184 
00185 /*           C( 1:m, n-l+1:n ) = C( 1:m, n-l+1:n ) - ... */
00186 /*                               tau * w( 1:m ) * v( 1:l )' */
00187 
00188             z__1.r = -tau->r, z__1.i = -tau->i;
00189             zgerc_(m, l, &z__1, &work[1], &c__1, &v[1], incv, &c__[(*n - *l + 
00190                     1) * c_dim1 + 1], ldc);
00191 
00192         }
00193 
00194     }
00195 
00196     return 0;
00197 
00198 /*     End of ZLARZ */
00199 
00200 } /* zlarz_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:41