SHOGUN  v2.0.0
 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 #include </System/Library/Frameworks/vecLib.framework/Headers/cblas.h>
29 #include </System/Library/Frameworks/vecLib.framework/Headers/clapack.h>
30 #else
31 #include <cblas.h>
32 #endif
33 
34 #ifdef HAVE_ACML
35 #include <acml.h>
36 #endif
37 
38 #ifdef HAVE_ATLAS
39 #include <clapack.h>
40 #else
41 // ACML and MKL do not provide clapack_* routines
42 // double precision
43 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
44  const int N, double *A, const int lda);
45 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
46  const int N, const int NRHS, double *A, const int lda,
47  double *B, const int ldb);
48 int clapack_dpotri(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
49  const int N, double *A, const int LDA);
50 int clapack_dpotrs(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
51  const int N, const int NRHS, double *A, const int lda,
52  double *B, const int ldb);
53 int clapack_dgetrf(const CBLAS_ORDER Order, const int M, const int N,
54  double *A, const int lda, int *ipiv);
55 int clapack_dgetri(const CBLAS_ORDER Order, const int N, double *A,
56  const int lda, int *ipiv);
57 int clapack_dgetrs(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE Transpose,
58  const int N, const int NRHS, double *A, const int lda,
59  int *ipiv, double *B, const int ldb);
60 #endif
61 
62 namespace shogun
63 {
64 #ifndef DOXYGEN_SHOULD_SKIP_THIS
65 // double precision
66 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda,
67  double *w, int *info);
68 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda,
69  double *sing, double *u, int ldu, double *vt, int ldvt,
70  int *info);
71 void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info);
72 void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info);
73 void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu,
74  double *eigenvalues, double *eigenvectors, int *info);
75 void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b,
76  int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info);
77 #endif
78 }
79 
80 // only MKL, ACML and Mac OS vector library provide a header file for the lapack routines
81 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) && !defined(HAVE_MVEC)
82 // double precision
83 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
84 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda,
85  double* s, double* u, int* ldu, double* vt, int* ldvt, double* work,
86  int* lwork, int* info);
87 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info);
88 int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info);
89 int dpotri_(const char *uplo, int *n, double *a, int * lda, int *info);
90 int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info);
91 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
92 int dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*);
93 int dorgqr_(int*, int*, int*, double*, int*, double*, double*, int*, int*);
94 int dsyevr_(const char*, const char*, const char*, int*, double*, int*,
95  double*, double*, int*, int*, double*, int*, double*, double*,
96  int*, int*, double*, int*, int*, int*, int*);
97 int dgetrs_(const char*, int*, int*, double*, int*, int*, double*, int*, int*);
98 int dpotrs_(const char*, int*, int*, double*, int*, double*, int*, int*);
99 int dsygvx_(int*, const char*, const char*, const char*, int*, double*, int*,
100  double*, int*, double* , double*, int*, int*, double*,
101  int*, double*, double*, int*, double*, int*, int*, int*, int*);
102 #endif
103 }
104 
105 #endif //HAVE_LAPACK
106 #endif //_LAPACK_H__

SHOGUN Machine Learning Toolbox - Documentation