1 /* 2 This file is part of the BOLT-LMM linear mixed model software package 3 developed by Po-Ru Loh. Copyright (C) 2014-2019 Harvard University. 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef LAPACKCONST_HPP 20 #define LAPACKCONST_HPP 21 22 #ifdef USE_MKL 23 24 #include "mkl.h" 25 #define DGER_MACRO dger 26 #define DGEMV_MACRO dgemv 27 #define DGEMM_MACRO dgemm 28 #define SGEMM_MACRO sgemm 29 #define DGELS_MACRO dgels 30 #define DGESVD_MACRO dgesvd 31 32 #else 33 34 extern "C" int dgesvd_(char *jobu, char *jobvt, int *m, int *n, double *a, int *lda, double *s, 35 double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, 36 int *info); 37 extern "C" int dgemv_(char *TRANS, int *M, int *N, double *ALPHA, double *A, int *LDA, 38 const double *X, int *INCX, double *BETA, double *Y, int *INCY); 39 extern "C" int dger_(int *M, int *N, double *ALPHA, double *X, int *INCX, const double *Y, 40 int *INCY, double *A, int *LDA); 41 extern "C" int dgemm_(char *TRANSA, char *TRANSB, int *M, int *N, int *K, double *ALPHA, 42 const double *A, int *LDA, const double *B, int *LDB, double *BETA, 43 double *C, int *LDC); 44 extern "C" int sgemm_(char *TRANSA, char *TRANSB, int *M, int *N, int *K, float *ALPHA, 45 const float *A, int *LDA, const float *B, int *LDB, float *BETA, 46 float *C, int *LDC); 47 extern "C" int dgels_(char *TRANS, int *M, int *N, int *NRHS, double *A, int *LDA, double *B, 48 int *LDB, double *WORK, int *LWORK, int *INFO); 49 50 #define DGER_MACRO dger_ 51 #define DGEMV_MACRO dgemv_ 52 #define DGEMM_MACRO dgemm_ 53 #define SGEMM_MACRO sgemm_ 54 #define DGELS_MACRO dgels_ 55 #define DGESVD_MACRO dgesvd_ 56 57 #endif 58 59 60 61 /* 62 namespace LapackConst { 63 64 #ifndef USE_MKL 65 #ifdef USE_MKL 66 inline CBLAS_TRANSPOSE lapackTransToMKL(char trans) { 67 return (trans=='N'||trans=='n') ? CblasNoTrans : CblasTrans; 68 } 69 #endif 70 71 void dgemm_wrap(char TRANSA, char TRANSB, int M, int N, int K, double ALPHA, 72 const double *A, int LDA, const double *B, int LDB, double BETA, 73 double *C, int LDC); 74 } 75 */ 76 #endif 77