SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
lapack.h
Go to the documentation of this file.
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 <shogun/lib/config.h>
00018 #include <shogun/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 #elif defined(HAVE_MVEC)
00028 //FIXME: Accelerate framework's vForce.h forward declares
00029 // std::complex<> classes that causes major errors
00030 // in c++11 mode and Eigen3
00031 // this define basically disables the include of vForce.h
00032 #ifdef HAVE_CXX11
00033 #define __VFORCE_H 1
00034 #endif
00035 #include <Accelerate/Accelerate.h>
00036 #else
00037 #include <openblas/cblas.h>
00038 #endif
00039 
00040 #ifdef HAVE_ACML
00041 #include <acml.h>
00042 #endif
00043 
00044 #ifdef HAVE_ATLAS
00045 #include <clapack.h>
00046 #else
00047 // ACML and MKL do not provide clapack_* routines
00048 // double precision
00049 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00050         const int N, double *A, const int lda);
00051 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00052         const int N, const int NRHS, double *A, const int lda,
00053         double *B, const int ldb);
00054 int clapack_dpotri(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00055         const int N, double *A, const int LDA);
00056 int clapack_dpotrs(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00057                    const int N, const int NRHS, double *A, const int lda,
00058                    double *B, const int ldb);
00059 int clapack_dgetrf(const CBLAS_ORDER Order, const int M, const int N,
00060                    double *A, const int lda, int *ipiv);
00061 int clapack_dgetri(const CBLAS_ORDER Order, const int N, double *A,
00062                    const int lda, int *ipiv);
00063 int clapack_dgetrs(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE Transpose,
00064                    const int N, const int NRHS, double *A, const int lda,
00065                    int *ipiv, double *B, const int ldb);
00066 #endif
00067 
00068 namespace shogun
00069 {
00070 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00071 // double precision
00072 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda,
00073         double *w, int *info);
00074 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda,
00075         double *sing, double *u, int ldu, double *vt, int ldvt,
00076         int *info);
00077 void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info);
00078 void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info);
00079 void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu,
00080                  double *eigenvalues, double *eigenvectors, int *info);
00081 void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b,
00082                  int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info);
00083 void wrap_dstemr(char jobz, char range, int n, double* d__, double *e, double vl, double vu,
00084         int il, int iu, int* m, double* w, double* z__, int ldz, int nzc, int *isuppz,
00085         int tryrac, int *info);
00086 #endif
00087 }
00088 
00089 // only MKL, ACML and Mac OS vector library provide a header file for the lapack routines
00090 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) && !defined(HAVE_MVEC)
00091 // double precision
00092 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
00093 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda,
00094         double* s, double* u, int* ldu, double* vt, int* ldvt, double* work,
00095         int* lwork, int* info);
00096 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info);
00097 //int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info);
00098 //int dpotri_(const char *uplo, int *n, double *a, int * lda, int *info);
00099 int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info);
00100 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
00101 int dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*);
00102 int dorgqr_(int*, int*, int*, double*, int*, double*, double*, int*, int*);
00103 int dsyevr_(const char*, const char*, const char*, int*, double*, int*,
00104             double*, double*, int*, int*, double*, int*, double*, double*,
00105             int*, int*, double*, int*, int*, int*, int*);
00106 //int dgetrs_(const char*, int*, int*, double*, int*, int*, double*, int*, int*);
00107 //int dpotrs_(const char*, int*, int*, double*, int*, double*, int*, int*);
00108 int dsygvx_(int*, const char*, const char*, const char*, int*, double*, int*,
00109             double*, int*, double* , double*, int*, int*, double*,
00110             int*, double*, double*, int*, double*, int*, int*, int*, int*);
00111 int dstemr_(char*, char*, int*, double*, double*, double*, double*, int*,
00112     int*, int*, double*, double*, int*, int*, int*, int*, double*,
00113     int*, int*, int*, int*);
00114 #endif
00115 }
00116 
00117 #endif //HAVE_LAPACK
00118 #endif //_LAPACK_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation