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
Guilhem Saurel
eigenpy
Commits
42e4faa3
Verified
Commit
42e4faa3
authored
3 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: add alignment value automatically deduced
parent
fdfaa736
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/eigenpy/register.hpp
+1
-0
1 addition, 0 deletions
include/eigenpy/register.hpp
include/eigenpy/user-type.hpp
+13
-0
13 additions, 0 deletions
include/eigenpy/user-type.hpp
src/register.cpp
+2
-1
2 additions, 1 deletion
src/register.cpp
with
16 additions
and
1 deletion
include/eigenpy/register.hpp
+
1
−
0
View file @
42e4faa3
...
@@ -79,6 +79,7 @@ namespace eigenpy
...
@@ -79,6 +79,7 @@ namespace eigenpy
static
int
registerNewType
(
PyTypeObject
*
py_type_ptr
,
static
int
registerNewType
(
PyTypeObject
*
py_type_ptr
,
const
std
::
type_info
*
type_info_ptr
,
const
std
::
type_info
*
type_info_ptr
,
const
int
type_size
,
const
int
type_size
,
const
int
alignment
,
PyArray_GetItemFunc
*
getitem
,
PyArray_GetItemFunc
*
getitem
,
PyArray_SetItemFunc
*
setitem
,
PyArray_SetItemFunc
*
setitem
,
PyArray_NonzeroFunc
*
nonzero
,
PyArray_NonzeroFunc
*
nonzero
,
...
...
This diff is collapsed.
Click to expand it.
include/eigenpy/user-type.hpp
+
13
−
0
View file @
42e4faa3
...
@@ -27,6 +27,18 @@ namespace eigenpy
...
@@ -27,6 +27,18 @@ namespace eigenpy
// static void cast(void * /*from*/, void * /*to*/, npy_intp /*n*/, void * /*fromarr*/, void * /*toarr*/) {};
// static void cast(void * /*from*/, void * /*to*/, npy_intp /*n*/, void * /*fromarr*/, void * /*toarr*/) {};
};
};
template
<
typename
T
>
struct
OffsetOf
{
struct
Data
{
char
c
;
T
v
;
};
enum
{
value
=
offsetof
(
Data
,
v
)
};
};
template
<
typename
T
>
template
<
typename
T
>
struct
SpecialMethods
<
T
,
NPY_USERDEF
>
struct
SpecialMethods
<
T
,
NPY_USERDEF
>
{
{
...
@@ -194,6 +206,7 @@ namespace eigenpy
...
@@ -194,6 +206,7 @@ namespace eigenpy
int
code
=
Register
::
registerNewType
(
py_type_ptr
,
int
code
=
Register
::
registerNewType
(
py_type_ptr
,
&
typeid
(
Scalar
),
&
typeid
(
Scalar
),
sizeof
(
Scalar
),
sizeof
(
Scalar
),
internal
::
OffsetOf
<
Scalar
>::
value
,
getitem
,
setitem
,
nonzero
,
getitem
,
setitem
,
nonzero
,
copyswap
,
copyswapn
,
copyswap
,
copyswapn
,
dotfunc
);
dotfunc
);
...
...
This diff is collapsed.
Click to expand it.
src/register.cpp
+
2
−
1
View file @
42e4faa3
...
@@ -36,6 +36,7 @@ namespace eigenpy
...
@@ -36,6 +36,7 @@ namespace eigenpy
int
Register
::
registerNewType
(
PyTypeObject
*
py_type_ptr
,
int
Register
::
registerNewType
(
PyTypeObject
*
py_type_ptr
,
const
std
::
type_info
*
type_info_ptr
,
const
std
::
type_info
*
type_info_ptr
,
const
int
type_size
,
const
int
type_size
,
const
int
alignement
,
PyArray_GetItemFunc
*
getitem
,
PyArray_GetItemFunc
*
getitem
,
PyArray_SetItemFunc
*
setitem
,
PyArray_SetItemFunc
*
setitem
,
PyArray_NonzeroFunc
*
nonzero
,
PyArray_NonzeroFunc
*
nonzero
,
...
@@ -68,7 +69,7 @@ namespace eigenpy
...
@@ -68,7 +69,7 @@ namespace eigenpy
descr
.
type_num
=
0
;
descr
.
type_num
=
0
;
descr
.
names
=
0
;
descr
.
names
=
0
;
descr
.
fields
=
0
;
descr
.
fields
=
0
;
descr
.
alignment
=
call_PyArray_DescrFromType
(
NPY_OBJECT
)
->
alignment
;
descr
.
alignment
=
alignement
;
//
call_PyArray_DescrFromType(NPY_OBJECT)->alignment;
PyArray_ArrFuncs
*
funcs_ptr
=
new
PyArray_ArrFuncs
;
PyArray_ArrFuncs
*
funcs_ptr
=
new
PyArray_ArrFuncs
;
PyArray_ArrFuncs
&
funcs
=
*
funcs_ptr
;
PyArray_ArrFuncs
&
funcs
=
*
funcs_ptr
;
...
...
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