Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

building with Eigen HEAD and -std=c++11 #980

Closed
rimmartin opened this issue Oct 28, 2014 · 5 comments
Closed

building with Eigen HEAD and -std=c++11 #980

rimmartin opened this issue Oct 28, 2014 · 5 comments

Comments

@rimmartin
Copy link

Hi,

I built pcl with only one line needing a change in https://github.com/PointCloudLibrary/pcl/blob/master/registration/include/pcl/registration/impl/ndt_2d.hpp to satisfy Eigen.
I cloned pcl and required supporting libraries last evening. Used cmake-2.8.12.2 and more particularly -std=c++11 and compiler g++ (GCC) 4.10.0 20140510 (experimental)

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- <html>ndt_2d.hpp (<b>Today 10:05:34 AM</b>)</html>
+++ <html><b>Current File</b></html>
@@ -432,7 +432,7 @@
       if (min_eigenvalue < 0)
       {
         double lambda = 1.1 * min_eigenvalue - 1;
-        score.hessian += Eigen::Vector3d (-lambda, -lambda, -lambda).asDiagonal ();
+        score.hessian.diagonal() += Eigen::Matrix<double,3,1> (-lambda, -lambda, -lambda);
         solver.compute (score.hessian, false);
         PCL_DEBUG ("[pcl::NormalDistributionsTransform2D::computeTransformation] adjust hessian: %f: new eigenvalues:%f %f %f\n",
             float (lambda),

The += works with this change. Have not run tests yet but am compiled successfully

@taketwo
Copy link
Member

taketwo commented Oct 29, 2014

Hi, you are welcome to submit a pull request. Please make sure to put a space in score.hessian.diagonal (), as required by the PCL style guide.

@rimmartin
Copy link
Author

Thank you. I will after I test; I'm yet not familiar with the code that would run this part. Learning mode

@fidergo-stephane-gourichon
Copy link
Contributor

Summary: "worksforme"

Observed: works here on several variants of Ubuntu

Current master does not apply the patch discussed here (ref), yet its absence does not cause any problem during compilation here.

Context:

  • Ubuntu 16.04 x86_64
  • cmake version 3.5.1
  • CMAKE_CXX_STANDARD set to 11
  • libeigen3-dev 3.3~beta1-2
  • gcc 5.4.0-6ubuntu1~16.04.10

Also, no such problem observed on AMD64 architecture, same parameters as above.

Also, no such problem observed on:

  • Ubuntu 14.04 x86_64
  • cmake version 2.8.12.2
  • libeigen3-dev 3.2.0-8
  • gcc 6.3.0-18ubuntu2~14.04

Link to master at the time you read this message: https://github.com/PointCloudLibrary/pcl/blob/master/registration/include/pcl/registration/impl/ndt_2d.hpp#L439

Next step

  • Hypothesis: eigen evolved, removing need for such a patch?
  • Does this suggest just closing the issue?

@rimmartin
Copy link
Author

rimmartin commented Oct 30, 2018

Hi,

I made a small unit test in a second project of mine:

    Eigen::Matrix<double, 3, 3> hessian = Eigen::Matrix<double, 3, 3>::Identity ();
    double lambda = -1;
    hessian += Eigen::Vector3d (-lambda, -lambda, -lambda).asDiagonal ();
    std::cout<<hessian<<std::endl;

result:

2 0 0
0 2 0
0 0 2

It does appear eigen added a += that knows what a diagonal is from the right side and alters the diagonal of the matrix on the left

Thank you, this can be closed

@taketwo
Copy link
Member

taketwo commented Nov 5, 2018

Thanks for digging this up and updating us.

@taketwo taketwo closed this as completed Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants