SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
PB_Ctzsyrk.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_Ctzsyrk( PBTYP_T * TYPE, char * UPLO, Int M, Int N, Int K,
21 Int IOFFD, char * ALPHA, char * AC, Int LDAC,
22 char * AR, Int LDAR, char * C, Int LDC )
23#else
24void PB_Ctzsyrk( TYPE, UPLO, M, N, K, IOFFD, ALPHA, AC, LDAC, AR, LDAR,
25 C, LDC )
26/*
27* .. Scalar Arguments ..
28*/
29 char * UPLO;
30 Int IOFFD, K, LDAC, LDAR, LDC, M, N;
31 char * ALPHA;
32/*
33* .. Array Arguments ..
34*/
35 PBTYP_T * TYPE;
36 char * AC, * AR, * C;
37#endif
38{
39/*
40* Purpose
41* =======
42*
43* PB_Ctzsyrk performs the trapezoidal symmetric or Hermitian rank k
44* operation:
45*
46* C := alpha * AC * AR + C,
47*
48* where alpha is a scalar, AC is an m by k matrix, AR is an k by n ma-
49* trix and C is an m by n trapezoidal symmetric or Hermitian matrix.
50*
51* Arguments
52* =========
53*
54* TYPE (local input) pointer to a PBTYP_T structure
55* On entry, TYPE is a pointer to a structure of type PBTYP_T,
56* that contains type information (See pblas.h).
57*
58* UPLO (input) pointer to CHAR
59* On entry, UPLO specifies which part of the matrix C is to be
60* referenced as follows:
61*
62* UPLO = 'L' or 'l' the lower trapezoid of C is referenced,
63*
64* UPLO = 'U' or 'u' the upper trapezoid of C is referenced,
65*
66* otherwise all of the matrix C is referenced.
67*
68* M (input) INTEGER
69* On entry, M specifies the number of rows of the matrix C. M
70* must be at least zero.
71*
72* N (input) INTEGER
73* On entry, N specifies the number of columns of the matrix C.
74* N must be at least zero.
75*
76* K (input) INTEGER
77* On entry, K specifies the number of columns of the matrix AC,
78* and the number of rows of the matrix AR. K must be at least
79* zero.
80*
81* IOFFD (input) INTEGER
82* On entry, IOFFD specifies the position of the offdiagonal de-
83* limiting the upper and lower trapezoidal part of C as follows
84* (see the notes below):
85*
86* IOFFD = 0 specifies the main diagonal C( i, i ),
87* with i = 1 ... MIN( M, N ),
88* IOFFD > 0 specifies the subdiagonal C( i+IOFFD, i ),
89* with i = 1 ... MIN( M-IOFFD, N ),
90* IOFFD < 0 specifies the superdiagonal C( i, i-IOFFD ),
91* with i = 1 ... MIN( M, N+IOFFD ).
92*
93* ALPHA (input) pointer to CHAR
94* On entry, ALPHA specifies the scalar alpha.
95*
96* AC (input) pointer to CHAR
97* On entry, AC is an array of dimension (LDAC,K) containing the
98* m by k matrix AC.
99*
100* LDAC (input) INTEGER
101* On entry, LDAC specifies the leading dimension of the array
102* AC. LDAC must be at least max( 1, M ).
103*
104* AR (input) pointer to CHAR
105* On entry, AR is an array of dimension (LDAR,N) containing the
106* k by n matrix AR.
107*
108* LDAR (input) INTEGER
109* On entry, LDAR specifies the leading dimension of the array
110* AR. LDAR must be at least K.
111*
112* C (input/output) pointer to CHAR
113* On entry, C is an array of dimension (LDC,N) containing the m
114* by n matrix A. Only the trapezoidal part of C determined by
115* UPLO and IOFFD is updated.
116*
117* LDC (input) INTEGER
118* On entry, LDC specifies the leading dimension of the array C.
119* LDC must be at least max( 1, M ).
120*
121* Notes
122* =====
123* N N
124* ---------------------------- -----------
125* | d | | |
126* M | d Upper | | Upper |
127* | Lower d | |d |
128* | d | M | d |
129* ---------------------------- | d |
130* | d |
131* IOFFD < 0 | Lower d |
132* | d|
133* N | |
134* ----------- -----------
135* | d Upper|
136* | d | IOFFD > 0
137* M | d |
138* | d| N
139* | Lower | ----------------------------
140* | | | Upper |
141* | | |d |
142* | | | d |
143* | | | d |
144* | | |Lower d |
145* ----------- ----------------------------
146*
147* -- Written on April 1, 1998 by
148* Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
149*
150* ---------------------------------------------------------------------
151*/
152/*
153* .. Local Scalars ..
154*/
155 char * one;
156 Int i1, j1, m1, mn, n1, size;
157 GEMM_T gemm;
158/* ..
159* .. Executable Statements ..
160*
161*/
162 if( ( M <= 0 ) || ( N <= 0 ) ) return;
163
164 if( Mupcase( UPLO[0] ) == CLOWER )
165 {
166 size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm;
167 mn = MAX( 0, -IOFFD );
168 if( ( n1 = MIN( mn, N ) ) > 0 )
169 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC,
170 &LDAC, AR, &LDAR, one, C, &LDC );
171 if( ( n1 = MIN( M-IOFFD, N ) - mn ) > 0 )
172 {
173 i1 = ( j1 = mn ) + IOFFD;
174 TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA,
175 Mptr( AC, i1, 0, LDAC, size ), &LDAC, one, Mptr( C, i1,
176 j1, LDC, size ), &LDC );
177 if( ( m1 = M - mn - n1 - IOFFD ) > 0 )
178 {
179 i1 += n1;
180 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA,
181 Mptr( AC, i1, 0, LDAC, size ), &LDAC, Mptr( AR, 0, j1, LDAR,
182 size ), &LDAR, one, Mptr( C, i1, j1, LDC, size ), &LDC );
183 }
184 }
185 }
186 else if( Mupcase( UPLO[0] ) == CUPPER )
187 {
188 size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm;
189 mn = MIN( M - IOFFD, N );
190 if( ( n1 = mn - MAX( 0, -IOFFD ) ) > 0 )
191 {
192 j1 = mn - n1;
193 if( ( m1 = MAX( 0, IOFFD ) ) > 0 )
194 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA,
195 AC, &LDAC, AR, &LDAR, one, C, &LDC );
196 TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA,
197 Mptr( AC, m1, 0, LDAC, size ), &LDAC, one, Mptr( C, m1,
198 j1, LDC, size ), &LDC );
199 }
200 if( ( n1 = N - MAX( 0, mn ) ) > 0 )
201 {
202 j1 = N - n1;
203 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC,
204 &LDAC, Mptr( AR, 0, j1, LDAR, size ), &LDAR, one, Mptr( C, 0, j1,
205 LDC, size ), &LDC );
206 }
207 }
208 else
209 {
210 TYPE->Fgemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &N, &K, ALPHA,
211 AC, &LDAC, AR, &LDAR, TYPE->one, C, &LDC );
212 }
213/*
214* End of PB_Ctzsyrk
215*/
216}
#define Int
Definition Bconfig.h:22
F_VOID_FCT(* GEMM_T)()
Definition pblas.h:317
#define C2F_CHAR(a)
Definition pblas.h:125
#define NOTRAN
Definition PBblas.h:44
#define CUPPER
Definition PBblas.h:26
#define CLOWER
Definition PBblas.h:25
#define MAX(a_, b_)
Definition PBtools.h:77
#define MIN(a_, b_)
Definition PBtools.h:76
#define Mptr(a_, i_, j_, lda_, siz_)
Definition PBtools.h:132
void PB_Ctzsyrk()
#define Mupcase(C)
Definition PBtools.h:83
#define TYPE
Definition clamov.c:7
Int size
Definition pblas.h:333