Skip to content

Commit a467802

Browse files
committed
core: add getNumpy{Matrix,Array}Type + is{Matrix,Array} methods
1 parent 77b2063 commit a467802

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

include/eigenpy/details.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,28 @@ namespace eigenpy
119119
{
120120
return getInstance().CurrentNumpyType;
121121
}
122+
123+
static const PyTypeObject * getNumpyMatrixType()
124+
{
125+
return getInstance().NumpyMatrixType;
126+
}
127+
128+
static const PyTypeObject * getNumpyArrayType()
129+
{
130+
return getInstance().NumpyArrayType;
131+
}
132+
133+
static bool isMatrix()
134+
{
135+
return PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(getInstance().CurrentNumpyType.ptr()),
136+
getInstance().NumpyMatrixType);
137+
}
138+
139+
static bool isArray()
140+
{
141+
return PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(getInstance().CurrentNumpyType.ptr()),
142+
getInstance().NumpyArrayType);
143+
}
122144

123145
protected:
124146
NumpyType()

0 commit comments

Comments
 (0)