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
f5ae7190
Commit
f5ae7190
authored
2 years ago
by
Wilson Jallet
Browse files
Options
Downloads
Patches
Plain Diff
eigen-allocator: go back to allocating when layout is wrong
parent
d6766a20
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-allocator.hpp
+6
-13
6 additions, 13 deletions
include/eigenpy/eigen-allocator.hpp
with
6 additions
and
13 deletions
include/eigenpy/eigen-allocator.hpp
+
6
−
13
View file @
f5ae7190
...
...
@@ -271,10 +271,9 @@ struct EigenAllocator<Eigen::Ref<MatType, Options, Stride> > {
const
int
pyArray_type_code
=
EIGENPY_GET_PY_ARRAY_TYPE
(
pyArray
);
const
int
Scalar_type_code
=
Register
::
getTypeCode
<
Scalar
>
();
if
(
pyArray_type_code
!=
Scalar_type_code
)
need_to_allocate
|=
true
;
if
(
is_arr_layout_compatible_with_mat_type
<
MatType
>
(
pyArray
))
need_to_allocate
|=
false
;
// no need to allocate
else
need_to_allocate
|=
true
;
bool
incompatible_layout
=
!
is_arr_layout_compatible_with_mat_type
<
MatType
>
(
pyArray
);
need_to_allocate
|=
incompatible_layout
;
if
(
Options
!=
Eigen
::
Unaligned
)
// we need to check whether the memory is correctly
// aligned and composed of a continuous segment
...
...
@@ -286,10 +285,6 @@ struct EigenAllocator<Eigen::Ref<MatType, Options, Stride> > {
void
*
raw_ptr
=
storage
->
storage
.
bytes
;
if
(
need_to_allocate
)
{
PyObject
*
pyarr_transposed
=
PyArray_Transpose
(
pyArray
,
NULL
);
allocate
((
PyArrayObject
*
)
pyarr_transposed
,
storage
);
/*
std::cout << " doing allocate\n";
MatType
*
mat_ptr
;
mat_ptr
=
details
::
init_matrix_or_array
<
MatType
>::
run
(
pyArray
);
RefType
mat_ref
(
*
mat_ptr
);
...
...
@@ -340,7 +335,6 @@ struct EigenAllocator<Eigen::Ref<MatType, Options, Stride> > {
throw
Exception
(
"You asked for a conversion which is not implemented."
);
}
*/
}
else
{
assert
(
pyArray_type_code
==
Scalar_type_code
);
typename
NumpyMap
<
MatType
,
Scalar
,
Options
,
NumpyMapStride
>::
EigenMap
...
...
@@ -380,10 +374,9 @@ struct EigenAllocator<const Eigen::Ref<const MatType, Options, Stride> > {
const
int
Scalar_type_code
=
Register
::
getTypeCode
<
Scalar
>
();
if
(
pyArray_type_code
!=
Scalar_type_code
)
need_to_allocate
|=
true
;
if
(
is_arr_layout_compatible_with_mat_type
<
MatType
>
(
pyArray
))
need_to_allocate
|=
false
;
// no need to allocate
else
need_to_allocate
|=
true
;
bool
incompatible_layout
=
!
is_arr_layout_compatible_with_mat_type
<
MatType
>
(
pyArray
);
need_to_allocate
|=
incompatible_layout
;
if
(
Options
!=
Eigen
::
Unaligned
)
// we need to check whether the memory is correctly
// aligned and composed of a continuous segment
...
...
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