SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
PB_Ctztrmm.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_Ctztrmm( PBTYP_T * TYPE, char * SIDE, char * UPLO, char * TRANS,
21 char * DIAG, Int M, Int N, Int K, Int IOFFD,
22 char * ALPHA, char * A, Int LDA, char * B, Int LDB,
23 char * C, Int LDC )
24#else
25void PB_Ctztrmm( TYPE, SIDE, UPLO, TRANS, DIAG, M, N, K, IOFFD, ALPHA,
26 A, LDA, B, LDB, C, LDC )
27/*
28* .. Scalar Arguments ..
29*/
30 char * SIDE, * UPLO, * TRANS, * DIAG;
31 Int IOFFD, K, LDA, LDB, LDC, M, N;
32 char * ALPHA;
33/*
34* .. Array Arguments ..
35*/
36 PBTYP_T * TYPE;
37 char * A, * B, * C;
38#endif
39{
40/*
41* Purpose
42* =======
43*
44* PB_Ctztrmm performs the matrix-matrix operation
45*
46* C := alpha * op( A ) * B,
47*
48* or
49*
50* C := alpha * B * op( A ),
51*
52* where alpha is a scalar, A is an m by n trapezoidal triangular ma-
53* trix, B is an k by n matrix when TRANS is 'N' or 'n' and an m by k
54* matrix otherwise, and op( A ) is one of
55*
56* op( A ) = A or op( A ) = A' or op( A ) = conjg( A' ).
57*
58* Arguments
59* =========
60*
61* TYPE (local input) pointer to a PBTYP_T structure
62* On entry, TYPE is a pointer to a structure of type PBTYP_T,
63* that contains type information (See pblas.h).
64*
65* SIDE (input) pointer to CHAR
66* On entry, SIDE specifies whether op( A ) multiplies B from
67* the left or right as follows:
68*
69* SIDE = 'L' or 'l' C := alpha * op( A ) * B,
70*
71* SIDE = 'R' or 'r' C := alpha * B * op( A ).
72*
73* UPLO (input) pointer to CHAR
74* On entry, UPLO specifies which part of the matrix A is to be
75* referenced as follows:
76*
77* UPLO = 'L' or 'l' the lower trapezoid of A is referenced,
78*
79* UPLO = 'U' or 'u' the upper trapezoid of A is referenced,
80*
81* otherwise all of the matrix A is referenced.
82*
83* TRANS (input) pointer to CHAR
84* On entry, TRANS specifies the form of op( A ) to be used as
85* follows:
86*
87* TRANS = 'N' or 'n': op( A ) = A,
88*
89* TRANS = 'T' or 't': op( A ) = A',
90*
91* TRANS = 'C' or 'c': op( A ) = A' or conjg( A' ).
92*
93* DIAG (input) pointer to CHAR
94* On entry, DIAG specifies whether or not A is unit triangular
95* as follows:
96*
97* DIAG = 'U' or 'u' A is assumed to be unit triangular.
98*
99* DIAG = 'N' or 'n' A is not assumed to be unit triangular.
100*
101* M (input) INTEGER
102* On entry, M specifies the number of rows of the matrix A. M
103* must be at least zero.
104*
105* N (input) INTEGER
106* On entry, N specifies the number of columns of the matrix A.
107* N must be at least zero.
108*
109* K (input) INTEGER
110* On entry, K specifies the number of rows of the matrix B when
111* TRANS is 'N' or 'n', and the number of columns of the matrix
112* B otherwise. K must be at least zero.
113*
114* IOFFD (input) INTEGER
115* On entry, IOFFD specifies the position of the offdiagonal de-
116* limiting the upper and lower trapezoidal part of A as follows
117* (see the notes below):
118*
119* IOFFD = 0 specifies the main diagonal A( i, i ),
120* with i = 1 ... MIN( M, N ),
121* IOFFD > 0 specifies the subdiagonal A( i+IOFFD, i ),
122* with i = 1 ... MIN( M-IOFFD, N ),
123* IOFFD < 0 specifies the superdiagonal A( i, i-IOFFD ),
124* with i = 1 ... MIN( M, N+IOFFD ).
125*
126* ALPHA (input) pointer to CHAR
127* On entry, ALPHA specifies the scalar alpha.
128*
129* A (input) pointer to CHAR
130* On entry, A is an array of dimension (LDA,N) containing the m
131* by n matrix A. Only the trapezoidal part of A determined by
132* UPLO and IOFFD is referenced. When DIAG = 'U' or 'u', the
133* diagonal elements of A are not referenced either, but are
134* assumed to be unity.
135*
136* LDA (input) INTEGER
137* On entry, LDA specifies the leading dimension of the array A.
138* LDA must be at least max( 1, M ).
139*
140* B (input) pointer to CHAR
141* On entry, B is an array of dimension (LDB,Kb). Before entry,
142* with TRANS = 'N' or 'n', the array B must contain the k by n
143* matrix B corresponding to the columns of A. Otherwise, the
144* array B must contain the m by k matrix B corresponding to the
145* rows of A. When TRANS is 'N' or 'n', LDB is at least K, and
146* Kb is at least N. Otherwise, LDB is at least max(1,M), and Kb
147* is at least K.
148*
149* LDB (input) INTEGER
150* On entry, LDB specifies the leading dimension of the array B.
151* LDB must be at least K when TRANS is 'N' or 'n' and
152* max( 1, M ) otherwise.
153*
154* C (input/output) pointer to CHAR
155* On entry, C is an array of dimension (LDC,Kc). On exit, with
156* TRANS = 'N' or 'n', the array C contains the m by k matrix C
157* corresponding to the rows of A. Otherwise, the array C con-
158* tains the k by n matrix C corresponding to the columns of A.
159* When TRANS is 'N' or 'n', LDC is at least max( 1, M ), and Kc
160* is at least K. Otherwise, LDC is at least K, and Kc is at
161* least N. On exit, C is overwritten by the partial updated
162* matrix C.
163*
164* LDC (input) INTEGER
165* On entry, LDC specifies the leading dimension of the array C.
166* LDC must be at least max( 1, M ) when TRANS is 'N' or
167* 'n' and 1 otherwise.
168*
169* Notes
170* =====
171* N N
172* ---------------------------- -----------
173* | d | | |
174* M | d Upper | | Upper |
175* | Lower d | |d |
176* | d | M | d |
177* ---------------------------- | d |
178* | d |
179* IOFFD < 0 | Lower d |
180* | d|
181* N | |
182* ----------- -----------
183* | d Upper|
184* | d | IOFFD > 0
185* M | d |
186* | d| N
187* | Lower | ----------------------------
188* | | | Upper |
189* | | |d |
190* | | | d |
191* | | | d |
192* | | |Lower d |
193* ----------- ----------------------------
194*
195* -- Written on April 1, 1998 by
196* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
197*
198* ---------------------------------------------------------------------
199*/
200/*
201* .. Local Scalars ..
202*/
203 char * Aptr = NULL;
204/* ..
205* .. Executable Statements ..
206*
207*/
208 if( ( M <= 0 ) || ( N <= 0 ) ) return;
209
210 if( ( Mupcase( UPLO[0] ) == CLOWER ) || ( Mupcase( UPLO[0] ) == CUPPER ) )
211 {
212 Aptr = PB_Cmalloc( M * N * TYPE->size );
213 TYPE->Ftzpadcpy( C2F_CHAR( UPLO ), C2F_CHAR( DIAG ), &M, &N, &IOFFD,
214 A, &LDA, Aptr, &M );
215 if( Mupcase( SIDE[0] ) == CLEFT )
216 {
217 if( Mupcase( TRANS[0] ) == CNOTRAN )
218 {
219 TYPE->Fgemm( C2F_CHAR( TRANS ), C2F_CHAR( TRAN ), &M, &K, &N,
220 ALPHA, Aptr, &M, B, &LDB, TYPE->one, C, &LDC );
221 }
222 else
223 {
224 TYPE->Fgemm( C2F_CHAR( TRANS ), C2F_CHAR( NOTRAN ), &K, &N, &M,
225 ALPHA, B, &LDB, Aptr, &M, TYPE->one, C, &LDC );
226 }
227 }
228 else
229 {
230 if( Mupcase( TRANS[0] ) == CNOTRAN )
231 {
232 TYPE->Fgemm( C2F_CHAR( TRAN ), C2F_CHAR( TRANS ), &K, &N, &M,
233 ALPHA, B, &LDB, Aptr, &M, TYPE->one, C, &LDC );
234 }
235 else
236 {
237 TYPE->Fgemm( C2F_CHAR( NOTRAN ), C2F_CHAR( TRANS ), &M, &K, &N,
238 ALPHA, Aptr, &M, B, &LDB, TYPE->one, C, &LDC );
239 }
240 }
241 if( Aptr ) free( Aptr );
242 }
243 else
244 {
245 if( Mupcase( SIDE[0] ) == CLEFT )
246 {
247 if( Mupcase( TRANS[0] ) == CNOTRAN )
248 {
249 TYPE->Fgemm( C2F_CHAR( TRANS ), C2F_CHAR( TRAN ), &M, &K, &N,
250 ALPHA, A, &LDA, B, &LDB, TYPE->one, C, &LDC );
251 }
252 else
253 {
254 TYPE->Fgemm( C2F_CHAR( TRANS ), C2F_CHAR( NOTRAN ), &K, &N, &M,
255 ALPHA, B, &LDB, A, &LDA, TYPE->one, C, &LDC );
256 }
257 }
258 else
259 {
260 if( Mupcase( TRANS[0] ) == CNOTRAN )
261 {
262 TYPE->Fgemm( C2F_CHAR( TRAN ), C2F_CHAR( TRANS ), &K, &N, &M,
263 ALPHA, B, &LDB, A, &LDA, TYPE->one, C, &LDC );
264 }
265 else
266 {
267 TYPE->Fgemm( C2F_CHAR( NOTRAN ), C2F_CHAR( TRANS ), &M, &K, &N,
268 ALPHA, A, &LDA, B, &LDB, TYPE->one, C, &LDC );
269 }
270 }
271 }
272/*
273* End of PB_Ctztrmm
274*/
275}
#define Int
Definition Bconfig.h:22
#define C2F_CHAR(a)
Definition pblas.h:125
#define NOTRAN
Definition PBblas.h:44
#define CLEFT
Definition PBblas.h:29
#define TRAN
Definition PBblas.h:46
#define CUPPER
Definition PBblas.h:26
#define CNOTRAN
Definition PBblas.h:18
#define CLOWER
Definition PBblas.h:25
char * PB_Cmalloc()
void PB_Ctztrmm()
#define Mupcase(C)
Definition PBtools.h:83
#define TYPE
Definition clamov.c:7