LAPACK 3.3.1
Linear Algebra PACKage

clauum.f

Go to the documentation of this file.
00001       SUBROUTINE CLAUUM( 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            A( LDA, * )
00014 *     ..
00015 *
00016 *  Purpose
00017 *  =======
00018 *
00019 *  CLAUUM 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 blocked form of the algorithm, calling Level 3 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**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       REAL               ONE
00060       PARAMETER          ( ONE = 1.0E+0 )
00061       COMPLEX            CONE
00062       PARAMETER          ( CONE = ( 1.0E+0, 0.0E+0 ) )
00063 *     ..
00064 *     .. Local Scalars ..
00065       LOGICAL            UPPER
00066       INTEGER            I, IB, NB
00067 *     ..
00068 *     .. External Functions ..
00069       LOGICAL            LSAME
00070       INTEGER            ILAENV
00071       EXTERNAL           LSAME, ILAENV
00072 *     ..
00073 *     .. External Subroutines ..
00074       EXTERNAL           CGEMM, CHERK, CLAUU2, CTRMM, XERBLA
00075 *     ..
00076 *     .. Intrinsic Functions ..
00077       INTRINSIC          MAX, MIN
00078 *     ..
00079 *     .. Executable Statements ..
00080 *
00081 *     Test the input parameters.
00082 *
00083       INFO = 0
00084       UPPER = LSAME( UPLO, 'U' )
00085       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
00086          INFO = -1
00087       ELSE IF( N.LT.0 ) THEN
00088          INFO = -2
00089       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00090          INFO = -4
00091       END IF
00092       IF( INFO.NE.0 ) THEN
00093          CALL XERBLA( 'CLAUUM', -INFO )
00094          RETURN
00095       END IF
00096 *
00097 *     Quick return if possible
00098 *
00099       IF( N.EQ.0 )
00100      $   RETURN
00101 *
00102 *     Determine the block size for this environment.
00103 *
00104       NB = ILAENV( 1, 'CLAUUM', UPLO, N, -1, -1, -1 )
00105 *
00106       IF( NB.LE.1 .OR. NB.GE.N ) THEN
00107 *
00108 *        Use unblocked code
00109 *
00110          CALL CLAUU2( UPLO, N, A, LDA, INFO )
00111       ELSE
00112 *
00113 *        Use blocked code
00114 *
00115          IF( UPPER ) THEN
00116 *
00117 *           Compute the product U * U**H.
00118 *
00119             DO 10 I = 1, N, NB
00120                IB = MIN( NB, N-I+1 )
00121                CALL CTRMM( 'Right', 'Upper', 'Conjugate transpose',
00122      $                     'Non-unit', I-1, IB, CONE, A( I, I ), LDA,
00123      $                     A( 1, I ), LDA )
00124                CALL CLAUU2( 'Upper', IB, A( I, I ), LDA, INFO )
00125                IF( I+IB.LE.N ) THEN
00126                   CALL CGEMM( 'No transpose', 'Conjugate transpose',
00127      $                        I-1, IB, N-I-IB+1, CONE, A( 1, I+IB ),
00128      $                        LDA, A( I, I+IB ), LDA, CONE, A( 1, I ),
00129      $                        LDA )
00130                   CALL CHERK( 'Upper', 'No transpose', IB, N-I-IB+1,
00131      $                        ONE, A( I, I+IB ), LDA, ONE, A( I, I ),
00132      $                        LDA )
00133                END IF
00134    10       CONTINUE
00135          ELSE
00136 *
00137 *           Compute the product L**H * L.
00138 *
00139             DO 20 I = 1, N, NB
00140                IB = MIN( NB, N-I+1 )
00141                CALL CTRMM( 'Left', 'Lower', 'Conjugate transpose',
00142      $                     'Non-unit', IB, I-1, CONE, A( I, I ), LDA,
00143      $                     A( I, 1 ), LDA )
00144                CALL CLAUU2( 'Lower', IB, A( I, I ), LDA, INFO )
00145                IF( I+IB.LE.N ) THEN
00146                   CALL CGEMM( 'Conjugate transpose', 'No transpose', IB,
00147      $                        I-1, N-I-IB+1, CONE, A( I+IB, I ), LDA,
00148      $                        A( I+IB, 1 ), LDA, CONE, A( I, 1 ), LDA )
00149                   CALL CHERK( 'Lower', 'Conjugate transpose', IB,
00150      $                        N-I-IB+1, ONE, A( I+IB, I ), LDA, ONE,
00151      $                        A( I, I ), LDA )
00152                END IF
00153    20       CONTINUE
00154          END IF
00155       END IF
00156 *
00157       RETURN
00158 *
00159 *     End of CLAUUM
00160 *
00161       END
 All Files Functions