[Scipy-svn] r4967 - trunk/scipy/optimize
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Nov 3 10:52:43 EST 2008
Author: paul.ivanov
Date: 2008-11-03 09:52:32 -0600 (Mon, 03 Nov 2008)
New Revision: 4967
Modified:
trunk/scipy/optimize/__minpack.h
trunk/scipy/optimize/minpack.h
trunk/scipy/optimize/setup.py
Log:
more FromDims to SimpleNew, etc. see also r4953 r4954 r4955 r4956.
this should get rid of more deprecation warning.
Modified: trunk/scipy/optimize/__minpack.h
===================================================================
--- trunk/scipy/optimize/__minpack.h 2008-11-03 10:31:23 UTC (rev 4966)
+++ trunk/scipy/optimize/__minpack.h 2008-11-03 15:52:32 UTC (rev 4967)
@@ -216,14 +216,15 @@
PyObject *fcn, *x0, *extra_args = NULL, *o_diag = NULL;
int full_output = 0, maxfev = -10, ml = -10, mu = -10;
double xtol = 1.49012e-8, epsfcn = 0.0, factor = 1.0e2;
- int n, mode = 2, nprint = 0, info, nfev, ldfjac, lr;
+ int mode = 2, nprint = 0, info, nfev, ldfjac;
+ npy_intp n,lr;
double *x, *fvec, *diag, *fjac, *r, *qtf;
PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
PyArrayObject *ap_fjac = NULL, *ap_r = NULL, *ap_qtf = NULL;
PyArrayObject *ap_diag = NULL;
- int dims[2];
+ npy_intp dims[2];
int allocated = 0;
double *wa = NULL;
@@ -256,9 +257,9 @@
SET_DIAG(ap_diag,o_diag,mode);
dims[0] = n; dims[1] = n;
- ap_r = (PyArrayObject *)PyArray_FromDims(1,&lr,PyArray_DOUBLE);
- ap_qtf = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
- ap_fjac = (PyArrayObject *)PyArray_FromDims(2,dims,PyArray_DOUBLE);
+ ap_r = (PyArrayObject *)PyArray_SimpleNew(1,&lr,PyArray_DOUBLE);
+ ap_qtf = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_DOUBLE);
+ ap_fjac = (PyArrayObject *)PyArray_SimpleNew(2,dims,PyArray_DOUBLE);
if (ap_r == NULL || ap_qtf == NULL || ap_fjac ==NULL) goto fail;
@@ -316,14 +317,15 @@
PyObject *fcn, *Dfun, *x0, *extra_args = NULL, *o_diag = NULL;
int full_output = 0, maxfev = -10, col_deriv = 1;
double xtol = 1.49012e-8, factor = 1.0e2;
- int n, mode = 2, nprint = 0, info, nfev, njev, ldfjac, lr;
+ int mode = 2, nprint = 0, info, nfev, njev, ldfjac;
+ npy_intp n, lr;
double *x, *fvec, *diag, *fjac, *r, *qtf;
PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
PyArrayObject *ap_fjac = NULL, *ap_r = NULL, *ap_qtf = NULL;
PyArrayObject *ap_diag = NULL;
- int dims[2];
+ npy_intp dims[2];
int allocated = 0;
double *wa = NULL;
@@ -354,9 +356,9 @@
SET_DIAG(ap_diag,o_diag,mode);
dims[0] = n; dims[1] = n;
- ap_r = (PyArrayObject *)PyArray_FromDims(1,&lr,PyArray_DOUBLE);
- ap_qtf = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
- ap_fjac = (PyArrayObject *)PyArray_FromDims(2,dims,PyArray_DOUBLE);
+ ap_r = (PyArrayObject *)PyArray_SimpleNew(1,&lr,PyArray_DOUBLE);
+ ap_qtf = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_DOUBLE);
+ ap_fjac = (PyArrayObject *)PyArray_SimpleNew(2,dims,PyArray_DOUBLE);
if (ap_r == NULL || ap_qtf == NULL || ap_fjac ==NULL) goto fail;
@@ -417,14 +419,15 @@
int full_output = 0, maxfev = -10;
double xtol = 1.49012e-8, ftol = 1.49012e-8;
double gtol = 0.0, epsfcn = 0.0, factor = 1.0e2;
- int m, n, mode = 2, nprint = 0, info, nfev, ldfjac, *ipvt;
+ int m, mode = 2, nprint = 0, info, nfev, ldfjac, *ipvt;
+ npy_intp n;
double *x, *fvec, *diag, *fjac, *qtf;
PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
PyArrayObject *ap_fjac = NULL, *ap_ipvt = NULL, *ap_qtf = NULL;
PyArrayObject *ap_diag = NULL;
- int dims[2];
+ npy_intp dims[2];
int allocated = 0;
double *wa = NULL;
@@ -452,9 +455,9 @@
m = (ap_fvec->nd > 0 ? ap_fvec->dimensions[0] : 1);
dims[0] = n; dims[1] = m;
- ap_ipvt = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_INT);
- ap_qtf = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
- ap_fjac = (PyArrayObject *)PyArray_FromDims(2,dims,PyArray_DOUBLE);
+ ap_ipvt = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_INT);
+ ap_qtf = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_DOUBLE);
+ ap_fjac = (PyArrayObject *)PyArray_SimpleNew(2,dims,PyArray_DOUBLE);
if (ap_ipvt == NULL || ap_qtf == NULL || ap_fjac ==NULL) goto fail;
@@ -516,14 +519,15 @@
int full_output = 0, maxfev = -10, col_deriv = 1;
double xtol = 1.49012e-8, ftol = 1.49012e-8;
double gtol = 0.0, factor = 1.0e2;
- int m, n, mode = 2, nprint = 0, info, nfev, njev, ldfjac, *ipvt;
+ int m, mode = 2, nprint = 0, info, nfev, njev, ldfjac, *ipvt;
+ npy_intp n;
double *x, *fvec, *diag, *fjac, *qtf;
PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
PyArrayObject *ap_fjac = NULL, *ap_ipvt = NULL, *ap_qtf = NULL;
PyArrayObject *ap_diag = NULL;
- int dims[2];
+ npy_intp dims[2];
int allocated = 0;
double *wa = NULL;
@@ -551,9 +555,9 @@
m = (ap_fvec->nd > 0 ? ap_fvec->dimensions[0] : 1);
dims[0] = n; dims[1] = m;
- ap_ipvt = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_INT);
- ap_qtf = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
- ap_fjac = (PyArrayObject *)PyArray_FromDims(2,dims,PyArray_DOUBLE);
+ ap_ipvt = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_INT);
+ ap_qtf = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_DOUBLE);
+ ap_fjac = (PyArrayObject *)PyArray_SimpleNew(2,dims,PyArray_DOUBLE);
if (ap_ipvt == NULL || ap_qtf == NULL || ap_fjac ==NULL) goto fail;
Modified: trunk/scipy/optimize/minpack.h
===================================================================
--- trunk/scipy/optimize/minpack.h 2008-11-03 10:31:23 UTC (rev 4966)
+++ trunk/scipy/optimize/minpack.h 2008-11-03 15:52:32 UTC (rev 4967)
@@ -83,7 +83,7 @@
#define SET_DIAG(ap_diag,o_diag,mode) { /* Set the diag vector from input */ \
if (o_diag == NULL || o_diag == Py_None) { \
- ap_diag = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE); \
+ ap_diag = (PyArrayObject *)PyArray_SimpleNew(1,&n,PyArray_DOUBLE); \
if (ap_diag == NULL) goto fail; \
diag = (double *)ap_diag -> data; \
mode = 1; \
@@ -105,7 +105,7 @@
static PyObject *multipack_extra_arguments=NULL; /* a tuple */
static int multipack_jac_transpose=1;
-static PyObject *call_python_function(PyObject *func, int n, double *x, PyObject *args, int dim, PyObject *error_obj)
+static PyObject *call_python_function(PyObject *func, npy_intp n, double *x, PyObject *args, int dim, PyObject *error_obj)
{
/*
This is a generic function to call a python function that takes a 1-D
@@ -127,7 +127,7 @@
PyArrayObject *result_array = NULL;
/* Build sequence argument from inputs */
- sequence = (PyArrayObject *)PyArray_FromDimsAndData(1, &n, PyArray_DOUBLE, (char *)x);
+ sequence = (PyArrayObject *)PyArray_SimpleNewFromData(1, &n, PyArray_DOUBLE, (char *)x);
if (sequence == NULL) PYERR2(error_obj,"Internal failure to make an array of doubles out of first\n argument to function call.");
/* Build argument list */
Modified: trunk/scipy/optimize/setup.py
===================================================================
--- trunk/scipy/optimize/setup.py 2008-11-03 10:31:23 UTC (rev 4966)
+++ trunk/scipy/optimize/setup.py 2008-11-03 15:52:32 UTC (rev 4967)
@@ -10,7 +10,8 @@
config.add_library('minpack',sources=[join('minpack','*f')])
config.add_extension('_minpack',
sources=['_minpackmodule.c'],
- libraries=['minpack'])
+ libraries=['minpack'],
+ depends=["minpack.h","__minpack.h"])
config.add_library('rootfind',
sources=[join('Zeros','*.c')],
@@ -28,7 +29,8 @@
sources=['moduleTNC.c','tnc.c']
config.add_extension('moduleTNC',
- sources=[join('tnc',x) for x in sources])
+ sources=[join('tnc',x) for x in sources],
+ depends=[join('tnc','tnc.h')])
config.add_extension('_cobyla',
sources=[join('cobyla',x) for x in ['cobyla.pyf',
More information about the Scipy-svn
mailing list