File: odrpack.h

package info (click to toggle)
python-scipy 0.5.2-0.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 33,888 kB
  • ctags: 44,231
  • sloc: ansic: 156,256; cpp: 90,347; python: 89,604; fortran: 73,083; sh: 1,318; objc: 424; makefile: 342
file content (69 lines) | stat: -rw-r--r-- 2,244 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "Python.h"
#include "numpy/arrayobject.h"

#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif

#define PYERR(errobj,message) {PyErr_SetString(errobj,message); goto fail;}
#define PYERR2(errobj,message) {PyErr_Print(); PyErr_SetString(errobj, message); goto fail;}
#define ISCONTIGUOUS(m) ((m)->flags & CONTIGUOUS)

#define MAX(n1,n2) ((n1) > (n2))?(n1):(n2);
#define MIN(n1,n2) ((n1) > (n2))?(n2):(n1);

struct ODR_info_ {
  PyObject* fcn;
  PyObject* fjacb;
  PyObject* fjacd;
  PyObject* pyBeta;
  PyObject* extra_args;
};

typedef struct ODR_info_ ODR_info;

static ODR_info odr_global;

static PyObject *odr_error=NULL;
static PyObject *odr_stop=NULL;

void fcn_callback(int *n, int *m, int *np, int *nq, int *ldn, int *ldm,
		  int *ldnp, double *beta, double *xplusd, int *ifixb,
		  int *ifixx, int *ldfix, int *ideval, double *f,
		  double *fjacb, double *fjacd, int *istop);

PyObject *gen_output(int n, int m, int np, int nq, int ldwe, int ld2we,
		     PyArrayObject *beta, PyArrayObject *work, PyArrayObject *iwork,
		     int isodr, int info, int full_output);

PyObject *odr(PyObject *self, PyObject *args, PyObject *kwds);

#define PyArray_CONTIGUOUS(m) (ISCONTIGUOUS(m) ? Py_INCREF(m), m : \
(PyArrayObject *)(PyArray_ContiguousFromObject((PyObject *)(m), \
(m)->descr->type_num, 0,0)))
#define D(dbg) printf("we're here: %i\n", dbg)
#define EXIST(name,obj) if (obj==NULL){printf("%s\n",name);}
static void check_args(int n, int m, int np, int nq, 
		       PyArrayObject *beta,
		       PyArrayObject *y, int ldy, 
		       PyArrayObject *x, int ldx, 
		       PyArrayObject *we, int ldwe, int ld2we, 
		       PyArrayObject *wd, int ldwd, int ld2wd, 
		       PyArrayObject *ifixb, PyArrayObject *ifixx, int ldifx,
		       int job, int ndigit, double taufac, double sstol, 
		       double partol, int maxit,
		       PyArrayObject *stpb, PyArrayObject *stpd, int ldstpd,
		       PyArrayObject *sclb, PyArrayObject *scld, int ldscld,
		       PyArrayObject *work, int lwork, 
		       PyArrayObject *iwork, int liwork,
		       int info);