kusano 2b45e8
      SUBROUTINE CLAUU2F( UPLO, N, A, LDA, INFO )
kusano 2b45e8
*
kusano 2b45e8
*  -- LAPACK auxiliary routine (version 3.1) --
kusano 2b45e8
*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
kusano 2b45e8
*     November 2006
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
*  CLAUU2 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 unblocked form of the algorithm, calling Level 2 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
      COMPLEX            ONE
kusano 2b45e8
      PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ) )
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Local Scalars ..
kusano 2b45e8
      LOGICAL            UPPER
kusano 2b45e8
      INTEGER            I
kusano 2b45e8
      REAL               AII
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. External Functions ..
kusano 2b45e8
      LOGICAL            LSAME
kusano 2b45e8
      COMPLEX            CDOTC
kusano 2b45e8
      EXTERNAL           LSAME, CDOTC
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. External Subroutines ..
kusano 2b45e8
      EXTERNAL           CGEMV, CLACGV, CSSCAL, XERBLA
kusano 2b45e8
*     ..
kusano 2b45e8
*     .. Intrinsic Functions ..
kusano 2b45e8
      INTRINSIC          CMPLX, MAX, REAL
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( 'CLAUU2', -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
      IF( UPPER ) THEN
kusano 2b45e8
*
kusano 2b45e8
*        Compute the product U * U'.
kusano 2b45e8
*
kusano 2b45e8
         DO 10 I = 1, N
kusano 2b45e8
            AII = A( I, I )
kusano 2b45e8
            IF( I.LT.N ) THEN
kusano 2b45e8
               A( I, I ) = AII*AII + REAL( CDOTC( N-I, A( I, I+1 ), LDA,
kusano 2b45e8
     $                     A( I, I+1 ), LDA ) )
kusano 2b45e8
               CALL CLACGV( N-I, A( I, I+1 ), LDA )
kusano 2b45e8
               CALL CGEMV( 'No transpose', I-1, N-I, ONE, A( 1, I+1 ),
kusano 2b45e8
     $                     LDA, A( I, I+1 ), LDA, CMPLX( AII ),
kusano 2b45e8
     $                     A( 1, I ), 1 )
kusano 2b45e8
               CALL CLACGV( N-I, A( I, I+1 ), LDA )
kusano 2b45e8
            ELSE
kusano 2b45e8
               CALL CSSCAL( I, AII, A( 1, I ), 1 )
kusano 2b45e8
            END IF
kusano 2b45e8
   10    CONTINUE
kusano 2b45e8
*
kusano 2b45e8
      ELSE
kusano 2b45e8
*
kusano 2b45e8
*        Compute the product L' * L.
kusano 2b45e8
*
kusano 2b45e8
         DO 20 I = 1, N
kusano 2b45e8
            AII = A( I, I )
kusano 2b45e8
            IF( I.LT.N ) THEN
kusano 2b45e8
               A( I, I ) = AII*AII + REAL( CDOTC( N-I, A( I+1, I ), 1,
kusano 2b45e8
     $                     A( I+1, I ), 1 ) )
kusano 2b45e8
               CALL CLACGV( I-1, A( I, 1 ), LDA )
kusano 2b45e8
               CALL CGEMV( 'Conjugate transpose', N-I, I-1, ONE,
kusano 2b45e8
     $                     A( I+1, 1 ), LDA, A( I+1, I ), 1,
kusano 2b45e8
     $                     CMPLX( AII ), A( I, 1 ), LDA )
kusano 2b45e8
               CALL CLACGV( I-1, A( I, 1 ), LDA )
kusano 2b45e8
            ELSE
kusano 2b45e8
               CALL CSSCAL( I, AII, A( I, 1 ), LDA )
kusano 2b45e8
            END IF
kusano 2b45e8
   20    CONTINUE
kusano 2b45e8
      END IF
kusano 2b45e8
*
kusano 2b45e8
      RETURN
kusano 2b45e8
*
kusano 2b45e8
*     End of CLAUU2
kusano 2b45e8
*
kusano 2b45e8
      END