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