From 044dc5a93c33d7aa4c9c98a626890c16446a56fc Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Mon, 16 May 2016 18:47:09 +0200 Subject: major refactor of the code --- src/gensvm_kernel.c | 51 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 8 deletions(-) (limited to 'src/gensvm_kernel.c') diff --git a/src/gensvm_kernel.c b/src/gensvm_kernel.c index 1d7e5e4..a4f2277 100644 --- a/src/gensvm_kernel.c +++ b/src/gensvm_kernel.c @@ -11,15 +11,7 @@ * */ -#include -#include - -#include "globals.h" -#include "gensvm.h" #include "gensvm_kernel.h" -#include "gensvm_lapack.h" -#include "gensvm_matrix.h" -#include "gensvm_util.h" /** * @brief Do the preprocessing steps needed to perform kernel GenSVM @@ -451,3 +443,46 @@ double gensvm_dot_sigmoid(double *x1, double *x2, double *kernelparam, long n) value += kernelparam[1]; return tanh(value); } + +/** + * @brief Compute the eigenvalues and optionally the eigenvectors of a + * symmetric matrix. + * + * @details + * This is a wrapper function around the external LAPACK function. + * + * See the LAPACK documentation at: + * http://www.netlib.org/lapack/explore-html/d2/d97/dsyevx_8f.html + * + * + */ +int dsyevx(char JOBZ, char RANGE, char UPLO, int N, double *A, int LDA, + double VL, double VU, int IL, int IU, double ABSTOL, int *M, + double *W, double *Z, int LDZ, double *WORK, int LWORK, + int *IWORK, int *IFAIL) +{ + extern void dsyevx_(char *JOBZ, char *RANGE, char *UPLO, int *Np, + double *A, int *LDAp, double *VLp, double *VUp, + int *ILp, int *IUp, double *ABSTOLp, int *M, + double *W, double *Z, int *LDZp, double *WORK, + int *LWORKp, int *IWORK, int *IFAIL, int *INFOp); + int INFO; + dsyevx_(&JOBZ, &RANGE, &UPLO, &N, A, &LDA, &VL, &VU, &IL, &IU, &ABSTOL, + M, W, Z, &LDZ, WORK, &LWORK, IWORK, IFAIL, &INFO); + return INFO; +} + +/** + * @brief Determine double precision machine parameters. + * + * @details + * This is a wrapper function around the external LAPACK function. + * + * See the LAPACK documentation at: + * http://www.netlib.org/lapack/explore-html/d5/dd4/dlamch_8f.html + */ +double dlamch(char CMACH) +{ + extern double dlamch_(char *CMACH); + return dlamch_(&CMACH); +} -- cgit v1.2.3