8 #ifndef _PyImathMatrix_h_
9 #define _PyImathMatrix_h_
12 #define HBOOST_BIND_GLOBAL_PLACEHOLDERS
13 #include <hboost/python.hpp>
20 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Matrix22<T> >
register_Matrix22();
21 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Matrix33<T> >
register_Matrix33();
22 template <
class T> hboost::python::class_<IMATH_NAMESPACE::Matrix44<T> >
register_Matrix44();
23 template <
class T> hboost::python::class_<FixedArray<IMATH_NAMESPACE::Matrix44<T> > >
register_M44Array();
24 template <
class T> hboost::python::class_<FixedArray<IMATH_NAMESPACE::Matrix33<T> > >
register_M33Array();
25 template <
class T> hboost::python::class_<FixedArray<IMATH_NAMESPACE::Matrix22<T> > >
register_M22Array();
45 static PyObject *
wrap (
const IMATH_NAMESPACE::Matrix22<T> &m);
46 static int convert (PyObject *p, IMATH_NAMESPACE::Matrix22<T> *m);
52 static PyObject *
wrap (
const IMATH_NAMESPACE::Matrix33<T> &m);
53 static int convert (PyObject *p, IMATH_NAMESPACE::Matrix33<T> *m);
59 static PyObject *
wrap (
const IMATH_NAMESPACE::Matrix44<T> &m);
60 static int convert (PyObject *p, IMATH_NAMESPACE::Matrix44<T> *m);
67 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Matrix22<T> >
::type converter;
68 PyObject *p = converter (m);
76 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Matrix33<T> >
::type converter;
77 PyObject *p = converter (m);
85 typename hboost::python::return_by_value::apply < IMATH_NAMESPACE::Matrix44<T> >
::type converter;
86 PyObject *p = converter (m);
94 hboost::python::extract <IMATH_NAMESPACE::M22f> extractorMf (p);
95 if (extractorMf.check())
102 hboost::python::extract <IMATH_NAMESPACE::M22d> extractorMd (p);
103 if (extractorMd.check())
117 hboost::python::extract <IMATH_NAMESPACE::M33f> extractorMf (p);
118 if (extractorMf.check())
125 hboost::python::extract <IMATH_NAMESPACE::M33d> extractorMd (p);
126 if (extractorMd.check())
140 hboost::python::extract <IMATH_NAMESPACE::M44f> extractorMf (p);
141 if (extractorMf.check())
148 hboost::python::extract <IMATH_NAMESPACE::M44d> extractorMd (p);
149 if (extractorMd.check())
159 template <
class Matrix>
160 hboost::python::tuple
163 typedef typename Matrix::BaseType
T;
164 typedef typename Matrix::BaseVecType Vec;
173 const int d = Matrix::dimensions();
174 const T tol =
std::sqrt(std::numeric_limits<T>::epsilon());
175 for (
int i = 0; i < d; ++i)
177 for (
int j = i+1;
j < d; ++
j)
179 const T Aij = m[i][
j],
182 throw std::invalid_argument
183 (
"Symmetric eigensolve requires a symmetric matrix (matrix[i][j] == matrix[j][i]).");
192 return hboost::python::make_tuple (Q, S);
Matrix44< float > M44f
4x4 matrix of float
vfloat4 sqrt(const vfloat4 &a)
Matrix22< double > M22d
2x2 matrix of double
FixedArray< IMATH_NAMESPACE::Matrix44< float > > M44fArray
FixedArray< IMATH_NAMESPACE::Matrix22< float > > M22fArray
hboost::python::class_< IMATH_NAMESPACE::Matrix33< T > > register_Matrix33()
static int convert(PyObject *p, IMATH_NAMESPACE::Matrix44< T > *m)
static PyObject * wrap(const IMATH_NAMESPACE::Matrix33< T > &m)
Matrix33< float > M33f
3x3 matrix of float
Matrix44< double > M44d
4x4 matrix of double
FixedArray< IMATH_NAMESPACE::Matrix33< float > > M33fArray
hboost::python::class_< IMATH_NAMESPACE::Matrix22< T > > register_Matrix22()
Matrix33< double > M33d
3x3 matrix of double
hboost::python::tuple jacobiEigensolve(const Matrix &m)
GLint GLint GLsizei GLint GLenum GLenum type
FixedArray< IMATH_NAMESPACE::Matrix44< double > > M44dArray
hboost::python::class_< FixedArray< IMATH_NAMESPACE::Matrix22< T > > > register_M22Array()
static int convert(PyObject *p, IMATH_NAMESPACE::Matrix33< T > *m)
FixedArray< IMATH_NAMESPACE::Matrix22< double > > M22dArray
static PyObject * wrap(const IMATH_NAMESPACE::Matrix22< T > &m)
hboost::python::class_< FixedArray< IMATH_NAMESPACE::Matrix44< T > > > register_M44Array()
hboost::python::class_< IMATH_NAMESPACE::Matrix44< T > > register_Matrix44()
Matrix22< float > M22f
2x2 matrix of float
static PyObject * wrap(const IMATH_NAMESPACE::Matrix44< T > &m)
hboost::python::class_< FixedArray< IMATH_NAMESPACE::Matrix33< T > > > register_M33Array()
void jacobiEigenSolver(Matrix33< T > &A, Vec3< T > &S, Matrix33< T > &V, const T tol)
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE constexpr T abs(T a) IMATH_NOEXCEPT
static int convert(PyObject *p, IMATH_NAMESPACE::Matrix22< T > *m)
FixedArray< IMATH_NAMESPACE::Matrix33< double > > M33dArray