kusano 2b45e8
      SUBROUTINE CLAUUMF( UPLO, N, A, LDA, INFO )
kusano 2b45e8
*
kusano 2b45e8
*  -- LAPACK auxiliary routine (version 3.0) --
kusano 2b45e8
*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
kusano 2b45e8
*     Courant Institute, Argonne National Lab, and Rice University
kusano 2b45e8
*     September 30, 1994
kusano 2b45e8
*
kusano 2b45e8
*     .. Scalar Arguments ..
kusano 2b45e8
      CHARACTER          UPLO
kusano 2b45e8
      INTEGER            INFO, LDA, N
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Array Arguments ..
kusano 2b45e8
      COMPLEX            A( LDA, * )
kusano 2b45e8
*     ..
kusano 2b45e8
*
kusano 2b45e8
*  Purpose
kusano 2b45e8
*  =======
kusano 2b45e8
*
kusano 2b45e8
*  CLAUUM computes the product U * U' or L' * L, where the triangular
kusano 2b45e8
*  factor U or L is stored in the upper or lower triangular part of
kusano 2b45e8
*  the array A.
kusano 2b45e8
*
kusano 2b45e8
*  If UPLO = 'U' or 'u' then the upper triangle of the result is stored,
kusano 2b45e8
*  overwriting the factor U in A.
kusano 2b45e8
*  If UPLO = 'L' or 'l' then the lower triangle of the result is stored,
kusano 2b45e8
*  overwriting the factor L in A.
kusano 2b45e8
*
kusano 2b45e8
*  This is the blocked form of the algorithm, calling Level 3 BLAS.
kusano 2b45e8
*
kusano 2b45e8
*  Arguments
kusano 2b45e8
*  =========
kusano 2b45e8
*
kusano 2b45e8
*  UPLO    (input) CHARACTER*1
kusano 2b45e8
*          Specifies whether the triangular factor stored in the array A
kusano 2b45e8
*          is upper or lower triangular:
kusano 2b45e8
*          = 'U':  Upper triangular
kusano 2b45e8
*          = 'L':  Lower triangular
kusano 2b45e8
*
kusano 2b45e8
*  N       (input) INTEGER
kusano 2b45e8
*          The order of the triangular factor U or L.  N >= 0.
kusano 2b45e8
*
kusano 2b45e8
*  A       (input/output) COMPLEX array, dimension (LDA,N)
kusano 2b45e8
*          On entry, the triangular factor U or L.
kusano 2b45e8
*          On exit, if UPLO = 'U', the upper triangle of A is
kusano 2b45e8
*          overwritten with the upper triangle of the product U * U';
kusano 2b45e8
*          if UPLO = 'L', the lower triangle of A is overwritten with
kusano 2b45e8
*          the lower triangle of the product L' * L.
kusano 2b45e8
*
kusano 2b45e8
*  LDA     (input) INTEGER
kusano 2b45e8
*          The leading dimension of the array A.  LDA >= max(1,N).
kusano 2b45e8
*
kusano 2b45e8
*  INFO    (output) INTEGER
kusano 2b45e8
*          = 0: successful exit
kusano 2b45e8
*          < 0: if INFO = -k, the k-th argument had an illegal value
kusano 2b45e8
*
kusano 2b45e8
*  =====================================================================
kusano 2b45e8
*
kusano 2b45e8
*     .. Parameters ..
kusano 2b45e8
      REAL               ONE
kusano 2b45e8
      PARAMETER          ( ONE = 1.0E+0 )
kusano 2b45e8
      COMPLEX            CONE
kusano 2b45e8
      PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ) )
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      LOGICAL            UPPER
kusano 2b45e8
      INTEGER            I, IB, NB
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LSAME
kusano 2b45e8
      INTEGER            ILAENV
kusano 2b45e8
      EXTERNAL           LSAME, ILAENV
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CGEMM, CHERK, CLAUU2, CTRMM, XERBLA
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          MAX, MIN
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Executable Statements ..
kusano 2b45e8
*
kusano 2b45e8
*     Test the input parameters.
kusano 2b45e8
*
kusano 2b45e8
      INFO = 0
kusano 2b45e8
      UPPER = LSAME( UPLO, 'U' )
kusano 2b45e8
      IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
kusano 2b45e8
         INFO = -1
kusano 2b45e8
      ELSE IF( N.LT.0 ) THEN
kusano 2b45e8
         INFO = -2
kusano 2b45e8
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
kusano 2b45e8
         INFO = -4
kusano 2b45e8
      END IF
kusano 2b45e8
      IF( INFO.NE.0 ) THEN
kusano 2b45e8
         CALL XERBLA( 'CLAUUM', -INFO )
kusano 2b45e8
         RETURN
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
*     Quick return if possible
kusano 2b45e8
*
kusano 2b45e8
      IF( N.EQ.0 )
kusano 2b45e8
     $   RETURN
kusano 2b45e8
*
kusano 2b45e8
*     Determine the block size for this environment.
kusano 2b45e8
*
kusano 2b45e8
      NB = 128
kusano 2b45e8
*
kusano 2b45e8
      IF( NB.LE.1 .OR. NB.GE.N ) THEN
kusano 2b45e8
*
kusano 2b45e8
*        Use unblocked code
kusano 2b45e8
*
kusano 2b45e8
         CALL CLAUU2( UPLO, N, A, LDA, INFO )
kusano 2b45e8
      ELSE
kusano 2b45e8
*
kusano 2b45e8
*        Use blocked code
kusano 2b45e8
*
kusano 2b45e8
         IF( UPPER ) THEN
kusano 2b45e8
*
kusano 2b45e8
*           Compute the product U * U'.
kusano 2b45e8
*
kusano 2b45e8
            DO 10 I = 1, N, NB
kusano 2b45e8
               IB = MIN( NB, N-I+1 )
kusano 2b45e8
               CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose',
kusano 2b45e8
     $                     'Non-unit', I-1, IB, CONE, A( I, I ), LDA,
kusano 2b45e8
     $                     A( 1, I ), LDA )
kusano 2b45e8
               CALL CLAUU2( 'Upper', IB, A( I, I ), LDA, INFO )
kusano 2b45e8
               IF( I+IB.LE.N ) THEN
kusano 2b45e8
                  CALL CGEMM( 'No transpose', 'Conjugate transpose',
kusano 2b45e8
     $                        I-1, IB, N-I-IB+1, CONE, A( 1, I+IB ),
kusano 2b45e8
     $                        LDA, A( I, I+IB ), LDA, CONE, A( 1, I ),
kusano 2b45e8
     $                        LDA )
kusano 2b45e8
                  CALL CHERK( 'Upper', 'No transpose', IB, N-I-IB+1,
kusano 2b45e8
     $                        ONE, A( I, I+IB ), LDA, ONE, A( I, I ),
kusano 2b45e8
     $                        LDA )
kusano 2b45e8
               END IF
kusano 2b45e8
   10       CONTINUE
kusano 2b45e8
         ELSE
kusano 2b45e8
*
kusano 2b45e8
*           Compute the product L' * L.
kusano 2b45e8
*
kusano 2b45e8
            DO 20 I = 1, N, NB
kusano 2b45e8
               IB = MIN( NB, N-I+1 )
kusano 2b45e8
               CALL CTRMM( 'Left', 'Lower', 'Conjugate transpose',
kusano 2b45e8
     $                     'Non-unit', IB, I-1, CONE, A( I, I ), LDA,
kusano 2b45e8
     $                     A( I, 1 ), LDA )
kusano 2b45e8
               CALL CLAUU2( 'Lower', IB, A( I, I ), LDA, INFO )
kusano 2b45e8
               IF( I+IB.LE.N ) THEN
kusano 2b45e8
                  CALL CGEMM( 'Conjugate transpose', 'No transpose', IB,
kusano 2b45e8
     $                        I-1, N-I-IB+1, CONE, A( I+IB, I ), LDA,
kusano 2b45e8
     $                        A( I+IB, 1 ), LDA, CONE, A( I, 1 ), LDA )
kusano 2b45e8
                  CALL CHERK( 'Lower', 'Conjugate transpose', IB,
kusano 2b45e8
     $                        N-I-IB+1, ONE, A( I+IB, I ), LDA, ONE,
kusano 2b45e8
     $                        A( I, I ), LDA )
kusano 2b45e8
               END IF
kusano 2b45e8
   20       CONTINUE
kusano 2b45e8
         END IF
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of CLAUUM
kusano 2b45e8
*
kusano 2b45e8
      END