ethz-asl/aslam_optimizer

Code never executed in ErrorTermTests

Closed this issue · 1 comments

ErrorTermTests.cpp seems to have a piece of code that never gets executed:

using namespace aslam::backend;
  int D = 4;
  int E = 6;
  std::vector<DesignVariable*> dvs;
  std::vector<ErrorTerm*> errs;
  try {
    std::vector<int> blocks;
    int block = 0;
    for (size_t i = 0; i < errs.size(); ++i) {
      block += errs[i]->dimension();
      blocks.push_back(block);
      boost::shared_ptr<GemanMcClureMEstimator> me(new GemanMcClureMEstimator(errs[i]->getRawSquaredError()));
    }

errs is of size 0, so the for-loop is never executed. I just noticed it while adding a test, I don't know whether it has any effect on the result of the test.

You mean this :

for (size_t i = 0; i < errs.size(); ++i) {
block += errs[i]->dimension();
blocks.push_back(block);
boost::shared_ptr<GemanMcClureMEstimator> me(new GemanMcClureMEstimator(errs[i]->getRawSquaredError()));
}
. Yes that look wired. Good catch! I'm on it :).