Routine: PDLANTR()  File: SRC\pdlantr.f

 
 
# lines: 1030
  # code: 1030
  # comment: 0
  # blank:0
# Variables:24
# Callers:1
# Callings:0
# Words:37
# Keywords:21
 

 

..
     .. Local Scalars ..
     ..
     .. Local Arrays ..
     ..
     .. External Subroutines ..
     ..
     .. External Functions ..
     ..
     .. Intrinsic Functions ..
     ..
     .. Executable Statements ..
     Get grid parameters
        Find max(abs(A(i,j))).
           Upper triangular matrix
           Loop over remaining block of columns
           Lower triangular matrix
           Loop over remaining block of columns
        Gather the intermediate results to process (0,0).
           Upper triangular matrix
           Loop over remaining block of columns
           Lower triangular matrix
           Loop over remaining block of columns
        Find sum of global matrix columns and store on row 0 of
        process grid
        Find maximum sum of columns for 1-norm
           Upper triangular matrix
           Loop over remaining block of columns
           Lower triangular matrix
           Loop over remaining block of columns
        Find sum of global matrix rows and store on column 0 of
        process grid
        Find maximum sum of rows for Infinity-norm
           Upper triangular matrix
           Loop over remaining block of columns
           Lower triangular matrix
           Loop over remaining block of columns
        Perform the global scaled sum

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

 
001        DOUBLE PRECISION FUNCTION PDLANTR( NORM , UPLO , DIAG , M , N , A ,
002       $IA , JA , DESCA , 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 1 , 1997
008  
009  *     .. Scalar Arguments ..
010        CHARACTER DIAG , NORM , UPLO
011        INTEGER IA , JA , M , N
012  *     ..
013  *     .. Array Arguments ..
014        INTEGER DESCA( * )
015        DOUBLE PRECISION A( * ) , WORK( * )
016  *     ..
017  
018  *     Purpose
019  *     === ====
020  
021  *     PDLANTR returns the value of the one norm , or the Frobenius norm ,
022  *     or the infinity norm , or the element of largest absolute value of a
023  *     trapezoidal or triangular distributed matrix sub( A ) denoting
024  *     A(IA : IA + M - 1 , JA : JA + N - 1).
025  
026  *     PDLANTR returns the value
027  
028  *     ( max(abs(A(i , j))) , NORM = 'M' or 'm' with ia <= i <= ia + m - 1 ,
029  *     ( and ja <= j <= ja + n - 1 ,
030  *     (
031  *     ( norm1( sub( A ) ) , NORM = '1' , 'O' or 'o'
032  *     (
033  *     ( normI( sub( A ) ) , NORM = 'I' or 'i'
034  *     (
035  *     ( normF( sub( A ) ) , NORM = 'F' , 'f' , 'E' or 'e'
036  
037  *     where norm1 denotes the one norm of a matrix(maximum column sum) ,
038  *     normI denotes the infinity norm of a matrix(maximum row sum) and
039  *     normF denotes the Frobenius norm of a matrix(square root of sum of
040  *     squares). Note that max(abs(A(i , j))) is not a matrix norm.
041  
042  *     Notes
043  *     === ==
044  
045  *     Each global data object is described by an associated description
046  *     vector. This vector stores the information required to establish
047  *     the mapping between an object element and its corresponding process
048  *     and memory location.
049  
050  *     Let A be a generic term for any 2D block cyclicly distributed array.
051  *     Such a global array has an associated description vector DESCA.
052  *     In the following comments , the character _ should be read as
053  *     "of the global array".
054  
055  *     NOTATION STORED IN EXPLANATION
056  *     --- ------------ -------------- --------------------------------------
057  *     DTYPE_A(global) DESCA( DTYPE_ )The descriptor type. In this case ,
058  *     DTYPE_A = 1.
059  *     CTXT_A(global) DESCA( CTXT_ ) The BLACS context handle , indicating
060  *     the BLACS process grid A is distribu -
061  *     ted over. The context itself is glo -
062  *     bal , but the handle(the integer
063  *     value) may vary.
064  *     M_A(global) DESCA( M_ ) The number of rows in the global
065  *     array A.
066  *     N_A(global) DESCA( N_ ) The number of columns in the global
067  *     array A.
068  *     MB_A(global) DESCA( MB_ ) The blocking factor used to distribute
069  *     the rows of the array.
070  *     NB_A(global) DESCA( NB_ ) The blocking factor used to distribute
071  *     the columns of the array.
072  *     RSRC_A(global) DESCA( RSRC_ ) The process row over which the first
073  *     row of the array A is distributed.
074  *     CSRC_A(global) DESCA( CSRC_ ) The process column over which the
075  *     first column of the array A is
076  *     distributed.
077  *     LLD_A(local) DESCA( LLD_ ) The leading dimension of the local
078  *     array. LLD_A >= MAX(1 , LOCr(M_A)).
079  
080  *     Let K be the number of rows or columns of a distributed matrix ,
081  *     and assume that its process grid has dimension p x q.
082  *     LOCr( K ) denotes the number of elements of K that a process
083  *     would receive if K were distributed over the p processes of its
084  *     process column.
085  *     Similarly , LOCc( K ) denotes the number of elements of K that a
086  *     process would receive if K were distributed over the q processes of
087  *     its process row.
088  *     The values of LOCr() and LOCc() may be determined via a call to the
089  *     ScaLAPACK tool function , NUMROC :
090  *     LOCr( M ) = NUMROC( M , MB_A , MYROW , RSRC_A , NPROW ) ,
091  *     LOCc( N ) = NUMROC( N , NB_A , MYCOL , CSRC_A , NPCOL ).
092  *     An upper bound for these quantities may be computed by :
093  *     LOCr( M ) <= ceil( ceil(M / MB_A) / NPROW )*MB_A
094  *     LOCc( N ) <= ceil( ceil(N / NB_A) / NPCOL )*NB_A
095  
096  *     Arguments
097  *     === ======
098  
099  *     NORM(global input) CHARACTER
100  *     Specifies the value to be returned in PDLANTR as described
101  *     above.
102  
103  *     UPLO(global input) CHARACTER
104  *     Specifies whether the matrix sub( A ) is upper or lower
105  *     trapezoidal.
106  *     = 'U' : Upper trapezoidal
107  *     = 'L' : Lower trapezoidal
108  *     Note that sub( A ) is triangular instead of trapezoidal
109  *     if M = N.
110  
111  *     DIAG(global input) CHARACTER
112  *     Specifies whether or not the distributed matrix sub( A ) has
113  *     unit diagonal.
114  *     = 'N' : Non - unit diagonal
115  *     = 'U' : Unit diagonal
116  
117  *     M(global input) INTEGER
118  *     The number of rows to be operated on i.e the number of rows
119  *     of the distributed submatrix sub( A ). When M = 0 , PDLANTR is
120  *     set to zero. M >= 0.
121  
122  *     N(global input) INTEGER
123  *     The number of columns to be operated on i.e the number of
124  *     columns of the distributed submatrix sub( A ). When N = 0 ,
125  *     PDLANTR is set to zero. N >= 0.
126  
127  *     A(local input) DOUBLE PRECISION pointer into the local memory
128  *     to an array of dimension(LLD_A , LOCc(JA + N - 1) ) containing
129  *     the local pieces of sub( A ).
130  
131  *     IA(global input) INTEGER
132  *     The row index in the global array A indicating the first
133  *     row of sub( A ).
134  
135  *     JA(global input) INTEGER
136  *     The column index in the global array A indicating the
137  *     first column of sub( A ).
138  
139  *     DESCA(global and local input) INTEGER array of dimension DLEN_.
140  *     The array descriptor for the distributed matrix A.
141  
142  *     WORK(local workspace) DOUBLE PRECISION array dimension(LWORK)
143  *     LWORK >= 0 if NORM = 'M' or 'm'(not referenced) ,
144  *     Nq0 if NORM = '1' , 'O' or 'o' ,
145  *     Mp0 if NORM = 'I' or 'i' ,
146  *     0 if NORM = 'F' , 'f' , 'E' or 'e'(not referenced) ,
147  *     where
148  
149  *     IROFFA = MOD( IA - 1 , MB_A ) , ICOFFA = MOD( JA - 1 , NB_A ) ,
150  *     IAROW = INDXG2P( IA , MB_A , MYROW , RSRC_A , NPROW ) ,
151  *     IACOL = INDXG2P( JA , NB_A , MYCOL , CSRC_A , NPCOL ) ,
152  *     Mp0 = NUMROC( M + IROFFA , MB_A , MYROW , IAROW , NPROW ) ,
153  *     Nq0 = NUMROC( N + ICOFFA , NB_A , MYCOL , IACOL , NPCOL ) ,
154  
155  *     INDXG2P and NUMROC are ScaLAPACK tool functions ; MYROW ,
156  *     MYCOL , NPROW and NPCOL can be determined by calling the
157  *     subroutine BLACS_GRIDINFO.
158  
159  *     === ==================================================================
160  
161  *     .. Parameters ..
162        INTEGER BLOCK_CYCLIC_2D , CSRC_ , CTXT_ , DLEN_ , DTYPE_ ,
163       $LLD_ , MB_ , M_ , NB_ , N_ , RSRC_
164        PARAMETER( BLOCK_CYCLIC_2D = 1 , DLEN_ = 9 , DTYPE_ = 1 ,
165       $CTXT_ = 2 , M_ = 3 , N_ = 4 , MB_ = 5 , NB_ = 6 ,
166       $RSRC_ = 7 , CSRC_ = 8 , LLD_ = 9 )
167        DOUBLE PRECISION ONE , ZERO
168        PARAMETER( ONE = 1.0D + 0 , ZERO = 0.0D + 0 )
169        END IF
170  
171  *     Broadcast the result to every process in the grid.
172  
173        IF( MYROW.EQ.0 .AND. MYCOL.EQ.0 ) THEN
174            CALL DGEBS2D( ICTXT , 'All' , ' ' , 1 , 1 , VALUE , 1 )
175        ELSE
176            CALL DGEBR2D( ICTXT , 'All' , ' ' , 1 , 1 , VALUE , 1 , 0 , 0 )
177        END IF
178  
179        PDLANTR = VALUE
180  
181        RETURN
182  
183  *     End of PDLANTR
184  
185        END