1a1e12872SBarry Smith /* 2*4fcfbe5fSBarry Smith This file dispatches between various header files for blas/lapack distributions to handle the name mangling. 3*4fcfbe5fSBarry Smith It also provides C prototypes for all the BLAS/LAPACK functions that PETSc uses 4a1e12872SBarry Smith */ 5c3e41550SBarry Smith #if !defined(_BLASLAPACK_H) 6c3e41550SBarry Smith #define _BLASLAPACK_H 719b02663SBarry Smith #include "petsc.h" 8bb638ab5SSatish Balay 9429d5388SBarry Smith #if defined(PETSC_BLASLAPACK_STDCALL) 10bb6813b4SKris Buschelman #include "petscblaslapack_stdcall.h" 11c35b00c6SBarry Smith #else 12c35b00c6SBarry Smith 13429d5388SBarry Smith #if defined(PETSC_BLASLAPACK_UNDERSCORE) 14bb6813b4SKris Buschelman #include "petscblaslapack_uscore.h" 15429d5388SBarry Smith #elif defined(PETSC_BLASLAPACK_CAPS) 16bb6813b4SKris Buschelman #include "petscblaslapack_caps.h" 1775567043SBarry Smith #elif defined(PETSC_USE_SCALAR_QD_DD) 1875567043SBarry Smith #include "petscblaslapack_qd.h" 1925fce39dSBarry Smith #else 20bb6813b4SKris Buschelman #include "petscblaslapack_c.h" 21a1e12872SBarry Smith #endif 22a1e12872SBarry Smith 2375567043SBarry Smith #if !defined(PETSC_USE_SCALAR_QD_DD) 24c35b00c6SBarry Smith EXTERN_C_BEGIN 2575567043SBarry Smith #endif 26c35b00c6SBarry Smith 27c35b00c6SBarry Smith EXTERN void LAPACKgetrf_(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); 28c35b00c6SBarry Smith EXTERN void LAPACKungqr_(PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 29c35b00c6SBarry Smith EXTERN void LAPACKgeqrf_(PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 30c35b00c6SBarry Smith 31356650c2SBarry Smith EXTERN PetscReal BLASdot_(const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*); 32356650c2SBarry Smith EXTERN PetscReal BLASnrm2_(const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*); 33356650c2SBarry Smith EXTERN void BLASscal_(const PetscBLASInt*,const PetscScalar*,PetscScalar*,const PetscBLASInt*); 34356650c2SBarry Smith EXTERN void BLAScopy_(const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*); 35356650c2SBarry Smith EXTERN void BLASswap_(const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*); 36356650c2SBarry Smith EXTERN void BLASaxpy_(const PetscBLASInt*,const PetscScalar*,const PetscScalar*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*); 37356650c2SBarry Smith EXTERN PetscReal BLASasum_(const PetscBLASInt*,const PetscScalar*,const PetscBLASInt*); 38356650c2SBarry Smith EXTERN void LAPACKpttrf_(const PetscBLASInt*,PetscReal*,PetscScalar*,const PetscBLASInt*); 39356650c2SBarry Smith EXTERN void LAPACKstein_(const PetscBLASInt*,PetscReal*,PetscReal*,const PetscBLASInt*,PetscReal*,const PetscBLASInt*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscReal*,const PetscBLASInt*,const PetscBLASInt*,const PetscBLASInt*); 400ac4e535SJed Brown EXTERN void LAPACKgesv_(const PetscBLASInt*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscBLASInt*); 41c35b00c6SBarry Smith 42c35b00c6SBarry Smith EXTERN void LAPACKormqr_(const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 43c35b00c6SBarry Smith EXTERN void LAPACKtrtrs_(const char*,const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 44c35b00c6SBarry Smith EXTERN void LAPACKpotrf_(const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 45c35b00c6SBarry Smith EXTERN void LAPACKpotrs_(const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 465c42ef9dSBarry Smith EXTERN void BLASgemv_(const char*,const PetscBLASInt*,const PetscBLASInt*,PetscScalar*,const PetscScalar*,const PetscBLASInt*,PetscScalar *,const PetscBLASInt*,PetscScalar*,PetscScalar*,const PetscBLASInt*); 47c35b00c6SBarry Smith EXTERN void LAPACKgetrs_(const char*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 48c35b00c6SBarry Smith EXTERN void BLAStrmv_(const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*); 49c35b00c6SBarry Smith EXTERN void BLASgemm_(const char*,const char*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*); 50c35b00c6SBarry Smith 51976cf19bSSatish Balay /* Some functions prototypes differ between real and complex */ 52976cf19bSSatish Balay #if defined(PETSC_USE_COMPLEX) 5333f32db5SJed Brown EXTERN void LAPACKgelss_(const PetscBLASInt*,const PetscBLASInt*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscReal*,const PetscReal*,PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscReal*,PetscBLASInt*); 54976cf19bSSatish Balay EXTERN void LAPACKsyev_(const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 55976cf19bSSatish Balay EXTERN void LAPACKsyevx_(const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); 56976cf19bSSatish Balay EXTERN void LAPACKsygv_(PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 57976cf19bSSatish Balay EXTERN void LAPACKsygvx_(PetscBLASInt*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); 58976cf19bSSatish Balay EXTERN void LAPACKpttrs_(const char*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 59976cf19bSSatish Balay #else 6033f32db5SJed Brown EXTERN void LAPACKgelss_(const PetscBLASInt*,const PetscBLASInt*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscReal*,const PetscReal*,PetscBLASInt*,PetscScalar*,const PetscBLASInt*,PetscBLASInt*); 61976cf19bSSatish Balay EXTERN void LAPACKsyev_(const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 62976cf19bSSatish Balay EXTERN void LAPACKsyevx_(const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); 63976cf19bSSatish Balay EXTERN void LAPACKsygv_(PetscBLASInt*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 64976cf19bSSatish Balay EXTERN void LAPACKsygvx_(PetscBLASInt*,const char*,const char*,const char*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*); 65976cf19bSSatish Balay EXTERN void LAPACKpttrs_(PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 66976cf19bSSatish Balay EXTERN void LAPACKstebz_(const char*,const char*,PetscBLASInt*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscReal*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*,PetscBLASInt*); 67976cf19bSSatish Balay #endif 68976cf19bSSatish Balay 69c35b00c6SBarry Smith /* ESSL uses a different calling sequence for dgeev(), zgeev() than LAPACK; */ 70c35b00c6SBarry Smith #if defined(PETSC_HAVE_ESSL) && defined(PETSC_USE_COMPLEX) 71c35b00c6SBarry Smith EXTERN void LAPACKgeev_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 72c35b00c6SBarry Smith EXTERN void LAPACKgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 73c35b00c6SBarry Smith #elif defined(PETSC_HAVE_ESSL) 74c35b00c6SBarry Smith EXTERN void LAPACKgeev_(PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscBLASInt*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 75c35b00c6SBarry Smith EXTERN void LAPACKgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 76976cf19bSSatish Balay #elif defined(PETSC_USE_COMPLEX) 77976cf19bSSatish Balay EXTERN void LAPACKgeev_(const char*,const char*,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscScalar*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 78976cf19bSSatish Balay EXTERN void LAPACKgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscReal*,PetscBLASInt*); 79976cf19bSSatish Balay #else 80c35b00c6SBarry Smith EXTERN void LAPACKgeev_(const char*,const char*,PetscBLASInt *,PetscScalar *,PetscBLASInt*,PetscReal*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 81c35b00c6SBarry Smith EXTERN void LAPACKgesvd_(const char*,const char*,PetscBLASInt *,PetscBLASInt*,PetscScalar *,PetscBLASInt*,PetscReal*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscScalar*,PetscBLASInt*,PetscBLASInt*); 82c35b00c6SBarry Smith #endif 83c35b00c6SBarry Smith 8475567043SBarry Smith #if !defined(PETSC_USE_SCALAR_QD_DD) 85c35b00c6SBarry Smith EXTERN_C_END 8675567043SBarry Smith #endif 87c35b00c6SBarry Smith 88c35b00c6SBarry Smith #endif 89a1e12872SBarry Smith #endif 90