ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
pdelset2.f
Go to the documentation of this file.
00001       SUBROUTINE PDELSET2( ALPHA, A, IA, JA, DESCA, BETA )
00002 *
00003 *  -- ScaLAPACK tools routine (version 1.7) --
00004 *     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
00005 *     and University of California, Berkeley.
00006 *     May 1, 1997
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            IA, JA
00010       DOUBLE PRECISION   ALPHA, BETA
00011 *     ..
00012 *     .. Array arguments ..
00013       INTEGER            DESCA( * )
00014       DOUBLE PRECISION   A( * )
00015 *     ..
00016 *
00017 *  Purpose
00018 *  =======
00019 *
00020 *  PDELSET2 sets alpha to the distributed matrix entry A(IA,JA)
00021 *  and A(IA,JA) to beta.
00022 *
00023 *  Notes
00024 *  =====
00025 *
00026 *  Each global data object is described by an associated description
00027 *  vector.  This vector stores the information required to establish
00028 *  the mapping between an object element and its corresponding process
00029 *  and memory location.
00030 *
00031 *  Let A be a generic term for any 2D block cyclicly distributed array.
00032 *  Such a global array has an associated description vector DESCA.
00033 *  In the following comments, the character _ should be read as
00034 *  "of the global array".
00035 *
00036 *  NOTATION        STORED IN      EXPLANATION
00037 *  --------------- -------------- --------------------------------------
00038 *  DTYPE_A(global) DESCA( DTYPE_ )The descriptor type.  In this case,
00039 *                                 DTYPE_A = 1.
00040 *  CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating
00041 *                                 the BLACS process grid A is distribu-
00042 *                                 ted over. The context itself is glo-
00043 *                                 bal, but the handle (the integer
00044 *                                 value) may vary.
00045 *  M_A    (global) DESCA( M_ )    The number of rows in the global
00046 *                                 array A.
00047 *  N_A    (global) DESCA( N_ )    The number of columns in the global
00048 *                                 array A.
00049 *  MB_A   (global) DESCA( MB_ )   The blocking factor used to distribute
00050 *                                 the rows of the array.
00051 *  NB_A   (global) DESCA( NB_ )   The blocking factor used to distribute
00052 *                                 the columns of the array.
00053 *  RSRC_A (global) DESCA( RSRC_ ) The process row over which the first
00054 *                                 row of the array A is distributed.
00055 *  CSRC_A (global) DESCA( CSRC_ ) The process column over which the
00056 *                                 first column of the array A is
00057 *                                 distributed.
00058 *  LLD_A  (local)  DESCA( LLD_ )  The leading dimension of the local
00059 *                                 array.  LLD_A >= MAX(1,LOCr(M_A)).
00060 *
00061 *  Let K be the number of rows or columns of a distributed matrix,
00062 *  and assume that its process grid has dimension p x q.
00063 *  LOCr( K ) denotes the number of elements of K that a process
00064 *  would receive if K were distributed over the p processes of its
00065 *  process column.
00066 *  Similarly, LOCc( K ) denotes the number of elements of K that a
00067 *  process would receive if K were distributed over the q processes of
00068 *  its process row.
00069 *  The values of LOCr() and LOCc() may be determined via a call to the
00070 *  ScaLAPACK tool function, NUMROC:
00071 *          LOCr( M ) = NUMROC( M, MB_A, MYROW, RSRC_A, NPROW ),
00072 *          LOCc( N ) = NUMROC( N, NB_A, MYCOL, CSRC_A, NPCOL ).
00073 *  An upper bound for these quantities may be computed by:
00074 *          LOCr( M ) <= ceil( ceil(M/MB_A)/NPROW )*MB_A
00075 *          LOCc( N ) <= ceil( ceil(N/NB_A)/NPCOL )*NB_A
00076 *
00077 *  Arguments
00078 *  =========
00079 *
00080 *  ALPHA   (local output) DOUBLE PRECISION
00081 *          The scalar alpha.
00082 *
00083 *  A       (local input/local ouput) DOUBLE PRECISION pointer into the
00084 *          local memory to an array of dimension (LLD_A,*) containing
00085 *          the local pieces of the distributed matrix A.
00086 *
00087 *  IA      (global input) INTEGER
00088 *          The row index in the global array A indicating the first
00089 *          row of sub( A ).
00090 *
00091 *  JA      (global input) INTEGER
00092 *          The column index in the global array A indicating the
00093 *          first column of sub( A ).
00094 *
00095 *  DESCA   (global and local input) INTEGER array of dimension DLEN_.
00096 *          The array descriptor for the distributed matrix A.
00097 *
00098 *  BETA    (local input) DOUBLE PRECISION
00099 *          The scalar beta.
00100 *
00101 *  =====================================================================
00102 *
00103 *     .. Parameters ..
00104       INTEGER            BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
00105      $                   LLD_, MB_, M_, NB_, N_, RSRC_
00106       PARAMETER          ( BLOCK_CYCLIC_2D = 1, DLEN_ = 9, DTYPE_ = 1,
00107      $                     CTXT_ = 2, M_ = 3, N_ = 4, MB_ = 5, NB_ = 6,
00108      $                     RSRC_ = 7, CSRC_ = 8, LLD_ = 9 )
00109       DOUBLE PRECISION   ZERO
00110       PARAMETER          ( ZERO = 0.0D+0 )
00111 *     ..
00112 *     .. Local Scalars ..
00113       INTEGER            IACOL, IAROW, IIA, IOFFA, JJA, MYCOL, MYROW,
00114      $                   NPCOL, NPROW
00115 *     ..
00116 *     .. External Subroutines ..
00117       EXTERNAL           BLACS_GRIDINFO, INFOG2L
00118 *     ..
00119 *     .. Executable Statements ..
00120 *
00121 *     Get grid parameters.
00122 *
00123       CALL BLACS_GRIDINFO( DESCA( CTXT_ ), NPROW, NPCOL, MYROW, MYCOL )
00124 *
00125       CALL INFOG2L( IA, JA, DESCA, NPROW, NPCOL, MYROW, MYCOL, IIA, JJA,
00126      $              IAROW, IACOL )
00127 *
00128       IF( MYROW.EQ.IAROW .AND. MYCOL.EQ.IACOL ) THEN
00129          IOFFA = IIA+(JJA-1)*DESCA( LLD_ )
00130          ALPHA = A( IOFFA )
00131          A( IOFFA ) = BETA
00132       ELSE
00133          ALPHA = ZERO
00134       END IF
00135 *
00136       RETURN
00137 *
00138 *     End of PDELSET2
00139 *
00140       END