Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
eigenpy
Commits
ca8d6b6a
Unverified
Commit
ca8d6b6a
authored
Sep 19, 2019
by
Justin Carpentier
Committed by
GitHub
Sep 19, 2019
Browse files
Merge pull request #89 from jmirabel/devel
Add warnings when implicitly using numpy.matrix.
parents
c6e5497a
8ea359da
Changes
2
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
ca8d6b6a
language
:
python
python
:
-
"
2.7"
-
"
3.5"
sudo
:
required
compiler
:
-
gcc
...
...
include/eigenpy/details.hpp
View file @
ca8d6b6a
...
...
@@ -46,6 +46,7 @@ namespace eigenpy
enum
NP_TYPE
{
DEFAULT_TYPE
,
MATRIX_TYPE
,
ARRAY_TYPE
};
...
...
@@ -66,6 +67,16 @@ namespace eigenpy
bp
::
object
make
(
PyObject
*
pyObj
,
bool
copy
=
false
)
{
if
(
getType
()
==
DEFAULT_TYPE
)
{
std
::
cerr
<<
"eigenpy warning: you use the deprecated class numpy.matrix without explicily asking for it. "
"The default behaviour will change to numpy.array at next major release.
\n
"
"- Either call eigenpy.switchToNumpyMatrix() before using eigenpy to suppress this warning
\n
"
"- or call eigenpy.switchToNumpyArray() and adapt your code accordingly.
\n
"
"See https://github.com/stack-of-tasks/eigenpy/issues/87 for further details."
<<
std
::
endl
;
switchToNumpyMatrix
();
}
bp
::
object
m
;
if
(
PyType_IsSubtype
(
reinterpret_cast
<
PyTypeObject
*>
(
CurrentNumpyType
.
ptr
()),
NumpyMatrixType
))
m
=
NumpyMatrixObject
(
bp
::
object
(
bp
::
handle
<>
(
pyObj
)),
bp
::
object
(),
copy
);
...
...
@@ -122,7 +133,7 @@ namespace eigenpy
//NumpyAsMatrixType = reinterpret_cast<PyTypeObject*>(NumpyAsMatrixObject.ptr());
CurrentNumpyType
=
NumpyMatrixObject
;
// default conversion
getType
()
=
MATRIX
_TYPE
;
getType
()
=
DEFAULT
_TYPE
;
}
bp
::
object
CurrentNumpyType
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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