Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
eigenpy
Commits
20b89555
Verified
Commit
20b89555
authored
4 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: move Python call to the dynamic lib
parent
41d2650e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/eigenpy/numpy.hpp
+9
-0
9 additions, 0 deletions
include/eigenpy/numpy.hpp
include/eigenpy/register.hpp
+5
-5
5 additions, 5 deletions
include/eigenpy/register.hpp
src/numpy.cpp
+15
-0
15 additions, 0 deletions
src/numpy.cpp
with
29 additions
and
5 deletions
include/eigenpy/numpy.hpp
+
9
−
0
View file @
20b89555
...
...
@@ -44,12 +44,21 @@ namespace eigenpy
EIGENPY_DLLEXPORT
int
call_PyArray_ObjectType
(
PyObject
*
,
int
);
EIGENPY_DLLEXPORT
PyTypeObject
*
getPyArrayType
();
EIGENPY_DLLEXPORT
int
call_PyArray_DescrFromType
(
int
typenum
);
EIGENPY_DLLEXPORT
void
call_PyArray_InitArrFuncs
(
PyArray_ArrFuncs
*
funcs
);
EIGENPY_DLLEXPORT
int
call_PyArray_RegisterDataType
(
PyArray_Descr
*
dtype
);
}
#else
#define call_PyArray_SimpleNew PyArray_SimpleNew
#define call_PyArray_New(py_type_ptr,nd,shape,np_type,data_ptr,options) \
PyArray_New(py_type_ptr,nd,shape,np_type,NULL,data_ptr,0,options,NULL)
#define getPyArrayType() &PyArray_Type
#define call_PyArray_DescrFromType(typenum) PyArray_DescrFromType(typenum)
#define call_PyArray_InitArrFuncs(funcs) PyArray_InitArrFuncs(funcs)
#define call_PyArray_RegisterDataType(dtype) PyArray_RegisterDataType(dtype)
#endif
#endif // ifndef __eigenpy_numpy_hpp__
This diff is collapsed.
Click to expand it.
include/eigenpy/register.hpp
+
5
−
5
View file @
20b89555
...
...
@@ -70,7 +70,7 @@ namespace eigenpy
}
else
{
PyArray_Descr
*
new_descr
=
PyArray_DescrFromType
(
NumpyEquivalentType
<
Scalar
>::
type_code
);
PyArray_Descr
*
new_descr
=
call_
PyArray_DescrFromType
(
NumpyEquivalentType
<
Scalar
>::
type_code
);
return
new_descr
->
typeobj
;
}
}
...
...
@@ -107,7 +107,7 @@ namespace eigenpy
{
namespace
bp
=
boost
::
python
;
PyArray_Descr
*
descr_ptr
=
new
PyArray_Descr
(
*
PyArray_DescrFromType
(
NPY_OBJECT
));
PyArray_Descr
*
descr_ptr
=
new
PyArray_Descr
(
*
call_
PyArray_DescrFromType
(
NPY_OBJECT
));
PyArray_Descr
&
descr
=
*
descr_ptr
;
descr
.
typeobj
=
py_type_ptr
;
descr
.
kind
=
'V'
;
...
...
@@ -120,7 +120,7 @@ namespace eigenpy
PyArray_ArrFuncs
*
funcs_ptr
=
new
PyArray_ArrFuncs
;
PyArray_ArrFuncs
&
funcs
=
*
funcs_ptr
;
descr
.
f
=
funcs_ptr
;
PyArray_InitArrFuncs
(
funcs_ptr
);
call_
PyArray_InitArrFuncs
(
funcs_ptr
);
funcs
.
getitem
=
getitem
;
funcs
.
setitem
=
setitem
;
funcs
.
nonzero
=
nonzero
;
...
...
@@ -129,9 +129,9 @@ namespace eigenpy
funcs
.
dotfunc
=
dotfunc
;
// f->cast = cast;
const
int
code
=
PyArray_RegisterDataType
(
descr_ptr
);
const
int
code
=
call_
PyArray_RegisterDataType
(
descr_ptr
);
assert
(
code
>=
0
&&
"The return code should be positive"
);
PyArray_Descr
*
new_descr
=
PyArray_DescrFromType
(
code
);
PyArray_Descr
*
new_descr
=
call_
PyArray_DescrFromType
(
code
);
type_to_py_type_bindings
.
insert
(
std
::
make_pair
(
type_info_ptr
,
py_type_ptr
));
py_array_descr_bindings
[
py_type_ptr
]
=
new_descr
;
...
...
This diff is collapsed.
Click to expand it.
src/numpy.cpp
+
15
−
0
View file @
20b89555
...
...
@@ -38,6 +38,21 @@ namespace eigenpy
}
PyTypeObject
*
getPyArrayType
()
{
return
&
PyArray_Type
;
}
int
call_PyArray_DescrFromType
(
int
typenum
)
{
return
PyArray_DescrFromType
(
typenum
);
}
void
call_PyArray_InitArrFuncs
(
PyArray_ArrFuncs
*
funcs
)
{
PyArray_InitArrFuncs
(
funcs
);
}
int
call_PyArray_RegisterDataType
(
PyArray_Descr
*
dtype
)
{
return
PyArray_RegisterDataType
(
dtype
);
}
#endif
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment