GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/core/activations/quadratic-float.cpp
Date: 2025-04-18 16:41:15
Exec Total Coverage
Lines: 0 6 0.0%
Branches: 0 22 0.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2025, LAAS-CNRS, University of Edinburgh
5 // Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // Auto-generated file for float
11 #include "crocoddyl/core/activations/quadratic.hpp"
12
13 #include "python/crocoddyl/core/activation-base.hpp"
14 #include "python/crocoddyl/core/core.hpp"
15
16 namespace crocoddyl {
17 namespace python {
18
19 template <typename Model>
20 struct ActivationModelQuadVisitor
21 : public bp::def_visitor<ActivationModelQuadVisitor<Model>> {
22 typedef typename Model::Scalar Scalar;
23 template <class PyClass>
24 void visit(PyClass& cl) const {
25 cl.def("calc", &Model::calc, bp::args("self", "data", "r"),
26 "Compute the 0.5 * ||r||^2.\n\n"
27 ":param data: activation data\n"
28 ":param r: residual vector")
29 .def("calcDiff", &Model::calcDiff, bp::args("self", "data", "r"),
30 "Compute the derivatives of a quadratic function.\n\n"
31 "Note that the Hessian is constant, so we don't write again this "
32 "value.\n"
33 "It assumes that calc has been run first.\n"
34 ":param data: activation data\n"
35 ":param r: residual vector \n")
36 .def("createData", &Model::createData, bp::args("self"),
37 "Create the quadratic activation data.\n\n");
38 }
39 };
40
41 #define CROCODDYL_ACTIVATION_MODEL_QUAD_PYTHON_BINDINGS(Scalar) \
42 typedef ActivationModelQuadTpl<Scalar> Model; \
43 typedef ActivationModelAbstractTpl<Scalar> ModelBase; \
44 bp::register_ptr_to_python<std::shared_ptr<Model>>(); \
45 bp::class_<Model, bp::bases<ModelBase>>( \
46 "ActivationModelQuad", \
47 "Quadratic activation model.\n\n" \
48 "A quadratic action describes a quadratic function that depends on the " \
49 "residual, i.e., 0.5 *||r||^2.", \
50 bp::init<std::size_t>( \
51 bp::args("self", "nr"), \
52 "Initialize the activation model.\n\n" \
53 ":param nr: dimension of the cost-residual vector")) \
54 .def(ActivationModelQuadVisitor<Model>()) \
55 .def(CastVisitor<Model>()) \
56 .def(PrintableVisitor<Model>()) \
57 .def(CopyableVisitor<Model>());
58
59 void exposeActivationQuad() {
60 CROCODDYL_ACTIVATION_MODEL_QUAD_PYTHON_BINDINGS(float)
61 }
62
63 } // namespace python
64 } // namespace crocoddyl
65