ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
pzlamr1d.f
Go to the documentation of this file.
00001       SUBROUTINE PZLAMR1D( N, A, IA, JA, DESCA, B, IB, JB, DESCB )
00002 *
00003 *  -- ScaLAPACK routine (version 1.7) --
00004 *     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
00005 *     and University of California, Berkeley.
00006 *     October 15, 1999
00007 *
00008 *     .. Scalar Arguments ..
00009       INTEGER            IA, IB, JA, JB, N
00010 *     ..
00011 *     .. Array Arguments ..
00012       INTEGER            DESCA( * ), DESCB( * )
00013       COMPLEX*16         A( * ), B( * )
00014 *     ..
00015 *
00016 *  Bugs
00017 *  ====
00018 *
00019 *  I am not sure that this works correctly when IB and JB are not equal
00020 *  to 1.  Indeed, I suspect that IB should always be set to 1 or ignored
00021 *  with 1 used in its place.
00022 *
00023 *  PZLAMR1D has not been tested except withint the contect of
00024 *  PZHEPTRD, the prototype reduction to tridiagonal form code.
00025 *
00026 *  Purpose
00027 *
00028 *  =======
00029 *
00030 *  PZLAMR1D redistributes a one-dimensional row vector from one data
00031 *  decomposition to another.
00032 *
00033 *  This is an auxiliary routine called by PZHETRD to redistribute D, E
00034 *  and TAU.
00035 *
00036 *  Notes
00037 *  =====
00038 *
00039 *  Although all processes call PZGEMR2D, only the processes that own
00040 *  the first column of A send data and only processes that own the
00041 *  first column of B receive data.  The calls to ZGEBS2D/ZGEBR2D
00042 *  spread the data down.
00043 *
00044 *  Arguments
00045 *  =========
00046 *
00047 *  N       (global input) INTEGER
00048 *          The size of the matrix to be transposed.
00049 *
00050 *  A       (local output) COMPLEX*16 pointer into the
00051 *          local memory to an array of dimension (LOCc(JA+N-1)).
00052 *          On output, A is replicated across all processes in
00053 *          this processor column.
00054 *
00055 *  IA      (global input) INTEGER
00056 *          A's global row index, which points to the beginning of
00057 *          the submatrix which is to be operated on.
00058 *
00059 *  JA      (global input) INTEGER
00060 *          A's global column index, which points to the beginning of
00061 *          the submatrix which is to be operated on.
00062 *
00063 *  DESCA   (global and local input) INTEGER array of dimension DLEN_.
00064 *          The array descriptor for the distributed matrix A.
00065 *
00066 *  B       (local input/local output) COMPLEX*16 pointer into the
00067 *          local memory to an array of dimension (LOCc(JB+N-1)).
00068 *
00069 *  IB      (global input) INTEGER
00070 *          B's global row index,  NOT USED
00071 *
00072 *  JB      (global input) INTEGER
00073 *          B's global column index, which points to the beginning of
00074 *          the submatrix which is to be operated on.
00075 *
00076 *  DESCB   (global and local input) INTEGER array of dimension DLEN_.
00077 *          The array descriptor for the distributed matrix B.
00078 *
00079 *  WORK    (local workspace) COMPLEX*16 array, dimension ( LWORK )
00080 *
00081 *  LWORK   (local input) INTEGER
00082 *          The dimension of the array WORK.
00083 *          LWORK is local input and must be at least
00084 *          LWORK >= NB * NUMROC( N, 1, 0, 0, NPROW )
00085 *
00086 *  =====================================================================
00087 *
00088 *     .. Parameters ..
00089       INTEGER            BLOCK_CYCLIC_2D, DLEN_, DTYPE_, CTXT_, M_, N_,
00090      $                   MB_, NB_, RSRC_, CSRC_, LLD_
00091       PARAMETER          ( BLOCK_CYCLIC_2D = 1, DLEN_ = 9, DTYPE_ = 1,
00092      $                   CTXT_ = 2, M_ = 3, N_ = 4, MB_ = 5, NB_ = 6,
00093      $                   RSRC_ = 7, CSRC_ = 8, LLD_ = 9 )
00094 *     ..
00095 *     .. Local Scalars ..
00096       INTEGER            I, ICTXT, MYCOL, MYROW, NPCOL, NPROW, NQ
00097 *     ..
00098 *     .. Local Arrays ..
00099       INTEGER            DESCAA( DLEN_ ), DESCBB( DLEN_ )
00100 *     ..
00101 *     .. External Subroutines ..
00102       EXTERNAL           BLACS_GRIDINFO, PZGEMR2D, ZGEBR2D, ZGEBS2D
00103 *     ..
00104 *     .. External Functions ..
00105       INTEGER            NUMROC
00106       EXTERNAL           NUMROC
00107 *     ..
00108 *     .. Executable Statements ..
00109 *       This is just to keep ftnchek and toolpack/1 happy
00110       IF( BLOCK_CYCLIC_2D*CSRC_*CTXT_*DLEN_*DTYPE_*LLD_*MB_*M_*NB_*N_*
00111      $    RSRC_.LT.0 )RETURN
00112 *
00113 *     Quick return if possible
00114 *
00115       IF( N.LE.0 )
00116      $   RETURN
00117 *
00118       DO 10 I = 1, DLEN_
00119          DESCAA( I ) = DESCA( I )
00120          DESCBB( I ) = DESCB( I )
00121    10 CONTINUE
00122 *
00123       DESCAA( M_ ) = 1
00124       DESCBB( M_ ) = 1
00125       DESCAA( LLD_ ) = 1
00126       DESCBB( LLD_ ) = 1
00127 *
00128       ICTXT = DESCB( CTXT_ )
00129       CALL PZGEMR2D( 1, N, A, IA, JA, DESCAA, B, IB, JB, DESCBB, ICTXT )
00130 *
00131       CALL BLACS_GRIDINFO( ICTXT, NPROW, NPCOL, MYROW, MYCOL )
00132       NQ = NUMROC( N, DESCB( NB_ ), MYCOL, 0, NPCOL )
00133 *
00134       IF( MYROW.EQ.0 ) THEN
00135          CALL ZGEBS2D( ICTXT, 'C', ' ', NQ, 1, B, NQ )
00136       ELSE
00137          CALL ZGEBR2D( ICTXT, 'C', ' ', NQ, 1, B, NQ, 0, MYCOL )
00138       END IF
00139 *
00140       RETURN
00141 *
00142 *     End of PZLAMR1D
00143 *
00144       END