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