Skip to content

Commit d8c0ca3

Browse files
committed
Fix (final?) issue on clang4.0, add ceres test
1 parent c60488f commit d8c0ca3

File tree

4 files changed

+53
-18
lines changed

4 files changed

+53
-18
lines changed

include/manif/impl/composite/Composite.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,6 @@ Composite<_Scalar, _T...>::coeffs() const
173173
return data_;
174174
}
175175

176-
} // namespace manif
176+
} // namespace manif
177177

178-
#endif // _MANIF_MANIF_COMPOSITE_H_
178+
#endif // _MANIF_MANIF_COMPOSITE_H_

include/manif/impl/composite/Composite_properties.h

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ struct intseq
3333

3434
// join two intseqs
3535
template<typename _Seq1, typename _Seq2>
36-
struct intseq_join;
36+
struct intseq_join
37+
{
38+
using type = std::false_type;
39+
};
3740

3841
template<typename _Int, template<typename, _Int ...> class _IntSeq, _Int ... _I1, _Int ... _I2>
3942
struct intseq_join<_IntSeq<_Int, _I1...>, _IntSeq<_Int, _I2...>>
@@ -47,28 +50,28 @@ using intseq_join_t = typename intseq_join<_Seq1, _Seq2>::type;
4750

4851
// create intseq of given length
4952
template<typename _Int, size_t _N>
50-
struct make_intseq;
53+
struct make_intseq
54+
{
55+
using type =
56+
typename intseq_join<typename make_intseq<_Int, _N - 1>::type, intseq<_Int, _N - 1>>::type;
57+
};
5158

5259
template<typename _Int>
5360
struct make_intseq<_Int, 0>
5461
{
5562
using type = intseq<_Int>;
5663
};
5764

58-
template<typename _Int, size_t _N>
59-
struct make_intseq
60-
{
61-
using type =
62-
typename intseq_join<typename make_intseq<_Int, _N - 1>::type, intseq<_Int, _N - 1>>::type;
63-
};
64-
6565
template<typename _Int, size_t _N>
6666
using make_intseq_t = typename make_intseq<_Int, _N>::type;
6767

6868

6969
// extract element from integer sequence
7070
template<size_t _Idx, typename _Seq>
71-
struct intseq_element;
71+
struct intseq_element
72+
{
73+
static constexpr typename _Seq::value_type value = 0;
74+
};
7275

7376
template<typename _Int, template<typename, _Int ...> class _IntSeq, _Int _I, _Int ... _Is>
7477
struct intseq_element<0, _IntSeq<_Int, _I, _Is...>>
@@ -79,9 +82,7 @@ struct intseq_element<0, _IntSeq<_Int, _I, _Is...>>
7982
template<
8083
typename _Int,
8184
template<typename, _Int ...> class _IntSeq,
82-
_Int _I,
83-
_Int ... _Is,
84-
size_t _Idx>
85+
_Int _I, _Int ... _Is, size_t _Idx>
8586
struct intseq_element<_Idx, _IntSeq<_Int, _I, _Is...>>
8687
{
8788
static constexpr _Int value = intseq_element<_Idx - 1, _IntSeq<_Int, _Is...>>::value;
@@ -94,7 +95,10 @@ struct intseq_element<_Idx, _IntSeq<_Int, _I, _Is...>>
9495

9596
// sum an integer sequence
9697
template<typename _Seq>
97-
struct intseq_sum;
98+
struct intseq_sum
99+
{
100+
static constexpr typename _Seq::value_type value = 0;
101+
};
98102

99103
template<typename _Int, template<typename, _Int ...> class _IntSeq>
100104
struct intseq_sum<_IntSeq<_Int>>
@@ -115,7 +119,10 @@ struct intseq_sum<_IntSeq<_Int, I, Is...>>
115119

116120
// prefix-sum an integer sequence
117121
template<typename _Int, typename _Collected, typename _Remaining, _Int Sum>
118-
struct intseq_psum_impl;
122+
struct intseq_psum_impl
123+
{
124+
using type = std::false_type;
125+
};
119126

120127
template<
121128
typename _Int,
@@ -134,7 +141,10 @@ struct intseq_psum_impl<_Int, _IntSeq<_Int, _Cur...>, _IntSeq<_Int, _First, _Rem
134141
{};
135142

136143
template<class _Seq>
137-
struct intseq_psum;
144+
struct intseq_psum
145+
{
146+
using type = std::false_type;
147+
};
138148

139149
template<typename _Int, template<typename, _Int ...> class _IntSeq, _Int ... _I>
140150
struct intseq_psum<_IntSeq<_Int, _I...>>

test/ceres/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ manif_add_gtest(gtest_so3_ceres gtest_so3_ceres.cpp)
99

1010
manif_add_gtest(gtest_se3_ceres gtest_se3_ceres.cpp)
1111

12+
manif_add_gtest(gtest_composite_ceres gtest_composite_ceres.cpp)
13+
1214
set(CXX_11_TEST_TARGETS_CERES
1315
# SO2
1416
gtest_so2_ceres
@@ -22,6 +24,9 @@ set(CXX_11_TEST_TARGETS_CERES
2224

2325
# SE3
2426
gtest_se3_ceres
27+
28+
# Composite
29+
gtest_composite_ceres
2530
)
2631

2732
foreach(target ${CXX_11_TEST_TARGETS_CERES})
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "manif/Composite.h"
2+
#include "manif/Rn.h"
3+
#include "manif/SO2.h"
4+
#include "manif/SO3.h"
5+
6+
#include "ceres_test_utils.h"
7+
8+
#include <ceres/ceres.h>
9+
10+
using namespace manif;
11+
12+
using Group = Composite<double, SO3, R3, SO2, R2>;
13+
14+
MANIF_TEST_JACOBIANS_CERES(Group);
15+
16+
int main(int argc, char** argv)
17+
{
18+
testing::InitGoogleTest(&argc, argv);
19+
return RUN_ALL_TESTS();
20+
}

0 commit comments

Comments
 (0)