12 template<
typename Scalar>
46 ss <<
"value: " <<
m_value << std::endl;
55 template<
typename Scalar>
56 Eigen::Matrix<CustomType<Scalar>,Eigen::Dynamic,Eigen::Dynamic>
create(
int rows,
int cols)
58 typedef Eigen::Matrix<CustomType<Scalar>,Eigen::Dynamic,Eigen::Dynamic> Matrix;
59 return Matrix(rows,cols);
62 template<
typename Scalar>
65 typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> Matrix;
66 return Matrix(rows,cols);
69 template<
typename Scalar>
72 using namespace Eigen;
77 bp::class_<Type>(name.c_str(),bp::init<Scalar>(bp::arg(
"value")))
79 .def(bp::self + bp::self)
80 .def(bp::self - bp::self)
81 .def(bp::self * bp::self)
82 .def(bp::self / bp::self)
84 .def(bp::self += bp::self)
85 .def(bp::self -= bp::self)
86 .def(bp::self *= bp::self)
87 .def(bp::self /= bp::self)
89 .def(
"__repr__",&Type::print)
92 int code = eigenpy::registerNewType<Type>();
93 std::cout <<
"code: " << code << std::endl;
94 eigenpy::registerCommonUfunc<Type>();
99 using namespace Eigen;
103 expose_custom_type<double>(
"CustomDouble");
105 typedef Eigen::Matrix<DoubleType,Eigen::Dynamic,Eigen::Dynamic> DoubleMatrix;
107 bp::def(
"create_double",create<double>);
109 expose_custom_type<float>(
"CustomFloat");
111 typedef Eigen::Matrix<FloatType,Eigen::Dynamic,Eigen::Dynamic> FloatMatrix;
113 bp::def(
"create_float",create<float>);
115 bp::def(
"build_matrix",build_matrix<double>);
void operator/=(const CustomType &other)
void operator-=(const CustomType &other)
void operator*=(const CustomType &other)
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > build_matrix(int rows, int cols)
void operator=(const Scalar &value)
BOOST_PYTHON_MODULE(user_type)
void EIGENPY_DLLAPI enableEigenPy()
bool operator==(const CustomType &other) const
CustomType operator/(const CustomType &other) const
bool operator>(const CustomType &other) const
std::string print() const
CustomType operator-() const
bool operator>=(const CustomType &other) const
bool operator!=(const CustomType &other) const
Eigen::Matrix< CustomType< Scalar >, Eigen::Dynamic, Eigen::Dynamic > create(int rows, int cols)
bool operator<(const CustomType &other) const
CustomType(const Scalar &value)
CustomType operator-(const CustomType &other) const
CustomType operator*(const CustomType &other) const
void expose_custom_type(const std::string &name)
bool operator<=(const CustomType &other) const
CustomType operator+(const CustomType &other) const
void operator+=(const CustomType &other)
static void registration()