SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
PB_Cplacnjg.c
Go to the documentation of this file.
1/* ---------------------------------------------------------------------
2*
3* -- PBLAS auxiliary routine (version 2.0) --
4* University of Tennessee, Knoxville, Oak Ridge National Laboratory,
5* and University of California, Berkeley.
6* April 1, 1998
7*
8* ---------------------------------------------------------------------
9*/
10/*
11* Include files
12*/
13#include "../pblas.h"
14#include "../PBpblas.h"
15#include "../PBtools.h"
16#include "../PBblacs.h"
17#include "../PBblas.h"
18
19#ifdef __STDC__
20void PB_Cplacnjg( PBTYP_T * TYPE, Int M, Int N, char * ALPHA, char * A,
21 Int IA, Int JA, Int * DESCA )
22#else
23void PB_Cplacnjg( TYPE, M, N, ALPHA, A, IA, JA, DESCA )
24/*
25* .. Scalar Arguments ..
26*/
27 Int IA, JA, M, N;
28 char * ALPHA;
29 PBTYP_T * TYPE;
30/*
31* .. Array Arguments ..
32*/
33 Int * DESCA;
34 char * A;
35#endif
36{
37/*
38* Purpose
39* =======
40*
41* PB_Cplacnjg conjugates and scales by alpha and an m by n submatrix
42* sub( A ) denoting A(IA:IA+M-1,JA:JA+N-1).
43*
44* Notes
45* =====
46*
47* A description vector is associated with each 2D block-cyclicly dis-
48* tributed matrix. This vector stores the information required to
49* establish the mapping between a matrix entry and its corresponding
50* process and memory location.
51*
52* In the following comments, the character _ should be read as
53* "of the distributed matrix". Let A be a generic term for any 2D
54* block cyclicly distributed matrix. Its description vector is DESC_A:
55*
56* NOTATION STORED IN EXPLANATION
57* ---------------- --------------- ------------------------------------
58* DTYPE_A (global) DESCA[ DTYPE_ ] The descriptor type.
59* CTXT_A (global) DESCA[ CTXT_ ] The BLACS context handle, indicating
60* the NPROW x NPCOL BLACS process grid
61* A is distributed over. The context
62* itself is global, but the handle
63* (the integer value) may vary.
64* M_A (global) DESCA[ M_ ] The number of rows in the distribu-
65* ted matrix A, M_A >= 0.
66* N_A (global) DESCA[ N_ ] The number of columns in the distri-
67* buted matrix A, N_A >= 0.
68* IMB_A (global) DESCA[ IMB_ ] The number of rows of the upper left
69* block of the matrix A, IMB_A > 0.
70* INB_A (global) DESCA[ INB_ ] The number of columns of the upper
71* left block of the matrix A,
72* INB_A > 0.
73* MB_A (global) DESCA[ MB_ ] The blocking factor used to distri-
74* bute the last M_A-IMB_A rows of A,
75* MB_A > 0.
76* NB_A (global) DESCA[ NB_ ] The blocking factor used to distri-
77* bute the last N_A-INB_A columns of
78* A, NB_A > 0.
79* RSRC_A (global) DESCA[ RSRC_ ] The process row over which the first
80* row of the matrix A is distributed,
81* NPROW > RSRC_A >= 0.
82* CSRC_A (global) DESCA[ CSRC_ ] The process column over which the
83* first column of A is distributed.
84* NPCOL > CSRC_A >= 0.
85* LLD_A (local) DESCA[ LLD_ ] The leading dimension of the local
86* array storing the local blocks of
87* the distributed matrix A,
88* IF( Lc( 1, N_A ) > 0 )
89* LLD_A >= MAX( 1, Lr( 1, M_A ) )
90* ELSE
91* LLD_A >= 1.
92*
93* Let K be the number of rows of a matrix A starting at the global in-
94* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
95* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
96* receive if these K rows were distributed over NPROW processes. If K
97* is the number of columns of a matrix A starting at the global index
98* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
99* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
100* these K columns were distributed over NPCOL processes.
101*
102* The values of Lr() and Lc() may be determined via a call to the func-
103* tion PB_Cnumroc:
104* Lr( IA, K ) = PB_Cnumroc( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
105* Lc( JA, K ) = PB_Cnumroc( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
106*
107* Arguments
108* =========
109*
110* TYPE (local input) pointer to a PBTYP_T structure
111* On entry, TYPE is a pointer to a structure of type PBTYP_T,
112* that contains type information (See pblas.h).
113*
114* M (global input) INTEGER
115* On entry, M specifies the number of rows of the submatrix
116* sub( A ). M must be at least zero.
117*
118* N (global input) INTEGER
119* On entry, N specifies the number of columns of the submatrix
120* sub( A ). N must be at least zero.
121*
122* ALPHA (global input) pointer to CHAR
123* On entry, ALPHA specifies the scalar alpha, i.e., the cons-
124* tant with which the matrix elements are to be scaled.
125*
126* A (local input/local output) pointer to CHAR
127* On entry, A is an array of dimension (LLD_A, Ka), where Ka is
128* at least Lc( 1, JA+N-1 ). Before entry, this array contains
129* the local entries of the matrix A to be scaled. On exit, the
130* local entries of this array corresponding to the to the en-
131* tries of the submatrix sub( A ) are overwritten by the local
132* entries of the m by n conjugated and scaled submatrix.
133*
134* IA (global input) INTEGER
135* On entry, IA specifies A's global row index, which points to
136* the beginning of the submatrix sub( A ).
137*
138* JA (global input) INTEGER
139* On entry, JA specifies A's global column index, which points
140* to the beginning of the submatrix sub( A ).
141*
142* DESCA (global and local input) INTEGER array
143* On entry, DESCA is an integer array of dimension DLEN_. This
144* is the array descriptor for the matrix A.
145*
146* -- Written on April 1, 1998 by
147* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
148*
149* ---------------------------------------------------------------------
150*/
151/*
152* .. Local Scalars ..
153*/
154 Int Acol, Arow, Aii, Aimb1, Ainb1, Ajj, Ald, Amb, Amp, Anb, Anq,
155 izero=0, mycol, myrow, npcol, nprow;
156/*
157* .. Local Arrays ..
158*/
159 Int Ad0[DLEN_];
160/* ..
161* .. Executable Statements ..
162*
163*/
164/*
165* Quick return if possible
166*/
167 if( ( M <= 0 ) || ( N <= 0 ) ) return;
168/*
169* Retrieve process grid information
170*/
171 Cblacs_gridinfo( DESCA[CTXT_], &nprow, &npcol, &myrow, &mycol );
172/*
173* Compute descriptor Ad0 for sub( A )
174*/
175 PB_Cdescribe( M, N, IA, JA, DESCA, nprow, npcol, myrow, mycol, &Aii, &Ajj,
176 &Ald, &Aimb1, &Ainb1, &Amb, &Anb, &Arow, &Acol, Ad0 );
177/*
178* Quick return if I don't own any of sub( A ).
179*/
180 Amp = PB_Cnumroc( M, 0, Aimb1, Amb, myrow, Arow, nprow );
181 Anq = PB_Cnumroc( N, 0, Ainb1, Anb, mycol, Acol, npcol );
182 if( ( Amp <= 0 ) || ( Anq <= 0 ) ) return;
183/*
184* Conjugate and scale local data
185*/
186 TYPE->Ftzcnjg( C2F_CHAR( ALL ), &Amp, &Anq, &izero, ALPHA,
187 Mptr( A, Aii, Ajj, Ald, TYPE->size ), &Ald );
188/*
189* End of PB_Cplacnjg
190*/
191}
#define Int
Definition Bconfig.h:22
#define C2F_CHAR(a)
Definition pblas.h:125
void Cblacs_gridinfo()
#define ALL
Definition PBblas.h:50
#define CTXT_
Definition PBtools.h:38
#define Mptr(a_, i_, j_, lda_, siz_)
Definition PBtools.h:132
Int PB_Cnumroc()
void PB_Cplacnjg()
#define DLEN_
Definition PBtools.h:48
void PB_Cdescribe()
#define TYPE
Definition clamov.c:7