Skip to content
GitLab
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
201f6b4b
Commit
201f6b4b
authored
Dec 27, 2015
by
jcarpent
Browse files
[C++][Cmake] Add option to make eigen and numpy objects aligned
parent
a1ea4c28
Changes
4
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
201f6b4b
...
...
@@ -23,6 +23,15 @@ IF(APPLE)
SET
(
CMAKE_MACOSX_RPATH TRUE
)
ENDIF
(
APPLE
)
# ----------------------------------------------------
# --- OPTIONS ---------------------------------------
# ----------------------------------------------------
OPTION
(
EIGEN_NUMPY_ALIGNED
"Directly aligned data between Numpy and Eigen"
OFF
)
IF
(
EIGEN_NUMPY_ALIGNED
)
ADD_DEFINITIONS
(
-DEIGENPY_ALIGNED
)
ENDIF
(
EIGEN_NUMPY_ALIGNED
)
# ----------------------------------------------------
# --- DEPENDANCIES -----------------------------------
# ----------------------------------------------------
...
...
@@ -102,6 +111,9 @@ ADD_LIBRARY(geometry SHARED unittest/geometry.cpp)
TARGET_LINK_LIBRARIES
(
geometry
${
Boost_LIBRARIES
}
${
PROJECT_NAME
}
)
SET_TARGET_PROPERTIES
(
geometry PROPERTIES PREFIX
""
)
IF
(
EIGEN_NUMPY_ALIGNED
)
PKG_CONFIG_APPEND_CFLAGS
(
"-DEIGENPY_ALIGNED"
)
ENDIF
(
EIGEN_NUMPY_ALIGNED
)
PKG_CONFIG_APPEND_CFLAGS
(
"-I
${
PYTHON_INCLUDE_DIRS
}
"
)
PKG_CONFIG_APPEND_CFLAGS
(
"-I
${
NUMPY_INCLUDE_DIRS
}
"
)
PKG_CONFIG_APPEND_LIBS
(
"boost_python"
)
...
...
src/details.hpp
View file @
201f6b4b
...
...
@@ -190,20 +190,26 @@ namespace eigenpy
void
enableEigenPySpecific
()
{
import_array
();
#ifdef EIGEN_DONT_VECTORIZE
#ifdef EIGEN_DONT_VECTORIZE
boost
::
python
::
to_python_converter
<
MatType
,
eigenpy
::
EigenToPy
<
MatType
,
MatType
>
>
();
eigenpy
::
EigenToPy
<
MatType
,
MatType
>
>
();
eigenpy
::
EigenFromPy
<
MatType
,
MatType
>
();
#else
typedef
typename
eigenpy
::
UnalignedEquivalent
<
MatType
>::
type
MatTypeDontAlign
;
#else
boost
::
python
::
to_python_converter
<
MatType
,
eigenpy
::
EigenToPy
<
MatType
,
MatType
>
>
();
eigenpy
::
EigenFromPy
<
MatType
,
MatType
>
();
typedef
typename
eigenpy
::
UnalignedEquivalent
<
MatType
>::
type
MatTypeDontAlign
;
#ifndef EIGENPY_ALIGNED
boost
::
python
::
to_python_converter
<
MatTypeDontAlign
,
eigenpy
::
EigenToPy
<
MatTypeDontAlign
,
MatTypeDontAlign
>
>
();
eigenpy
::
EigenFromPy
<
MatTypeDontAlign
,
MatTypeDontAlign
>
();
#endif
#endif
}
...
...
src/fwd.hpp
View file @
201f6b4b
...
...
@@ -27,11 +27,15 @@ namespace eigenpy
{
typedef
Eigen
::
MatrixBase
<
D
>
MatType
;
typedef
Eigen
::
Matrix
<
typename
D
::
Scalar
,
D
::
RowsAtCompileTime
,
D
::
ColsAtCompileTime
,
D
::
Options
|
Eigen
::
DontAlign
,
D
::
MaxRowsAtCompileTime
,
D
::
MaxColsAtCompileTime
>
type
;
D
::
RowsAtCompileTime
,
D
::
ColsAtCompileTime
,
#ifndef EIGENPY_ALIGNED
D
::
Options
|
Eigen
::
DontAlign
,
#else
D
::
Options
,
#endif
D
::
MaxRowsAtCompileTime
,
D
::
MaxColsAtCompileTime
>
type
;
};
}
// namespace eigenpy
...
...
src/quaternion.hpp
View file @
201f6b4b
...
...
@@ -39,7 +39,11 @@ namespace eigenpy
template
<
>
struct
UnalignedEquivalent
<
Eigen
::
Quaterniond
>
{
typedef
Eigen
::
Quaternion
<
double
,
Eigen
::
DontAlign
>
type
;
#ifndef EIGENPY_ALIGNED
typedef
Eigen
::
Quaternion
<
Eigen
::
Quaterniond
::
Scalar
,
Eigen
::
DontAlign
>
type
;
#else
typedef
Eigen
::
Quaterniond
type
;
#endif
};
namespace
bp
=
boost
::
python
;
...
...
@@ -51,10 +55,15 @@ namespace eigenpy
typedef
Eigen
::
QuaternionBase
<
Quaternion
>
QuaternionBase
;
typedef
typename
eigenpy
::
UnalignedEquivalent
<
Quaternion
>::
type
QuaternionUnaligned
;
typedef
typename
QuaternionUnaligned
::
Scalar
Scalar
;
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
1
,
Eigen
::
DontAlign
>
Vector3
;
typedef
typename
QuaternionBase
::
Scalar
Scalar
;
typedef
typename
QuaternionUnaligned
::
Coefficients
Coefficients
;
#ifndef EIGENPY_ALIGNED
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
1
,
Eigen
::
DontAlign
>
Vector3
;
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
3
,
Eigen
::
DontAlign
>
Matrix3
;
#else
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
1
,
0
>
Vector3
;
typedef
Eigen
::
Matrix
<
Scalar
,
3
,
3
,
0
>
Matrix3
;
#endif
typedef
Eigen
::
AngleAxis
<
Scalar
>
AngleAxisUnaligned
;
...
...
@@ -169,8 +178,10 @@ namespace eigenpy
bp
::
init
<>
())
.
def
(
QuaternionVisitor
<
Quaternion
>
())
;
#ifndef EIGENPY_ALIGNED
bp
::
to_python_converter
<
Quaternion
,
QuaternionVisitor
<
Quaternion
>
>
();
#endif
}
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment