Routine: PSLARF()  File: SRC\pslarf.f

 
 
# lines: 812
  # code: 812
  # comment: 0
  # blank:0
# Variables:27
# Callers:15
# Callings:0
# Words:29
# Keywords:18
 

 

..
     .. Local Scalars ..
     ..
     .. External Subroutines ..
     ..
     .. External Functions ..
     ..
     .. Intrinsic Functions ..
     ..
     .. Executable Statements ..
     Quick return if possible
     Get grid parameters.
     Figure local indexes
     Is sub( C ) only distributed over a process row ?
     Is sub( C ) only distributed over a process column ?
           sub( C ) is distributed over a process column
              Transpose row vector V
              Perform the local computation within a process column
                    w := sub( C )' * v
                    sub( C ) := sub( C ) - v * w'
              V is a column vector
                 Perform the local computation within a process column
                       w := sub( C )' * v
                       sub( C ) := sub( C ) - v * w'
                 Send V and TAU to the process column ICCOL
                       w := sub( C )' * v
                       sub( C ) := sub( C ) - v * w'
           sub( C ) is a proper distributed matrix
              Transpose and broadcast row vector V
              Perform the local computation within a process column
                 w := sub( C )' * v
                 sub( C ) := sub( C ) - v * w'
              Broadcast column vector V
                 w := sub( C )' * v
                 sub( C ) := sub( C ) - v * w'
           sub( C ) is distributed over a process row
              V is a row vector
                 Perform the local computation within a process row
                       w := sub( C ) * v
                       sub( C ) := sub( C ) - w * v'
                 Send V and TAU to the process row ICROW
                       w := sub( C ) * v
                       sub( C ) := sub( C ) - w * v'
              Transpose column vector V
              Perform the local computation within a process column
                    w := sub( C ) * v
                    sub( C ) := sub( C ) - w * v'
           sub( C ) is a proper distributed matrix
              Broadcast row vector V
                 w := sub( C ) * v
                 sub( C ) := sub( C ) - w * v'
              Transpose and broadcast column vector V
              Perform the local computation within a process column
                 w := sub( C ) * v
                 sub( C ) := sub( C ) - w * v'

 
Display dynamic version Find AutoScroll Reload FontSize: - + Hide Comments Hide Blanks Frame FullScreen MailPrint

 
001        SUBROUTINE PSLARF( SIDE , M , N , V , IV , JV , DESCV , INCV , TAU ,
002       $C , IC , JC , DESCC , WORK )
003  
004  *     -- ScaLAPACK auxiliary routine(version 1.7) --
005  *     University of Tennessee , Knoxville , Oak Ridge National Laboratory ,
006  *     and University of California , Berkeley.
007  *     May 25 , 2001
008  
009  *     .. Scalar Arguments ..
010        CHARACTER SIDE
011        INTEGER IC , INCV , IV , JC , JV , M , N
012  *     ..
013  *     .. Array Arguments ..
014        INTEGER DESCC( * ) , DESCV( * )
015        REAL C( * ) , TAU( * ) , V( * ) , WORK( * )
016  *     ..
017  
018  *     Purpose
019  *     === ====
020  
021  *     PSLARF applies a real elementary reflector Q(or Q**T) to a real
022  *     M-by - N distributed matrix sub( C ) = C(IC : IC + M - 1 , JC : JC + N - 1) , from
023  *     either the left or the right. Q is represented in the form
024  
025  *     Q = I - tau * v * v'
026  
027  *     where tau is a real scalar and v is a real vector.
028  
029  *     If tau = 0 , then Q is taken to be the unit matrix.
030  
031  *     Notes
032  *     === ==
033  
034  *     Each global data object is described by an associated description
035  *     vector. This vector stores the information required to establish
036  *     the mapping between an object element and its corresponding process
037  *     and memory location.
038  
039  *     Let A be a generic term for any 2D block cyclicly distributed array.
040  *     Such a global array has an associated description vector DESCA.
041  *     In the following comments , the character _ should be read as
042  *     "of the global array".
043  
044  *     NOTATION STORED IN EXPLANATION
045  *     --- ------------ -------------- --------------------------------------
046  *     DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case ,
047  *     DTYPE_A = 1.
048  *     CTXT_A(global) DESCA( CTXT_ ) The BLACS context handle , indicating
049  *     the BLACS process grid A is distribu -
050  *     ted over. The context itself is glo -
051  *     bal , but the handle(the integer
052  *     value) may vary.
053  *     M_A(global) DESCA( M_ ) The number of rows in the global
054  *     array A.
055  *     N_A(global) DESCA( N_ ) The number of columns in the global
056  *     array A.
057  *     MB_A(global) DESCA( MB_ ) The blocking factor used to distribute
058  *     the rows of the array.
059  *     NB_A(global) DESCA( NB_ ) The blocking factor used to distribute
060  *     the columns of the array.
061  *     RSRC_A(global) DESCA( RSRC_ ) The process row over which the first
062  *     row of the array A is distributed.
063  *     CSRC_A(global) DESCA( CSRC_ ) The process column over which the
064  *     first column of the array A is
065  *     distributed.
066  *     LLD_A(local) DESCA( LLD_ ) The leading dimension of the local
067  *     array. LLD_A >= MAX(1 , LOCr(M_A)).
068  
069  *     Let K be the number of rows or columns of a distributed matrix ,
070  *     and assume that its process grid has dimension p x q.
071  *     LOCr( K ) denotes the number of elements of K that a process
072  *     would receive if K were distributed over the p processes of its
073  *     process column.
074  *     Similarly , LOCc( K ) denotes the number of elements of K that a
075  *     process would receive if K were distributed over the q processes of
076  *     its process row.
077  *     The values of LOCr() and LOCc() may be determined via a call to the
078  *     ScaLAPACK tool function , NUMROC :
079  *     LOCr( M ) = NUMROC( M , MB_A , MYROW , RSRC_A , NPROW ) ,
080  *     LOCc( N ) = NUMROC( N , NB_A , MYCOL , CSRC_A , NPCOL ).
081  *     An upper bound for these quantities may be computed by :
082  *     LOCr( M ) <= ceil( ceil(M / MB_A) / NPROW )*MB_A
083  *     LOCc( N ) <= ceil( ceil(N / NB_A) / NPCOL )*NB_A
084  
085  *     Because vectors may be viewed as a subclass of matrices , a
086  *     distributed vector is considered to be a distributed matrix.
087  
088  *     Restrictions
089  *     === =========
090  
091  *     If SIDE = 'Left' and INCV = 1 , then the row process having the first
092  *     entry V(IV , JV) must also have the first row of sub( C ). Moreover ,
093  *     MOD(IV - 1 , MB_V) must be equal to MOD(IC - 1 , MB_C) , if INCV = M_V , only
094  *     the last equality must be satisfied.
095  
096  *     If SIDE = 'Right' and INCV = M_V then the column process having the
097  *     first entry V(IV , JV) must also have the first column of sub( C ) and
098  *     MOD(JV - 1 , NB_V) must be equal to MOD(JC - 1 , NB_C) , if INCV = 1 only the
099  *     last equality must be satisfied.
100  
101  *     Arguments
102  *     === ======
103  
104  *     SIDE(global input) CHARACTER
105  *     = 'L' : form Q * sub( C ) ,
106  *     = 'R' : form sub( C ) * Q , Q = Q**T.
107  
108  *     M(global input) INTEGER
109  *     The number of rows to be operated on i.e the number of rows
110  *     of the distributed submatrix sub( C ). M >= 0.
111  
112  *     N(global input) INTEGER
113  *     The number of columns to be operated on i.e the number of
114  *     columns of the distributed submatrix sub( C ). N >= 0.
115  
116  *     V(local input) REAL pointer into the local memory
117  *     to an array of dimension(LLD_V ,*) containing the local
118  *     pieces of the distributed vectors V representing the
119  *     Householder transformation Q ,
120  *     V(IV : IV + M - 1 , JV) if SIDE = 'L' and INCV = 1 ,
121  *     V(IV , JV : JV + M - 1) if SIDE = 'L' and INCV = M_V ,
122  *     V(IV : IV + N - 1 , JV) if SIDE = 'R' and INCV = 1 ,
123  *     V(IV , JV : JV + N - 1) if SIDE = 'R' and INCV = M_V ,
124  
125  *     The vector v in the representation of Q. V is not used if
126  *     TAU = 0.
127  
128  *     IV(global input) INTEGER
129  *     The row index in the global array V indicating the first
130  *     row of sub( V ).
131  
132  *     JV(global input) INTEGER
133  *     The column index in the global array V indicating the
134  *     first column of sub( V ).
135  
136  *     DESCV(global and local input) INTEGER array of dimension DLEN_.
137  *     The array descriptor for the distributed matrix V.
138  
139  *     INCV(global input) INTEGER
140  *     The global increment for the elements of V. Only two values
141  *     of INCV are supported in this version , namely 1 and M_V.
142  *     INCV must not be zero.
143  
144  *     TAU(local input) REAL , array , dimension LOCc(JV) if
145  *     INCV = 1 , and LOCr(IV) otherwise. This array contains the
146  *     Householder scalars related to the Householder vectors.
147  *     TAU is tied to the distributed matrix V.
148  
149  *     C(local input / local output) REAL pointer into the
150  *     local memory to an array of dimension(LLD_C , LOCc(JC + N - 1) ) ,
151  *     containing the local pieces of sub( C ). On exit , sub( C )
152  *     is overwritten by the Q * sub( C ) if SIDE = 'L' , or
153  *     sub( C ) * Q if SIDE = 'R'.
154  
155  *     IC(global input) INTEGER
156  *     The row index in the global array C indicating the first
157  *     row of sub( C ).
158  
159  *     JC(global input) INTEGER
160  *     The column index in the global array C indicating the
161  *     first column of sub( C ).
162  
163  *     DESCC(global and local input) INTEGER array of dimension DLEN_.
164  *     The array descriptor for the distributed matrix C.
165  
166  *     WORK(local workspace) REAL array , dimension(LWORK)
167  *     If INCV = 1 ,
168  *     if SIDE = 'L' ,
169  *     if IVCOL = ICCOL ,
170  *     LWORK >= NqC0
171  *     else
172  *     LWORK >= MpC0 + MAX( 1 , NqC0 )
173  *     end if
174  *     else if SIDE = 'R' ,
175  *     LWORK >= NqC0 + MAX( MAX( 1 , MpC0 ) , NUMROC( NUMROC(
176  *     N + ICOFFC , NB_V , 0 , 0 , NPCOL ) , NB_V , 0 , 0 , LCMQ ) )
177  *     end if
178  *     else if INCV = M_V ,
179  *     if SIDE = 'L' ,
180  *     LWORK >= MpC0 + MAX( MAX( 1 , NqC0 ) , NUMROC( NUMROC(
181  *     M + IROFFC , MB_V , 0 , 0 , NPROW ) , MB_V , 0 , 0 , LCMP ) )
182  *     else if SIDE = 'R' ,
183  *     if IVROW = ICROW ,
184  *     LWORK >= MpC0
185  *     else
186  *     LWORK >= NqC0 + MAX( 1 , MpC0 )
187  *     end if
188  *     end if
189  *     end if
190  
191  *     where LCM is the least common multiple of NPROW and NPCOL and
192  *     LCM = ILCM( NPROW , NPCOL ) , LCMP = LCM / NPROW ,
193  *     LCMQ = LCM / NPCOL ,
194  
195  *     IROFFC = MOD( IC - 1 , MB_C ) , ICOFFC = MOD( JC - 1 , NB_C ) ,
196  *     ICROW = INDXG2P( IC , MB_C , MYROW , RSRC_C , NPROW ) ,
197  *     ICCOL = INDXG2P( JC , NB_C , MYCOL , CSRC_C , NPCOL ) ,
198  *     MpC0 = NUMROC( M + IROFFC , MB_C , MYROW , ICROW , NPROW ) ,
199  *     NqC0 = NUMROC( N + ICOFFC , NB_C , MYCOL , ICCOL , NPCOL ) ,
200  
201  *     ILCM , INDXG2P and NUMROC are ScaLAPACK tool functions ;
202  *     MYROW , MYCOL , NPROW and NPCOL can be determined by calling
203  *     the subroutine BLACS_GRIDINFO.
204  
205  *     Alignment requirements
206  *     === ===================
207  
208  *     The distributed submatrices V(IV : * , JV :*) and C(IC : IC + M - 1 , JC : JC + N - 1)
209  *     must verify some alignment properties , namely the following
210  *     expressions should be true :
211  
212  *     MB_V = NB_V ,
213  
214  *     If INCV = 1 ,
215  *     If SIDE = 'Left' ,
216  *     ( MB_V.EQ.MB_C .AND. IROFFV.EQ.IROFFC .AND. IVROW.EQ.ICROW )
217  *     If SIDE = 'Right' ,
218  *     ( MB_V.EQ.NB_A .AND. MB_V.EQ.NB_C .AND. IROFFV.EQ.ICOFFC )
219  *     else if INCV = M_V ,
220  *     If SIDE = 'Left' ,
221  *     ( MB_V.EQ.NB_V .AND. MB_V.EQ.MB_C .AND. ICOFFV.EQ.IROFFC )
222  *     If SIDE = 'Right' ,
223  *     ( NB_V.EQ.NB_C .AND. ICOFFV.EQ.ICOFFC .AND. IVCOL.EQ.ICCOL )
224  *     end if
225  
226  *     === ==================================================================
227  
228  *     .. Parameters ..
229        INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
230       $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
231        PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
232       $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
233       $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
234        REAL ONE , ZERO
235        PARAMETER( ONE = 1.0E + 0 , ZERO = 0.0E + 0 )
236        CALL SGER( MP , NQ , - TAULOC , WORK( IPW ) , 1 , WORK , 1 ,
237       $C( IOFFC ) , LDC )
238        END IF
239  
240        END IF
241  
242        END IF
243  
244        END IF
245  
246        RETURN
247  
248  *     End of PSLARF
249  
250        END