clauum.c
Go to the documentation of this file.
00001 /* clauum.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 static integer c_n1 = -1;
00021 static real c_b21 = 1.f;
00022 
00023 /* Subroutine */ int clauum_(char *uplo, integer *n, complex *a, integer *lda, 
00024          integer *info)
00025 {
00026     /* System generated locals */
00027     integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00028 
00029     /* Local variables */
00030     integer i__, ib, nb;
00031     extern /* Subroutine */ int cgemm_(char *, char *, integer *, integer *, 
00032             integer *, complex *, complex *, integer *, complex *, integer *, 
00033             complex *, complex *, integer *), cherk_(char *, 
00034             char *, integer *, integer *, real *, complex *, integer *, real *
00035 , complex *, integer *);
00036     extern logical lsame_(char *, char *);
00037     extern /* Subroutine */ int ctrmm_(char *, char *, char *, char *, 
00038             integer *, integer *, complex *, complex *, integer *, complex *, 
00039             integer *);
00040     logical upper;
00041     extern /* Subroutine */ int clauu2_(char *, integer *, complex *, integer 
00042             *, integer *), xerbla_(char *, integer *);
00043     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00044             integer *, integer *);
00045 
00046 
00047 /*  -- LAPACK auxiliary routine (version 3.2) -- */
00048 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00049 /*     November 2006 */
00050 
00051 /*     .. Scalar Arguments .. */
00052 /*     .. */
00053 /*     .. Array Arguments .. */
00054 /*     .. */
00055 
00056 /*  Purpose */
00057 /*  ======= */
00058 
00059 /*  CLAUUM computes the product U * U' or L' * L, where the triangular */
00060 /*  factor U or L is stored in the upper or lower triangular part of */
00061 /*  the array A. */
00062 
00063 /*  If UPLO = 'U' or 'u' then the upper triangle of the result is stored, */
00064 /*  overwriting the factor U in A. */
00065 /*  If UPLO = 'L' or 'l' then the lower triangle of the result is stored, */
00066 /*  overwriting the factor L in A. */
00067 
00068 /*  This is the blocked form of the algorithm, calling Level 3 BLAS. */
00069 
00070 /*  Arguments */
00071 /*  ========= */
00072 
00073 /*  UPLO    (input) CHARACTER*1 */
00074 /*          Specifies whether the triangular factor stored in the array A */
00075 /*          is upper or lower triangular: */
00076 /*          = 'U':  Upper triangular */
00077 /*          = 'L':  Lower triangular */
00078 
00079 /*  N       (input) INTEGER */
00080 /*          The order of the triangular factor U or L.  N >= 0. */
00081 
00082 /*  A       (input/output) COMPLEX array, dimension (LDA,N) */
00083 /*          On entry, the triangular factor U or L. */
00084 /*          On exit, if UPLO = 'U', the upper triangle of A is */
00085 /*          overwritten with the upper triangle of the product U * U'; */
00086 /*          if UPLO = 'L', the lower triangle of A is overwritten with */
00087 /*          the lower triangle of the product L' * L. */
00088 
00089 /*  LDA     (input) INTEGER */
00090 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00091 
00092 /*  INFO    (output) INTEGER */
00093 /*          = 0: successful exit */
00094 /*          < 0: if INFO = -k, the k-th argument had an illegal value */
00095 
00096 /*  ===================================================================== */
00097 
00098 /*     .. Parameters .. */
00099 /*     .. */
00100 /*     .. Local Scalars .. */
00101 /*     .. */
00102 /*     .. External Functions .. */
00103 /*     .. */
00104 /*     .. External Subroutines .. */
00105 /*     .. */
00106 /*     .. Intrinsic Functions .. */
00107 /*     .. */
00108 /*     .. Executable Statements .. */
00109 
00110 /*     Test the input parameters. */
00111 
00112     /* Parameter adjustments */
00113     a_dim1 = *lda;
00114     a_offset = 1 + a_dim1;
00115     a -= a_offset;
00116 
00117     /* Function Body */
00118     *info = 0;
00119     upper = lsame_(uplo, "U");
00120     if (! upper && ! lsame_(uplo, "L")) {
00121         *info = -1;
00122     } else if (*n < 0) {
00123         *info = -2;
00124     } else if (*lda < max(1,*n)) {
00125         *info = -4;
00126     }
00127     if (*info != 0) {
00128         i__1 = -(*info);
00129         xerbla_("CLAUUM", &i__1);
00130         return 0;
00131     }
00132 
00133 /*     Quick return if possible */
00134 
00135     if (*n == 0) {
00136         return 0;
00137     }
00138 
00139 /*     Determine the block size for this environment. */
00140 
00141     nb = ilaenv_(&c__1, "CLAUUM", uplo, n, &c_n1, &c_n1, &c_n1);
00142 
00143     if (nb <= 1 || nb >= *n) {
00144 
00145 /*        Use unblocked code */
00146 
00147         clauu2_(uplo, n, &a[a_offset], lda, info);
00148     } else {
00149 
00150 /*        Use blocked code */
00151 
00152         if (upper) {
00153 
00154 /*           Compute the product U * U'. */
00155 
00156             i__1 = *n;
00157             i__2 = nb;
00158             for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00159 /* Computing MIN */
00160                 i__3 = nb, i__4 = *n - i__ + 1;
00161                 ib = min(i__3,i__4);
00162                 i__3 = i__ - 1;
00163                 ctrmm_("Right", "Upper", "Conjugate transpose", "Non-unit", &
00164                         i__3, &ib, &c_b1, &a[i__ + i__ * a_dim1], lda, &a[i__ 
00165                         * a_dim1 + 1], lda);
00166                 clauu2_("Upper", &ib, &a[i__ + i__ * a_dim1], lda, info);
00167                 if (i__ + ib <= *n) {
00168                     i__3 = i__ - 1;
00169                     i__4 = *n - i__ - ib + 1;
00170                     cgemm_("No transpose", "Conjugate transpose", &i__3, &ib, 
00171                             &i__4, &c_b1, &a[(i__ + ib) * a_dim1 + 1], lda, &
00172                             a[i__ + (i__ + ib) * a_dim1], lda, &c_b1, &a[i__ *
00173                              a_dim1 + 1], lda);
00174                     i__3 = *n - i__ - ib + 1;
00175                     cherk_("Upper", "No transpose", &ib, &i__3, &c_b21, &a[
00176                             i__ + (i__ + ib) * a_dim1], lda, &c_b21, &a[i__ + 
00177                             i__ * a_dim1], lda);
00178                 }
00179 /* L10: */
00180             }
00181         } else {
00182 
00183 /*           Compute the product L' * L. */
00184 
00185             i__2 = *n;
00186             i__1 = nb;
00187             for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
00188 /* Computing MIN */
00189                 i__3 = nb, i__4 = *n - i__ + 1;
00190                 ib = min(i__3,i__4);
00191                 i__3 = i__ - 1;
00192                 ctrmm_("Left", "Lower", "Conjugate transpose", "Non-unit", &
00193                         ib, &i__3, &c_b1, &a[i__ + i__ * a_dim1], lda, &a[i__ 
00194                         + a_dim1], lda);
00195                 clauu2_("Lower", &ib, &a[i__ + i__ * a_dim1], lda, info);
00196                 if (i__ + ib <= *n) {
00197                     i__3 = i__ - 1;
00198                     i__4 = *n - i__ - ib + 1;
00199                     cgemm_("Conjugate transpose", "No transpose", &ib, &i__3, 
00200                             &i__4, &c_b1, &a[i__ + ib + i__ * a_dim1], lda, &
00201                             a[i__ + ib + a_dim1], lda, &c_b1, &a[i__ + a_dim1]
00202 , lda);
00203                     i__3 = *n - i__ - ib + 1;
00204                     cherk_("Lower", "Conjugate transpose", &ib, &i__3, &c_b21, 
00205                              &a[i__ + ib + i__ * a_dim1], lda, &c_b21, &a[i__ 
00206                             + i__ * a_dim1], lda);
00207                 }
00208 /* L20: */
00209             }
00210         }
00211     }
00212 
00213     return 0;
00214 
00215 /*     End of CLAUUM */
00216 
00217 } /* clauum_ */


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