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