|
ScaLAPACK
2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
|
00001 /* --------------------------------------------------------------------- 00002 * 00003 * -- PBLAS auxiliary routine (version 2.0) -- 00004 * University of Tennessee, Knoxville, Oak Ridge National Laboratory, 00005 * and University of California, Berkeley. 00006 * April 1, 1998 00007 * 00008 * --------------------------------------------------------------------- 00009 */ 00010 /* 00011 * Include files 00012 */ 00013 #include "../pblas.h" 00014 #include "../PBpblas.h" 00015 #include "../PBtools.h" 00016 #include "../PBblacs.h" 00017 #include "../PBblas.h" 00018 00019 #ifdef __STDC__ 00020 void PB_Ctzsyrk( PBTYP_T * TYPE, char * UPLO, int M, int N, int K, 00021 int IOFFD, char * ALPHA, char * AC, int LDAC, 00022 char * AR, int LDAR, char * C, int LDC ) 00023 #else 00024 void PB_Ctzsyrk( TYPE, UPLO, M, N, K, IOFFD, ALPHA, AC, LDAC, AR, LDAR, 00025 C, LDC ) 00026 /* 00027 * .. Scalar Arguments .. 00028 */ 00029 char * UPLO; 00030 int IOFFD, K, LDAC, LDAR, LDC, M, N; 00031 char * ALPHA; 00032 /* 00033 * .. Array Arguments .. 00034 */ 00035 PBTYP_T * TYPE; 00036 char * AC, * AR, * C; 00037 #endif 00038 { 00039 /* 00040 * Purpose 00041 * ======= 00042 * 00043 * PB_Ctzsyrk performs the trapezoidal symmetric or Hermitian rank k 00044 * operation: 00045 * 00046 * C := alpha * AC * AR + C, 00047 * 00048 * where alpha is a scalar, AC is an m by k matrix, AR is an k by n ma- 00049 * trix and C is an m by n trapezoidal symmetric or Hermitian matrix. 00050 * 00051 * Arguments 00052 * ========= 00053 * 00054 * TYPE (local input) pointer to a PBTYP_T structure 00055 * On entry, TYPE is a pointer to a structure of type PBTYP_T, 00056 * that contains type information (See pblas.h). 00057 * 00058 * UPLO (input) pointer to CHAR 00059 * On entry, UPLO specifies which part of the matrix C is to be 00060 * referenced as follows: 00061 * 00062 * UPLO = 'L' or 'l' the lower trapezoid of C is referenced, 00063 * 00064 * UPLO = 'U' or 'u' the upper trapezoid of C is referenced, 00065 * 00066 * otherwise all of the matrix C is referenced. 00067 * 00068 * M (input) INTEGER 00069 * On entry, M specifies the number of rows of the matrix C. M 00070 * must be at least zero. 00071 * 00072 * N (input) INTEGER 00073 * On entry, N specifies the number of columns of the matrix C. 00074 * N must be at least zero. 00075 * 00076 * K (input) INTEGER 00077 * On entry, K specifies the number of columns of the matrix AC, 00078 * and the number of rows of the matrix AR. K must be at least 00079 * zero. 00080 * 00081 * IOFFD (input) INTEGER 00082 * On entry, IOFFD specifies the position of the offdiagonal de- 00083 * limiting the upper and lower trapezoidal part of C as follows 00084 * (see the notes below): 00085 * 00086 * IOFFD = 0 specifies the main diagonal C( i, i ), 00087 * with i = 1 ... MIN( M, N ), 00088 * IOFFD > 0 specifies the subdiagonal C( i+IOFFD, i ), 00089 * with i = 1 ... MIN( M-IOFFD, N ), 00090 * IOFFD < 0 specifies the superdiagonal C( i, i-IOFFD ), 00091 * with i = 1 ... MIN( M, N+IOFFD ). 00092 * 00093 * ALPHA (input) pointer to CHAR 00094 * On entry, ALPHA specifies the scalar alpha. 00095 * 00096 * AC (input) pointer to CHAR 00097 * On entry, AC is an array of dimension (LDAC,K) containing the 00098 * m by k matrix AC. 00099 * 00100 * LDAC (input) INTEGER 00101 * On entry, LDAC specifies the leading dimension of the array 00102 * AC. LDAC must be at least max( 1, M ). 00103 * 00104 * AR (input) pointer to CHAR 00105 * On entry, AR is an array of dimension (LDAR,N) containing the 00106 * k by n matrix AR. 00107 * 00108 * LDAR (input) INTEGER 00109 * On entry, LDAR specifies the leading dimension of the array 00110 * AR. LDAR must be at least K. 00111 * 00112 * C (input/output) pointer to CHAR 00113 * On entry, C is an array of dimension (LDC,N) containing the m 00114 * by n matrix A. Only the trapezoidal part of C determined by 00115 * UPLO and IOFFD is updated. 00116 * 00117 * LDC (input) INTEGER 00118 * On entry, LDC specifies the leading dimension of the array C. 00119 * LDC must be at least max( 1, M ). 00120 * 00121 * Notes 00122 * ===== 00123 * N N 00124 * ---------------------------- ----------- 00125 * | d | | | 00126 * M | d Upper | | Upper | 00127 * | Lower d | |d | 00128 * | d | M | d | 00129 * ---------------------------- | d | 00130 * | d | 00131 * IOFFD < 0 | Lower d | 00132 * | d| 00133 * N | | 00134 * ----------- ----------- 00135 * | d Upper| 00136 * | d | IOFFD > 0 00137 * M | d | 00138 * | d| N 00139 * | Lower | ---------------------------- 00140 * | | | Upper | 00141 * | | |d | 00142 * | | | d | 00143 * | | | d | 00144 * | | |Lower d | 00145 * ----------- ---------------------------- 00146 * 00147 * -- Written on April 1, 1998 by 00148 * Antoine Petitet, University of Tennessee, Knoxville 37996, USA. 00149 * 00150 * --------------------------------------------------------------------- 00151 */ 00152 /* 00153 * .. Local Scalars .. 00154 */ 00155 char * one; 00156 int i1, j1, m1, mn, n1, size; 00157 GEMM_T gemm; 00158 /* .. 00159 * .. Executable Statements .. 00160 * 00161 */ 00162 if( ( M <= 0 ) || ( N <= 0 ) ) return; 00163 00164 if( Mupcase( UPLO[0] ) == CLOWER ) 00165 { 00166 size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm; 00167 mn = MAX( 0, -IOFFD ); 00168 if( ( n1 = MIN( mn, N ) ) > 0 ) 00169 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC, 00170 &LDAC, AR, &LDAR, one, C, &LDC ); 00171 if( ( n1 = MIN( M-IOFFD, N ) - mn ) > 0 ) 00172 { 00173 i1 = ( j1 = mn ) + IOFFD; 00174 TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA, 00175 Mptr( AC, i1, 0, LDAC, size ), &LDAC, one, Mptr( C, i1, 00176 j1, LDC, size ), &LDC ); 00177 if( ( m1 = M - mn - n1 - IOFFD ) > 0 ) 00178 { 00179 i1 += n1; 00180 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA, 00181 Mptr( AC, i1, 0, LDAC, size ), &LDAC, Mptr( AR, 0, j1, LDAR, 00182 size ), &LDAR, one, Mptr( C, i1, j1, LDC, size ), &LDC ); 00183 } 00184 } 00185 } 00186 else if( Mupcase( UPLO[0] ) == CUPPER ) 00187 { 00188 size = TYPE->size; one = TYPE->one; gemm = TYPE->Fgemm; 00189 mn = MIN( M - IOFFD, N ); 00190 if( ( n1 = mn - MAX( 0, -IOFFD ) ) > 0 ) 00191 { 00192 j1 = mn - n1; 00193 if( ( m1 = MAX( 0, IOFFD ) ) > 0 ) 00194 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &m1, &n1, &K, ALPHA, 00195 AC, &LDAC, AR, &LDAR, one, C, &LDC ); 00196 TYPE->Fsyrk( C2F_CHAR( UPLO ), C2F_CHAR( NOTRAN ), &n1, &K, ALPHA, 00197 Mptr( AC, m1, 0, LDAC, size ), &LDAC, one, Mptr( C, m1, 00198 j1, LDC, size ), &LDC ); 00199 } 00200 if( ( n1 = N - MAX( 0, mn ) ) > 0 ) 00201 { 00202 j1 = N - n1; 00203 gemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &n1, &K, ALPHA, AC, 00204 &LDAC, Mptr( AR, 0, j1, LDAR, size ), &LDAR, one, Mptr( C, 0, j1, 00205 LDC, size ), &LDC ); 00206 } 00207 } 00208 else 00209 { 00210 TYPE->Fgemm( C2F_CHAR( NOTRAN ), C2F_CHAR( NOTRAN ), &M, &N, &K, ALPHA, 00211 AC, &LDAC, AR, &LDAR, TYPE->one, C, &LDC ); 00212 } 00213 /* 00214 * End of PB_Ctzsyrk 00215 */ 00216 }