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
Stack Of Tasks
eigenpy
Commits
0deef658
Verified
Commit
0deef658
authored
2 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: add alignment support
parent
2a6d963f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+2
-1
2 additions, 1 deletion
CMakeLists.txt
include/eigenpy/alignment.hpp
+116
-0
116 additions, 0 deletions
include/eigenpy/alignment.hpp
include/eigenpy/fwd.hpp
+2
-0
2 additions, 0 deletions
include/eigenpy/fwd.hpp
with
120 additions
and
1 deletion
CMakeLists.txt
+
2
−
1
View file @
0deef658
#
# Copyright (c) 2014-2019 CNRS Copyright (c) 2018-202
2
INRIA
# Copyright (c) 2014-2019 CNRS Copyright (c) 2018-202
3
INRIA
#
cmake_minimum_required
(
VERSION 3.1
)
...
...
@@ -130,6 +130,7 @@ set(${PROJECT_NAME}_HEADERS
${${
PROJECT_NAME
}
_UTILS_HEADERS
}
${${
PROJECT_NAME
}
_SOLVERS_HEADERS
}
${${
PROJECT_NAME
}
_DECOMPOSITIONS_HEADERS
}
include/eigenpy/alignment.hpp
include/eigenpy/computation-info.hpp
include/eigenpy/eigenpy.hpp
include/eigenpy/exception.hpp
...
...
This diff is collapsed.
Click to expand it.
include/eigenpy/alignment.hpp
0 → 100644
+
116
−
0
View file @
0deef658
/*
* Copyright 2023, INRIA
*/
#ifndef __eigenpy_alignment_hpp__
#define __eigenpy_alignment_hpp__
#include
<boost/python/detail/referent_storage.hpp>
#include
<boost/python/converter/arg_from_python.hpp>
#include
<boost/python/converter/rvalue_from_python_data.hpp>
#include
<boost/type_traits/aligned_storage.hpp>
namespace
eigenpy
{
template
<
std
::
size_t
size
,
std
::
size_t
alignment
=
EIGENPY_DEFAULT_ALIGN_BYTES
>
struct
aligned_storage
{
union
type
{
typename
::
boost
::
aligned_storage
<
size
,
alignment
>::
type
data
;
char
bytes
[
size
];
};
};
}
// namespace eigenpy
namespace
boost
{
namespace
python
{
namespace
detail
{
template
<
typename
Scalar
,
int
Rows
,
int
Cols
,
int
Options
,
int
MaxRows
,
int
MaxCols
>
struct
referent_storage
<
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
&>
{
typedef
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
T
;
typedef
typename
eigenpy
::
aligned_storage
<
referent_size
<
T
&>::
value
>::
type
type
;
};
template
<
typename
Scalar
,
int
Rows
,
int
Cols
,
int
Options
,
int
MaxRows
,
int
MaxCols
>
struct
referent_storage
<
const
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
&>
{
typedef
Eigen
::
Matrix
<
Scalar
,
Rows
,
Cols
,
Options
,
MaxRows
,
MaxCols
>
T
;
typedef
typename
eigenpy
::
aligned_storage
<
referent_size
<
T
&>::
value
>::
type
type
;
};
template
<
typename
Scalar
,
int
Options
>
struct
referent_storage
<
Eigen
::
Quaternion
<
Scalar
,
Options
>
&>
{
typedef
Eigen
::
Quaternion
<
Scalar
,
Options
>
T
;
typedef
typename
eigenpy
::
aligned_storage
<
referent_size
<
T
&>::
value
>::
type
type
;
};
template
<
typename
Scalar
,
int
Options
>
struct
referent_storage
<
const
Eigen
::
Quaternion
<
Scalar
,
Options
>
&>
{
typedef
Eigen
::
Quaternion
<
Scalar
,
Options
>
T
;
typedef
typename
eigenpy
::
aligned_storage
<
referent_size
<
T
&>::
value
>::
type
type
;
};
}
// namespace detail
}
// namespace python
}
// namespace boost
namespace
eigenpy
{
template
<
class
T
>
struct
call_destructor
{
static
void
run
(
void
*
bytes
)
{
typedef
typename
boost
::
remove_const
<
typename
boost
::
remove_reference
<
T
>::
type
>::
type
T_
;
static_cast
<
T_
*>
((
void
*
)
bytes
)
->~
T_
();
}
};
template
<
class
T
>
struct
rvalue_from_python_data
:
::
boost
::
python
::
converter
::
rvalue_from_python_storage
<
T
>
{
#if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) && \
(!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) && \
(!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) && \
!defined(BOOST_PYTHON_SYNOPSIS)
/* Synopsis' OpenCXX has trouble parsing \
this */
// This must always be a POD struct with m_data its first member.
BOOST_STATIC_ASSERT
(
BOOST_PYTHON_OFFSETOF
(
::
boost
::
python
::
converter
::
rvalue_from_python_storage
<
T
>
,
stage1
)
==
0
);
#endif
// The usual constructor
rvalue_from_python_data
(
::
boost
::
python
::
converter
::
rvalue_from_python_stage1_data
const
&
_stage1
)
{
this
->
stage1
=
_stage1
;
}
// This constructor just sets m_convertible -- used by
// implicitly_convertible<> to perform the final step of the
// conversion, where the construct() function is already known.
rvalue_from_python_data
(
void
*
convertible
)
{
this
->
stage1
.
convertible
=
convertible
;
}
// Destroys any object constructed in the storage.
~
rvalue_from_python_data
()
{
if
(
this
->
stage1
.
convertible
==
this
->
storage
.
bytes
)
{
void
*
storage
=
reinterpret_cast
<
void
*>
(
this
->
storage
.
bytes
);
call_destructor
<
T
>::
run
(
storage
);
}
}
};
}
// namespace eigenpy
#endif // __eigenpy_alignment_hpp__
This diff is collapsed.
Click to expand it.
include/eigenpy/fwd.hpp
+
2
−
0
View file @
0deef658
...
...
@@ -47,4 +47,6 @@ template <typename MatType,
struct
EigenFromPy
;
}
// namespace eigenpy
#include
"eigenpy/alignment.hpp"
#endif // ifndef __eigenpy_fwd_hpp__
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