Skip to content
Snippets Groups Projects
Verified Commit ead61d9f authored by Justin Carpentier's avatar Justin Carpentier
Browse files

core: fix allocate for const Eigen::Ref<const ...

parent 80b1fd72
No related merge requests found
/* /*
* Copyright 2020 INRIA * Copyright 2020-2022 INRIA
*/ */
#ifndef __eigenpy_numpy_allocator_hpp__ #ifndef __eigenpy_numpy_allocator_hpp__
...@@ -116,13 +116,11 @@ template <typename MatType, int Options, typename Stride> ...@@ -116,13 +116,11 @@ template <typename MatType, int Options, typename Stride>
struct NumpyAllocator<const Eigen::Ref<const MatType, Options, Stride> > { struct NumpyAllocator<const Eigen::Ref<const MatType, Options, Stride> > {
typedef const Eigen::Ref<const MatType, Options, Stride> RefType; typedef const Eigen::Ref<const MatType, Options, Stride> RefType;
template <typename SimilarMatrixType>
static PyArrayObject *allocate(RefType &mat, npy_intp nd, npy_intp *shape) { static PyArrayObject *allocate(RefType &mat, npy_intp nd, npy_intp *shape) {
typedef typename SimilarMatrixType::Scalar Scalar; typedef typename RefType::Scalar Scalar;
enum { enum {
NPY_ARRAY_MEMORY_CONTIGUOUS_RO = SimilarMatrixType::IsRowMajor NPY_ARRAY_MEMORY_CONTIGUOUS_RO =
? NPY_ARRAY_CARRAY_RO RefType::IsRowMajor ? NPY_ARRAY_CARRAY_RO : NPY_ARRAY_FARRAY_RO
: NPY_ARRAY_FARRAY_RO
}; };
if (NumpyType::sharedMemory()) { if (NumpyType::sharedMemory()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment