1 /* $Id: plapack.h,v 1.11 1995/10/12 02:31:54 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 #define LAgetf2_ CGETF2 134 #elif defined(FORTRANCAPS) 135 #define LAgeqrf_ ZGEQRF 136 #define BLdot_ ZDOTC 137 #define BLnrm2_ DZNRM2 138 #define BLscal_ ZSCAL 139 #define BLcopy_ ZCOPY 140 #define BLswap_ ZSWAP 141 #define BLaxpy_ ZAXPY 142 #define BLasum_ DZASUM 143 #elif !defined(FORTRANUNDERSCORE) 144 #define LAgeqrf_ zgeqrf 145 #define LAgetrf_ zgetrf 146 #define LAgetf2_ zgetf2 147 #define BLdot_ zdotc 148 #define BLnrm2_ dznrm2 149 #define BLscal_ zscal 150 #define BLcopy_ zcopy 151 #define BLswap_ zswap 152 #define BLaxpy_ zaxpy 153 #define BLasum_ dzasum 154 #else 155 #define LAgeqrf_ zgeqrf_ 156 #define LAgetrf_ zgetrf_ 157 #define LAgetf2_ zgetf2_ 158 #define BLdot_ zdotc_ 159 #define BLnrm2_ dznrm2_ 160 #define BLscal_ zscal_ 161 #define BLcopy_ zcopy_ 162 #define BLswap_ zswap_ 163 #define BLaxpy_ zaxpy_ 164 #define BLasum_ dzasum_ 165 #endif 166 167 #if defined(PARCH_t3d) 168 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j) CTRTRS(_cptofcd((a),1),_cptofcd((b),1),\ 169 _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j)) 170 #define LApotrf_(a,b,c,d,e) CPOTRF(_cptofcd((a),1),(b),(c),(d),(e)) 171 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\ 172 (f),(g),(h)) 173 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\ 174 (f),(g),(h),(i),(j),(k)) 175 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\ 176 (f),(g),(h),(i)) 177 #define LAtrmv_ CTRMV 178 #define LAtrsl_ CTRSL 179 #elif defined(PARCH_cray) 180 #define LAormqr_ CORMQR 181 #define LAtrtrs_ CTRTRS 182 #define LApotrf_ CPOTRF 183 #define LApotrs_ CPOTRS 184 #define LAgetrs_ CGETRS 185 #define LAgemv_ CGEMV 186 #define LAtrmv_ CTRMV 187 #define LAtrsl_ CTRSL 188 #elif defined(FORTRANCAPS) 189 #define LAtrtrs_ ZTRTRS 190 #define LApotrf_ ZPOTRF 191 #define LApotrs_ ZPOTRS 192 #define LAgemv_ ZGEMV 193 #define LAgetrf_ ZGETRF 194 #define LAgetf2_ ZGETF2 195 #define LAgetrs_ ZGETRS 196 #define LAtrmv_ ZTRMV 197 #define LAtrsl_ ZTRSL 198 #elif !defined(FORTRANUNDERSCORE) 199 #define LAtrtrs_ ztrtrs 200 #define LApotrf_ zpotrf 201 #define LApotrs_ zpotrs 202 #define LAgemv_ zgemv 203 #define LAgetrs_ zgetrs 204 #define LAtrmv_ ztrmv 205 #define LAtrsl_ ztrsl 206 #else 207 #define LAtrtrs_ ztrtrs_ 208 #define LApotrf_ zpotrf_ 209 #define LApotrs_ zpotrs_ 210 #define LAgemv_ zgemv_ 211 #define LAgetrs_ zgetrs_ 212 #define LAtrmv_ ztrmv_ 213 #define LAtrsl_ ztrsl_ 214 #endif 215 216 #endif 217 218 #if defined(__cplusplus) 219 extern "C" { 220 #endif 221 222 /* note that BLdot cannot be used with COMPLEX because it cannot 223 handle returing a double complex!! 224 */ 225 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*); 226 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*); 227 extern void BLscal_(int*,Scalar*,Scalar*,int*); 228 extern void BLcopy_(int*,Scalar*,int*,Scalar*,int*); 229 extern void BLswap_(int*,Scalar*,int*,Scalar*,int*); 230 extern void BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*); 231 extern void LAgetrf_(int*,int*,Scalar*,int*,int*,int*); 232 extern void LAgetf2_(int*,int*,Scalar*,int*,int*,int*); 233 extern void LAgeqrf_(int*,int*,Scalar*,int*,Scalar*,Scalar*,int*,int*); 234 235 #if defined(PARCH_t3d) 236 extern void CPOTRF(_fcd,int*,Scalar*,int*,int*); 237 extern void CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 238 Scalar*,Scalar*,int*); 239 extern void CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*); 240 extern void CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 241 #else 242 extern void LAormqr_(char*,char*,int*,int*,int*,Scalar*,int*,Scalar*,Scalar*, 243 int*,Scalar*,int*,int*); 244 extern void LAtrtrs_(char*,char*,char*,int*,int*,Scalar*,int*,Scalar*,int*, 245 int*); 246 extern void LApotrf_(char*,int*,Scalar*,int*,int*); 247 extern void LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 248 Scalar*,Scalar*,int*); 249 extern void LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*); 250 extern void LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 251 #endif 252 253 #if defined(__cplusplus) 254 } 255 #endif 256 257 #endif 258