ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Ctzasymv.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_Ctzasymv( 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_Ctzasymv( 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_Ctzasymv performs the matrix-vector operation
45 *
46 * y := abs( alpha )*abs( A )*abs( x )+ abs( y ),
47 *
48 * where alpha is a real scalar, y is a real vector, x is a vector and A
49 * 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 * 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, usiz;
176  AGEMV_T agemv;
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; usiz = TYPE->usiz;
186  one = TYPE->one; agemv = TYPE->Fagemv;
187  mn = MAX( 0, -IOFFD );
188  if( ( n1 = MIN( mn, N ) ) > 0 )
189  {
190  agemv( C2F_CHAR( NOTRAN ), &M, &n1, ALPHA, A, &LDA, XR, &LDXR, one, YC,
191  &ione );
192  agemv( C2F_CHAR( TRAN ), &M, &n1, ALPHA, A, &LDA, XC, &ione, one, YR,
193  &LDYR );
194  }
195  n1 = M - IOFFD;
196  if( ( n1 = MIN( n1, N ) - mn ) > 0 )
197  {
198  i1 = ( j1 = mn ) + IOFFD;
199  TYPE->Fasymv( C2F_CHAR( UPLO ), &n1, ALPHA, Mptr( A, i1, j1, LDA,
200  size ), &LDA, Mptr( XC, i1, 0, LDXC, size ), &ione, one,
201  Mptr( YC, i1, 0, LDYC, usiz ), &ione );
202  if( ( m1 = M - mn - n1 - IOFFD ) > 0 )
203  {
204  i1 += n1;
205  agemv( C2F_CHAR( NOTRAN ), &m1, &n1, ALPHA, Mptr( A, i1, j1, LDA,
206  size ), &LDA, Mptr( XR, 0, j1, LDXR, size ), &LDXR, one,
207  Mptr( YC, i1, 0, LDYC, usiz ), &ione );
208  agemv( C2F_CHAR( TRAN ), &m1, &n1, ALPHA, Mptr( A, i1, j1, LDA,
209  size ), &LDA, Mptr( XC, i1, 0, LDXC, size ), &ione, one,
210  Mptr( YR, 0, j1, LDYR, usiz ), &LDYR );
211  }
212  }
213  }
214  else if( Mupcase( UPLO[0] ) == CUPPER )
215  {
216  size = TYPE->size; usiz = TYPE->usiz;
217  one = TYPE->one; agemv = TYPE->Fagemv;
218  mn = M - IOFFD; mn = MIN( mn, N );
219  if( ( n1 = mn - MAX( 0, -IOFFD ) ) > 0 )
220  {
221  j1 = mn - n1;
222  if( ( m1 = MAX( 0, IOFFD ) ) > 0 )
223  {
224  agemv( C2F_CHAR( NOTRAN ), &m1, &n1, ALPHA, A, &LDA, XR, &LDXR, one,
225  YC, &ione );
226  agemv( C2F_CHAR( TRAN ), &m1, &n1, ALPHA, A, &LDA, XC, &ione, one,
227  YR, &LDYR );
228  }
229  TYPE->Fasymv( C2F_CHAR( UPLO ), &n1, ALPHA, Mptr( A, m1, j1, LDA,
230  size ), &LDA, Mptr( XC, m1, 0, LDXC, size ), &ione, one,
231  Mptr( YC, m1, 0, LDYC, usiz ), &ione );
232  }
233  if( ( n1 = N - MAX( 0, mn ) ) > 0 )
234  {
235  j1 = N - n1;
236  agemv( C2F_CHAR( NOTRAN ), &M, &n1, ALPHA, Mptr( A, 0, j1, LDA, size ),
237  &LDA, Mptr( XR, 0, j1, LDXR, size ), &LDXR, one, YC, &ione );
238  agemv( C2F_CHAR( TRAN ), &M, &n1, ALPHA, Mptr( A, 0, j1, LDA, size ),
239  &LDA, XC, &ione, one, Mptr( YR, 0, j1, LDYR, usiz ), &LDYR );
240  }
241  }
242  else
243  {
244  one = TYPE->one; agemv = TYPE->Fagemv;
245  agemv( C2F_CHAR( NOTRAN ), &M, &N, ALPHA, A, &LDA, XR, &LDXR, one, YC,
246  &ione );
247  agemv( C2F_CHAR( TRAN ), &M, &N, ALPHA, A, &LDA, XC, &ione, one, YR,
248  &LDYR );
249  }
250 /*
251 * End of PB_Ctzasymv
252 */
253 }
TYPE
#define TYPE
Definition: clamov.c:7
TRAN
#define TRAN
Definition: PBblas.h:46
AGEMV_T
F_VOID_FCT(* AGEMV_T)()
Definition: pblas.h:298
NOTRAN
#define NOTRAN
Definition: PBblas.h:44
CLOWER
#define CLOWER
Definition: PBblas.h:25
PB_Ctzasymv
void PB_Ctzasymv(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_Ctzasymv.c: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