当我在 ceres 求解器教程中运行以下代码时,我遇到了一些问题。
这是代码:
#include <iostream>
#include "ceres/ceres.h"
#include "glog/logging.h"
using ceres::AutoDiffCostFunction;
using ceres::CostFunction;
using ceres::Problem;
using ceres::Solve;
using ceres::Solver;
struct CostFunctor {
template <typename T>
bool operator()(const T* const x, T* residual) const {
residual[0] = 10.0 - x[0];
return true;
}
};
int main(int argc, char *argv[])
{
double x = 0.5;
const double initial_x = x;
Problem problem;
CostFunction* cost_function =
new AutoDiffCostFunction<CostFunctor, 1, 1>(new CostFunctor);
problem.AddResidualBlock(cost_function, nullptr, &x);
Solver::Options options;
options.minimizer_progress_to_stdout = true;
Solver::Summary summary;
Solve(options, &problem, &summary);
std::cout << summary.BriefReport() << "\n";
std::cout << "x : " << initial_x << " -> " << x << "\n";
}
我遇到了问题:
E:\study_materials\Computer Version\ceres\ceres-solver-2.0.0\internal\ceres\solver.cc:505 Terminating: Can't use SPARSE_NORMAL_CHOLESKY with Solver::Options::sparse_linear_algebra_library_type = SUITE_SPARSE, because support was not enabled when Ceres Solver was built.
我不知道如何启用此支持,任何帮助将不胜感激。