zlarfy.c
Go to the documentation of this file.
00001 /* zlarfy.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 doublecomplex c_b2 = {0.,0.};
00020 static integer c__1 = 1;
00021 
00022 /* Subroutine */ int zlarfy_(char *uplo, integer *n, doublecomplex *v, 
00023         integer *incv, doublecomplex *tau, doublecomplex *c__, integer *ldc, 
00024         doublecomplex *work)
00025 {
00026     /* System generated locals */
00027     integer c_dim1, c_offset;
00028     doublecomplex z__1, z__2, z__3, z__4;
00029 
00030     /* Local variables */
00031     extern /* Subroutine */ int zher2_(char *, integer *, doublecomplex *, 
00032             doublecomplex *, integer *, doublecomplex *, integer *, 
00033             doublecomplex *, integer *);
00034     doublecomplex alpha;
00035     extern /* Double Complex */ VOID zdotc_(doublecomplex *, integer *, 
00036             doublecomplex *, integer *, doublecomplex *, integer *);
00037     extern /* Subroutine */ int zhemv_(char *, integer *, doublecomplex *, 
00038             doublecomplex *, integer *, doublecomplex *, integer *, 
00039             doublecomplex *, doublecomplex *, integer *), zaxpy_(
00040             integer *, doublecomplex *, doublecomplex *, integer *, 
00041             doublecomplex *, integer *);
00042 
00043 
00044 /*  -- LAPACK auxiliary test routine (version 3.1) -- */
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 /*  ZLARFY applies an elementary reflector, or Householder matrix, H, */
00057 /*  to an n x n Hermitian matrix C, from both the left and the right. */
00058 
00059 /*  H is represented in the form */
00060 
00061 /*     H = I - tau * v * v' */
00062 
00063 /*  where  tau  is a scalar and  v  is a vector. */
00064 
00065 /*  If  tau  is  zero, then  H  is taken to be the unit matrix. */
00066 
00067 /*  Arguments */
00068 /*  ========= */
00069 
00070 /*  UPLO    (input) CHARACTER*1 */
00071 /*          Specifies whether the upper or lower triangular part of the */
00072 /*          Hermitian matrix C is stored. */
00073 /*          = 'U':  Upper triangle */
00074 /*          = 'L':  Lower triangle */
00075 
00076 /*  N       (input) INTEGER */
00077 /*          The number of rows and columns of the matrix C.  N >= 0. */
00078 
00079 /*  V       (input) COMPLEX*16 array, dimension */
00080 /*                  (1 + (N-1)*abs(INCV)) */
00081 /*          The vector v as described above. */
00082 
00083 /*  INCV    (input) INTEGER */
00084 /*          The increment between successive elements of v.  INCV must */
00085 /*          not be zero. */
00086 
00087 /*  TAU     (input) COMPLEX*16 */
00088 /*          The value tau as described above. */
00089 
00090 /*  C       (input/output) COMPLEX*16 array, dimension (LDC, N) */
00091 /*          On entry, the matrix C. */
00092 /*          On exit, C is overwritten by H * C * H'. */
00093 
00094 /*  LDC     (input) INTEGER */
00095 /*          The leading dimension of the array C.  LDC >= max( 1, N ). */
00096 
00097 /*  WORK    (workspace) COMPLEX*16 array, dimension (N) */
00098 
00099 /*  ===================================================================== */
00100 
00101 /*     .. Parameters .. */
00102 /*     .. */
00103 /*     .. Local Scalars .. */
00104 /*     .. */
00105 /*     .. External Subroutines .. */
00106 /*     .. */
00107 /*     .. External Functions .. */
00108 /*     .. */
00109 /*     .. Executable Statements .. */
00110 
00111     /* Parameter adjustments */
00112     --v;
00113     c_dim1 = *ldc;
00114     c_offset = 1 + c_dim1;
00115     c__ -= c_offset;
00116     --work;
00117 
00118     /* Function Body */
00119     if (tau->r == 0. && tau->i == 0.) {
00120         return 0;
00121     }
00122 
00123 /*     Form  w:= C * v */
00124 
00125     zhemv_(uplo, n, &c_b1, &c__[c_offset], ldc, &v[1], incv, &c_b2, &work[1], 
00126             &c__1);
00127 
00128     z__3.r = -.5, z__3.i = -0.;
00129     z__2.r = z__3.r * tau->r - z__3.i * tau->i, z__2.i = z__3.r * tau->i + 
00130             z__3.i * tau->r;
00131     zdotc_(&z__4, n, &work[1], &c__1, &v[1], incv);
00132     z__1.r = z__2.r * z__4.r - z__2.i * z__4.i, z__1.i = z__2.r * z__4.i + 
00133             z__2.i * z__4.r;
00134     alpha.r = z__1.r, alpha.i = z__1.i;
00135     zaxpy_(n, &alpha, &v[1], incv, &work[1], &c__1);
00136 
00137 /*     C := C - v * w' - w * v' */
00138 
00139     z__1.r = -tau->r, z__1.i = -tau->i;
00140     zher2_(uplo, n, &z__1, &v[1], incv, &work[1], &c__1, &c__[c_offset], ldc);
00141 
00142     return 0;
00143 
00144 /*     End of ZLARFY */
00145 
00146 } /* zlarfy_ */


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