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


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