ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
pzlauum.f
Go to the documentation of this file.
1  SUBROUTINE pzlauum( UPLO, N, A, IA, JA, DESCA )
2 *
3 * -- ScaLAPACK auxiliary routine (version 1.7) --
4 * University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5 * and University of California, Berkeley.
6 * May 1, 1997
7 *
8 * .. Scalar Arguments ..
9  CHARACTER UPLO
10  INTEGER IA, JA, N
11 * ..
12 * .. Array Arguments ..
13  INTEGER DESCA( * )
14  COMPLEX*16 A( * )
15 * ..
16 *
17 * Purpose
18 * =======
19 *
20 * PZLAUUM computes the product U * U' or L' * L, where the triangular
21 * factor U or L is stored in the upper or lower triangular part of
22 * the distributed matrix sub( A ) = A(IA:IA+N-1,JA:JA+N-1).
23 *
24 * If UPLO = 'U' or 'u' then the upper triangle of the result is stored,
25 * overwriting the factor U in sub( A ).
26 * If UPLO = 'L' or 'l' then the lower triangle of the result is stored,
27 * overwriting the factor L in sub( A ).
28 *
29 * This is the blocked form of the algorithm, calling Level 3 PBLAS.
30 *
31 * Notes
32 * =====
33 *
34 * Each global data object is described by an associated description
35 * vector. This vector stores the information required to establish
36 * the mapping between an object element and its corresponding process
37 * and memory location.
38 *
39 * Let A be a generic term for any 2D block cyclicly distributed array.
40 * Such a global array has an associated description vector DESCA.
41 * In the following comments, the character _ should be read as
42 * "of the global array".
43 *
44 * NOTATION STORED IN EXPLANATION
45 * --------------- -------------- --------------------------------------
46 * DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case,
47 * DTYPE_A = 1.
48 * CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
49 * the BLACS process grid A is distribu-
50 * ted over. The context itself is glo-
51 * bal, but the handle (the integer
52 * value) may vary.
53 * M_A (global) DESCA( M_ ) The number of rows in the global
54 * array A.
55 * N_A (global) DESCA( N_ ) The number of columns in the global
56 * array A.
57 * MB_A (global) DESCA( MB_ ) The blocking factor used to distribute
58 * the rows of the array.
59 * NB_A (global) DESCA( NB_ ) The blocking factor used to distribute
60 * the columns of the array.
61 * RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
62 * row of the array A is distributed.
63 * CSRC_A (global) DESCA( CSRC_ ) The process column over which the
64 * first column of the array A is
65 * distributed.
66 * LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
67 * array. LLD_A >= MAX(1,LOCr(M_A)).
68 *
69 * Let K be the number of rows or columns of a distributed matrix,
70 * and assume that its process grid has dimension p x q.
71 * LOCr( K ) denotes the number of elements of K that a process
72 * would receive if K were distributed over the p processes of its
73 * process column.
74 * Similarly, LOCc( K ) denotes the number of elements of K that a
75 * process would receive if K were distributed over the q processes of
76 * its process row.
77 * The values of LOCr() and LOCc() may be determined via a call to the
78 * ScaLAPACK tool function, NUMROC:
79 * LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
80 * LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
81 * An upper bound for these quantities may be computed by:
82 * LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
83 * LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
84 *
85 * Arguments
86 * =========
87 *
88 * UPLO (global input) CHARACTER*1
89 * Specifies whether the triangular factor stored in the
90 * distributed matrix sub( A ) is upper or lower triangular:
91 * = 'U': Upper triangular
92 * = 'L': Lower triangular
93 *
94 * N (global input) INTEGER
95 * The number of rows and columns to be operated on, i.e. the
96 * order of the triangular factor U or L. N >= 0.
97 *
98 * A (local input/local output) COMPLEX*16 pointer into the
99 * local memory to an array of dimension (LLD_A, LOCc(JA+N-1)).
100 * On entry, the local pieces of the triangular factor L or U.
101 * On exit, if UPLO = 'U', the upper triangle of the distributed
102 * matrix sub( A ) is overwritten with the upper triangle of the
103 * product U * U'; if UPLO = 'L', the lower triangle of sub( A )
104 * is overwritten with the lower triangle of the product L' * L.
105 *
106 * IA (global input) INTEGER
107 * The row index in the global array A indicating the first
108 * row of sub( A ).
109 *
110 * JA (global input) INTEGER
111 * The column index in the global array A indicating the
112 * first column of sub( A ).
113 *
114 * DESCA (global and local input) INTEGER array of dimension DLEN_.
115 * The array descriptor for the distributed matrix A.
116 *
117 * =====================================================================
118 *
119 * .. Parameters ..
120  INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
121  $ LLD_, MB_, M_, NB_, N_, RSRC_
122  parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
123  $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
124  $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
125  DOUBLE PRECISION ONE
126  parameter( one = 1.0d+0 )
127  COMPLEX*16 CONE
128  parameter( cone = 1.0d+0 )
129 * ..
130 * .. Local Scalars ..
131  INTEGER I, J, JB, JN
132 * ..
133 * .. External Subroutines ..
134  EXTERNAL pzgemm, pzherk, pzlauu2, pztrmm
135 * ..
136 * .. External Functions ..
137  LOGICAL LSAME
138  INTEGER ICEIL
139  EXTERNAL iceil, lsame
140 * ..
141 * .. Intrinsic Functions ..
142  INTRINSIC min
143 * ..
144 * .. Executable Statements ..
145 *
146 * Quick return if possible
147 *
148  IF( n.EQ.0 )
149  $ RETURN
150 *
151  jn = min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
152  IF( lsame( uplo, 'U' ) ) THEN
153 *
154 * Compute the product U * U'.
155 *
156 * Handle first block separately
157 *
158  jb = jn-ja+1
159  CALL pzlauu2( 'Upper', jb, a, ia, ja, desca )
160  IF( jb.LE.n-1 ) THEN
161  CALL pzherk( 'Upper', 'No transpose', jb, n-jb, one, a, ia,
162  $ ja+jb, desca, one, a, ia, ja, desca )
163  END IF
164 *
165 * Loop over remaining block of columns
166 *
167  DO 10 j = jn+1, ja+n-1, desca( nb_ )
168  jb = min( n-j+ja, desca( nb_ ) )
169  i = ia + j - ja
170  CALL pztrmm( 'Right', 'Upper', 'Conjugate transpose',
171  $ 'Non-unit', j-ja, jb, cone, a, i, j, desca,
172  $ a, ia, j, desca )
173  CALL pzlauu2( 'Upper', jb, a, i, j, desca )
174  IF( j+jb.LE.ja+n-1 ) THEN
175  CALL pzgemm( 'No transpose', 'Conjugate transpose',
176  $ j-ja, jb, n-j-jb+ja, cone, a, ia, j+jb,
177  $ desca, a, i, j+jb, desca, cone, a, ia,
178  $ j, desca )
179  CALL pzherk( 'Upper', 'No transpose', jb, n-j-jb+ja, one,
180  $ a, i, j+jb, desca, one, a, i, j, desca )
181  END IF
182  10 CONTINUE
183  ELSE
184 *
185 * Compute the product L' * L.
186 *
187 * Handle first block separately
188 *
189  jb = jn-ja+1
190  CALL pzlauu2( 'Lower', jb, a, ia, ja, desca )
191  IF( jb.LE.n-1 ) THEN
192  CALL pzherk( 'Lower', 'Conjugate transpose', jb, n-jb, one,
193  $ a, ia+jb, ja, desca, one, a, ia, ja, desca )
194  END IF
195 *
196 * Loop over remaining block of columns
197 *
198  DO 20 j = jn+1, ja+n-1, desca( nb_ )
199  jb = min( n-j+ja, desca( nb_ ) )
200  i = ia + j - ja
201  CALL pztrmm( 'Left', 'Lower', 'Conjugate Transpose',
202  $ 'Non-unit', jb, j-ja, cone, a, i, j, desca, a,
203  $ i, ja, desca )
204  CALL pzlauu2( 'Lower', jb, a, i, j, desca )
205  IF( j+jb.LE.ja+n-1 ) THEN
206  CALL pzgemm( 'Conjugate transpose', 'No transpose', jb,
207  $ j-ja, n-j-jb+ja, cone, a, i+jb, j, desca,
208  $ a, i+jb, ja, desca, cone, a, i, ja, desca )
209  CALL pzherk( 'Lower', 'Conjugate transpose', jb,
210  $ n-j-jb+ja, one, a, i+jb, j, desca, one,
211  $ a, i, j, desca )
212  END IF
213  20 CONTINUE
214  END IF
215 *
216  RETURN
217 *
218 * End of PZLAUUM
219 *
220  END
pzlauum
subroutine pzlauum(UPLO, N, A, IA, JA, DESCA)
Definition: pzlauum.f:2
pzlauu2
subroutine pzlauu2(UPLO, N, A, IA, JA, DESCA)
Definition: pzlauu2.f:2
min
#define min(A, B)
Definition: pcgemr.c:181