diff --git a/_pyceres/core/problem.h b/_pyceres/core/problem.h index 54131f5..10d7627 100644 --- a/_pyceres/core/problem.h +++ b/_pyceres/core/problem.h @@ -42,13 +42,15 @@ void BindProblem(py::module& m) { py::class_(m, "EvaluateOptions") .def(py::init<>()) - .def("set_parameter_blocks", [](ceres::Problem::EvaluateOptions& self, std::vector>& blocks) { - self.parameter_blocks.clear(); - for (auto it = blocks.begin(); it != blocks.end(); ++it) { - py::buffer_info info = it->request(); - self.parameter_blocks.push_back(static_cast(info.ptr)); - } - }) + .def("set_parameter_blocks", + [](ceres::Problem::EvaluateOptions& self, + std::vector>& blocks) { + self.parameter_blocks.clear(); + for (auto it = blocks.begin(); it != blocks.end(); ++it) { + py::buffer_info info = it->request(); + self.parameter_blocks.push_back(static_cast(info.ptr)); + } + }) .def_readwrite("apply_loss_function", &ceres::Problem::EvaluateOptions::apply_loss_function) .def_readwrite("num_threads", @@ -238,20 +240,22 @@ void BindProblem(py::module& m) { [](ceres::Problem& self, ResidualBlockIDWrapper& residual_block_id) { self.RemoveResidualBlock(residual_block_id.id); }) - .def("evaluate_residuals", + .def( + "evaluate_residuals", [](ceres::Problem& self, - const ceres::Problem::EvaluateOptions& options) { - std::vector residuals; - self.Evaluate(options, nullptr, &residuals, nullptr, nullptr); - return residuals; - }, - py::arg("options") = ceres::Problem::EvaluateOptions()) - .def("evaluate_jacobian", - [](ceres::Problem& self, - const ceres::Problem::EvaluateOptions& options) { - ceres::CRSMatrix jacobian; - self.Evaluate(options, nullptr, nullptr, nullptr, &jacobian); - return jacobian; - }, - py::arg("options") = ceres::Problem::EvaluateOptions()); + const ceres::Problem::EvaluateOptions& options) { + std::vector residuals; + self.Evaluate(options, nullptr, &residuals, nullptr, nullptr); + return residuals; + }, + py::arg("options") = ceres::Problem::EvaluateOptions()) + .def( + "evaluate_jacobian", + [](ceres::Problem& self, + const ceres::Problem::EvaluateOptions& options) { + ceres::CRSMatrix jacobian; + self.Evaluate(options, nullptr, nullptr, nullptr, &jacobian); + return jacobian; + }, + py::arg("options") = ceres::Problem::EvaluateOptions()); }