Skip to content
Snippets Groups Projects
main.cpp 1.7 KiB
Newer Older
/*
 * Copyright 2014-2019, CNRS
Justin Carpentier's avatar
Justin Carpentier committed
 * Copyright 2018-2022, INRIA
#include <boost/python/scope.hpp>

#include "eigenpy/computation-info.hpp"
#include "eigenpy/decompositions/decompositions.hpp"
#include "eigenpy/eigenpy.hpp"
#include "eigenpy/geometry.hpp"
#include "eigenpy/solvers/preconditioners.hpp"
#include "eigenpy/solvers/solvers.hpp"
#include "eigenpy/std-vector.hpp"
#include "eigenpy/utils/is-approx.hpp"
#include "eigenpy/version.hpp"
jcarpent's avatar
jcarpent committed
using namespace eigenpy;
BOOST_PYTHON_MODULE(eigenpy_pywrap) {
  namespace bp = boost::python;
jcarpent's avatar
jcarpent committed
  enableEigenPy();
  bp::scope().attr("__version__") = eigenpy::printVersion();
  bp::scope().attr("__raw_version__") = bp::str(EIGENPY_VERSION);
  bp::def("checkVersionAtLeast", &eigenpy::checkVersionAtLeast,
          bp::args("major_version", "minor_version", "patch_version"),
          "Checks if the current version of EigenPy is at least the version "
          "provided by the input arguments.");
jcarpent's avatar
jcarpent committed
  exposeAngleAxis();
  exposeQuaternion();
  exposeGeometryConversion();
  exposeComputationInfo();
    bp::scope solvers = boost::python::class_<SolversScope>("solvers");
jcarpent's avatar
jcarpent committed
    exposeSolvers();
    exposePreconditioners();
    register_symbolic_link_to_registered_type<Eigen::ComputationInfo>();
  {
    using namespace Eigen;
    bp::def("is_approx",
            (bool (*)(const Eigen::MatrixBase<MatrixXd> &,
                      const Eigen::MatrixBase<MatrixXd> &, const double &)) &
                is_approx<MatrixXd, MatrixXd>,
            (bp::arg("A"), bp::arg("B"), bp::arg("prec") = 1e-12),
            "Returns True if A is approximately equal to B, within the "
            "precision determined by prec.");
  exposeDecompositions();