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

SHOGUN Machine Learning Toolbox - Documentation