SHOGUN v0.9.0
|
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 <cblas.h> 00029 #endif 00030 00031 #ifdef HAVE_ACML 00032 #include <acml.h> 00033 #endif 00034 00035 #ifdef HAVE_ATLAS 00036 #include <clapack.h> 00037 #else 00038 // ACML and MKL do not provide clapack_* routines 00039 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo, 00040 const int N, double *A, const int lda); 00041 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo, 00042 const int N, const int NRHS, double *A, const int lda, 00043 double *B, const int ldb); 00044 #endif 00045 00046 namespace shogun 00047 { 00048 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda, 00049 double *w, int *info); 00050 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda, 00051 double *sing, double *u, int ldu, double *vt, int ldvt, 00052 int *info); 00053 } 00054 00055 // only MKL and ACML provide a header file for the lapack routines 00056 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) 00057 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*); 00058 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda, 00059 double* s, double* u, int* ldu, double* vt, int* ldvt, double* work, 00060 int* lwork, int* info); 00061 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info); 00062 int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info); 00063 #endif 00064 } 00065 00066 #endif //HAVE_LAPACK 00067 #endif //_LAPACK_H__