~ubuntu-branches/ubuntu/lucid/python-scipy/lucid

« back to all changes in this revision

Viewing changes to Lib/interpolate/__fitpack.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-07 14:12:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070107141212-mm0ebkh5b37hcpzn
* Remove build dependency on python-numpy-dev.
* python-scipy: Depend on python-numpy instead of python-numpy-dev.
* Package builds on other archs than i386. Closes: #402783.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  Author: Pearu Peterson <pearu@ioc.ee>
4
4
  June 1.-4., 1999
5
5
  June 7. 1999
6
 
  $Revision: 1.3 $
7
 
  $Date: 2002/06/30 23:55:02 $
 
6
  $Revision: 1917 $
 
7
  $Date: 2006-05-27 03:51:39 -0600 (Sat, 27 May 2006) $
8
8
 */
9
9
 
10
10
/*  module_methods:
198
198
    SURFIT(&iopt,&m,x,y,z,w,&xb,&xe,&yb,&ye,&kx,&ky,&s,&nxest,&nyest,&nmax,&eps,&nx,tx,&ny,ty,c,&fp,wrk1,&lwrk1,wrk2,&lwrk2,iwrk,&kwrk,&ier);
199
199
    if (wrk2) free(wrk2);
200
200
  }
201
 
  if (ier==10) goto fail;
 
201
  if (ier==10) {
 
202
          PyErr_SetString(PyExc_ValueError, "Invalid inputs.");
 
203
          goto fail;
 
204
  }
202
205
  lc = (nx-kx-1)*(ny-ky-1);
 
206
  Py_XDECREF(ap_tx);
 
207
  Py_XDECREF(ap_ty);
203
208
  ap_tx = (PyArrayObject *)PyArray_FromDims(1,&nx,PyArray_DOUBLE);
204
209
  ap_ty = (PyArrayObject *)PyArray_FromDims(1,&ny,PyArray_DOUBLE);
205
210
  ap_c = (PyArrayObject *)PyArray_FromDims(1,&lc,PyArray_DOUBLE);
233
238
  Py_XDECREF(ap_ty);
234
239
  Py_XDECREF(ap_wrk);
235
240
  /*Py_XDECREF(ap_iwrk);*/
 
241
  if (!PyErr_Occurred()) {
 
242
          PyErr_SetString(PyExc_ValueError, "An error occurred.");
 
243
  }
236
244
  return NULL;
237
245
}
238
246
 
239
247
 
240
248
static char doc_parcur[] = " [t,c,o] = _parcur(x,w,u,ub,ue,k,iopt,ipar,s,t,nest,wrk,iwrk,per)";
241
249
static PyObject *fitpack_parcur(PyObject *dummy, PyObject *args) {
242
 
  int k,iopt,ipar,nest,*iwrk,idim,m,mx,n,no=0,nc,ier,lc,lwa,lwrk,i,per;
 
250
  int k,iopt,ipar,nest,*iwrk,idim,m,mx,n=0,no=0,nc,ier,lc,lwa,lwrk,i,per;
243
251
  double *x,*w,*u,*c,*t,*wrk,*wa=NULL,ub,ue,fp,s;
244
252
  PyObject *x_py = NULL,*u_py = NULL,*w_py = NULL,*t_py = NULL;
245
253
  PyObject *wrk_py=NULL,*iwrk_py=NULL;
290
298
    PARCUR(&iopt,&ipar,&idim,&m,u,&mx,x,w,&ub,&ue,&k,&s,&nest,&n,t,&nc,\
291
299
           c,&fp,wrk,&lwrk,iwrk,&ier);
292
300
  if (ier==10) goto fail;
 
301
  if (ier>0 && n==0) n=1;
293
302
  lc = (n-k-1)*idim;
294
303
  ap_t = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
295
304
  ap_c = (PyArrayObject *)PyArray_FromDims(1,&lc,PyArray_DOUBLE);
364
373
    PERCUR(&iopt,&m,x,y,w,&k,&s,&nest,&n,t,c,&fp,wrk,&lwrk,iwrk,&ier);
365
374
  else
366
375
    CURFIT(&iopt,&m,x,y,w,&xb,&xe,&k,&s,&nest,&n,t,c,&fp,wrk,&lwrk,iwrk,&ier);
367
 
  if (ier==10) goto fail;
 
376
  if (ier==10) {
 
377
          PyErr_SetString(PyExc_ValueError, "Invalid inputs.");
 
378
          goto fail;
 
379
  }
368
380
  lc = n-k-1;
369
 
  ap_t = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
 
381
  if (!iopt) {
 
382
          ap_t = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
 
383
          if (ap_t == NULL) goto fail;
 
384
  }
370
385
  ap_c = (PyArrayObject *)PyArray_FromDims(1,&lc,PyArray_DOUBLE);
371
 
  if (ap_t == NULL || ap_c == NULL) goto fail;
 
386
  if (ap_c == NULL) goto fail;
372
387
  if ((iopt==0)||(n>no)) {
 
388
    Py_XDECREF(ap_wrk);
 
389
    Py_XDECREF(ap_iwrk);
373
390
    ap_wrk = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_DOUBLE);
374
391
    ap_iwrk = (PyArrayObject *)PyArray_FromDims(1,&n,PyArray_INT);
375
392
    if (ap_wrk == NULL || ap_iwrk == NULL) goto fail;