File: odrpack.h

package info (click to toggle)
python-scipy 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 52,228 kB
  • ctags: 63,719
  • sloc: python: 112,726; fortran: 88,685; cpp: 86,979; ansic: 85,860; makefile: 530; sh: 236
file content (71 lines) | stat: -rw-r--r-- 2,277 bytes parent folder | download | duplicates (2)
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
70
71
#include "Python.h"
#include "numpy/arrayobject.h"

#include "numpy/npy_3kcompat.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);