artivis / manif

A small C++11 header-only library for Lie theory.
https://artivis.github.io/manif
MIT License
1.46k stars 239 forks source link

replaced ::Constant(0) with ::Zero() due to ceres::Jet compile error #271

Closed willat343 closed 1 year ago

willat343 commented 1 year ago

I encountered the following compilation error when use the hat operator of the Rn group with ceres:

/usr/local/include/manif/impl/rn/RnTangent_base.h:125:34: error: no matching function for call to ‘Eigen::Matrix<ceres::Jet<double, 4>, 4, 4, 0, 4, 4>::Constant(int)’
  125 |   LieAlg t_hat = LieAlg::Constant(0);

I fixed this by replacing ::Constant(0) with ::Zero(). An alternative fix I think is to use ::Constant(Scalar(0)). I chose the former because ::Zero() is much more common in the codebase than ::Constant(Scalar(n)).

I noticed 3 instances of ::Constant(Scalar(1)) in the code, in the SO2 base and tangent base classes. It would make sense to replace these with ::Ones() but I have not included that in this pull request.

artivis commented 1 year ago

Thanks for those fixes :+1: .

artivis commented 1 year ago

@willat343 could you please rebase your pr on top of devel ? Thanks.

willat343 commented 1 year ago

@artivis I think I have done so

codecov[bot] commented 1 year ago

Codecov Report

Merging #271 (9dedec1) into devel (08719cb) will increase coverage by 0.16%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##            devel     #271      +/-   ##
==========================================
+ Coverage   97.96%   98.12%   +0.16%     
==========================================
  Files          55       55              
  Lines        1817     1817              
==========================================
+ Hits         1780     1783       +3     
+ Misses         37       34       -3