1 /* $Id: plapack.h,v 1.14 1996/01/26 04:35:51 bsmith Exp bsmith $ */ 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_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(HAVE_FORTRAN_CAPS) 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(HAVE_FORTRAN_UNDERSCORE) 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(HAVE_FORTRAN_CAPS) 84 #define LAormqr_ DORMQR 85 #define LAtrtrs_ DTRTRS 86 #define LApotrf_ DPOTRF 87 #define LApotrs_ DPOTRS 88 #define LAgemv_ DGEMV 89 #define LAgetrs_ DGETRS 90 #define LAtrmv_ DTRMV 91 #define LAtrsl_ DTRSL 92 #elif !defined(HAVE_FORTRAN_UNDERSCORE) 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 #else 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 #endif 111 112 #else 113 114 #if defined(PARCH_t3d) 115 #define LAgeqrf_ CGEQRF 116 #define BLdot_ CDOTC 117 #define BLnrm2_ SCNRM2 118 #define BLscal_ CSCAL 119 #define BLcopy_ CCOPY 120 #define BLswap_ CSWAP 121 #define BLaxpy_ CAXPY 122 #define BLasum_ SCASUM 123 #define LAgetrf_ CGETRF 124 #define LAgetf2_ CGETRF 125 #elif defined(HAVE_FORTRAN_CAPS) 126 #define LAgeqrf_ ZGEQRF 127 #define BLdot_ ZDOTC 128 #define BLnrm2_ DZNRM2 129 #define BLscal_ ZSCAL 130 #define BLcopy_ ZCOPY 131 #define BLswap_ ZSWAP 132 #define BLaxpy_ ZAXPY 133 #define BLasum_ DZASUM 134 #elif !defined(HAVE_FORTRAN_UNDERSCORE) 135 #define LAgeqrf_ zgeqrf 136 #define LAgetrf_ zgetrf 137 #define LAgetf2_ zgetf2 138 #define BLdot_ zdotc 139 #define BLnrm2_ dznrm2 140 #define BLscal_ zscal 141 #define BLcopy_ zcopy 142 #define BLswap_ zswap 143 #define BLaxpy_ zaxpy 144 #define BLasum_ dzasum 145 #else 146 #define LAgeqrf_ zgeqrf_ 147 #define LAgetrf_ zgetrf_ 148 #define LAgetf2_ zgetf2_ 149 #define BLdot_ zdotc_ 150 #define BLnrm2_ dznrm2_ 151 #define BLscal_ zscal_ 152 #define BLcopy_ zcopy_ 153 #define BLswap_ zswap_ 154 #define BLaxpy_ zaxpy_ 155 #define BLasum_ dzasum_ 156 #endif 157 158 #if defined(PARCH_t3d) 159 #define LAtrtrs_(a,b,c,d,e,f,g,h,i,j) CTRTRS(_cptofcd((a),1),_cptofcd((b),1),\ 160 _cptofcd((c),1),(d),(e),(f),(g),(h),(i),(j)) 161 #define LApotrf_(a,b,c,d,e) CPOTRF(_cptofcd((a),1),(b),(c),(d),(e)) 162 #define LApotrs_(a,b,c,d,e,f,g,h) CPOTRS(_cptofcd((a),1),(b),(c),(d),(e),\ 163 (f),(g),(h)) 164 #define LAgemv_(a,b,c,d,e,f,g,h,i,j,k) CGEMV(_cptofcd((a),1),(b),(c),(d),(e),\ 165 (f),(g),(h),(i),(j),(k)) 166 #define LAgetrs_(a,b,c,d,e,f,g,h,i) CGETRS(_cptofcd((a),1),(b),(c),(d),(e),\ 167 (f),(g),(h),(i)) 168 #define LAtrmv_ CTRMV 169 #define LAtrsl_ CTRSL 170 #elif defined(HAVE_FORTRAN_CAPS) 171 #define LAtrtrs_ ZTRTRS 172 #define LApotrf_ ZPOTRF 173 #define LApotrs_ ZPOTRS 174 #define LAgemv_ ZGEMV 175 #define LAgetrf_ ZGETRF 176 #define LAgetf2_ ZGETF2 177 #define LAgetrs_ ZGETRS 178 #define LAtrmv_ ZTRMV 179 #define LAtrsl_ ZTRSL 180 #elif !defined(HAVE_FORTRAN_UNDERSCORE) 181 #define LAtrtrs_ ztrtrs 182 #define LApotrf_ zpotrf 183 #define LApotrs_ zpotrs 184 #define LAgemv_ zgemv 185 #define LAgetrs_ zgetrs 186 #define LAtrmv_ ztrmv 187 #define LAtrsl_ ztrsl 188 #else 189 #define LAtrtrs_ ztrtrs_ 190 #define LApotrf_ zpotrf_ 191 #define LApotrs_ zpotrs_ 192 #define LAgemv_ zgemv_ 193 #define LAgetrs_ zgetrs_ 194 #define LAtrmv_ ztrmv_ 195 #define LAtrsl_ ztrsl_ 196 #endif 197 198 #endif 199 200 #if defined(__cplusplus) 201 extern "C" { 202 #endif 203 204 /* note that BLdot cannot be used with COMPLEX because it cannot 205 handle returing a double complex!! 206 */ 207 extern double BLdot_(int*,Scalar*,int*,Scalar*,int*); 208 extern double BLnrm2_(int*,Scalar*,int*),BLasum_(int*,Scalar*,int*); 209 extern void BLscal_(int*,Scalar*,Scalar*,int*); 210 extern void BLcopy_(int*,Scalar*,int*,Scalar*,int*); 211 extern void BLswap_(int*,Scalar*,int*,Scalar*,int*); 212 extern void BLaxpy_(int*,Scalar*,Scalar*,int*,Scalar*,int*); 213 extern void LAgetrf_(int*,int*,Scalar*,int*,int*,int*); 214 extern void LAgetf2_(int*,int*,Scalar*,int*,int*,int*); 215 extern void LAgeqrf_(int*,int*,Scalar*,int*,Scalar*,Scalar*,int*,int*); 216 217 #if defined(PARCH_t3d) 218 219 #if defined(PETSC_COMPLEX) 220 extern void CPOTRF(_fcd,int*,Scalar*,int*,int*); 221 extern void CGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 222 Scalar*,Scalar*,int*); 223 extern void CPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*); 224 extern void CGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 225 #else 226 extern void SPOTRF(_fcd,int*,Scalar*,int*,int*); 227 extern void SGEMV(_fcd,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 228 Scalar*,Scalar*,int*); 229 extern void SPOTRS(_fcd,int*,int*,Scalar*,int*,Scalar*,int*,int*); 230 extern void SGETRS(_fcd,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 231 #endif 232 233 #else 234 extern void LAormqr_(char*,char*,int*,int*,int*,Scalar*,int*,Scalar*,Scalar*, 235 int*,Scalar*,int*,int*); 236 extern void LAtrtrs_(char*,char*,char*,int*,int*,Scalar*,int*,Scalar*,int*, 237 int*); 238 extern void LApotrf_(char*,int*,Scalar*,int*,int*); 239 extern void LAgemv_(char*,int*,int*,Scalar*,Scalar*,int*,Scalar *,int*, 240 Scalar*,Scalar*,int*); 241 extern void LApotrs_(char*,int*,int*,Scalar*,int*,Scalar*,int*,int*); 242 extern void LAgetrs_(char*,int*,int*,Scalar*,int*,int*,Scalar*,int*,int*); 243 #endif 244 245 #if defined(__cplusplus) 246 } 247 #endif 248 249 #endif 250