1 SUBROUTINE pcgerqrv( M, N, A, IA, JA, DESCA, TAU, WORK )
13 COMPLEX A( * ), TAU( * ), WORK( * )
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 )
128 parameter( one = ( 1.0e+0, 0.0e+0 ),
129 $ zero = ( 0.0e+0, 0.0e+0 ) )
132 CHARACTER COLBTOP, ROWBTOP
133 INTEGER I, IACOL, IAROW, IB, ICOFF, ICTXT, IIA, IN,
134 $ IPT, IPV, IPW, JJA, JV, K, MYCOL, MYROW, NPCOL,
138 INTEGER DESCV( DLEN_ )
146 INTEGER ICEIL, NUMROC
147 EXTERNAL iceil, numroc
156 ictxt = desca( ctxt_ )
157 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
160 in =
min( iceil( ia+m-k, desca( mb_ ) ) * desca( mb_ ), ia+m-1 )
162 icoff = mod( ja-1, desca( nb_ ) )
163 CALL infog2l( ia+m-k, ja, desca, nprow, npcol, myrow, mycol,
164 $ iia, jja, iarow, iacol )
165 nq = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
167 ipt = ipv + nq * desca( mb_ )
168 ipw = ipt + desca( mb_ ) * desca( mb_ )
169 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
170 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
171 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
172 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
174 CALL descset( descv, desca( mb_), n + icoff, desca( mb_ ),
175 $ desca( nb_ ), iarow, iacol, ictxt, desca( mb_ ) )
179 ib = in - ia - m + k + 1
180 jv = 1 + n - k + icoff
184 CALL pclarft(
'Backward',
'Rowwise', n-m+in-ia+1, ib, a, ia+m-k,
185 $ ja, desca, tau, work( ipt ), work( ipw ) )
189 CALL pclacpy(
'All', ib, n-m+in-ia+1, a, ia+m-k, ja, desca,
190 $ work( ipv ), 1, icoff+1, descv )
191 CALL pclaset(
'Upper', ib, ib, zero, one, work( ipv ), 1, jv,
197 CALL pclaset(
'All', ib, n-k, zero, zero, a, ia+m-k, ja,
199 CALL pclaset(
'Lower', ib-1, ib, zero, zero, a, ia+m-k+1,
204 CALL pclarfb(
'Right',
'Conjugate transpose',
'Backward',
205 $
'Rowwise', in-ia+1, n-m+in-ia+1, ib, work( ipv ), 1,
206 $ icoff+1, descv, work( ipt ), a, ia, ja, desca,
209 descv( rsrc_ ) = mod( descv( rsrc_ ) + 1, nprow )
213 DO 10 i = in+1, ia+m-1, desca( mb_ )
214 ib =
min( ia+m-i, desca( mb_ ) )
215 jv = 1 + n - m + i - ia + icoff
219 CALL pclarft(
'Backward',
'Rowwise', n-m+i+ib-ia, ib, a, i, ja,
220 $ desca, tau, work( ipt ), work( ipw ) )
224 CALL pclacpy(
'All', ib, n-m+i+ib-ia, a, i, ja, desca,
225 $ work( ipv ), 1, icoff+1, descv )
226 CALL pclaset(
'Upper', ib, ib, zero, one, work( ipv ), 1, jv,
232 CALL pclaset(
'All', ib, n-m+i-ia, zero, zero, a, i, ja,
234 CALL pclaset(
'Lower', ib-1, ib, zero, zero, a, i+1,
235 $ ja+n-m+i-ia, desca )
239 CALL pclarfb(
'Right',
'Conjugate transpose',
'Backward',
240 $
'Rowwise', i+ib-ia, n-m+i+ib-ia, ib, work( ipv ),
241 $ 1, icoff+1, descv, work( ipt ), a, ia, ja, desca,
244 descv( rsrc_ ) = mod( descv( rsrc_ ) + 1, nprow )
248 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
249 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )