Skip to content

Commit e755ea3

Browse files
committed
try to fix unresolved external symbol error
and dividing by zero problem
1 parent 9712acd commit e755ea3

6 files changed

Lines changed: 34 additions & 29 deletions

File tree

cmake/dllexport.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131

3232
// Whether GTSAM is compiled as static or DLL in windows.
3333
// This will be used to decide whether include __declspec(dllimport) or not in headers
34-
#cmakedefine GTSAM_SHARED_LIB
34+
#cmakedefine01 GTSAM_SHARED_LIB
3535

3636
#ifdef _WIN32
37-
# ifndef GTSAM_SHARED_LIB
37+
# if !GTSAM_SHARED_LIB
3838
# define @library_name@_EXPORT
3939
# define @library_name@_EXTERN_EXPORT extern
4040
# else

gtsam/geometry/SO3.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,21 +386,6 @@ Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H) {
386386
}
387387

388388
//******************************************************************************
389-
template <>
390-
GTSAM_EXPORT
391-
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const {
392-
const Matrix3& R = matrix_;
393-
if (H) {
394-
H->setZero();
395-
H->block<3, 1>(0, 1) = -R.col(2);
396-
H->block<3, 1>(0, 2) = R.col(1);
397-
H->block<3, 1>(3, 0) = R.col(2);
398-
H->block<3, 1>(3, 2) = -R.col(0);
399-
H->block<3, 1>(6, 0) = -R.col(1);
400-
H->block<3, 1>(6, 1) = R.col(0);
401-
}
402-
return Eigen::Map<const Vector9>(R.data());
403-
}
404389
//******************************************************************************
405390

406391
} // end namespace gtsam

gtsam/geometry/SO3.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,22 @@ template <>
9999
GTSAM_EXPORT
100100
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const;
101101

102+
template <>
103+
GTSAM_EXPORT
104+
inline Vector9 SO3::vec(OptionalJacobian<9, 3> H) const {
105+
const Matrix3& R = matrix_;
106+
if (H) {
107+
H->setZero();
108+
H->block<3, 1>(0, 1) = -R.col(2);
109+
H->block<3, 1>(0, 2) = R.col(1);
110+
H->block<3, 1>(3, 0) = R.col(2);
111+
H->block<3, 1>(3, 2) = -R.col(0);
112+
H->block<3, 1>(6, 0) = -R.col(1);
113+
H->block<3, 1>(6, 1) = R.col(0);
114+
}
115+
return Eigen::Map<const Vector9>(R.data());
116+
}
117+
102118
#if GTSAM_ENABLE_BOOST_SERIALIZATION
103119
template <class Archive>
104120
/** Serialization function */

gtsam/geometry/SO4.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,6 @@ Matrix4 SO4::Hat(const Vector6& xi) {
6666
}
6767

6868
//******************************************************************************
69-
template <>
70-
GTSAM_EXPORT
71-
Vector6 SO4::Vee(const Matrix4& X) {
72-
Vector6 xi;
73-
xi(5) = -X(0, 1);
74-
xi(4) = +X(0, 2);
75-
xi(3) = -X(1, 2);
76-
xi(2) = +X(0, 3);
77-
xi(1) = -X(1, 3);
78-
xi(0) = +X(2, 3);
79-
return xi;
80-
}
8169

8270
//******************************************************************************
8371
/* Exponential map, porting MATLAB implementation by Luca, which follows

gtsam/geometry/SO4.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ GTSAM_EXPORT Matrix3 topLeft(const SO4 &Q, OptionalJacobian<9, 6> H = {});
7474
*/
7575
GTSAM_EXPORT Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = {});
7676

77+
template <>
78+
GTSAM_EXPORT
79+
inline Vector6 SO4::Vee(const Matrix4& X) {
80+
Vector6 xi;
81+
xi(5) = -X(0, 1);
82+
xi(4) = +X(0, 2);
83+
xi(3) = -X(1, 2);
84+
xi(2) = +X(0, 3);
85+
xi(1) = -X(1, 3);
86+
xi(0) = +X(2, 3);
87+
return xi;
88+
}
89+
7790
#if GTSAM_ENABLE_BOOST_SERIALIZATION
7891
template <class Archive>
7992
/** Serialization function */

gtsam/linear/NoiseModel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ namespace gtsam {
575575
* An isotropic noise model created by specifying a precision
576576
*/
577577
static shared_ptr Precision(size_t dim, double precision, bool smart = true) {
578+
if (0 == precision) {
579+
return nullptr;
580+
}
578581
return Variance(dim, 1.0/precision, smart);
579582
}
580583

0 commit comments

Comments
 (0)