19 :
public boost::python::def_visitor<
20 GeneralizedEigenSolverVisitor<_MatrixType>> {
21 typedef _MatrixType MatrixType;
22 typedef typename MatrixType::Scalar Scalar;
23 typedef Eigen::GeneralizedEigenSolver<MatrixType> Solver;
25 template <
class PyClass>
26 void visit(PyClass& cl)
const {
27 cl.def(bp::init<>(
"Default constructor"))
28 .def(bp::init<Eigen::DenseIndex>(
29 bp::arg(
"size"),
"Default constructor with memory preallocation. "))
30 .def(bp::init<MatrixType, MatrixType, bp::optional<bool>>(
31 bp::args(
"A",
"B",
"computeEigenVectors"),
32 "Computes the generalized eigendecomposition of given matrix " 35 .def(
"eigenvectors", &Solver::eigenvectors, bp::arg(
"self"),
36 "Returns an expression of the computed generalized eigenvectors. ")
39 +[](
const Solver& c) {
return c.eigenvalues().eval(); },
40 "Returns the computed generalized eigenvalues.")
42 .def(
"alphas", &Solver::alphas, bp::arg(
"self"),
43 "Returns the vectors containing the alpha values. ",
44 bp::return_value_policy<bp::return_by_value>())
45 .def(
"betas", &Solver::betas, bp::arg(
"self"),
46 "Returns the vectors containing the beta values. ",
47 bp::return_value_policy<bp::return_by_value>())
50 &GeneralizedEigenSolverVisitor::compute_proxy<MatrixType>,
51 bp::args(
"self",
"A",
"B"),
52 "Computes generalized eigendecomposition of given matrix. ",
56 (Solver::*)(
const MatrixType& A,
const MatrixType& B,
bool)) &
58 bp::args(
"self",
"A",
"B",
"computeEigenvectors"),
59 "Computes generalized eigendecomposition of given matrix. .",
62 .def(
"info", &Solver::info, bp::arg(
"self"),
63 "NumericalIssue if the input contains INF or NaN values or " 64 "overflow occured. Returns Success otherwise.")
66 .def(
"setMaxIterations", &Solver::setMaxIterations,
67 bp::args(
"self",
"max_iter"),
68 "Sets the maximum number of iterations allowed.",
73 static const std::string classname =
74 "GeneralizedEigenSolver" + scalar_name<Scalar>::shortname();
78 static void expose(
const std::string& name) {
79 bp::class_<Solver>(name.c_str(), bp::no_init)
85 template <
typename MatrixType>
86 static Solver& compute_proxy(Solver& self,
const MatrixType& A,
87 const MatrixType& B) {
88 return self.compute(A, B);