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