Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
eigenpy
Commits
287351ea
Verified
Commit
287351ea
authored
Feb 27, 2020
by
Justin Carpentier
Browse files
core: rename MapNumpy into NumpyMap
parent
eb920acc
Changes
2
Show whitespace changes
Inline
Side-by-side
include/eigenpy/eigen-allocator.hpp
View file @
287351ea
...
...
@@ -96,10 +96,10 @@ namespace eigenpy
}
// namespace details
#define EIGENPY_CAST_FROM_PYARRAY_TO_EIGEN_MATRIX(MatType,Scalar,NewScalar,pyArray,mat) \
details::cast_matrix_or_array<Scalar,NewScalar>::run(
Map
Numpy<MatType,Scalar>::map(pyArray),mat)
details::cast_matrix_or_array<Scalar,NewScalar>::run(Numpy
Map
<MatType,Scalar>::map(pyArray),mat)
#define EIGENPY_CAST_FROM_EIGEN_MATRIX_TO_PYARRAY(MatType,Scalar,NewScalar,mat,pyArray) \
details::cast_matrix_or_array<Scalar,NewScalar>::run(mat,
Map
Numpy<MatType,NewScalar>::map(pyArray))
details::cast_matrix_or_array<Scalar,NewScalar>::run(mat,Numpy
Map
<MatType,NewScalar>::map(pyArray))
template
<
typename
MatType
>
struct
EigenAllocator
...
...
@@ -117,7 +117,7 @@ namespace eigenpy
const
int
pyArray_Type
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
{
mat
=
Map
Numpy
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
mat
=
Numpy
Map
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
return
;
}
...
...
@@ -160,11 +160,11 @@ namespace eigenpy
const
MatrixDerived
&
mat
=
const_cast
<
const
MatrixDerived
&>
(
mat_
.
derived
());
const
int
pyArray_Type
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
typedef
typename
Map
Numpy
<
MatType
,
Scalar
>::
EigenMap
MapType
;
typedef
typename
Numpy
Map
<
MatType
,
Scalar
>::
EigenMap
MapType
;
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
// no cast needed
{
MapType
map_pyArray
=
Map
Numpy
<
MatType
,
Scalar
>::
map
(
pyArray
);
MapType
map_pyArray
=
Numpy
Map
<
MatType
,
Scalar
>::
map
(
pyArray
);
if
(
mat
.
rows
()
==
map_pyArray
.
rows
())
map_pyArray
=
mat
;
else
...
...
@@ -248,7 +248,7 @@ namespace eigenpy
RefType
&
mat
=
*
reinterpret_cast
<
RefType
*>
(
raw_ptr
);
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
{
mat
=
Map
Numpy
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
mat
=
Numpy
Map
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
return
;
}
...
...
@@ -285,7 +285,7 @@ namespace eigenpy
else
{
assert
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
);
typename
Map
Numpy
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
EigenMap
numpyMap
=
Map
Numpy
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
map
(
pyArray
);
typename
Numpy
Map
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
EigenMap
numpyMap
=
Numpy
Map
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
map
(
pyArray
);
RefType
mat_ref
(
numpyMap
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
}
...
...
@@ -340,7 +340,7 @@ namespace eigenpy
MatType
&
mat
=
*
mat_ptr
;
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
{
mat
=
Map
Numpy
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
mat
=
Numpy
Map
<
MatType
,
Scalar
>::
map
(
pyArray
);
// avoid useless cast
return
;
}
...
...
@@ -377,7 +377,7 @@ namespace eigenpy
else
{
assert
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
);
typename
Map
Numpy
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
EigenMap
numpyMap
=
Map
Numpy
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
map
(
pyArray
);
typename
Numpy
Map
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
EigenMap
numpyMap
=
Numpy
Map
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
map
(
pyArray
);
RefType
mat_ref
(
numpyMap
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
}
...
...
@@ -397,7 +397,7 @@ namespace eigenpy
static
void
allocate
(
PyArrayObject
*
pyArray
,
void
*
storage
)
{
typename
Map
Numpy
<
MatType
,
Scalar
>::
EigenMap
numpyMap
=
Map
Numpy
<
MatType
,
Scalar
>::
map
(
pyArray
);
typename
Numpy
Map
<
MatType
,
Scalar
>::
EigenMap
numpyMap
=
Numpy
Map
<
MatType
,
Scalar
>::
map
(
pyArray
);
new
(
storage
)
Type
(
numpyMap
);
}
...
...
include/eigenpy/numpy-map.hpp
View file @
287351ea
...
...
@@ -13,13 +13,13 @@
namespace
eigenpy
{
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
,
bool
IsVector
=
MatType
::
IsVectorAtCompileTime
>
struct
Map
NumpyTraits
{};
struct
Numpy
Map
Traits
{};
/* Wrap a numpy::array with an Eigen::Map. No memory copy. */
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
=
EIGENPY_NO_ALIGNMENT_VALUE
,
typename
Stride
=
typename
StrideType
<
MatType
>
::
type
>
struct
Map
Numpy
struct
Numpy
Map
{
typedef
Map
NumpyTraits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>
Impl
;
typedef
Numpy
Map
Traits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>
Impl
;
typedef
typename
Impl
::
EigenMap
EigenMap
;
static
EigenMap
map
(
PyArrayObject
*
pyArray
);
...
...
@@ -34,7 +34,7 @@ namespace eigenpy
namespace
eigenpy
{
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
struct
Map
NumpyTraits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
,
false
>
struct
Numpy
Map
Traits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
,
false
>
{
typedef
Eigen
::
Matrix
<
InputScalar
,
MatType
::
RowsAtCompileTime
,
MatType
::
ColsAtCompileTime
,
MatType
::
Options
>
EquivalentInputMatrixType
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
...
...
@@ -108,7 +108,7 @@ namespace eigenpy
};
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
struct
Map
NumpyTraits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
,
true
>
struct
Numpy
Map
Traits
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
,
true
>
{
typedef
Eigen
::
Matrix
<
InputScalar
,
MatType
::
RowsAtCompileTime
,
MatType
::
ColsAtCompileTime
,
MatType
::
Options
>
EquivalentInputMatrixType
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
...
...
@@ -140,8 +140,8 @@ namespace eigenpy
};
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
typename
Map
Numpy
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
EigenMap
Map
Numpy
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
map
(
PyArrayObject
*
pyArray
)
typename
Numpy
Map
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
EigenMap
Numpy
Map
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
map
(
PyArrayObject
*
pyArray
)
{
return
Impl
::
mapImpl
(
pyArray
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment