PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
clauum.f
Go to the documentation of this file.
1  SUBROUTINE clauum( UPLO, N, A, LDA, INFO )
2 *
3 * -- LAPACK auxiliary routine (version 3.2) --
4 * -- LAPACK is a software package provided by Univ. of Tennessee, --
5 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6 * November 2006
7 *
8 * .. Scalar Arguments ..
9  CHARACTER uplo
10  INTEGER info, lda, n
11 * ..
12 * .. Array Arguments ..
13  COMPLEX a( lda, * )
14 * ..
15 *
16 * Purpose
17 * =======
18 *
19 * CLAUUM computes the product U * U' or L' * L, where the triangular
20 * factor U or L is stored in the upper or lower triangular part of
21 * the array A.
22 *
23 * If UPLO = 'U' or 'u' then the upper triangle of the result is stored,
24 * overwriting the factor U in A.
25 * If UPLO = 'L' or 'l' then the lower triangle of the result is stored,
26 * overwriting the factor L in A.
27 *
28 * This is the blocked form of the algorithm, calling Level 3 BLAS.
29 *
30 * Arguments
31 * =========
32 *
33 * UPLO (input) CHARACTER*1
34 * Specifies whether the triangular factor stored in the array A
35 * is upper or lower triangular:
36 * = 'U': Upper triangular
37 * = 'L': Lower triangular
38 *
39 * N (input) INTEGER
40 * The order of the triangular factor U or L. N >= 0.
41 *
42 * A (input/output) COMPLEX array, dimension (LDA,N)
43 * On entry, the triangular factor U or L.
44 * On exit, if UPLO = 'U', the upper triangle of A is
45 * overwritten with the upper triangle of the product U * U';
46 * if UPLO = 'L', the lower triangle of A is overwritten with
47 * the lower triangle of the product L' * L.
48 *
49 * LDA (input) INTEGER
50 * The leading dimension of the array A. LDA >= max(1,N).
51 *
52 * INFO (output) INTEGER
53 * = 0: successful exit
54 * < 0: if INFO = -k, the k-th argument had an illegal value
55 *
56 * =====================================================================
57 *
58 * .. Parameters ..
59  REAL one
60  parameter( one = 1.0e+0 )
61  COMPLEX cone
62  parameter( cone = ( 1.0e+0, 0.0e+0 ) )
63 * ..
64 * .. Local Scalars ..
65  LOGICAL upper
66  INTEGER i, ib, nb
67 * ..
68 * .. External Functions ..
69  LOGICAL lsame
70  INTEGER ilaenv
71  EXTERNAL lsame, ilaenv
72 * ..
73 * .. External Subroutines ..
74  EXTERNAL cgemm, cherk, clauu2, ctrmm, xerbla
75 * ..
76 * .. Intrinsic Functions ..
77  INTRINSIC max, min
78 * ..
79 * .. Executable Statements ..
80 *
81 * Test the input parameters.
82 *
83  info = 0
84  upper = lsame( uplo, 'U' )
85  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
86  info = -1
87  ELSE IF( n.LT.0 ) THEN
88  info = -2
89  ELSE IF( lda.LT.max( 1, n ) ) THEN
90  info = -4
91  END IF
92  IF( info.NE.0 ) THEN
93  CALL xerbla( 'CLAUUM', -info )
94  return
95  END IF
96 *
97 * Quick return if possible
98 *
99  IF( n.EQ.0 )
100  $ return
101 *
102 * Determine the block size for this environment.
103 *
104  nb = ilaenv( 1, 'CLAUUM', uplo, n, -1, -1, -1 )
105 *
106  IF( nb.LE.1 .OR. nb.GE.n ) THEN
107 *
108 * Use unblocked code
109 *
110  CALL clauu2( uplo, n, a, lda, info )
111  ELSE
112 *
113 * Use blocked code
114 *
115  IF( upper ) THEN
116 *
117 * Compute the product U * U'.
118 *
119  DO 10 i = 1, n, nb
120  ib = min( nb, n-i+1 )
121  CALL ctrmm( 'Right', 'Upper', 'Conjugate transpose',
122  $ 'Non-unit', i-1, ib, cone, a( i, i ), lda,
123  $ a( 1, i ), lda )
124  CALL clauu2( 'Upper', ib, a( i, i ), lda, info )
125  IF( i+ib.LE.n ) THEN
126  CALL cgemm( 'No transpose', 'Conjugate transpose',
127  $ i-1, ib, n-i-ib+1, cone, a( 1, i+ib ),
128  $ lda, a( i, i+ib ), lda, cone, a( 1, i ),
129  $ lda )
130  CALL cherk( 'Upper', 'No transpose', ib, n-i-ib+1,
131  $ one, a( i, i+ib ), lda, one, a( i, i ),
132  $ lda )
133  END IF
134  10 continue
135  ELSE
136 *
137 * Compute the product L' * L.
138 *
139  DO 20 i = 1, n, nb
140  ib = min( nb, n-i+1 )
141  CALL ctrmm( 'Left', 'Lower', 'Conjugate transpose',
142  $ 'Non-unit', ib, i-1, cone, a( i, i ), lda,
143  $ a( i, 1 ), lda )
144  CALL clauu2( 'Lower', ib, a( i, i ), lda, info )
145  IF( i+ib.LE.n ) THEN
146  CALL cgemm( 'Conjugate transpose', 'No transpose', ib,
147  $ i-1, n-i-ib+1, cone, a( i+ib, i ), lda,
148  $ a( i+ib, 1 ), lda, cone, a( i, 1 ), lda )
149  CALL cherk( 'Lower', 'Conjugate transpose', ib,
150  $ n-i-ib+1, one, a( i+ib, i ), lda, one,
151  $ a( i, i ), lda )
152  END IF
153  20 continue
154  END IF
155  END IF
156 *
157  return
158 *
159 * End of CLAUUM
160 *
161  END