mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Add static/compile time sizing to EuclideanManifold
This brings it in line with other manifolds like SphereManifold and LineManifold, where the user has the choice to specify the size of the manifold at compile time or runtime. Most of the time the size is known at compile time so this will speed up the common case. Change-Id: I0c7ff8b7a9a64a81203eb11afc074874e208815a
This commit is contained in:
@@ -67,7 +67,6 @@ class UnaryCostFunction : public CostFunction {
|
||||
mutable_parameter_block_sizes()->push_back(parameter_block_size);
|
||||
}
|
||||
|
||||
|
||||
bool Evaluate(double const* const* parameters,
|
||||
double* residuals,
|
||||
double** jacobians) const final {
|
||||
@@ -595,7 +594,7 @@ TEST(Problem, SetManifoldWithUnknownPtrDies) {
|
||||
Problem problem;
|
||||
problem.AddParameterBlock(x, 3);
|
||||
|
||||
EXPECT_DEATH_IF_SUPPORTED(problem.SetManifold(y, new EuclideanManifold(3)),
|
||||
EXPECT_DEATH_IF_SUPPORTED(problem.SetManifold(y, new EuclideanManifold<3>),
|
||||
"Parameter block not found:");
|
||||
}
|
||||
|
||||
@@ -632,7 +631,7 @@ TEST(Problem, GetManifold) {
|
||||
problem.AddParameterBlock(x, 3);
|
||||
problem.AddParameterBlock(y, 2);
|
||||
|
||||
Manifold* manifold = new EuclideanManifold(3);
|
||||
Manifold* manifold = new EuclideanManifold<3>;
|
||||
problem.SetManifold(x, manifold);
|
||||
EXPECT_EQ(problem.GetManifold(x), manifold);
|
||||
EXPECT_TRUE(problem.GetManifold(y) == nullptr);
|
||||
@@ -660,7 +659,7 @@ TEST(Problem, HasManifold) {
|
||||
problem.AddParameterBlock(x, 3);
|
||||
problem.AddParameterBlock(y, 2);
|
||||
|
||||
Manifold* manifold = new EuclideanManifold(3);
|
||||
Manifold* manifold = new EuclideanManifold<3>;
|
||||
problem.SetManifold(x, manifold);
|
||||
EXPECT_TRUE(problem.HasManifold(x));
|
||||
EXPECT_FALSE(problem.HasManifold(y));
|
||||
|
||||
Reference in New Issue
Block a user