aboutsummaryrefslogtreecommitdiff
path: root/src/gensvm_kernel.c
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-16 18:47:09 +0200
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2016-05-16 18:47:09 +0200
commit044dc5a93c33d7aa4c9c98a626890c16446a56fc (patch)
tree23cc17a595d36a35ad9cb50e3ab18c2956b5f65c /src/gensvm_kernel.c
parentMove includes to header (diff)
downloadgensvm-044dc5a93c33d7aa4c9c98a626890c16446a56fc.tar.gz
gensvm-044dc5a93c33d7aa4c9c98a626890c16446a56fc.zip
major refactor of the code
Diffstat (limited to 'src/gensvm_kernel.c')
-rw-r--r--src/gensvm_kernel.c51
1 files changed, 43 insertions, 8 deletions
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 <cblas.h>
-#include <math.h>
-
-#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);
+}