LAPACK 3.3.1 Linear Algebra PACKage

# zlauu2.f

Go to the documentation of this file.
```00001       SUBROUTINE ZLAUU2( UPLO, N, A, LDA, INFO )
00002 *
00003 *  -- LAPACK auxiliary routine (version 3.3.1) --
00004 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00005 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00006 *  -- April 2011                                                      --
00007 *
00008 *     .. Scalar Arguments ..
00009       CHARACTER          UPLO
00010       INTEGER            INFO, LDA, N
00011 *     ..
00012 *     .. Array Arguments ..
00013       COMPLEX*16         A( LDA, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  ZLAUU2 computes the product U * U**H or L**H * 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*16 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**H;
00046 *          if UPLO = 'L', the lower triangle of A is overwritten with
00047 *          the lower triangle of the product L**H * 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*16         ONE
00060       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ) )
00061 *     ..
00062 *     .. Local Scalars ..
00063       LOGICAL            UPPER
00064       INTEGER            I
00065       DOUBLE PRECISION   AII
00066 *     ..
00067 *     .. External Functions ..
00068       LOGICAL            LSAME
00069       COMPLEX*16         ZDOTC
00070       EXTERNAL           LSAME, ZDOTC
00071 *     ..
00072 *     .. External Subroutines ..
00073       EXTERNAL           XERBLA, ZDSCAL, ZGEMV, ZLACGV
00074 *     ..
00075 *     .. Intrinsic Functions ..
00076       INTRINSIC          DBLE, DCMPLX, MAX
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( 'ZLAUU2', -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**H.
00104 *
00105          DO 10 I = 1, N
00106             AII = A( I, I )
00107             IF( I.LT.N ) THEN
00108                A( I, I ) = AII*AII + DBLE( ZDOTC( N-I, A( I, I+1 ), LDA,
00109      \$                     A( I, I+1 ), LDA ) )
00110                CALL ZLACGV( N-I, A( I, I+1 ), LDA )
00111                CALL ZGEMV( 'No transpose', I-1, N-I, ONE, A( 1, I+1 ),
00112      \$                     LDA, A( I, I+1 ), LDA, DCMPLX( AII ),
00113      \$                     A( 1, I ), 1 )
00114                CALL ZLACGV( N-I, A( I, I+1 ), LDA )
00115             ELSE
00116                CALL ZDSCAL( I, AII, A( 1, I ), 1 )
00117             END IF
00118    10    CONTINUE
00119 *
00120       ELSE
00121 *
00122 *        Compute the product L**H * L.
00123 *
00124          DO 20 I = 1, N
00125             AII = A( I, I )
00126             IF( I.LT.N ) THEN
00127                A( I, I ) = AII*AII + DBLE( ZDOTC( N-I, A( I+1, I ), 1,
00128      \$                     A( I+1, I ), 1 ) )
00129                CALL ZLACGV( I-1, A( I, 1 ), LDA )
00130                CALL ZGEMV( 'Conjugate transpose', N-I, I-1, ONE,
00131      \$                     A( I+1, 1 ), LDA, A( I+1, I ), 1,
00132      \$                     DCMPLX( AII ), A( I, 1 ), LDA )
00133                CALL ZLACGV( I-1, A( I, 1 ), LDA )
00134             ELSE
00135                CALL ZDSCAL( I, AII, A( I, 1 ), LDA )
00136             END IF
00137    20    CONTINUE
00138       END IF
00139 *
00140       RETURN
00141 *
00142 *     End of ZLAUU2
00143 *
00144       END
```