ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
PB_Ctzatrmv.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_Ctzatrmv( PBTYP_T * TYPE, char * SIDE, char * UPLO,
21  char * TRANS, char * DIAG, int M, int N, int K,
22  int IOFFD, char * ALPHA, char * A, int LDA, char * X,
23  int LDX, char * Y, int LDY )
24 #else
25 void PB_Ctzatrmv( TYPE, SIDE, UPLO, TRANS, DIAG, M, N, K, IOFFD, ALPHA,
26  A, LDA, X, LDX, Y, LDY )
27 /*
28 * .. Scalar Arguments ..
29 */
30  char * SIDE, * UPLO, * TRANS, * DIAG;
31  int IOFFD, K, LDA, LDX, LDY, M, N;
32  char * ALPHA;
33 /*
34 * .. Array Arguments ..
35 */
36  char * A, * X, * Y;
37  PBTYP_T * TYPE;
38 #endif
39 {
40 /*
41 * Purpose
42 * =======
43 *
44 * PB_Ctzatrmv performs the matrix-vector operation
45 *
46 * y := abs( alpha )*abs( A )*abs( x )+ abs( y ),
47 *
48 * or
49 *
50 * y := abs( alpha )*abs( A' )*abs( x ) + abs( y ),
51 *
52 * or
53 *
54 * y := abs( alpha )*abs( conjg( A' ) )*abs( x ) + abs( y ),
55 *
56 * where alpha is a real scalar, y is a real vector, x is a vector and A
57 * is an m by n trapezoidal triangular matrix.
58 *
59 * Arguments
60 * =========
61 *
62 * TYPE (local input) pointer to a PBTYP_T structure
63 * On entry, TYPE is a pointer to a structure of type PBTYP_T,
64 * that contains type information (See pblas.h).
65 *
66 * SIDE (dummy) pointer to CHAR
67 * In this routine, SIDE is a dummy (unused) argument.
68 *
69 * UPLO (input) pointer to CHAR
70 * On entry, UPLO specifies which part of the matrix A is to be
71 * referenced as follows:
72 *
73 * UPLO = 'L' or 'l' the lower trapezoid of A is referenced,
74 *
75 * UPLO = 'U' or 'u' the upper trapezoid of A is referenced,
76 *
77 * otherwise all of the matrix A is referenced.
78 *
79 * TRANS (input) pointer to CHAR
80 * On entry, TRANS specifies the operation to be performed as
81 * follows:
82 *
83 * TRANS = 'N' or 'n':
84 * y := abs( alpha )*abs( A )*abs( x )+ abs( beta*y ),
85 *
86 * TRANS = 'T' or 't':
87 * y := abs( alpha )*abs( A' )*abs( x ) + abs( beta*y ),
88 *
89 * TRANS = 'C' or 'c':
90 * y := abs( alpha )*abs( A' )*abs( x ) + abs( y ) or
91 * y := abs( alpha )*abs( conjg(A') )*abs( x ) + abs( y ).
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 (dummy) INTEGER
110 * In this routine, K is a dummy (unused) argument.
111 *
112 * IOFFD (input) INTEGER
113 * On entry, IOFFD specifies the position of the offdiagonal de-
114 * limiting the upper and lower trapezoidal part of A as follows
115 * (see the notes below):
116 *
117 * IOFFD = 0 specifies the main diagonal A( i, i ),
118 * with i = 1 ... MIN( M, N ),
119 * IOFFD > 0 specifies the subdiagonal A( i+IOFFD, i ),
120 * with i = 1 ... MIN( M-IOFFD, N ),
121 * IOFFD < 0 specifies the superdiagonal A( i, i-IOFFD ),
122 * with i = 1 ... MIN( M, N+IOFFD ).
123 *
124 * ALPHA (input) pointer to CHAR
125 * On entry, ALPHA specifies the scalar alpha.
126 *
127 * A (input) pointer to CHAR
128 * On entry, A is an array of dimension (LDA,N) containing the m
129 * by n matrix A. Only the trapezoidal part of A determined by
130 * UPLO and IOFFD is referenced. When DIAG = 'U' or 'u', the
131 * diagonal elements of A are not referenced either, but are
132 * assumed to be unity.
133 *
134 * LDA (input) INTEGER
135 * On entry, LDA specifies the leading dimension of the array A.
136 * LDA must be at least max( 1, M ).
137 *
138 * X (input) pointer to CHAR
139 * On entry, X is an array of dimension (LDX,Kx). Before entry,
140 * with TRANS = 'N' or 'n', the array X must contain the n ele-
141 * ment vector x corresponding to the columns of A. Otherwise,
142 * the array X must contain the m element vector x corresponding
143 * to the rows of A. When TRANS is 'N' or 'n', LDX is at least
144 * 1, and Kx is at least N. Otherwise, LDX is at least max(1,M),
145 * and Kx is at least 1.
146 *
147 * LDX (input) INTEGER
148 * On entry, LDX specifies the leading dimension of the array X.
149 * LDX must be at least 1 when TRANS is 'N' or 'n' and
150 * max( 1, M ) otherwise.
151 *
152 * Y (input/output) pointer to CHAR
153 * On entry, Y is an array of dimension (LDY,Ky). On exit, with
154 * TRANS = 'N' or 'n', the array Y contains the m element vector
155 * y corresponding to the rows of A. Otherwise, the array Y con-
156 * tains the n element vector y corresponding to the columns of
157 * A. When TRANS is 'N' or 'n', LDY is at least max( 1, M ), and
158 * Ky is at least 1. Otherwise, LDY is at least 1, and Ky is at
159 * least N. On exit, Y is overwritten by the partial updated
160 * vector y.
161 *
162 * LDY (input) INTEGER
163 * On entry, LDY specifies the leading dimension of the array Y.
164 * LDY must be at least max( 1, M ) when TRANS is 'N' or
165 * 'n' and 1 otherwise.
166 *
167 * Notes
168 * =====
169 * N N
170 * ---------------------------- -----------
171 * | d | | |
172 * M | d Upper | | Upper |
173 * | Lower d | |d |
174 * | d | M | d |
175 * ---------------------------- | d |
176 * | d |
177 * IOFFD < 0 | Lower d |
178 * | d|
179 * N | |
180 * ----------- -----------
181 * | d Upper|
182 * | d | IOFFD > 0
183 * M | d |
184 * | d| N
185 * | Lower | ----------------------------
186 * | | | Upper |
187 * | | |d |
188 * | | | d |
189 * | | | d |
190 * | | |Lower d |
191 * ----------- ----------------------------
192 *
193 * -- Written on April 1, 1998 by
194 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
195 *
196 * ---------------------------------------------------------------------
197 */
198 /*
199 * .. Local Scalars ..
200 */
201  int ione = 1;
202  char * Aptr = NULL;
203 /* ..
204 * .. Executable Statements ..
205 *
206 */
207  if( ( M <= 0 ) || ( N <= 0 ) ) return;
208 
209  if( ( Mupcase( UPLO[0] ) == CLOWER ) || ( Mupcase( UPLO[0] ) == CUPPER ) )
210  {
211  Aptr = PB_Cmalloc( M * N * TYPE->size );
212  TYPE->Ftzpadcpy( C2F_CHAR( UPLO ), C2F_CHAR( DIAG ), &M, &N, &IOFFD,
213  A, &LDA, Aptr, &M );
214  if( Mupcase( TRANS[0] ) == CNOTRAN )
215  {
216  TYPE->Fagemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, Aptr, &M, X, &LDX,
217  TYPE->one, Y, &ione );
218  }
219  else
220  {
221  TYPE->Fagemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, Aptr, &M, X, &ione,
222  TYPE->one, Y, &LDY );
223  }
224  if( Aptr ) free( Aptr );
225  }
226  else
227  {
228  if( Mupcase( TRANS[0] ) == CNOTRAN )
229  {
230  TYPE->Fagemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, A, &LDA, X, &LDX,
231  TYPE->one, Y, &ione );
232  }
233  else
234  {
235  TYPE->Fagemv( C2F_CHAR( TRANS ), &M, &N, ALPHA, A, &LDA, X, &ione,
236  TYPE->one, Y, &LDY );
237  }
238  }
239 /*
240 * End of PB_Ctzatrmv
241 */
242 }
TYPE
#define TYPE
Definition: clamov.c:7
PB_Ctzatrmv
void PB_Ctzatrmv(PBTYP_T *TYPE, char *SIDE, char *UPLO, char *TRANS, char *DIAG, int M, int N, int K, int IOFFD, char *ALPHA, char *A, int LDA, char *X, int LDX, char *Y, int LDY)
Definition: PB_Ctzatrmv.c:25
CLOWER
#define CLOWER
Definition: PBblas.h:25
CNOTRAN
#define CNOTRAN
Definition: PBblas.h:18
PB_Cmalloc
char * PB_Cmalloc()
C2F_CHAR
#define C2F_CHAR(a)
Definition: pblas.h:121
PBTYP_T
Definition: pblas.h:325
Mupcase
#define Mupcase(C)
Definition: PBtools.h:83
CUPPER
#define CUPPER
Definition: PBblas.h:26