LAPACK 3.3.0

clauu2.f

Go to the documentation of this file.
00001       SUBROUTINE CLAUU2( UPLO, N, A, LDA, INFO )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.2) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *     November 2006
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            INFO, LDA, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       COMPLEX            A( LDA, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  CLAUU2 computes the product U * U' or L' * L, where the triangular
00020 *  factor U or L is stored in the upper or lower triangular part of
00021 *  the array A.
00022 *
00023 *  If UPLO = 'U' or 'u' then the upper triangle of the result is stored,
00024 *  overwriting the factor U in A.
00025 *  If UPLO = 'L' or 'l' then the lower triangle of the result is stored,
00026 *  overwriting the factor L in A.
00027 *
00028 *  This is the unblocked form of the algorithm, calling Level 2 BLAS.
00029 *
00030 *  Arguments
00031 *  =========
00032 *
00033 *  UPLO    (input) CHARACTER*1
00034 *          Specifies whether the triangular factor stored in the array A
00035 *          is upper or lower triangular:
00036 *          = 'U':  Upper triangular
00037 *          = 'L':  Lower triangular
00038 *
00039 *  N       (input) INTEGER
00040 *          The order of the triangular factor U or L.  N >= 0.
00041 *
00042 *  A       (input/output) COMPLEX array, dimension (LDA,N)
00043 *          On entry, the triangular factor U or L.
00044 *          On exit, if UPLO = 'U', the upper triangle of A is
00045 *          overwritten with the upper triangle of the product U * U';
00046 *          if UPLO = 'L', the lower triangle of A is overwritten with
00047 *          the lower triangle of the product L' * L.
00048 *
00049 *  LDA     (input) INTEGER
00050 *          The leading dimension of the array A.  LDA >= max(1,N).
00051 *
00052 *  INFO    (output) INTEGER
00053 *          = 0: successful exit
00054 *          < 0: if INFO = -k, the k-th argument had an illegal value
00055 *
00056 *  =====================================================================
00057 *
00058 *     .. Parameters ..
00059       COMPLEX            ONE
00060       PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ) )
00061 *     ..
00062 *     .. Local Scalars ..
00063       LOGICAL            UPPER
00064       INTEGER            I
00065       REAL               AII
00066 *     ..
00067 *     .. External Functions ..
00068       LOGICAL            LSAME
00069       COMPLEX            CDOTC
00070       EXTERNAL           LSAME, CDOTC
00071 *     ..
00072 *     .. External Subroutines ..
00073       EXTERNAL           CGEMV, CLACGV, CSSCAL, XERBLA
00074 *     ..
00075 *     .. Intrinsic Functions ..
00076       INTRINSIC          CMPLX, MAX, REAL
00077 *     ..
00078 *     .. Executable Statements ..
00079 *
00080 *     Test the input parameters.
00081 *
00082       INFO = 0
00083       UPPER = LSAME( UPLO, 'U' )
00084       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00085          INFO = -1
00086       ELSE IF( N.LT.0 ) THEN
00087          INFO = -2
00088       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00089          INFO = -4
00090       END IF
00091       IF( INFO.NE.0 ) THEN
00092          CALL XERBLA( 'CLAUU2', -INFO )
00093          RETURN
00094       END IF
00095 *
00096 *     Quick return if possible
00097 *
00098       IF( N.EQ.0 )
00099      $   RETURN
00100 *
00101       IF( UPPER ) THEN
00102 *
00103 *        Compute the product U * U'.
00104 *
00105          DO 10 I = 1, N
00106             AII = A( I, I )
00107             IF( I.LT.N ) THEN
00108                A( I, I ) = AII*AII + REAL( CDOTC( N-I, A( I, I+1 ), LDA,
     $                     A( I, I+1 ), LDA ) )
00109                CALL CLACGV( N-I, A( I, I+1 ), LDA )
00110                CALL CGEMV( 'No transpose', I-1, N-I, ONE, A( 1, I+1 ),
00111      $                     LDA, A( I, I+1 ), LDA, CMPLX( AII ),
00112      $                     A( 1, I ), 1 )
00113                CALL CLACGV( N-I, A( I, I+1 ), LDA )
00114             ELSE
00115                CALL CSSCAL( I, AII, A( 1, I ), 1 )
00116             END IF
00117    10    CONTINUE
00118 *
00119       ELSE
00120 *
00121 *        Compute the product L' * L.
00122 *
00123          DO 20 I = 1, N
00124             AII = A( I, I )
00125             IF( I.LT.N ) THEN
00126                A( I, I ) = AII*AII + REAL( CDOTC( N-I, A( I+1, I ), 1,
     $                     A( I+1, I ), 1 ) )
00127                CALL CLACGV( I-1, A( I, 1 ), LDA )
00128                CALL CGEMV( 'Conjugate transpose', N-I, I-1, ONE,
00129      $                     A( I+1, 1 ), LDA, A( I+1, I ), 1,
00130      $                     CMPLX( AII ), A( I, 1 ), LDA )
00131                CALL CLACGV( I-1, A( I, 1 ), LDA )
00132             ELSE
00133                CALL CSSCAL( I, AII, A( I, 1 ), LDA )
00134             END IF
00135    20    CONTINUE
00136       END IF
00137 *
00138       RETURN
00139 *
00140 *     End of CLAUU2
00141 *
00142       END
00143 
 All Files Functions