added missing square matrix specialization - without it, square to square cases would be ambiguous.

release/4.3a0
HannesSommer 2014-11-10 16:35:23 +01:00
parent 00765d9bf3
commit fed2c8b684
2 changed files with 18 additions and 0 deletions

View File

@ -303,6 +303,15 @@ struct Reshape {
}
};
/// Reshape specialization that does nothing as shape stays the same (needed to not be ambiguous for square input equals square output)
template <int M, int InOptions>
struct Reshape<M, M, M, M, InOptions> {
typedef const Eigen::Matrix<double, M, M, InOptions> & ReshapedType;
static inline ReshapedType reshape(const Eigen::Matrix<double, M, M, InOptions> & in) {
return in;
}
};
/// Reshape specialization that does nothing as shape stays the same
template <int M, int N, int InOptions>
struct Reshape<M, N, M, N, InOptions> {

View File

@ -96,6 +96,15 @@ TEST(Manifold, DefaultChart) {
EXPECT(chart.retract(m, Vector2(1, 2)) == 2 * m);
}
{
typedef Eigen::Matrix<double, 1, 1> ManifoldPoint;
ManifoldPoint m;
DefaultChart<ManifoldPoint> chart;
m << 1;
EXPECT(assert_equal(Vector(ManifoldPoint::Ones()), Vector(chart.local(ManifoldPoint::Zero(), m))));
EXPECT(chart.retract(m, ManifoldPoint::Ones()) == 2 * m);
}
DefaultChart<double> chart3;
Vector v1(1);
v1 << 1;