ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Ctzsymv.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__
20 void PB_Ctzsymv( PBTYP_T * TYPE, char * SIDE, char * UPLO, int M, int N,
21  int K, int IOFFD, char * ALPHA, char * A, int LDA,
22  char * XC, int LDXC, char * XR, int LDXR, char * YC,
23  int LDYC, char * YR, int LDYR )
24 #else
25 void PB_Ctzsymv( TYPE, SIDE, UPLO, M, N, K, IOFFD, ALPHA, A, LDA, XC,
26  LDXC, XR, LDXR, YC, LDYC, YR, LDYR )
27 /*
28 * .. Scalar Arguments ..
29 */
30  char * SIDE, * UPLO;
31  int IOFFD, K, LDA, LDXC, LDXR, LDYC, LDYR, M, N;
32  char * ALPHA;
33 /*
34 * .. Array Arguments ..
35 */
36  PBTYP_T * TYPE;
37  char * A, * XC, * XR, * YC, * YR;
38 #endif
39 {
40 /*
41 * Purpose
42 * =======
43 *
44 * PB_Ctzsymv performs the matrix-vector operation
45 *
46 * y := alpha * A * x + y,
47 *
48 * where alpha is a scalar, x and y are n element vectors and A is an m
49 * 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 * SIDE (dummy) pointer to CHAR
59 * In this routine, SIDE is a dummy (unused) argument.
60 *
61 * UPLO (input) pointer to CHAR
62 * On entry, UPLO specifies which part of the matrix A is to be
63 * referenced as follows:
64 *
65 * UPLO = 'L' or 'l' the lower trapezoid of A is referenced,
66 *
67 * UPLO = 'U' or 'u' the upper trapezoid of A is referenced,
68 *
69 * otherwise all of the matrix A is referenced.
70 *
71 * M (input) INTEGER
72 * On entry, M specifies the number of rows of the matrix A. M
73 * must be at least zero.
74 *
75 * N (input) INTEGER
76 * On entry, N specifies the number of columns of the matrix A.
77 * N must be at least zero.
78 *
79 * K (dummy) INTEGER
80 * In this routine, K is a dummy (unused) argument.
81 *
82 * IOFFD (input) INTEGER
83 * On entry, IOFFD specifies the position of the offdiagonal de-
84 * limiting the upper and lower trapezoidal part of A as follows
85 * (see the notes below):
86 *
87 * IOFFD = 0 specifies the main diagonal A( i, i ),
88 * with i = 1 ... MIN( M, N ),
89 * IOFFD > 0 specifies the subdiagonal A( i+IOFFD, i ),
90 * with i = 1 ... MIN( M-IOFFD, N ),
91 * IOFFD < 0 specifies the superdiagonal A( i, i-IOFFD ),
92 * with i = 1 ... MIN( M, N+IOFFD ).
93 *
94 * ALPHA (input) pointer to CHAR
95 * On entry, ALPHA specifies the scalar alpha.
96 *
97 * A (input) pointer to CHAR
98 * On entry, A is an array of dimension (LDA,N) containing the m
99 * by n matrix A. Only the trapezoidal part of A determined by
100 * UPLO and IOFFD is referenced.
101 *
102 * LDA (input) INTEGER
103 * On entry, LDA specifies the leading dimension of the array A.
104 * LDA must be at least max( 1, M ).
105 *
106 * XC (input) pointer to CHAR
107 * On entry, XC is an array of dimension (LDXC,1) containing the
108 * m by 1 vector XC.
109 *
110 * LDXC (input) INTEGER
111 * On entry, LDXC specifies the leading dimension of the array
112 * XC. LDXC must be at least max( 1, M ).
113 *
114 * XR (input) pointer to CHAR
115 * On entry, XR is an array of dimension (LDXR,N) containing the
116 * 1 by n vector XR.
117 *
118 * LDXR (input) INTEGER
119 * On entry, LDXR specifies the leading dimension of the array
120 * XR. LDXR must be at least 1.
121 *
122 * YC (input/output) pointer to CHAR
123 * On entry, YC is an array of dimension (LDYC,1) containing the
124 * m by 1 vector YC. On exit, YC is overwritten by the partially
125 * updated vector y.
126 *
127 * LDYC (input) INTEGER
128 * On entry, LDYC specifies the leading dimension of the array
129 * YC. LDYC must be at least max( 1, M ).
130 *
131 * YR (input/output) pointer to CHAR
132 * On entry, YR is an array of dimension (LDYR,N) containing the
133 * 1 by n vector YR. On exit, YR is overwritten by the partially
134 * updated vector y.
135 *
136 * LDYR (input) INTEGER
137 * On entry, LDYR specifies the leading dimension of the array
138 * YR. LDYR must be at least 1.
139 *
140 * Notes
141 * =====
142 * N N
143 * ---------------------------- -----------
144 * | d | | |
145 * M | d Upper | | Upper |
146 * | Lower d | |d |
147 * | d | M | d |
148 * ---------------------------- | d |
149 * | d |
150 * IOFFD < 0 | Lower d |
151 * | d|
152 * N | |
153 * ----------- -----------
154 * | d Upper|
155 * | d | IOFFD > 0
156 * M | d |
157 * | d| N
158 * | Lower | ----------------------------
159 * | | | Upper |
160 * | | |d |
161 * | | | d |
162 * | | | d |
163 * | | |Lower d |
164 * ----------- ----------------------------
165 *
166 * -- Written on April 1, 1998 by
167 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
168 *
169 * ---------------------------------------------------------------------
170 */
171 /*
172 * .. Local Scalars ..
173 */
174  char * one;
175  int i1, ione=1, j1, m1, mn, n1, size;
176  GEMV_T gemv;
177 /* ..
178 * .. Executable Statements ..
179 *
180 */
181  if( ( M <= 0 ) || ( N <= 0 ) ) return;
182 
183  if( Mupcase( UPLO[0] ) == CLOWER )
184  {
185  size = TYPE->size; one = TYPE->one; gemv = TYPE->Fgemv;
186  mn = MAX( 0, -IOFFD );
187  if( ( n1 = MIN( mn, N ) ) > 0 )
188  {
189  gemv( C2F_CHAR( NOTRAN ), &M, &n1, ALPHA, A, &LDA, XR, &LDXR, one, YC,
190  &ione );
191  gemv( C2F_CHAR( TRAN ), &M, &n1, ALPHA, A, &LDA, XC, &ione, one, YR,
192  &LDYR );
193  }
194  n1 = M - IOFFD;
195  if( ( n1 = MIN( n1, N ) - mn ) > 0 )
196  {
197  i1 = ( j1 = mn ) + IOFFD;
198  TYPE->Fsymv( C2F_CHAR( UPLO ), &n1, ALPHA, Mptr( A, i1, j1, LDA,
199  size ), &LDA, Mptr( XC, i1, 0, LDXC, size ), &ione, one,
200  Mptr( YC, i1, 0, LDYC, size ), &ione );
201  if( ( m1 = M - mn - n1 - IOFFD ) > 0 )
202  {
203  i1 += n1;
204  gemv( C2F_CHAR( NOTRAN ), &m1, &n1, ALPHA, Mptr( A, i1, j1, LDA,
205  size ), &LDA, Mptr( XR, 0, j1, LDXR, size ), &LDXR, one,
206  Mptr( YC, i1, 0, LDYC, size ), &ione );
207  gemv( C2F_CHAR( TRAN ), &m1, &n1, ALPHA, Mptr( A, i1, j1, LDA,
208  size ), &LDA, Mptr( XC, i1, 0, LDXC, size ), &ione, one,
209  Mptr( YR, 0, j1, LDYR, size ), &LDYR );
210  }
211  }
212  }
213  else if( Mupcase( UPLO[0] ) == CUPPER )
214  {
215  size = TYPE->size; one = TYPE->one; gemv = TYPE->Fgemv;
216  mn = M - IOFFD; mn = MIN( mn, N );
217  if( ( n1 = mn - MAX( 0, -IOFFD ) ) > 0 )
218  {
219  j1 = mn - n1;
220  if( ( m1 = MAX( 0, IOFFD ) ) > 0 )
221  {
222  gemv( C2F_CHAR( NOTRAN ), &m1, &n1, ALPHA, A, &LDA, XR, &LDXR, one,
223  YC, &ione );
224  gemv( C2F_CHAR( TRAN ), &m1, &n1, ALPHA, A, &LDA, XC, &ione, one,
225  YR, &LDYR );
226  }
227  TYPE->Fsymv( C2F_CHAR( UPLO ), &n1, ALPHA, Mptr( A, m1, j1, LDA,
228  size ), &LDA, Mptr( XC, m1, 0, LDXC, size ), &ione, one,
229  Mptr( YC, m1, 0, LDYC, size ), &ione );
230  }
231  if( ( n1 = N - MAX( 0, mn ) ) > 0 )
232  {
233  j1 = N - n1;
234  gemv( C2F_CHAR( NOTRAN ), &M, &n1, ALPHA, Mptr( A, 0, j1, LDA, size ),
235  &LDA, Mptr( XR, 0, j1, LDXR, size ), &LDXR, one, YC, &ione );
236  gemv( C2F_CHAR( TRAN ), &M, &n1, ALPHA, Mptr( A, 0, j1, LDA, size ),
237  &LDA, XC, &ione, one, Mptr( YR, 0, j1, LDYR, size ), &LDYR );
238  }
239  }
240  else
241  {
242  one = TYPE->one; gemv = TYPE->Fgemv;
243  gemv( C2F_CHAR( NOTRAN ), &M, &N, ALPHA, A, &LDA, XR, &LDXR, one, YC,
244  &ione );
245  gemv( C2F_CHAR( TRAN ), &M, &N, ALPHA, A, &LDA, XC, &ione, one, YR,
246  &LDYR );
247  }
248 /*
249 * End of PB_Ctzsymv
250 */
251 }
PB_Ctzsymv
void PB_Ctzsymv(PBTYP_T *TYPE, char *SIDE, char *UPLO, int M, int N, int K, int IOFFD, char *ALPHA, char *A, int LDA, char *XC, int LDXC, char *XR, int LDXR, char *YC, int LDYC, char *YR, int LDYR)
Definition: PB_Ctzsymv.c:25
TYPE
#define TYPE
Definition: clamov.c:7
GEMV_T
F_VOID_FCT(* GEMV_T)()
Definition: pblas.h:297
TRAN
#define TRAN
Definition: PBblas.h:46
NOTRAN
#define NOTRAN
Definition: PBblas.h:44
CLOWER
#define CLOWER
Definition: PBblas.h:25
MIN
#define MIN(a_, b_)
Definition: PBtools.h:76
C2F_CHAR
#define C2F_CHAR(a)
Definition: pblas.h:121
MAX
#define MAX(a_, b_)
Definition: PBtools.h:77
PBTYP_T
Definition: pblas.h:325
Mupcase
#define Mupcase(C)
Definition: PBtools.h:83
CUPPER
#define CUPPER
Definition: PBblas.h:26
Mptr
#define Mptr(a_, i_, j_, lda_, siz_)
Definition: PBtools.h:132