LAPACK 3.3.1
Linear Algebra PACKage

slauum.f

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