Marcel Plch 180d901
diff -ru scipy-1.2.1/scipy/odr/__odrpack.c scipy-1.2.1_patched/scipy/odr/__odrpack.c
Marcel Plch 180d901
--- scipy-1.2.1/scipy/odr/__odrpack.c	2019-01-28 04:57:51.000000000 +0100
Marcel Plch 180d901
+++ scipy-1.2.1_patched/scipy/odr/__odrpack.c	2019-06-06 16:11:32.947892754 +0200
Marcel Plch 180d901
@@ -9,6 +9,8 @@
Marcel Plch 180d901
  *
Marcel Plch 180d901
  */
Marcel Plch 180d901
 
Marcel Plch 180d901
+#define PY_SSIZE_T_CLEAN
Marcel Plch 180d901
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
Marcel Plch 180d901
 #include "odrpack.h"
Marcel Plch 180d901
 
Marcel Plch 180d901
 
Marcel Plch 180d901
@@ -44,7 +46,7 @@
Marcel Plch 180d901
                   double *fjacb, double *fjacd, int *istop)
Marcel Plch 180d901
 {
Marcel Plch 180d901
   PyObject *arg01, *arglist;
Marcel Plch 180d901
-  PyObject *result;
Marcel Plch 180d901
+  PyObject *result = NULL;
Marcel Plch 180d901
   PyArrayObject *result_array = NULL;
Marcel Plch 180d901
   PyArrayObject *pyXplusD;
Marcel Plch 180d901
   void *beta_dst;
Marcel Plch 180d901
@@ -57,14 +59,14 @@
Marcel Plch 180d901
       dim2[0] = *m;
Marcel Plch 180d901
       dim2[1] = *n;
Marcel Plch 180d901
       pyXplusD = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_DOUBLE);
Marcel Plch 180d901
-      memcpy(pyXplusD->data, (void *)xplusd, (*m) * (*n) * sizeof(double));
Marcel Plch 180d901
+      memcpy(PyArray_DATA(pyXplusD), (void *)xplusd, (*m) * (*n) * sizeof(double));
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
     {
Marcel Plch 180d901
       npy_intp dim1[1];
Marcel Plch 180d901
       dim1[0] = *n;
Marcel Plch 180d901
       pyXplusD = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-      memcpy(pyXplusD->data, (void *)xplusd, (*n) * sizeof(double));
Marcel Plch 180d901
+      memcpy(PyArray_DATA(pyXplusD), (void *)xplusd, (*n) * sizeof(double));
Marcel Plch 180d901
     }
Marcel Plch 180d901
 
Marcel Plch 180d901
   PyTuple_SetItem(arg01, 0, odr_global.pyBeta);
Marcel Plch 180d901
@@ -84,7 +86,7 @@
Marcel Plch 180d901
   Py_DECREF(arg01);
Marcel Plch 180d901
   *istop = 0;
Marcel Plch 180d901
 
Marcel Plch 180d901
-  beta_dst = ((PyArrayObject *) (odr_global.pyBeta))->data;
Marcel Plch 180d901
+  beta_dst = (PyArray_DATA((PyArrayObject *) odr_global.pyBeta));
Marcel Plch 180d901
   if (beta != beta_dst) {
Marcel Plch 180d901
       memcpy(beta_dst, (void *)beta, (*np) * sizeof(double));
Marcel Plch 180d901
   }
Marcel Plch 180d901
@@ -121,7 +123,7 @@
Marcel Plch 180d901
                  "Result from function call is not a proper array of floats.");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      memcpy((void *)f, result_array->data, (*n) * (*nq) * sizeof(double));
Marcel Plch 180d901
+      memcpy((void *)f, PyArray_DATA(result_array), (*n) * (*nq) * sizeof(double));
Marcel Plch 180d901
       Py_DECREF(result_array);
Marcel Plch 180d901
     }
Marcel Plch 180d901
 
Marcel Plch 180d901
@@ -161,7 +163,7 @@
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* result_array should be rank-3 */
Marcel Plch 180d901
 
Marcel Plch 180d901
-          if (result_array->nd != 3)
Marcel Plch 180d901
+          if (PyArray_NDIM(result_array) != 3)
Marcel Plch 180d901
             {
Marcel Plch 180d901
               Py_DECREF(result_array);
Marcel Plch 180d901
               PYERR2(odr_error, "Beta Jacobian is not rank-3");
Marcel Plch 180d901
@@ -171,14 +173,14 @@
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* result_array should be rank-2 */
Marcel Plch 180d901
 
Marcel Plch 180d901
-          if (result_array->nd != 2)
Marcel Plch 180d901
+          if (PyArray_NDIM(result_array) != 2)
Marcel Plch 180d901
             {
Marcel Plch 180d901
               Py_DECREF(result_array);
Marcel Plch 180d901
               PYERR2(odr_error, "Beta Jacobian is not rank-2");
Marcel Plch 180d901
             }
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      memcpy((void *)fjacb, result_array->data,
Marcel Plch 180d901
+      memcpy((void *)fjacb, PyArray_DATA(result_array),
Marcel Plch 180d901
              (*n) * (*nq) * (*np) * sizeof(double));
Marcel Plch 180d901
       Py_DECREF(result_array);
Marcel Plch 180d901
 
Marcel Plch 180d901
@@ -220,7 +222,7 @@
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* result_array should be rank-3 */
Marcel Plch 180d901
 
Marcel Plch 180d901
-          if (result_array->nd != 3)
Marcel Plch 180d901
+          if (PyArray_NDIM(result_array) != 3)
Marcel Plch 180d901
             {
Marcel Plch 180d901
               Py_DECREF(result_array);
Marcel Plch 180d901
               PYERR2(odr_error, "xplusd Jacobian is not rank-3");
Marcel Plch 180d901
@@ -230,7 +232,7 @@
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* result_array should be rank-2 */
Marcel Plch 180d901
 
Marcel Plch 180d901
-          if (result_array->nd != 2)
Marcel Plch 180d901
+          if (PyArray_NDIM(result_array) != 2)
Marcel Plch 180d901
             {
Marcel Plch 180d901
               Py_DECREF(result_array);
Marcel Plch 180d901
               PYERR2(odr_error, "xplusd Jacobian is not rank-2");
Marcel Plch 180d901
@@ -240,14 +242,14 @@
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* result_array should be rank-1 */
Marcel Plch 180d901
 
Marcel Plch 180d901
-          if (result_array->nd != 1)
Marcel Plch 180d901
+          if (PyArray_NDIM(result_array) != 1)
Marcel Plch 180d901
             {
Marcel Plch 180d901
               Py_DECREF(result_array);
Marcel Plch 180d901
               PYERR2(odr_error, "xplusd Jacobian is not rank-1");
Marcel Plch 180d901
             }
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      memcpy((void *)fjacd, result_array->data,
Marcel Plch 180d901
+      memcpy((void *)fjacd, PyArray_DATA(result_array),
Marcel Plch 180d901
              (*n) * (*nq) * (*m) * sizeof(double));
Marcel Plch 180d901
       Py_DECREF(result_array);
Marcel Plch 180d901
     }
Marcel Plch 180d901
@@ -291,7 +293,7 @@
Marcel Plch 180d901
       return NULL;
Marcel Plch 180d901
   }
Marcel Plch 180d901
 
Marcel Plch 180d901
-  lwkmn = work->dimensions[0];
Marcel Plch 180d901
+  lwkmn = PyArray_DIMS(work)[0];
Marcel Plch 180d901
 
Marcel Plch 180d901
   F_FUNC(dwinf,DWINF)(&n, &m, &np, &nq, &ldwe, &ld2we, &isodr,
Marcel Plch 180d901
         &delta, &eps, &xplus, &fn, &sd, &vcv, &rvar, &wss, &wssde,
Marcel Plch 180d901
@@ -352,15 +354,15 @@
Marcel Plch 180d901
   wrk6--;
Marcel Plch 180d901
   wrk7--;
Marcel Plch 180d901
 
Marcel Plch 180d901
-  dim1[0] = beta->dimensions[0];
Marcel Plch 180d901
+  dim1[0] = PyArray_DIMS(beta)[0];
Marcel Plch 180d901
   sd_beta = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-  dim2[0] = beta->dimensions[0];
Marcel Plch 180d901
-  dim2[1] = beta->dimensions[0];
Marcel Plch 180d901
+  dim2[0] = PyArray_DIMS(beta)[0];
Marcel Plch 180d901
+  dim2[1] = PyArray_DIMS(beta)[0];
Marcel Plch 180d901
   cov_beta = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_DOUBLE);
Marcel Plch 180d901
 
Marcel Plch 180d901
-  memcpy(sd_beta->data, (void *)((double *)(work->data) + sd),
Marcel Plch 180d901
+  memcpy(PyArray_DATA(sd_beta), (void *)((double *)(PyArray_DATA(work)) + sd),
Marcel Plch 180d901
          np * sizeof(double));
Marcel Plch 180d901
-  memcpy(cov_beta->data, (void *)((double *)(work->data) + vcv),
Marcel Plch 180d901
+  memcpy(PyArray_DATA(cov_beta), (void *)((double *)(PyArray_DATA(work)) + vcv),
Marcel Plch 180d901
          np * np * sizeof(double));
Marcel Plch 180d901
 
Marcel Plch 180d901
   if (!full_output)
Marcel Plch 180d901
@@ -427,21 +429,21 @@
Marcel Plch 180d901
           fnA = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_DOUBLE);
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      memcpy(deltaA->data, (void *)((double *)(work->data) + delta),
Marcel Plch 180d901
+      memcpy(PyArray_DATA(deltaA), (void *)((double *)(PyArray_DATA(work)) + delta),
Marcel Plch 180d901
              m * n * sizeof(double));
Marcel Plch 180d901
-      memcpy(epsA->data, (void *)((double *)(work->data) + eps),
Marcel Plch 180d901
+      memcpy(PyArray_DATA(epsA), (void *)((double *)(PyArray_DATA(work)) + eps),
Marcel Plch 180d901
              nq * n * sizeof(double));
Marcel Plch 180d901
-      memcpy(xplusA->data, (void *)((double *)(work->data) + xplus),
Marcel Plch 180d901
+      memcpy(PyArray_DATA(xplusA), (void *)((double *)(PyArray_DATA(work)) + xplus),
Marcel Plch 180d901
              m * n * sizeof(double));
Marcel Plch 180d901
-      memcpy(fnA->data, (void *)((double *)(work->data) + fn),
Marcel Plch 180d901
+      memcpy(PyArray_DATA(fnA), (void *)((double *)(PyArray_DATA(work)) + fn),
Marcel Plch 180d901
              nq * n * sizeof(double));
Marcel Plch 180d901
 
Marcel Plch 180d901
-      res_var = *((double *)(work->data) + rvar);
Marcel Plch 180d901
-      sum_square = *((double *)(work->data) + wss);
Marcel Plch 180d901
-      sum_square_delta = *((double *)(work->data) + wssde);
Marcel Plch 180d901
-      sum_square_eps = *((double *)(work->data) + wssep);
Marcel Plch 180d901
-      inv_condnum = *((double *)(work->data) + rcond);
Marcel Plch 180d901
-      rel_error = *((double *)(work->data) + eta);
Marcel Plch 180d901
+      res_var = *((double *)(PyArray_DATA(work)) + rvar);
Marcel Plch 180d901
+      sum_square = *((double *)(PyArray_DATA(work)) + wss);
Marcel Plch 180d901
+      sum_square_delta = *((double *)(PyArray_DATA(work)) + wssde);
Marcel Plch 180d901
+      sum_square_eps = *((double *)(PyArray_DATA(work)) + wssep);
Marcel Plch 180d901
+      inv_condnum = *((double *)(PyArray_DATA(work)) + rcond);
Marcel Plch 180d901
+      rel_error = *((double *)(PyArray_DATA(work)) + eta);
Marcel Plch 180d901
 
Marcel Plch 180d901
       retobj =
Marcel Plch 180d901
         Py_BuildValue
Marcel Plch 180d901
@@ -623,7 +625,7 @@
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "y could not be made into a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      n = y->dimensions[y->nd - 1];     /* pick the last dimension */
Marcel Plch 180d901
+      n = PyArray_DIMS(y)[PyArray_NDIM(y) - 1];     /* pick the last dimension */
Marcel Plch 180d901
       if ((x =
Marcel Plch 180d901
            (PyArrayObject *) PyArray_CopyFromObject(px, NPY_DOUBLE, 1,
Marcel Plch 180d901
                                                     2)) == NULL)
Marcel Plch 180d901
@@ -631,18 +633,18 @@
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "x could not be made into a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      if (n != x->dimensions[x->nd - 1])
Marcel Plch 180d901
+      if (n != PyArray_DIMS(x)[PyArray_NDIM(x) - 1])
Marcel Plch 180d901
         {
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "x and y don't have matching numbers of observations");
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      if (y->nd == 1)
Marcel Plch 180d901
+      if (PyArray_NDIM(y) == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           nq = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
       else
Marcel Plch 180d901
         {
Marcel Plch 180d901
-          nq = y->dimensions[0];
Marcel Plch 180d901
+          nq = PyArray_DIMS(y)[0];
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
       ldx = ldy = n;
Marcel Plch 180d901
@@ -664,17 +666,17 @@
Marcel Plch 180d901
                 "x could not be made into a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      n = x->dimensions[x->nd - 1];
Marcel Plch 180d901
+      n = PyArray_DIMS(x)[PyArray_NDIM(x) - 1];
Marcel Plch 180d901
       ldx = n;
Marcel Plch 180d901
     }
Marcel Plch 180d901
 
Marcel Plch 180d901
-  if (x->nd == 1)
Marcel Plch 180d901
+  if (PyArray_NDIM(x) == 1)
Marcel Plch 180d901
     {
Marcel Plch 180d901
       m = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
     {
Marcel Plch 180d901
-      m = x->dimensions[0];
Marcel Plch 180d901
+      m = PyArray_DIMS(x)[0];
Marcel Plch 180d901
     }                           /* x, y */
Marcel Plch 180d901
 
Marcel Plch 180d901
   if ((beta =
Marcel Plch 180d901
@@ -684,14 +686,14 @@
Marcel Plch 180d901
       PYERR(PyExc_ValueError,
Marcel Plch 180d901
             "initbeta could not be made into a suitable array");
Marcel Plch 180d901
     }
Marcel Plch 180d901
-  np = beta->dimensions[0];
Marcel Plch 180d901
+  np = PyArray_DIMS(beta)[0];
Marcel Plch 180d901
 
Marcel Plch 180d901
   if (pwe == NULL)
Marcel Plch 180d901
     {
Marcel Plch 180d901
       ldwe = ld2we = 1;
Marcel Plch 180d901
       dim1[0] = n;
Marcel Plch 180d901
       we = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-      ((double *)(we->data))[0] = -1.0;
Marcel Plch 180d901
+      ((double *)(PyArray_DATA(we)))[0] = -1.0;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else if (PyNumber_Check(pwe) && !PyArray_Check(pwe))
Marcel Plch 180d901
     {
Marcel Plch 180d901
@@ -711,11 +713,11 @@
Marcel Plch 180d901
       we = (PyArrayObject *) PyArray_SimpleNew(3, dim3, NPY_DOUBLE);
Marcel Plch 180d901
       if (implicit)
Marcel Plch 180d901
         {
Marcel Plch 180d901
-          ((double *)(we->data))[0] = val;
Marcel Plch 180d901
+          ((double *)(PyArray_DATA(we)))[0] = val;
Marcel Plch 180d901
         }
Marcel Plch 180d901
       else
Marcel Plch 180d901
         {
Marcel Plch 180d901
-          ((double *)(we->data))[0] = -val;
Marcel Plch 180d901
+          ((double *)(PyArray_DATA(we)))[0] = -val;
Marcel Plch 180d901
         }
Marcel Plch 180d901
       ldwe = ld2we = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
@@ -730,29 +732,29 @@
Marcel Plch 180d901
           PYERR(PyExc_ValueError, "could not convert we to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (we->nd == 1 && nq == 1)
Marcel Plch 180d901
+      if (PyArray_NDIM(we) == 1 && nq == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
 
Marcel Plch 180d901
           ldwe = n;
Marcel Plch 180d901
           ld2we = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (we->nd == 1 && we->dimensions[0] == nq)
Marcel Plch 180d901
+      else if (PyArray_NDIM(we) == 1 && PyArray_DIMS(we)[0] == nq)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* we is a rank-1 array with diagonal weightings to be broadcast 
Marcel Plch 180d901
            * to all observations */
Marcel Plch 180d901
           ldwe = 1;
Marcel Plch 180d901
           ld2we = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (we->nd == 3 && we->dimensions[0] == nq
Marcel Plch 180d901
-               && we->dimensions[1] == nq && we->dimensions[2] == 1)
Marcel Plch 180d901
+      else if (PyArray_NDIM(we) == 3 && PyArray_DIMS(we)[0] == nq
Marcel Plch 180d901
+               && PyArray_DIMS(we)[1] == nq && PyArray_DIMS(we)[2] == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* we is a rank-3 array with the covariant weightings 
Marcel Plch 180d901
              to be broadcast to all observations */
Marcel Plch 180d901
           ldwe = 1;
Marcel Plch 180d901
           ld2we = nq;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (we->nd == 2 && we->dimensions[0] == nq
Marcel Plch 180d901
-               && we->dimensions[1] == nq)
Marcel Plch 180d901
+      else if (PyArray_NDIM(we) == 2 && PyArray_DIMS(we)[0] == nq
Marcel Plch 180d901
+               && PyArray_DIMS(we)[1] == nq)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* we is a rank-2 array with the full covariant weightings 
Marcel Plch 180d901
              to be broadcast to all observations */
Marcel Plch 180d901
@@ -760,16 +762,16 @@
Marcel Plch 180d901
           ld2we = nq;
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      else if (we->nd == 2 && we->dimensions[0] == nq
Marcel Plch 180d901
-               && we->dimensions[1] == n)
Marcel Plch 180d901
+      else if (PyArray_NDIM(we) == 2 && PyArray_DIMS(we)[0] == nq
Marcel Plch 180d901
+               && PyArray_DIMS(we)[1] == n)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* we is a rank-2 array with the diagonal elements of the 
Marcel Plch 180d901
              covariant weightings for each observation */
Marcel Plch 180d901
           ldwe = n;
Marcel Plch 180d901
           ld2we = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (we->nd == 3 && we->dimensions[0] == nq
Marcel Plch 180d901
-               && we->dimensions[1] == nq && we->dimensions[2] == n)
Marcel Plch 180d901
+      else if (PyArray_NDIM(we) == 3 && PyArray_DIMS(we)[0] == nq
Marcel Plch 180d901
+               && PyArray_DIMS(we)[1] == nq && PyArray_DIMS(we)[2] == n)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* we is the full specification of the covariant weights
Marcel Plch 180d901
              for each observation */
Marcel Plch 180d901
@@ -788,7 +790,7 @@
Marcel Plch 180d901
 
Marcel Plch 180d901
       dim1[0] = m;
Marcel Plch 180d901
       wd = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-      ((double *)(wd->data))[0] = -1.0;
Marcel Plch 180d901
+      ((double *)(PyArray_DATA(wd)))[0] = -1.0;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else if (PyNumber_Check(pwd) && !PyArray_Check(pwd))
Marcel Plch 180d901
     {
Marcel Plch 180d901
@@ -806,7 +808,7 @@
Marcel Plch 180d901
       dim3[1] = 1;
Marcel Plch 180d901
       dim3[2] = m;
Marcel Plch 180d901
       wd = (PyArrayObject *) PyArray_SimpleNew(3, dim3, NPY_DOUBLE);
Marcel Plch 180d901
-      ((double *)(wd->data))[0] = -val;
Marcel Plch 180d901
+      ((double *)(PyArray_DATA(wd)))[0] = -val;
Marcel Plch 180d901
       ldwd = ld2wd = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else if (PySequence_Check(pwd))
Marcel Plch 180d901
@@ -820,12 +822,12 @@
Marcel Plch 180d901
           PYERR(PyExc_ValueError, "could not convert wd to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (wd->nd == 1 && m == 1)
Marcel Plch 180d901
+      if (PyArray_NDIM(wd) == 1 && m == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldwd = n;
Marcel Plch 180d901
           ld2wd = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (wd->nd == 1 && wd->dimensions[0] == m)
Marcel Plch 180d901
+      else if (PyArray_NDIM(wd) == 1 && PyArray_DIMS(wd)[0] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* wd is a rank-1 array with diagonal weightings to be broadcast 
Marcel Plch 180d901
            * to all observations */
Marcel Plch 180d901
@@ -833,16 +835,16 @@
Marcel Plch 180d901
           ld2wd = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      else if (wd->nd == 3 && wd->dimensions[0] == m
Marcel Plch 180d901
-               && wd->dimensions[1] == m && wd->dimensions[2] == 1)
Marcel Plch 180d901
+      else if (PyArray_NDIM(wd) == 3 && PyArray_DIMS(wd)[0] == m
Marcel Plch 180d901
+               && PyArray_DIMS(wd)[1] == m && PyArray_DIMS(wd)[2] == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* wd is a rank-3 array with the covariant wdightings 
Marcel Plch 180d901
              to be broadcast to all observations */
Marcel Plch 180d901
           ldwd = 1;
Marcel Plch 180d901
           ld2wd = m;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (wd->nd == 2 && wd->dimensions[0] == m
Marcel Plch 180d901
-               && wd->dimensions[1] == m)
Marcel Plch 180d901
+      else if (PyArray_NDIM(wd) == 2 && PyArray_DIMS(wd)[0] == m
Marcel Plch 180d901
+               && PyArray_DIMS(wd)[1] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* wd is a rank-2 array with the full covariant weightings 
Marcel Plch 180d901
              to be broadcast to all observations */
Marcel Plch 180d901
@@ -850,16 +852,16 @@
Marcel Plch 180d901
           ld2wd = m;
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      else if (wd->nd == 2 && wd->dimensions[0] == m
Marcel Plch 180d901
-               && wd->dimensions[1] == n)
Marcel Plch 180d901
+      else if (PyArray_NDIM(wd) == 2 && PyArray_DIMS(wd)[0] == m
Marcel Plch 180d901
+               && PyArray_DIMS(wd)[1] == n)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* wd is a rank-2 array with the diagonal elements of the 
Marcel Plch 180d901
              covariant weightings for each observation */
Marcel Plch 180d901
           ldwd = n;
Marcel Plch 180d901
           ld2wd = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (wd->nd == 3 && wd->dimensions[0] == m
Marcel Plch 180d901
-               && wd->dimensions[1] == m && wd->dimensions[2] == n)
Marcel Plch 180d901
+      else if (PyArray_NDIM(wd) == 3 && PyArray_DIMS(wd)[0] == m
Marcel Plch 180d901
+               && PyArray_DIMS(wd)[1] == m && PyArray_DIMS(wd)[2] == n)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           /* wd is the full specification of the covariant weights
Marcel Plch 180d901
              for each observation */
Marcel Plch 180d901
@@ -878,7 +880,7 @@
Marcel Plch 180d901
     {
Marcel Plch 180d901
       dim1[0] = np;
Marcel Plch 180d901
       ifixb = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_INT);
Marcel Plch 180d901
-      *(int *)(ifixb->data) = -1;      /* set first element negative */
Marcel Plch 180d901
+      *(int *)(PyArray_DATA(ifixb)) = -1;      /* set first element negative */
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
     {
Marcel Plch 180d901
@@ -892,7 +894,7 @@
Marcel Plch 180d901
                 "could not convert ifixb to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (ifixb->dimensions[0] != np)
Marcel Plch 180d901
+      if (PyArray_DIMS(ifixb)[0] != np)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "could not convert ifixb to a suitable array");
Marcel Plch 180d901
@@ -904,7 +906,7 @@
Marcel Plch 180d901
       dim2[0] = m;
Marcel Plch 180d901
       dim2[1] = 1;
Marcel Plch 180d901
       ifixx = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_INT);
Marcel Plch 180d901
-      *(int *)(ifixx->data) = -1;      /* set first element negative */
Marcel Plch 180d901
+      *(int *)(PyArray_DATA(ifixx)) = -1;      /* set first element negative */
Marcel Plch 180d901
       ldifx = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
@@ -919,16 +921,16 @@
Marcel Plch 180d901
                 "could not convert ifixx to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (ifixx->nd == 1 && ifixx->dimensions[0] == m)
Marcel Plch 180d901
+      if (PyArray_NDIM(ifixx) == 1 && PyArray_DIMS(ifixx)[0] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldifx = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (ifixx->nd == 1 && ifixx->dimensions[0] == n && m == 1)
Marcel Plch 180d901
+      else if (PyArray_NDIM(ifixx) == 1 && PyArray_DIMS(ifixx)[0] == n && m == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldifx = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (ifixx->nd == 2 && ifixx->dimensions[0] == m
Marcel Plch 180d901
-               && ifixx->dimensions[1] == n)
Marcel Plch 180d901
+      else if (PyArray_NDIM(ifixx) == 2 && PyArray_DIMS(ifixx)[0] == m
Marcel Plch 180d901
+               && PyArray_DIMS(ifixx)[1] == n)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldifx = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
@@ -957,14 +959,14 @@
Marcel Plch 180d901
     {
Marcel Plch 180d901
       dim1[0] = np;
Marcel Plch 180d901
       stpb = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-      *(double *)(stpb->data) = 0.0;
Marcel Plch 180d901
+      *(double *)(PyArray_DATA(stpb)) = 0.0;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else                          /* pstpb is a sequence */
Marcel Plch 180d901
     {
Marcel Plch 180d901
       if ((stpb =
Marcel Plch 180d901
            (PyArrayObject *) PyArray_CopyFromObject(pstpb, NPY_DOUBLE, 1,
Marcel Plch 180d901
                                                     1)) == NULL
Marcel Plch 180d901
-          || stpb->dimensions[0] != np)
Marcel Plch 180d901
+          || PyArray_DIMS(stpb)[0] != np)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "could not convert stpb to a suitable array");
Marcel Plch 180d901
@@ -976,7 +978,7 @@
Marcel Plch 180d901
       dim2[0] = 1;
Marcel Plch 180d901
       dim2[1] = m;
Marcel Plch 180d901
       stpd = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_DOUBLE);
Marcel Plch 180d901
-      *(double *)(stpd->data) = 0.0;
Marcel Plch 180d901
+      *(double *)(PyArray_DATA(stpd)) = 0.0;
Marcel Plch 180d901
       ldstpd = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
@@ -989,16 +991,16 @@
Marcel Plch 180d901
                 "could not convert stpb to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (stpd->nd == 1 && stpd->dimensions[0] == m)
Marcel Plch 180d901
+      if (PyArray_NDIM(stpd) == 1 && PyArray_DIMS(stpd)[0] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldstpd = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (stpd->nd == 1 && stpd->dimensions[0] == n && m == 1)
Marcel Plch 180d901
+      else if (PyArray_NDIM(stpd) == 1 && PyArray_DIMS(stpd)[0] == n && m == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldstpd = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (stpd->nd == 2 && stpd->dimensions[0] == n &&
Marcel Plch 180d901
-               stpd->dimensions[1] == m)
Marcel Plch 180d901
+      else if (PyArray_NDIM(stpd) == 2 && PyArray_DIMS(stpd)[0] == n &&
Marcel Plch 180d901
+               PyArray_DIMS(stpd)[1] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldstpd = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
@@ -1008,14 +1010,14 @@
Marcel Plch 180d901
     {
Marcel Plch 180d901
       dim1[0] = np;
Marcel Plch 180d901
       sclb = (PyArrayObject *) PyArray_SimpleNew(1, dim1, NPY_DOUBLE);
Marcel Plch 180d901
-      *(double *)(sclb->data) = 0.0;
Marcel Plch 180d901
+      *(double *)(PyArray_DATA(sclb)) = 0.0;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else                          /* psclb is a sequence */
Marcel Plch 180d901
     {
Marcel Plch 180d901
       if ((sclb =
Marcel Plch 180d901
            (PyArrayObject *) PyArray_CopyFromObject(psclb, NPY_DOUBLE, 1,
Marcel Plch 180d901
                                                     1)) == NULL
Marcel Plch 180d901
-          || sclb->dimensions[0] != np)
Marcel Plch 180d901
+          || PyArray_DIMS(sclb)[0] != np)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "could not convert sclb to a suitable array");
Marcel Plch 180d901
@@ -1027,7 +1029,7 @@
Marcel Plch 180d901
       dim2[0] = 1;
Marcel Plch 180d901
       dim2[1] = n;
Marcel Plch 180d901
       scld = (PyArrayObject *) PyArray_SimpleNew(2, dim2, NPY_DOUBLE);
Marcel Plch 180d901
-      *(double *)(scld->data) = 0.0;
Marcel Plch 180d901
+      *(double *)(PyArray_DATA(scld)) = 0.0;
Marcel Plch 180d901
       ldscld = 1;
Marcel Plch 180d901
     }
Marcel Plch 180d901
   else
Marcel Plch 180d901
@@ -1040,16 +1042,16 @@
Marcel Plch 180d901
                 "could not convert stpb to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (scld->nd == 1 && scld->dimensions[0] == m)
Marcel Plch 180d901
+      if (PyArray_NDIM(scld) == 1 && PyArray_DIMS(scld)[0] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldscld = 1;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (scld->nd == 1 && scld->dimensions[0] == n && m == 1)
Marcel Plch 180d901
+      else if (PyArray_NDIM(scld) == 1 && PyArray_DIMS(scld)[0] == n && m == 1)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldscld = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      else if (scld->nd == 2 && scld->dimensions[0] == n &&
Marcel Plch 180d901
-               scld->dimensions[1] == m)
Marcel Plch 180d901
+      else if (PyArray_NDIM(scld) == 2 && PyArray_DIMS(scld)[0] == n &&
Marcel Plch 180d901
+               PyArray_DIMS(scld)[1] == m)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           ldscld = n;
Marcel Plch 180d901
         }
Marcel Plch 180d901
@@ -1110,9 +1112,9 @@
Marcel Plch 180d901
           PYERR(PyExc_ValueError,
Marcel Plch 180d901
                 "could not convert work to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
-      if (work->dimensions[0] < lwork)
Marcel Plch 180d901
+      if (PyArray_DIMS(work)[0] < lwork)
Marcel Plch 180d901
         {
Marcel Plch 180d901
-            printf("%d %d\n", work->dimensions[0], lwork);
Marcel Plch 180d901
+            printf("%ld %d\n", PyArray_DIMS(work)[0], lwork);
Marcel Plch 180d901
           PYERR(PyExc_ValueError, "work is too small");
Marcel Plch 180d901
         }
Marcel Plch 180d901
     }
Marcel Plch 180d901
@@ -1133,7 +1135,7 @@
Marcel Plch 180d901
                 "could not convert iwork to a suitable array");
Marcel Plch 180d901
         }
Marcel Plch 180d901
 
Marcel Plch 180d901
-      if (iwork->dimensions[0] < liwork)
Marcel Plch 180d901
+      if (PyArray_DIMS(iwork)[0] < liwork)
Marcel Plch 180d901
         {
Marcel Plch 180d901
           PYERR(PyExc_ValueError, "iwork is too small");
Marcel Plch 180d901
         }
Marcel Plch 180d901
@@ -1170,19 +1172,18 @@
Marcel Plch 180d901
   Py_INCREF(beta);
Marcel Plch 180d901
   odr_global.extra_args = extra_args;
Marcel Plch 180d901
   Py_XINCREF(extra_args);
Marcel Plch 180d901
-
Marcel Plch 180d901
-  /* now call DODRC */
Marcel Plch 180d901
-  F_FUNC(dodrc,DODRC)(fcn_callback, &n, &m, &np, &nq, (double *)(beta->data),
Marcel Plch 180d901
-        (double *)(y->data), &ldy, (double *)(x->data), &ldx,
Marcel Plch 180d901
-        (double *)(we->data), &ldwe, &ld2we,
Marcel Plch 180d901
-        (double *)(wd->data), &ldwd, &ld2wd,
Marcel Plch 180d901
-        (int *)(ifixb->data), (int *)(ifixx->data), &ldifx,
Marcel Plch 180d901
-        &job, &ndigit, &taufac, &sstol, &partol, &maxit,
Marcel Plch 180d901
-        &iprint, &lunerr, &lunrpt,
Marcel Plch 180d901
-        (double *)(stpb->data), (double *)(stpd->data), &ldstpd,
Marcel Plch 180d901
-        (double *)(sclb->data), (double *)(scld->data), &ldscld,
Marcel Plch 180d901
-        (double *)(work->data), &lwork, (int *)(iwork->data), &liwork,
Marcel Plch 180d901
-        &info;;
Marcel Plch 180d901
+   /* now call DODRC */
Marcel Plch 180d901
+   F_FUNC(dodrc,DODRC)(fcn_callback, &n, &m, &np, &nq, (double *)(PyArray_DATA(beta)),
Marcel Plch 180d901
+         (double *)(PyArray_DATA(y)), &ldy, (double *)(PyArray_DATA(x)), &ldx,
Marcel Plch 180d901
+         (double *)(PyArray_DATA(we)), &ldwe, &ld2we,
Marcel Plch 180d901
+         (double *)(PyArray_DATA(wd)), &ldwd, &ld2wd,
Marcel Plch 180d901
+         (int *)(PyArray_DATA(ifixb)), (int *)(PyArray_DATA(ifixx)), &ldifx,
Marcel Plch 180d901
+         &job, &ndigit, &taufac, &sstol, &partol, &maxit,
Marcel Plch 180d901
+         &iprint, &lunerr, &lunrpt,
Marcel Plch 180d901
+         (double *)(PyArray_DATA(stpb)), (double *)(PyArray_DATA(stpd)), &ldstpd,
Marcel Plch 180d901
+         (double *)(PyArray_DATA(sclb)), (double *)(PyArray_DATA(scld)), &ldscld,
Marcel Plch 180d901
+         (double *)(PyArray_DATA(work)), &lwork, (int *)(PyArray_DATA(iwork)), &liwork,
Marcel Plch 180d901
+         &info;;
Marcel Plch 180d901
 
Marcel Plch 180d901
   result = gen_output(n, m, np, nq, ldwe, ld2we,
Marcel Plch 180d901
                       beta, work, iwork, isodr, info, full_output);