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


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