SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
pztranu_.c
Go to the documentation of this file.
1/* ---------------------------------------------------------------------
2*
3* -- PBLAS 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 pztranu_( Int * M, Int * N,
21 double * ALPHA,
22 double * A, Int * IA, Int * JA, Int * DESCA,
23 double * BETA,
24 double * C, Int * IC, Int * JC, Int * DESCC )
25#else
26void pztranu_( M, N, ALPHA, A, IA, JA, DESCA, BETA, C, IC, JC, DESCC )
27/*
28* .. Scalar Arguments ..
29*/
30 Int * IA, * IC, * JA, * JC, * M, * N;
31 double * ALPHA, * BETA;
32/*
33* .. Array Arguments ..
34*/
35 Int * DESCA, * DESCC;
36 double * A, * C;
37#endif
38{
39/*
40* Purpose
41* =======
42*
43* PZTRANU transposes a matrix
44*
45* sub( C ) := beta*sub( C ) + alpha*op( sub( A ) )
46*
47* where
48*
49* sub( C ) denotes C(IC:IC+M-1,JC:JC+N-1),
50*
51* sub( A ) denotes A(IA:IA+N-1,JA:JA+M-1), and, op( X ) = X'.
52*
53* Thus, op( sub( A ) ) denotes A(IA:IA+N-1,JA:JA+M-1)'.
54*
55* Beta is a scalar, sub( C ) is an m by n submatrix, and sub( A ) is an
56* n by m submatrix.
57*
58* Notes
59* =====
60*
61* A description vector is associated with each 2D block-cyclicly dis-
62* tributed matrix. This vector stores the information required to
63* establish the mapping between a matrix entry and its corresponding
64* process and memory location.
65*
66* In the following comments, the character _ should be read as
67* "of the distributed matrix". Let A be a generic term for any 2D
68* block cyclicly distributed matrix. Its description vector is DESC_A:
69*
70* NOTATION STORED IN EXPLANATION
71* ---------------- --------------- ------------------------------------
72* DTYPE_A (global) DESCA[ DTYPE_ ] The descriptor type.
73* CTXT_A (global) DESCA[ CTXT_ ] The BLACS context handle, indicating
74* the NPROW x NPCOL BLACS process grid
75* A is distributed over. The context
76* itself is global, but the handle
77* (the integer value) may vary.
78* M_A (global) DESCA[ M_ ] The number of rows in the distribu-
79* ted matrix A, M_A >= 0.
80* N_A (global) DESCA[ N_ ] The number of columns in the distri-
81* buted matrix A, N_A >= 0.
82* IMB_A (global) DESCA[ IMB_ ] The number of rows of the upper left
83* block of the matrix A, IMB_A > 0.
84* INB_A (global) DESCA[ INB_ ] The number of columns of the upper
85* left block of the matrix A,
86* INB_A > 0.
87* MB_A (global) DESCA[ MB_ ] The blocking factor used to distri-
88* bute the last M_A-IMB_A rows of A,
89* MB_A > 0.
90* NB_A (global) DESCA[ NB_ ] The blocking factor used to distri-
91* bute the last N_A-INB_A columns of
92* A, NB_A > 0.
93* RSRC_A (global) DESCA[ RSRC_ ] The process row over which the first
94* row of the matrix A is distributed,
95* NPROW > RSRC_A >= 0.
96* CSRC_A (global) DESCA[ CSRC_ ] The process column over which the
97* first column of A is distributed.
98* NPCOL > CSRC_A >= 0.
99* LLD_A (local) DESCA[ LLD_ ] The leading dimension of the local
100* array storing the local blocks of
101* the distributed matrix A,
102* IF( Lc( 1, N_A ) > 0 )
103* LLD_A >= MAX( 1, Lr( 1, M_A ) )
104* ELSE
105* LLD_A >= 1.
106*
107* Let K be the number of rows of a matrix A starting at the global in-
108* dex IA,i.e, A( IA:IA+K-1, : ). Lr( IA, K ) denotes the number of rows
109* that the process of row coordinate MYROW ( 0 <= MYROW < NPROW ) would
110* receive if these K rows were distributed over NPROW processes. If K
111* is the number of columns of a matrix A starting at the global index
112* JA, i.e, A( :, JA:JA+K-1, : ), Lc( JA, K ) denotes the number of co-
113* lumns that the process MYCOL ( 0 <= MYCOL < NPCOL ) would receive if
114* these K columns were distributed over NPCOL processes.
115*
116* The values of Lr() and Lc() may be determined via a call to the func-
117* tion PB_Cnumroc:
118* Lr( IA, K ) = PB_Cnumroc( K, IA, IMB_A, MB_A, MYROW, RSRC_A, NPROW )
119* Lc( JA, K ) = PB_Cnumroc( K, JA, INB_A, NB_A, MYCOL, CSRC_A, NPCOL )
120*
121* Arguments
122* =========
123*
124* M (global input) INTEGER
125* On entry, M specifies the number of rows of the submatrix
126* sub( C ) and the number of columns of the submatrix sub( A ).
127* M must be at least zero.
128*
129* N (global input) INTEGER
130* On entry, N specifies the number of columns of the submatrix
131* sub( C ) and the number of rows of the submatrix sub( A ). N
132* must be at least zero.
133*
134* ALPHA (global input) COMPLEX*16
135* On entry, ALPHA specifies the scalar alpha. When ALPHA is
136* supplied as zero then the local entries of the array A
137* corresponding to the entries of the submatrix sub( A ) need
138* not be set on input.
139*
140* A (local input) COMPLEX*16 array
141* On entry, A is an array of dimension (LLD_A, Ka), where Ka is
142* at least Lc( 1, JA+M-1 ). Before entry, this array contains
143* the local entries of the matrix A.
144*
145* IA (global input) INTEGER
146* On entry, IA specifies A's global row index, which points to
147* the beginning of the submatrix sub( A ).
148*
149* JA (global input) INTEGER
150* On entry, JA specifies A's global column index, which points
151* to the beginning of the submatrix sub( A ).
152*
153* DESCA (global and local input) INTEGER array
154* On entry, DESCA is an integer array of dimension DLEN_. This
155* is the array descriptor for the matrix A.
156*
157* BETA (global input) COMPLEX*16
158* On entry, BETA specifies the scalar beta. When BETA is
159* supplied as zero then the local entries of the array C
160* corresponding to the entries of the submatrix sub( C ) need
161* not be set on input.
162*
163* C (local input/local output) COMPLEX*16 array
164* On entry, C is an array of dimension (LLD_C, Kc), where Kc is
165* at least Lc( 1, JC+N-1 ). Before entry, this array contains
166* the local entries of the matrix C.
167* On exit, the entries of this array corresponding to the local
168* entries of the submatrix sub( C ) are overwritten by the
169* local entries of the m by n updated submatrix.
170*
171* IC (global input) INTEGER
172* On entry, IC specifies C's global row index, which points to
173* the beginning of the submatrix sub( C ).
174*
175* JC (global input) INTEGER
176* On entry, JC specifies C's global column index, which points
177* to the beginning of the submatrix sub( C ).
178*
179* DESCC (global and local input) INTEGER array
180* On entry, DESCC is an integer array of dimension DLEN_. This
181* is the array descriptor for the matrix C.
182*
183* -- Written on April 1, 1998 by
184* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
185*
186* ---------------------------------------------------------------------
187*/
188/*
189* .. Local Scalars ..
190*/
191 Int Ai, Aj, Ci, Cj, ctxt, info, mycol, myrow, npcol, nprow;
192/*
193* .. Local Arrays ..
194*/
195 Int Ad[DLEN_], Cd[DLEN_];
196/* ..
197* .. Executable Statements ..
198*
199*/
200 PB_CargFtoC( *IA, *JA, DESCA, &Ai, &Aj, Ad );
201 PB_CargFtoC( *IC, *JC, DESCC, &Ci, &Cj, Cd );
202#ifndef NO_ARGCHK
203/*
204* Test the input parameters
205*/
206 Cblacs_gridinfo( ( ctxt = Ad[CTXT_] ), &nprow, &npcol, &myrow, &mycol );
207 if( !( info = ( ( nprow == -1 ) ? -( 701 + CTXT_ ) : 0 ) ) )
208 {
209 PB_Cchkmat( ctxt, "PZTRANU", "A", *N, 2, *M, 1, Ai, Aj, Ad, 7, &info );
210 PB_Cchkmat( ctxt, "PZTRANU", "C", *M, 1, *N, 2, Ci, Cj, Cd, 12, &info );
211 }
212 if( info ) { PB_Cabort( ctxt, "PZTRANU", info ); return; }
213#endif
214/*
215* Quick return if possible
216*/
217 if( ( *M == 0 ) || ( *N == 0 ) ||
218 ( ( ALPHA[REAL_PART] == ZERO && ALPHA[IMAG_PART] == ZERO ) &&
219 ( BETA [REAL_PART] == ONE && BETA [IMAG_PART] == ZERO ) ) )
220 return;
221/*
222* And when alpha is zero
223*/
224 if( ( ALPHA[REAL_PART] == ZERO ) && ( ALPHA[IMAG_PART] == ZERO ) )
225 {
226 if( ( BETA[REAL_PART] == ZERO ) && ( BETA[IMAG_PART] == ZERO ) )
227 {
228 PB_Cplapad( PB_Cztypeset(), ALL, NOCONJG, *M, *N, ((char *)BETA),
229 ((char *)BETA), ((char *) C), Ci, Cj, Cd );
230 }
231 else
232 {
233 PB_Cplascal( PB_Cztypeset(), ALL, NOCONJG, *M, *N, ((char *)BETA),
234 ((char * )C), Ci, Cj, Cd );
235 }
236 return;
237 }
238/*
239* Start the operations
240*/
241 PB_Cptran( PB_Cztypeset(), NOCONJG, *M, *N, ((char *) ALPHA),
242 ((char *) A), Ai, Aj, Ad, ((char *) BETA), ((char *) C),
243 Ci, Cj, Cd );
244/*
245* End of PZTRANU
246*/
247}
#define Int
Definition Bconfig.h:22
#define REAL_PART
Definition pblas.h:139
#define IMAG_PART
Definition pblas.h:140
void Cblacs_gridinfo()
#define ALL
Definition PBblas.h:50
#define NOCONJG
Definition PBblas.h:45
#define pztranu_
Definition PBpblas.h:195
#define CTXT_
Definition PBtools.h:38
void PB_Cabort()
#define ONE
Definition PBtools.h:64
void PB_Cptran()
void PB_Cchkmat()
PBTYP_T * PB_Cztypeset()
void PB_Cplapad()
void PB_Cplascal()
void PB_CargFtoC()
#define ZERO
Definition PBtools.h:66
#define DLEN_
Definition PBtools.h:48