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
1c58c535
Verified
Commit
1c58c535
authored
2 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: add arg type info
parent
77f0505d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/eigenpy/eigen-from-python.hpp
+68
-8
68 additions, 8 deletions
include/eigenpy/eigen-from-python.hpp
with
68 additions
and
8 deletions
include/eigenpy/eigen-from-python.hpp
+
68
−
8
View file @
1c58c535
//
// Copyright (c) 2014-202
0
CNRS INRIA
// Copyright (c) 2014-202
2
CNRS INRIA
//
#ifndef __eigenpy_eigen_from_python_hpp__
...
...
@@ -12,6 +12,36 @@
#include
<boost/python/converter/rvalue_from_python_data.hpp>
namespace
eigenpy
{
template
<
typename
C
>
struct
expected_pytype_for_arg
{};
template
<
typename
Scalar
,
int
Rows
,
int
Cols
,
int
Options
,
int
MaxRows
,
int
MaxCols
>
struct
expected_pytype_for_arg
<
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
>
{
static
PyTypeObject
const
*
get_pytype
()
{
PyTypeObject
const
*
py_type
=
eigenpy
::
getPyArrayType
();
return
py_type
;
}
};
}
namespace
boost
{
namespace
python
{
namespace
converter
{
template
<
typename
Scalar
,
int
Rows
,
int
Cols
,
int
Options
,
int
MaxRows
,
int
MaxCols
>
struct
expected_pytype_for_arg
<
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
>
:
eigenpy
::
expected_pytype_for_arg
<
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
>
{
};
}}}
namespace
eigenpy
{
namespace
details
...
...
@@ -427,7 +457,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
EigenFromPy
::
construct
,
bp
::
type_id
<
MatType
>
());
&
EigenFromPy
::
construct
,
bp
::
type_id
<
MatType
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
template
<
typename
MatType
>
...
...
@@ -453,7 +488,7 @@ namespace eigenpy
// Add conversion to Eigen::Ref<MatType>
typedef
Eigen
::
Ref
<
MatType
>
RefType
;
EigenFromPy
<
RefType
>::
registration
();
// Add conversion to Eigen::Ref<MatType>
typedef
const
Eigen
::
Ref
<
const
MatType
>
ConstRefType
;
EigenFromPy
<
ConstRefType
>::
registration
();
...
...
@@ -471,7 +506,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
());
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
};
...
...
@@ -485,7 +525,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
());
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
};
...
...
@@ -499,7 +544,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
());
&
EigenFromPy
::
construct
,
bp
::
type_id
<
Base
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
};
...
...
@@ -526,7 +576,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
eigen_from_py_construct
<
RefType
>
,
bp
::
type_id
<
RefType
>
());
&
eigen_from_py_construct
<
RefType
>
,
bp
::
type_id
<
RefType
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
};
...
...
@@ -546,7 +601,12 @@ namespace eigenpy
{
bp
::
converter
::
registry
::
push_back
(
reinterpret_cast
<
void
*
(
*
)(
_object
*
)
>
(
&
EigenFromPy
::
convertible
),
&
eigen_from_py_construct
<
ConstRefType
>
,
bp
::
type_id
<
ConstRefType
>
());
&
eigen_from_py_construct
<
ConstRefType
>
,
bp
::
type_id
<
ConstRefType
>
()
#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
,
&
eigenpy
::
expected_pytype_for_arg
<
MatType
>::
get_pytype
#endif
);
}
};
#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