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


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