20 :
public boost::python::def_visitor<JacobiSVDVisitor<JacobiSVD>> {
21 typedef typename JacobiSVD::MatrixType MatrixType;
22 typedef typename MatrixType::Scalar Scalar;
24 template <
class PyClass>
25 void visit(PyClass &cl)
const {
26 cl.def(bp::init<>(bp::arg(
"self"),
"Default constructor"))
27 .def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex,
28 bp::optional<unsigned int>>(
29 bp::args(
"self",
"rows",
"cols",
"computationOptions "),
30 "Default Constructor with memory preallocation."))
31 .def(bp::init<MatrixType, bp::optional<unsigned int>>(
32 bp::args(
"self",
"matrix",
"computationOptions "),
33 "Constructor performing the decomposition of given matrix."))
35 .def(
"cols", &JacobiSVD::cols, bp::arg(
"self"),
36 "Returns the number of columns. ")
38 (JacobiSVD & (JacobiSVD::*)(
const MatrixType &matrix)) &
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 (JacobiSVD & (JacobiSVD::*)(
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", &JacobiSVD::rows, bp::arg(
"self"),
55 "Returns the number of rows.")
61 static const std::string classname =
62 "JacobiSVD_" + scalar_name<Scalar>::shortname();
66 static void expose(
const std::string &name) {
67 bp::class_<JacobiSVD, boost::noncopyable>(
69 "Two-sided Jacobi SVD decomposition of a rectangular matrix. \n\n" 70 "SVD decomposition consists in decomposing any n-by-p matrix A as a " 72 "A=USV∗ where U is a n-by-n unitary, V is a p-by-p unitary, and S is a " 74 "eal positive matrix which is zero outside of its main diagonal; the " 76 "entries of S are known as the singular values of A and the columns of " 78 "are known as the left and right singular vectors of A respectively. " 80 "Singular values are always sorted in decreasing order. \n\n " 81 "This JacobiSVD decomposition computes only the singular values by " 83 "If you want U or V, you need to ask for them explicitly. \n\n" 84 "You can ask for only thin U or V to be computed, meaning the " 86 "In case of a rectangular n-by-p matrix, letting m be the smaller " 88 "n and p, there are only m singular vectors; the remaining columns of " 90 "do not correspond to actual singular vectors. Asking for thin U or V " 92 "for only their m first columns to be formed. So U is then a n-by-m " 94 "is then a p-by-m matrix. Notice that thin U and V are all you need " 95 "for (least squares) "