SHOGUN  6.1.3
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 #if !(defined(EIGEN_USE_LAPACKE) || defined(EIGEN_USE_LAPACKE_STRICT))
36 #include <Accelerate/Accelerate.h>
37 #else
38 #include <vecLib/cblas.h>
39 #endif
40 #else
41 #include <cblas.h>
42 #endif
43 
44 #ifdef HAVE_ACML
45 #include <acml.h>
46 #endif
47 
48 #ifdef HAVE_ATLAS
49 #include <clapack.h>
50 #else
51 // ACML, MKL and Mac OS vecLib do not provide clapack_* routines
52 // double precision
53 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
54  const int N, double *A, const int lda);
55 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
56  const int N, const int NRHS, double *A, const int lda,
57  double *B, const int ldb);
58 int clapack_dpotri(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
59  const int N, double *A, const int LDA);
60 int clapack_dpotrs(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
61  const int N, const int NRHS, double *A, const int lda,
62  double *B, const int ldb);
63 int clapack_dgetrf(const CBLAS_ORDER Order, const int M, const int N,
64  double *A, const int lda, int *ipiv);
65 int clapack_dgetri(const CBLAS_ORDER Order, const int N, double *A,
66  const int lda, int *ipiv);
67 int clapack_dgetrs(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE Transpose,
68  const int N, const int NRHS, double *A, const int lda,
69  int *ipiv, double *B, const int ldb);
70 #endif
71 
72 namespace shogun
73 {
74 #ifndef DOXYGEN_SHOULD_SKIP_THIS
75 // double precision
76 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda,
77  double *w, int *info);
78 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda,
79  double *sing, double *u, int ldu, double *vt, int ldvt,
80  int *info);
81 void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info);
82 void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info);
83 void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu,
84  double *eigenvalues, double *eigenvectors, int *info);
85 void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b,
86  int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info);
87 void wrap_dstemr(char jobz, char range, int n, double* d__, double *e, double vl, double vu,
88  int il, int iu, int* m, double* w, double* z__, int ldz, int nzc, int *isuppz,
89  int tryrac, int *info);
90 #endif
91 }
92 
93 // only MKL, ACML and Mac OS vector library provide a header file for the lapack routines
94 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) && !defined(HAVE_MVEC) && !(defined(EIGEN_USE_LAPACKE) || defined(EIGEN_USE_LAPACKE_STRICT))
95 // double precision
96 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
97 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda,
98  double* s, double* u, int* ldu, double* vt, int* ldvt, double* work,
99  int* lwork, int* info);
100 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info);
101 int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info);
102 int dpotri_(const char *uplo, int *n, double *a, int * lda, int *info);
103 int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info);
104 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
105 int dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*);
106 int dorgqr_(int*, int*, int*, double*, int*, double*, double*, int*, int*);
107 int dsyevr_(const char*, const char*, const char*, int*, double*, int*,
108  double*, double*, int*, int*, double*, int*, double*, double*,
109  int*, int*, double*, int*, int*, int*, int*);
110 int dgetrs_(const char*, int*, int*, double*, int*, int*, double*, int*, int*);
111 int dpotrs_(const char*, int*, int*, double*, int*, double*, int*, int*);
112 int dsygvx_(int*, const char*, const char*, const char*, int*, double*, int*,
113  double*, int*, double* , double*, int*, int*, double*,
114  int*, double*, double*, int*, double*, int*, int*, int*, int*);
115 int dstemr_(char*, char*, int*, double*, double*, double*, double*, int*,
116  int*, int*, double*, double*, int*, int*, int*, int*, double*,
117  int*, int*, int*, int*);
118 #endif
119 }
120 
121 #endif //HAVE_LAPACK
122 #endif //_LAPACK_H__
void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu, double *eigenvalues, double *eigenvectors, int *info)
Definition: lapack.cpp:310
int dsyev_(char *, char *, int *, double *, int *, double *, double *, int *, int *)
int dgesvd_(char *jobu, char *jobvt, int *m, int *n, double *a, int *lda, double *s, double *u, int *ldu, double *vt, int *ldvt, double *work, int *lwork, int *info)
int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info)
int dorgqr_(int *, int *, int *, double *, int *, double *, double *, int *, int *)
int dpotrs_(const char *, int *, int *, double *, int *, double *, int *, int *)
int dgeqrf_(int *, int *, double *, int *, double *, double *, int *, int *)
Range< T > range(T rend)
Definition: range.h:136
int dpotri_(const char *uplo, int *n, double *a, int *lda, int *info)
void wrap_dstemr(char jobz, char range, int n, double *diag, double *subdiag, double vl, double vu, int il, int iu, int *m, double *w, double *z__, int ldz, int nzc, int *isuppz, int tryrac, int *info)
Definition: lapack.cpp:376
int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info)
void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda, double *sing, double *u, int ldu, double *vt, int ldvt, int *info)
Definition: lapack.cpp:256
int dstemr_(char *, char *, int *, double *, double *, double *, double *, int *, int *, int *, double *, double *, int *, int *, int *, int *, double *, int *, int *, int *, int *)
void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b, int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info)
Definition: lapack.cpp:345
void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda, double *w, int *info)
Definition: lapack.cpp:238
int dsygvx_(int *, const char *, const char *, const char *, int *, double *, int *, double *, int *, double *, double *, int *, int *, double *, int *, double *, double *, int *, double *, int *, int *, int *, int *)
int dgetrs_(const char *, int *, int *, double *, int *, int *, double *, int *, int *)
int dpotrf_(const char *uplo, int *n, double *a, int *lda, int *info)
int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info)
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
int dsyevr_(const char *, const char *, const char *, int *, double *, int *, double *, double *, int *, int *, double *, int *, double *, double *, int *, int *, double *, int *, int *, int *, int *)
void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info)
Definition: lapack.cpp:274
void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info)
Definition: lapack.cpp:292

SHOGUN Machine Learning Toolbox - Documentation