|
SHOGUN v0.9.3
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 1999-2009 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Written (W) 2006-2007 Mikio L. Braun 00010 * Written (W) 2008 Jochen Garcke 00011 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00012 */ 00013 00014 #ifndef _LAPACK_H__ 00015 #define _LAPACK_H__ 00016 00017 #include "lib/config.h" 00018 #include "lib/common.h" 00019 00020 #ifdef HAVE_LAPACK 00021 00022 extern "C" { 00023 00024 #ifdef HAVE_MKL 00025 #include <mkl_cblas.h> 00026 #include <mkl_lapack.h> 00027 #else 00028 #include <gotoblas/common.h> 00029 #include <cblas.h> 00030 #endif 00031 00032 #ifdef HAVE_ACML 00033 #include <acml.h> 00034 #endif 00035 00036 #ifdef HAVE_ATLAS 00037 #include <clapack.h> 00038 #else 00039 // ACML and MKL do not provide clapack_* routines 00040 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo, 00041 const int N, double *A, const int lda); 00042 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo, 00043 const int N, const int NRHS, double *A, const int lda, 00044 double *B, const int ldb); 00045 #endif 00046 00047 namespace shogun 00048 { 00049 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda, 00050 double *w, int *info); 00051 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda, 00052 double *sing, double *u, int ldu, double *vt, int ldvt, 00053 int *info); 00054 } 00055 00056 // only MKL and ACML provide a header file for the lapack routines 00057 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) 00058 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*); 00059 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda, 00060 double* s, double* u, int* ldu, double* vt, int* ldvt, double* work, 00061 int* lwork, int* info); 00062 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info); 00063 //int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info); 00064 #endif 00065 } 00066 00067 #endif //HAVE_LAPACK 00068 #endif //_LAPACK_H__