Skip to content

Commit

Permalink
We want (most) arrays to be initialized with zeros! Bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyG committed Aug 24, 2015
1 parent 33a3e2c commit bc27f42
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pysais.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static PyObject *python_sais(PyObject *self, PyObject *args)
int n = strlen((const char *)T);
npy_intp dims[2];
dims[0] = n;
SA_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_INT);
SA_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_INT, 0);
SA = pyvector_to_Carrayptrs(SA_np);
int res = sais(T, SA, n);
if (res < 0)
Expand Down Expand Up @@ -89,7 +89,7 @@ static PyObject *python_sais_int(PyObject *self, PyObject *args)
}
npy_intp dims[2];
dims[0] = n;
SA_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_INT);
SA_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_INT, 0);
SA = pyvector_to_Carrayptrs(SA_np);
int res = sais_int(T, SA, n, k);
if (res < 0)
Expand Down Expand Up @@ -231,12 +231,12 @@ static PyObject *python_lcp(PyObject *self, PyObject *args)
}
npy_intp dims[2];
dims[0] = n;
LCP_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_INT);
LCP_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_INT, 0);
LCP = pyvector_to_Carrayptrs(LCP_np);
dims[0]--;
LCP_left_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_INT);
LCP_left_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_INT, 0);
LCP_left = pyvector_to_Carrayptrs(LCP_left_np);
LCP_right_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_INT);
LCP_right_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_INT, 0);
LCP_right = pyvector_to_Carrayptrs(LCP_right_np);
int *rank = malloc(n * sizeof(int));
if (rank == NULL)
Expand Down Expand Up @@ -424,7 +424,7 @@ PyObject *python_count_occurrences(PyObject *self, PyObject *args)
PyArrayObject *counts_np;
char *counts;
int k;
counts_np = (PyArrayObject *) PyArray_SimpleNew(1, dims, NPY_BYTE);
counts_np = (PyArrayObject *) PyArray_ZEROS(1, dims, NPY_BYTE, 0);
if (found)
{
counts = (char *)counts_np->data;
Expand Down Expand Up @@ -491,7 +491,7 @@ PyObject *python_count_position_occurrences(PyObject *self, PyObject *args)
PyArrayObject *counts_np;
char *counts;
int j, k;
counts_np = (PyArrayObject *) PyArray_SimpleNew(2, dims, NPY_BYTE);
counts_np = (PyArrayObject *) PyArray_ZEROS(2, dims, NPY_BYTE, 0);
if (found)
{
counts = (char *)counts_np->data;
Expand Down

0 comments on commit bc27f42

Please sign in to comment.