1 /* $Id: plapack.h,v 1.12 1995/10/12 14:02:34 curfman Exp curfman $ */ 2 /* 3 This file provides some name space protection from LAPACK and BLAS and 4 allows the appropriate single or double precision version to be used. 5 This file also deals with different Fortran 77 naming conventions on machines. 6 7 Another problem is charactor strings are represented differently on 8 on some machines in C and Fortran 77. This problem comes up on the 9 Cray T3D. Yet another reason to hate ... 10 11 */ 12 #if !defined(_PLAPACK_H) 13 #define _PLAPACK_H 14 15 #include "petsc.h" 16 17 #if defined(PARCH_t3d) 18 #include "fortran.h" 19 #endif 20 21 /* t3d doesn't have lower level SGETF2 in library, so use SGETRF instead */ 22 #if !defined(PETSC_COMPLEX) 23 #if defined(PARCH_cray) || defined(PARCH_t3d) 24 #define LAgeqrf_ SGEQRF 25 #define LAgetrf_ SGETRF 26 #define LAgetf2_ SGETRF 27 #define BLdot_ SDOT 28 #define BLnrm2_ SNRM2 29 #define BLscal_ SSCAL 30 #define BLcopy_ SCOPY 31 #define BLswap_ SSWAP 32 #define BLaxpy_ SAXPY 33 #define BLasum_ SASUM 34 #elif defined(FORTRANCAPS) 35 #define LAgeqrf_ DGEQRF 36 #define LAgetrf_ DGETRF 37 #define LAgetf2_ DGETF2 38 #define BLdot_ DDOT 39 #define BLnrm2_ DNRM2 40 #define BLscal_ DSCAL 41 #define BLcopy_ DCOPY 42 #define BLswap_ DSWAP 43 #define BLaxpy_ DAXPY 44 #define BLasum_ DASUM 45 #elif !defined(FORTRANUNDERSCORE) 46 #define LAgeqrf_ dgeqrf 47 #define LAgetrf_ dgetrf 48 #define LAgetf2_ dgetf2 49 #define BLdot_ ddot 50 #define BLnrm2_ dnrm2 51 #define BLscal_ dscal 52 #define BLcopy_ dcopy 53 #define BLswap_ dswap 54 #define BLaxpy_ daxpy 55 #define BLasum_ dasum 56 #else 57 #define LAgeqrf_ dgeqrf_ 58 #define LAgetrf_ dgetrf_ 59 #define LAgetf2_ dgetf2_ 60 #define BLdot_ ddot_ 61 #define BLnrm2_ dnrm2_ 62 #define BLscal_ dscal_ 63 #define BLcopy_ dcopy_ 64 #define BLswap_ dswap_ 65 #define BLaxpy_ daxpy_ 66 #define BLasum_ dasum_ 67 #endif 68 69 #if defined(PARCH_t3d) 70 #define LAormqr_(a,b,c,d,e,f,g,h,i,j,k,l,m) SORMQR(_cptofcd((a),1),\ 71 _cptofcd((b),1),(c),(d),(e),(f),(g),(h),(i),(j),(k),(l),(m)) 72 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j) STRTRS(_cptofcd((a),1),_cptofcd((b),1),\ 73 _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j)) 74 #define LApotrf_(a,b,c,d,e) SPOTRF(_cptofcd((a),1),(b),(c),(d),(e)) 75 #define LApotrs_(a,b,c,d,e,f,g,h) SPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\ 76 (f),(g),(h)) 77 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) SGEMV(_cptofcd((a),1),(b),(c),(d),(e),\ 78 (f),(g),(h),(i),(j),(k)) 79 #define LAgetrs_(a,b,c,d,e,f,g,h,i) SGETRS(_cptofcd((a),1),(b),(c),(d),(e),\ 80 (f),(g),(h),(i)) 81 #define LAtrmv_ STRMV 82 #define LAtrsl_ STRSL 83 #elif defined(PARCH_cray) 84 #define LAormqr_ SORMQR 85 #define LAtrtrs_ STRTRS 86 #define LApotrf_ SPOTRF 87 #define LApotrs_ SPOTRS 88 #define LAgemv_ SGEMV 89 #define LAgetrs_ SGETRS 90 #define LAgemv_ SGEMV 91 #define LAtrmv_ STRMV 92 #define LAtrsl_ STRSL 93 #elif defined(FORTRANCAPS) 94 #define LAormqr_ DORMQR 95 #define LAtrtrs_ DTRTRS 96 #define LApotrf_ DPOTRF 97 #define LApotrs_ DPOTRS 98 #define LAgemv_ DGEMV 99 #define LAgetrs_ DGETRS 100 #define LAtrmv_ DTRMV 101 #define LAtrsl_ DTRSL 102 #elif !defined(FORTRANUNDERSCORE) 103 #define LAormqr_ dormqr 104 #define LAtrtrs_ dtrtrs 105 #define LApotrf_ dpotrf 106 #define LApotrs_ dpotrs 107 #define LAgemv_ dgemv 108 #define LAgetrs_ dgetrs 109 #define LAtrmv_ dtrmv 110 #define LAtrsl_ dtrsl 111 #else 112 #define LAormqr_ dormqr_ 113 #define LAtrtrs_ dtrtrs_ 114 #define LApotrf_ dpotrf_ 115 #define LApotrs_ dpotrs_ 116 #define LAgemv_ dgemv_ 117 #define LAgetrs_ dgetrs_ 118 #define LAtrmv_ dtrmv_ 119 #define LAtrsl_ dtrsl_ 120 #endif 121 122 #else 123 124 #if defined(PARCH_cray) || defined(PARCH_t3d) 125 #define LAgeqrf_ CGEQRF 126 #define BLdot_ CDOTC 127 #define BLnrm2_ SCNRM2 128 #define BLscal_ CSCAL 129 #define BLcopy_ CCOPY 130 #define BLswap_ CSWAP 131 #define BLaxpy_ CAXPY 132 #define BLasum_ SCASUM 133 #define LAgetrf_ CGETRF 134 #define LAgetf2_ CGETRF 135 #elif defined(FORTRANCAPS) 136 #define LAgeqrf_ ZGEQRF 137 #define BLdot_ ZDOTC 138 #define BLnrm2_ DZNRM2 139 #define BLscal_ ZSCAL 140 #define BLcopy_ ZCOPY 141 #define BLswap_ ZSWAP 142 #define BLaxpy_ ZAXPY 143 #define BLasum_ DZASUM 144 #elif !defined(FORTRANUNDERSCORE) 145 #define LAgeqrf_ zgeqrf 146 #define LAgetrf_ zgetrf 147 #define LAgetf2_ zgetf2 148 #define BLdot_ zdotc 149 #define BLnrm2_ dznrm2 150 #define BLscal_ zscal 151 #define BLcopy_ zcopy 152 #define BLswap_ zswap 153 #define BLaxpy_ zaxpy 154 #define BLasum_ dzasum 155 #else 156 #define LAgeqrf_ zgeqrf_ 157 #define LAgetrf_ zgetrf_ 158 #define LAgetf2_ zgetf2_ 159 #define BLdot_ zdotc_ 160 #define BLnrm2_ dznrm2_ 161 #define BLscal_ zscal_ 162 #define BLcopy_ zcopy_ 163 #define BLswap_ zswap_ 164 #define BLaxpy_ zaxpy_ 165 #define BLasum_ dzasum_ 166 #endif 167 168 #if defined(PARCH_t3d) 169 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j) CTRTRS(_cptofcd((a),1),_cptofcd((b),1),\ 170 _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j)) 171 #define LApotrf_(a,b,c,d,e) CPOTRF(_cptofcd((a),1),(b),(c),(d),(e)) 172 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\ 173 (f),(g),(h)) 174 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\ 175 (f),(g),(h),(i),(j),(k)) 176 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\ 177 (f),(g),(h),(i)) 178 #define LAtrmv_ CTRMV 179 #define LAtrsl_ CTRSL 180 #elif defined(PARCH_cray) 181 #define LAormqr_ CORMQR 182 #define LAtrtrs_ CTRTRS 183 #define LApotrf_ CPOTRF 184 #define LApotrs_ CPOTRS 185 #define LAgetrs_ CGETRS 186 #define LAgemv_ CGEMV 187 #define LAtrmv_ CTRMV 188 #define LAtrsl_ CTRSL 189 #elif defined(FORTRANCAPS) 190 #define LAtrtrs_ ZTRTRS 191 #define LApotrf_ ZPOTRF 192 #define LApotrs_ ZPOTRS 193 #define LAgemv_ ZGEMV 194 #define LAgetrf_ ZGETRF 195 #define LAgetf2_ ZGETF2 196 #define LAgetrs_ ZGETRS 197 #define LAtrmv_ ZTRMV 198 #define LAtrsl_ ZTRSL 199 #elif !defined(FORTRANUNDERSCORE) 200 #define LAtrtrs_ ztrtrs 201 #define LApotrf_ zpotrf 202 #define LApotrs_ zpotrs 203 #define LAgemv_ zgemv 204 #define LAgetrs_ zgetrs 205 #define LAtrmv_ ztrmv 206 #define LAtrsl_ ztrsl 207 #else 208 #define LAtrtrs_ ztrtrs_ 209 #define LApotrf_ zpotrf_ 210 #define LApotrs_ zpotrs_ 211 #define LAgemv_ zgemv_ 212 #define LAgetrs_ zgetrs_ 213 #define LAtrmv_ ztrmv_ 214 #define LAtrsl_ ztrsl_ 215 #endif 216 217 #endif 218 219 #if defined(__cplusplus) 220 extern "C" { 221 #endif 222 223 /* note that BLdot cannot be used with COMPLEX because it cannot 224 handle returing a double complex!! 225 */ 226 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*); 227 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*); 228 extern void BLscal_(int*,Scalar*,Scalar*,int*); 229 extern void BLcopy_(int*,Scalar*,int*,Scalar*,int*); 230 extern void BLswap_(int*,Scalar*,int*,Scalar*,int*); 231 extern void BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*); 232 extern void LAgetrf_(int*,int*,Scalar*,int*,int*,int*); 233 extern void LAgetf2_(int*,int*,Scalar*,int*,int*,int*); 234 extern void LAgeqrf_(int*,int*,Scalar*,int*,Scalar*,Scalar*,int*,int*); 235 236 #if defined(PARCH_t3d) 237 extern void CPOTRF(_fcd,int*,Scalar*,int*,int*); 238 extern void CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 239 Scalar*,Scalar*,int*); 240 extern void CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*); 241 extern void CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 242 #else 243 extern void LAormqr_(char*,char*,int*,int*,int*,Scalar*,int*,Scalar*,Scalar*, 244 int*,Scalar*,int*,int*); 245 extern void LAtrtrs_(char*,char*,char*,int*,int*,Scalar*,int*,Scalar*,int*, 246 int*); 247 extern void LApotrf_(char*,int*,Scalar*,int*,int*); 248 extern void LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 249 Scalar*,Scalar*,int*); 250 extern void LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*); 251 extern void LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 252 #endif 253 254 #if defined(__cplusplus) 255 } 256 #endif 257 258 #endif 259