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
0d9e76bc
Unverified
Commit
0d9e76bc
authored
Feb 27, 2020
by
Justin Carpentier
Committed by
GitHub
Feb 27, 2020
Browse files
Merge pull request #168 from jcarpent/devel
Minor renaming
parents
c870f4c9
287351ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
0d9e76bc
...
@@ -110,7 +110,7 @@ SET(${PROJECT_NAME}_HEADERS
...
@@ -110,7 +110,7 @@ SET(${PROJECT_NAME}_HEADERS
include/eigenpy/eigen-allocator.hpp
include/eigenpy/eigen-allocator.hpp
include/eigenpy/eigen-to-python.hpp
include/eigenpy/eigen-to-python.hpp
include/eigenpy/eigen-from-python.hpp
include/eigenpy/eigen-from-python.hpp
include/eigenpy/map.hpp
include/eigenpy/
numpy-
map.hpp
include/eigenpy/geometry.hpp
include/eigenpy/geometry.hpp
include/eigenpy/geometry-conversion.hpp
include/eigenpy/geometry-conversion.hpp
include/eigenpy/memory.hpp
include/eigenpy/memory.hpp
...
...
include/eigenpy/details.hpp
View file @
0d9e76bc
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
#include
"eigenpy/eigen-from-python.hpp"
#include
"eigenpy/eigen-from-python.hpp"
#include
"eigenpy/registration.hpp"
#include
"eigenpy/registration.hpp"
#include
"eigenpy/map.hpp"
#include
"eigenpy/exception.hpp"
#include
"eigenpy/exception.hpp"
namespace
boost
{
namespace
python
{
namespace
detail
{
namespace
boost
{
namespace
python
{
namespace
detail
{
...
...
include/eigenpy/eigen-allocator.hpp
View file @
0d9e76bc
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#define __eigenpy_eigen_allocator_hpp__
#define __eigenpy_eigen_allocator_hpp__
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/map.hpp"
#include
"eigenpy/
numpy-
map.hpp"
#include
"eigenpy/scalar-conversion.hpp"
#include
"eigenpy/scalar-conversion.hpp"
#include
"eigenpy/utils/is-aligned.hpp"
#include
"eigenpy/utils/is-aligned.hpp"
...
@@ -96,10 +96,10 @@ namespace eigenpy
...
@@ -96,10 +96,10 @@ namespace eigenpy
}
// namespace details
}
// namespace details
#define EIGENPY_CAST_FROM_PYARRAY_TO_EIGEN_MATRIX(MatType,Scalar,NewScalar,pyArray,mat) \
#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) \
#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
>
template
<
typename
MatType
>
struct
EigenAllocator
struct
EigenAllocator
...
@@ -117,7 +117,7 @@ namespace eigenpy
...
@@ -117,7 +117,7 @@ namespace eigenpy
const
int
pyArray_Type
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
const
int
pyArray_Type
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
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
;
return
;
}
}
...
@@ -160,11 +160,11 @@ namespace eigenpy
...
@@ -160,11 +160,11 @@ namespace eigenpy
const
MatrixDerived
&
mat
=
const_cast
<
const
MatrixDerived
&>
(
mat_
.
derived
());
const
MatrixDerived
&
mat
=
const_cast
<
const
MatrixDerived
&>
(
mat_
.
derived
());
const
int
pyArray_Type
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
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
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
())
if
(
mat
.
rows
()
==
map_pyArray
.
rows
())
map_pyArray
=
mat
;
map_pyArray
=
mat
;
else
else
...
@@ -248,7 +248,7 @@ namespace eigenpy
...
@@ -248,7 +248,7 @@ namespace eigenpy
RefType
&
mat
=
*
reinterpret_cast
<
RefType
*>
(
raw_ptr
);
RefType
&
mat
=
*
reinterpret_cast
<
RefType
*>
(
raw_ptr
);
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
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
;
return
;
}
}
...
@@ -285,7 +285,7 @@ namespace eigenpy
...
@@ -285,7 +285,7 @@ namespace eigenpy
else
else
{
{
assert
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
);
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
);
RefType
mat_ref
(
numpyMap
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
}
}
...
@@ -340,7 +340,7 @@ namespace eigenpy
...
@@ -340,7 +340,7 @@ namespace eigenpy
MatType
&
mat
=
*
mat_ptr
;
MatType
&
mat
=
*
mat_ptr
;
if
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
)
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
;
return
;
}
}
...
@@ -377,7 +377,7 @@ namespace eigenpy
...
@@ -377,7 +377,7 @@ namespace eigenpy
else
else
{
{
assert
(
pyArray_Type
==
NumpyEquivalentType
<
Scalar
>::
type_code
);
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
);
RefType
mat_ref
(
numpyMap
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
new
(
raw_ptr
)
StorageType
(
mat_ref
,
pyArray
);
}
}
...
@@ -397,7 +397,7 @@ namespace eigenpy
...
@@ -397,7 +397,7 @@ namespace eigenpy
static
void
allocate
(
PyArrayObject
*
pyArray
,
void
*
storage
)
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
);
new
(
storage
)
Type
(
numpyMap
);
}
}
...
...
include/eigenpy/map.hpp
→
include/eigenpy/
numpy-
map.hpp
View file @
0d9e76bc
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
* Copyright 2018-2020, INRIA
* Copyright 2018-2020, INRIA
*/
*/
#ifndef __eigenpy_map_hpp__
#ifndef __eigenpy_
numpy_
map_hpp__
#define __eigenpy_map_hpp__
#define __eigenpy_
numpy_
map_hpp__
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/exception.hpp"
#include
"eigenpy/exception.hpp"
...
@@ -13,13 +13,13 @@
...
@@ -13,13 +13,13 @@
namespace
eigenpy
namespace
eigenpy
{
{
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
,
bool
IsVector
=
MatType
::
IsVectorAtCompileTime
>
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. */
/* 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
>
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
;
typedef
typename
Impl
::
EigenMap
EigenMap
;
static
EigenMap
map
(
PyArrayObject
*
pyArray
);
static
EigenMap
map
(
PyArrayObject
*
pyArray
);
...
@@ -34,7 +34,7 @@ namespace eigenpy
...
@@ -34,7 +34,7 @@ namespace eigenpy
namespace
eigenpy
namespace
eigenpy
{
{
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
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
::
Matrix
<
InputScalar
,
MatType
::
RowsAtCompileTime
,
MatType
::
ColsAtCompileTime
,
MatType
::
Options
>
EquivalentInputMatrixType
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
...
@@ -108,7 +108,7 @@ namespace eigenpy
...
@@ -108,7 +108,7 @@ namespace eigenpy
};
};
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
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
::
Matrix
<
InputScalar
,
MatType
::
RowsAtCompileTime
,
MatType
::
ColsAtCompileTime
,
MatType
::
Options
>
EquivalentInputMatrixType
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
typedef
Eigen
::
Map
<
EquivalentInputMatrixType
,
AlignmentValue
,
Stride
>
EigenMap
;
...
@@ -140,12 +140,12 @@ namespace eigenpy
...
@@ -140,12 +140,12 @@ namespace eigenpy
};
};
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
template
<
typename
MatType
,
typename
InputScalar
,
int
AlignmentValue
,
typename
Stride
>
typename
Map
Numpy
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
EigenMap
typename
Numpy
Map
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
EigenMap
Map
Numpy
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
map
(
PyArrayObject
*
pyArray
)
Numpy
Map
<
MatType
,
InputScalar
,
AlignmentValue
,
Stride
>::
map
(
PyArrayObject
*
pyArray
)
{
{
return
Impl
::
mapImpl
(
pyArray
);
return
Impl
::
mapImpl
(
pyArray
);
}
}
}
// namespace eigenpy
}
// namespace eigenpy
#endif // define __eigenpy_map_hpp__
#endif // define __eigenpy_
numpy_
map_hpp__
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