Skip to content

Commit

Permalink
workaround for eigen 3.2.93 bug
Browse files Browse the repository at this point in the history
it's because yakkety ships with such eigen...
  • Loading branch information
vigsterkr committed Feb 3, 2017
1 parent 79c075d commit 9673755
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/shogun/mathematics/eigen3.h
Expand Up @@ -76,6 +76,11 @@
// c.f. github isse #3486
#define EIGEN_WITH_OPERATOR_BUG 1
#endif

#if ((EIGEN_WORLD_VERSION == 3) && (EIGEN_MAJOR_VERSION == 2) && \
((EIGEN_MINOR_VERSION >= 93)))
#define EIGEN_WITH_TRANSPOSITION_BUG 1
#endif
namespace shogun
{
template<class T> class SGSparseMatrix;
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/regression/lars_unittest.cc
Expand Up @@ -451,11 +451,16 @@ TEST(LeastAngleRegression, ols_equivalence)
Map<MatrixXd> feat(mat.matrix, mat.num_rows, mat.num_cols);
Map<VectorXd> l(lab.vector, lab.size());
// OLS
#if EIGEN_WITH_TRANSPOSITION_BUG
MatrixXd feat_t = feat.transpose().eval();
VectorXd solve=feat_t.colPivHouseholderQr().solve(l);
#else
VectorXd solve=feat.transpose().colPivHouseholderQr().solve(l);
#endif

// Check if full LAR model is equivalent to OLS
EXPECT_EQ( w.size(), n_feat);
EXPECT_NEAR( (map_w - solve).norm(), 0.0, 1E-12);
EXPECT_NEAR( (map_w - solve).norm(), 0.0, 1E-12);


SG_UNREF(proc1);
Expand Down

0 comments on commit 9673755

Please sign in to comment.