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


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