SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
All Classes Files Functions Variables Typedefs Macros
pdgelqrv.f
Go to the documentation of this file.
1 SUBROUTINE pdgelqrv( M, N, A, IA, JA, DESCA, TAU, WORK )
2*
3* -- ScaLAPACK routine (version 1.7) --
4* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5* and University of California, Berkeley.
6* May 28, 2001
7*
8* .. Scalar Arguments ..
9 INTEGER IA, JA, M, N
10* ..
11* .. Array Arguments ..
12 INTEGER DESCA( * )
13 DOUBLE PRECISION A( * ), TAU( * ), WORK( * )
14* ..
15*
16* Purpose
17* =======
18*
19* PDGELQRV computes sub( A ) = A(IA:IA+M-1,JA:JA+N-1) from L, Q
20* computed by PDGELQF.
21*
22* Notes
23* =====
24*
25* Each global data object is described by an associated description
26* vector. This vector stores the information required to establish
27* the mapping between an object element and its corresponding process
28* and memory location.
29*
30* Let A be a generic term for any 2D block cyclicly distributed array.
31* Such a global array has an associated description vector DESCA.
32* In the following comments, the character _ should be read as
33* "of the global array".
34*
35* NOTATION STORED IN EXPLANATION
36* --------------- -------------- --------------------------------------
37* DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case,
38* DTYPE_A = 1.
39* CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
40* the BLACS process grid A is distribu-
41* ted over. The context itself is glo-
42* bal, but the handle (the integer
43* value) may vary.
44* M_A (global) DESCA( M_ ) The number of rows in the global
45* array A.
46* N_A (global) DESCA( N_ ) The number of columns in the global
47* array A.
48* MB_A (global) DESCA( MB_ ) The blocking factor used to distribute
49* the rows of the array.
50* NB_A (global) DESCA( NB_ ) The blocking factor used to distribute
51* the columns of the array.
52* RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
53* row of the array A is distributed.
54* CSRC_A (global) DESCA( CSRC_ ) The process column over which the
55* first column of the array A is
56* distributed.
57* LLD_A (local) DESCA( LLD_ ) The leading dimension of the local
58* array. LLD_A >= MAX(1,LOCr(M_A)).
59*
60* Let K be the number of rows or columns of a distributed matrix,
61* and assume that its process grid has dimension p x q.
62* LOCr( K ) denotes the number of elements of K that a process
63* would receive if K were distributed over the p processes of its
64* process column.
65* Similarly, LOCc( K ) denotes the number of elements of K that a
66* process would receive if K were distributed over the q processes of
67* its process row.
68* The values of LOCr() and LOCc() may be determined via a call to the
69* ScaLAPACK tool function, NUMROC:
70* LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
71* LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
72* An upper bound for these quantities may be computed by:
73* LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
74* LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
75*
76* Arguments
77* =========
78*
79* M (global input) INTEGER
80* The number of rows to be operated on, i.e. the number of rows
81* of the distributed submatrix sub( A ). M >= 0.
82*
83* N (global input) INTEGER
84* The number of columns to be operated on, i.e. the number of
85* columns of the distributed submatrix sub( A ). N >= 0.
86*
87* A (local input/local output) DOUBLE PRECISION pointer into the
88* local memory to an array of dimension (LLD_A, LOCc(JA+N-1)).
89* On entry, sub( A ) contains the the factors L and Q computed
90* by PDGELQF. On exit, the original matrix is restored.
91*
92* IA (global input) INTEGER
93* The row index in the global array A indicating the first
94* row of sub( A ).
95*
96* JA (global input) INTEGER
97* The column index in the global array A indicating the
98* first column of sub( A ).
99*
100* DESCA (global and local input) INTEGER array of dimension DLEN_.
101* The array descriptor for the distributed matrix A.
102*
103* TAU (local input) DOUBLE PRECISION, array, dimension
104* LOCr(IA+MIN(M,N)-1). This array contains the scalar factors
105* TAU of the elementary reflectors computed by PDGELQF. TAU
106* is tied to the distributed matrix A.
107*
108* WORK (local workspace) DOUBLE PRECISION array, dimension
109* LWORK = MB_A * ( Mp0 + 2*Nq0 + MB_A ), where
110* Mp0 = NUMROC( M+IROFF, MB_A, MYROW, IAROW, NPROW ) * NB_A,
111* Nq0 = NUMROC( N+ICOFF, NB_A, MYCOL, IACOL, NPCOL ) * MB_A,
112* IROFF = MOD( IA-1, MB_A ), ICOFF = MOD( JA-1, NB_A ),
113* IAROW = INDXG2P( IA, DESCA( MB_ ), MYROW, DESCA( RSRC_ ),
114* NPROW ),
115* IACOL = INDXG2P( JA, DESCA( NB_ ), MYCOL, DESCA( CSRC_ ),
116* NPCOL ),
117* and NUMROC, INDXG2P are ScaLAPACK tool functions.
118*
119* =====================================================================
120*
121* .. Parameters ..
122 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
123 $ LLD_, MB_, M_, NB_, N_, RSRC_
124 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
125 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
126 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
127 DOUBLE PRECISION ONE, ZERO
128 parameter( one = 1.0d+0, zero = 0.0d+0 )
129* ..
130* .. Local Scalars ..
131 CHARACTER COLBTOP, ROWBTOP
132 INTEGER I, IACOL, IAROW, IB, ICOFF, ICTXT, IIA, IL, IN,
133 $ IPT, IPV, IPW, J, JJA, JV, K, MYCOL, MYROW,
134 $ NPCOL, NPROW, NQ
135* ..
136* .. Local Arrays ..
137 INTEGER DESCV( DLEN_ )
138* ..
139* .. External Subroutines ..
140 EXTERNAL blacs_gridinfo, descset, infog2l, pdlacpy,
142* ..
143* .. External Functions ..
144 INTEGER ICEIL, NUMROC
145 EXTERNAL iceil, numroc
146* ..
147* .. Intrinsic Functions ..
148 INTRINSIC max, min, mod
149* ..
150* .. Executable Statements ..
151*
152* Get grid parameters
153*
154 ictxt = desca( ctxt_ )
155 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
156*
157 k = min( m, n )
158 in = min( iceil( ia, desca( mb_ ) ) * desca( mb_ ), ia+k-1 )
159 il = max( ( (ia+k-2) / desca( mb_ ) ) * desca( mb_ ) + 1, ia )
160*
161 icoff = mod( ja-1, desca( nb_ ) )
162 CALL infog2l( il, ja, desca, nprow, npcol, myrow, mycol, iia, jja,
163 $ iarow, iacol )
164 nq = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
165 ipv = 1
166 ipt = ipv + nq * desca( mb_ )
167 ipw = ipt + desca( mb_ ) * desca( mb_ )
168 CALL pb_topget( ictxt, 'Broadcast', 'Rowwise', rowbtop )
169 CALL pb_topget( ictxt, 'Broadcast', 'Columnwise', colbtop )
170 CALL pb_topset( ictxt, 'Broadcast', 'Rowwise', ' ' )
171 CALL pb_topset( ictxt, 'Broadcast', 'Columnwise', 'D-ring' )
172*
173 CALL descset( descv, desca( mb_ ), n + icoff, desca( mb_ ),
174 $ desca( nb_ ), iarow, iacol, ictxt, desca( mb_ ) )
175*
176 DO 10 i = il, in+1, -desca( mb_ )
177 ib = min( ia+k-i, desca( mb_ ) )
178 j = ja + i - ia
179 jv = 1 + i - ia + icoff
180*
181* Compute upper triangular matrix T
182*
183 CALL pdlarft( 'Forward', 'Rowwise', n-j+ja, ib, a, i, j, desca,
184 $ tau, work( ipt ), work( ipw ) )
185*
186* Copy Householder vectors into workspace
187*
188 CALL pdlacpy( 'Upper', ib, n-j+ja, a, i, j, desca, work( ipv ),
189 $ 1, jv, descv )
190 CALL pdlaset( 'Lower', ib, n-j+ja, zero, one, work( ipv ), 1,
191 $ jv, descv )
192*
193* Zeroes the strict upper triangular part of sub( A ) to get
194* block column of L
195*
196 CALL pdlaset( 'Upper', ib, n-j+ja-1, zero, zero, a, i, j+1,
197 $ desca )
198*
199* Apply block Householder transformation
200*
201 CALL pdlarfb( 'Right', 'Transpose', 'Forward', 'Rowwise',
202 $ m-i+ia, n-j+ja, ib, work( ipv ), 1, jv, descv,
203 $ work( ipt ), a, i, j, desca, work( ipw ) )
204*
205 descv( rsrc_ ) = mod( descv( rsrc_ ) + nprow - 1, nprow )
206*
207 10 CONTINUE
208*
209* Handle first block separately
210*
211 ib = in - ia + 1
212*
213* Compute upper triangular matrix T
214*
215 CALL pdlarft( 'Forward', 'Rowwise', n, ib, a, ia, ja, desca, tau,
216 $ work( ipt ), work( ipw ) )
217*
218* Copy Householder vectors into workspace
219*
220 CALL pdlacpy( 'Upper', ib, n, a, ia, ja, desca, work( ipv ), 1,
221 $ icoff+1, descv )
222 CALL pdlaset( 'Lower', ib, n, zero, one, work, 1, icoff+1, descv )
223*
224* Zeroes the strict upper triangular part of sub( A ) to get
225* block column of L
226*
227 CALL pdlaset( 'Upper', ib, n-1, zero, zero, a, ia, ja+1, desca )
228*
229* Apply block Householder transformation
230*
231 CALL pdlarfb( 'Right', 'Transpose', 'Forward', 'Rowwise', m, n,
232 $ ib, work( ipv ), 1, icoff+1, descv, work( ipt ), a,
233 $ ia, ja, desca, work( ipw ) )
234*
235 CALL pb_topset( ictxt, 'Broadcast', 'Rowwise', rowbtop )
236 CALL pb_topset( ictxt, 'Broadcast', 'Columnwise', colbtop )
237*
238 RETURN
239*
240* End of PDGELQRV
241*
242 END
subroutine descset(desc, m, n, mb, nb, irsrc, icsrc, ictxt, lld)
Definition descset.f:3
subroutine infog2l(grindx, gcindx, desc, nprow, npcol, myrow, mycol, lrindx, lcindx, rsrc, csrc)
Definition infog2l.f:3
#define max(A, B)
Definition pcgemr.c:180
#define min(A, B)
Definition pcgemr.c:181
subroutine pdlaset(uplo, m, n, alpha, beta, a, ia, ja, desca)
Definition pdblastst.f:6862
subroutine pdgelqrv(m, n, a, ia, ja, desca, tau, work)
Definition pdgelqrv.f:2
subroutine pdlacpy(uplo, m, n, a, ia, ja, desca, b, ib, jb, descb)
Definition pdlacpy.f:3
subroutine pdlarfb(side, trans, direct, storev, m, n, k, v, iv, jv, descv, t, c, ic, jc, descc, work)
Definition pdlarfb.f:3
subroutine pdlarft(direct, storev, n, k, v, iv, jv, descv, tau, t, work)
Definition pdlarft.f:3