File: up_minpack_ints.diff

package info (click to toggle)
python-scipy 0.10.1%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 42,232 kB
  • sloc: cpp: 224,773; ansic: 103,496; python: 85,210; fortran: 79,130; makefile: 272; sh: 43
file content (179 lines) | stat: -rw-r--r-- 6,285 bytes parent folder | download
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
Description: minpack API types misfit on s390x
URL: http://projects.scipy.org/scipy/ticket/1700
Debian: http://bugs.debian.org/681270

Index: python-scipy-0.10.1+dfsg1/scipy/optimize/__minpack.h
===================================================================
--- python-scipy-0.10.1+dfsg1.orig/scipy/optimize/__minpack.h	2012-02-21 17:50:06.000000000 -0500
+++ python-scipy-0.10.1+dfsg1/scipy/optimize/__minpack.h	2012-07-21 17:05:14.270325178 -0400
@@ -63,7 +63,7 @@
   */
 
   PyArrayObject *result_array = NULL;
- 
+
   result_array = (PyArrayObject *)call_python_function(multipack_python_function, *n, x, multipack_extra_arguments, 1, minpack_error);
   if (result_array == NULL) {
     *iflag = -1;
@@ -122,7 +122,7 @@
   */
 
   PyArrayObject *result_array = NULL;
- 
+
   result_array = (PyArrayObject *)call_python_function(multipack_python_function,*n, x, multipack_extra_arguments, 1, minpack_error);
   if (result_array == NULL) {
     *iflag = -1;
@@ -161,7 +161,7 @@
       *iflag = -1;
       return -1;
     }
-    if (multipack_jac_transpose == 1) 
+    if (multipack_jac_transpose == 1)
       MATRIXC2F(fjac, result_array->data, *n, *ldfjac)
     else
       memcpy(fjac, result_array->data, (*n)*(*ldfjac)*sizeof(double));
@@ -231,6 +231,7 @@
   double   xtol = 1.49012e-8, epsfcn = 0.0, factor = 1.0e2;
   int      mode = 2, nprint = 0, info, nfev, ldfjac;
   npy_intp n,lr;
+  int      n_int, lr_int;  /* for casted storage to pass int into HYBRD */
   double   *x, *fvec, *diag, *fjac, *r, *qtf;
 
   PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
@@ -242,7 +243,7 @@
   double   *wa = NULL;
 
   STORE_VARS();    /* Define storage variables for global variables. */
-  
+
   if (!PyArg_ParseTuple(args, "OO|OidiiiddO", &fcn, &x0, &extra_args, &full_output, &xtol, &maxfev, &ml, &mu, &epsfcn, &factor, &o_diag)) return NULL;
 
   INIT_FUNC(fcn,extra_args,minpack_error);
@@ -262,7 +263,7 @@
   ap_fvec = (PyArrayObject *)call_python_function(fcn, n, x, extra_args, 1, minpack_error);
   if (ap_fvec == NULL) goto fail;
   fvec = (double *) ap_fvec->data;
-  if (ap_fvec->nd == 0) 
+  if (ap_fvec->nd == 0)
     n = 1;
   else if (ap_fvec->dimensions[0] < n)
     n = ap_fvec->dimensions[0];
@@ -288,7 +289,8 @@
   allocated = 1;
 
   /* Call the underlying FORTRAN routines. */
-  HYBRD(raw_multipack_calling_function, &n, x, fvec, &xtol, &maxfev, &ml, &mu, &epsfcn, diag, &mode, &factor, &nprint, &info, &nfev, fjac, &ldfjac, r, &lr, qtf, wa, wa+n, wa+2*n, wa+3*n);
+  n_int = n; lr_int = lr; /* cast/store/pass into HYBRD */
+  HYBRD(raw_multipack_calling_function, &n_int, x, fvec, &xtol, &maxfev, &ml, &mu, &epsfcn, diag, &mode, &factor, &nprint, &info, &nfev, fjac, &ldfjac, r, &lr_int, qtf, wa, wa+n, wa+2*n, wa+3*n);
 
   RESTORE_FUNC();
 
@@ -332,6 +334,7 @@
   double   xtol = 1.49012e-8, factor = 1.0e2;
   int      mode = 2, nprint = 0, info, nfev, njev, ldfjac;
   npy_intp n, lr;
+  int n_int, lr_int;
   double   *x, *fvec, *diag, *fjac, *r, *qtf;
 
   PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
@@ -388,7 +391,8 @@
   allocated = 1;
 
   /* Call the underlying FORTRAN routines. */
-  HYBRJ(jac_multipack_calling_function, &n, x, fvec, fjac, &ldfjac, &xtol, &maxfev, diag, &mode, &factor, &nprint, &info, &nfev, &njev, r, &lr, qtf, wa, wa+n, wa+2*n, wa+3*n);
+  n_int = n; lr_int = lr; /* cast/store/pass into HYBRJ */
+  HYBRJ(jac_multipack_calling_function, &n_int, x, fvec, fjac, &ldfjac, &xtol, &maxfev, diag, &mode, &factor, &nprint, &info, &nfev, &njev, r, &lr_int, qtf, wa, wa+n, wa+2*n, wa+3*n);
 
   RESTORE_JAC_FUNC();
 
@@ -420,7 +424,7 @@
   Py_XDECREF(ap_qtf);
   if (allocated) free(wa);
   return NULL;
-  
+
 }
 
 /************************ Levenberg-Marquardt *******************/
@@ -434,6 +438,7 @@
   double   gtol = 0.0, epsfcn = 0.0, factor = 1.0e2;
   int      m, mode = 2, nprint = 0, info, nfev, ldfjac, *ipvt;
   npy_intp n;
+  int      n_int;  /* for casted storage to pass int into LMDIF */
   double   *x, *fvec, *diag, *fjac, *qtf;
 
   PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
@@ -486,14 +491,15 @@
   allocated = 1;
 
   /* Call the underlying FORTRAN routines. */
-  LMDIF(raw_multipack_lm_function, &m, &n, x, fvec, &ftol, &xtol, &gtol, &maxfev, &epsfcn, diag, &mode, &factor, &nprint, &info, &nfev, fjac, &ldfjac, ipvt, qtf, wa, wa+n, wa+2*n, wa+3*n);
-    
+  n_int = n; /* to provide int*-pointed storage for int argument of LMDIF */
+  LMDIF(raw_multipack_lm_function, &m, &n_int, x, fvec, &ftol, &xtol, &gtol, &maxfev, &epsfcn, diag, &mode, &factor, &nprint, &info, &nfev, fjac, &ldfjac, ipvt, qtf, wa, wa+n, wa+2*n, wa+3*n);
+
   RESTORE_FUNC();
 
   if (info < 0) goto fail;           /* Python error */
 
   free(wa);
-  Py_DECREF(extra_args); 
+  Py_DECREF(extra_args);
   Py_DECREF(ap_diag);
 
   if (full_output) {
@@ -517,7 +523,7 @@
   Py_XDECREF(ap_ipvt);
   Py_XDECREF(ap_qtf);
   if (allocated) free(wa);
-  return NULL;  
+  return NULL;
 }
 
 
@@ -530,6 +536,7 @@
   double   gtol = 0.0, factor = 1.0e2;
   int      m, mode = 2, nprint = 0, info, nfev, njev, ldfjac, *ipvt;
   npy_intp n;
+  int n_int;
   double   *x, *fvec, *diag, *fjac, *qtf;
 
   PyArrayObject *ap_x = NULL, *ap_fvec = NULL;
@@ -582,7 +589,8 @@
   allocated = 1;
 
   /* Call the underlying FORTRAN routines. */
-  LMDER(jac_multipack_lm_function, &m, &n, x, fvec, fjac, &ldfjac, &ftol, &xtol, &gtol, &maxfev, diag, &mode, &factor, &nprint, &info, &nfev, &njev, ipvt, qtf, wa, wa+n, wa+2*n, wa+3*n);
+  n_int = n;
+  LMDER(jac_multipack_lm_function, &m, &n_int, x, fvec, fjac, &ldfjac, &ftol, &xtol, &gtol, &maxfev, diag, &mode, &factor, &nprint, &info, &nfev, &njev, ipvt, qtf, wa, wa+n, wa+2*n, wa+3*n);
 
   RESTORE_JAC_FUNC();
 
@@ -613,7 +621,7 @@
   Py_XDECREF(ap_ipvt);
   Py_XDECREF(ap_qtf);
   if (allocated) free(wa);
-  return NULL;  
+  return NULL;
 }
 
 
@@ -660,7 +668,7 @@
     fjac = (double *)ap_fjac -> data;
     xp = (double *)ap_xp->data;
     fvecp = (double *)ap_fvecp -> data;
-    err = (double *)ap_err->data;    
+    err = (double *)ap_err->data;
 
     CHKDER(&m, &n, x, fvec, fjac, &m, xp, fvecp, &mode, err);
 
@@ -668,7 +676,7 @@
     Py_DECREF(ap_fjac);
     Py_DECREF(ap_fvecp);
   }
-  else 
+  else
     PYERR(minpack_error,"Invalid mode, must be 1 or 2.");
 
   Py_DECREF(ap_x);