Skip to content

Commit

Permalink
fix compile errors in slep and mmd when lapack is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Jul 13, 2012
1 parent 2d27e44 commit 20bc943
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/shogun/lib/slep/slep_accel_grad_mtl.cpp
Expand Up @@ -8,6 +8,7 @@
* Copyright (C) 2010-2012 Jun Liu, Jieping Ye
*/

#include <shogun/lib/config.h>
#include <shogun/lib/slep/slep_accel_grad_mtl.h>
#include <shogun/features/DotFeatures.h>
#include <shogun/io/SGIO.h>
Expand All @@ -16,6 +17,7 @@

using namespace shogun;

#ifdef HAVE_LAPACK
void compute_QP(double* Wp, double& P, double& sval,
double* W1, double* delta_W, CDotFeatures* features,
double* Y, double* W, int n_vecs, int n_feats, int* ind, int n_tasks,
Expand Down Expand Up @@ -73,6 +75,7 @@ void compute_QP(double* Wp, double& P, double& sval,
P += delta_W[t*n_feats+i]*(W[t*n_feats+i]-Wp[t*n_feats+i]);
}
}
#endif

namespace shogun
{
Expand All @@ -83,6 +86,7 @@ SGMatrix<double> slep_accel_grad_mtl(
double lambda,
const slep_options& options)
{
#ifdef HAVE_LAPACK
SG_SWARNING("SLEP trace norm regularized MTL is not fully tested yet.\n");
int i,t;
int n_feats = features->get_dim_feature_space();
Expand Down Expand Up @@ -164,5 +168,8 @@ SGMatrix<double> slep_accel_grad_mtl(
SG_FREE(Z_old);

return SGMatrix<float64_t>(Wp,n_feats,n_tasks);
#else //HAVE_LAPACK
SG_SERROR("Lapack not enabled at compile time - slep_accel_grad_mtl() not available\n");
#endif //HAVE_LAPACK
};
};
4 changes: 2 additions & 2 deletions src/shogun/statistics/LinearTimeMMD.h
Expand Up @@ -176,14 +176,15 @@ class CLinearTimeMMD: public CKernelTwoSampleTestStatistic
void init();

public:
#ifdef HAVE_LAPACK
/** return pointer to i-th column of m_Q. Helper for libqp */
static const float64_t* get_Q_col(uint32_t i);

/** helper functions that prints current state */
static void print_state(libqp_state_T state);
#endif //HAVE_LAPACK

protected:
#ifdef HAVE_LAPACK
/** maximum number of iterations of qp solver */
index_t m_opt_max_iterations;

Expand All @@ -198,7 +199,6 @@ class CLinearTimeMMD: public CKernelTwoSampleTestStatistic

/** matrix for selection of kernel weights (static because of libqp) */
static SGMatrix<float64_t> m_Q;
#endif //HAVE_LAPACK
};

}
Expand Down

0 comments on commit 20bc943

Please sign in to comment.