Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get eigen3 out of math.h
  • Loading branch information
lisitsyn committed Jul 24, 2012
1 parent 50f8b64 commit 629ccb8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/shogun/lib/SGVector.cpp
Expand Up @@ -15,6 +15,10 @@
#include <shogun/lib/SGReferencedData.h>
#include <shogun/mathematics/lapack.h>

#ifdef HAVE_EIGEN3
#include <shogun/mathematics/eigen3.h>
#endif

namespace shogun {

template<class T> SGVector<T>::SGVector() : SGReferencedData(false)
Expand Down
9 changes: 5 additions & 4 deletions src/shogun/lib/malsar/malsar_clustered.cpp
Expand Up @@ -11,6 +11,7 @@
#include <shogun/lib/malsar/malsar_clustered.h>
#ifdef HAVE_EIGEN3
#include <shogun/mathematics/Math.h>
#include <shogun/mathematics/eigen3.h>
#include <iostream>
#include <shogun/lib/external/libqp.h>

Expand Down Expand Up @@ -134,7 +135,7 @@ malsar_result_t malsar_clustered(

int inner_iter = 0;
// line search, Armijo-Goldstein scheme
while (inner_iter <= 1)
while (inner_iter <= 1000)
{
Wzp = Ws - gWs/gamma;
Czp = Cs - gCs/gamma;
Expand Down Expand Up @@ -259,8 +260,8 @@ malsar_result_t malsar_clustered(
case 0:
if (iter>=2)
{
if ( CMath::abs(obj-obj_old) <= options.tolerance )
done = true;
// if ( CMath::abs(obj-obj_old) <= options.tolerance )
// done = true;
}
break;
case 1:
Expand Down Expand Up @@ -300,7 +301,7 @@ malsar_result_t malsar_clustered(
for (task=0; task<n_tasks; task++)
tasks_w[i] = Wzp(i,task);
}
tasks_w.display_matrix();
//tasks_w.display_matrix();
SGVector<float64_t> tasks_c(n_tasks);
for (int i=0; i<n_tasks; i++) tasks_c[i] = Czp[i];
return malsar_result_t(tasks_w, tasks_c);
Expand Down
2 changes: 2 additions & 0 deletions src/shogun/lib/malsar/malsar_joint_feature_learning.cpp
Expand Up @@ -11,6 +11,7 @@
#include <shogun/lib/malsar/malsar_joint_feature_learning.h>
#ifdef HAVE_EIGEN3
#include <shogun/mathematics/Math.h>
#include <shogun/mathematics/eigen3.h>
#include <iostream>

using namespace Eigen;
Expand Down Expand Up @@ -171,6 +172,7 @@ malsar_result_t malsar_joint_feature_learning(
obj = Fzp;
for (task=0; task<n_tasks; task++)
obj += rho1*(Wz.col(task).norm());
SG_SDEBUG("Obj = %f\n",obj);

// check if process should be terminated
switch (options.termination)
Expand Down
1 change: 1 addition & 0 deletions src/shogun/lib/malsar/malsar_low_rank.cpp
Expand Up @@ -10,6 +10,7 @@

#include <shogun/lib/malsar/malsar_low_rank.h>
#ifdef HAVE_EIGEN3
#include <shogun/mathematics/eigen3.h>
#include <shogun/mathematics/Math.h>
#include <iostream>

Expand Down
5 changes: 0 additions & 5 deletions src/shogun/mathematics/Math.h
Expand Up @@ -36,11 +36,6 @@
#include <ieeefp.h>
#endif

#ifdef HAVE_EIGEN3
#define EIGEN_RUNTIME_NO_MALLOC
#include <Eigen/Dense>
#endif

/// workaround for log2 being a define on cygwin
#ifdef log2
#define cygwin_log2 log2
Expand Down
18 changes: 18 additions & 0 deletions src/shogun/mathematics/eigen3.h
@@ -0,0 +1,18 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Copyright (C) 2012 Sergey Lisitsyn
*/

#ifndef EIGEN3_H_
#define EIGEN3_H_

#ifdef HAVE_EIGEN3
#define EIGEN_RUNTIME_NO_MALLOC
#include <Eigen/Dense>
#endif

#endif

0 comments on commit 629ccb8

Please sign in to comment.