SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lapack.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Written (W) 2006-2007 Mikio L. Braun
10  * Written (W) 2008 Jochen Garcke
11  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
12  */
13 
14 #ifndef _LAPACK_H__
15 #define _LAPACK_H__
16 
17 #include <shogun/lib/config.h>
18 #include <shogun/lib/common.h>
19 
20 #ifdef HAVE_LAPACK
21 
22 extern "C" {
23 
24 #ifdef HAVE_MKL
25 #include <mkl_cblas.h>
26 #include <mkl_lapack.h>
27 #elif defined(HAVE_MVEC)
28 //FIXME: Accelerate framework's vForce.h forward declares
29 // std::complex<> classes that causes major errors
30 // in c++11 mode and Eigen3
31 // this define basically disables the include of vForce.h
32 #ifdef HAVE_CXX11
33 #define __VFORCE_H 1
34 #endif
35 #include <Accelerate/Accelerate.h>
36 #else
37 #include <cblas.h>
38 #endif
39 
40 #ifdef HAVE_ACML
41 #include <acml.h>
42 #endif
43 
44 #ifdef HAVE_ATLAS
45 #include <clapack.h>
46 #else
47 // ACML and MKL do not provide clapack_* routines
48 // double precision
49 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
50  const int N, double *A, const int lda);
51 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
52  const int N, const int NRHS, double *A, const int lda,
53  double *B, const int ldb);
54 int clapack_dpotri(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
55  const int N, double *A, const int LDA);
56 int clapack_dpotrs(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
57  const int N, const int NRHS, double *A, const int lda,
58  double *B, const int ldb);
59 int clapack_dgetrf(const CBLAS_ORDER Order, const int M, const int N,
60  double *A, const int lda, int *ipiv);
61 int clapack_dgetri(const CBLAS_ORDER Order, const int N, double *A,
62  const int lda, int *ipiv);
63 int clapack_dgetrs(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE Transpose,
64  const int N, const int NRHS, double *A, const int lda,
65  int *ipiv, double *B, const int ldb);
66 #endif
67 
68 namespace shogun
69 {
70 #ifndef DOXYGEN_SHOULD_SKIP_THIS
71 // double precision
72 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda,
73  double *w, int *info);
74 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda,
75  double *sing, double *u, int ldu, double *vt, int ldvt,
76  int *info);
77 void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info);
78 void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info);
79 void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu,
80  double *eigenvalues, double *eigenvectors, int *info);
81 void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b,
82  int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info);
83 void wrap_dstemr(char jobz, char range, int n, double* d__, double *e, double vl, double vu,
84  int il, int iu, int* m, double* w, double* z__, int ldz, int nzc, int *isuppz,
85  int tryrac, int *info);
86 #endif
87 }
88 
89 // only MKL, ACML and Mac OS vector library provide a header file for the lapack routines
90 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) && !defined(HAVE_MVEC)
91 // double precision
92 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
93 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda,
94  double* s, double* u, int* ldu, double* vt, int* ldvt, double* work,
95  int* lwork, int* info);
96 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info);
97 int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info);
98 int dpotri_(const char *uplo, int *n, double *a, int * lda, int *info);
99 int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info);
100 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
101 int dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*);
102 int dorgqr_(int*, int*, int*, double*, int*, double*, double*, int*, int*);
103 int dsyevr_(const char*, const char*, const char*, int*, double*, int*,
104  double*, double*, int*, int*, double*, int*, double*, double*,
105  int*, int*, double*, int*, int*, int*, int*);
106 int dgetrs_(const char*, int*, int*, double*, int*, int*, double*, int*, int*);
107 int dpotrs_(const char*, int*, int*, double*, int*, double*, int*, int*);
108 int dsygvx_(int*, const char*, const char*, const char*, int*, double*, int*,
109  double*, int*, double* , double*, int*, int*, double*,
110  int*, double*, double*, int*, double*, int*, int*, int*, int*);
111 int dstemr_(char*, char*, int*, double*, double*, double*, double*, int*,
112  int*, int*, double*, double*, int*, int*, int*, int*, double*,
113  int*, int*, int*, int*);
114 #endif
115 }
116 
117 #endif //HAVE_LAPACK
118 #endif //_LAPACK_H__

SHOGUN Machine Learning Toolbox - Documentation