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
cdcfab5d
Verified
Commit
cdcfab5d
authored
Jun 15, 2021
by
Justin Carpentier
Browse files
core: fix definition order
parent
e402f5d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/eigenpy/numpy-type.hpp
View file @
cdcfab5d
...
...
@@ -7,6 +7,7 @@
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/scalar-conversion.hpp"
#include
"eigenpy/register.hpp"
#include
<stdexcept>
#include
<typeinfo>
...
...
@@ -16,27 +17,6 @@ namespace eigenpy
{
namespace
bp
=
boost
::
python
;
// By default, the Scalar is considered as a Python object
template
<
typename
Scalar
>
struct
NumpyEquivalentType
{
enum
{
type_code
=
NPY_USERDEF
};};
template
<
>
struct
NumpyEquivalentType
<
float
>
{
enum
{
type_code
=
NPY_FLOAT
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
float
>
>
{
enum
{
type_code
=
NPY_CFLOAT
};};
template
<
>
struct
NumpyEquivalentType
<
double
>
{
enum
{
type_code
=
NPY_DOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
double
>
>
{
enum
{
type_code
=
NPY_CDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
long
double
>
{
enum
{
type_code
=
NPY_LONGDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
long
double
>
>
{
enum
{
type_code
=
NPY_CLONGDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
bool
>
{
enum
{
type_code
=
NPY_BOOL
};};
template
<
>
struct
NumpyEquivalentType
<
int
>
{
enum
{
type_code
=
NPY_INT
};};
template
<
>
struct
NumpyEquivalentType
<
long
>
{
enum
{
type_code
=
NPY_LONG
};};
template
<
typename
Scalar
>
bool
isNumpyNativeType
()
{
if
((
int
)
NumpyEquivalentType
<
Scalar
>::
type_code
==
NPY_USERDEF
)
return
false
;
return
true
;
}
template
<
typename
Scalar
>
bool
np_type_is_convertible_into_scalar
(
const
int
np_type
)
{
...
...
include/eigenpy/numpy.hpp
View file @
cdcfab5d
...
...
@@ -31,6 +31,28 @@ namespace eigenpy
{
void
EIGENPY_DLLAPI
import_numpy
();
int
EIGENPY_DLLAPI
PyArray_TypeNum
(
PyTypeObject
*
type
);
// By default, the Scalar is considered as a Python object
template
<
typename
Scalar
>
struct
NumpyEquivalentType
{
enum
{
type_code
=
NPY_USERDEF
};};
template
<
>
struct
NumpyEquivalentType
<
float
>
{
enum
{
type_code
=
NPY_FLOAT
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
float
>
>
{
enum
{
type_code
=
NPY_CFLOAT
};};
template
<
>
struct
NumpyEquivalentType
<
double
>
{
enum
{
type_code
=
NPY_DOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
double
>
>
{
enum
{
type_code
=
NPY_CDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
long
double
>
{
enum
{
type_code
=
NPY_LONGDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
std
::
complex
<
long
double
>
>
{
enum
{
type_code
=
NPY_CLONGDOUBLE
};};
template
<
>
struct
NumpyEquivalentType
<
bool
>
{
enum
{
type_code
=
NPY_BOOL
};};
template
<
>
struct
NumpyEquivalentType
<
int
>
{
enum
{
type_code
=
NPY_INT
};};
template
<
>
struct
NumpyEquivalentType
<
long
>
{
enum
{
type_code
=
NPY_LONG
};};
template
<
typename
Scalar
>
bool
isNumpyNativeType
()
{
if
((
int
)
NumpyEquivalentType
<
Scalar
>::
type_code
==
NPY_USERDEF
)
return
false
;
return
true
;
}
}
#if defined _WIN32 || defined __CYGWIN__
...
...
include/eigenpy/register.hpp
View file @
cdcfab5d
...
...
@@ -6,7 +6,7 @@
#define __eigenpy_register_hpp__
#include
"eigenpy/fwd.hpp"
#include
"eigenpy/numpy
-type
.hpp"
#include
"eigenpy/numpy.hpp"
#include
"eigenpy/exception.hpp"
#include
<algorithm>
...
...
@@ -36,6 +36,7 @@ namespace eigenpy
template
<
typename
Scalar
>
static
PyTypeObject
*
getPyType
()
{
namespace
bp
=
boost
::
python
;
if
(
!
isNumpyNativeType
<
Scalar
>
())
{
const
PyTypeObject
*
const_py_type_ptr
=
bp
::
converter
::
registered_pytype
<
Scalar
>::
get_pytype
();
...
...
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