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 #include </System/Library/Frameworks/vecLib.framework/Headers/cblas.h>
00029 #include </System/Library/Frameworks/vecLib.framework/Headers/clapack.h>
00030 #else
00031 #include <cblas.h>
00032 #endif
00033 
00034 #ifdef HAVE_ACML
00035 #include <acml.h>
00036 #endif
00037 
00038 #ifdef HAVE_ATLAS
00039 #include <clapack.h>
00040 #else
00041 // ACML and MKL do not provide clapack_* routines
00042 int clapack_dpotrf(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00043         const int N, double *A, const int lda);
00044 int clapack_dposv(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00045         const int N, const int NRHS, double *A, const int lda,
00046         double *B, const int ldb);
00047 int clapack_dpotri(const CBLAS_ORDER Order, const CBLAS_UPLO Uplo,
00048         const int N, double *A, const int LDA);
00049 int clapack_dpotrs(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
00050                    const int N, const int NRHS, double *A, const int lda,
00051                    double *B, const int ldb);
00052 int clapack_dgetrf(const CBLAS_ORDER Order, const int M, const int N,
00053                    double *A, const int lda, int *ipiv);
00054 int clapack_dgetri(const CBLAS_ORDER Order, const int N, double *A,
00055                    const int lda, int *ipiv);
00056 int clapack_dgetrs(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE Transpose,
00057                    const int N, const int NRHS, double *A, const int lda,
00058                    int *ipiv, double *B, const int ldb);
00059 #endif
00060 
00061 namespace shogun
00062 {
00063 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00064 void wrap_dsyev(char jobz, char uplo, int n, double *a, int lda, 
00065         double *w, int *info);
00066 void wrap_dgesvd(char jobu, char jobvt, int m, int n, double *a, int lda, 
00067         double *sing, double *u, int ldu, double *vt, int ldvt, 
00068         int *info);
00069 void wrap_dgeqrf(int m, int n, double *a, int lda, double *tau, int *info);
00070 void wrap_dorgqr(int m, int n, int k, double *a, int lda, double *tau, int *info);
00071 void wrap_dsyevr(char jobz, char uplo, int n, double *a, int lda, int il, int iu, 
00072                  double *eigenvalues, double *eigenvectors, int *info);
00073 void wrap_dsygvx(int itype, char jobz, char uplo, int n, double *a, int lda, double *b,
00074                  int ldb, int il, int iu, double *eigenvalues, double *eigenvectors, int *info);
00075 #endif
00076 }
00077 
00078 // only MKL, ACML and Mac OS vector library provide a header file for the lapack routines
00079 #if !defined(HAVE_ACML) && !defined(HAVE_MKL) && !defined(HAVE_MVEC)
00080 int dsyev_(char*, char*, int*, double*, int*, double*, double*, int*, int*);
00081 int dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* lda,
00082         double* s, double* u, int* ldu, double* vt, int* ldvt, double* work,
00083         int* lwork, int* info);
00084 int dposv_(const char *uplo, const int *n, const int *nrhs, double *a, const int *lda, double *b, const int *ldb, int *info);
00085 int dpotrf_(const char *uplo, int *n, double *a, int * lda, int *info);
00086 int dpotri_(const char *uplo, int *n, double *a, int * lda, int *info);
00087 int dgetri_(int *n, double *a, int *lda, int *ipiv, double *work, int *lwork, int *info);
00088 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
00089 int dgeqrf_(int*, int*, double*, int*, double*, double*, int*, int*);
00090 int dorgqr_(int*, int*, int*, double*, int*, double*, double*, int*, int*);
00091 int dsyevr_(const char*, const char*, const char*, int*, double*, int*, 
00092             double*, double*, int*, int*, double*, int*, double*, double*,
00093             int*, int*, double*, int*, int*, int*, int*);
00094 int dgetrs_(const char*, int*, int*, double*, int*, int*, double*, int*, int*);
00095 int dpotrs_(const char*, int*, int*, double*, int*, double*, int*, int*);
00096 int dsygvx_(int*, const char*, const char*, const char*, int*, double*, int*,
00097             double*, int*, double* , double*, int*, int*, double*,
00098             int*, double*, double*, int*, double*, int*, int*, int*, int*);
00099 #endif
00100 }
00101 
00102 #endif //HAVE_LAPACK
00103 #endif //_LAPACK_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation