install

install by apt

install on ubuntu20

sudo apt install libceres-dev

install from source

enable eigen_metis during ceres compilation

prerequisites

  1. Ceres version ≥ 2.1.0 (METIS support added in 2.1).
  2. Eigen ≥ 3.3.0
  3. METIS library installed (required by EIGEN_METIS).

Add configuration to compilation: -DEIGENSPARSE=ON, -DEIGEN_METIS=ON.

enable cuda

Prerequisites

  1. CUDA Toolkit ≥ 9.0
  2. CMake ≥ 3.5
  3. g++ ≥ 7

Add configuration to compilation: -DCERES_USE_CUDA=ON

In the CMake output (or CMakeCache.txt), ensure:

-- CUDA support     : YES

check ceres

check version of ceres

sudo cat /usr/local/include/ceres/version.h
Problem problem;

// Add residual terms to the problem using the autodiff wrapper to get the derivatives automatically.
problem.AddResidualBlock(new AutoDiffCostFunction<F1, 1, 1, 1>(new F1), nullptr, &x1, &x2);
// AutoDiffCostFunction<函数,残差的数量,第一个参数块,第二个参数块>

###