ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
pdlauum.f
Go to the documentation of this file.
1  SUBROUTINE pdlauum( 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  DOUBLE PRECISION A( * )
15 * ..
16 *
17 * Purpose
18 * =======
19 *
20 * PDLAUUM 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) DOUBLE PRECISION 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 * ..
128 * .. Local Scalars ..
129  INTEGER I, J, JB, JN
130 * ..
131 * .. External Subroutines ..
132  EXTERNAL pdgemm, pdlauu2, pdtrmm, pdsyrk
133 * ..
134 * .. External Functions ..
135  LOGICAL LSAME
136  INTEGER ICEIL
137  EXTERNAL iceil, lsame
138 * ..
139 * .. Intrinsic Functions ..
140  INTRINSIC min
141 * ..
142 * .. Executable Statements ..
143 *
144 * Quick return if possible
145 *
146  IF( n.EQ.0 )
147  $ RETURN
148 *
149  jn = min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+n-1 )
150  IF( lsame( uplo, 'U' ) ) THEN
151 *
152 * Compute the product U * U'.
153 *
154 * Handle first block separately
155 *
156  jb = jn-ja+1
157  CALL pdlauu2( 'Upper', jb, a, ia, ja, desca )
158  IF( jb.LE.n-1 ) THEN
159  CALL pdsyrk( 'Upper', 'No transpose', jb, n-jb, one, a, ia,
160  $ ja+jb, desca, one, a, ia, ja, desca )
161  END IF
162 *
163 * Loop over remaining block of columns
164 *
165  DO 10 j = jn+1, ja+n-1, desca( nb_ )
166  jb = min( n-j+ja, desca( nb_ ) )
167  i = ia + j - ja
168  CALL pdtrmm( 'Right', 'Upper', 'Transpose', 'Non-unit',
169  $ j-ja, jb, one, a, i, j, desca, a, ia, j,
170  $ desca )
171  CALL pdlauu2( 'Upper', jb, a, i, j, desca )
172  IF( j+jb.LE.ja+n-1 ) THEN
173  CALL pdgemm( 'No transpose', 'Transpose', j-ja, jb,
174  $ n-j-jb+ja, one, a, ia, j+jb, desca, a, i,
175  $ j+jb, desca, one, a, ia, j, desca )
176  CALL pdsyrk( 'Upper', 'No transpose', jb, n-j-jb+ja, one,
177  $ a, i, j+jb, desca, one, a, i, j, desca )
178  END IF
179  10 CONTINUE
180  ELSE
181 *
182 * Compute the product L' * L.
183 *
184 * Handle first block separately
185 *
186  jb = jn-ja+1
187  CALL pdlauu2( 'Lower', jb, a, ia, ja, desca )
188  IF( jb.LE.n-1 ) THEN
189  CALL pdsyrk( 'Lower', 'Transpose', jb, n-jb, one, a, ia+jb,
190  $ ja, desca, one, a, ia, ja, desca )
191  END IF
192 *
193 * Loop over remaining block of columns
194 *
195  DO 20 j = jn+1, ja+n-1, desca( nb_ )
196  jb = min( n-j+ja, desca( nb_ ) )
197  i = ia + j - ja
198  CALL pdtrmm( 'Left', 'Lower', 'Transpose', 'Non-unit', jb,
199  $ j-ja, one, a, i, j, desca, a, i, ja, desca )
200  CALL pdlauu2( 'Lower', jb, a, i, j, desca )
201  IF( j+jb.LE.ja+n-1 ) THEN
202  CALL pdgemm( 'Transpose', 'No transpose', jb, j-ja,
203  $ n-j-jb+ja, one, a, i+jb, j, desca, a, i+jb,
204  $ ja, desca, one, a, i, ja, desca )
205  CALL pdsyrk( 'Lower', 'Transpose', jb, n-j-jb+ja, one,
206  $ a, i+jb, j, desca, one, a, i, j, desca )
207  END IF
208  20 CONTINUE
209  END IF
210 *
211  RETURN
212 *
213 * End of PDLAUUM
214 *
215  END
pdlauu2
subroutine pdlauu2(UPLO, N, A, IA, JA, DESCA)
Definition: pdlauu2.f:2
pdlauum
subroutine pdlauum(UPLO, N, A, IA, JA, DESCA)
Definition: pdlauum.f:2
min
#define min(A, B)
Definition: pcgemr.c:181