Commit 2ba453e9 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts

ensure that a numpy array is of type float before using it as a fullmatrix

parent 205a6fdd
Pipeline #2406 failed with stage
in 31 minutes and 32 seconds
......@@ -61,7 +61,7 @@
return fm;
%#ifdef HAVE_NUMPY
PyArrayObject *array = (PyArrayObject*)obj;
if (PyArray_Check(array) && PyArray_ISFARRAY_RO(array) && PyArray_NDIM(array) == 2) {
if (PyArray_Check(array) && PyArray_ISFARRAY_RO(array) && PyArray_NDIM(array) == 2 && PyArray_ISFLOAT(array)) {
newMatrix = true;
return new fullMatrix<double>((double*)PyArray_DATA(array), PyArray_DIM(array, 0), PyArray_DIM(array, 1));
}
......@@ -84,7 +84,7 @@
return fm;
%#ifdef HAVE_NUMPY
PyArrayObject *array = (PyArrayObject*)obj;
if (PyArray_Check(array) && PyArray_ISFARRAY(array) && PyArray_NDIM(array) == 2) {
if (PyArray_Check(array) && PyArray_ISFARRAY(array) && PyArray_NDIM(array) == 2 && PyArray_ISFLOAT(array)) {
newMatrix = true;
return new fullMatrix<double>((double*)PyArray_DATA(array), PyArray_DIM(array, 0), PyArray_DIM(array, 1));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment