clauu2.c
Go to the documentation of this file.
00001 /* clauu2.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 clauu2_(char *uplo, integer *n, complex *a, integer *lda, 
00022          integer *info)
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, i__1, i__2, i__3;
00026     real r__1;
00027     complex q__1;
00028 
00029     /* Local variables */
00030     integer i__;
00031     real aii;
00032     extern /* Complex */ VOID cdotc_(complex *, integer *, complex *, integer 
00033             *, complex *, integer *);
00034     extern logical lsame_(char *, char *);
00035     extern /* Subroutine */ int cgemv_(char *, integer *, integer *, complex *
00036 , complex *, integer *, complex *, integer *, complex *, complex *
00037 , integer *);
00038     logical upper;
00039     extern /* Subroutine */ int clacgv_(integer *, complex *, integer *), 
00040             csscal_(integer *, real *, complex *, integer *), xerbla_(char *, 
00041             integer *);
00042 
00043 
00044 /*  -- LAPACK auxiliary 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 /*  CLAUU2 computes the product U * U' or L' * L, where the triangular */
00057 /*  factor U or L is stored in the upper or lower triangular part of */
00058 /*  the array A. */
00059 
00060 /*  If UPLO = 'U' or 'u' then the upper triangle of the result is stored, */
00061 /*  overwriting the factor U in A. */
00062 /*  If UPLO = 'L' or 'l' then the lower triangle of the result is stored, */
00063 /*  overwriting the factor L in A. */
00064 
00065 /*  This is the unblocked form of the algorithm, calling Level 2 BLAS. */
00066 
00067 /*  Arguments */
00068 /*  ========= */
00069 
00070 /*  UPLO    (input) CHARACTER*1 */
00071 /*          Specifies whether the triangular factor stored in the array A */
00072 /*          is upper or lower triangular: */
00073 /*          = 'U':  Upper triangular */
00074 /*          = 'L':  Lower triangular */
00075 
00076 /*  N       (input) INTEGER */
00077 /*          The order of the triangular factor U or L.  N >= 0. */
00078 
00079 /*  A       (input/output) COMPLEX array, dimension (LDA,N) */
00080 /*          On entry, the triangular factor U or L. */
00081 /*          On exit, if UPLO = 'U', the upper triangle of A is */
00082 /*          overwritten with the upper triangle of the product U * U'; */
00083 /*          if UPLO = 'L', the lower triangle of A is overwritten with */
00084 /*          the lower triangle of the product L' * L. */
00085 
00086 /*  LDA     (input) INTEGER */
00087 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00088 
00089 /*  INFO    (output) INTEGER */
00090 /*          = 0: successful exit */
00091 /*          < 0: if INFO = -k, the k-th argument had an illegal value */
00092 
00093 /*  ===================================================================== */
00094 
00095 /*     .. Parameters .. */
00096 /*     .. */
00097 /*     .. Local Scalars .. */
00098 /*     .. */
00099 /*     .. External Functions .. */
00100 /*     .. */
00101 /*     .. External Subroutines .. */
00102 /*     .. */
00103 /*     .. Intrinsic Functions .. */
00104 /*     .. */
00105 /*     .. Executable Statements .. */
00106 
00107 /*     Test the input parameters. */
00108 
00109     /* Parameter adjustments */
00110     a_dim1 = *lda;
00111     a_offset = 1 + a_dim1;
00112     a -= a_offset;
00113 
00114     /* Function Body */
00115     *info = 0;
00116     upper = lsame_(uplo, "U");
00117     if (! upper && ! lsame_(uplo, "L")) {
00118         *info = -1;
00119     } else if (*n < 0) {
00120         *info = -2;
00121     } else if (*lda < max(1,*n)) {
00122         *info = -4;
00123     }
00124     if (*info != 0) {
00125         i__1 = -(*info);
00126         xerbla_("CLAUU2", &i__1);
00127         return 0;
00128     }
00129 
00130 /*     Quick return if possible */
00131 
00132     if (*n == 0) {
00133         return 0;
00134     }
00135 
00136     if (upper) {
00137 
00138 /*        Compute the product U * U'. */
00139 
00140         i__1 = *n;
00141         for (i__ = 1; i__ <= i__1; ++i__) {
00142             i__2 = i__ + i__ * a_dim1;
00143             aii = a[i__2].r;
00144             if (i__ < *n) {
00145                 i__2 = i__ + i__ * a_dim1;
00146                 i__3 = *n - i__;
00147                 cdotc_(&q__1, &i__3, &a[i__ + (i__ + 1) * a_dim1], lda, &a[
00148                         i__ + (i__ + 1) * a_dim1], lda);
00149                 r__1 = aii * aii + q__1.r;
00150                 a[i__2].r = r__1, a[i__2].i = 0.f;
00151                 i__2 = *n - i__;
00152                 clacgv_(&i__2, &a[i__ + (i__ + 1) * a_dim1], lda);
00153                 i__2 = i__ - 1;
00154                 i__3 = *n - i__;
00155                 q__1.r = aii, q__1.i = 0.f;
00156                 cgemv_("No transpose", &i__2, &i__3, &c_b1, &a[(i__ + 1) * 
00157                         a_dim1 + 1], lda, &a[i__ + (i__ + 1) * a_dim1], lda, &
00158                         q__1, &a[i__ * a_dim1 + 1], &c__1);
00159                 i__2 = *n - i__;
00160                 clacgv_(&i__2, &a[i__ + (i__ + 1) * a_dim1], lda);
00161             } else {
00162                 csscal_(&i__, &aii, &a[i__ * a_dim1 + 1], &c__1);
00163             }
00164 /* L10: */
00165         }
00166 
00167     } else {
00168 
00169 /*        Compute the product L' * L. */
00170 
00171         i__1 = *n;
00172         for (i__ = 1; i__ <= i__1; ++i__) {
00173             i__2 = i__ + i__ * a_dim1;
00174             aii = a[i__2].r;
00175             if (i__ < *n) {
00176                 i__2 = i__ + i__ * a_dim1;
00177                 i__3 = *n - i__;
00178                 cdotc_(&q__1, &i__3, &a[i__ + 1 + i__ * a_dim1], &c__1, &a[
00179                         i__ + 1 + i__ * a_dim1], &c__1);
00180                 r__1 = aii * aii + q__1.r;
00181                 a[i__2].r = r__1, a[i__2].i = 0.f;
00182                 i__2 = i__ - 1;
00183                 clacgv_(&i__2, &a[i__ + a_dim1], lda);
00184                 i__2 = *n - i__;
00185                 i__3 = i__ - 1;
00186                 q__1.r = aii, q__1.i = 0.f;
00187                 cgemv_("Conjugate transpose", &i__2, &i__3, &c_b1, &a[i__ + 1 
00188                         + a_dim1], lda, &a[i__ + 1 + i__ * a_dim1], &c__1, &
00189                         q__1, &a[i__ + a_dim1], lda);
00190                 i__2 = i__ - 1;
00191                 clacgv_(&i__2, &a[i__ + a_dim1], lda);
00192             } else {
00193                 csscal_(&i__, &aii, &a[i__ + a_dim1], lda);
00194             }
00195 /* L20: */
00196         }
00197     }
00198 
00199     return 0;
00200 
00201 /*     End of CLAUU2 */
00202 
00203 } /* clauu2_ */


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