12 template <
typename Scalar>
18 template <
typename Scalar>
33 RequireInitialization = 1,
56 static int digits10() {
return std::numeric_limits<Scalar>::digits10; }
60 template <
typename Scalar>
87 return m_value == other.
m_value;
90 return m_value != other.
m_value;
94 return m_value <= other.
m_value;
100 return m_value >= other.
m_value;
103 return m_value > other.
m_value;
108 operator Scalar()
const {
return m_value; }
111 std::stringstream ss;
112 ss <<
"value: " << m_value << std::endl;
126 template <
typename Scalar>
127 Eigen::Matrix<CustomType<Scalar>, Eigen::Dynamic, Eigen::Dynamic>
create(
129 typedef Eigen::Matrix<CustomType<Scalar>, Eigen::Dynamic, Eigen::Dynamic>
131 return Matrix(rows, cols);
134 template <
typename Scalar>
136 Eigen::Dynamic>&
mat) {
137 std::cout <<
mat << std::endl;
140 template <
typename Scalar>
143 typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> Matrix;
144 return Matrix(rows, cols);
147 template <
typename Scalar>
149 using namespace Eigen;
154 bp::class_<Type>(name.c_str(), bp::init<Scalar>(bp::arg(
"value")))
156 .def(bp::self + bp::self)
157 .def(bp::self - bp::self)
158 .def(bp::self * bp::self)
159 .def(bp::self / bp::self)
161 .def(bp::self += bp::self)
162 .def(bp::self -= bp::self)
163 .def(bp::self *= bp::self)
164 .def(bp::self /= bp::self)
168 int code = eigenpy::registerNewType<Type>();
169 std::cout <<
"code: " << code << std::endl;
170 eigenpy::registerCommonUfunc<Type>();
174 using namespace Eigen;
178 expose_custom_type<double>(
"CustomDouble");
180 typedef Eigen::Matrix<DoubleType, Eigen::Dynamic, Eigen::Dynamic>
184 bp::def(
"create_double", create<double>);
186 expose_custom_type<float>(
"CustomFloat");
188 typedef Eigen::Matrix<FloatType, Eigen::Dynamic, Eigen::Dynamic> FloatMatrix;
191 bp::def(
"create_float", create<float>);
193 bp::def(
"build_matrix", build_matrix<double>);
194 #if EIGEN_VERSION_AT_LEAST(3, 3, 0) 195 bp::def(
"print", print<double>);
196 bp::def(
"print", print<float>);
199 eigenpy::registerCast<DoubleType, double>(
true);
200 eigenpy::registerCast<double, DoubleType>(
true);
201 eigenpy::registerCast<DoubleType, int>(
false);
202 eigenpy::registerCast<int, DoubleType>(
true);
203 eigenpy::registerCast<DoubleType, long long>(
false);
204 eigenpy::registerCast<long long, DoubleType>(
true);
205 eigenpy::registerCast<DoubleType, long>(
false);
206 eigenpy::registerCast<long, DoubleType>(
true);
207 eigenpy::registerCast<FloatType, double>(
true);
208 eigenpy::registerCast<double, FloatType>(
false);
209 eigenpy::registerCast<FloatType, long long>(
false);
210 eigenpy::registerCast<long long, FloatType>(
true);
211 eigenpy::registerCast<FloatType, int>(
false);
212 eigenpy::registerCast<int, FloatType>(
true);
213 eigenpy::registerCast<FloatType, long>(
false);
214 eigenpy::registerCast<long, FloatType>(
true);
216 bp::implicitly_convertible<double, DoubleType>();
217 bp::implicitly_convertible<DoubleType, double>();
void operator/=(const CustomType &other)
void operator-=(const CustomType &other)
void operator*=(const CustomType &other)
CustomType< Scalar > NonInteger
CustomType operator/(const CustomType &other) const
bool operator>(const CustomType &other) const
Eigen::Matrix< CustomType< Scalar >, Eigen::Dynamic, Eigen::Dynamic > create(int rows, int cols)
CustomType operator+(const CustomType &other) const
void print(const Eigen::Matrix< CustomType< Scalar >, Eigen::Dynamic, Eigen::Dynamic > &mat)
void operator=(const Scalar &value)
bool operator>=(const CustomType &other) const
BOOST_PYTHON_MODULE(user_type)
void EIGENPY_DLLAPI enableEigenPy()
bool operator<=(const CustomType &other) const
bool operator<(const CustomType &other) const
static CustomType< Scalar > epsilon()
static CustomType< Scalar > lowest()
static CustomType< Scalar > dummy_precision()
CustomType operator-(const CustomType &other) const
CustomType operator*(const CustomType &other) const
friend std::ostream & operator<<(std::ostream &os, const CustomType &X)
CustomType< Scalar > Nested
bool operator!=(const CustomType &other) const
CustomType(const Scalar &value)
CustomType operator-() const
static CustomType< Scalar > highest()
std::string print() const
void expose_custom_type(const std::string &name)
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > build_matrix(int rows, int cols)
bool operator==(const CustomType &other) const
CustomType< Scalar > Literal
CustomType< Scalar > Real
void operator+=(const CustomType &other)
static void registration()