MCPcopy Create free account
hub / github.com/ceres-solver/ceres-solver / TEST

Function TEST

internal/ceres/program_test.cc:84–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82class TernaryCostFunction : public MockCostFunctionBase<2, 1, 1, 1> {};
83
84TEST(Program, RemoveFixedBlocksNothingConstant) {
85 ProblemImpl problem;
86 double x;
87 double y;
88 double z;
89
90 problem.AddParameterBlock(&x, 1);
91 problem.AddParameterBlock(&y, 1);
92 problem.AddParameterBlock(&z, 1);
93 problem.AddResidualBlock(new UnaryCostFunction(), nullptr, &x);
94 problem.AddResidualBlock(new BinaryCostFunction(), nullptr, &x, &y);
95 problem.AddResidualBlock(new TernaryCostFunction(), nullptr, &x, &y, &z);
96
97 std::vector<double*> removed_parameter_blocks;
98 double fixed_cost = 0.0;
99 std::string message;
100 std::unique_ptr<Program> reduced_program(
101 problem.program().CreateReducedProgram(
102 &removed_parameter_blocks, &fixed_cost, &message));
103
104 EXPECT_EQ(reduced_program->NumParameterBlocks(), 3);
105 EXPECT_EQ(reduced_program->NumResidualBlocks(), 3);
106 EXPECT_EQ(removed_parameter_blocks.size(), 0);
107 EXPECT_EQ(fixed_cost, 0.0);
108}
109
110TEST(Program, RemoveFixedBlocksAllParameterBlocksConstant) {
111 ProblemImpl problem;

Callers

nothing calls this directly

Calls 15

CreateReducedProgramMethod · 0.80
getMethod · 0.80
mutable_valuesMethod · 0.80
set_num_nonzerosMethod · 0.80
IsFeasibleMethod · 0.80
AddParameterBlockMethod · 0.45
AddResidualBlockMethod · 0.45
NumParameterBlocksMethod · 0.45

Tested by

no test coverage detected