File: PB_Ctzsyrk.c

package info (click to toggle)
scalapack 1.8.0-12
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,712 kB
  • ctags: 29,423
  • sloc: fortran: 288,069; ansic: 64,035; makefile: 1,966
file content (216 lines) | stat: -rw-r--r-- 7,969 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/* ---------------------------------------------------------------------
*
*  -- PBLAS auxiliary routine (version 2.0) --
*     University of Tennessee, Knoxville, Oak Ridge National Laboratory,
*     and University of California, Berkeley.
*     April 1, 1998
*
*  ---------------------------------------------------------------------
*/
/*
*  Include files
*/
#include "../pblas.h"
#include "../PBpblas.h"
#include "../PBtools.h"
#include "../PBblacs.h"
#include "../PBblas.h"

#ifdef __STDC__
void PB_Ctzsyrk( PBTYP_T * TYPE, char * UPLO, int M, int N, int K,
                 int IOFFD, char * ALPHA, char * AC, int LDAC,
                 char * AR, int LDAR, char * C, int LDC )
#else
void PB_Ctzsyrk( TYPE, UPLO, M, N, K, IOFFD, ALPHA, AC, LDAC, AR, LDAR,
                 C, LDC )
/*
*  .. Scalar Arguments ..
*/
   char           * UPLO;
   int            IOFFD, K, LDAC, LDAR, LDC, M, N;
   char           * ALPHA;
/*
*  .. Array Arguments ..
*/
   PBTYP_T        * TYPE;
   char           * AC, * AR, * C;
#endif
{
/*
*  Purpose
*  =======
*
*  PB_Ctzsyrk  performs  the  trapezoidal  symmetric or Hermitian rank k
*  operation:
*
*     C := alpha * AC * AR + C,
*
*  where alpha is a scalar, AC is an m by k matrix, AR  is an k by n ma-
*  trix and C is an m by n trapezoidal symmetric or Hermitian matrix.
*
*  Arguments
*  =========
*
*  TYPE    (local input) pointer to a PBTYP_T structure
*          On entry,  TYPE  is a pointer to a structure of type PBTYP_T,
*          that contains type information (See pblas.h).
*
*  UPLO    (input) pointer to CHAR
*          On entry, UPLO  specifies which part of the matrix C is to be
*          referenced as follows:
*
*             UPLO = 'L' or 'l' the lower trapezoid of C is referenced,
*
*             UPLO = 'U' or 'u' the upper trapezoid of C is referenced,
*
*             otherwise         all of the matrix C is referenced.
*
*  M       (input) INTEGER
*          On entry,  M  specifies the number of rows of the matrix C. M
*          must be at least zero.
*
*  N       (input) INTEGER
*          On entry, N  specifies the number of columns of the matrix C.
*          N must be at least zero.
*
*  K       (input) INTEGER
*          On entry, K specifies the number of columns of the matrix AC,
*          and the number of rows of the matrix AR.  K  must be at least
*          zero.
*
*  IOFFD   (input) INTEGER
*          On entry, IOFFD specifies the position of the offdiagonal de-
*          limiting the upper and lower trapezoidal part of C as follows
*          (see the notes below):
*
*             IOFFD = 0  specifies the main diagonal C( i, i ),
*                        with i = 1 ... MIN( M, N ),
*             IOFFD > 0  specifies the subdiagonal   C( i+IOFFD, i ),
*                        with i = 1 ... MIN( M-IOFFD, N ),
*             IOFFD < 0  specifies the superdiagonal C( i, i-IOFFD ),
*                        with i = 1 ... MIN( M, N+IOFFD ).
*
*  ALPHA   (input) pointer to CHAR
*          On entry, ALPHA specifies the scalar alpha.
*
*  AC      (input) pointer to CHAR
*          On entry, AC is an array of dimension (LDAC,K) containing the
*          m by k matrix AC.
*
*  LDAC    (input) INTEGER
*          On entry,  LDAC  specifies the leading dimension of the array
*          AC. LDAC must be at least max( 1, M ).
*
*  AR      (input) pointer to CHAR
*          On entry, AR is an array of dimension (LDAR,N) containing the
*          k by n matrix AR.
*
*  LDAR    (input) INTEGER
*          On entry,  LDAR  specifies the leading dimension of the array
*          AR. LDAR must be at least K.
*
*  C       (input/output) pointer to CHAR
*          On entry, C is an array of dimension (LDC,N) containing the m
*          by n matrix A. Only the trapezoidal part of  C  determined by
*          UPLO and IOFFD is updated.
*
*  LDC     (input) INTEGER
*          On entry, LDC specifies the leading dimension of the array C.
*          LDC must be at least max( 1, M ).
*
*  Notes
*  =====
*                           N                                    N
*             ----------------------------                  -----------
*            |       d                    |                |           |
*          M |         d         Upper    |                |    Upper  |
*            | Lower     d                |                |d          |
*            |             d              |              M |  d        |
*             ----------------------------                 |    d      |
*                                                          |      d    |
*               IOFFD < 0                                  | Lower  d  |
*                                                          |          d|
*                  N                                       |           |
*             -----------                                   -----------
*            |    d Upper|
*            |      d    |                                   IOFFD > 0
*          M |        d  |
*            |          d|                              N
*            |  Lower    |                 ----------------------------
*            |           |                |          Upper             |
*            |           |                |d                           |
*            |           |                |  d                         |
*            |           |                |    d                       |
*            |           |                |Lower d                     |
*             -----------                  ----------------------------
*
*  -- Written on April 1, 1998 by
*     Antoine Petitet, University of Tennessee, Knoxville 37996, USA.
*
*  ---------------------------------------------------------------------
*/
/*
*  .. Local Scalars ..
*/
   char           * one;
   int            i1, j1, m1, mn, n1, size;
   GEMM_T         gemm;
/* ..
*  .. Executable Statements ..
*
*/
   if( ( M <= 0 ) || ( N <= 0 ) ) return;

   if( Mupcase( UPLO[0] ) == CLOWER )
   {
      size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm;
      mn   = MAX( 0, -IOFFD );
      if( ( n1 = MIN( mn, N ) ) > 0 )
         gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC,
               &LDAC, AR, &LDAR, one, C, &LDC );
      if( ( n1 = MIN( M-IOFFD, N ) - mn ) > 0 )
      {
         i1 = ( j1 = mn ) + IOFFD;
         TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA,
                      Mptr( AC, i1, 0, LDAC, size ), &LDAC, one, Mptr( C, i1,
                      j1, LDC, size ), &LDC );
         if( ( m1 = M - mn - n1 - IOFFD ) > 0 )
         {
            i1 += n1;
            gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA,
                  Mptr( AC, i1, 0, LDAC, size ), &LDAC, Mptr( AR, 0, j1, LDAR,
                  size ), &LDAR, one, Mptr( C, i1, j1, LDC, size ), &LDC );
         }
      }
   }
   else if( Mupcase( UPLO[0] ) == CUPPER )
   {
      size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm;
      mn   = MIN( M - IOFFD, N );
      if( ( n1 = mn - MAX( 0, -IOFFD ) ) > 0 )
      {
         j1 = mn - n1;
         if( ( m1 = MAX( 0, IOFFD ) ) > 0 )
            gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA,
                  AC, &LDAC, AR, &LDAR, one, C, &LDC );
         TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA,
                      Mptr( AC, m1, 0, LDAC, size ), &LDAC, one, Mptr( C, m1,
                      j1, LDC, size ), &LDC );
      }
      if( ( n1 = N - MAX( 0, mn ) ) > 0 )
      {
         j1 = N - n1;
         gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC,
               &LDAC, Mptr( AR, 0, j1, LDAR, size ), &LDAR, one, Mptr( C, 0, j1,
               LDC, size ), &LDC );
      }
   }
   else
   {
      TYPE->Fgemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &N, &K, ALPHA,
                   AC, &LDAC, AR, &LDAR, TYPE->one, C, &LDC );
   }
/*
*  End of PB_Ctzsyrk
*/
}