```001:       SUBROUTINE SLAUUM( UPLO, N, A, LDA, INFO )
002: *
003: *  -- LAPACK auxiliary routine (version 3.2) --
004: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
005: *     November 2006
006: *
007: *     .. Scalar Arguments ..
008:       CHARACTER          UPLO
009:       INTEGER            INFO, LDA, N
010: *     ..
011: *     .. Array Arguments ..
012:       REAL               A( LDA, * )
013: *     ..
014: *
015: *  Purpose
016: *  =======
017: *
018: *  SLAUUM computes the product U * U' or L' * L, where the triangular
019: *  factor U or L is stored in the upper or lower triangular part of
020: *  the array A.
021: *
022: *  If UPLO = 'U' or 'u' then the upper triangle of the result is stored,
023: *  overwriting the factor U in A.
024: *  If UPLO = 'L' or 'l' then the lower triangle of the result is stored,
025: *  overwriting the factor L in A.
026: *
027: *  This is the blocked form of the algorithm, calling Level 3 BLAS.
028: *
029: *  Arguments
030: *  =========
031: *
032: *  UPLO    (input) CHARACTER*1
033: *          Specifies whether the triangular factor stored in the array A
034: *          is upper or lower triangular:
035: *          = 'U':  Upper triangular
036: *          = 'L':  Lower triangular
037: *
038: *  N       (input) INTEGER
039: *          The order of the triangular factor U or L.  N >= 0.
040: *
041: *  A       (input/output) REAL array, dimension (LDA,N)
042: *          On entry, the triangular factor U or L.
043: *          On exit, if UPLO = 'U', the upper triangle of A is
044: *          overwritten with the upper triangle of the product U * U';
045: *          if UPLO = 'L', the lower triangle of A is overwritten with
046: *          the lower triangle of the product L' * L.
047: *
048: *  LDA     (input) INTEGER
049: *          The leading dimension of the array A.  LDA >= max(1,N).
050: *
051: *  INFO    (output) INTEGER
052: *          = 0: successful exit
053: *          < 0: if INFO = -k, the k-th argument had an illegal value
054: *
055: *  =====================================================================
056: *
057: *     .. Parameters ..
058:       REAL               ONE
059:       PARAMETER          ( ONE = 1.0E+0 )
060: *     ..
061: *     .. Local Scalars ..
062:       LOGICAL            UPPER
063:       INTEGER            I, IB, NB
064: *     ..
065: *     .. External Functions ..
066:       LOGICAL            LSAME
067:       INTEGER            ILAENV
068:       EXTERNAL           LSAME, ILAENV
069: *     ..
070: *     .. External Subroutines ..
071:       EXTERNAL           SGEMM, SLAUU2, SSYRK, STRMM, XERBLA
072: *     ..
073: *     .. Intrinsic Functions ..
074:       INTRINSIC          MAX, MIN
075: *     ..
076: *     .. Executable Statements ..
077: *
078: *     Test the input parameters.
079: *
080:       INFO = 0
081:       UPPER = LSAME( UPLO, 'U' )
082:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
083:          INFO = -1
084:       ELSE IF( N.LT.0 ) THEN
085:          INFO = -2
086:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
087:          INFO = -4
088:       END IF
089:       IF( INFO.NE.0 ) THEN
090:          CALL XERBLA( 'SLAUUM', -INFO )
091:          RETURN
092:       END IF
093: *
094: *     Quick return if possible
095: *
096:       IF( N.EQ.0 )
097:      \$   RETURN
098: *
099: *     Determine the block size for this environment.
100: *
101:       NB = ILAENV( 1, 'SLAUUM', UPLO, N, -1, -1, -1 )
102: *
103:       IF( NB.LE.1 .OR. NB.GE.N ) THEN
104: *
105: *        Use unblocked code
106: *
107:          CALL SLAUU2( UPLO, N, A, LDA, INFO )
108:       ELSE
109: *
110: *        Use blocked code
111: *
112:          IF( UPPER ) THEN
113: *
114: *           Compute the product U * U'.
115: *
116:             DO 10 I = 1, N, NB
117:                IB = MIN( NB, N-I+1 )
118:                CALL STRMM( 'Right', 'Upper', 'Transpose', 'Non-unit',
119:      \$                     I-1, IB, ONE, A( I, I ), LDA, A( 1, I ),
120:      \$                     LDA )
121:                CALL SLAUU2( 'Upper', IB, A( I, I ), LDA, INFO )
122:                IF( I+IB.LE.N ) THEN
123:                   CALL SGEMM( 'No transpose', 'Transpose', I-1, IB,
124:      \$                        N-I-IB+1, ONE, A( 1, I+IB ), LDA,
125:      \$                        A( I, I+IB ), LDA, ONE, A( 1, I ), LDA )
126:                   CALL SSYRK( 'Upper', 'No transpose', IB, N-I-IB+1,
127:      \$                        ONE, A( I, I+IB ), LDA, ONE, A( I, I ),
128:      \$                        LDA )
129:                END IF
130:    10       CONTINUE
131:          ELSE
132: *
133: *           Compute the product L' * L.
134: *
135:             DO 20 I = 1, N, NB
136:                IB = MIN( NB, N-I+1 )
137:                CALL STRMM( 'Left', 'Lower', 'Transpose', 'Non-unit', IB,
138:      \$                     I-1, ONE, A( I, I ), LDA, A( I, 1 ), LDA )
139:                CALL SLAUU2( 'Lower', IB, A( I, I ), LDA, INFO )
140:                IF( I+IB.LE.N ) THEN
141:                   CALL SGEMM( 'Transpose', 'No transpose', IB, I-1,
142:      \$                        N-I-IB+1, ONE, A( I+IB, I ), LDA,
143:      \$                        A( I+IB, 1 ), LDA, ONE, A( I, 1 ), LDA )
144:                   CALL SSYRK( 'Lower', 'Transpose', IB, N-I-IB+1, ONE,
145:      \$                        A( I+IB, I ), LDA, ONE, A( I, I ), LDA )
146:                END IF
147:    20       CONTINUE
148:          END IF
149:       END IF
150: *
151:       RETURN
152: *
153: *     End of SLAUUM
154: *
155:       END
156: ```