18  using FunctionPtr = shared_ptr<context::C2Function>;
 
   19  using PolyManifold = polymorphic<context::Manifold>;
 
   22  bp::class_<QuadraticResidualCost, bp::bases<Cost>>(
 
   23      "QuadraticResidualCost",
 
   24      "A cost which is a quadratic form :math:`\\frac 12 r(x)^\\top Wr(x) + " 
   25      "b^\\top r(x) + c` of a residual function",
 
   27      .def(bp::init<FunctionPtr, 
const ConstMatrixRef &, 
const ConstVectorRef &,
 
   28                    Scalar>((bp::arg(
"self"), bp::arg(
"residual"),
 
   29                             bp::arg(
"weights"), bp::arg(
"slope"),
 
   30                             bp::arg(
"constant") = 0.)))
 
   31      .def(bp::init<
const shared_ptr<context::C2Function> &,
 
   32                    const ConstMatrixRef &, Scalar>(
 
   33          (bp::arg(
"self"), bp::arg(
"residual"), bp::arg(
"weights"),
 
   34           bp::arg(
"constant") = 0.)))
 
   35      .def_readonly(
"residual", &QuadraticResidualCost::residual_,
 
   36                    "The underlying function residual.")
 
   38          "gauss_newton", &QuadraticResidualCost::gauss_newton_,
 
   39          "Whether to use a Gauss-Newton approximation of the Hessian.");
 
   42  bp::class_<QuadraticDistanceCost, bp::bases<QuadraticResidualCost>>(
 
   43      "QuadraticDistanceCost",
 
   44      "Quadratic distance cost `(1/2)r.T * Q * r + b.T * r + c` on the " 
   46      bp::init<PolyManifold, const VectorXs &, const MatrixXs &>(
 
   47          bp::args(
"self", 
"space", 
"target", 
"weights")))
 
   48      .def(bp::init<PolyManifold, const VectorXs &>(
 
   49          bp::args(
"self", 
"space", 
"target")))
 
   50      .def(bp::init<PolyManifold>(
 
   51          "Constructor which uses the neutral element of the space.",
 
   52          bp::args(
"self", 
"space")))
 
   53      .add_property(
"target", &QuadraticDistanceCost::getTarget,
 
   54                    &QuadraticDistanceCost::updateTarget);