20 :
public boost::python::def_visitor<BDCSVDVisitor<_MatrixType>> {
21 typedef _MatrixType MatrixType;
22 typedef Eigen::BDCSVD<MatrixType> Solver;
23 typedef typename MatrixType::Scalar Scalar;
25 template <
class PyClass>
26 void visit(PyClass &cl)
const {
27 cl.def(bp::init<>(bp::arg(
"self"),
"Default constructor"))
28 .def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex,
29 bp::optional<unsigned int>>(
30 bp::args(
"self",
"rows",
"cols",
"computationOptions "),
31 "Default Constructor with memory preallocation. "))
32 .def(bp::init<MatrixType, bp::optional<unsigned int>>(
33 bp::args(
"self",
"matrix",
"computationOptions "),
34 "Constructor performing the decomposition of given matrix."))
36 .def(
"cols", &Solver::cols, bp::arg(
"self"),
37 "Returns the number of columns. ")
39 (Solver & (Solver::*)(
const MatrixType &matrix)) & Solver::compute,
40 bp::args(
"self",
"matrix"),
41 "Method performing the decomposition of given matrix. Computes " 43 "unitaries U/V if specified using the Options template parameter " 44 "or the class constructor. ",
47 (Solver & (Solver::*)(
const MatrixType &matrix,
48 unsigned int computationOptions)) &
50 bp::args(
"self",
"matrix",
"computationOptions"),
51 "Method performing the decomposition of given matrix, as " 52 "specified by the computationOptions parameter. ",
54 .def(
"rows", &Solver::rows, bp::arg(
"self"),
55 "Returns the number of rows. ")
56 .def(
"setSwitchSize", &Solver::setSwitchSize, bp::args(
"self",
"s"))
62 static const std::string classname =
63 "BDCSVD_" + scalar_name<Scalar>::shortname();
67 static void expose(
const std::string &name) {
68 bp::class_<Solver, boost::noncopyable>(
70 "Class Bidiagonal Divide and Conquer SVD.\n\n" 71 "This class first reduces the input matrix to bi-diagonal form using " 73 "UpperBidiagonalization, and then performs a divide-and-conquer " 75 "Small blocks are diagonalized using class JacobiSVD. You can control " 77 "switching size with the setSwitchSize() method, default is 16. For " 79 "(<16), it is thus preferable to directly use JacobiSVD. For larger " 81 "is highly recommended and can several order of magnitude faster.\n\n" 82 "Warming: this algorithm is unlikely to provide accurate result when " 84 "unsafe math optimizations. For instance, this concerns Intel's " 85 "compiler (ICC), which " 86 "performs such optimization by default unless you compile with the " 88 "option. Likewise, the -ffast-math option of GCC or clang will " 89 "significantly degrade the "