File Coverage

Levmar.xs
Criterion Covered Total %
statement 2295 7477 30.6
branch 962 7306 13.1
condition n/a
subroutine n/a
pod n/a
total 3257 14783 22.0


line stmt bran cond sub pod time code
1              
2             /*
3             * THIS FILE WAS GENERATED BY PDL::PP! Do not modify!
4             */
5              
6             #define PDL_COMMENT(comment)
7             PDL_COMMENT("This preprocessor symbol is used to add commentary in the PDL ")
8             PDL_COMMENT("autogenerated code. Normally, one would use typical C-style ")
9             PDL_COMMENT("multiline comments (i.e. /* comment */). However, because such ")
10             PDL_COMMENT("comments do not nest, it's not possible for PDL::PP users to ")
11             PDL_COMMENT("comment-out sections of code using multiline comments, as is ")
12             PDL_COMMENT("often the practice when debugging, for example. So, when you ")
13             PDL_COMMENT("see something like this: ")
14             PDL_COMMENT(" ")
15             PDL_COMMENT("Memory access")
16             PDL_COMMENT(" ")
17             PDL_COMMENT("just think of it as a C multiline comment like: ")
18             PDL_COMMENT(" ")
19             PDL_COMMENT(" /* Memory access */ ")
20              
21             #include "EXTERN.h"
22             #include "perl.h"
23             #include "XSUB.h"
24             #include "pdl.h"
25             #include "pdlcore.h"
26             static Core* PDL; PDL_COMMENT("Structure hold core C functions")
27             static int __pdl_debugging = 0;
28             static int __pdl_boundscheck = 0;
29             static SV* CoreSV; PDL_COMMENT("Gets pointer to perl var holding core structure")
30              
31             #if ! 1
32             # define PP_INDTERM(max, at) at
33             #else
34             # define PP_INDTERM(max, at) (__pdl_boundscheck? PDL->safe_indterm(max,at, __FILE__, __LINE__) : at)
35             #endif
36              
37              
38             #include
39             #include
40             #include
41             #include
42             #include "pdlperlfunc.c"
43             #include "lm.h"
44             typedef struct pdl_levmar_der_lb_struct {
45             PDL_TRANS_START(11);
46             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_lb_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __m_size;PDL_Indx __n_size;PDL_Indx __nt_size;PDL_Indx __in_size;PDL_Indx __nopt_size;PDL_Indx __wn_size;PDL_Indx __q_size;
47             IV funcn;IV sfuncn;IV jacn;IV sjacn;IV indat;int want_covar;
48             char __ddone; PDL_COMMENT("Dims done")
49             } pdl_levmar_der_lb_struct;
50              
51 0           void pdl_levmar_der_lb_redodims(pdl_trans *__tr ) {
52             int __dim;
53 0           pdl_levmar_der_lb_struct *__privtrans = (pdl_levmar_der_lb_struct *) __tr;
54            
55             {
56             PDL_Indx __creating[11];
57 0           __privtrans->__m_size = -1;
58 0           __privtrans->__n_size = -1;
59 0           __privtrans->__nt_size = -1;
60 0           __privtrans->__in_size = -1;
61 0           __privtrans->__nopt_size = -1;
62 0           __privtrans->__wn_size = -1;
63 0           __privtrans->__q_size = 10;
64 0           __creating[0] = 0;
65 0           __creating[1] = 0;
66 0           __creating[2] = 0;
67 0           __creating[3] = 0;
68 0           __creating[4] = 0;
69 0           __creating[5] = 0;
70 0 0         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
71 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
72 0 0         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    0          
73 0 0         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    0          
74 0 0         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    0          
75             {
76             {PDL_COMMENT("Start generic loop")
77              
78 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
79 0           } break; case PDL_F: {
80 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
81 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
82              
83 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
84 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
85              
86 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
87 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
88              
89 0 0         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
90 0           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
91              
92 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
93 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
94              
95 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
96 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
97              
98 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
99 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
100              
101 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
102 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
103              
104 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
105 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
106              
107 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
108 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
109              
110 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
111 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
112              
113 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
114 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
115 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
116 0           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
117 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
118 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
119 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
120 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
121 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
122 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
123 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
124              
125              
126 0           int im = __privtrans->pdls[0]->dims[0];
127 0           int in = __privtrans->pdls[1]->dims[0];
128 0           int min = 2*in + 4*im + in*im + im*im;
129 0           int inw = __privtrans->pdls[6]->dims[0];
130 0           __privtrans->__wn_size = inw >= min ? inw : min;
131            
132 0           } } break; case PDL_D: {
133 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
134 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
135              
136 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
137 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
138              
139 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
140 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
141              
142 0 0         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
143 0           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
144              
145 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
146 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
147              
148 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
149 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
150              
151 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
152 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
153              
154 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
155 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
156              
157 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
158 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
159              
160 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
161 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
162              
163 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
164 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
165              
166 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
167 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
168 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
169 0           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
170 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
171 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
172 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
173 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
174 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
175 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
176 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
177              
178              
179 0           int im = __privtrans->pdls[0]->dims[0];
180 0           int in = __privtrans->pdls[1]->dims[0];
181 0           int min = 2*in + 4*im + in*im + im*im;
182 0           int inw = __privtrans->pdls[6]->dims[0];
183 0           __privtrans->__wn_size = inw >= min ? inw : min;
184            
185 0           } break;}
186 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
187             }
188             }
189             {
190             static char *__parnames[] = {"p","x","t","lb","iopts","opts","work","covar","returnval","pout","info"};
191             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,2,0,1,1};
192             static char __funcname[] = "PDL::Fit::Levmar::levmar_der_lb";
193             static pdl_errorinfo __einfo = {
194             __funcname, __parnames, 11
195             };
196            
197 0           PDL->initthreadstruct(2,__privtrans->pdls,
198             __realdims,__creating,11,
199             &__einfo,&(__privtrans->__pdlthread),
200 0           __privtrans->vtable->per_pdl_flags,
201             0 );
202             }
203 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
204 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
205             }
206 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
207 0           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
208 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
209 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
210 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
211             }
212             }
213 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
214 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
215             }
216 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
217 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
218 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
219 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
220 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
221             }
222             }
223 0           PDL->make_physical(((__privtrans->pdls[1])));
224 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
225 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
226             }
227 0 0         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
228 0           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
229 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
230 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
231 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
232             }
233             }
234 0           PDL->make_physical(((__privtrans->pdls[2])));
235 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
236 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
237             }
238 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
239 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
240 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
241 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
242 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
243             }
244             }
245 0           PDL->make_physical(((__privtrans->pdls[3])));
246 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
247 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    0          
248             }
249 0 0         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size == 1)) {
    0          
    0          
250 0           __privtrans->__in_size = ((__privtrans->pdls[4]))->dims[0];
251 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
252 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
253 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
254             }
255             }
256 0           PDL->make_physical(((__privtrans->pdls[4])));
257 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
258 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
259             }
260 0 0         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
261 0           __privtrans->__nopt_size = ((__privtrans->pdls[5]))->dims[0];
262 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
263 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
264 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
265             }
266             }
267 0           PDL->make_physical(((__privtrans->pdls[5])));
268 0 0         if(!__creating[6]) {
269 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
270 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
271             }
272 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
273 0           __privtrans->__wn_size = ((__privtrans->pdls[6]))->dims[0];
274 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
275 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
276 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
277             }
278             }
279 0           PDL->make_physical(((__privtrans->pdls[6])));
280             } else {
281 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
282 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,1);
283 0 0         }if(!__creating[7]) {
284 0 0         if(((__privtrans->pdls[7]))->ndims < 2) {
285 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
286 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
287             }
288 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
289 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[0];
290 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
291 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
292 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
293             }
294             }
295 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
296 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[1];
297 0 0         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[1]) {
    0          
298 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
299 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
300             }
301             }
302 0           PDL->make_physical(((__privtrans->pdls[7])));
303             } else {
304 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
305 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
306 0 0         }if(!__creating[8]) {
307             } else {
308             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
309 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
310 0 0         }if(!__creating[9]) {
311 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
312 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
313             }
314 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
315 0           __privtrans->__m_size = ((__privtrans->pdls[9]))->dims[0];
316 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
317 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
318 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
319             }
320             }
321 0           PDL->make_physical(((__privtrans->pdls[9])));
322             } else {
323 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
324 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
325 0 0         }if(!__creating[10]) {
326 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
327 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
328             }
329 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
330 0           __privtrans->__q_size = ((__privtrans->pdls[10]))->dims[0];
331 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
332 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
333 0           PDL->pdl_barf("Error in levmar_der_lb:" "Wrong dims\n");
334             }
335             }
336 0           PDL->make_physical(((__privtrans->pdls[10])));
337             } else {
338 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
339 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
340             }
341             { PDL_COMMENT("convenience block")
342 0           void *hdrp = NULL;
343 0           char propagate_hdrcpy = 0;
344 0           SV *hdr_copy = NULL;
345 0 0         if(!hdrp &&
    0          
346 0 0         __privtrans->pdls[0]->hdrsv &&
347 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
348             ) {
349 0           hdrp = __privtrans->pdls[0]->hdrsv;
350 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
351             }
352 0 0         if(!hdrp &&
    0          
353 0 0         __privtrans->pdls[1]->hdrsv &&
354 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
355             ) {
356 0           hdrp = __privtrans->pdls[1]->hdrsv;
357 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
358             }
359 0 0         if(!hdrp &&
    0          
360 0 0         __privtrans->pdls[2]->hdrsv &&
361 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
362             ) {
363 0           hdrp = __privtrans->pdls[2]->hdrsv;
364 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
365             }
366 0 0         if(!hdrp &&
    0          
367 0 0         __privtrans->pdls[3]->hdrsv &&
368 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
369             ) {
370 0           hdrp = __privtrans->pdls[3]->hdrsv;
371 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
372             }
373 0 0         if(!hdrp &&
    0          
374 0 0         __privtrans->pdls[4]->hdrsv &&
375 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
376             ) {
377 0           hdrp = __privtrans->pdls[4]->hdrsv;
378 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
379             }
380 0 0         if(!hdrp &&
    0          
381 0 0         __privtrans->pdls[5]->hdrsv &&
382 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
383             ) {
384 0           hdrp = __privtrans->pdls[5]->hdrsv;
385 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
386             }
387 0 0         if(!hdrp &&
    0          
388 0 0         !__creating[6] &&
389 0 0         __privtrans->pdls[6]->hdrsv &&
390 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
391             ) {
392 0           hdrp = __privtrans->pdls[6]->hdrsv;
393 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
394             }
395 0 0         if(!hdrp &&
    0          
396 0 0         !__creating[7] &&
397 0 0         __privtrans->pdls[7]->hdrsv &&
398 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
399             ) {
400 0           hdrp = __privtrans->pdls[7]->hdrsv;
401 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
402             }
403 0 0         if(!hdrp &&
    0          
404 0 0         !__creating[8] &&
405 0 0         __privtrans->pdls[8]->hdrsv &&
406 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
407             ) {
408 0           hdrp = __privtrans->pdls[8]->hdrsv;
409 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
410             }
411 0 0         if(!hdrp &&
    0          
412 0 0         !__creating[9] &&
413 0 0         __privtrans->pdls[9]->hdrsv &&
414 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
415             ) {
416 0           hdrp = __privtrans->pdls[9]->hdrsv;
417 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
418             }
419 0 0         if(!hdrp &&
    0          
420 0 0         !__creating[10] &&
421 0 0         __privtrans->pdls[10]->hdrsv &&
422 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
423             ) {
424 0           hdrp = __privtrans->pdls[10]->hdrsv;
425 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
426             }
427 0 0         if (hdrp) {
428 0 0         if(hdrp == &PL_sv_undef)
429 0           hdr_copy = &PL_sv_undef;
430             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
431             int count;
432             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
433 0           dSP;
434 0           ENTER ;
435 0           SAVETMPS ;
436 0 0         PUSHMARK(SP) ;
437 0 0         XPUSHs( hdrp );
438 0           PUTBACK ;
439 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
440 0           SPAGAIN ;
441 0 0         if(count != 1)
442 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
443              
444 0           hdr_copy = (SV *)POPs;
445              
446 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
447 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
448             }
449              
450 0 0         FREETMPS ;
451 0           LEAVE ;
452              
453              
454             } PDL_COMMENT("end of callback block")
455              
456 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
457 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
458 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
459 0 0         if( hdr_copy != &PL_sv_undef )
460 0           (void)SvREFCNT_inc(hdr_copy);
461 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
462             }
463 0 0         if(propagate_hdrcpy)
464 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
465 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
466 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
467 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
468 0 0         if( hdr_copy != &PL_sv_undef )
469 0           (void)SvREFCNT_inc(hdr_copy);
470 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
471             }
472 0 0         if(propagate_hdrcpy)
473 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
474 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
475 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
476 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
477 0 0         if( hdr_copy != &PL_sv_undef )
478 0           (void)SvREFCNT_inc(hdr_copy);
479 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
480             }
481 0 0         if(propagate_hdrcpy)
482 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
483 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
484 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
485 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
486 0 0         if( hdr_copy != &PL_sv_undef )
487 0           (void)SvREFCNT_inc(hdr_copy);
488 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
489             }
490 0 0         if(propagate_hdrcpy)
491 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
492 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
493 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
494 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
495 0 0         if( hdr_copy != &PL_sv_undef )
496 0           (void)SvREFCNT_inc(hdr_copy);
497 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
498             }
499 0 0         if(propagate_hdrcpy)
500 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
501              
502 0 0         if(hdr_copy != &PL_sv_undef)
503 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
504             } PDL_COMMENT("end of if(hdrp) block")
505             } PDL_COMMENT("end of conv. block")
506 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
507 0           __privtrans->__inc_p_m = 0; else
508 0 0         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
509 0           __privtrans->__inc_x_n = 0; else
510 0 0         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
511 0           __privtrans->__inc_t_nt = 0; else
512 0 0         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
513 0           __privtrans->__inc_lb_m = 0; else
514 0 0         __privtrans->__inc_lb_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
515 0           __privtrans->__inc_iopts_in = 0; else
516 0 0         __privtrans->__inc_iopts_in = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
517 0           __privtrans->__inc_opts_nopt = 0; else
518 0 0         __privtrans->__inc_opts_nopt = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
519 0           __privtrans->__inc_work_wn = 0; else
520 0 0         __privtrans->__inc_work_wn = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
521 0           __privtrans->__inc_covar_m0 = 0; else
522 0 0         __privtrans->__inc_covar_m0 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    0          
523 0           __privtrans->__inc_covar_m1 = 0; else
524 0 0         __privtrans->__inc_covar_m1 = __privtrans->pdls[7]->dimincs[1];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    0          
525 0           __privtrans->__inc_pout_m = 0; else
526 0 0         __privtrans->__inc_pout_m = __privtrans->pdls[9]->dimincs[0];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    0          
527 0           __privtrans->__inc_info_q = 0; else
528 0           __privtrans->__inc_info_q = __privtrans->pdls[10]->dimincs[0]; __privtrans->__ddone = 1;
529             }
530 0           }
531            
532              
533 0           pdl_trans * pdl_levmar_der_lb_copy(pdl_trans *__tr ) {
534             int __dim;
535 0           pdl_levmar_der_lb_struct *__privtrans = (pdl_levmar_der_lb_struct *) __tr;
536            
537             {
538 0           pdl_levmar_der_lb_struct *__copy = malloc(sizeof(pdl_levmar_der_lb_struct));
539 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
540 0           __copy->has_badvalue = __privtrans->has_badvalue;
541 0           __copy->badvalue = __privtrans->badvalue;
542 0           __copy->flags = __privtrans->flags;
543 0           __copy->vtable = __privtrans->vtable;
544 0           __copy->__datatype = __privtrans->__datatype;
545 0           __copy->freeproc = NULL;
546 0           __copy->__ddone = __privtrans->__ddone;
547             {int i;
548 0 0         for(i=0; i<__copy->vtable->npdls; i++)
549 0           __copy->pdls[i] = __privtrans->pdls[i];
550             }
551 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->jacn) = (__privtrans->jacn);;(__copy->sjacn) = (__privtrans->sjacn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
552 0 0         if(__copy->__ddone) {
553 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_lb_m=__copy->__inc_lb_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__m_size=__privtrans->__m_size;__copy->__n_size=__privtrans->__n_size;__copy->__nt_size=__privtrans->__nt_size;__copy->__in_size=__privtrans->__in_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__q_size=__privtrans->__q_size;
554             }
555 0           return (pdl_trans*)__copy;
556             }
557             }
558            
559              
560 0           void pdl_levmar_der_lb_readdata(pdl_trans *__tr ) {
561             int __dim;
562 0           pdl_levmar_der_lb_struct *__privtrans = (pdl_levmar_der_lb_struct *) __tr;
563            
564             {
565 0           {register PDL_Indx __m_size = __privtrans->__m_size;
566             PDL_COMMENT("Start generic loop")
567              
568 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
569 0           } break; case PDL_F: {
570 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
571 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
572              
573 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
574 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
575              
576 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
577 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
578              
579 0 0         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
580 0           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
581              
582 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
583 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
584              
585 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
586 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
587              
588 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
589 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
590              
591 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
592 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
593              
594 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
595 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
596              
597 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
598 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
599              
600 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
601 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
602              
603 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
604 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
605 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
606 0           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
607 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
608 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
609 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
610 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
611 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
612 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
613 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
614              
615              
616             int * iopts;
617             int maxits;
618 0           void * tfuncn = (void *) __privtrans->funcn;
619 0           void * tsfuncn = (void *) __privtrans->sfuncn;
620             PDL_Float * pcovar;
621             PDL_Float * pwork;
622 0           void * tjacn = (void *) __privtrans->jacn;
623 0           void * tsjacn = (void *) __privtrans->sjacn;;
624 0           DFP *dat = (void *) __privtrans->indat;
625 0           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
626 0           __privtrans->__nt_size, t_datap );
627            
628             PDL_COMMENT("THREADLOOPBEGIN")
629 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
630 0           do { register PDL_Indx __tind1=0,__tind2=0;
631 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
632 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
633 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
634 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
635 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
636 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
637 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
638 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
639 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
640 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
641 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
642 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
643 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
644 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
645 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
646 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
647 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
648 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
649 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
650 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
651 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
652 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
653 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
654 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
655 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
656 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
657 0           p_datap += __offsp[0];
658 0           x_datap += __offsp[1];
659 0           t_datap += __offsp[2];
660 0           lb_datap += __offsp[3];
661 0           iopts_datap += __offsp[4];
662 0           opts_datap += __offsp[5];
663 0           work_datap += __offsp[6];
664 0           covar_datap += __offsp[7];
665 0           returnval_datap += __offsp[8];
666 0           pout_datap += __offsp[9];
667 0           info_datap += __offsp[10];
668 0 0         for( __tind2 = 0 ;
669             __tind2 < __tdims1 ;
670 0           __tind2++
671 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
672 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
673 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
674 0           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
675 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
676 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
677 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
678 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
679 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
680 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
681 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
682             )
683             {
684 0 0         for( __tind1 = 0 ;
685             __tind1 < __tdims0 ;
686 0           __tind1++
687 0           ,p_datap += __tinc0_0
688 0           ,x_datap += __tinc0_1
689 0           ,t_datap += __tinc0_2
690 0           ,lb_datap += __tinc0_3
691 0           ,iopts_datap += __tinc0_4
692 0           ,opts_datap += __tinc0_5
693 0           ,work_datap += __tinc0_6
694 0           ,covar_datap += __tinc0_7
695 0           ,returnval_datap += __tinc0_8
696 0           ,pout_datap += __tinc0_9
697 0           ,info_datap += __tinc0_10
698             )
699             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
700             {PDL_COMMENT("Open m") register PDL_Indx m;
701 0 0         for(m=0; m<(__m_size); m++) {
702 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
703             }} PDL_COMMENT("Close m")
704 0           iopts = iopts_datap;
705 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
706 0           else pcovar = NULL;
707             if ( 0 == 1 ) pwork = NULL;
708 0           else pwork = work_datap;
709 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
710 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_der (
711             tsfuncn , tsjacn,
712 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, NULL,
713             maxits, opts_datap, info_datap, pwork, pcovar, dat);
714             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
715            
716             PDL_COMMENT("THREADLOOPEND")
717             }
718             }
719 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
720 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
721 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
722 0           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
723 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
724 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
725 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
726 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
727 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
728 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
729 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
730 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
731            
732 0           } } break; case PDL_D: {
733 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
734 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
735              
736 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
737 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
738              
739 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
740 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
741              
742 0 0         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
743 0           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
744              
745 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
746 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
747              
748 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
749 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
750              
751 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
752 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
753              
754 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
755 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
756              
757 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
758 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
759              
760 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
761 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
762              
763 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
764 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
765              
766 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
767 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
768 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
769 0           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
770 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
771 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
772 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
773 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
774 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
775 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
776 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
777              
778              
779             int * iopts;
780             int maxits;
781 0           void * tfuncn = (void *) __privtrans->funcn;
782 0           void * tsfuncn = (void *) __privtrans->sfuncn;
783             PDL_Double * pcovar;
784             PDL_Double * pwork;
785 0           void * tjacn = (void *) __privtrans->jacn;
786 0           void * tsjacn = (void *) __privtrans->sjacn;;
787 0           DFP *dat = (void *) __privtrans->indat;
788 0           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
789 0           __privtrans->__nt_size, t_datap );
790            
791             PDL_COMMENT("THREADLOOPBEGIN")
792 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
793 0           do { register PDL_Indx __tind1=0,__tind2=0;
794 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
795 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
796 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
797 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
798 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
799 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
800 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
801 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
802 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
803 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
804 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
805 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
806 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
807 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
808 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
809 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
810 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
811 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
812 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
813 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
814 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
815 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
816 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
817 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
818 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
819 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
820 0           p_datap += __offsp[0];
821 0           x_datap += __offsp[1];
822 0           t_datap += __offsp[2];
823 0           lb_datap += __offsp[3];
824 0           iopts_datap += __offsp[4];
825 0           opts_datap += __offsp[5];
826 0           work_datap += __offsp[6];
827 0           covar_datap += __offsp[7];
828 0           returnval_datap += __offsp[8];
829 0           pout_datap += __offsp[9];
830 0           info_datap += __offsp[10];
831 0 0         for( __tind2 = 0 ;
832             __tind2 < __tdims1 ;
833 0           __tind2++
834 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
835 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
836 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
837 0           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
838 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
839 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
840 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
841 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
842 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
843 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
844 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
845             )
846             {
847 0 0         for( __tind1 = 0 ;
848             __tind1 < __tdims0 ;
849 0           __tind1++
850 0           ,p_datap += __tinc0_0
851 0           ,x_datap += __tinc0_1
852 0           ,t_datap += __tinc0_2
853 0           ,lb_datap += __tinc0_3
854 0           ,iopts_datap += __tinc0_4
855 0           ,opts_datap += __tinc0_5
856 0           ,work_datap += __tinc0_6
857 0           ,covar_datap += __tinc0_7
858 0           ,returnval_datap += __tinc0_8
859 0           ,pout_datap += __tinc0_9
860 0           ,info_datap += __tinc0_10
861             )
862             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
863             {PDL_COMMENT("Open m") register PDL_Indx m;
864 0 0         for(m=0; m<(__m_size); m++) {
865 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
866             }} PDL_COMMENT("Close m")
867 0           iopts = iopts_datap;
868 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
869 0           else pcovar = NULL;
870             if ( 0 == 1 ) pwork = NULL;
871 0           else pwork = work_datap;
872 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
873 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_der (
874             tfuncn , tjacn,
875 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, NULL,
876             maxits, opts_datap, info_datap, pwork, pcovar, dat);
877             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
878            
879             PDL_COMMENT("THREADLOOPEND")
880             }
881             }
882 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
883 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
884 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
885 0           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
886 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
887 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
888 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
889 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
890 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
891 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
892 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
893 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
894            
895 0           } break;}
896 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
897             }
898             }
899             }
900            
901              
902              
903              
904 0           void pdl_levmar_der_lb_free(pdl_trans *__tr ) {
905             int __dim;
906 0           pdl_levmar_der_lb_struct *__privtrans = (pdl_levmar_der_lb_struct *) __tr;
907            
908             {
909            
910 0           PDL_TR_CLRMAGIC(__privtrans);
911             ;;;;;;
912 0 0         if(__privtrans->__ddone) {
913 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
914             ;;;;;;;;;;;;;;;;;;;
915             }
916            
917             }
918 0           }
919            
920              
921              
922              
923             static char pdl_levmar_der_lb_vtable_flags[] =
924             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
925             pdl_transvtable pdl_levmar_der_lb_vtable = {
926             0,0, 6, 11, pdl_levmar_der_lb_vtable_flags,
927             pdl_levmar_der_lb_redodims, pdl_levmar_der_lb_readdata, NULL,
928             pdl_levmar_der_lb_free,NULL,NULL,pdl_levmar_der_lb_copy,
929             sizeof(pdl_levmar_der_lb_struct),"pdl_levmar_der_lb_vtable"
930             };
931              
932             typedef struct pdl_levmar_der_lb_ub_struct {
933             PDL_TRANS_START(12);
934             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_lb_m;PDL_Indx __inc_ub_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __q_size;PDL_Indx __n_size;PDL_Indx __nopt_size;PDL_Indx __m_size;PDL_Indx __in_size;PDL_Indx __wn_size;PDL_Indx __nt_size;
935             IV funcn;IV sfuncn;IV jacn;IV sjacn;IV indat;int want_covar;
936             char __ddone; PDL_COMMENT("Dims done")
937             } pdl_levmar_der_lb_ub_struct;
938              
939 9           void pdl_levmar_der_lb_ub_redodims(pdl_trans *__tr ) {
940             int __dim;
941 9           pdl_levmar_der_lb_ub_struct *__privtrans = (pdl_levmar_der_lb_ub_struct *) __tr;
942            
943             {
944             PDL_Indx __creating[12];
945 9           __privtrans->__q_size = 10;
946 9           __privtrans->__n_size = -1;
947 9           __privtrans->__nopt_size = -1;
948 9           __privtrans->__m_size = -1;
949 9           __privtrans->__in_size = -1;
950 9           __privtrans->__wn_size = -1;
951 9           __privtrans->__nt_size = -1;
952 9           __creating[0] = 0;
953 9           __creating[1] = 0;
954 9           __creating[2] = 0;
955 9           __creating[3] = 0;
956 9           __creating[4] = 0;
957 9           __creating[5] = 0;
958 9           __creating[6] = 0;
959 9 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
960 9 50         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    50          
961 9 50         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    50          
962 9 50         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    50          
963 9 50         __creating[11] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[11]);
    50          
964             {
965             {PDL_COMMENT("Start generic loop")
966              
967 9           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
968 0           } break; case PDL_F: {
969 3 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
970 3           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
971              
972 3 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
973 3           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
974              
975 3 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
976 3           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
977              
978 3 50         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
979 3           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
980              
981 3 50         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
982 3           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
983              
984 3 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
985 3           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
986              
987 3 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
988 3           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
989              
990 3 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
991 3           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
992              
993 3 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
994 3           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
995              
996 3 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
997 3           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
998              
999 3 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1000 3           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
1001              
1002 3 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
1003 3           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[11])->data));
1004              
1005 3           {register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1006 3           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1007 3           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
1008 3           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1009 3           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1010 3           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
1011 3           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1012 3           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1013 3           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1014 3           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1015 3           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
1016 3           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
1017              
1018              
1019 3           int im = __privtrans->pdls[0]->dims[0];
1020 3           int in = __privtrans->pdls[1]->dims[0];
1021 3           int min = 2*in + 4*im + in*im + im*im;
1022 3           int inw = __privtrans->pdls[7]->dims[0];
1023 3           __privtrans->__wn_size = inw >= min ? inw : min;
1024            
1025 3           } } break; case PDL_D: {
1026 6 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1027 6           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1028              
1029 6 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1030 6           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
1031              
1032 6 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1033 6           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1034              
1035 6 50         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1036 6           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1037              
1038 6 50         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1039 6           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1040              
1041 6 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1042 6           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
1043              
1044 6 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
1045 6           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
1046              
1047 6 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
1048 6           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
1049              
1050 6 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
1051 6           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
1052              
1053 6 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
1054 6           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
1055              
1056 6 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1057 6           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
1058              
1059 6 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
1060 6           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[11])->data));
1061              
1062 6           {register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1063 6           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1064 6           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
1065 6           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1066 6           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1067 6           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
1068 6           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1069 6           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1070 6           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1071 6           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1072 6           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
1073 6           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
1074              
1075              
1076 6           int im = __privtrans->pdls[0]->dims[0];
1077 6           int in = __privtrans->pdls[1]->dims[0];
1078 6           int min = 2*in + 4*im + in*im + im*im;
1079 6           int inw = __privtrans->pdls[7]->dims[0];
1080 6           __privtrans->__wn_size = inw >= min ? inw : min;
1081            
1082 6           } break;}
1083 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
1084             }
1085             }
1086             {
1087             static char *__parnames[] = {"p","x","t","lb","ub","iopts","opts","work","covar","returnval","pout","info"};
1088             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,1,2,0,1,1};
1089             static char __funcname[] = "PDL::Fit::Levmar::levmar_der_lb_ub";
1090             static pdl_errorinfo __einfo = {
1091             __funcname, __parnames, 12
1092             };
1093            
1094 9           PDL->initthreadstruct(2,__privtrans->pdls,
1095             __realdims,__creating,12,
1096             &__einfo,&(__privtrans->__pdlthread),
1097 9           __privtrans->vtable->per_pdl_flags,
1098             0 );
1099             }
1100 9 50         if(((__privtrans->pdls[0]))->ndims < 1) {
1101 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1102             }
1103 9 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
1104 9           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
1105 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
1106 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
1107 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1108             }
1109             }
1110 9 50         if(((__privtrans->pdls[1]))->ndims < 1) {
1111 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
1112             }
1113 9 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
1114 9           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
1115 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
1116 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
1117 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1118             }
1119             }
1120 9           PDL->make_physical(((__privtrans->pdls[1])));
1121 9 50         if(((__privtrans->pdls[2]))->ndims < 1) {
1122 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
1123             }
1124 9 50         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
1125 9           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
1126 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
1127 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
1128 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1129             }
1130             }
1131 9           PDL->make_physical(((__privtrans->pdls[2])));
1132 9 50         if(((__privtrans->pdls[3]))->ndims < 1) {
1133 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1134             }
1135 9 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    50          
    50          
1136 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
1137 9 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    50          
1138 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
1139 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1140             }
1141             }
1142 9           PDL->make_physical(((__privtrans->pdls[3])));
1143 9 50         if(((__privtrans->pdls[4]))->ndims < 1) {
1144 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1145             }
1146 9 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__m_size == 1)) {
    50          
    50          
1147 0           __privtrans->__m_size = ((__privtrans->pdls[4]))->dims[0];
1148 9 50         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[4]))->dims[0]) {
    50          
1149 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
1150 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1151             }
1152             }
1153 9           PDL->make_physical(((__privtrans->pdls[4])));
1154 9 50         if(((__privtrans->pdls[5]))->ndims < 1) {
1155 9 50         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    50          
1156             }
1157 9 50         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__in_size == 1)) {
    50          
    0          
1158 0           __privtrans->__in_size = ((__privtrans->pdls[5]))->dims[0];
1159 9 50         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
1160 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
1161 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1162             }
1163             }
1164 9           PDL->make_physical(((__privtrans->pdls[5])));
1165 9 50         if(((__privtrans->pdls[6]))->ndims < 1) {
1166 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
1167             }
1168 9 50         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
1169 9           __privtrans->__nopt_size = ((__privtrans->pdls[6]))->dims[0];
1170 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
1171 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
1172 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1173             }
1174             }
1175 9           PDL->make_physical(((__privtrans->pdls[6])));
1176 9 50         if(!__creating[7]) {
1177 0 0         if(((__privtrans->pdls[7]))->ndims < 1) {
1178 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
1179             }
1180 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
1181 0           __privtrans->__wn_size = ((__privtrans->pdls[7]))->dims[0];
1182 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
1183 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
1184 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1185             }
1186             }
1187 0           PDL->make_physical(((__privtrans->pdls[7])));
1188             } else {
1189 9           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
1190 9           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,1);
1191 9 50         }if(!__creating[8]) {
1192 0 0         if(((__privtrans->pdls[8]))->ndims < 2) {
1193 0 0         if (((__privtrans->pdls[8]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1194 0 0         if (((__privtrans->pdls[8]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1195             }
1196 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
1197 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[0];
1198 0 0         } else if(((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[0]) {
    0          
1199 0 0         if(((__privtrans->pdls[8]))->dims[0] != 1) {
1200 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1201             }
1202             }
1203 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
1204 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[1];
1205 0 0         } else if(((__privtrans->pdls[8]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[1]) {
    0          
1206 0 0         if(((__privtrans->pdls[8]))->dims[1] != 1) {
1207 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1208             }
1209             }
1210 0           PDL->make_physical(((__privtrans->pdls[8])));
1211             } else {
1212 9           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
1213 9           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
1214 9 50         }if(!__creating[9]) {
1215             } else {
1216             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
1217 9           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
1218 9 50         }if(!__creating[10]) {
1219 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
1220 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
1221             }
1222 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
1223 0           __privtrans->__m_size = ((__privtrans->pdls[10]))->dims[0];
1224 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
1225 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
1226 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1227             }
1228             }
1229 0           PDL->make_physical(((__privtrans->pdls[10])));
1230             } else {
1231 9           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
1232 9           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
1233 9 50         }if(!__creating[11]) {
1234 0 0         if(((__privtrans->pdls[11]))->ndims < 1) {
1235 0 0         if (((__privtrans->pdls[11]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
1236             }
1237 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[11]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
1238 0           __privtrans->__q_size = ((__privtrans->pdls[11]))->dims[0];
1239 0 0         } else if(((__privtrans->pdls[11]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[11]))->dims[0]) {
    0          
1240 0 0         if(((__privtrans->pdls[11]))->dims[0] != 1) {
1241 0           PDL->pdl_barf("Error in levmar_der_lb_ub:" "Wrong dims\n");
1242             }
1243             }
1244 0           PDL->make_physical(((__privtrans->pdls[11])));
1245             } else {
1246 9           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
1247 9           PDL->thread_create_parameter(&__privtrans->__pdlthread,11,dims,0);
1248             }
1249             { PDL_COMMENT("convenience block")
1250 9           void *hdrp = NULL;
1251 9           char propagate_hdrcpy = 0;
1252 9           SV *hdr_copy = NULL;
1253 9 50         if(!hdrp &&
    50          
1254 0 0         __privtrans->pdls[0]->hdrsv &&
1255 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
1256             ) {
1257 0           hdrp = __privtrans->pdls[0]->hdrsv;
1258 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
1259             }
1260 9 50         if(!hdrp &&
    50          
1261 0 0         __privtrans->pdls[1]->hdrsv &&
1262 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
1263             ) {
1264 0           hdrp = __privtrans->pdls[1]->hdrsv;
1265 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
1266             }
1267 9 50         if(!hdrp &&
    50          
1268 0 0         __privtrans->pdls[2]->hdrsv &&
1269 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
1270             ) {
1271 0           hdrp = __privtrans->pdls[2]->hdrsv;
1272 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
1273             }
1274 9 50         if(!hdrp &&
    50          
1275 0 0         __privtrans->pdls[3]->hdrsv &&
1276 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
1277             ) {
1278 0           hdrp = __privtrans->pdls[3]->hdrsv;
1279 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
1280             }
1281 9 50         if(!hdrp &&
    50          
1282 0 0         __privtrans->pdls[4]->hdrsv &&
1283 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
1284             ) {
1285 0           hdrp = __privtrans->pdls[4]->hdrsv;
1286 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
1287             }
1288 9 50         if(!hdrp &&
    50          
1289 0 0         __privtrans->pdls[5]->hdrsv &&
1290 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
1291             ) {
1292 0           hdrp = __privtrans->pdls[5]->hdrsv;
1293 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
1294             }
1295 9 50         if(!hdrp &&
    50          
1296 0 0         __privtrans->pdls[6]->hdrsv &&
1297 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
1298             ) {
1299 0           hdrp = __privtrans->pdls[6]->hdrsv;
1300 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
1301             }
1302 9 50         if(!hdrp &&
    50          
1303 0 0         !__creating[7] &&
1304 0 0         __privtrans->pdls[7]->hdrsv &&
1305 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
1306             ) {
1307 0           hdrp = __privtrans->pdls[7]->hdrsv;
1308 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
1309             }
1310 9 50         if(!hdrp &&
    50          
1311 0 0         !__creating[8] &&
1312 0 0         __privtrans->pdls[8]->hdrsv &&
1313 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
1314             ) {
1315 0           hdrp = __privtrans->pdls[8]->hdrsv;
1316 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
1317             }
1318 9 50         if(!hdrp &&
    50          
1319 0 0         !__creating[9] &&
1320 0 0         __privtrans->pdls[9]->hdrsv &&
1321 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
1322             ) {
1323 0           hdrp = __privtrans->pdls[9]->hdrsv;
1324 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
1325             }
1326 9 50         if(!hdrp &&
    50          
1327 0 0         !__creating[10] &&
1328 0 0         __privtrans->pdls[10]->hdrsv &&
1329 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
1330             ) {
1331 0           hdrp = __privtrans->pdls[10]->hdrsv;
1332 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
1333             }
1334 9 50         if(!hdrp &&
    50          
1335 0 0         !__creating[11] &&
1336 0 0         __privtrans->pdls[11]->hdrsv &&
1337 0           (__privtrans->pdls[11]->state & PDL_HDRCPY)
1338             ) {
1339 0           hdrp = __privtrans->pdls[11]->hdrsv;
1340 0           propagate_hdrcpy = ((__privtrans->pdls[11]->state & PDL_HDRCPY) != 0);
1341             }
1342 9 50         if (hdrp) {
1343 0 0         if(hdrp == &PL_sv_undef)
1344 0           hdr_copy = &PL_sv_undef;
1345             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
1346             int count;
1347             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
1348 0           dSP;
1349 0           ENTER ;
1350 0           SAVETMPS ;
1351 0 0         PUSHMARK(SP) ;
1352 0 0         XPUSHs( hdrp );
1353 0           PUTBACK ;
1354 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
1355 0           SPAGAIN ;
1356 0 0         if(count != 1)
1357 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
1358              
1359 0           hdr_copy = (SV *)POPs;
1360              
1361 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
1362 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
1363             }
1364              
1365 0 0         FREETMPS ;
1366 0           LEAVE ;
1367              
1368              
1369             } PDL_COMMENT("end of callback block")
1370              
1371 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
1372 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
1373 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
1374 0 0         if( hdr_copy != &PL_sv_undef )
1375 0           (void)SvREFCNT_inc(hdr_copy);
1376 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
1377             }
1378 0 0         if(propagate_hdrcpy)
1379 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
1380 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
1381 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
1382 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
1383 0 0         if( hdr_copy != &PL_sv_undef )
1384 0           (void)SvREFCNT_inc(hdr_copy);
1385 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
1386             }
1387 0 0         if(propagate_hdrcpy)
1388 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
1389 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
1390 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
1391 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
1392 0 0         if( hdr_copy != &PL_sv_undef )
1393 0           (void)SvREFCNT_inc(hdr_copy);
1394 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
1395             }
1396 0 0         if(propagate_hdrcpy)
1397 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
1398 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
1399 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
1400 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
1401 0 0         if( hdr_copy != &PL_sv_undef )
1402 0           (void)SvREFCNT_inc(hdr_copy);
1403 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
1404             }
1405 0 0         if(propagate_hdrcpy)
1406 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
1407 0 0         if ( __privtrans->pdls[11]->hdrsv != hdrp ){
1408 0 0         if( __privtrans->pdls[11]->hdrsv && __privtrans->pdls[11]->hdrsv != &PL_sv_undef)
    0          
1409 0           (void)SvREFCNT_dec( __privtrans->pdls[11]->hdrsv );
1410 0 0         if( hdr_copy != &PL_sv_undef )
1411 0           (void)SvREFCNT_inc(hdr_copy);
1412 0           __privtrans->pdls[11]->hdrsv = hdr_copy;
1413             }
1414 0 0         if(propagate_hdrcpy)
1415 0           __privtrans->pdls[11]->state |= PDL_HDRCPY;
1416              
1417 0 0         if(hdr_copy != &PL_sv_undef)
1418 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
1419             } PDL_COMMENT("end of if(hdrp) block")
1420             } PDL_COMMENT("end of conv. block")
1421 9 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
1422 0           __privtrans->__inc_p_m = 0; else
1423 9 50         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
1424 0           __privtrans->__inc_x_n = 0; else
1425 9 50         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    100          
1426 8           __privtrans->__inc_t_nt = 0; else
1427 9 50         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
1428 0           __privtrans->__inc_lb_m = 0; else
1429 9 50         __privtrans->__inc_lb_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
1430 0           __privtrans->__inc_ub_m = 0; else
1431 9 50         __privtrans->__inc_ub_m = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
1432 9           __privtrans->__inc_iopts_in = 0; else
1433 9 50         __privtrans->__inc_iopts_in = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    50          
1434 0           __privtrans->__inc_opts_nopt = 0; else
1435 9 50         __privtrans->__inc_opts_nopt = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    50          
1436 0           __privtrans->__inc_work_wn = 0; else
1437 9 50         __privtrans->__inc_work_wn = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[8]->ndims <= 0 || __privtrans->pdls[8]->dims[0] <= 1)
    50          
1438 0           __privtrans->__inc_covar_m0 = 0; else
1439 9 50         __privtrans->__inc_covar_m0 = __privtrans->pdls[8]->dimincs[0];if(__privtrans->pdls[8]->ndims <= 1 || __privtrans->pdls[8]->dims[1] <= 1)
    50          
1440 0           __privtrans->__inc_covar_m1 = 0; else
1441 9 50         __privtrans->__inc_covar_m1 = __privtrans->pdls[8]->dimincs[1];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    50          
1442 0           __privtrans->__inc_pout_m = 0; else
1443 9 50         __privtrans->__inc_pout_m = __privtrans->pdls[10]->dimincs[0];if(__privtrans->pdls[11]->ndims <= 0 || __privtrans->pdls[11]->dims[0] <= 1)
    50          
1444 0           __privtrans->__inc_info_q = 0; else
1445 9           __privtrans->__inc_info_q = __privtrans->pdls[11]->dimincs[0]; __privtrans->__ddone = 1;
1446             }
1447 9           }
1448            
1449              
1450 0           pdl_trans * pdl_levmar_der_lb_ub_copy(pdl_trans *__tr ) {
1451             int __dim;
1452 0           pdl_levmar_der_lb_ub_struct *__privtrans = (pdl_levmar_der_lb_ub_struct *) __tr;
1453            
1454             {
1455 0           pdl_levmar_der_lb_ub_struct *__copy = malloc(sizeof(pdl_levmar_der_lb_ub_struct));
1456 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
1457 0           __copy->has_badvalue = __privtrans->has_badvalue;
1458 0           __copy->badvalue = __privtrans->badvalue;
1459 0           __copy->flags = __privtrans->flags;
1460 0           __copy->vtable = __privtrans->vtable;
1461 0           __copy->__datatype = __privtrans->__datatype;
1462 0           __copy->freeproc = NULL;
1463 0           __copy->__ddone = __privtrans->__ddone;
1464             {int i;
1465 0 0         for(i=0; i<__copy->vtable->npdls; i++)
1466 0           __copy->pdls[i] = __privtrans->pdls[i];
1467             }
1468 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->jacn) = (__privtrans->jacn);;(__copy->sjacn) = (__privtrans->sjacn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
1469 0 0         if(__copy->__ddone) {
1470 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_lb_m=__copy->__inc_lb_m;__privtrans->__inc_ub_m=__copy->__inc_ub_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__q_size=__privtrans->__q_size;__copy->__n_size=__privtrans->__n_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__m_size=__privtrans->__m_size;__copy->__in_size=__privtrans->__in_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__nt_size=__privtrans->__nt_size;
1471             }
1472 0           return (pdl_trans*)__copy;
1473             }
1474             }
1475            
1476              
1477 9           void pdl_levmar_der_lb_ub_readdata(pdl_trans *__tr ) {
1478             int __dim;
1479 9           pdl_levmar_der_lb_ub_struct *__privtrans = (pdl_levmar_der_lb_ub_struct *) __tr;
1480            
1481             {
1482 9           {register PDL_Indx __m_size = __privtrans->__m_size;
1483             PDL_COMMENT("Start generic loop")
1484              
1485 9           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
1486 0           } break; case PDL_F: {
1487 3 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1488 3           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
1489              
1490 3 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1491 3           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
1492              
1493 3 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1494 3           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
1495              
1496 3 50         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1497 3           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
1498              
1499 3 50         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1500 3           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
1501              
1502 3 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1503 3           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
1504              
1505 3 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
1506 3           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
1507              
1508 3 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
1509 3           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
1510              
1511 3 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
1512 3           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
1513              
1514 3 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
1515 3           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
1516              
1517 3 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1518 3           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
1519              
1520 3 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
1521 3           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[11])->data));
1522              
1523 3           {register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1524 3           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1525 3           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
1526 3           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1527 3           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1528 3           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
1529 3           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1530 3           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1531 3           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1532 3           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1533 3           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
1534 3           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
1535              
1536              
1537             int * iopts;
1538             int maxits;
1539 3           void * tfuncn = (void *) __privtrans->funcn;
1540 3           void * tsfuncn = (void *) __privtrans->sfuncn;
1541             PDL_Float * pcovar;
1542             PDL_Float * pwork;
1543 3           void * tjacn = (void *) __privtrans->jacn;
1544 3           void * tsjacn = (void *) __privtrans->sjacn;;
1545 3           DFP *dat = (void *) __privtrans->indat;
1546 3           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
1547 3           __privtrans->__nt_size, t_datap );
1548            
1549             PDL_COMMENT("THREADLOOPBEGIN")
1550 3 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1551 3           do { register PDL_Indx __tind1=0,__tind2=0;
1552 3           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1553 3           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1554 3           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1555 3           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1556 3           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1557 3           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1558 3           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1559 3           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1560 3           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1561 3           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1562 3           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
1563 3           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
1564 3           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
1565 3           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
1566 3           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
1567 3           register PDL_Indx __tinc0_11 = __privtrans->__pdlthread.incs[11];
1568 3           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1569 3           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1570 3           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1571 3           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1572 3           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1573 3           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1574 3           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
1575 3           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
1576 3           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
1577 3           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
1578 3           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
1579 3           register PDL_Indx __tinc1_11 = __privtrans->__pdlthread.incs[__tnpdls+11];
1580 3           p_datap += __offsp[0];
1581 3           x_datap += __offsp[1];
1582 3           t_datap += __offsp[2];
1583 3           lb_datap += __offsp[3];
1584 3           ub_datap += __offsp[4];
1585 3           iopts_datap += __offsp[5];
1586 3           opts_datap += __offsp[6];
1587 3           work_datap += __offsp[7];
1588 3           covar_datap += __offsp[8];
1589 3           returnval_datap += __offsp[9];
1590 3           pout_datap += __offsp[10];
1591 3           info_datap += __offsp[11];
1592 6 100         for( __tind2 = 0 ;
1593             __tind2 < __tdims1 ;
1594 3           __tind2++
1595 3           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
1596 3           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
1597 3           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
1598 3           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
1599 3           ,ub_datap += __tinc1_4 - __tinc0_4 * __tdims0
1600 3           ,iopts_datap += __tinc1_5 - __tinc0_5 * __tdims0
1601 3           ,opts_datap += __tinc1_6 - __tinc0_6 * __tdims0
1602 3           ,work_datap += __tinc1_7 - __tinc0_7 * __tdims0
1603 3           ,covar_datap += __tinc1_8 - __tinc0_8 * __tdims0
1604 3           ,returnval_datap += __tinc1_9 - __tinc0_9 * __tdims0
1605 3           ,pout_datap += __tinc1_10 - __tinc0_10 * __tdims0
1606 3           ,info_datap += __tinc1_11 - __tinc0_11 * __tdims0
1607             )
1608             {
1609 6 100         for( __tind1 = 0 ;
1610             __tind1 < __tdims0 ;
1611 3           __tind1++
1612 3           ,p_datap += __tinc0_0
1613 3           ,x_datap += __tinc0_1
1614 3           ,t_datap += __tinc0_2
1615 3           ,lb_datap += __tinc0_3
1616 3           ,ub_datap += __tinc0_4
1617 3           ,iopts_datap += __tinc0_5
1618 3           ,opts_datap += __tinc0_6
1619 3           ,work_datap += __tinc0_7
1620 3           ,covar_datap += __tinc0_8
1621 3           ,returnval_datap += __tinc0_9
1622 3           ,pout_datap += __tinc0_10
1623 3           ,info_datap += __tinc0_11
1624             )
1625             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1626             {PDL_COMMENT("Open m") register PDL_Indx m;
1627 15 100         for(m=0; m<(__m_size); m++) {
1628 12 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
1629             }} PDL_COMMENT("Close m")
1630 3           iopts = iopts_datap;
1631 3 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
1632 3           else pcovar = NULL;
1633             if ( 0 == 1 ) pwork = NULL;
1634 3           else pwork = work_datap;
1635 3           maxits = iopts[0]; /* for clarity. we hope optimized away */
1636 3           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_der (
1637             tsfuncn , tsjacn,
1638 6           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, ub_datap,
1639             maxits, opts_datap, info_datap, pwork, pcovar, dat);
1640             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
1641            
1642             PDL_COMMENT("THREADLOOPEND")
1643             }
1644             }
1645 3           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1646 3           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1647 3           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1648 3           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1649 3           ub_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1650 3           iopts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1651 3           opts_datap -= __tinc1_6 * __tdims1 + __offsp[6];
1652 3           work_datap -= __tinc1_7 * __tdims1 + __offsp[7];
1653 3           covar_datap -= __tinc1_8 * __tdims1 + __offsp[8];
1654 3           returnval_datap -= __tinc1_9 * __tdims1 + __offsp[9];
1655 3           pout_datap -= __tinc1_10 * __tdims1 + __offsp[10];
1656 3           info_datap -= __tinc1_11 * __tdims1 + __offsp[11];
1657 3 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1658            
1659 3           } } break; case PDL_D: {
1660 6 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1661 6           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1662              
1663 6 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1664 6           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
1665              
1666 6 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1667 6           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1668              
1669 6 50         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1670 6           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1671              
1672 6 50         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1673 6           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1674              
1675 6 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1676 6           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
1677              
1678 6 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
1679 6           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
1680              
1681 6 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
1682 6           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
1683              
1684 6 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
1685 6           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
1686              
1687 6 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
1688 6           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
1689              
1690 6 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1691 6           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
1692              
1693 6 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
1694 6           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[11])->data));
1695              
1696 6           {register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1697 6           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1698 6           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
1699 6           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1700 6           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1701 6           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
1702 6           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1703 6           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1704 6           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1705 6           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1706 6           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
1707 6           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
1708              
1709              
1710             int * iopts;
1711             int maxits;
1712 6           void * tfuncn = (void *) __privtrans->funcn;
1713 6           void * tsfuncn = (void *) __privtrans->sfuncn;
1714             PDL_Double * pcovar;
1715             PDL_Double * pwork;
1716 6           void * tjacn = (void *) __privtrans->jacn;
1717 6           void * tsjacn = (void *) __privtrans->sjacn;;
1718 6           DFP *dat = (void *) __privtrans->indat;
1719 6           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
1720 6           __privtrans->__nt_size, t_datap );
1721            
1722             PDL_COMMENT("THREADLOOPBEGIN")
1723 6 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1724 6           do { register PDL_Indx __tind1=0,__tind2=0;
1725 6           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1726 6           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1727 6           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1728 6           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1729 6           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1730 6           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1731 6           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1732 6           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1733 6           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1734 6           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1735 6           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
1736 6           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
1737 6           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
1738 6           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
1739 6           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
1740 6           register PDL_Indx __tinc0_11 = __privtrans->__pdlthread.incs[11];
1741 6           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1742 6           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1743 6           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1744 6           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1745 6           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1746 6           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1747 6           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
1748 6           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
1749 6           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
1750 6           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
1751 6           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
1752 6           register PDL_Indx __tinc1_11 = __privtrans->__pdlthread.incs[__tnpdls+11];
1753 6           p_datap += __offsp[0];
1754 6           x_datap += __offsp[1];
1755 6           t_datap += __offsp[2];
1756 6           lb_datap += __offsp[3];
1757 6           ub_datap += __offsp[4];
1758 6           iopts_datap += __offsp[5];
1759 6           opts_datap += __offsp[6];
1760 6           work_datap += __offsp[7];
1761 6           covar_datap += __offsp[8];
1762 6           returnval_datap += __offsp[9];
1763 6           pout_datap += __offsp[10];
1764 6           info_datap += __offsp[11];
1765 12 100         for( __tind2 = 0 ;
1766             __tind2 < __tdims1 ;
1767 6           __tind2++
1768 6           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
1769 6           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
1770 6           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
1771 6           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
1772 6           ,ub_datap += __tinc1_4 - __tinc0_4 * __tdims0
1773 6           ,iopts_datap += __tinc1_5 - __tinc0_5 * __tdims0
1774 6           ,opts_datap += __tinc1_6 - __tinc0_6 * __tdims0
1775 6           ,work_datap += __tinc1_7 - __tinc0_7 * __tdims0
1776 6           ,covar_datap += __tinc1_8 - __tinc0_8 * __tdims0
1777 6           ,returnval_datap += __tinc1_9 - __tinc0_9 * __tdims0
1778 6           ,pout_datap += __tinc1_10 - __tinc0_10 * __tdims0
1779 6           ,info_datap += __tinc1_11 - __tinc0_11 * __tdims0
1780             )
1781             {
1782 14 100         for( __tind1 = 0 ;
1783             __tind1 < __tdims0 ;
1784 8           __tind1++
1785 8           ,p_datap += __tinc0_0
1786 8           ,x_datap += __tinc0_1
1787 8           ,t_datap += __tinc0_2
1788 8           ,lb_datap += __tinc0_3
1789 8           ,ub_datap += __tinc0_4
1790 8           ,iopts_datap += __tinc0_5
1791 8           ,opts_datap += __tinc0_6
1792 8           ,work_datap += __tinc0_7
1793 8           ,covar_datap += __tinc0_8
1794 8           ,returnval_datap += __tinc0_9
1795 8           ,pout_datap += __tinc0_10
1796 8           ,info_datap += __tinc0_11
1797             )
1798             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1799             {PDL_COMMENT("Open m") register PDL_Indx m;
1800 39 100         for(m=0; m<(__m_size); m++) {
1801 31 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
1802             }} PDL_COMMENT("Close m")
1803 8           iopts = iopts_datap;
1804 8 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
1805 8           else pcovar = NULL;
1806             if ( 0 == 1 ) pwork = NULL;
1807 8           else pwork = work_datap;
1808 8           maxits = iopts[0]; /* for clarity. we hope optimized away */
1809 8           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_der (
1810             tfuncn , tjacn,
1811 16           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, ub_datap,
1812             maxits, opts_datap, info_datap, pwork, pcovar, dat);
1813             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
1814            
1815             PDL_COMMENT("THREADLOOPEND")
1816             }
1817             }
1818 6           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1819 6           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1820 6           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1821 6           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1822 6           ub_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1823 6           iopts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1824 6           opts_datap -= __tinc1_6 * __tdims1 + __offsp[6];
1825 6           work_datap -= __tinc1_7 * __tdims1 + __offsp[7];
1826 6           covar_datap -= __tinc1_8 * __tdims1 + __offsp[8];
1827 6           returnval_datap -= __tinc1_9 * __tdims1 + __offsp[9];
1828 6           pout_datap -= __tinc1_10 * __tdims1 + __offsp[10];
1829 6           info_datap -= __tinc1_11 * __tdims1 + __offsp[11];
1830 6 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1831            
1832 6           } break;}
1833 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
1834             }
1835             }
1836             }
1837            
1838              
1839              
1840              
1841 9           void pdl_levmar_der_lb_ub_free(pdl_trans *__tr ) {
1842             int __dim;
1843 9           pdl_levmar_der_lb_ub_struct *__privtrans = (pdl_levmar_der_lb_ub_struct *) __tr;
1844            
1845             {
1846            
1847 9           PDL_TR_CLRMAGIC(__privtrans);
1848             ;;;;;;
1849 9 50         if(__privtrans->__ddone) {
1850 9           PDL->freethreadloop(&(__privtrans->__pdlthread));
1851             ;;;;;;;;;;;;;;;;;;;;
1852             }
1853            
1854             }
1855 9           }
1856            
1857              
1858              
1859              
1860             static char pdl_levmar_der_lb_ub_vtable_flags[] =
1861             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
1862             pdl_transvtable pdl_levmar_der_lb_ub_vtable = {
1863             0,0, 7, 12, pdl_levmar_der_lb_ub_vtable_flags,
1864             pdl_levmar_der_lb_ub_redodims, pdl_levmar_der_lb_ub_readdata, NULL,
1865             pdl_levmar_der_lb_ub_free,NULL,NULL,pdl_levmar_der_lb_ub_copy,
1866             sizeof(pdl_levmar_der_lb_ub_struct),"pdl_levmar_der_lb_ub_vtable"
1867             };
1868              
1869             typedef struct pdl_levmar_der_ub_struct {
1870             PDL_TRANS_START(11);
1871             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_ub_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __q_size;PDL_Indx __in_size;PDL_Indx __nt_size;PDL_Indx __n_size;PDL_Indx __wn_size;PDL_Indx __nopt_size;PDL_Indx __m_size;
1872             IV funcn;IV sfuncn;IV jacn;IV sjacn;IV indat;int want_covar;
1873             char __ddone; PDL_COMMENT("Dims done")
1874             } pdl_levmar_der_ub_struct;
1875              
1876 0           void pdl_levmar_der_ub_redodims(pdl_trans *__tr ) {
1877             int __dim;
1878 0           pdl_levmar_der_ub_struct *__privtrans = (pdl_levmar_der_ub_struct *) __tr;
1879            
1880             {
1881             PDL_Indx __creating[11];
1882 0           __privtrans->__q_size = 10;
1883 0           __privtrans->__in_size = -1;
1884 0           __privtrans->__nt_size = -1;
1885 0           __privtrans->__n_size = -1;
1886 0           __privtrans->__wn_size = -1;
1887 0           __privtrans->__nopt_size = -1;
1888 0           __privtrans->__m_size = -1;
1889 0           __creating[0] = 0;
1890 0           __creating[1] = 0;
1891 0           __creating[2] = 0;
1892 0           __creating[3] = 0;
1893 0           __creating[4] = 0;
1894 0           __creating[5] = 0;
1895 0 0         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
1896 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
1897 0 0         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    0          
1898 0 0         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    0          
1899 0 0         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    0          
1900             {
1901             {PDL_COMMENT("Start generic loop")
1902              
1903 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
1904 0           } break; case PDL_F: {
1905 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1906 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
1907              
1908 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1909 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
1910              
1911 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1912 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
1913              
1914 0 0         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1915 0           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
1916              
1917 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1918 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
1919              
1920 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1921 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
1922              
1923 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
1924 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
1925              
1926 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
1927 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
1928              
1929 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
1930 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
1931              
1932 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
1933 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
1934              
1935 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1936 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
1937              
1938 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1939 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1940 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1941 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1942 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1943 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1944 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1945 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1946 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
1947 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
1948 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
1949              
1950              
1951 0           int im = __privtrans->pdls[0]->dims[0];
1952 0           int in = __privtrans->pdls[1]->dims[0];
1953 0           int min = 2*in + 4*im + in*im + im*im;
1954 0           int inw = __privtrans->pdls[6]->dims[0];
1955 0           __privtrans->__wn_size = inw >= min ? inw : min;
1956            
1957 0           } } break; case PDL_D: {
1958 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1959 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1960              
1961 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1962 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
1963              
1964 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1965 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1966              
1967 0 0         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1968 0           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1969              
1970 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1971 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
1972              
1973 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1974 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1975              
1976 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
1977 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
1978              
1979 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
1980 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
1981              
1982 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
1983 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
1984              
1985 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
1986 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
1987              
1988 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
1989 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
1990              
1991 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
1992 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
1993 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
1994 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
1995 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
1996 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
1997 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
1998 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
1999 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
2000 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
2001 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
2002              
2003              
2004 0           int im = __privtrans->pdls[0]->dims[0];
2005 0           int in = __privtrans->pdls[1]->dims[0];
2006 0           int min = 2*in + 4*im + in*im + im*im;
2007 0           int inw = __privtrans->pdls[6]->dims[0];
2008 0           __privtrans->__wn_size = inw >= min ? inw : min;
2009            
2010 0           } break;}
2011 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
2012             }
2013             }
2014             {
2015             static char *__parnames[] = {"p","x","t","ub","iopts","opts","work","covar","returnval","pout","info"};
2016             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,2,0,1,1};
2017             static char __funcname[] = "PDL::Fit::Levmar::levmar_der_ub";
2018             static pdl_errorinfo __einfo = {
2019             __funcname, __parnames, 11
2020             };
2021            
2022 0           PDL->initthreadstruct(2,__privtrans->pdls,
2023             __realdims,__creating,11,
2024             &__einfo,&(__privtrans->__pdlthread),
2025 0           __privtrans->vtable->per_pdl_flags,
2026             0 );
2027             }
2028 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
2029 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2030             }
2031 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
2032 0           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
2033 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
2034 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
2035 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2036             }
2037             }
2038 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
2039 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
2040             }
2041 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
2042 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
2043 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
2044 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
2045 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2046             }
2047             }
2048 0           PDL->make_physical(((__privtrans->pdls[1])));
2049 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
2050 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
2051             }
2052 0 0         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
2053 0           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
2054 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
2055 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
2056 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2057             }
2058             }
2059 0           PDL->make_physical(((__privtrans->pdls[2])));
2060 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
2061 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2062             }
2063 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
2064 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
2065 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
2066 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
2067 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2068             }
2069             }
2070 0           PDL->make_physical(((__privtrans->pdls[3])));
2071 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
2072 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    0          
2073             }
2074 0 0         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size == 1)) {
    0          
    0          
2075 0           __privtrans->__in_size = ((__privtrans->pdls[4]))->dims[0];
2076 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
2077 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
2078 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2079             }
2080             }
2081 0           PDL->make_physical(((__privtrans->pdls[4])));
2082 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
2083 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
2084             }
2085 0 0         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
2086 0           __privtrans->__nopt_size = ((__privtrans->pdls[5]))->dims[0];
2087 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
2088 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
2089 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2090             }
2091             }
2092 0           PDL->make_physical(((__privtrans->pdls[5])));
2093 0 0         if(!__creating[6]) {
2094 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
2095 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
2096             }
2097 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
2098 0           __privtrans->__wn_size = ((__privtrans->pdls[6]))->dims[0];
2099 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
2100 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
2101 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2102             }
2103             }
2104 0           PDL->make_physical(((__privtrans->pdls[6])));
2105             } else {
2106 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
2107 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,1);
2108 0 0         }if(!__creating[7]) {
2109 0 0         if(((__privtrans->pdls[7]))->ndims < 2) {
2110 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2111 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2112             }
2113 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
2114 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[0];
2115 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
2116 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
2117 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2118             }
2119             }
2120 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
2121 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[1];
2122 0 0         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[1]) {
    0          
2123 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
2124 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2125             }
2126             }
2127 0           PDL->make_physical(((__privtrans->pdls[7])));
2128             } else {
2129 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
2130 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
2131 0 0         }if(!__creating[8]) {
2132             } else {
2133             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
2134 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
2135 0 0         }if(!__creating[9]) {
2136 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
2137 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2138             }
2139 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
2140 0           __privtrans->__m_size = ((__privtrans->pdls[9]))->dims[0];
2141 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
2142 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
2143 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2144             }
2145             }
2146 0           PDL->make_physical(((__privtrans->pdls[9])));
2147             } else {
2148 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
2149 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
2150 0 0         }if(!__creating[10]) {
2151 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
2152 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
2153             }
2154 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
2155 0           __privtrans->__q_size = ((__privtrans->pdls[10]))->dims[0];
2156 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
2157 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
2158 0           PDL->pdl_barf("Error in levmar_der_ub:" "Wrong dims\n");
2159             }
2160             }
2161 0           PDL->make_physical(((__privtrans->pdls[10])));
2162             } else {
2163 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
2164 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
2165             }
2166             { PDL_COMMENT("convenience block")
2167 0           void *hdrp = NULL;
2168 0           char propagate_hdrcpy = 0;
2169 0           SV *hdr_copy = NULL;
2170 0 0         if(!hdrp &&
    0          
2171 0 0         __privtrans->pdls[0]->hdrsv &&
2172 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
2173             ) {
2174 0           hdrp = __privtrans->pdls[0]->hdrsv;
2175 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
2176             }
2177 0 0         if(!hdrp &&
    0          
2178 0 0         __privtrans->pdls[1]->hdrsv &&
2179 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
2180             ) {
2181 0           hdrp = __privtrans->pdls[1]->hdrsv;
2182 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
2183             }
2184 0 0         if(!hdrp &&
    0          
2185 0 0         __privtrans->pdls[2]->hdrsv &&
2186 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
2187             ) {
2188 0           hdrp = __privtrans->pdls[2]->hdrsv;
2189 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
2190             }
2191 0 0         if(!hdrp &&
    0          
2192 0 0         __privtrans->pdls[3]->hdrsv &&
2193 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
2194             ) {
2195 0           hdrp = __privtrans->pdls[3]->hdrsv;
2196 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
2197             }
2198 0 0         if(!hdrp &&
    0          
2199 0 0         __privtrans->pdls[4]->hdrsv &&
2200 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
2201             ) {
2202 0           hdrp = __privtrans->pdls[4]->hdrsv;
2203 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
2204             }
2205 0 0         if(!hdrp &&
    0          
2206 0 0         __privtrans->pdls[5]->hdrsv &&
2207 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
2208             ) {
2209 0           hdrp = __privtrans->pdls[5]->hdrsv;
2210 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
2211             }
2212 0 0         if(!hdrp &&
    0          
2213 0 0         !__creating[6] &&
2214 0 0         __privtrans->pdls[6]->hdrsv &&
2215 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
2216             ) {
2217 0           hdrp = __privtrans->pdls[6]->hdrsv;
2218 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
2219             }
2220 0 0         if(!hdrp &&
    0          
2221 0 0         !__creating[7] &&
2222 0 0         __privtrans->pdls[7]->hdrsv &&
2223 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
2224             ) {
2225 0           hdrp = __privtrans->pdls[7]->hdrsv;
2226 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
2227             }
2228 0 0         if(!hdrp &&
    0          
2229 0 0         !__creating[8] &&
2230 0 0         __privtrans->pdls[8]->hdrsv &&
2231 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
2232             ) {
2233 0           hdrp = __privtrans->pdls[8]->hdrsv;
2234 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
2235             }
2236 0 0         if(!hdrp &&
    0          
2237 0 0         !__creating[9] &&
2238 0 0         __privtrans->pdls[9]->hdrsv &&
2239 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
2240             ) {
2241 0           hdrp = __privtrans->pdls[9]->hdrsv;
2242 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
2243             }
2244 0 0         if(!hdrp &&
    0          
2245 0 0         !__creating[10] &&
2246 0 0         __privtrans->pdls[10]->hdrsv &&
2247 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
2248             ) {
2249 0           hdrp = __privtrans->pdls[10]->hdrsv;
2250 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
2251             }
2252 0 0         if (hdrp) {
2253 0 0         if(hdrp == &PL_sv_undef)
2254 0           hdr_copy = &PL_sv_undef;
2255             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
2256             int count;
2257             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
2258 0           dSP;
2259 0           ENTER ;
2260 0           SAVETMPS ;
2261 0 0         PUSHMARK(SP) ;
2262 0 0         XPUSHs( hdrp );
2263 0           PUTBACK ;
2264 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
2265 0           SPAGAIN ;
2266 0 0         if(count != 1)
2267 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
2268              
2269 0           hdr_copy = (SV *)POPs;
2270              
2271 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
2272 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
2273             }
2274              
2275 0 0         FREETMPS ;
2276 0           LEAVE ;
2277              
2278              
2279             } PDL_COMMENT("end of callback block")
2280              
2281 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
2282 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
2283 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
2284 0 0         if( hdr_copy != &PL_sv_undef )
2285 0           (void)SvREFCNT_inc(hdr_copy);
2286 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
2287             }
2288 0 0         if(propagate_hdrcpy)
2289 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
2290 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
2291 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
2292 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
2293 0 0         if( hdr_copy != &PL_sv_undef )
2294 0           (void)SvREFCNT_inc(hdr_copy);
2295 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
2296             }
2297 0 0         if(propagate_hdrcpy)
2298 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
2299 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
2300 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
2301 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
2302 0 0         if( hdr_copy != &PL_sv_undef )
2303 0           (void)SvREFCNT_inc(hdr_copy);
2304 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
2305             }
2306 0 0         if(propagate_hdrcpy)
2307 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
2308 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
2309 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
2310 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
2311 0 0         if( hdr_copy != &PL_sv_undef )
2312 0           (void)SvREFCNT_inc(hdr_copy);
2313 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
2314             }
2315 0 0         if(propagate_hdrcpy)
2316 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
2317 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
2318 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
2319 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
2320 0 0         if( hdr_copy != &PL_sv_undef )
2321 0           (void)SvREFCNT_inc(hdr_copy);
2322 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
2323             }
2324 0 0         if(propagate_hdrcpy)
2325 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
2326              
2327 0 0         if(hdr_copy != &PL_sv_undef)
2328 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
2329             } PDL_COMMENT("end of if(hdrp) block")
2330             } PDL_COMMENT("end of conv. block")
2331 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
2332 0           __privtrans->__inc_p_m = 0; else
2333 0 0         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
2334 0           __privtrans->__inc_x_n = 0; else
2335 0 0         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
2336 0           __privtrans->__inc_t_nt = 0; else
2337 0 0         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
2338 0           __privtrans->__inc_ub_m = 0; else
2339 0 0         __privtrans->__inc_ub_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
2340 0           __privtrans->__inc_iopts_in = 0; else
2341 0 0         __privtrans->__inc_iopts_in = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
2342 0           __privtrans->__inc_opts_nopt = 0; else
2343 0 0         __privtrans->__inc_opts_nopt = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
2344 0           __privtrans->__inc_work_wn = 0; else
2345 0 0         __privtrans->__inc_work_wn = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
2346 0           __privtrans->__inc_covar_m0 = 0; else
2347 0 0         __privtrans->__inc_covar_m0 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    0          
2348 0           __privtrans->__inc_covar_m1 = 0; else
2349 0 0         __privtrans->__inc_covar_m1 = __privtrans->pdls[7]->dimincs[1];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    0          
2350 0           __privtrans->__inc_pout_m = 0; else
2351 0 0         __privtrans->__inc_pout_m = __privtrans->pdls[9]->dimincs[0];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    0          
2352 0           __privtrans->__inc_info_q = 0; else
2353 0           __privtrans->__inc_info_q = __privtrans->pdls[10]->dimincs[0]; __privtrans->__ddone = 1;
2354             }
2355 0           }
2356            
2357              
2358 0           pdl_trans * pdl_levmar_der_ub_copy(pdl_trans *__tr ) {
2359             int __dim;
2360 0           pdl_levmar_der_ub_struct *__privtrans = (pdl_levmar_der_ub_struct *) __tr;
2361            
2362             {
2363 0           pdl_levmar_der_ub_struct *__copy = malloc(sizeof(pdl_levmar_der_ub_struct));
2364 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
2365 0           __copy->has_badvalue = __privtrans->has_badvalue;
2366 0           __copy->badvalue = __privtrans->badvalue;
2367 0           __copy->flags = __privtrans->flags;
2368 0           __copy->vtable = __privtrans->vtable;
2369 0           __copy->__datatype = __privtrans->__datatype;
2370 0           __copy->freeproc = NULL;
2371 0           __copy->__ddone = __privtrans->__ddone;
2372             {int i;
2373 0 0         for(i=0; i<__copy->vtable->npdls; i++)
2374 0           __copy->pdls[i] = __privtrans->pdls[i];
2375             }
2376 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->jacn) = (__privtrans->jacn);;(__copy->sjacn) = (__privtrans->sjacn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
2377 0 0         if(__copy->__ddone) {
2378 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_ub_m=__copy->__inc_ub_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__q_size=__privtrans->__q_size;__copy->__in_size=__privtrans->__in_size;__copy->__nt_size=__privtrans->__nt_size;__copy->__n_size=__privtrans->__n_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__m_size=__privtrans->__m_size;
2379             }
2380 0           return (pdl_trans*)__copy;
2381             }
2382             }
2383            
2384              
2385 0           void pdl_levmar_der_ub_readdata(pdl_trans *__tr ) {
2386             int __dim;
2387 0           pdl_levmar_der_ub_struct *__privtrans = (pdl_levmar_der_ub_struct *) __tr;
2388            
2389             {
2390 0           {register PDL_Indx __m_size = __privtrans->__m_size;
2391             PDL_COMMENT("Start generic loop")
2392              
2393 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
2394 0           } break; case PDL_F: {
2395 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2396 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
2397              
2398 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2399 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
2400              
2401 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2402 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
2403              
2404 0 0         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2405 0           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
2406              
2407 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2408 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2409              
2410 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2411 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
2412              
2413 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2414 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
2415              
2416 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2417 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
2418              
2419 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
2420 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
2421              
2422 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
2423 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
2424              
2425 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
2426 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
2427              
2428 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
2429 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
2430 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
2431 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
2432 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
2433 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
2434 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
2435 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
2436 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
2437 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
2438 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
2439              
2440              
2441             int * iopts;
2442             int maxits;
2443 0           void * tfuncn = (void *) __privtrans->funcn;
2444 0           void * tsfuncn = (void *) __privtrans->sfuncn;
2445             PDL_Float * pcovar;
2446             PDL_Float * pwork;
2447 0           void * tjacn = (void *) __privtrans->jacn;
2448 0           void * tsjacn = (void *) __privtrans->sjacn;;
2449 0           DFP *dat = (void *) __privtrans->indat;
2450 0           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
2451 0           __privtrans->__nt_size, t_datap );
2452            
2453             PDL_COMMENT("THREADLOOPBEGIN")
2454 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2455 0           do { register PDL_Indx __tind1=0,__tind2=0;
2456 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2457 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2458 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2459 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2460 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2461 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2462 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2463 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2464 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2465 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2466 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2467 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2468 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
2469 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
2470 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
2471 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2472 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2473 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2474 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2475 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2476 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2477 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2478 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2479 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
2480 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
2481 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
2482 0           p_datap += __offsp[0];
2483 0           x_datap += __offsp[1];
2484 0           t_datap += __offsp[2];
2485 0           ub_datap += __offsp[3];
2486 0           iopts_datap += __offsp[4];
2487 0           opts_datap += __offsp[5];
2488 0           work_datap += __offsp[6];
2489 0           covar_datap += __offsp[7];
2490 0           returnval_datap += __offsp[8];
2491 0           pout_datap += __offsp[9];
2492 0           info_datap += __offsp[10];
2493 0 0         for( __tind2 = 0 ;
2494             __tind2 < __tdims1 ;
2495 0           __tind2++
2496 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
2497 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
2498 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
2499 0           ,ub_datap += __tinc1_3 - __tinc0_3 * __tdims0
2500 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
2501 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
2502 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
2503 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
2504 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
2505 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
2506 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
2507             )
2508             {
2509 0 0         for( __tind1 = 0 ;
2510             __tind1 < __tdims0 ;
2511 0           __tind1++
2512 0           ,p_datap += __tinc0_0
2513 0           ,x_datap += __tinc0_1
2514 0           ,t_datap += __tinc0_2
2515 0           ,ub_datap += __tinc0_3
2516 0           ,iopts_datap += __tinc0_4
2517 0           ,opts_datap += __tinc0_5
2518 0           ,work_datap += __tinc0_6
2519 0           ,covar_datap += __tinc0_7
2520 0           ,returnval_datap += __tinc0_8
2521 0           ,pout_datap += __tinc0_9
2522 0           ,info_datap += __tinc0_10
2523             )
2524             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
2525             {PDL_COMMENT("Open m") register PDL_Indx m;
2526 0 0         for(m=0; m<(__m_size); m++) {
2527 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
2528             }} PDL_COMMENT("Close m")
2529 0           iopts = iopts_datap;
2530 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
2531 0           else pcovar = NULL;
2532             if ( 0 == 1 ) pwork = NULL;
2533 0           else pwork = work_datap;
2534 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
2535 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_der (
2536             tsfuncn , tsjacn,
2537 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, NULL,ub_datap,
2538             maxits, opts_datap, info_datap, pwork, pcovar, dat);
2539             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
2540            
2541             PDL_COMMENT("THREADLOOPEND")
2542             }
2543             }
2544 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
2545 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
2546 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
2547 0           ub_datap -= __tinc1_3 * __tdims1 + __offsp[3];
2548 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
2549 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
2550 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
2551 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
2552 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
2553 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
2554 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
2555 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
2556            
2557 0           } } break; case PDL_D: {
2558 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2559 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2560              
2561 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2562 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
2563              
2564 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2565 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2566              
2567 0 0         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2568 0           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
2569              
2570 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2571 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2572              
2573 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2574 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
2575              
2576 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2577 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
2578              
2579 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2580 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2581              
2582 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
2583 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
2584              
2585 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
2586 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
2587              
2588 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
2589 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
2590              
2591 0           {register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
2592 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
2593 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
2594 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
2595 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
2596 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
2597 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
2598 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
2599 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
2600 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
2601 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
2602              
2603              
2604             int * iopts;
2605             int maxits;
2606 0           void * tfuncn = (void *) __privtrans->funcn;
2607 0           void * tsfuncn = (void *) __privtrans->sfuncn;
2608             PDL_Double * pcovar;
2609             PDL_Double * pwork;
2610 0           void * tjacn = (void *) __privtrans->jacn;
2611 0           void * tsjacn = (void *) __privtrans->sjacn;;
2612 0           DFP *dat = (void *) __privtrans->indat;
2613 0           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
2614 0           __privtrans->__nt_size, t_datap );
2615            
2616             PDL_COMMENT("THREADLOOPBEGIN")
2617 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2618 0           do { register PDL_Indx __tind1=0,__tind2=0;
2619 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2620 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2621 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2622 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2623 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2624 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2625 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2626 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2627 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2628 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2629 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2630 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2631 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
2632 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
2633 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
2634 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2635 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2636 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2637 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2638 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2639 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2640 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2641 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2642 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
2643 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
2644 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
2645 0           p_datap += __offsp[0];
2646 0           x_datap += __offsp[1];
2647 0           t_datap += __offsp[2];
2648 0           ub_datap += __offsp[3];
2649 0           iopts_datap += __offsp[4];
2650 0           opts_datap += __offsp[5];
2651 0           work_datap += __offsp[6];
2652 0           covar_datap += __offsp[7];
2653 0           returnval_datap += __offsp[8];
2654 0           pout_datap += __offsp[9];
2655 0           info_datap += __offsp[10];
2656 0 0         for( __tind2 = 0 ;
2657             __tind2 < __tdims1 ;
2658 0           __tind2++
2659 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
2660 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
2661 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
2662 0           ,ub_datap += __tinc1_3 - __tinc0_3 * __tdims0
2663 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
2664 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
2665 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
2666 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
2667 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
2668 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
2669 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
2670             )
2671             {
2672 0 0         for( __tind1 = 0 ;
2673             __tind1 < __tdims0 ;
2674 0           __tind1++
2675 0           ,p_datap += __tinc0_0
2676 0           ,x_datap += __tinc0_1
2677 0           ,t_datap += __tinc0_2
2678 0           ,ub_datap += __tinc0_3
2679 0           ,iopts_datap += __tinc0_4
2680 0           ,opts_datap += __tinc0_5
2681 0           ,work_datap += __tinc0_6
2682 0           ,covar_datap += __tinc0_7
2683 0           ,returnval_datap += __tinc0_8
2684 0           ,pout_datap += __tinc0_9
2685 0           ,info_datap += __tinc0_10
2686             )
2687             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
2688             {PDL_COMMENT("Open m") register PDL_Indx m;
2689 0 0         for(m=0; m<(__m_size); m++) {
2690 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
2691             }} PDL_COMMENT("Close m")
2692 0           iopts = iopts_datap;
2693 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
2694 0           else pcovar = NULL;
2695             if ( 0 == 1 ) pwork = NULL;
2696 0           else pwork = work_datap;
2697 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
2698 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_der (
2699             tfuncn , tjacn,
2700 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, NULL,ub_datap,
2701             maxits, opts_datap, info_datap, pwork, pcovar, dat);
2702             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
2703            
2704             PDL_COMMENT("THREADLOOPEND")
2705             }
2706             }
2707 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
2708 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
2709 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
2710 0           ub_datap -= __tinc1_3 * __tdims1 + __offsp[3];
2711 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
2712 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
2713 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
2714 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
2715 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
2716 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
2717 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
2718 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
2719            
2720 0           } break;}
2721 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
2722             }
2723             }
2724             }
2725            
2726              
2727              
2728              
2729 0           void pdl_levmar_der_ub_free(pdl_trans *__tr ) {
2730             int __dim;
2731 0           pdl_levmar_der_ub_struct *__privtrans = (pdl_levmar_der_ub_struct *) __tr;
2732            
2733             {
2734            
2735 0           PDL_TR_CLRMAGIC(__privtrans);
2736             ;;;;;;
2737 0 0         if(__privtrans->__ddone) {
2738 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
2739             ;;;;;;;;;;;;;;;;;;;
2740             }
2741            
2742             }
2743 0           }
2744            
2745              
2746              
2747              
2748             static char pdl_levmar_der_ub_vtable_flags[] =
2749             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
2750             pdl_transvtable pdl_levmar_der_ub_vtable = {
2751             0,0, 6, 11, pdl_levmar_der_ub_vtable_flags,
2752             pdl_levmar_der_ub_redodims, pdl_levmar_der_ub_readdata, NULL,
2753             pdl_levmar_der_ub_free,NULL,NULL,pdl_levmar_der_ub_copy,
2754             sizeof(pdl_levmar_der_ub_struct),"pdl_levmar_der_ub_vtable"
2755             };
2756              
2757             typedef struct pdl_levmar_der__struct {
2758             PDL_TRANS_START(10);
2759             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __q_size;PDL_Indx __wn_size;PDL_Indx __in_size;PDL_Indx __nt_size;PDL_Indx __m_size;PDL_Indx __n_size;PDL_Indx __nopt_size;
2760             IV funcn;IV sfuncn;IV jacn;IV sjacn;IV indat;int want_covar;
2761             char __ddone; PDL_COMMENT("Dims done")
2762             } pdl_levmar_der__struct;
2763              
2764 60           void pdl_levmar_der__redodims(pdl_trans *__tr ) {
2765             int __dim;
2766 60           pdl_levmar_der__struct *__privtrans = (pdl_levmar_der__struct *) __tr;
2767            
2768             {
2769             PDL_Indx __creating[10];
2770 60           __privtrans->__q_size = 10;
2771 60           __privtrans->__wn_size = -1;
2772 60           __privtrans->__in_size = -1;
2773 60           __privtrans->__nt_size = -1;
2774 60           __privtrans->__m_size = -1;
2775 60           __privtrans->__n_size = -1;
2776 60           __privtrans->__nopt_size = -1;
2777 60           __creating[0] = 0;
2778 60           __creating[1] = 0;
2779 60           __creating[2] = 0;
2780 60           __creating[3] = 0;
2781 60           __creating[4] = 0;
2782 60 50         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    100          
2783 60 50         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    100          
2784 60 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
2785 60 50         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    50          
2786 60 50         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    50          
2787             {
2788             {PDL_COMMENT("Start generic loop")
2789              
2790 60           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
2791 0           } break; case PDL_F: {
2792 6 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2793 6           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
2794              
2795 6 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2796 6           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
2797              
2798 6 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2799 6           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
2800              
2801 6 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2802 6           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2803              
2804 6 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2805 6           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
2806              
2807 6 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2808 6           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
2809              
2810 6 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2811 6           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
2812              
2813 6 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2814 6           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
2815              
2816 6 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
2817 6           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
2818              
2819 6 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
2820 6           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
2821              
2822 6           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
2823 6           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
2824 6           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
2825 6           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
2826 6           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
2827 6           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
2828 6           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
2829 6           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
2830 6           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
2831 6           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
2832              
2833              
2834 6           int im = __privtrans->pdls[0]->dims[0];
2835 6           int in = __privtrans->pdls[1]->dims[0];
2836 6           int min = 2*in + 4*im + in*im + im*im;
2837 6           int inw = __privtrans->pdls[5]->dims[0];
2838 6           __privtrans->__wn_size = inw >= min ? inw : min;
2839            
2840 6           } } break; case PDL_D: {
2841 54 100         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    50          
2842 54           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2843              
2844 54 100         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    50          
2845 54           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
2846              
2847 54 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2848 54           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2849              
2850 54 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2851 54           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2852              
2853 54 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2854 54           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
2855              
2856 54 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2857 54           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
2858              
2859 54 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2860 54           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
2861              
2862 54 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2863 54           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
2864              
2865 54 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
2866 54           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
2867              
2868 54 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
2869 54           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
2870              
2871 54           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
2872 54           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
2873 54           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
2874 54           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
2875 54           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
2876 54           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
2877 54           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
2878 54           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
2879 54           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
2880 54           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
2881              
2882              
2883 54           int im = __privtrans->pdls[0]->dims[0];
2884 54           int in = __privtrans->pdls[1]->dims[0];
2885 54           int min = 2*in + 4*im + in*im + im*im;
2886 54           int inw = __privtrans->pdls[5]->dims[0];
2887 54           __privtrans->__wn_size = inw >= min ? inw : min;
2888            
2889 54           } break;}
2890 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
2891             }
2892             }
2893             {
2894             static char *__parnames[] = {"p","x","t","iopts","opts","work","covar","returnval","pout","info"};
2895             static PDL_Indx __realdims[] = {1,1,1,1,1,1,2,0,1,1};
2896             static char __funcname[] = "PDL::Fit::Levmar::levmar_der_";
2897             static pdl_errorinfo __einfo = {
2898             __funcname, __parnames, 10
2899             };
2900            
2901 60           PDL->initthreadstruct(2,__privtrans->pdls,
2902             __realdims,__creating,10,
2903             &__einfo,&(__privtrans->__pdlthread),
2904 60           __privtrans->vtable->per_pdl_flags,
2905             0 );
2906             }
2907 60 50         if(((__privtrans->pdls[0]))->ndims < 1) {
2908 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2909             }
2910 60 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
2911 60           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
2912 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
2913 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
2914 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2915             }
2916             }
2917 60 50         if(((__privtrans->pdls[1]))->ndims < 1) {
2918 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
2919             }
2920 60 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
2921 60           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
2922 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
2923 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
2924 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2925             }
2926             }
2927 60           PDL->make_physical(((__privtrans->pdls[1])));
2928 60 50         if(((__privtrans->pdls[2]))->ndims < 1) {
2929 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
2930             }
2931 60 50         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
2932 60           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
2933 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
2934 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
2935 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2936             }
2937             }
2938 60           PDL->make_physical(((__privtrans->pdls[2])));
2939 60 50         if(((__privtrans->pdls[3]))->ndims < 1) {
2940 60 50         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    50          
2941             }
2942 60 50         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__in_size == 1)) {
    50          
    0          
2943 0           __privtrans->__in_size = ((__privtrans->pdls[3]))->dims[0];
2944 60 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
2945 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
2946 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2947             }
2948             }
2949 60           PDL->make_physical(((__privtrans->pdls[3])));
2950 60 50         if(((__privtrans->pdls[4]))->ndims < 1) {
2951 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
2952             }
2953 60 50         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
2954 60           __privtrans->__nopt_size = ((__privtrans->pdls[4]))->dims[0];
2955 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
2956 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
2957 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2958             }
2959             }
2960 60           PDL->make_physical(((__privtrans->pdls[4])));
2961 60 100         if(!__creating[5]) {
2962 1 50         if(((__privtrans->pdls[5]))->ndims < 1) {
2963 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
2964             }
2965 1 50         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    50          
    50          
2966 0           __privtrans->__wn_size = ((__privtrans->pdls[5]))->dims[0];
2967 1 50         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[5]))->dims[0]) {
    50          
2968 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
2969 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2970             }
2971             }
2972 1           PDL->make_physical(((__privtrans->pdls[5])));
2973             } else {
2974 59           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
2975 59           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,1);
2976 60 100         }if(!__creating[6]) {
2977 1 50         if(((__privtrans->pdls[6]))->ndims < 2) {
2978 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2979 0 0         if (((__privtrans->pdls[6]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
2980             }
2981 1 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__m_size == 1)) {
    50          
    50          
2982 0           __privtrans->__m_size = ((__privtrans->pdls[6]))->dims[0];
2983 1 50         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[6]))->dims[0]) {
    50          
2984 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
2985 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2986             }
2987             }
2988 1 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__m_size == 1)) {
    50          
    50          
2989 0           __privtrans->__m_size = ((__privtrans->pdls[6]))->dims[1];
2990 1 50         } else if(((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[6]))->dims[1]) {
    50          
2991 0 0         if(((__privtrans->pdls[6]))->dims[1] != 1) {
2992 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
2993             }
2994             }
2995 1           PDL->make_physical(((__privtrans->pdls[6])));
2996             } else {
2997 59           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
2998 59           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,0);
2999 60 50         }if(!__creating[7]) {
3000             } else {
3001             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
3002 60           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
3003 60 50         }if(!__creating[8]) {
3004 0 0         if(((__privtrans->pdls[8]))->ndims < 1) {
3005 0 0         if (((__privtrans->pdls[8]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3006             }
3007 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
3008 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[0];
3009 0 0         } else if(((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[0]) {
    0          
3010 0 0         if(((__privtrans->pdls[8]))->dims[0] != 1) {
3011 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
3012             }
3013             }
3014 0           PDL->make_physical(((__privtrans->pdls[8])));
3015             } else {
3016 60           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
3017 60           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
3018 60 50         }if(!__creating[9]) {
3019 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
3020 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
3021             }
3022 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
3023 0           __privtrans->__q_size = ((__privtrans->pdls[9]))->dims[0];
3024 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
3025 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
3026 0           PDL->pdl_barf("Error in levmar_der_:" "Wrong dims\n");
3027             }
3028             }
3029 0           PDL->make_physical(((__privtrans->pdls[9])));
3030             } else {
3031 60           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
3032 60           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
3033             }
3034             { PDL_COMMENT("convenience block")
3035 60           void *hdrp = NULL;
3036 60           char propagate_hdrcpy = 0;
3037 60           SV *hdr_copy = NULL;
3038 60 50         if(!hdrp &&
    50          
3039 0 0         __privtrans->pdls[0]->hdrsv &&
3040 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
3041             ) {
3042 0           hdrp = __privtrans->pdls[0]->hdrsv;
3043 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
3044             }
3045 60 50         if(!hdrp &&
    50          
3046 0 0         __privtrans->pdls[1]->hdrsv &&
3047 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
3048             ) {
3049 0           hdrp = __privtrans->pdls[1]->hdrsv;
3050 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
3051             }
3052 60 50         if(!hdrp &&
    50          
3053 0 0         __privtrans->pdls[2]->hdrsv &&
3054 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
3055             ) {
3056 0           hdrp = __privtrans->pdls[2]->hdrsv;
3057 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
3058             }
3059 60 50         if(!hdrp &&
    50          
3060 0 0         __privtrans->pdls[3]->hdrsv &&
3061 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
3062             ) {
3063 0           hdrp = __privtrans->pdls[3]->hdrsv;
3064 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
3065             }
3066 60 50         if(!hdrp &&
    50          
3067 0 0         __privtrans->pdls[4]->hdrsv &&
3068 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
3069             ) {
3070 0           hdrp = __privtrans->pdls[4]->hdrsv;
3071 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
3072             }
3073 60 50         if(!hdrp &&
    100          
3074 1 50         !__creating[5] &&
3075 0 0         __privtrans->pdls[5]->hdrsv &&
3076 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
3077             ) {
3078 0           hdrp = __privtrans->pdls[5]->hdrsv;
3079 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
3080             }
3081 60 50         if(!hdrp &&
    100          
3082 1 50         !__creating[6] &&
3083 0 0         __privtrans->pdls[6]->hdrsv &&
3084 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
3085             ) {
3086 0           hdrp = __privtrans->pdls[6]->hdrsv;
3087 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
3088             }
3089 60 50         if(!hdrp &&
    50          
3090 0 0         !__creating[7] &&
3091 0 0         __privtrans->pdls[7]->hdrsv &&
3092 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
3093             ) {
3094 0           hdrp = __privtrans->pdls[7]->hdrsv;
3095 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
3096             }
3097 60 50         if(!hdrp &&
    50          
3098 0 0         !__creating[8] &&
3099 0 0         __privtrans->pdls[8]->hdrsv &&
3100 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
3101             ) {
3102 0           hdrp = __privtrans->pdls[8]->hdrsv;
3103 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
3104             }
3105 60 50         if(!hdrp &&
    50          
3106 0 0         !__creating[9] &&
3107 0 0         __privtrans->pdls[9]->hdrsv &&
3108 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
3109             ) {
3110 0           hdrp = __privtrans->pdls[9]->hdrsv;
3111 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
3112             }
3113 60 50         if (hdrp) {
3114 0 0         if(hdrp == &PL_sv_undef)
3115 0           hdr_copy = &PL_sv_undef;
3116             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
3117             int count;
3118             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
3119 0           dSP;
3120 0           ENTER ;
3121 0           SAVETMPS ;
3122 0 0         PUSHMARK(SP) ;
3123 0 0         XPUSHs( hdrp );
3124 0           PUTBACK ;
3125 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
3126 0           SPAGAIN ;
3127 0 0         if(count != 1)
3128 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
3129              
3130 0           hdr_copy = (SV *)POPs;
3131              
3132 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
3133 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
3134             }
3135              
3136 0 0         FREETMPS ;
3137 0           LEAVE ;
3138              
3139              
3140             } PDL_COMMENT("end of callback block")
3141              
3142 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
3143 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
3144 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
3145 0 0         if( hdr_copy != &PL_sv_undef )
3146 0           (void)SvREFCNT_inc(hdr_copy);
3147 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
3148             }
3149 0 0         if(propagate_hdrcpy)
3150 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
3151 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
3152 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
3153 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
3154 0 0         if( hdr_copy != &PL_sv_undef )
3155 0           (void)SvREFCNT_inc(hdr_copy);
3156 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
3157             }
3158 0 0         if(propagate_hdrcpy)
3159 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
3160 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
3161 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
3162 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
3163 0 0         if( hdr_copy != &PL_sv_undef )
3164 0           (void)SvREFCNT_inc(hdr_copy);
3165 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
3166             }
3167 0 0         if(propagate_hdrcpy)
3168 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
3169 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
3170 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
3171 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
3172 0 0         if( hdr_copy != &PL_sv_undef )
3173 0           (void)SvREFCNT_inc(hdr_copy);
3174 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
3175             }
3176 0 0         if(propagate_hdrcpy)
3177 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
3178 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
3179 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
3180 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
3181 0 0         if( hdr_copy != &PL_sv_undef )
3182 0           (void)SvREFCNT_inc(hdr_copy);
3183 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
3184             }
3185 0 0         if(propagate_hdrcpy)
3186 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
3187              
3188 0 0         if(hdr_copy != &PL_sv_undef)
3189 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
3190             } PDL_COMMENT("end of if(hdrp) block")
3191             } PDL_COMMENT("end of conv. block")
3192 60 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
3193 0           __privtrans->__inc_p_m = 0; else
3194 60 100         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
3195 0           __privtrans->__inc_x_n = 0; else
3196 60 50         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    100          
3197 12           __privtrans->__inc_t_nt = 0; else
3198 60 50         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
3199 60           __privtrans->__inc_iopts_in = 0; else
3200 60 50         __privtrans->__inc_iopts_in = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
3201 0           __privtrans->__inc_opts_nopt = 0; else
3202 60 50         __privtrans->__inc_opts_nopt = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    50          
3203 0           __privtrans->__inc_work_wn = 0; else
3204 60 50         __privtrans->__inc_work_wn = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    50          
3205 0           __privtrans->__inc_covar_m0 = 0; else
3206 60 50         __privtrans->__inc_covar_m0 = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 1 || __privtrans->pdls[6]->dims[1] <= 1)
    50          
3207 0           __privtrans->__inc_covar_m1 = 0; else
3208 60 50         __privtrans->__inc_covar_m1 = __privtrans->pdls[6]->dimincs[1];if(__privtrans->pdls[8]->ndims <= 0 || __privtrans->pdls[8]->dims[0] <= 1)
    50          
3209 0           __privtrans->__inc_pout_m = 0; else
3210 60 50         __privtrans->__inc_pout_m = __privtrans->pdls[8]->dimincs[0];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    50          
3211 0           __privtrans->__inc_info_q = 0; else
3212 60           __privtrans->__inc_info_q = __privtrans->pdls[9]->dimincs[0]; __privtrans->__ddone = 1;
3213             }
3214 60           }
3215            
3216              
3217 0           pdl_trans * pdl_levmar_der__copy(pdl_trans *__tr ) {
3218             int __dim;
3219 0           pdl_levmar_der__struct *__privtrans = (pdl_levmar_der__struct *) __tr;
3220            
3221             {
3222 0           pdl_levmar_der__struct *__copy = malloc(sizeof(pdl_levmar_der__struct));
3223 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
3224 0           __copy->has_badvalue = __privtrans->has_badvalue;
3225 0           __copy->badvalue = __privtrans->badvalue;
3226 0           __copy->flags = __privtrans->flags;
3227 0           __copy->vtable = __privtrans->vtable;
3228 0           __copy->__datatype = __privtrans->__datatype;
3229 0           __copy->freeproc = NULL;
3230 0           __copy->__ddone = __privtrans->__ddone;
3231             {int i;
3232 0 0         for(i=0; i<__copy->vtable->npdls; i++)
3233 0           __copy->pdls[i] = __privtrans->pdls[i];
3234             }
3235 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->jacn) = (__privtrans->jacn);;(__copy->sjacn) = (__privtrans->sjacn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
3236 0 0         if(__copy->__ddone) {
3237 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__q_size=__privtrans->__q_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__in_size=__privtrans->__in_size;__copy->__nt_size=__privtrans->__nt_size;__copy->__m_size=__privtrans->__m_size;__copy->__n_size=__privtrans->__n_size;__copy->__nopt_size=__privtrans->__nopt_size;
3238             }
3239 0           return (pdl_trans*)__copy;
3240             }
3241             }
3242            
3243              
3244 60           void pdl_levmar_der__readdata(pdl_trans *__tr ) {
3245             int __dim;
3246 60           pdl_levmar_der__struct *__privtrans = (pdl_levmar_der__struct *) __tr;
3247            
3248             {
3249 60           {register PDL_Indx __m_size = __privtrans->__m_size;
3250             PDL_COMMENT("Start generic loop")
3251              
3252 60           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
3253 0           } break; case PDL_F: {
3254 6 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3255 6           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
3256              
3257 6 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3258 6           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
3259              
3260 6 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3261 6           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
3262              
3263 6 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3264 6           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3265              
3266 6 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3267 6           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
3268              
3269 6 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3270 6           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
3271              
3272 6 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3273 6           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
3274              
3275 6 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3276 6           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
3277              
3278 6 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
3279 6           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
3280              
3281 6 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
3282 6           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
3283              
3284 6           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
3285 6           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
3286 6           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
3287 6           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
3288 6           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
3289 6           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
3290 6           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
3291 6           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
3292 6           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
3293 6           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
3294              
3295              
3296             int * iopts;
3297             int maxits;
3298 6           void * tfuncn = (void *) __privtrans->funcn;
3299 6           void * tsfuncn = (void *) __privtrans->sfuncn;
3300             PDL_Float * pcovar;
3301             PDL_Float * pwork;
3302 6           void * tjacn = (void *) __privtrans->jacn;
3303 6           void * tsjacn = (void *) __privtrans->sjacn;;
3304 6           DFP *dat = (void *) __privtrans->indat;
3305 6           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
3306 6           __privtrans->__nt_size, t_datap );
3307            
3308             PDL_COMMENT("THREADLOOPBEGIN")
3309 6 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3310 6           do { register PDL_Indx __tind1=0,__tind2=0;
3311 6           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3312 6           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3313 6           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3314 6           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3315 6           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3316 6           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3317 6           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3318 6           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3319 6           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3320 6           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3321 6           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3322 6           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3323 6           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
3324 6           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
3325 6           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3326 6           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3327 6           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3328 6           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3329 6           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3330 6           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3331 6           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3332 6           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3333 6           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
3334 6           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
3335 6           p_datap += __offsp[0];
3336 6           x_datap += __offsp[1];
3337 6           t_datap += __offsp[2];
3338 6           iopts_datap += __offsp[3];
3339 6           opts_datap += __offsp[4];
3340 6           work_datap += __offsp[5];
3341 6           covar_datap += __offsp[6];
3342 6           returnval_datap += __offsp[7];
3343 6           pout_datap += __offsp[8];
3344 6           info_datap += __offsp[9];
3345 12 100         for( __tind2 = 0 ;
3346             __tind2 < __tdims1 ;
3347 6           __tind2++
3348 6           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
3349 6           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
3350 6           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
3351 6           ,iopts_datap += __tinc1_3 - __tinc0_3 * __tdims0
3352 6           ,opts_datap += __tinc1_4 - __tinc0_4 * __tdims0
3353 6           ,work_datap += __tinc1_5 - __tinc0_5 * __tdims0
3354 6           ,covar_datap += __tinc1_6 - __tinc0_6 * __tdims0
3355 6           ,returnval_datap += __tinc1_7 - __tinc0_7 * __tdims0
3356 6           ,pout_datap += __tinc1_8 - __tinc0_8 * __tdims0
3357 6           ,info_datap += __tinc1_9 - __tinc0_9 * __tdims0
3358             )
3359             {
3360 12 100         for( __tind1 = 0 ;
3361             __tind1 < __tdims0 ;
3362 6           __tind1++
3363 6           ,p_datap += __tinc0_0
3364 6           ,x_datap += __tinc0_1
3365 6           ,t_datap += __tinc0_2
3366 6           ,iopts_datap += __tinc0_3
3367 6           ,opts_datap += __tinc0_4
3368 6           ,work_datap += __tinc0_5
3369 6           ,covar_datap += __tinc0_6
3370 6           ,returnval_datap += __tinc0_7
3371 6           ,pout_datap += __tinc0_8
3372 6           ,info_datap += __tinc0_9
3373             )
3374             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3375             {PDL_COMMENT("Open m") register PDL_Indx m;
3376 18 100         for(m=0; m<(__m_size); m++) {
3377 12 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
3378             }} PDL_COMMENT("Close m")
3379 6           iopts = iopts_datap;
3380 6 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
3381 6           else pcovar = NULL;
3382             if ( 0 == 1 ) pwork = NULL;
3383 6           else pwork = work_datap;
3384 6           maxits = iopts[0]; /* for clarity. we hope optimized away */
3385 6           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_der (
3386             tsfuncn , tsjacn,
3387 12           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size,
3388             maxits, opts_datap, info_datap, pwork, pcovar, dat);
3389             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
3390            
3391             PDL_COMMENT("THREADLOOPEND")
3392             }
3393             }
3394 6           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3395 6           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3396 6           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3397 6           iopts_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3398 6           opts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3399 6           work_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3400 6           covar_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3401 6           returnval_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3402 6           pout_datap -= __tinc1_8 * __tdims1 + __offsp[8];
3403 6           info_datap -= __tinc1_9 * __tdims1 + __offsp[9];
3404 6 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3405            
3406 6           } } break; case PDL_D: {
3407 54 100         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    50          
3408 54           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3409              
3410 54 100         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    50          
3411 54           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
3412              
3413 54 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3414 54           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3415              
3416 54 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3417 54           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3418              
3419 54 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3420 54           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
3421              
3422 54 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3423 54           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
3424              
3425 54 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3426 54           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
3427              
3428 54 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3429 54           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
3430              
3431 54 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
3432 54           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
3433              
3434 54 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
3435 54           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
3436              
3437 54           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
3438 54           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
3439 54           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
3440 54           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
3441 54           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
3442 54           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
3443 54           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
3444 54           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
3445 54           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
3446 54           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
3447              
3448              
3449             int * iopts;
3450             int maxits;
3451 54           void * tfuncn = (void *) __privtrans->funcn;
3452 54           void * tsfuncn = (void *) __privtrans->sfuncn;
3453             PDL_Double * pcovar;
3454             PDL_Double * pwork;
3455 54           void * tjacn = (void *) __privtrans->jacn;
3456 54           void * tsjacn = (void *) __privtrans->sjacn;;
3457 54           DFP *dat = (void *) __privtrans->indat;
3458 54           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
3459 54           __privtrans->__nt_size, t_datap );
3460            
3461             PDL_COMMENT("THREADLOOPBEGIN")
3462 54 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3463 54           do { register PDL_Indx __tind1=0,__tind2=0;
3464 54           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3465 54           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3466 54           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3467 54           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3468 54           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3469 54           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3470 54           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3471 54           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3472 54           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3473 54           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3474 54           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3475 54           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3476 54           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
3477 54           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
3478 54           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3479 54           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3480 54           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3481 54           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3482 54           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3483 54           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3484 54           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3485 54           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3486 54           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
3487 54           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
3488 54           p_datap += __offsp[0];
3489 54           x_datap += __offsp[1];
3490 54           t_datap += __offsp[2];
3491 54           iopts_datap += __offsp[3];
3492 54           opts_datap += __offsp[4];
3493 54           work_datap += __offsp[5];
3494 54           covar_datap += __offsp[6];
3495 54           returnval_datap += __offsp[7];
3496 54           pout_datap += __offsp[8];
3497 54           info_datap += __offsp[9];
3498 120 100         for( __tind2 = 0 ;
3499             __tind2 < __tdims1 ;
3500 66           __tind2++
3501 66           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
3502 66           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
3503 66           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
3504 66           ,iopts_datap += __tinc1_3 - __tinc0_3 * __tdims0
3505 66           ,opts_datap += __tinc1_4 - __tinc0_4 * __tdims0
3506 66           ,work_datap += __tinc1_5 - __tinc0_5 * __tdims0
3507 66           ,covar_datap += __tinc1_6 - __tinc0_6 * __tdims0
3508 66           ,returnval_datap += __tinc1_7 - __tinc0_7 * __tdims0
3509 66           ,pout_datap += __tinc1_8 - __tinc0_8 * __tdims0
3510 66           ,info_datap += __tinc1_9 - __tinc0_9 * __tdims0
3511             )
3512             {
3513 185 100         for( __tind1 = 0 ;
3514             __tind1 < __tdims0 ;
3515 119           __tind1++
3516 119           ,p_datap += __tinc0_0
3517 119           ,x_datap += __tinc0_1
3518 119           ,t_datap += __tinc0_2
3519 119           ,iopts_datap += __tinc0_3
3520 119           ,opts_datap += __tinc0_4
3521 119           ,work_datap += __tinc0_5
3522 119           ,covar_datap += __tinc0_6
3523 119           ,returnval_datap += __tinc0_7
3524 119           ,pout_datap += __tinc0_8
3525 119           ,info_datap += __tinc0_9
3526             )
3527             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3528             {PDL_COMMENT("Open m") register PDL_Indx m;
3529 369 100         for(m=0; m<(__m_size); m++) {
3530 250 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
3531             }} PDL_COMMENT("Close m")
3532 119           iopts = iopts_datap;
3533 119 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
3534 119           else pcovar = NULL;
3535             if ( 0 == 1 ) pwork = NULL;
3536 119           else pwork = work_datap;
3537 119           maxits = iopts[0]; /* for clarity. we hope optimized away */
3538 119           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_der (
3539             tfuncn , tjacn,
3540 238           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size,
3541             maxits, opts_datap, info_datap, pwork, pcovar, dat);
3542             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
3543            
3544             PDL_COMMENT("THREADLOOPEND")
3545             }
3546             }
3547 54           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3548 54           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3549 54           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3550 54           iopts_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3551 54           opts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3552 54           work_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3553 54           covar_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3554 54           returnval_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3555 54           pout_datap -= __tinc1_8 * __tdims1 + __offsp[8];
3556 54           info_datap -= __tinc1_9 * __tdims1 + __offsp[9];
3557 54 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3558            
3559 54           } break;}
3560 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
3561             }
3562             }
3563             }
3564            
3565              
3566              
3567              
3568 60           void pdl_levmar_der__free(pdl_trans *__tr ) {
3569             int __dim;
3570 60           pdl_levmar_der__struct *__privtrans = (pdl_levmar_der__struct *) __tr;
3571            
3572             {
3573            
3574 60           PDL_TR_CLRMAGIC(__privtrans);
3575             ;;;;;;
3576 60 50         if(__privtrans->__ddone) {
3577 60           PDL->freethreadloop(&(__privtrans->__pdlthread));
3578             ;;;;;;;;;;;;;;;;;;
3579             }
3580            
3581             }
3582 60           }
3583            
3584              
3585              
3586              
3587             static char pdl_levmar_der__vtable_flags[] =
3588             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
3589             pdl_transvtable pdl_levmar_der__vtable = {
3590             0,0, 5, 10, pdl_levmar_der__vtable_flags,
3591             pdl_levmar_der__redodims, pdl_levmar_der__readdata, NULL,
3592             pdl_levmar_der__free,NULL,NULL,pdl_levmar_der__copy,
3593             sizeof(pdl_levmar_der__struct),"pdl_levmar_der__vtable"
3594             };
3595              
3596             typedef struct pdl_levmar_diff_lb_struct {
3597             PDL_TRANS_START(11);
3598             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_lb_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __m_size;PDL_Indx __wn_size;PDL_Indx __n_size;PDL_Indx __q_size;PDL_Indx __in_size;PDL_Indx __nopt_size;PDL_Indx __nt_size;
3599             IV funcn;IV sfuncn;IV indat;int want_covar;
3600             char __ddone; PDL_COMMENT("Dims done")
3601             } pdl_levmar_diff_lb_struct;
3602              
3603 0           void pdl_levmar_diff_lb_redodims(pdl_trans *__tr ) {
3604             int __dim;
3605 0           pdl_levmar_diff_lb_struct *__privtrans = (pdl_levmar_diff_lb_struct *) __tr;
3606            
3607             {
3608             PDL_Indx __creating[11];
3609 0           __privtrans->__m_size = -1;
3610 0           __privtrans->__wn_size = -1;
3611 0           __privtrans->__n_size = -1;
3612 0           __privtrans->__q_size = 10;
3613 0           __privtrans->__in_size = -1;
3614 0           __privtrans->__nopt_size = -1;
3615 0           __privtrans->__nt_size = -1;
3616 0           __creating[0] = 0;
3617 0           __creating[1] = 0;
3618 0           __creating[2] = 0;
3619 0           __creating[3] = 0;
3620 0           __creating[4] = 0;
3621 0           __creating[5] = 0;
3622 0 0         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
3623 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
3624 0 0         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    0          
3625 0 0         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    0          
3626 0 0         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    0          
3627             {
3628             {PDL_COMMENT("Start generic loop")
3629              
3630 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
3631 0           } break; case PDL_F: {
3632 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3633 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
3634              
3635 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3636 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
3637              
3638 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3639 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
3640              
3641 0 0         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3642 0           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
3643              
3644 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3645 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3646              
3647 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3648 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
3649              
3650 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3651 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
3652              
3653 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3654 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
3655              
3656 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
3657 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
3658              
3659 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
3660 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
3661              
3662 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
3663 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
3664              
3665 0           {register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
3666 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
3667 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
3668 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
3669 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
3670 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
3671 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
3672 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
3673 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
3674 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
3675 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
3676              
3677              
3678 0           int im = __privtrans->pdls[0]->dims[0];
3679 0           int in = __privtrans->pdls[1]->dims[0];
3680 0           int min = 4*in + 4*im + in*im + im*im;
3681 0           int inw = __privtrans->pdls[6]->dims[0];
3682 0           __privtrans->__wn_size = inw >= min ? inw : min;
3683            
3684 0           } } break; case PDL_D: {
3685 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3686 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3687              
3688 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3689 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
3690              
3691 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3692 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3693              
3694 0 0         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3695 0           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3696              
3697 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3698 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3699              
3700 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3701 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
3702              
3703 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3704 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
3705              
3706 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3707 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
3708              
3709 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
3710 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
3711              
3712 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
3713 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
3714              
3715 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
3716 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
3717              
3718 0           {register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
3719 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
3720 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
3721 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
3722 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
3723 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
3724 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
3725 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
3726 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
3727 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
3728 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
3729              
3730              
3731 0           int im = __privtrans->pdls[0]->dims[0];
3732 0           int in = __privtrans->pdls[1]->dims[0];
3733 0           int min = 4*in + 4*im + in*im + im*im;
3734 0           int inw = __privtrans->pdls[6]->dims[0];
3735 0           __privtrans->__wn_size = inw >= min ? inw : min;
3736            
3737 0           } break;}
3738 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
3739             }
3740             }
3741             {
3742             static char *__parnames[] = {"p","x","t","lb","iopts","opts","work","covar","returnval","pout","info"};
3743             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,2,0,1,1};
3744             static char __funcname[] = "PDL::Fit::Levmar::levmar_diff_lb";
3745             static pdl_errorinfo __einfo = {
3746             __funcname, __parnames, 11
3747             };
3748            
3749 0           PDL->initthreadstruct(2,__privtrans->pdls,
3750             __realdims,__creating,11,
3751             &__einfo,&(__privtrans->__pdlthread),
3752 0           __privtrans->vtable->per_pdl_flags,
3753             0 );
3754             }
3755 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
3756 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3757             }
3758 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
3759 0           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
3760 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
3761 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
3762 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3763             }
3764             }
3765 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
3766 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
3767             }
3768 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
3769 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
3770 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
3771 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
3772 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3773             }
3774             }
3775 0           PDL->make_physical(((__privtrans->pdls[1])));
3776 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
3777 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
3778             }
3779 0 0         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
3780 0           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
3781 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
3782 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
3783 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3784             }
3785             }
3786 0           PDL->make_physical(((__privtrans->pdls[2])));
3787 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
3788 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3789             }
3790 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
3791 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
3792 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
3793 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
3794 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3795             }
3796             }
3797 0           PDL->make_physical(((__privtrans->pdls[3])));
3798 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
3799 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    0          
3800             }
3801 0 0         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size == 1)) {
    0          
    0          
3802 0           __privtrans->__in_size = ((__privtrans->pdls[4]))->dims[0];
3803 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
3804 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
3805 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3806             }
3807             }
3808 0           PDL->make_physical(((__privtrans->pdls[4])));
3809 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
3810 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
3811             }
3812 0 0         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
3813 0           __privtrans->__nopt_size = ((__privtrans->pdls[5]))->dims[0];
3814 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
3815 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
3816 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3817             }
3818             }
3819 0           PDL->make_physical(((__privtrans->pdls[5])));
3820 0 0         if(!__creating[6]) {
3821 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
3822 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
3823             }
3824 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
3825 0           __privtrans->__wn_size = ((__privtrans->pdls[6]))->dims[0];
3826 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
3827 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
3828 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3829             }
3830             }
3831 0           PDL->make_physical(((__privtrans->pdls[6])));
3832             } else {
3833 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
3834 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,1);
3835 0 0         }if(!__creating[7]) {
3836 0 0         if(((__privtrans->pdls[7]))->ndims < 2) {
3837 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3838 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3839             }
3840 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
3841 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[0];
3842 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
3843 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
3844 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3845             }
3846             }
3847 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
3848 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[1];
3849 0 0         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[1]) {
    0          
3850 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
3851 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3852             }
3853             }
3854 0           PDL->make_physical(((__privtrans->pdls[7])));
3855             } else {
3856 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
3857 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
3858 0 0         }if(!__creating[8]) {
3859             } else {
3860             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
3861 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
3862 0 0         }if(!__creating[9]) {
3863 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
3864 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
3865             }
3866 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
3867 0           __privtrans->__m_size = ((__privtrans->pdls[9]))->dims[0];
3868 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
3869 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
3870 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3871             }
3872             }
3873 0           PDL->make_physical(((__privtrans->pdls[9])));
3874             } else {
3875 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
3876 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
3877 0 0         }if(!__creating[10]) {
3878 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
3879 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
3880             }
3881 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
3882 0           __privtrans->__q_size = ((__privtrans->pdls[10]))->dims[0];
3883 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
3884 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
3885 0           PDL->pdl_barf("Error in levmar_diff_lb:" "Wrong dims\n");
3886             }
3887             }
3888 0           PDL->make_physical(((__privtrans->pdls[10])));
3889             } else {
3890 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
3891 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
3892             }
3893             { PDL_COMMENT("convenience block")
3894 0           void *hdrp = NULL;
3895 0           char propagate_hdrcpy = 0;
3896 0           SV *hdr_copy = NULL;
3897 0 0         if(!hdrp &&
    0          
3898 0 0         __privtrans->pdls[0]->hdrsv &&
3899 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
3900             ) {
3901 0           hdrp = __privtrans->pdls[0]->hdrsv;
3902 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
3903             }
3904 0 0         if(!hdrp &&
    0          
3905 0 0         __privtrans->pdls[1]->hdrsv &&
3906 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
3907             ) {
3908 0           hdrp = __privtrans->pdls[1]->hdrsv;
3909 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
3910             }
3911 0 0         if(!hdrp &&
    0          
3912 0 0         __privtrans->pdls[2]->hdrsv &&
3913 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
3914             ) {
3915 0           hdrp = __privtrans->pdls[2]->hdrsv;
3916 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
3917             }
3918 0 0         if(!hdrp &&
    0          
3919 0 0         __privtrans->pdls[3]->hdrsv &&
3920 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
3921             ) {
3922 0           hdrp = __privtrans->pdls[3]->hdrsv;
3923 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
3924             }
3925 0 0         if(!hdrp &&
    0          
3926 0 0         __privtrans->pdls[4]->hdrsv &&
3927 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
3928             ) {
3929 0           hdrp = __privtrans->pdls[4]->hdrsv;
3930 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
3931             }
3932 0 0         if(!hdrp &&
    0          
3933 0 0         __privtrans->pdls[5]->hdrsv &&
3934 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
3935             ) {
3936 0           hdrp = __privtrans->pdls[5]->hdrsv;
3937 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
3938             }
3939 0 0         if(!hdrp &&
    0          
3940 0 0         !__creating[6] &&
3941 0 0         __privtrans->pdls[6]->hdrsv &&
3942 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
3943             ) {
3944 0           hdrp = __privtrans->pdls[6]->hdrsv;
3945 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
3946             }
3947 0 0         if(!hdrp &&
    0          
3948 0 0         !__creating[7] &&
3949 0 0         __privtrans->pdls[7]->hdrsv &&
3950 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
3951             ) {
3952 0           hdrp = __privtrans->pdls[7]->hdrsv;
3953 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
3954             }
3955 0 0         if(!hdrp &&
    0          
3956 0 0         !__creating[8] &&
3957 0 0         __privtrans->pdls[8]->hdrsv &&
3958 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
3959             ) {
3960 0           hdrp = __privtrans->pdls[8]->hdrsv;
3961 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
3962             }
3963 0 0         if(!hdrp &&
    0          
3964 0 0         !__creating[9] &&
3965 0 0         __privtrans->pdls[9]->hdrsv &&
3966 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
3967             ) {
3968 0           hdrp = __privtrans->pdls[9]->hdrsv;
3969 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
3970             }
3971 0 0         if(!hdrp &&
    0          
3972 0 0         !__creating[10] &&
3973 0 0         __privtrans->pdls[10]->hdrsv &&
3974 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
3975             ) {
3976 0           hdrp = __privtrans->pdls[10]->hdrsv;
3977 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
3978             }
3979 0 0         if (hdrp) {
3980 0 0         if(hdrp == &PL_sv_undef)
3981 0           hdr_copy = &PL_sv_undef;
3982             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
3983             int count;
3984             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
3985 0           dSP;
3986 0           ENTER ;
3987 0           SAVETMPS ;
3988 0 0         PUSHMARK(SP) ;
3989 0 0         XPUSHs( hdrp );
3990 0           PUTBACK ;
3991 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
3992 0           SPAGAIN ;
3993 0 0         if(count != 1)
3994 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
3995              
3996 0           hdr_copy = (SV *)POPs;
3997              
3998 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
3999 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
4000             }
4001              
4002 0 0         FREETMPS ;
4003 0           LEAVE ;
4004              
4005              
4006             } PDL_COMMENT("end of callback block")
4007              
4008 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
4009 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
4010 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
4011 0 0         if( hdr_copy != &PL_sv_undef )
4012 0           (void)SvREFCNT_inc(hdr_copy);
4013 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
4014             }
4015 0 0         if(propagate_hdrcpy)
4016 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
4017 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
4018 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
4019 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
4020 0 0         if( hdr_copy != &PL_sv_undef )
4021 0           (void)SvREFCNT_inc(hdr_copy);
4022 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
4023             }
4024 0 0         if(propagate_hdrcpy)
4025 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
4026 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
4027 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
4028 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
4029 0 0         if( hdr_copy != &PL_sv_undef )
4030 0           (void)SvREFCNT_inc(hdr_copy);
4031 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
4032             }
4033 0 0         if(propagate_hdrcpy)
4034 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
4035 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
4036 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
4037 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
4038 0 0         if( hdr_copy != &PL_sv_undef )
4039 0           (void)SvREFCNT_inc(hdr_copy);
4040 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
4041             }
4042 0 0         if(propagate_hdrcpy)
4043 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
4044 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
4045 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
4046 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
4047 0 0         if( hdr_copy != &PL_sv_undef )
4048 0           (void)SvREFCNT_inc(hdr_copy);
4049 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
4050             }
4051 0 0         if(propagate_hdrcpy)
4052 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
4053              
4054 0 0         if(hdr_copy != &PL_sv_undef)
4055 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
4056             } PDL_COMMENT("end of if(hdrp) block")
4057             } PDL_COMMENT("end of conv. block")
4058 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
4059 0           __privtrans->__inc_p_m = 0; else
4060 0 0         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
4061 0           __privtrans->__inc_x_n = 0; else
4062 0 0         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
4063 0           __privtrans->__inc_t_nt = 0; else
4064 0 0         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
4065 0           __privtrans->__inc_lb_m = 0; else
4066 0 0         __privtrans->__inc_lb_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
4067 0           __privtrans->__inc_iopts_in = 0; else
4068 0 0         __privtrans->__inc_iopts_in = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
4069 0           __privtrans->__inc_opts_nopt = 0; else
4070 0 0         __privtrans->__inc_opts_nopt = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
4071 0           __privtrans->__inc_work_wn = 0; else
4072 0 0         __privtrans->__inc_work_wn = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
4073 0           __privtrans->__inc_covar_m0 = 0; else
4074 0 0         __privtrans->__inc_covar_m0 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    0          
4075 0           __privtrans->__inc_covar_m1 = 0; else
4076 0 0         __privtrans->__inc_covar_m1 = __privtrans->pdls[7]->dimincs[1];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    0          
4077 0           __privtrans->__inc_pout_m = 0; else
4078 0 0         __privtrans->__inc_pout_m = __privtrans->pdls[9]->dimincs[0];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    0          
4079 0           __privtrans->__inc_info_q = 0; else
4080 0           __privtrans->__inc_info_q = __privtrans->pdls[10]->dimincs[0]; __privtrans->__ddone = 1;
4081             }
4082 0           }
4083            
4084              
4085 0           pdl_trans * pdl_levmar_diff_lb_copy(pdl_trans *__tr ) {
4086             int __dim;
4087 0           pdl_levmar_diff_lb_struct *__privtrans = (pdl_levmar_diff_lb_struct *) __tr;
4088            
4089             {
4090 0           pdl_levmar_diff_lb_struct *__copy = malloc(sizeof(pdl_levmar_diff_lb_struct));
4091 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
4092 0           __copy->has_badvalue = __privtrans->has_badvalue;
4093 0           __copy->badvalue = __privtrans->badvalue;
4094 0           __copy->flags = __privtrans->flags;
4095 0           __copy->vtable = __privtrans->vtable;
4096 0           __copy->__datatype = __privtrans->__datatype;
4097 0           __copy->freeproc = NULL;
4098 0           __copy->__ddone = __privtrans->__ddone;
4099             {int i;
4100 0 0         for(i=0; i<__copy->vtable->npdls; i++)
4101 0           __copy->pdls[i] = __privtrans->pdls[i];
4102             }
4103 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
4104 0 0         if(__copy->__ddone) {
4105 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_lb_m=__copy->__inc_lb_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__m_size=__privtrans->__m_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__n_size=__privtrans->__n_size;__copy->__q_size=__privtrans->__q_size;__copy->__in_size=__privtrans->__in_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__nt_size=__privtrans->__nt_size;
4106             }
4107 0           return (pdl_trans*)__copy;
4108             }
4109             }
4110            
4111              
4112 0           void pdl_levmar_diff_lb_readdata(pdl_trans *__tr ) {
4113             int __dim;
4114 0           pdl_levmar_diff_lb_struct *__privtrans = (pdl_levmar_diff_lb_struct *) __tr;
4115            
4116             {
4117 0           {register PDL_Indx __m_size = __privtrans->__m_size;
4118             PDL_COMMENT("Start generic loop")
4119              
4120 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
4121 0           } break; case PDL_F: {
4122 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4123 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
4124              
4125 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4126 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
4127              
4128 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4129 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
4130              
4131 0 0         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4132 0           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
4133              
4134 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4135 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4136              
4137 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
4138 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
4139              
4140 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
4141 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
4142              
4143 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
4144 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
4145              
4146 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
4147 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
4148              
4149 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
4150 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
4151              
4152 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
4153 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
4154              
4155 0           {register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
4156 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
4157 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
4158 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
4159 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
4160 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
4161 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
4162 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
4163 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
4164 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
4165 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
4166              
4167              
4168             int * iopts;
4169             int maxits;
4170 0           void * tfuncn = (void *) __privtrans->funcn;
4171 0           void * tsfuncn = (void *) __privtrans->sfuncn;
4172             PDL_Float * pcovar;
4173             PDL_Float * pwork;
4174             ;
4175 0           DFP *dat = (void *) __privtrans->indat;
4176 0           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
4177 0           __privtrans->__nt_size, t_datap );
4178            
4179             PDL_COMMENT("THREADLOOPBEGIN")
4180 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4181 0           do { register PDL_Indx __tind1=0,__tind2=0;
4182 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4183 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4184 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4185 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4186 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4187 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4188 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4189 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4190 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
4191 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
4192 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
4193 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
4194 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
4195 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
4196 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
4197 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4198 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4199 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4200 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4201 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
4202 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
4203 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
4204 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
4205 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
4206 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
4207 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
4208 0           p_datap += __offsp[0];
4209 0           x_datap += __offsp[1];
4210 0           t_datap += __offsp[2];
4211 0           lb_datap += __offsp[3];
4212 0           iopts_datap += __offsp[4];
4213 0           opts_datap += __offsp[5];
4214 0           work_datap += __offsp[6];
4215 0           covar_datap += __offsp[7];
4216 0           returnval_datap += __offsp[8];
4217 0           pout_datap += __offsp[9];
4218 0           info_datap += __offsp[10];
4219 0 0         for( __tind2 = 0 ;
4220             __tind2 < __tdims1 ;
4221 0           __tind2++
4222 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
4223 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
4224 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
4225 0           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
4226 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
4227 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
4228 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
4229 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
4230 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
4231 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
4232 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
4233             )
4234             {
4235 0 0         for( __tind1 = 0 ;
4236             __tind1 < __tdims0 ;
4237 0           __tind1++
4238 0           ,p_datap += __tinc0_0
4239 0           ,x_datap += __tinc0_1
4240 0           ,t_datap += __tinc0_2
4241 0           ,lb_datap += __tinc0_3
4242 0           ,iopts_datap += __tinc0_4
4243 0           ,opts_datap += __tinc0_5
4244 0           ,work_datap += __tinc0_6
4245 0           ,covar_datap += __tinc0_7
4246 0           ,returnval_datap += __tinc0_8
4247 0           ,pout_datap += __tinc0_9
4248 0           ,info_datap += __tinc0_10
4249             )
4250             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4251             {PDL_COMMENT("Open m") register PDL_Indx m;
4252 0 0         for(m=0; m<(__m_size); m++) {
4253 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
4254             }} PDL_COMMENT("Close m")
4255 0           iopts = iopts_datap;
4256 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
4257 0           else pcovar = NULL;
4258             if ( 0 == 1 ) pwork = NULL;
4259 0           else pwork = work_datap;
4260 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
4261 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_dif (
4262             tsfuncn ,
4263 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, NULL,
4264             maxits, opts_datap, info_datap, pwork, pcovar, dat);
4265             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
4266            
4267             PDL_COMMENT("THREADLOOPEND")
4268             }
4269             }
4270 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4271 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4272 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4273 0           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4274 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
4275 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
4276 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
4277 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
4278 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
4279 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
4280 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
4281 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4282            
4283 0           } } break; case PDL_D: {
4284 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4285 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4286              
4287 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4288 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
4289              
4290 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4291 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4292              
4293 0 0         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4294 0           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4295              
4296 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4297 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4298              
4299 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
4300 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
4301              
4302 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
4303 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
4304              
4305 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
4306 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
4307              
4308 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
4309 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
4310              
4311 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
4312 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
4313              
4314 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
4315 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
4316              
4317 0           {register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
4318 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
4319 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
4320 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
4321 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
4322 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
4323 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
4324 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
4325 0           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
4326 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
4327 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
4328              
4329              
4330             int * iopts;
4331             int maxits;
4332 0           void * tfuncn = (void *) __privtrans->funcn;
4333 0           void * tsfuncn = (void *) __privtrans->sfuncn;
4334             PDL_Double * pcovar;
4335             PDL_Double * pwork;
4336             ;
4337 0           DFP *dat = (void *) __privtrans->indat;
4338 0           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
4339 0           __privtrans->__nt_size, t_datap );
4340            
4341             PDL_COMMENT("THREADLOOPBEGIN")
4342 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4343 0           do { register PDL_Indx __tind1=0,__tind2=0;
4344 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4345 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4346 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4347 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4348 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4349 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4350 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4351 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4352 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
4353 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
4354 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
4355 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
4356 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
4357 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
4358 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
4359 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4360 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4361 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4362 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4363 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
4364 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
4365 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
4366 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
4367 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
4368 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
4369 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
4370 0           p_datap += __offsp[0];
4371 0           x_datap += __offsp[1];
4372 0           t_datap += __offsp[2];
4373 0           lb_datap += __offsp[3];
4374 0           iopts_datap += __offsp[4];
4375 0           opts_datap += __offsp[5];
4376 0           work_datap += __offsp[6];
4377 0           covar_datap += __offsp[7];
4378 0           returnval_datap += __offsp[8];
4379 0           pout_datap += __offsp[9];
4380 0           info_datap += __offsp[10];
4381 0 0         for( __tind2 = 0 ;
4382             __tind2 < __tdims1 ;
4383 0           __tind2++
4384 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
4385 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
4386 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
4387 0           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
4388 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
4389 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
4390 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
4391 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
4392 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
4393 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
4394 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
4395             )
4396             {
4397 0 0         for( __tind1 = 0 ;
4398             __tind1 < __tdims0 ;
4399 0           __tind1++
4400 0           ,p_datap += __tinc0_0
4401 0           ,x_datap += __tinc0_1
4402 0           ,t_datap += __tinc0_2
4403 0           ,lb_datap += __tinc0_3
4404 0           ,iopts_datap += __tinc0_4
4405 0           ,opts_datap += __tinc0_5
4406 0           ,work_datap += __tinc0_6
4407 0           ,covar_datap += __tinc0_7
4408 0           ,returnval_datap += __tinc0_8
4409 0           ,pout_datap += __tinc0_9
4410 0           ,info_datap += __tinc0_10
4411             )
4412             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4413             {PDL_COMMENT("Open m") register PDL_Indx m;
4414 0 0         for(m=0; m<(__m_size); m++) {
4415 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
4416             }} PDL_COMMENT("Close m")
4417 0           iopts = iopts_datap;
4418 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
4419 0           else pcovar = NULL;
4420             if ( 0 == 1 ) pwork = NULL;
4421 0           else pwork = work_datap;
4422 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
4423 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_dif (
4424             tfuncn ,
4425 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, NULL,
4426             maxits, opts_datap, info_datap, pwork, pcovar, dat);
4427             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
4428            
4429             PDL_COMMENT("THREADLOOPEND")
4430             }
4431             }
4432 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4433 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4434 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4435 0           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4436 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
4437 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
4438 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
4439 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
4440 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
4441 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
4442 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
4443 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4444            
4445 0           } break;}
4446 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
4447             }
4448             }
4449             }
4450            
4451              
4452              
4453              
4454 0           void pdl_levmar_diff_lb_free(pdl_trans *__tr ) {
4455             int __dim;
4456 0           pdl_levmar_diff_lb_struct *__privtrans = (pdl_levmar_diff_lb_struct *) __tr;
4457            
4458             {
4459            
4460 0           PDL_TR_CLRMAGIC(__privtrans);
4461             ;;;;
4462 0 0         if(__privtrans->__ddone) {
4463 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
4464             ;;;;;;;;;;;;;;;;;;;
4465             }
4466            
4467             }
4468 0           }
4469            
4470              
4471              
4472              
4473             static char pdl_levmar_diff_lb_vtable_flags[] =
4474             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
4475             pdl_transvtable pdl_levmar_diff_lb_vtable = {
4476             0,0, 6, 11, pdl_levmar_diff_lb_vtable_flags,
4477             pdl_levmar_diff_lb_redodims, pdl_levmar_diff_lb_readdata, NULL,
4478             pdl_levmar_diff_lb_free,NULL,NULL,pdl_levmar_diff_lb_copy,
4479             sizeof(pdl_levmar_diff_lb_struct),"pdl_levmar_diff_lb_vtable"
4480             };
4481              
4482             typedef struct pdl_levmar_diff_lb_ub_struct {
4483             PDL_TRANS_START(12);
4484             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_lb_m;PDL_Indx __inc_ub_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __n_size;PDL_Indx __in_size;PDL_Indx __nopt_size;PDL_Indx __wn_size;PDL_Indx __m_size;PDL_Indx __q_size;PDL_Indx __nt_size;
4485             IV funcn;IV sfuncn;IV indat;int want_covar;
4486             char __ddone; PDL_COMMENT("Dims done")
4487             } pdl_levmar_diff_lb_ub_struct;
4488              
4489 5           void pdl_levmar_diff_lb_ub_redodims(pdl_trans *__tr ) {
4490             int __dim;
4491 5           pdl_levmar_diff_lb_ub_struct *__privtrans = (pdl_levmar_diff_lb_ub_struct *) __tr;
4492            
4493             {
4494             PDL_Indx __creating[12];
4495 5           __privtrans->__n_size = -1;
4496 5           __privtrans->__in_size = -1;
4497 5           __privtrans->__nopt_size = -1;
4498 5           __privtrans->__wn_size = -1;
4499 5           __privtrans->__m_size = -1;
4500 5           __privtrans->__q_size = 10;
4501 5           __privtrans->__nt_size = -1;
4502 5           __creating[0] = 0;
4503 5           __creating[1] = 0;
4504 5           __creating[2] = 0;
4505 5           __creating[3] = 0;
4506 5           __creating[4] = 0;
4507 5           __creating[5] = 0;
4508 5           __creating[6] = 0;
4509 5 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
4510 5 50         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    50          
4511 5 50         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    50          
4512 5 50         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    50          
4513 5 50         __creating[11] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[11]);
    50          
4514             {
4515             {PDL_COMMENT("Start generic loop")
4516              
4517 5           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
4518 0           } break; case PDL_F: {
4519 2 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4520 2           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
4521              
4522 2 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4523 2           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
4524              
4525 2 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4526 2           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
4527              
4528 2 50         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4529 2           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
4530              
4531 2 50         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4532 2           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
4533              
4534 2 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
4535 2           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
4536              
4537 2 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
4538 2           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
4539              
4540 2 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
4541 2           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
4542              
4543 2 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
4544 2           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
4545              
4546 2 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
4547 2           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
4548              
4549 2 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
4550 2           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
4551              
4552 2 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
4553 2           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[11])->data));
4554              
4555 2           {register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
4556 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
4557 2           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
4558 2           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
4559 2           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
4560 2           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
4561 2           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
4562 2           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
4563 2           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
4564 2           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
4565 2           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
4566 2           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
4567              
4568              
4569 2           int im = __privtrans->pdls[0]->dims[0];
4570 2           int in = __privtrans->pdls[1]->dims[0];
4571 2           int min = 4*in + 4*im + in*im + im*im;
4572 2           int inw = __privtrans->pdls[7]->dims[0];
4573 2           __privtrans->__wn_size = inw >= min ? inw : min;
4574            
4575 2           } } break; case PDL_D: {
4576 3 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4577 3           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4578              
4579 3 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4580 3           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
4581              
4582 3 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4583 3           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4584              
4585 3 50         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4586 3           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4587              
4588 3 50         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4589 3           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
4590              
4591 3 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
4592 3           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
4593              
4594 3 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
4595 3           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
4596              
4597 3 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
4598 3           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
4599              
4600 3 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
4601 3           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
4602              
4603 3 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
4604 3           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
4605              
4606 3 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
4607 3           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
4608              
4609 3 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
4610 3           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[11])->data));
4611              
4612 3           {register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
4613 3           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
4614 3           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
4615 3           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
4616 3           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
4617 3           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
4618 3           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
4619 3           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
4620 3           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
4621 3           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
4622 3           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
4623 3           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
4624              
4625              
4626 3           int im = __privtrans->pdls[0]->dims[0];
4627 3           int in = __privtrans->pdls[1]->dims[0];
4628 3           int min = 4*in + 4*im + in*im + im*im;
4629 3           int inw = __privtrans->pdls[7]->dims[0];
4630 3           __privtrans->__wn_size = inw >= min ? inw : min;
4631            
4632 3           } break;}
4633 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
4634             }
4635             }
4636             {
4637             static char *__parnames[] = {"p","x","t","lb","ub","iopts","opts","work","covar","returnval","pout","info"};
4638             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,1,2,0,1,1};
4639             static char __funcname[] = "PDL::Fit::Levmar::levmar_diff_lb_ub";
4640             static pdl_errorinfo __einfo = {
4641             __funcname, __parnames, 12
4642             };
4643            
4644 5           PDL->initthreadstruct(2,__privtrans->pdls,
4645             __realdims,__creating,12,
4646             &__einfo,&(__privtrans->__pdlthread),
4647 5           __privtrans->vtable->per_pdl_flags,
4648             0 );
4649             }
4650 5 50         if(((__privtrans->pdls[0]))->ndims < 1) {
4651 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4652             }
4653 5 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
4654 5           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
4655 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
4656 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
4657 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4658             }
4659             }
4660 5 50         if(((__privtrans->pdls[1]))->ndims < 1) {
4661 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
4662             }
4663 5 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
4664 5           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
4665 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
4666 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
4667 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4668             }
4669             }
4670 5           PDL->make_physical(((__privtrans->pdls[1])));
4671 5 50         if(((__privtrans->pdls[2]))->ndims < 1) {
4672 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
4673             }
4674 5 50         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
4675 5           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
4676 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
4677 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
4678 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4679             }
4680             }
4681 5           PDL->make_physical(((__privtrans->pdls[2])));
4682 5 50         if(((__privtrans->pdls[3]))->ndims < 1) {
4683 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4684             }
4685 5 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    50          
    50          
4686 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
4687 5 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    50          
4688 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
4689 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4690             }
4691             }
4692 5           PDL->make_physical(((__privtrans->pdls[3])));
4693 5 50         if(((__privtrans->pdls[4]))->ndims < 1) {
4694 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4695             }
4696 5 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__m_size == 1)) {
    50          
    50          
4697 0           __privtrans->__m_size = ((__privtrans->pdls[4]))->dims[0];
4698 5 50         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[4]))->dims[0]) {
    50          
4699 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
4700 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4701             }
4702             }
4703 5           PDL->make_physical(((__privtrans->pdls[4])));
4704 5 50         if(((__privtrans->pdls[5]))->ndims < 1) {
4705 5 50         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    50          
4706             }
4707 5 50         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__in_size == 1)) {
    50          
    0          
4708 0           __privtrans->__in_size = ((__privtrans->pdls[5]))->dims[0];
4709 5 50         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
4710 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
4711 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4712             }
4713             }
4714 5           PDL->make_physical(((__privtrans->pdls[5])));
4715 5 50         if(((__privtrans->pdls[6]))->ndims < 1) {
4716 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
4717             }
4718 5 50         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
4719 5           __privtrans->__nopt_size = ((__privtrans->pdls[6]))->dims[0];
4720 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
4721 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
4722 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4723             }
4724             }
4725 5           PDL->make_physical(((__privtrans->pdls[6])));
4726 5 50         if(!__creating[7]) {
4727 0 0         if(((__privtrans->pdls[7]))->ndims < 1) {
4728 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
4729             }
4730 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
4731 0           __privtrans->__wn_size = ((__privtrans->pdls[7]))->dims[0];
4732 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
4733 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
4734 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4735             }
4736             }
4737 0           PDL->make_physical(((__privtrans->pdls[7])));
4738             } else {
4739 5           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
4740 5           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,1);
4741 5 50         }if(!__creating[8]) {
4742 0 0         if(((__privtrans->pdls[8]))->ndims < 2) {
4743 0 0         if (((__privtrans->pdls[8]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4744 0 0         if (((__privtrans->pdls[8]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4745             }
4746 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
4747 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[0];
4748 0 0         } else if(((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[0]) {
    0          
4749 0 0         if(((__privtrans->pdls[8]))->dims[0] != 1) {
4750 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4751             }
4752             }
4753 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
4754 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[1];
4755 0 0         } else if(((__privtrans->pdls[8]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[1]) {
    0          
4756 0 0         if(((__privtrans->pdls[8]))->dims[1] != 1) {
4757 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4758             }
4759             }
4760 0           PDL->make_physical(((__privtrans->pdls[8])));
4761             } else {
4762 5           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
4763 5           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
4764 5 50         }if(!__creating[9]) {
4765             } else {
4766             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
4767 5           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
4768 5 50         }if(!__creating[10]) {
4769 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
4770 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
4771             }
4772 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
4773 0           __privtrans->__m_size = ((__privtrans->pdls[10]))->dims[0];
4774 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
4775 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
4776 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4777             }
4778             }
4779 0           PDL->make_physical(((__privtrans->pdls[10])));
4780             } else {
4781 5           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
4782 5           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
4783 5 50         }if(!__creating[11]) {
4784 0 0         if(((__privtrans->pdls[11]))->ndims < 1) {
4785 0 0         if (((__privtrans->pdls[11]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
4786             }
4787 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[11]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
4788 0           __privtrans->__q_size = ((__privtrans->pdls[11]))->dims[0];
4789 0 0         } else if(((__privtrans->pdls[11]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[11]))->dims[0]) {
    0          
4790 0 0         if(((__privtrans->pdls[11]))->dims[0] != 1) {
4791 0           PDL->pdl_barf("Error in levmar_diff_lb_ub:" "Wrong dims\n");
4792             }
4793             }
4794 0           PDL->make_physical(((__privtrans->pdls[11])));
4795             } else {
4796 5           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
4797 5           PDL->thread_create_parameter(&__privtrans->__pdlthread,11,dims,0);
4798             }
4799             { PDL_COMMENT("convenience block")
4800 5           void *hdrp = NULL;
4801 5           char propagate_hdrcpy = 0;
4802 5           SV *hdr_copy = NULL;
4803 5 50         if(!hdrp &&
    50          
4804 0 0         __privtrans->pdls[0]->hdrsv &&
4805 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
4806             ) {
4807 0           hdrp = __privtrans->pdls[0]->hdrsv;
4808 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
4809             }
4810 5 50         if(!hdrp &&
    50          
4811 0 0         __privtrans->pdls[1]->hdrsv &&
4812 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
4813             ) {
4814 0           hdrp = __privtrans->pdls[1]->hdrsv;
4815 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
4816             }
4817 5 50         if(!hdrp &&
    50          
4818 0 0         __privtrans->pdls[2]->hdrsv &&
4819 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
4820             ) {
4821 0           hdrp = __privtrans->pdls[2]->hdrsv;
4822 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
4823             }
4824 5 50         if(!hdrp &&
    50          
4825 0 0         __privtrans->pdls[3]->hdrsv &&
4826 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
4827             ) {
4828 0           hdrp = __privtrans->pdls[3]->hdrsv;
4829 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
4830             }
4831 5 50         if(!hdrp &&
    50          
4832 0 0         __privtrans->pdls[4]->hdrsv &&
4833 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
4834             ) {
4835 0           hdrp = __privtrans->pdls[4]->hdrsv;
4836 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
4837             }
4838 5 50         if(!hdrp &&
    50          
4839 0 0         __privtrans->pdls[5]->hdrsv &&
4840 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
4841             ) {
4842 0           hdrp = __privtrans->pdls[5]->hdrsv;
4843 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
4844             }
4845 5 50         if(!hdrp &&
    50          
4846 0 0         __privtrans->pdls[6]->hdrsv &&
4847 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
4848             ) {
4849 0           hdrp = __privtrans->pdls[6]->hdrsv;
4850 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
4851             }
4852 5 50         if(!hdrp &&
    50          
4853 0 0         !__creating[7] &&
4854 0 0         __privtrans->pdls[7]->hdrsv &&
4855 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
4856             ) {
4857 0           hdrp = __privtrans->pdls[7]->hdrsv;
4858 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
4859             }
4860 5 50         if(!hdrp &&
    50          
4861 0 0         !__creating[8] &&
4862 0 0         __privtrans->pdls[8]->hdrsv &&
4863 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
4864             ) {
4865 0           hdrp = __privtrans->pdls[8]->hdrsv;
4866 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
4867             }
4868 5 50         if(!hdrp &&
    50          
4869 0 0         !__creating[9] &&
4870 0 0         __privtrans->pdls[9]->hdrsv &&
4871 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
4872             ) {
4873 0           hdrp = __privtrans->pdls[9]->hdrsv;
4874 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
4875             }
4876 5 50         if(!hdrp &&
    50          
4877 0 0         !__creating[10] &&
4878 0 0         __privtrans->pdls[10]->hdrsv &&
4879 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
4880             ) {
4881 0           hdrp = __privtrans->pdls[10]->hdrsv;
4882 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
4883             }
4884 5 50         if(!hdrp &&
    50          
4885 0 0         !__creating[11] &&
4886 0 0         __privtrans->pdls[11]->hdrsv &&
4887 0           (__privtrans->pdls[11]->state & PDL_HDRCPY)
4888             ) {
4889 0           hdrp = __privtrans->pdls[11]->hdrsv;
4890 0           propagate_hdrcpy = ((__privtrans->pdls[11]->state & PDL_HDRCPY) != 0);
4891             }
4892 5 50         if (hdrp) {
4893 0 0         if(hdrp == &PL_sv_undef)
4894 0           hdr_copy = &PL_sv_undef;
4895             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
4896             int count;
4897             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
4898 0           dSP;
4899 0           ENTER ;
4900 0           SAVETMPS ;
4901 0 0         PUSHMARK(SP) ;
4902 0 0         XPUSHs( hdrp );
4903 0           PUTBACK ;
4904 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
4905 0           SPAGAIN ;
4906 0 0         if(count != 1)
4907 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
4908              
4909 0           hdr_copy = (SV *)POPs;
4910              
4911 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
4912 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
4913             }
4914              
4915 0 0         FREETMPS ;
4916 0           LEAVE ;
4917              
4918              
4919             } PDL_COMMENT("end of callback block")
4920              
4921 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
4922 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
4923 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
4924 0 0         if( hdr_copy != &PL_sv_undef )
4925 0           (void)SvREFCNT_inc(hdr_copy);
4926 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
4927             }
4928 0 0         if(propagate_hdrcpy)
4929 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
4930 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
4931 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
4932 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
4933 0 0         if( hdr_copy != &PL_sv_undef )
4934 0           (void)SvREFCNT_inc(hdr_copy);
4935 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
4936             }
4937 0 0         if(propagate_hdrcpy)
4938 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
4939 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
4940 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
4941 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
4942 0 0         if( hdr_copy != &PL_sv_undef )
4943 0           (void)SvREFCNT_inc(hdr_copy);
4944 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
4945             }
4946 0 0         if(propagate_hdrcpy)
4947 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
4948 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
4949 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
4950 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
4951 0 0         if( hdr_copy != &PL_sv_undef )
4952 0           (void)SvREFCNT_inc(hdr_copy);
4953 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
4954             }
4955 0 0         if(propagate_hdrcpy)
4956 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
4957 0 0         if ( __privtrans->pdls[11]->hdrsv != hdrp ){
4958 0 0         if( __privtrans->pdls[11]->hdrsv && __privtrans->pdls[11]->hdrsv != &PL_sv_undef)
    0          
4959 0           (void)SvREFCNT_dec( __privtrans->pdls[11]->hdrsv );
4960 0 0         if( hdr_copy != &PL_sv_undef )
4961 0           (void)SvREFCNT_inc(hdr_copy);
4962 0           __privtrans->pdls[11]->hdrsv = hdr_copy;
4963             }
4964 0 0         if(propagate_hdrcpy)
4965 0           __privtrans->pdls[11]->state |= PDL_HDRCPY;
4966              
4967 0 0         if(hdr_copy != &PL_sv_undef)
4968 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
4969             } PDL_COMMENT("end of if(hdrp) block")
4970             } PDL_COMMENT("end of conv. block")
4971 5 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
4972 0           __privtrans->__inc_p_m = 0; else
4973 5 50         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
4974 0           __privtrans->__inc_x_n = 0; else
4975 5 50         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    100          
4976 4           __privtrans->__inc_t_nt = 0; else
4977 5 50         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
4978 0           __privtrans->__inc_lb_m = 0; else
4979 5 50         __privtrans->__inc_lb_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
4980 0           __privtrans->__inc_ub_m = 0; else
4981 5 50         __privtrans->__inc_ub_m = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
4982 5           __privtrans->__inc_iopts_in = 0; else
4983 5 50         __privtrans->__inc_iopts_in = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    50          
4984 0           __privtrans->__inc_opts_nopt = 0; else
4985 5 50         __privtrans->__inc_opts_nopt = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    50          
4986 0           __privtrans->__inc_work_wn = 0; else
4987 5 50         __privtrans->__inc_work_wn = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[8]->ndims <= 0 || __privtrans->pdls[8]->dims[0] <= 1)
    50          
4988 0           __privtrans->__inc_covar_m0 = 0; else
4989 5 50         __privtrans->__inc_covar_m0 = __privtrans->pdls[8]->dimincs[0];if(__privtrans->pdls[8]->ndims <= 1 || __privtrans->pdls[8]->dims[1] <= 1)
    50          
4990 0           __privtrans->__inc_covar_m1 = 0; else
4991 5 50         __privtrans->__inc_covar_m1 = __privtrans->pdls[8]->dimincs[1];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    50          
4992 0           __privtrans->__inc_pout_m = 0; else
4993 5 50         __privtrans->__inc_pout_m = __privtrans->pdls[10]->dimincs[0];if(__privtrans->pdls[11]->ndims <= 0 || __privtrans->pdls[11]->dims[0] <= 1)
    50          
4994 0           __privtrans->__inc_info_q = 0; else
4995 5           __privtrans->__inc_info_q = __privtrans->pdls[11]->dimincs[0]; __privtrans->__ddone = 1;
4996             }
4997 5           }
4998            
4999              
5000 0           pdl_trans * pdl_levmar_diff_lb_ub_copy(pdl_trans *__tr ) {
5001             int __dim;
5002 0           pdl_levmar_diff_lb_ub_struct *__privtrans = (pdl_levmar_diff_lb_ub_struct *) __tr;
5003            
5004             {
5005 0           pdl_levmar_diff_lb_ub_struct *__copy = malloc(sizeof(pdl_levmar_diff_lb_ub_struct));
5006 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
5007 0           __copy->has_badvalue = __privtrans->has_badvalue;
5008 0           __copy->badvalue = __privtrans->badvalue;
5009 0           __copy->flags = __privtrans->flags;
5010 0           __copy->vtable = __privtrans->vtable;
5011 0           __copy->__datatype = __privtrans->__datatype;
5012 0           __copy->freeproc = NULL;
5013 0           __copy->__ddone = __privtrans->__ddone;
5014             {int i;
5015 0 0         for(i=0; i<__copy->vtable->npdls; i++)
5016 0           __copy->pdls[i] = __privtrans->pdls[i];
5017             }
5018 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
5019 0 0         if(__copy->__ddone) {
5020 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_lb_m=__copy->__inc_lb_m;__privtrans->__inc_ub_m=__copy->__inc_ub_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__n_size=__privtrans->__n_size;__copy->__in_size=__privtrans->__in_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__m_size=__privtrans->__m_size;__copy->__q_size=__privtrans->__q_size;__copy->__nt_size=__privtrans->__nt_size;
5021             }
5022 0           return (pdl_trans*)__copy;
5023             }
5024             }
5025            
5026              
5027 5           void pdl_levmar_diff_lb_ub_readdata(pdl_trans *__tr ) {
5028             int __dim;
5029 5           pdl_levmar_diff_lb_ub_struct *__privtrans = (pdl_levmar_diff_lb_ub_struct *) __tr;
5030            
5031             {
5032 5           {register PDL_Indx __m_size = __privtrans->__m_size;
5033             PDL_COMMENT("Start generic loop")
5034              
5035 5           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
5036 0           } break; case PDL_F: {
5037 2 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5038 2           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
5039              
5040 2 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5041 2           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
5042              
5043 2 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5044 2           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
5045              
5046 2 50         PDL_Float * lb_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5047 2           PDL_Float * lb_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
5048              
5049 2 50         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5050 2           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
5051              
5052 2 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
5053 2           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
5054              
5055 2 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
5056 2           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
5057              
5058 2 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
5059 2           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
5060              
5061 2 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
5062 2           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
5063              
5064 2 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
5065 2           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
5066              
5067 2 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
5068 2           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
5069              
5070 2 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
5071 2           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[11])->data));
5072              
5073 2           {register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
5074 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
5075 2           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
5076 2           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
5077 2           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
5078 2           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
5079 2           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
5080 2           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
5081 2           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
5082 2           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
5083 2           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
5084 2           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
5085              
5086              
5087             int * iopts;
5088             int maxits;
5089 2           void * tfuncn = (void *) __privtrans->funcn;
5090 2           void * tsfuncn = (void *) __privtrans->sfuncn;
5091             PDL_Float * pcovar;
5092             PDL_Float * pwork;
5093             ;
5094 2           DFP *dat = (void *) __privtrans->indat;
5095 2           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
5096 2           __privtrans->__nt_size, t_datap );
5097            
5098             PDL_COMMENT("THREADLOOPBEGIN")
5099 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5100 2           do { register PDL_Indx __tind1=0,__tind2=0;
5101 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5102 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5103 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5104 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5105 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5106 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5107 2           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5108 2           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5109 2           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5110 2           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
5111 2           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
5112 2           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
5113 2           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
5114 2           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
5115 2           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
5116 2           register PDL_Indx __tinc0_11 = __privtrans->__pdlthread.incs[11];
5117 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5118 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5119 2           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5120 2           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5121 2           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5122 2           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
5123 2           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
5124 2           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
5125 2           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
5126 2           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
5127 2           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
5128 2           register PDL_Indx __tinc1_11 = __privtrans->__pdlthread.incs[__tnpdls+11];
5129 2           p_datap += __offsp[0];
5130 2           x_datap += __offsp[1];
5131 2           t_datap += __offsp[2];
5132 2           lb_datap += __offsp[3];
5133 2           ub_datap += __offsp[4];
5134 2           iopts_datap += __offsp[5];
5135 2           opts_datap += __offsp[6];
5136 2           work_datap += __offsp[7];
5137 2           covar_datap += __offsp[8];
5138 2           returnval_datap += __offsp[9];
5139 2           pout_datap += __offsp[10];
5140 2           info_datap += __offsp[11];
5141 4 100         for( __tind2 = 0 ;
5142             __tind2 < __tdims1 ;
5143 2           __tind2++
5144 2           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
5145 2           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
5146 2           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
5147 2           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
5148 2           ,ub_datap += __tinc1_4 - __tinc0_4 * __tdims0
5149 2           ,iopts_datap += __tinc1_5 - __tinc0_5 * __tdims0
5150 2           ,opts_datap += __tinc1_6 - __tinc0_6 * __tdims0
5151 2           ,work_datap += __tinc1_7 - __tinc0_7 * __tdims0
5152 2           ,covar_datap += __tinc1_8 - __tinc0_8 * __tdims0
5153 2           ,returnval_datap += __tinc1_9 - __tinc0_9 * __tdims0
5154 2           ,pout_datap += __tinc1_10 - __tinc0_10 * __tdims0
5155 2           ,info_datap += __tinc1_11 - __tinc0_11 * __tdims0
5156             )
5157             {
5158 4 100         for( __tind1 = 0 ;
5159             __tind1 < __tdims0 ;
5160 2           __tind1++
5161 2           ,p_datap += __tinc0_0
5162 2           ,x_datap += __tinc0_1
5163 2           ,t_datap += __tinc0_2
5164 2           ,lb_datap += __tinc0_3
5165 2           ,ub_datap += __tinc0_4
5166 2           ,iopts_datap += __tinc0_5
5167 2           ,opts_datap += __tinc0_6
5168 2           ,work_datap += __tinc0_7
5169 2           ,covar_datap += __tinc0_8
5170 2           ,returnval_datap += __tinc0_9
5171 2           ,pout_datap += __tinc0_10
5172 2           ,info_datap += __tinc0_11
5173             )
5174             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5175             {PDL_COMMENT("Open m") register PDL_Indx m;
5176 10 100         for(m=0; m<(__m_size); m++) {
5177 8 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
5178             }} PDL_COMMENT("Close m")
5179 2           iopts = iopts_datap;
5180 2 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
5181 2           else pcovar = NULL;
5182             if ( 0 == 1 ) pwork = NULL;
5183 2           else pwork = work_datap;
5184 2           maxits = iopts[0]; /* for clarity. we hope optimized away */
5185 2           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_dif (
5186             tsfuncn ,
5187 4           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, ub_datap,
5188             maxits, opts_datap, info_datap, pwork, pcovar, dat);
5189             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
5190            
5191             PDL_COMMENT("THREADLOOPEND")
5192             }
5193             }
5194 2           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5195 2           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5196 2           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5197 2           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5198 2           ub_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5199 2           iopts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
5200 2           opts_datap -= __tinc1_6 * __tdims1 + __offsp[6];
5201 2           work_datap -= __tinc1_7 * __tdims1 + __offsp[7];
5202 2           covar_datap -= __tinc1_8 * __tdims1 + __offsp[8];
5203 2           returnval_datap -= __tinc1_9 * __tdims1 + __offsp[9];
5204 2           pout_datap -= __tinc1_10 * __tdims1 + __offsp[10];
5205 2           info_datap -= __tinc1_11 * __tdims1 + __offsp[11];
5206 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5207            
5208 2           } } break; case PDL_D: {
5209 3 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5210 3           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5211              
5212 3 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5213 3           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
5214              
5215 3 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5216 3           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
5217              
5218 3 50         PDL_Double * lb_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5219 3           PDL_Double * lb_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5220              
5221 3 50         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5222 3           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
5223              
5224 3 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
5225 3           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
5226              
5227 3 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
5228 3           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
5229              
5230 3 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
5231 3           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
5232              
5233 3 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
5234 3           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
5235              
5236 3 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
5237 3           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[9])->data));
5238              
5239 3 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
5240 3           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
5241              
5242 3 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[11]),(__privtrans->vtable->per_pdl_flags[11]))));
    0          
5243 3           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[11])->data));
5244              
5245 3           {register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
5246 3           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
5247 3           register PDL_Indx __inc_lb_m = __privtrans->__inc_lb_m;
5248 3           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
5249 3           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
5250 3           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
5251 3           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
5252 3           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
5253 3           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
5254 3           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
5255 3           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
5256 3           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
5257              
5258              
5259             int * iopts;
5260             int maxits;
5261 3           void * tfuncn = (void *) __privtrans->funcn;
5262 3           void * tsfuncn = (void *) __privtrans->sfuncn;
5263             PDL_Double * pcovar;
5264             PDL_Double * pwork;
5265             ;
5266 3           DFP *dat = (void *) __privtrans->indat;
5267 3           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
5268 3           __privtrans->__nt_size, t_datap );
5269            
5270             PDL_COMMENT("THREADLOOPBEGIN")
5271 3 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5272 3           do { register PDL_Indx __tind1=0,__tind2=0;
5273 3           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5274 3           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5275 3           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5276 3           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5277 3           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5278 3           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5279 3           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5280 3           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5281 3           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5282 3           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
5283 3           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
5284 3           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
5285 3           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
5286 3           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
5287 3           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
5288 3           register PDL_Indx __tinc0_11 = __privtrans->__pdlthread.incs[11];
5289 3           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5290 3           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5291 3           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5292 3           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5293 3           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5294 3           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
5295 3           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
5296 3           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
5297 3           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
5298 3           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
5299 3           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
5300 3           register PDL_Indx __tinc1_11 = __privtrans->__pdlthread.incs[__tnpdls+11];
5301 3           p_datap += __offsp[0];
5302 3           x_datap += __offsp[1];
5303 3           t_datap += __offsp[2];
5304 3           lb_datap += __offsp[3];
5305 3           ub_datap += __offsp[4];
5306 3           iopts_datap += __offsp[5];
5307 3           opts_datap += __offsp[6];
5308 3           work_datap += __offsp[7];
5309 3           covar_datap += __offsp[8];
5310 3           returnval_datap += __offsp[9];
5311 3           pout_datap += __offsp[10];
5312 3           info_datap += __offsp[11];
5313 6 100         for( __tind2 = 0 ;
5314             __tind2 < __tdims1 ;
5315 3           __tind2++
5316 3           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
5317 3           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
5318 3           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
5319 3           ,lb_datap += __tinc1_3 - __tinc0_3 * __tdims0
5320 3           ,ub_datap += __tinc1_4 - __tinc0_4 * __tdims0
5321 3           ,iopts_datap += __tinc1_5 - __tinc0_5 * __tdims0
5322 3           ,opts_datap += __tinc1_6 - __tinc0_6 * __tdims0
5323 3           ,work_datap += __tinc1_7 - __tinc0_7 * __tdims0
5324 3           ,covar_datap += __tinc1_8 - __tinc0_8 * __tdims0
5325 3           ,returnval_datap += __tinc1_9 - __tinc0_9 * __tdims0
5326 3           ,pout_datap += __tinc1_10 - __tinc0_10 * __tdims0
5327 3           ,info_datap += __tinc1_11 - __tinc0_11 * __tdims0
5328             )
5329             {
5330 6 100         for( __tind1 = 0 ;
5331             __tind1 < __tdims0 ;
5332 3           __tind1++
5333 3           ,p_datap += __tinc0_0
5334 3           ,x_datap += __tinc0_1
5335 3           ,t_datap += __tinc0_2
5336 3           ,lb_datap += __tinc0_3
5337 3           ,ub_datap += __tinc0_4
5338 3           ,iopts_datap += __tinc0_5
5339 3           ,opts_datap += __tinc0_6
5340 3           ,work_datap += __tinc0_7
5341 3           ,covar_datap += __tinc0_8
5342 3           ,returnval_datap += __tinc0_9
5343 3           ,pout_datap += __tinc0_10
5344 3           ,info_datap += __tinc0_11
5345             )
5346             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5347             {PDL_COMMENT("Open m") register PDL_Indx m;
5348 14 100         for(m=0; m<(__m_size); m++) {
5349 11 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
5350             }} PDL_COMMENT("Close m")
5351 3           iopts = iopts_datap;
5352 3 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
5353 3           else pcovar = NULL;
5354             if ( 0 == 1 ) pwork = NULL;
5355 3           else pwork = work_datap;
5356 3           maxits = iopts[0]; /* for clarity. we hope optimized away */
5357 3           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_dif (
5358             tfuncn ,
5359 6           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, lb_datap, ub_datap,
5360             maxits, opts_datap, info_datap, pwork, pcovar, dat);
5361             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
5362            
5363             PDL_COMMENT("THREADLOOPEND")
5364             }
5365             }
5366 3           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5367 3           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5368 3           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5369 3           lb_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5370 3           ub_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5371 3           iopts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
5372 3           opts_datap -= __tinc1_6 * __tdims1 + __offsp[6];
5373 3           work_datap -= __tinc1_7 * __tdims1 + __offsp[7];
5374 3           covar_datap -= __tinc1_8 * __tdims1 + __offsp[8];
5375 3           returnval_datap -= __tinc1_9 * __tdims1 + __offsp[9];
5376 3           pout_datap -= __tinc1_10 * __tdims1 + __offsp[10];
5377 3           info_datap -= __tinc1_11 * __tdims1 + __offsp[11];
5378 3 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5379            
5380 3           } break;}
5381 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
5382             }
5383             }
5384             }
5385            
5386              
5387              
5388              
5389 5           void pdl_levmar_diff_lb_ub_free(pdl_trans *__tr ) {
5390             int __dim;
5391 5           pdl_levmar_diff_lb_ub_struct *__privtrans = (pdl_levmar_diff_lb_ub_struct *) __tr;
5392            
5393             {
5394            
5395 5           PDL_TR_CLRMAGIC(__privtrans);
5396             ;;;;
5397 5 50         if(__privtrans->__ddone) {
5398 5           PDL->freethreadloop(&(__privtrans->__pdlthread));
5399             ;;;;;;;;;;;;;;;;;;;;
5400             }
5401            
5402             }
5403 5           }
5404            
5405              
5406              
5407              
5408             static char pdl_levmar_diff_lb_ub_vtable_flags[] =
5409             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
5410             pdl_transvtable pdl_levmar_diff_lb_ub_vtable = {
5411             0,0, 7, 12, pdl_levmar_diff_lb_ub_vtable_flags,
5412             pdl_levmar_diff_lb_ub_redodims, pdl_levmar_diff_lb_ub_readdata, NULL,
5413             pdl_levmar_diff_lb_ub_free,NULL,NULL,pdl_levmar_diff_lb_ub_copy,
5414             sizeof(pdl_levmar_diff_lb_ub_struct),"pdl_levmar_diff_lb_ub_vtable"
5415             };
5416              
5417             typedef struct pdl_levmar_diff_ub_struct {
5418             PDL_TRANS_START(11);
5419             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_ub_m;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __nopt_size;PDL_Indx __q_size;PDL_Indx __n_size;PDL_Indx __nt_size;PDL_Indx __wn_size;PDL_Indx __m_size;PDL_Indx __in_size;
5420             IV funcn;IV sfuncn;IV indat;int want_covar;
5421             char __ddone; PDL_COMMENT("Dims done")
5422             } pdl_levmar_diff_ub_struct;
5423              
5424 0           void pdl_levmar_diff_ub_redodims(pdl_trans *__tr ) {
5425             int __dim;
5426 0           pdl_levmar_diff_ub_struct *__privtrans = (pdl_levmar_diff_ub_struct *) __tr;
5427            
5428             {
5429             PDL_Indx __creating[11];
5430 0           __privtrans->__nopt_size = -1;
5431 0           __privtrans->__q_size = 10;
5432 0           __privtrans->__n_size = -1;
5433 0           __privtrans->__nt_size = -1;
5434 0           __privtrans->__wn_size = -1;
5435 0           __privtrans->__m_size = -1;
5436 0           __privtrans->__in_size = -1;
5437 0           __creating[0] = 0;
5438 0           __creating[1] = 0;
5439 0           __creating[2] = 0;
5440 0           __creating[3] = 0;
5441 0           __creating[4] = 0;
5442 0           __creating[5] = 0;
5443 0 0         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
5444 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
5445 0 0         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    0          
5446 0 0         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    0          
5447 0 0         __creating[10] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[10]);
    0          
5448             {
5449             {PDL_COMMENT("Start generic loop")
5450              
5451 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
5452 0           } break; case PDL_F: {
5453 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5454 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
5455              
5456 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5457 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
5458              
5459 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5460 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
5461              
5462 0 0         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5463 0           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
5464              
5465 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5466 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5467              
5468 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
5469 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
5470              
5471 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
5472 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
5473              
5474 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
5475 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
5476              
5477 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
5478 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
5479              
5480 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
5481 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
5482              
5483 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
5484 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
5485              
5486 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
5487 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
5488 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
5489 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
5490 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
5491 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
5492 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
5493 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
5494 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
5495 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
5496 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
5497              
5498              
5499 0           int im = __privtrans->pdls[0]->dims[0];
5500 0           int in = __privtrans->pdls[1]->dims[0];
5501 0           int min = 4*in + 4*im + in*im + im*im;
5502 0           int inw = __privtrans->pdls[6]->dims[0];
5503 0           __privtrans->__wn_size = inw >= min ? inw : min;
5504            
5505 0           } } break; case PDL_D: {
5506 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5507 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5508              
5509 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5510 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
5511              
5512 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5513 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
5514              
5515 0 0         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5516 0           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5517              
5518 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5519 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5520              
5521 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
5522 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
5523              
5524 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
5525 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
5526              
5527 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
5528 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
5529              
5530 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
5531 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
5532              
5533 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
5534 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
5535              
5536 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
5537 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
5538              
5539 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
5540 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
5541 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
5542 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
5543 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
5544 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
5545 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
5546 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
5547 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
5548 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
5549 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
5550              
5551              
5552 0           int im = __privtrans->pdls[0]->dims[0];
5553 0           int in = __privtrans->pdls[1]->dims[0];
5554 0           int min = 4*in + 4*im + in*im + im*im;
5555 0           int inw = __privtrans->pdls[6]->dims[0];
5556 0           __privtrans->__wn_size = inw >= min ? inw : min;
5557            
5558 0           } break;}
5559 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
5560             }
5561             }
5562             {
5563             static char *__parnames[] = {"p","x","t","ub","iopts","opts","work","covar","returnval","pout","info"};
5564             static PDL_Indx __realdims[] = {1,1,1,1,1,1,1,2,0,1,1};
5565             static char __funcname[] = "PDL::Fit::Levmar::levmar_diff_ub";
5566             static pdl_errorinfo __einfo = {
5567             __funcname, __parnames, 11
5568             };
5569            
5570 0           PDL->initthreadstruct(2,__privtrans->pdls,
5571             __realdims,__creating,11,
5572             &__einfo,&(__privtrans->__pdlthread),
5573 0           __privtrans->vtable->per_pdl_flags,
5574             0 );
5575             }
5576 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
5577 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
5578             }
5579 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
5580 0           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
5581 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
5582 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
5583 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5584             }
5585             }
5586 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
5587 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
5588             }
5589 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
5590 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
5591 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
5592 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
5593 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5594             }
5595             }
5596 0           PDL->make_physical(((__privtrans->pdls[1])));
5597 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
5598 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
5599             }
5600 0 0         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
5601 0           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
5602 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
5603 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
5604 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5605             }
5606             }
5607 0           PDL->make_physical(((__privtrans->pdls[2])));
5608 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
5609 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
5610             }
5611 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
5612 0           __privtrans->__m_size = ((__privtrans->pdls[3]))->dims[0];
5613 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
5614 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
5615 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5616             }
5617             }
5618 0           PDL->make_physical(((__privtrans->pdls[3])));
5619 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
5620 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    0          
5621             }
5622 0 0         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size == 1)) {
    0          
    0          
5623 0           __privtrans->__in_size = ((__privtrans->pdls[4]))->dims[0];
5624 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
5625 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
5626 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5627             }
5628             }
5629 0           PDL->make_physical(((__privtrans->pdls[4])));
5630 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
5631 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
5632             }
5633 0 0         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
5634 0           __privtrans->__nopt_size = ((__privtrans->pdls[5]))->dims[0];
5635 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
5636 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
5637 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5638             }
5639             }
5640 0           PDL->make_physical(((__privtrans->pdls[5])));
5641 0 0         if(!__creating[6]) {
5642 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
5643 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
5644             }
5645 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
5646 0           __privtrans->__wn_size = ((__privtrans->pdls[6]))->dims[0];
5647 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
5648 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
5649 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5650             }
5651             }
5652 0           PDL->make_physical(((__privtrans->pdls[6])));
5653             } else {
5654 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
5655 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,1);
5656 0 0         }if(!__creating[7]) {
5657 0 0         if(((__privtrans->pdls[7]))->ndims < 2) {
5658 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
5659 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
5660             }
5661 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
5662 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[0];
5663 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
5664 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
5665 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5666             }
5667             }
5668 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
5669 0           __privtrans->__m_size = ((__privtrans->pdls[7]))->dims[1];
5670 0 0         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[7]))->dims[1]) {
    0          
5671 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
5672 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5673             }
5674             }
5675 0           PDL->make_physical(((__privtrans->pdls[7])));
5676             } else {
5677 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
5678 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
5679 0 0         }if(!__creating[8]) {
5680             } else {
5681             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
5682 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
5683 0 0         }if(!__creating[9]) {
5684 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
5685 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
5686             }
5687 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
5688 0           __privtrans->__m_size = ((__privtrans->pdls[9]))->dims[0];
5689 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
5690 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
5691 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5692             }
5693             }
5694 0           PDL->make_physical(((__privtrans->pdls[9])));
5695             } else {
5696 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
5697 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
5698 0 0         }if(!__creating[10]) {
5699 0 0         if(((__privtrans->pdls[10]))->ndims < 1) {
5700 0 0         if (((__privtrans->pdls[10]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
5701             }
5702 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
5703 0           __privtrans->__q_size = ((__privtrans->pdls[10]))->dims[0];
5704 0 0         } else if(((__privtrans->pdls[10]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[10]))->dims[0]) {
    0          
5705 0 0         if(((__privtrans->pdls[10]))->dims[0] != 1) {
5706 0           PDL->pdl_barf("Error in levmar_diff_ub:" "Wrong dims\n");
5707             }
5708             }
5709 0           PDL->make_physical(((__privtrans->pdls[10])));
5710             } else {
5711 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
5712 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,10,dims,0);
5713             }
5714             { PDL_COMMENT("convenience block")
5715 0           void *hdrp = NULL;
5716 0           char propagate_hdrcpy = 0;
5717 0           SV *hdr_copy = NULL;
5718 0 0         if(!hdrp &&
    0          
5719 0 0         __privtrans->pdls[0]->hdrsv &&
5720 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
5721             ) {
5722 0           hdrp = __privtrans->pdls[0]->hdrsv;
5723 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
5724             }
5725 0 0         if(!hdrp &&
    0          
5726 0 0         __privtrans->pdls[1]->hdrsv &&
5727 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
5728             ) {
5729 0           hdrp = __privtrans->pdls[1]->hdrsv;
5730 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
5731             }
5732 0 0         if(!hdrp &&
    0          
5733 0 0         __privtrans->pdls[2]->hdrsv &&
5734 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
5735             ) {
5736 0           hdrp = __privtrans->pdls[2]->hdrsv;
5737 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
5738             }
5739 0 0         if(!hdrp &&
    0          
5740 0 0         __privtrans->pdls[3]->hdrsv &&
5741 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
5742             ) {
5743 0           hdrp = __privtrans->pdls[3]->hdrsv;
5744 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
5745             }
5746 0 0         if(!hdrp &&
    0          
5747 0 0         __privtrans->pdls[4]->hdrsv &&
5748 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
5749             ) {
5750 0           hdrp = __privtrans->pdls[4]->hdrsv;
5751 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
5752             }
5753 0 0         if(!hdrp &&
    0          
5754 0 0         __privtrans->pdls[5]->hdrsv &&
5755 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
5756             ) {
5757 0           hdrp = __privtrans->pdls[5]->hdrsv;
5758 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
5759             }
5760 0 0         if(!hdrp &&
    0          
5761 0 0         !__creating[6] &&
5762 0 0         __privtrans->pdls[6]->hdrsv &&
5763 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
5764             ) {
5765 0           hdrp = __privtrans->pdls[6]->hdrsv;
5766 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
5767             }
5768 0 0         if(!hdrp &&
    0          
5769 0 0         !__creating[7] &&
5770 0 0         __privtrans->pdls[7]->hdrsv &&
5771 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
5772             ) {
5773 0           hdrp = __privtrans->pdls[7]->hdrsv;
5774 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
5775             }
5776 0 0         if(!hdrp &&
    0          
5777 0 0         !__creating[8] &&
5778 0 0         __privtrans->pdls[8]->hdrsv &&
5779 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
5780             ) {
5781 0           hdrp = __privtrans->pdls[8]->hdrsv;
5782 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
5783             }
5784 0 0         if(!hdrp &&
    0          
5785 0 0         !__creating[9] &&
5786 0 0         __privtrans->pdls[9]->hdrsv &&
5787 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
5788             ) {
5789 0           hdrp = __privtrans->pdls[9]->hdrsv;
5790 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
5791             }
5792 0 0         if(!hdrp &&
    0          
5793 0 0         !__creating[10] &&
5794 0 0         __privtrans->pdls[10]->hdrsv &&
5795 0           (__privtrans->pdls[10]->state & PDL_HDRCPY)
5796             ) {
5797 0           hdrp = __privtrans->pdls[10]->hdrsv;
5798 0           propagate_hdrcpy = ((__privtrans->pdls[10]->state & PDL_HDRCPY) != 0);
5799             }
5800 0 0         if (hdrp) {
5801 0 0         if(hdrp == &PL_sv_undef)
5802 0           hdr_copy = &PL_sv_undef;
5803             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
5804             int count;
5805             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
5806 0           dSP;
5807 0           ENTER ;
5808 0           SAVETMPS ;
5809 0 0         PUSHMARK(SP) ;
5810 0 0         XPUSHs( hdrp );
5811 0           PUTBACK ;
5812 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
5813 0           SPAGAIN ;
5814 0 0         if(count != 1)
5815 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
5816              
5817 0           hdr_copy = (SV *)POPs;
5818              
5819 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
5820 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
5821             }
5822              
5823 0 0         FREETMPS ;
5824 0           LEAVE ;
5825              
5826              
5827             } PDL_COMMENT("end of callback block")
5828              
5829 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
5830 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
5831 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
5832 0 0         if( hdr_copy != &PL_sv_undef )
5833 0           (void)SvREFCNT_inc(hdr_copy);
5834 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
5835             }
5836 0 0         if(propagate_hdrcpy)
5837 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
5838 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
5839 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
5840 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
5841 0 0         if( hdr_copy != &PL_sv_undef )
5842 0           (void)SvREFCNT_inc(hdr_copy);
5843 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
5844             }
5845 0 0         if(propagate_hdrcpy)
5846 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
5847 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
5848 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
5849 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
5850 0 0         if( hdr_copy != &PL_sv_undef )
5851 0           (void)SvREFCNT_inc(hdr_copy);
5852 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
5853             }
5854 0 0         if(propagate_hdrcpy)
5855 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
5856 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
5857 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
5858 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
5859 0 0         if( hdr_copy != &PL_sv_undef )
5860 0           (void)SvREFCNT_inc(hdr_copy);
5861 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
5862             }
5863 0 0         if(propagate_hdrcpy)
5864 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
5865 0 0         if ( __privtrans->pdls[10]->hdrsv != hdrp ){
5866 0 0         if( __privtrans->pdls[10]->hdrsv && __privtrans->pdls[10]->hdrsv != &PL_sv_undef)
    0          
5867 0           (void)SvREFCNT_dec( __privtrans->pdls[10]->hdrsv );
5868 0 0         if( hdr_copy != &PL_sv_undef )
5869 0           (void)SvREFCNT_inc(hdr_copy);
5870 0           __privtrans->pdls[10]->hdrsv = hdr_copy;
5871             }
5872 0 0         if(propagate_hdrcpy)
5873 0           __privtrans->pdls[10]->state |= PDL_HDRCPY;
5874              
5875 0 0         if(hdr_copy != &PL_sv_undef)
5876 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
5877             } PDL_COMMENT("end of if(hdrp) block")
5878             } PDL_COMMENT("end of conv. block")
5879 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
5880 0           __privtrans->__inc_p_m = 0; else
5881 0 0         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
5882 0           __privtrans->__inc_x_n = 0; else
5883 0 0         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
5884 0           __privtrans->__inc_t_nt = 0; else
5885 0 0         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
5886 0           __privtrans->__inc_ub_m = 0; else
5887 0 0         __privtrans->__inc_ub_m = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
5888 0           __privtrans->__inc_iopts_in = 0; else
5889 0 0         __privtrans->__inc_iopts_in = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
5890 0           __privtrans->__inc_opts_nopt = 0; else
5891 0 0         __privtrans->__inc_opts_nopt = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
5892 0           __privtrans->__inc_work_wn = 0; else
5893 0 0         __privtrans->__inc_work_wn = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
5894 0           __privtrans->__inc_covar_m0 = 0; else
5895 0 0         __privtrans->__inc_covar_m0 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    0          
5896 0           __privtrans->__inc_covar_m1 = 0; else
5897 0 0         __privtrans->__inc_covar_m1 = __privtrans->pdls[7]->dimincs[1];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    0          
5898 0           __privtrans->__inc_pout_m = 0; else
5899 0 0         __privtrans->__inc_pout_m = __privtrans->pdls[9]->dimincs[0];if(__privtrans->pdls[10]->ndims <= 0 || __privtrans->pdls[10]->dims[0] <= 1)
    0          
5900 0           __privtrans->__inc_info_q = 0; else
5901 0           __privtrans->__inc_info_q = __privtrans->pdls[10]->dimincs[0]; __privtrans->__ddone = 1;
5902             }
5903 0           }
5904            
5905              
5906 0           pdl_trans * pdl_levmar_diff_ub_copy(pdl_trans *__tr ) {
5907             int __dim;
5908 0           pdl_levmar_diff_ub_struct *__privtrans = (pdl_levmar_diff_ub_struct *) __tr;
5909            
5910             {
5911 0           pdl_levmar_diff_ub_struct *__copy = malloc(sizeof(pdl_levmar_diff_ub_struct));
5912 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
5913 0           __copy->has_badvalue = __privtrans->has_badvalue;
5914 0           __copy->badvalue = __privtrans->badvalue;
5915 0           __copy->flags = __privtrans->flags;
5916 0           __copy->vtable = __privtrans->vtable;
5917 0           __copy->__datatype = __privtrans->__datatype;
5918 0           __copy->freeproc = NULL;
5919 0           __copy->__ddone = __privtrans->__ddone;
5920             {int i;
5921 0 0         for(i=0; i<__copy->vtable->npdls; i++)
5922 0           __copy->pdls[i] = __privtrans->pdls[i];
5923             }
5924 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
5925 0 0         if(__copy->__ddone) {
5926 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_ub_m=__copy->__inc_ub_m;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__q_size=__privtrans->__q_size;__copy->__n_size=__privtrans->__n_size;__copy->__nt_size=__privtrans->__nt_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__m_size=__privtrans->__m_size;__copy->__in_size=__privtrans->__in_size;
5927             }
5928 0           return (pdl_trans*)__copy;
5929             }
5930             }
5931            
5932              
5933 0           void pdl_levmar_diff_ub_readdata(pdl_trans *__tr ) {
5934             int __dim;
5935 0           pdl_levmar_diff_ub_struct *__privtrans = (pdl_levmar_diff_ub_struct *) __tr;
5936            
5937             {
5938 0           {register PDL_Indx __m_size = __privtrans->__m_size;
5939             PDL_COMMENT("Start generic loop")
5940              
5941 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
5942 0           } break; case PDL_F: {
5943 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5944 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
5945              
5946 0 0         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5947 0           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
5948              
5949 0 0         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5950 0           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
5951              
5952 0 0         PDL_Float * ub_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5953 0           PDL_Float * ub_physdatap = ((PDL_Float *)((__privtrans->pdls[3])->data));
5954              
5955 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5956 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5957              
5958 0 0         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
5959 0           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
5960              
5961 0 0         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
5962 0           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
5963              
5964 0 0         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
5965 0           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[7])->data));
5966              
5967 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
5968 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
5969              
5970 0 0         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
5971 0           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
5972              
5973 0 0         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
5974 0           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[10])->data));
5975              
5976 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
5977 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
5978 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
5979 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
5980 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
5981 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
5982 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
5983 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
5984 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
5985 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
5986 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
5987              
5988              
5989             int * iopts;
5990             int maxits;
5991 0           void * tfuncn = (void *) __privtrans->funcn;
5992 0           void * tsfuncn = (void *) __privtrans->sfuncn;
5993             PDL_Float * pcovar;
5994             PDL_Float * pwork;
5995             ;
5996 0           DFP *dat = (void *) __privtrans->indat;
5997 0           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
5998 0           __privtrans->__nt_size, t_datap );
5999            
6000             PDL_COMMENT("THREADLOOPBEGIN")
6001 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6002 0           do { register PDL_Indx __tind1=0,__tind2=0;
6003 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6004 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6005 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6006 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6007 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6008 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6009 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6010 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6011 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
6012 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
6013 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
6014 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
6015 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
6016 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
6017 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
6018 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6019 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6020 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6021 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6022 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
6023 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
6024 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
6025 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
6026 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
6027 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
6028 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
6029 0           p_datap += __offsp[0];
6030 0           x_datap += __offsp[1];
6031 0           t_datap += __offsp[2];
6032 0           ub_datap += __offsp[3];
6033 0           iopts_datap += __offsp[4];
6034 0           opts_datap += __offsp[5];
6035 0           work_datap += __offsp[6];
6036 0           covar_datap += __offsp[7];
6037 0           returnval_datap += __offsp[8];
6038 0           pout_datap += __offsp[9];
6039 0           info_datap += __offsp[10];
6040 0 0         for( __tind2 = 0 ;
6041             __tind2 < __tdims1 ;
6042 0           __tind2++
6043 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
6044 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
6045 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
6046 0           ,ub_datap += __tinc1_3 - __tinc0_3 * __tdims0
6047 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
6048 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
6049 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
6050 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
6051 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
6052 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
6053 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
6054             )
6055             {
6056 0 0         for( __tind1 = 0 ;
6057             __tind1 < __tdims0 ;
6058 0           __tind1++
6059 0           ,p_datap += __tinc0_0
6060 0           ,x_datap += __tinc0_1
6061 0           ,t_datap += __tinc0_2
6062 0           ,ub_datap += __tinc0_3
6063 0           ,iopts_datap += __tinc0_4
6064 0           ,opts_datap += __tinc0_5
6065 0           ,work_datap += __tinc0_6
6066 0           ,covar_datap += __tinc0_7
6067 0           ,returnval_datap += __tinc0_8
6068 0           ,pout_datap += __tinc0_9
6069 0           ,info_datap += __tinc0_10
6070             )
6071             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6072             {PDL_COMMENT("Open m") register PDL_Indx m;
6073 0 0         for(m=0; m<(__m_size); m++) {
6074 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
6075             }} PDL_COMMENT("Close m")
6076 0           iopts = iopts_datap;
6077 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
6078 0           else pcovar = NULL;
6079             if ( 0 == 1 ) pwork = NULL;
6080 0           else pwork = work_datap;
6081 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
6082 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_bc_dif (
6083             tsfuncn ,
6084 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, NULL,ub_datap,
6085             maxits, opts_datap, info_datap, pwork, pcovar, dat);
6086             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
6087            
6088             PDL_COMMENT("THREADLOOPEND")
6089             }
6090             }
6091 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6092 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6093 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6094 0           ub_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6095 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
6096 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
6097 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
6098 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
6099 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
6100 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
6101 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
6102 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6103            
6104 0           } } break; case PDL_D: {
6105 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6106 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6107              
6108 0 0         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6109 0           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
6110              
6111 0 0         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6112 0           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
6113              
6114 0 0         PDL_Double * ub_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6115 0           PDL_Double * ub_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6116              
6117 0 0         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
6118 0           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
6119              
6120 0 0         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
6121 0           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
6122              
6123 0 0         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
6124 0           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
6125              
6126 0 0         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
6127 0           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
6128              
6129 0 0         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
6130 0           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
6131              
6132 0 0         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
6133 0           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
6134              
6135 0 0         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[10]),(__privtrans->vtable->per_pdl_flags[10]))));
    0          
6136 0           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[10])->data));
6137              
6138 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
6139 0           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
6140 0           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
6141 0           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
6142 0           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
6143 0           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
6144 0           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
6145 0           register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
6146 0           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
6147 0           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
6148 0           register PDL_Indx __inc_ub_m = __privtrans->__inc_ub_m;
6149              
6150              
6151             int * iopts;
6152             int maxits;
6153 0           void * tfuncn = (void *) __privtrans->funcn;
6154 0           void * tsfuncn = (void *) __privtrans->sfuncn;
6155             PDL_Double * pcovar;
6156             PDL_Double * pwork;
6157             ;
6158 0           DFP *dat = (void *) __privtrans->indat;
6159 0           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
6160 0           __privtrans->__nt_size, t_datap );
6161            
6162             PDL_COMMENT("THREADLOOPBEGIN")
6163 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6164 0           do { register PDL_Indx __tind1=0,__tind2=0;
6165 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6166 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6167 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6168 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6169 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6170 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6171 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6172 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6173 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
6174 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
6175 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
6176 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
6177 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
6178 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
6179 0           register PDL_Indx __tinc0_10 = __privtrans->__pdlthread.incs[10];
6180 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6181 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6182 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6183 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6184 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
6185 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
6186 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
6187 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
6188 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
6189 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
6190 0           register PDL_Indx __tinc1_10 = __privtrans->__pdlthread.incs[__tnpdls+10];
6191 0           p_datap += __offsp[0];
6192 0           x_datap += __offsp[1];
6193 0           t_datap += __offsp[2];
6194 0           ub_datap += __offsp[3];
6195 0           iopts_datap += __offsp[4];
6196 0           opts_datap += __offsp[5];
6197 0           work_datap += __offsp[6];
6198 0           covar_datap += __offsp[7];
6199 0           returnval_datap += __offsp[8];
6200 0           pout_datap += __offsp[9];
6201 0           info_datap += __offsp[10];
6202 0 0         for( __tind2 = 0 ;
6203             __tind2 < __tdims1 ;
6204 0           __tind2++
6205 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
6206 0           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
6207 0           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
6208 0           ,ub_datap += __tinc1_3 - __tinc0_3 * __tdims0
6209 0           ,iopts_datap += __tinc1_4 - __tinc0_4 * __tdims0
6210 0           ,opts_datap += __tinc1_5 - __tinc0_5 * __tdims0
6211 0           ,work_datap += __tinc1_6 - __tinc0_6 * __tdims0
6212 0           ,covar_datap += __tinc1_7 - __tinc0_7 * __tdims0
6213 0           ,returnval_datap += __tinc1_8 - __tinc0_8 * __tdims0
6214 0           ,pout_datap += __tinc1_9 - __tinc0_9 * __tdims0
6215 0           ,info_datap += __tinc1_10 - __tinc0_10 * __tdims0
6216             )
6217             {
6218 0 0         for( __tind1 = 0 ;
6219             __tind1 < __tdims0 ;
6220 0           __tind1++
6221 0           ,p_datap += __tinc0_0
6222 0           ,x_datap += __tinc0_1
6223 0           ,t_datap += __tinc0_2
6224 0           ,ub_datap += __tinc0_3
6225 0           ,iopts_datap += __tinc0_4
6226 0           ,opts_datap += __tinc0_5
6227 0           ,work_datap += __tinc0_6
6228 0           ,covar_datap += __tinc0_7
6229 0           ,returnval_datap += __tinc0_8
6230 0           ,pout_datap += __tinc0_9
6231 0           ,info_datap += __tinc0_10
6232             )
6233             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6234             {PDL_COMMENT("Open m") register PDL_Indx m;
6235 0 0         for(m=0; m<(__m_size); m++) {
6236 0 0         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    0          
6237             }} PDL_COMMENT("Close m")
6238 0           iopts = iopts_datap;
6239 0 0         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
6240 0           else pcovar = NULL;
6241             if ( 0 == 1 ) pwork = NULL;
6242 0           else pwork = work_datap;
6243 0           maxits = iopts[0]; /* for clarity. we hope optimized away */
6244 0           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_bc_dif (
6245             tfuncn ,
6246 0           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size, NULL,ub_datap,
6247             maxits, opts_datap, info_datap, pwork, pcovar, dat);
6248             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
6249            
6250             PDL_COMMENT("THREADLOOPEND")
6251             }
6252             }
6253 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6254 0           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6255 0           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6256 0           ub_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6257 0           iopts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
6258 0           opts_datap -= __tinc1_5 * __tdims1 + __offsp[5];
6259 0           work_datap -= __tinc1_6 * __tdims1 + __offsp[6];
6260 0           covar_datap -= __tinc1_7 * __tdims1 + __offsp[7];
6261 0           returnval_datap -= __tinc1_8 * __tdims1 + __offsp[8];
6262 0           pout_datap -= __tinc1_9 * __tdims1 + __offsp[9];
6263 0           info_datap -= __tinc1_10 * __tdims1 + __offsp[10];
6264 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6265            
6266 0           } break;}
6267 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
6268             }
6269             }
6270             }
6271            
6272              
6273              
6274              
6275 0           void pdl_levmar_diff_ub_free(pdl_trans *__tr ) {
6276             int __dim;
6277 0           pdl_levmar_diff_ub_struct *__privtrans = (pdl_levmar_diff_ub_struct *) __tr;
6278            
6279             {
6280            
6281 0           PDL_TR_CLRMAGIC(__privtrans);
6282             ;;;;
6283 0 0         if(__privtrans->__ddone) {
6284 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
6285             ;;;;;;;;;;;;;;;;;;;
6286             }
6287            
6288             }
6289 0           }
6290            
6291              
6292              
6293              
6294             static char pdl_levmar_diff_ub_vtable_flags[] =
6295             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
6296             pdl_transvtable pdl_levmar_diff_ub_vtable = {
6297             0,0, 6, 11, pdl_levmar_diff_ub_vtable_flags,
6298             pdl_levmar_diff_ub_redodims, pdl_levmar_diff_ub_readdata, NULL,
6299             pdl_levmar_diff_ub_free,NULL,NULL,pdl_levmar_diff_ub_copy,
6300             sizeof(pdl_levmar_diff_ub_struct),"pdl_levmar_diff_ub_vtable"
6301             };
6302              
6303             typedef struct pdl_levmar_diff__struct {
6304             PDL_TRANS_START(10);
6305             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_x_n;PDL_Indx __inc_t_nt;PDL_Indx __inc_iopts_in;PDL_Indx __inc_opts_nopt;PDL_Indx __inc_work_wn;PDL_Indx __inc_covar_m0;PDL_Indx __inc_covar_m1;PDL_Indx __inc_pout_m;PDL_Indx __inc_info_q;PDL_Indx __n_size;PDL_Indx __wn_size;PDL_Indx __nopt_size;PDL_Indx __m_size;PDL_Indx __q_size;PDL_Indx __in_size;PDL_Indx __nt_size;
6306             IV funcn;IV sfuncn;IV indat;int want_covar;
6307             char __ddone; PDL_COMMENT("Dims done")
6308             } pdl_levmar_diff__struct;
6309              
6310 15           void pdl_levmar_diff__redodims(pdl_trans *__tr ) {
6311             int __dim;
6312 15           pdl_levmar_diff__struct *__privtrans = (pdl_levmar_diff__struct *) __tr;
6313            
6314             {
6315             PDL_Indx __creating[10];
6316 15           __privtrans->__n_size = -1;
6317 15           __privtrans->__wn_size = -1;
6318 15           __privtrans->__nopt_size = -1;
6319 15           __privtrans->__m_size = -1;
6320 15           __privtrans->__q_size = 10;
6321 15           __privtrans->__in_size = -1;
6322 15           __privtrans->__nt_size = -1;
6323 15           __creating[0] = 0;
6324 15           __creating[1] = 0;
6325 15           __creating[2] = 0;
6326 15           __creating[3] = 0;
6327 15           __creating[4] = 0;
6328 15 50         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    50          
6329 15 50         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    50          
6330 15 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
6331 15 50         __creating[8] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[8]);
    50          
6332 15 50         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    50          
6333             {
6334             {PDL_COMMENT("Start generic loop")
6335              
6336 15           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
6337 0           } break; case PDL_F: {
6338 5 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6339 5           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
6340              
6341 5 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6342 5           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
6343              
6344 5 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6345 5           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
6346              
6347 5 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6348 5           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
6349              
6350 5 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
6351 5           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
6352              
6353 5 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
6354 5           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
6355              
6356 5 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
6357 5           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
6358              
6359 5 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
6360 5           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
6361              
6362 5 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
6363 5           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
6364              
6365 5 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
6366 5           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
6367              
6368 5           {register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
6369 5           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
6370 5           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
6371 5           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
6372 5           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
6373 5           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
6374 5           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
6375 5           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
6376 5           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
6377 5           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
6378              
6379              
6380 5           int im = __privtrans->pdls[0]->dims[0];
6381 5           int in = __privtrans->pdls[1]->dims[0];
6382 5           int min = 4*in + 4*im + in*im + im*im;
6383 5           int inw = __privtrans->pdls[5]->dims[0];
6384 5           __privtrans->__wn_size = inw >= min ? inw : min;
6385            
6386 5           } } break; case PDL_D: {
6387 10 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6388 10           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6389              
6390 10 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6391 10           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
6392              
6393 10 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6394 10           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
6395              
6396 10 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6397 10           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
6398              
6399 10 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
6400 10           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
6401              
6402 10 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
6403 10           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
6404              
6405 10 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
6406 10           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
6407              
6408 10 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
6409 10           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
6410              
6411 10 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
6412 10           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
6413              
6414 10 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
6415 10           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
6416              
6417 10           {register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
6418 10           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
6419 10           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
6420 10           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
6421 10           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
6422 10           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
6423 10           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
6424 10           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
6425 10           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
6426 10           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
6427              
6428              
6429 10           int im = __privtrans->pdls[0]->dims[0];
6430 10           int in = __privtrans->pdls[1]->dims[0];
6431 10           int min = 4*in + 4*im + in*im + im*im;
6432 10           int inw = __privtrans->pdls[5]->dims[0];
6433 10           __privtrans->__wn_size = inw >= min ? inw : min;
6434            
6435 10           } break;}
6436 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
6437             }
6438             }
6439             {
6440             static char *__parnames[] = {"p","x","t","iopts","opts","work","covar","returnval","pout","info"};
6441             static PDL_Indx __realdims[] = {1,1,1,1,1,1,2,0,1,1};
6442             static char __funcname[] = "PDL::Fit::Levmar::levmar_diff_";
6443             static pdl_errorinfo __einfo = {
6444             __funcname, __parnames, 10
6445             };
6446            
6447 15           PDL->initthreadstruct(2,__privtrans->pdls,
6448             __realdims,__creating,10,
6449             &__einfo,&(__privtrans->__pdlthread),
6450 15           __privtrans->vtable->per_pdl_flags,
6451             0 );
6452             }
6453 15 50         if(((__privtrans->pdls[0]))->ndims < 1) {
6454 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
6455             }
6456 15 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
6457 15           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
6458 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
6459 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
6460 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6461             }
6462             }
6463 15 50         if(((__privtrans->pdls[1]))->ndims < 1) {
6464 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
6465             }
6466 15 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
6467 15           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
6468 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
6469 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
6470 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6471             }
6472             }
6473 15           PDL->make_physical(((__privtrans->pdls[1])));
6474 15 50         if(((__privtrans->pdls[2]))->ndims < 1) {
6475 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__nt_size <= 1) __privtrans->__nt_size = 1;
    0          
6476             }
6477 15 50         if(__privtrans->__nt_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size == 1)) {
    0          
    0          
6478 15           __privtrans->__nt_size = ((__privtrans->pdls[2]))->dims[0];
6479 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__nt_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
6480 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
6481 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6482             }
6483             }
6484 15           PDL->make_physical(((__privtrans->pdls[2])));
6485 15 50         if(((__privtrans->pdls[3]))->ndims < 1) {
6486 15 50         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__in_size <= 1) __privtrans->__in_size = 1;
    50          
6487             }
6488 15 50         if(__privtrans->__in_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__in_size == 1)) {
    50          
    0          
6489 0           __privtrans->__in_size = ((__privtrans->pdls[3]))->dims[0];
6490 15 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__in_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
6491 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
6492 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6493             }
6494             }
6495 15           PDL->make_physical(((__privtrans->pdls[3])));
6496 15 50         if(((__privtrans->pdls[4]))->ndims < 1) {
6497 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__nopt_size <= 1) __privtrans->__nopt_size = 1;
    0          
6498             }
6499 15 50         if(__privtrans->__nopt_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nopt_size == 1)) {
    0          
    0          
6500 15           __privtrans->__nopt_size = ((__privtrans->pdls[4]))->dims[0];
6501 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nopt_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
6502 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
6503 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6504             }
6505             }
6506 15           PDL->make_physical(((__privtrans->pdls[4])));
6507 15 50         if(!__creating[5]) {
6508 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
6509 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__wn_size <= 1) __privtrans->__wn_size = 1;
    0          
6510             }
6511 0 0         if(__privtrans->__wn_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__wn_size == 1)) {
    0          
    0          
6512 0           __privtrans->__wn_size = ((__privtrans->pdls[5]))->dims[0];
6513 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__wn_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
6514 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
6515 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6516             }
6517             }
6518 0           PDL->make_physical(((__privtrans->pdls[5])));
6519             } else {
6520 15           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__wn_size;
6521 15           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,1);
6522 15 50         }if(!__creating[6]) {
6523 0 0         if(((__privtrans->pdls[6]))->ndims < 2) {
6524 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
6525 0 0         if (((__privtrans->pdls[6]))->ndims < 2 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
6526             }
6527 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
6528 0           __privtrans->__m_size = ((__privtrans->pdls[6]))->dims[0];
6529 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
6530 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
6531 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6532             }
6533             }
6534 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__m_size == 1)) {
    0          
    0          
6535 0           __privtrans->__m_size = ((__privtrans->pdls[6]))->dims[1];
6536 0 0         } else if(((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__m_size != ((__privtrans->pdls[6]))->dims[1]) {
    0          
6537 0 0         if(((__privtrans->pdls[6]))->dims[1] != 1) {
6538 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6539             }
6540             }
6541 0           PDL->make_physical(((__privtrans->pdls[6])));
6542             } else {
6543 15           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;dims[1] = __privtrans->__m_size;
6544 15           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,0);
6545 15 50         }if(!__creating[7]) {
6546             } else {
6547             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
6548 15           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
6549 15 50         }if(!__creating[8]) {
6550 0 0         if(((__privtrans->pdls[8]))->ndims < 1) {
6551 0 0         if (((__privtrans->pdls[8]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
6552             }
6553 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
6554 0           __privtrans->__m_size = ((__privtrans->pdls[8]))->dims[0];
6555 0 0         } else if(((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[8]))->dims[0]) {
    0          
6556 0 0         if(((__privtrans->pdls[8]))->dims[0] != 1) {
6557 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6558             }
6559             }
6560 0           PDL->make_physical(((__privtrans->pdls[8])));
6561             } else {
6562 15           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__m_size;
6563 15           PDL->thread_create_parameter(&__privtrans->__pdlthread,8,dims,0);
6564 15 50         }if(!__creating[9]) {
6565 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
6566 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__q_size <= 1) __privtrans->__q_size = 1;
    0          
6567             }
6568 0 0         if(__privtrans->__q_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__q_size == 1)) {
    0          
    0          
6569 0           __privtrans->__q_size = ((__privtrans->pdls[9]))->dims[0];
6570 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__q_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
6571 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
6572 0           PDL->pdl_barf("Error in levmar_diff_:" "Wrong dims\n");
6573             }
6574             }
6575 0           PDL->make_physical(((__privtrans->pdls[9])));
6576             } else {
6577 15           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__q_size;
6578 15           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
6579             }
6580             { PDL_COMMENT("convenience block")
6581 15           void *hdrp = NULL;
6582 15           char propagate_hdrcpy = 0;
6583 15           SV *hdr_copy = NULL;
6584 15 50         if(!hdrp &&
    50          
6585 0 0         __privtrans->pdls[0]->hdrsv &&
6586 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
6587             ) {
6588 0           hdrp = __privtrans->pdls[0]->hdrsv;
6589 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
6590             }
6591 15 50         if(!hdrp &&
    50          
6592 0 0         __privtrans->pdls[1]->hdrsv &&
6593 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
6594             ) {
6595 0           hdrp = __privtrans->pdls[1]->hdrsv;
6596 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
6597             }
6598 15 50         if(!hdrp &&
    50          
6599 0 0         __privtrans->pdls[2]->hdrsv &&
6600 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
6601             ) {
6602 0           hdrp = __privtrans->pdls[2]->hdrsv;
6603 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
6604             }
6605 15 50         if(!hdrp &&
    50          
6606 0 0         __privtrans->pdls[3]->hdrsv &&
6607 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
6608             ) {
6609 0           hdrp = __privtrans->pdls[3]->hdrsv;
6610 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
6611             }
6612 15 50         if(!hdrp &&
    50          
6613 0 0         __privtrans->pdls[4]->hdrsv &&
6614 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
6615             ) {
6616 0           hdrp = __privtrans->pdls[4]->hdrsv;
6617 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
6618             }
6619 15 50         if(!hdrp &&
    50          
6620 0 0         !__creating[5] &&
6621 0 0         __privtrans->pdls[5]->hdrsv &&
6622 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
6623             ) {
6624 0           hdrp = __privtrans->pdls[5]->hdrsv;
6625 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
6626             }
6627 15 50         if(!hdrp &&
    50          
6628 0 0         !__creating[6] &&
6629 0 0         __privtrans->pdls[6]->hdrsv &&
6630 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
6631             ) {
6632 0           hdrp = __privtrans->pdls[6]->hdrsv;
6633 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
6634             }
6635 15 50         if(!hdrp &&
    50          
6636 0 0         !__creating[7] &&
6637 0 0         __privtrans->pdls[7]->hdrsv &&
6638 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
6639             ) {
6640 0           hdrp = __privtrans->pdls[7]->hdrsv;
6641 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
6642             }
6643 15 50         if(!hdrp &&
    50          
6644 0 0         !__creating[8] &&
6645 0 0         __privtrans->pdls[8]->hdrsv &&
6646 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
6647             ) {
6648 0           hdrp = __privtrans->pdls[8]->hdrsv;
6649 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
6650             }
6651 15 50         if(!hdrp &&
    50          
6652 0 0         !__creating[9] &&
6653 0 0         __privtrans->pdls[9]->hdrsv &&
6654 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
6655             ) {
6656 0           hdrp = __privtrans->pdls[9]->hdrsv;
6657 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
6658             }
6659 15 50         if (hdrp) {
6660 0 0         if(hdrp == &PL_sv_undef)
6661 0           hdr_copy = &PL_sv_undef;
6662             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
6663             int count;
6664             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
6665 0           dSP;
6666 0           ENTER ;
6667 0           SAVETMPS ;
6668 0 0         PUSHMARK(SP) ;
6669 0 0         XPUSHs( hdrp );
6670 0           PUTBACK ;
6671 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
6672 0           SPAGAIN ;
6673 0 0         if(count != 1)
6674 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
6675              
6676 0           hdr_copy = (SV *)POPs;
6677              
6678 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
6679 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
6680             }
6681              
6682 0 0         FREETMPS ;
6683 0           LEAVE ;
6684              
6685              
6686             } PDL_COMMENT("end of callback block")
6687              
6688 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
6689 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
6690 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
6691 0 0         if( hdr_copy != &PL_sv_undef )
6692 0           (void)SvREFCNT_inc(hdr_copy);
6693 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
6694             }
6695 0 0         if(propagate_hdrcpy)
6696 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
6697 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
6698 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
6699 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
6700 0 0         if( hdr_copy != &PL_sv_undef )
6701 0           (void)SvREFCNT_inc(hdr_copy);
6702 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
6703             }
6704 0 0         if(propagate_hdrcpy)
6705 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
6706 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
6707 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
6708 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
6709 0 0         if( hdr_copy != &PL_sv_undef )
6710 0           (void)SvREFCNT_inc(hdr_copy);
6711 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
6712             }
6713 0 0         if(propagate_hdrcpy)
6714 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
6715 0 0         if ( __privtrans->pdls[8]->hdrsv != hdrp ){
6716 0 0         if( __privtrans->pdls[8]->hdrsv && __privtrans->pdls[8]->hdrsv != &PL_sv_undef)
    0          
6717 0           (void)SvREFCNT_dec( __privtrans->pdls[8]->hdrsv );
6718 0 0         if( hdr_copy != &PL_sv_undef )
6719 0           (void)SvREFCNT_inc(hdr_copy);
6720 0           __privtrans->pdls[8]->hdrsv = hdr_copy;
6721             }
6722 0 0         if(propagate_hdrcpy)
6723 0           __privtrans->pdls[8]->state |= PDL_HDRCPY;
6724 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
6725 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
6726 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
6727 0 0         if( hdr_copy != &PL_sv_undef )
6728 0           (void)SvREFCNT_inc(hdr_copy);
6729 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
6730             }
6731 0 0         if(propagate_hdrcpy)
6732 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
6733              
6734 0 0         if(hdr_copy != &PL_sv_undef)
6735 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
6736             } PDL_COMMENT("end of if(hdrp) block")
6737             } PDL_COMMENT("end of conv. block")
6738 15 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
6739 0           __privtrans->__inc_p_m = 0; else
6740 15 50         __privtrans->__inc_p_m = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
6741 0           __privtrans->__inc_x_n = 0; else
6742 15 50         __privtrans->__inc_x_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    100          
6743 9           __privtrans->__inc_t_nt = 0; else
6744 15 50         __privtrans->__inc_t_nt = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
6745 15           __privtrans->__inc_iopts_in = 0; else
6746 15 50         __privtrans->__inc_iopts_in = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
6747 0           __privtrans->__inc_opts_nopt = 0; else
6748 15 50         __privtrans->__inc_opts_nopt = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    50          
6749 0           __privtrans->__inc_work_wn = 0; else
6750 15 50         __privtrans->__inc_work_wn = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    50          
6751 0           __privtrans->__inc_covar_m0 = 0; else
6752 15 50         __privtrans->__inc_covar_m0 = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 1 || __privtrans->pdls[6]->dims[1] <= 1)
    50          
6753 0           __privtrans->__inc_covar_m1 = 0; else
6754 15 50         __privtrans->__inc_covar_m1 = __privtrans->pdls[6]->dimincs[1];if(__privtrans->pdls[8]->ndims <= 0 || __privtrans->pdls[8]->dims[0] <= 1)
    50          
6755 0           __privtrans->__inc_pout_m = 0; else
6756 15 50         __privtrans->__inc_pout_m = __privtrans->pdls[8]->dimincs[0];if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    50          
6757 0           __privtrans->__inc_info_q = 0; else
6758 15           __privtrans->__inc_info_q = __privtrans->pdls[9]->dimincs[0]; __privtrans->__ddone = 1;
6759             }
6760 15           }
6761            
6762              
6763 0           pdl_trans * pdl_levmar_diff__copy(pdl_trans *__tr ) {
6764             int __dim;
6765 0           pdl_levmar_diff__struct *__privtrans = (pdl_levmar_diff__struct *) __tr;
6766            
6767             {
6768 0           pdl_levmar_diff__struct *__copy = malloc(sizeof(pdl_levmar_diff__struct));
6769 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
6770 0           __copy->has_badvalue = __privtrans->has_badvalue;
6771 0           __copy->badvalue = __privtrans->badvalue;
6772 0           __copy->flags = __privtrans->flags;
6773 0           __copy->vtable = __privtrans->vtable;
6774 0           __copy->__datatype = __privtrans->__datatype;
6775 0           __copy->freeproc = NULL;
6776 0           __copy->__ddone = __privtrans->__ddone;
6777             {int i;
6778 0 0         for(i=0; i<__copy->vtable->npdls; i++)
6779 0           __copy->pdls[i] = __privtrans->pdls[i];
6780             }
6781 0           (__copy->funcn) = (__privtrans->funcn);;(__copy->sfuncn) = (__privtrans->sfuncn);;(__copy->indat) = (__privtrans->indat);;(__copy->want_covar) = (__privtrans->want_covar);;
6782 0 0         if(__copy->__ddone) {
6783 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_x_n=__copy->__inc_x_n;__privtrans->__inc_t_nt=__copy->__inc_t_nt;__privtrans->__inc_iopts_in=__copy->__inc_iopts_in;__privtrans->__inc_opts_nopt=__copy->__inc_opts_nopt;__privtrans->__inc_work_wn=__copy->__inc_work_wn;__privtrans->__inc_covar_m0=__copy->__inc_covar_m0;__privtrans->__inc_covar_m1=__copy->__inc_covar_m1;__privtrans->__inc_pout_m=__copy->__inc_pout_m;__privtrans->__inc_info_q=__copy->__inc_info_q;__copy->__n_size=__privtrans->__n_size;__copy->__wn_size=__privtrans->__wn_size;__copy->__nopt_size=__privtrans->__nopt_size;__copy->__m_size=__privtrans->__m_size;__copy->__q_size=__privtrans->__q_size;__copy->__in_size=__privtrans->__in_size;__copy->__nt_size=__privtrans->__nt_size;
6784             }
6785 0           return (pdl_trans*)__copy;
6786             }
6787             }
6788            
6789              
6790 15           void pdl_levmar_diff__readdata(pdl_trans *__tr ) {
6791             int __dim;
6792 15           pdl_levmar_diff__struct *__privtrans = (pdl_levmar_diff__struct *) __tr;
6793            
6794             {
6795 15           {register PDL_Indx __m_size = __privtrans->__m_size;
6796             PDL_COMMENT("Start generic loop")
6797              
6798 15           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
6799 0           } break; case PDL_F: {
6800 5 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6801 5           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
6802              
6803 5 50         PDL_Float * x_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6804 5           PDL_Float * x_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
6805              
6806 5 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6807 5           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
6808              
6809 5 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6810 5           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
6811              
6812 5 50         PDL_Float * opts_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
6813 5           PDL_Float * opts_physdatap = ((PDL_Float *)((__privtrans->pdls[4])->data));
6814              
6815 5 50         PDL_Float * work_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
6816 5           PDL_Float * work_physdatap = ((PDL_Float *)((__privtrans->pdls[5])->data));
6817              
6818 5 50         PDL_Float * covar_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
6819 5           PDL_Float * covar_physdatap = ((PDL_Float *)((__privtrans->pdls[6])->data));
6820              
6821 5 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
6822 5           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
6823              
6824 5 50         PDL_Float * pout_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
6825 5           PDL_Float * pout_physdatap = ((PDL_Float *)((__privtrans->pdls[8])->data));
6826              
6827 5 50         PDL_Float * info_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
6828 5           PDL_Float * info_physdatap = ((PDL_Float *)((__privtrans->pdls[9])->data));
6829              
6830 5           {register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
6831 5           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
6832 5           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
6833 5           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
6834 5           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
6835 5           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
6836 5           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
6837 5           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
6838 5           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
6839 5           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
6840              
6841              
6842             int * iopts;
6843             int maxits;
6844 5           void * tfuncn = (void *) __privtrans->funcn;
6845 5           void * tsfuncn = (void *) __privtrans->sfuncn;
6846             PDL_Float * pcovar;
6847             PDL_Float * pwork;
6848             ;
6849 5           DFP *dat = (void *) __privtrans->indat;
6850 5           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size,
6851 5           __privtrans->__nt_size, t_datap );
6852            
6853             PDL_COMMENT("THREADLOOPBEGIN")
6854 5 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6855 5           do { register PDL_Indx __tind1=0,__tind2=0;
6856 5           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6857 5           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6858 5           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6859 5           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6860 5           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6861 5           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6862 5           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6863 5           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6864 5           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
6865 5           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
6866 5           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
6867 5           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
6868 5           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
6869 5           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
6870 5           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6871 5           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6872 5           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6873 5           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6874 5           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
6875 5           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
6876 5           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
6877 5           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
6878 5           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
6879 5           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
6880 5           p_datap += __offsp[0];
6881 5           x_datap += __offsp[1];
6882 5           t_datap += __offsp[2];
6883 5           iopts_datap += __offsp[3];
6884 5           opts_datap += __offsp[4];
6885 5           work_datap += __offsp[5];
6886 5           covar_datap += __offsp[6];
6887 5           returnval_datap += __offsp[7];
6888 5           pout_datap += __offsp[8];
6889 5           info_datap += __offsp[9];
6890 10 100         for( __tind2 = 0 ;
6891             __tind2 < __tdims1 ;
6892 5           __tind2++
6893 5           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
6894 5           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
6895 5           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
6896 5           ,iopts_datap += __tinc1_3 - __tinc0_3 * __tdims0
6897 5           ,opts_datap += __tinc1_4 - __tinc0_4 * __tdims0
6898 5           ,work_datap += __tinc1_5 - __tinc0_5 * __tdims0
6899 5           ,covar_datap += __tinc1_6 - __tinc0_6 * __tdims0
6900 5           ,returnval_datap += __tinc1_7 - __tinc0_7 * __tdims0
6901 5           ,pout_datap += __tinc1_8 - __tinc0_8 * __tdims0
6902 5           ,info_datap += __tinc1_9 - __tinc0_9 * __tdims0
6903             )
6904             {
6905 10 100         for( __tind1 = 0 ;
6906             __tind1 < __tdims0 ;
6907 5           __tind1++
6908 5           ,p_datap += __tinc0_0
6909 5           ,x_datap += __tinc0_1
6910 5           ,t_datap += __tinc0_2
6911 5           ,iopts_datap += __tinc0_3
6912 5           ,opts_datap += __tinc0_4
6913 5           ,work_datap += __tinc0_5
6914 5           ,covar_datap += __tinc0_6
6915 5           ,returnval_datap += __tinc0_7
6916 5           ,pout_datap += __tinc0_8
6917 5           ,info_datap += __tinc0_9
6918             )
6919             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6920             {PDL_COMMENT("Open m") register PDL_Indx m;
6921 16 100         for(m=0; m<(__m_size); m++) {
6922 11 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
6923             }} PDL_COMMENT("Close m")
6924 5           iopts = iopts_datap;
6925 5 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
6926 5           else pcovar = NULL;
6927             if ( 0 == 1 ) pwork = NULL;
6928 5           else pwork = work_datap;
6929 5           maxits = iopts[0]; /* for clarity. we hope optimized away */
6930 5           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = slevmar_dif (
6931             tsfuncn ,
6932 10           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size,
6933             maxits, opts_datap, info_datap, pwork, pcovar, dat);
6934             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
6935            
6936             PDL_COMMENT("THREADLOOPEND")
6937             }
6938             }
6939 5           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6940 5           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6941 5           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6942 5           iopts_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6943 5           opts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
6944 5           work_datap -= __tinc1_5 * __tdims1 + __offsp[5];
6945 5           covar_datap -= __tinc1_6 * __tdims1 + __offsp[6];
6946 5           returnval_datap -= __tinc1_7 * __tdims1 + __offsp[7];
6947 5           pout_datap -= __tinc1_8 * __tdims1 + __offsp[8];
6948 5           info_datap -= __tinc1_9 * __tdims1 + __offsp[9];
6949 5 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6950            
6951 5           } } break; case PDL_D: {
6952 10 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6953 10           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6954              
6955 10 50         PDL_Double * x_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6956 10           PDL_Double * x_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
6957              
6958 10 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6959 10           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
6960              
6961 10 50         PDL_Long * iopts_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6962 10           PDL_Long * iopts_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
6963              
6964 10 50         PDL_Double * opts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
6965 10           PDL_Double * opts_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
6966              
6967 10 50         PDL_Double * work_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
6968 10           PDL_Double * work_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
6969              
6970 10 50         PDL_Double * covar_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
6971 10           PDL_Double * covar_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
6972              
6973 10 50         PDL_Long * returnval_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
6974 10           PDL_Long * returnval_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
6975              
6976 10 50         PDL_Double * pout_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
6977 10           PDL_Double * pout_physdatap = ((PDL_Double *)((__privtrans->pdls[8])->data));
6978              
6979 10 50         PDL_Double * info_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
6980 10           PDL_Double * info_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
6981              
6982 10           {register PDL_Indx __inc_covar_m0 = __privtrans->__inc_covar_m0;
6983 10           register PDL_Indx __inc_covar_m1 = __privtrans->__inc_covar_m1;
6984 10           register PDL_Indx __inc_info_q = __privtrans->__inc_info_q;
6985 10           register PDL_Indx __inc_t_nt = __privtrans->__inc_t_nt;
6986 10           register PDL_Indx __inc_opts_nopt = __privtrans->__inc_opts_nopt;
6987 10           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
6988 10           register PDL_Indx __inc_pout_m = __privtrans->__inc_pout_m;
6989 10           register PDL_Indx __inc_iopts_in = __privtrans->__inc_iopts_in;
6990 10           register PDL_Indx __inc_x_n = __privtrans->__inc_x_n;
6991 10           register PDL_Indx __inc_work_wn = __privtrans->__inc_work_wn;
6992              
6993              
6994             int * iopts;
6995             int maxits;
6996 10           void * tfuncn = (void *) __privtrans->funcn;
6997 10           void * tsfuncn = (void *) __privtrans->sfuncn;
6998             PDL_Double * pcovar;
6999             PDL_Double * pwork;
7000             ;
7001 10           DFP *dat = (void *) __privtrans->indat;
7002 10           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size,
7003 10           __privtrans->__nt_size, t_datap );
7004            
7005             PDL_COMMENT("THREADLOOPBEGIN")
7006 10 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7007 10           do { register PDL_Indx __tind1=0,__tind2=0;
7008 10           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7009 10           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7010 10           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7011 10           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7012 10           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7013 10           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7014 10           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7015 10           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
7016 10           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
7017 10           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
7018 10           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
7019 10           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
7020 10           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
7021 10           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
7022 10           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7023 10           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7024 10           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7025 10           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
7026 10           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
7027 10           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
7028 10           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
7029 10           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
7030 10           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
7031 10           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
7032 10           p_datap += __offsp[0];
7033 10           x_datap += __offsp[1];
7034 10           t_datap += __offsp[2];
7035 10           iopts_datap += __offsp[3];
7036 10           opts_datap += __offsp[4];
7037 10           work_datap += __offsp[5];
7038 10           covar_datap += __offsp[6];
7039 10           returnval_datap += __offsp[7];
7040 10           pout_datap += __offsp[8];
7041 10           info_datap += __offsp[9];
7042 20 100         for( __tind2 = 0 ;
7043             __tind2 < __tdims1 ;
7044 10           __tind2++
7045 10           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
7046 10           ,x_datap += __tinc1_1 - __tinc0_1 * __tdims0
7047 10           ,t_datap += __tinc1_2 - __tinc0_2 * __tdims0
7048 10           ,iopts_datap += __tinc1_3 - __tinc0_3 * __tdims0
7049 10           ,opts_datap += __tinc1_4 - __tinc0_4 * __tdims0
7050 10           ,work_datap += __tinc1_5 - __tinc0_5 * __tdims0
7051 10           ,covar_datap += __tinc1_6 - __tinc0_6 * __tdims0
7052 10           ,returnval_datap += __tinc1_7 - __tinc0_7 * __tdims0
7053 10           ,pout_datap += __tinc1_8 - __tinc0_8 * __tdims0
7054 10           ,info_datap += __tinc1_9 - __tinc0_9 * __tdims0
7055             )
7056             {
7057 23 100         for( __tind1 = 0 ;
7058             __tind1 < __tdims0 ;
7059 13           __tind1++
7060 13           ,p_datap += __tinc0_0
7061 13           ,x_datap += __tinc0_1
7062 13           ,t_datap += __tinc0_2
7063 13           ,iopts_datap += __tinc0_3
7064 13           ,opts_datap += __tinc0_4
7065 13           ,work_datap += __tinc0_5
7066 13           ,covar_datap += __tinc0_6
7067 13           ,returnval_datap += __tinc0_7
7068 13           ,pout_datap += __tinc0_8
7069 13           ,info_datap += __tinc0_9
7070             )
7071             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
7072             {PDL_COMMENT("Open m") register PDL_Indx m;
7073 43 100         for(m=0; m<(__m_size); m++) {
7074 30 50         (pout_datap)[0+(__inc_pout_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") = (p_datap)[0+(__inc_p_m*PP_INDTERM(__privtrans->__m_size, m))] PDL_COMMENT("ACCESS()") ;
    50          
7075             }} PDL_COMMENT("Close m")
7076 13           iopts = iopts_datap;
7077 13 50         if ( __privtrans->want_covar == 1 ) pcovar = covar_datap;
7078 13           else pcovar = NULL;
7079             if ( 0 == 1 ) pwork = NULL;
7080 13           else pwork = work_datap;
7081 13           maxits = iopts[0]; /* for clarity. we hope optimized away */
7082 13           (returnval_datap)[0] PDL_COMMENT("ACCESS()") = dlevmar_dif (
7083             tfuncn ,
7084 26           pout_datap, x_datap, __privtrans->__m_size, __privtrans->__n_size,
7085             maxits, opts_datap, info_datap, pwork, pcovar, dat);
7086             /* maxits, opts_datap, info_datap, work_datap, pcovar , dat); */
7087            
7088             PDL_COMMENT("THREADLOOPEND")
7089             }
7090             }
7091 10           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7092 10           x_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7093 10           t_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7094 10           iopts_datap -= __tinc1_3 * __tdims1 + __offsp[3];
7095 10           opts_datap -= __tinc1_4 * __tdims1 + __offsp[4];
7096 10           work_datap -= __tinc1_5 * __tdims1 + __offsp[5];
7097 10           covar_datap -= __tinc1_6 * __tdims1 + __offsp[6];
7098 10           returnval_datap -= __tinc1_7 * __tdims1 + __offsp[7];
7099 10           pout_datap -= __tinc1_8 * __tdims1 + __offsp[8];
7100 10           info_datap -= __tinc1_9 * __tdims1 + __offsp[9];
7101 10 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
7102            
7103 10           } break;}
7104 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7105             }
7106             }
7107             }
7108            
7109              
7110              
7111              
7112 15           void pdl_levmar_diff__free(pdl_trans *__tr ) {
7113             int __dim;
7114 15           pdl_levmar_diff__struct *__privtrans = (pdl_levmar_diff__struct *) __tr;
7115            
7116             {
7117            
7118 15           PDL_TR_CLRMAGIC(__privtrans);
7119             ;;;;
7120 15 50         if(__privtrans->__ddone) {
7121 15           PDL->freethreadloop(&(__privtrans->__pdlthread));
7122             ;;;;;;;;;;;;;;;;;;
7123             }
7124            
7125             }
7126 15           }
7127            
7128              
7129              
7130              
7131             static char pdl_levmar_diff__vtable_flags[] =
7132             { PDL_TPDL_VAFFINE_OK,0,0,0,0,0,0,PDL_TPDL_VAFFINE_OK,0,0};
7133             pdl_transvtable pdl_levmar_diff__vtable = {
7134             0,0, 5, 10, pdl_levmar_diff__vtable_flags,
7135             pdl_levmar_diff__redodims, pdl_levmar_diff__readdata, NULL,
7136             pdl_levmar_diff__free,NULL,NULL,pdl_levmar_diff__copy,
7137             sizeof(pdl_levmar_diff__struct),"pdl_levmar_diff__vtable"
7138             };
7139              
7140             typedef struct pdl__levmar_chkjac_struct {
7141             PDL_TRANS_START(3);
7142             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_t_n;PDL_Indx __inc_err_n;PDL_Indx __n_size;PDL_Indx __m_size;
7143             IV func;IV sfunc;IV jac;IV sjac;IV indat;
7144             char __ddone; PDL_COMMENT("Dims done")
7145             } pdl__levmar_chkjac_struct;
7146              
7147 4           void pdl__levmar_chkjac_redodims(pdl_trans *__tr ) {
7148             int __dim;
7149 4           pdl__levmar_chkjac_struct *__privtrans = (pdl__levmar_chkjac_struct *) __tr;
7150            
7151             {
7152             PDL_Indx __creating[3];
7153 4           __privtrans->__n_size = -1;
7154 4           __privtrans->__m_size = -1;
7155 4           __creating[0] = 0;
7156 4           __creating[1] = 0;
7157 4 50         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    50          
7158             {
7159             {PDL_COMMENT("Start generic loop")
7160              
7161 4           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7162 0           } break; case PDL_F: {
7163 2 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7164 2           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
7165              
7166 2 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7167 2           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
7168              
7169 2 50         PDL_Float * err_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7170 2           PDL_Float * err_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
7171              
7172 2           {register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7173 2           register PDL_Indx __inc_t_n = __privtrans->__inc_t_n;
7174 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7175              
7176             PDL_COMMENT("none")
7177 2           } } break; case PDL_D: {
7178 2 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7179 2           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
7180              
7181 2 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7182 2           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7183              
7184 2 50         PDL_Double * err_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7185 2           PDL_Double * err_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
7186              
7187 2           {register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7188 2           register PDL_Indx __inc_t_n = __privtrans->__inc_t_n;
7189 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7190              
7191             PDL_COMMENT("none")
7192 2           } break;}
7193 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7194             }
7195             }
7196             {
7197             static char *__parnames[] = {"p","t","err"};
7198             static PDL_Indx __realdims[] = {1,1,1};
7199             static char __funcname[] = "PDL::Fit::Levmar::_levmar_chkjac";
7200             static pdl_errorinfo __einfo = {
7201             __funcname, __parnames, 3
7202             };
7203            
7204 4           PDL->initthreadstruct(2,__privtrans->pdls,
7205             __realdims,__creating,3,
7206             &__einfo,&(__privtrans->__pdlthread),
7207 4           __privtrans->vtable->per_pdl_flags,
7208             0 );
7209             }
7210 4 50         if(((__privtrans->pdls[0]))->ndims < 1) {
7211 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
7212             }
7213 4 50         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
7214 4           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
7215 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
7216 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
7217 0           PDL->pdl_barf("Error in _levmar_chkjac:" "Wrong dims\n");
7218             }
7219             }
7220 4           PDL->make_physical(((__privtrans->pdls[0])));
7221 4 50         if(((__privtrans->pdls[1]))->ndims < 1) {
7222 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7223             }
7224 4 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
7225 4           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
7226 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
7227 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
7228 0           PDL->pdl_barf("Error in _levmar_chkjac:" "Wrong dims\n");
7229             }
7230             }
7231 4           PDL->make_physical(((__privtrans->pdls[1])));
7232 4 50         if(!__creating[2]) {
7233 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
7234 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7235             }
7236 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
7237 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[0];
7238 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
7239 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
7240 0           PDL->pdl_barf("Error in _levmar_chkjac:" "Wrong dims\n");
7241             }
7242             }
7243 0           PDL->make_physical(((__privtrans->pdls[2])));
7244             } else {
7245 4           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
7246 4           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,0);
7247             }
7248             { PDL_COMMENT("convenience block")
7249 4           void *hdrp = NULL;
7250 4           char propagate_hdrcpy = 0;
7251 4           SV *hdr_copy = NULL;
7252 4 50         if(!hdrp &&
    50          
7253 0 0         __privtrans->pdls[0]->hdrsv &&
7254 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
7255             ) {
7256 0           hdrp = __privtrans->pdls[0]->hdrsv;
7257 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
7258             }
7259 4 50         if(!hdrp &&
    50          
7260 0 0         __privtrans->pdls[1]->hdrsv &&
7261 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
7262             ) {
7263 0           hdrp = __privtrans->pdls[1]->hdrsv;
7264 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
7265             }
7266 4 50         if(!hdrp &&
    50          
7267 0 0         !__creating[2] &&
7268 0 0         __privtrans->pdls[2]->hdrsv &&
7269 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
7270             ) {
7271 0           hdrp = __privtrans->pdls[2]->hdrsv;
7272 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
7273             }
7274 4 50         if (hdrp) {
7275 0 0         if(hdrp == &PL_sv_undef)
7276 0           hdr_copy = &PL_sv_undef;
7277             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
7278             int count;
7279             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
7280 0           dSP;
7281 0           ENTER ;
7282 0           SAVETMPS ;
7283 0 0         PUSHMARK(SP) ;
7284 0 0         XPUSHs( hdrp );
7285 0           PUTBACK ;
7286 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
7287 0           SPAGAIN ;
7288 0 0         if(count != 1)
7289 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
7290              
7291 0           hdr_copy = (SV *)POPs;
7292              
7293 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
7294 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
7295             }
7296              
7297 0 0         FREETMPS ;
7298 0           LEAVE ;
7299              
7300              
7301             } PDL_COMMENT("end of callback block")
7302              
7303 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
7304 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
7305 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
7306 0 0         if( hdr_copy != &PL_sv_undef )
7307 0           (void)SvREFCNT_inc(hdr_copy);
7308 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
7309             }
7310 0 0         if(propagate_hdrcpy)
7311 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
7312              
7313 0 0         if(hdr_copy != &PL_sv_undef)
7314 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
7315             } PDL_COMMENT("end of if(hdrp) block")
7316             } PDL_COMMENT("end of conv. block")
7317 4 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
7318 0           __privtrans->__inc_p_m = 0; else
7319 4 50         __privtrans->__inc_p_m = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
7320 0           __privtrans->__inc_t_n = 0; else
7321 4 50         __privtrans->__inc_t_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
7322 0           __privtrans->__inc_err_n = 0; else
7323 4           __privtrans->__inc_err_n = __privtrans->pdls[2]->dimincs[0]; __privtrans->__ddone = 1;
7324             }
7325 4           }
7326            
7327              
7328 0           pdl_trans * pdl__levmar_chkjac_copy(pdl_trans *__tr ) {
7329             int __dim;
7330 0           pdl__levmar_chkjac_struct *__privtrans = (pdl__levmar_chkjac_struct *) __tr;
7331            
7332             {
7333 0           pdl__levmar_chkjac_struct *__copy = malloc(sizeof(pdl__levmar_chkjac_struct));
7334 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
7335 0           __copy->has_badvalue = __privtrans->has_badvalue;
7336 0           __copy->badvalue = __privtrans->badvalue;
7337 0           __copy->flags = __privtrans->flags;
7338 0           __copy->vtable = __privtrans->vtable;
7339 0           __copy->__datatype = __privtrans->__datatype;
7340 0           __copy->freeproc = NULL;
7341 0           __copy->__ddone = __privtrans->__ddone;
7342             {int i;
7343 0 0         for(i=0; i<__copy->vtable->npdls; i++)
7344 0           __copy->pdls[i] = __privtrans->pdls[i];
7345             }
7346 0           (__copy->func) = (__privtrans->func);;(__copy->sfunc) = (__privtrans->sfunc);;(__copy->jac) = (__privtrans->jac);;(__copy->sjac) = (__privtrans->sjac);;(__copy->indat) = (__privtrans->indat);;
7347 0 0         if(__copy->__ddone) {
7348 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_t_n=__copy->__inc_t_n;__privtrans->__inc_err_n=__copy->__inc_err_n;__copy->__n_size=__privtrans->__n_size;__copy->__m_size=__privtrans->__m_size;
7349             }
7350 0           return (pdl_trans*)__copy;
7351             }
7352             }
7353            
7354              
7355 4           void pdl__levmar_chkjac_readdata(pdl_trans *__tr ) {
7356             int __dim;
7357 4           pdl__levmar_chkjac_struct *__privtrans = (pdl__levmar_chkjac_struct *) __tr;
7358            
7359             {
7360             {PDL_COMMENT("Start generic loop")
7361              
7362 4           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7363 0           } break; case PDL_F: {
7364 2 50         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7365 2           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
7366              
7367 2 50         PDL_Float * t_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7368 2           PDL_Float * t_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
7369              
7370 2 50         PDL_Float * err_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7371 2           PDL_Float * err_physdatap = ((PDL_Float *)((__privtrans->pdls[2])->data));
7372              
7373              
7374             PDL_COMMENT("THREADLOOPBEGIN")
7375 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7376 2           do { register PDL_Indx __tind1=0,__tind2=0;
7377 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7378 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7379 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7380 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7381 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7382 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7383 2           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7384 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7385 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7386 2           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7387 2           p_datap += __offsp[0];
7388 2           t_datap += __offsp[1];
7389 2           err_datap += __offsp[2];
7390 4 100         for( __tind2 = 0 ;
7391             __tind2 < __tdims1 ;
7392 2           __tind2++
7393 2           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
7394 2           ,t_datap += __tinc1_1 - __tinc0_1 * __tdims0
7395 2           ,err_datap += __tinc1_2 - __tinc0_2 * __tdims0
7396             )
7397             {
7398 4 100         for( __tind1 = 0 ;
7399             __tind1 < __tdims0 ;
7400 2           __tind1++
7401 2           ,p_datap += __tinc0_0
7402 2           ,t_datap += __tinc0_1
7403 2           ,err_datap += __tinc0_2
7404             )
7405 2           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7406 2           register PDL_Indx __inc_t_n = __privtrans->__inc_t_n;
7407 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7408              
7409              
7410 2           void * f = (void *) __privtrans->func;
7411 2           void * sf = (void *) __privtrans->sfunc;
7412 2           void * j = (void *) __privtrans->jac;
7413 2           void * sj = (void *) __privtrans->sjac;
7414 2           DFP *dat = (void *) __privtrans->indat;
7415 2           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size, __privtrans->__n_size, t_datap );
7416 2           slevmar_chkjac (
7417 4           sf, sj,p_datap,__privtrans->__m_size,__privtrans->__n_size,dat,err_datap
7418             );
7419            
7420             }
7421             PDL_COMMENT("THREADLOOPEND")
7422             }
7423             }
7424 2           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7425 2           t_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7426 2           err_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7427 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
7428 2 50         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7429 2           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
7430              
7431 2 50         PDL_Double * t_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7432 2           PDL_Double * t_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7433              
7434 2 50         PDL_Double * err_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7435 2           PDL_Double * err_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
7436              
7437              
7438             PDL_COMMENT("THREADLOOPBEGIN")
7439 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7440 2           do { register PDL_Indx __tind1=0,__tind2=0;
7441 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7442 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7443 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7444 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7445 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7446 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7447 2           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7448 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7449 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7450 2           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7451 2           p_datap += __offsp[0];
7452 2           t_datap += __offsp[1];
7453 2           err_datap += __offsp[2];
7454 4 100         for( __tind2 = 0 ;
7455             __tind2 < __tdims1 ;
7456 2           __tind2++
7457 2           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
7458 2           ,t_datap += __tinc1_1 - __tinc0_1 * __tdims0
7459 2           ,err_datap += __tinc1_2 - __tinc0_2 * __tdims0
7460             )
7461             {
7462 4 100         for( __tind1 = 0 ;
7463             __tind1 < __tdims0 ;
7464 2           __tind1++
7465 2           ,p_datap += __tinc0_0
7466 2           ,t_datap += __tinc0_1
7467 2           ,err_datap += __tinc0_2
7468             )
7469 2           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7470 2           register PDL_Indx __inc_t_n = __privtrans->__inc_t_n;
7471 2           register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7472              
7473              
7474 2           void * f = (void *) __privtrans->func;
7475 2           void * sf = (void *) __privtrans->sfunc;
7476 2           void * j = (void *) __privtrans->jac;
7477 2           void * sj = (void *) __privtrans->sjac;
7478 2           DFP *dat = (void *) __privtrans->indat;
7479 2           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size, __privtrans->__n_size, t_datap );
7480 2           dlevmar_chkjac (
7481 4           f, j,p_datap,__privtrans->__m_size,__privtrans->__n_size,dat,err_datap
7482             );
7483            
7484             }
7485             PDL_COMMENT("THREADLOOPEND")
7486             }
7487             }
7488 2           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7489 2           t_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7490 2           err_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7491 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
7492 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7493             }
7494             }
7495             }
7496            
7497              
7498              
7499              
7500 4           void pdl__levmar_chkjac_free(pdl_trans *__tr ) {
7501             int __dim;
7502 4           pdl__levmar_chkjac_struct *__privtrans = (pdl__levmar_chkjac_struct *) __tr;
7503            
7504             {
7505            
7506 4           PDL_TR_CLRMAGIC(__privtrans);
7507             ;;;;;
7508 4 50         if(__privtrans->__ddone) {
7509 4           PDL->freethreadloop(&(__privtrans->__pdlthread));
7510             ;;;;;;
7511             }
7512            
7513             }
7514 4           }
7515            
7516              
7517              
7518              
7519             static char pdl__levmar_chkjac_vtable_flags[] =
7520             { 0,0,0};
7521             pdl_transvtable pdl__levmar_chkjac_vtable = {
7522             0,0, 2, 3, pdl__levmar_chkjac_vtable_flags,
7523             pdl__levmar_chkjac_redodims, pdl__levmar_chkjac_readdata, NULL,
7524             pdl__levmar_chkjac_free,NULL,NULL,pdl__levmar_chkjac_copy,
7525             sizeof(pdl__levmar_chkjac_struct),"pdl__levmar_chkjac_vtable"
7526             };
7527              
7528             typedef struct pdl__levmar_chkjac_no_t_struct {
7529             PDL_TRANS_START(2);
7530             pdl_thread __pdlthread;PDL_Indx __inc_p_m;PDL_Indx __inc_err_n;PDL_Indx __m_size;PDL_Indx __n_size;
7531             IV func;IV sfunc;IV jac;IV sjac;int N;IV indat;
7532             char __ddone; PDL_COMMENT("Dims done")
7533             } pdl__levmar_chkjac_no_t_struct;
7534              
7535 0           void pdl__levmar_chkjac_no_t_redodims(pdl_trans *__tr ) {
7536             int __dim;
7537 0           pdl__levmar_chkjac_no_t_struct *__privtrans = (pdl__levmar_chkjac_no_t_struct *) __tr;
7538            
7539             {
7540             PDL_Indx __creating[2];
7541 0           __privtrans->__m_size = -1;
7542 0           __privtrans->__n_size = -1;
7543 0           __creating[0] = 0;
7544 0 0         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
7545             {
7546             {PDL_COMMENT("Start generic loop")
7547              
7548 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7549 0           } break; case PDL_F: {
7550 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7551 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
7552              
7553 0 0         PDL_Float * err_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7554 0           PDL_Float * err_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
7555              
7556 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7557 0           register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7558              
7559              
7560 0           int N = __privtrans->N;
7561 0           int nin = __privtrans->pdls[1]->dims[0];
7562 0           __privtrans->__n_size = nin >= N ? nin : N;
7563            
7564 0           } } break; case PDL_D: {
7565 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7566 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
7567              
7568 0 0         PDL_Double * err_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7569 0           PDL_Double * err_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7570              
7571 0           {register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7572 0           register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7573              
7574              
7575 0           int N = __privtrans->N;
7576 0           int nin = __privtrans->pdls[1]->dims[0];
7577 0           __privtrans->__n_size = nin >= N ? nin : N;
7578            
7579 0           } break;}
7580 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7581             }
7582             }
7583             {
7584             static char *__parnames[] = {"p","err"};
7585             static PDL_Indx __realdims[] = {1,1};
7586             static char __funcname[] = "PDL::Fit::Levmar::_levmar_chkjac_no_t";
7587             static pdl_errorinfo __einfo = {
7588             __funcname, __parnames, 2
7589             };
7590            
7591 0           PDL->initthreadstruct(2,__privtrans->pdls,
7592             __realdims,__creating,2,
7593             &__einfo,&(__privtrans->__pdlthread),
7594 0           __privtrans->vtable->per_pdl_flags,
7595             0 );
7596             }
7597 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
7598 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__m_size <= 1) __privtrans->__m_size = 1;
    0          
7599             }
7600 0 0         if(__privtrans->__m_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size == 1)) {
    0          
    0          
7601 0           __privtrans->__m_size = ((__privtrans->pdls[0]))->dims[0];
7602 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__m_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
7603 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
7604 0           PDL->pdl_barf("Error in _levmar_chkjac_no_t:" "Wrong dims\n");
7605             }
7606             }
7607 0           PDL->make_physical(((__privtrans->pdls[0])));
7608 0 0         if(!__creating[1]) {
7609 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
7610 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7611             }
7612 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
7613 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
7614 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
7615 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
7616 0           PDL->pdl_barf("Error in _levmar_chkjac_no_t:" "Wrong dims\n");
7617             }
7618             }
7619 0           PDL->make_physical(((__privtrans->pdls[1])));
7620             } else {
7621 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
7622 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
7623             }
7624             { PDL_COMMENT("convenience block")
7625 0           void *hdrp = NULL;
7626 0           char propagate_hdrcpy = 0;
7627 0           SV *hdr_copy = NULL;
7628 0 0         if(!hdrp &&
    0          
7629 0 0         __privtrans->pdls[0]->hdrsv &&
7630 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
7631             ) {
7632 0           hdrp = __privtrans->pdls[0]->hdrsv;
7633 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
7634             }
7635 0 0         if(!hdrp &&
    0          
7636 0 0         !__creating[1] &&
7637 0 0         __privtrans->pdls[1]->hdrsv &&
7638 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
7639             ) {
7640 0           hdrp = __privtrans->pdls[1]->hdrsv;
7641 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
7642             }
7643 0 0         if (hdrp) {
7644 0 0         if(hdrp == &PL_sv_undef)
7645 0           hdr_copy = &PL_sv_undef;
7646             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
7647             int count;
7648             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
7649 0           dSP;
7650 0           ENTER ;
7651 0           SAVETMPS ;
7652 0 0         PUSHMARK(SP) ;
7653 0 0         XPUSHs( hdrp );
7654 0           PUTBACK ;
7655 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
7656 0           SPAGAIN ;
7657 0 0         if(count != 1)
7658 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
7659              
7660 0           hdr_copy = (SV *)POPs;
7661              
7662 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
7663 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
7664             }
7665              
7666 0 0         FREETMPS ;
7667 0           LEAVE ;
7668              
7669              
7670             } PDL_COMMENT("end of callback block")
7671              
7672 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
7673 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
7674 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
7675 0 0         if( hdr_copy != &PL_sv_undef )
7676 0           (void)SvREFCNT_inc(hdr_copy);
7677 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
7678             }
7679 0 0         if(propagate_hdrcpy)
7680 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
7681              
7682 0 0         if(hdr_copy != &PL_sv_undef)
7683 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
7684             } PDL_COMMENT("end of if(hdrp) block")
7685             } PDL_COMMENT("end of conv. block")
7686 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
7687 0           __privtrans->__inc_p_m = 0; else
7688 0 0         __privtrans->__inc_p_m = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
7689 0           __privtrans->__inc_err_n = 0; else
7690 0           __privtrans->__inc_err_n = __privtrans->pdls[1]->dimincs[0]; __privtrans->__ddone = 1;
7691             }
7692 0           }
7693            
7694              
7695 0           pdl_trans * pdl__levmar_chkjac_no_t_copy(pdl_trans *__tr ) {
7696             int __dim;
7697 0           pdl__levmar_chkjac_no_t_struct *__privtrans = (pdl__levmar_chkjac_no_t_struct *) __tr;
7698            
7699             {
7700 0           pdl__levmar_chkjac_no_t_struct *__copy = malloc(sizeof(pdl__levmar_chkjac_no_t_struct));
7701 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
7702 0           __copy->has_badvalue = __privtrans->has_badvalue;
7703 0           __copy->badvalue = __privtrans->badvalue;
7704 0           __copy->flags = __privtrans->flags;
7705 0           __copy->vtable = __privtrans->vtable;
7706 0           __copy->__datatype = __privtrans->__datatype;
7707 0           __copy->freeproc = NULL;
7708 0           __copy->__ddone = __privtrans->__ddone;
7709             {int i;
7710 0 0         for(i=0; i<__copy->vtable->npdls; i++)
7711 0           __copy->pdls[i] = __privtrans->pdls[i];
7712             }
7713 0           (__copy->func) = (__privtrans->func);;(__copy->sfunc) = (__privtrans->sfunc);;(__copy->jac) = (__privtrans->jac);;(__copy->sjac) = (__privtrans->sjac);;(__copy->N) = (__privtrans->N);;(__copy->indat) = (__privtrans->indat);;
7714 0 0         if(__copy->__ddone) {
7715 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_p_m=__copy->__inc_p_m;__privtrans->__inc_err_n=__copy->__inc_err_n;__copy->__m_size=__privtrans->__m_size;__copy->__n_size=__privtrans->__n_size;
7716             }
7717 0           return (pdl_trans*)__copy;
7718             }
7719             }
7720            
7721              
7722 0           void pdl__levmar_chkjac_no_t_readdata(pdl_trans *__tr ) {
7723             int __dim;
7724 0           pdl__levmar_chkjac_no_t_struct *__privtrans = (pdl__levmar_chkjac_no_t_struct *) __tr;
7725            
7726             {
7727             {PDL_COMMENT("Start generic loop")
7728              
7729 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7730 0           } break; case PDL_F: {
7731 0 0         PDL_Float * p_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7732 0           PDL_Float * p_physdatap = ((PDL_Float *)((__privtrans->pdls[0])->data));
7733              
7734 0 0         PDL_Float * err_datap = ((PDL_Float *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7735 0           PDL_Float * err_physdatap = ((PDL_Float *)((__privtrans->pdls[1])->data));
7736              
7737              
7738             PDL_COMMENT("THREADLOOPBEGIN")
7739 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7740 0           do { register PDL_Indx __tind1=0,__tind2=0;
7741 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7742 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7743 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7744 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7745 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7746 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7747 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7748 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7749 0           p_datap += __offsp[0];
7750 0           err_datap += __offsp[1];
7751 0 0         for( __tind2 = 0 ;
7752             __tind2 < __tdims1 ;
7753 0           __tind2++
7754 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
7755 0           ,err_datap += __tinc1_1 - __tinc0_1 * __tdims0
7756             )
7757             {
7758 0 0         for( __tind1 = 0 ;
7759             __tind1 < __tdims0 ;
7760 0           __tind1++
7761 0           ,p_datap += __tinc0_0
7762 0           ,err_datap += __tinc0_1
7763             )
7764 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7765 0           register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7766              
7767              
7768 0           void * f = (void *) __privtrans->func;
7769 0           void * sf = (void *) __privtrans->sfunc;
7770 0           void * j = (void *) __privtrans->jac;
7771 0           void * sj =(void *) __privtrans->sjac;
7772 0           DFP *dat = (void *) __privtrans->indat;
7773 0           DFP_check( &dat, PDL_F, __privtrans->__m_size, __privtrans->__n_size, __privtrans->__n_size, NULL );
7774 0           slevmar_chkjac (
7775 0           sf, sj,p_datap,__privtrans->__m_size,__privtrans->__n_size,dat,err_datap
7776             );
7777            
7778             }
7779             PDL_COMMENT("THREADLOOPEND")
7780             }
7781             }
7782 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7783 0           err_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7784 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
7785 0 0         PDL_Double * p_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7786 0           PDL_Double * p_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
7787              
7788 0 0         PDL_Double * err_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7789 0           PDL_Double * err_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7790              
7791              
7792             PDL_COMMENT("THREADLOOPBEGIN")
7793 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7794 0           do { register PDL_Indx __tind1=0,__tind2=0;
7795 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7796 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7797 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7798 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7799 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7800 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7801 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7802 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7803 0           p_datap += __offsp[0];
7804 0           err_datap += __offsp[1];
7805 0 0         for( __tind2 = 0 ;
7806             __tind2 < __tdims1 ;
7807 0           __tind2++
7808 0           ,p_datap += __tinc1_0 - __tinc0_0 * __tdims0
7809 0           ,err_datap += __tinc1_1 - __tinc0_1 * __tdims0
7810             )
7811             {
7812 0 0         for( __tind1 = 0 ;
7813             __tind1 < __tdims0 ;
7814 0           __tind1++
7815 0           ,p_datap += __tinc0_0
7816 0           ,err_datap += __tinc0_1
7817             )
7818 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_p_m = __privtrans->__inc_p_m;
7819 0           register PDL_Indx __inc_err_n = __privtrans->__inc_err_n;
7820              
7821              
7822 0           void * f = (void *) __privtrans->func;
7823 0           void * sf = (void *) __privtrans->sfunc;
7824 0           void * j = (void *) __privtrans->jac;
7825 0           void * sj =(void *) __privtrans->sjac;
7826 0           DFP *dat = (void *) __privtrans->indat;
7827 0           DFP_check( &dat, PDL_D, __privtrans->__m_size, __privtrans->__n_size, __privtrans->__n_size, NULL );
7828 0           dlevmar_chkjac (
7829 0           f, j,p_datap,__privtrans->__m_size,__privtrans->__n_size,dat,err_datap
7830             );
7831            
7832             }
7833             PDL_COMMENT("THREADLOOPEND")
7834             }
7835             }
7836 0           p_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7837 0           err_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7838 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
7839 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7840             }
7841             }
7842             }
7843            
7844              
7845              
7846              
7847 0           void pdl__levmar_chkjac_no_t_free(pdl_trans *__tr ) {
7848             int __dim;
7849 0           pdl__levmar_chkjac_no_t_struct *__privtrans = (pdl__levmar_chkjac_no_t_struct *) __tr;
7850            
7851             {
7852            
7853 0           PDL_TR_CLRMAGIC(__privtrans);
7854             ;;;;;;
7855 0 0         if(__privtrans->__ddone) {
7856 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
7857             ;;;;;
7858             }
7859            
7860             }
7861 0           }
7862            
7863              
7864              
7865              
7866             static char pdl__levmar_chkjac_no_t_vtable_flags[] =
7867             { 0,0};
7868             pdl_transvtable pdl__levmar_chkjac_no_t_vtable = {
7869             0,0, 1, 2, pdl__levmar_chkjac_no_t_vtable_flags,
7870             pdl__levmar_chkjac_no_t_redodims, pdl__levmar_chkjac_no_t_readdata, NULL,
7871             pdl__levmar_chkjac_no_t_free,NULL,NULL,pdl__levmar_chkjac_no_t_copy,
7872             sizeof(pdl__levmar_chkjac_no_t_struct),"pdl__levmar_chkjac_no_t_vtable"
7873             };
7874              
7875              
7876              
7877             MODULE = PDL::Fit::Levmar PACKAGE = PDL::Fit::Levmar
7878              
7879             PROTOTYPES: ENABLE
7880              
7881             int
7882             set_debugging(i)
7883             int i;
7884             CODE:
7885 0           RETVAL = __pdl_debugging;
7886 0           __pdl_debugging = i;
7887             OUTPUT:
7888             RETVAL
7889              
7890             int
7891             set_boundscheck(i)
7892             int i;
7893             CODE:
7894             if (! 1)
7895             warn("Bounds checking is disabled for PDL::Fit::Levmar");
7896 0           RETVAL = __pdl_boundscheck;
7897 0           __pdl_boundscheck = i;
7898             OUTPUT:
7899             RETVAL
7900              
7901              
7902             MODULE = PDL::Fit::Levmar PACKAGE = PDL
7903              
7904              
7905             void
7906             levmar_der_lb(...)
7907             PREINIT:
7908 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
7909             by pp_bless ? (CS) */
7910 0           HV *bless_stash = 0;
7911 0           SV *parent = 0;
7912             int nreturn;
7913             SV *work_SV;
7914             SV *covar_SV;
7915             SV *returnval_SV;
7916             SV *pout_SV;
7917             SV *info_SV;
7918             pdl *p;
7919             pdl *x;
7920             pdl *t;
7921             pdl *lb;
7922             pdl *iopts;
7923             pdl *opts;
7924             pdl *work;
7925             pdl *covar;
7926             pdl *returnval;
7927             pdl *pout;
7928             pdl *info;
7929             IV funcn;
7930             IV sfuncn;
7931             IV jacn;
7932             IV sjacn;
7933             IV indat;
7934             int want_covar;
7935             PPCODE:
7936             {
7937             PDL_COMMENT("Check if you can get a package name for this input value. ")
7938             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
7939             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
7940 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
7941 0           parent = ST(0);
7942 0 0         if (sv_isobject(parent)){
7943 0           bless_stash = SvSTASH(SvRV(ST(0)));
7944 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
7945             }
7946             }
7947 0 0         if (items == 17) { PDL_COMMENT("all variables on stack, read in output and temp vars")
7948 0           nreturn = 0;
7949 0           p = PDL->SvPDLV(ST(0));
7950 0           x = PDL->SvPDLV(ST(1));
7951 0           t = PDL->SvPDLV(ST(2));
7952 0           lb = PDL->SvPDLV(ST(3));
7953 0           iopts = PDL->SvPDLV(ST(4));
7954 0           opts = PDL->SvPDLV(ST(5));
7955 0           work = PDL->SvPDLV(ST(6));
7956 0           covar = PDL->SvPDLV(ST(7));
7957 0           returnval = PDL->SvPDLV(ST(8));
7958 0           pout = PDL->SvPDLV(ST(9));
7959 0           info = PDL->SvPDLV(ST(10));
7960 0 0         funcn = (IV)SvIV(ST(11))
7961             ;
7962 0 0         sfuncn = (IV)SvIV(ST(12))
7963             ;
7964 0 0         jacn = (IV)SvIV(ST(13))
7965             ;
7966 0 0         sjacn = (IV)SvIV(ST(14))
7967             ;
7968 0 0         indat = (IV)SvIV(ST(15))
7969             ;
7970 0 0         want_covar = (int)SvIV(ST(16))
7971             ;
7972             }
7973 0 0         else if (items == 16) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
7974 0           p = PDL->SvPDLV(ST(0));
7975 0           x = PDL->SvPDLV(ST(1));
7976 0           t = PDL->SvPDLV(ST(2));
7977 0           lb = PDL->SvPDLV(ST(3));
7978 0           iopts = PDL->SvPDLV(ST(4));
7979 0           opts = PDL->SvPDLV(ST(5));
7980 0           covar = PDL->SvPDLV(ST(6));
7981 0           returnval = PDL->SvPDLV(ST(7));
7982 0           pout = PDL->SvPDLV(ST(8));
7983 0           info = PDL->SvPDLV(ST(9));
7984 0 0         funcn = (IV)SvIV(ST(10))
7985             ;
7986 0 0         sfuncn = (IV)SvIV(ST(11))
7987             ;
7988 0 0         jacn = (IV)SvIV(ST(12))
7989             ;
7990 0 0         sjacn = (IV)SvIV(ST(13))
7991             ;
7992 0 0         indat = (IV)SvIV(ST(14))
7993             ;
7994 0 0         want_covar = (int)SvIV(ST(15))
7995             ;
7996 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
7997 0           work_SV = sv_newmortal();
7998 0           work = PDL->null();
7999 0           PDL->SetSV_PDL(work_SV,work);
8000 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8001             } else {
8002 0 0         PUSHMARK(SP);
8003 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8004 0           PUTBACK;
8005 0           perl_call_method("initialize", G_SCALAR);
8006 0           SPAGAIN;
8007 0           work_SV = POPs;
8008 0           PUTBACK;
8009 0           work = PDL->SvPDLV(work_SV);
8010             }
8011             }
8012 0 0         else if (items == 12) { PDL_COMMENT("only input variables on stack, create outputs and temps")
8013 0           nreturn = 4;
8014 0           p = PDL->SvPDLV(ST(0));
8015 0           x = PDL->SvPDLV(ST(1));
8016 0           t = PDL->SvPDLV(ST(2));
8017 0           lb = PDL->SvPDLV(ST(3));
8018 0           iopts = PDL->SvPDLV(ST(4));
8019 0           opts = PDL->SvPDLV(ST(5));
8020 0 0         funcn = (IV)SvIV(ST(6))
8021             ;
8022 0 0         sfuncn = (IV)SvIV(ST(7))
8023             ;
8024 0 0         jacn = (IV)SvIV(ST(8))
8025             ;
8026 0 0         sjacn = (IV)SvIV(ST(9))
8027             ;
8028 0 0         indat = (IV)SvIV(ST(10))
8029             ;
8030 0 0         want_covar = (int)SvIV(ST(11))
8031             ;
8032 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8033 0           work_SV = sv_newmortal();
8034 0           work = PDL->null();
8035 0           PDL->SetSV_PDL(work_SV,work);
8036 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8037             } else {
8038 0 0         PUSHMARK(SP);
8039 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8040 0           PUTBACK;
8041 0           perl_call_method("initialize", G_SCALAR);
8042 0           SPAGAIN;
8043 0           work_SV = POPs;
8044 0           PUTBACK;
8045 0           work = PDL->SvPDLV(work_SV);
8046             }
8047 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8048 0           covar_SV = sv_newmortal();
8049 0           covar = PDL->null();
8050 0           PDL->SetSV_PDL(covar_SV,covar);
8051 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
8052             } else {
8053 0 0         PUSHMARK(SP);
8054 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8055 0           PUTBACK;
8056 0           perl_call_method("initialize", G_SCALAR);
8057 0           SPAGAIN;
8058 0           covar_SV = POPs;
8059 0           PUTBACK;
8060 0           covar = PDL->SvPDLV(covar_SV);
8061             }
8062 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8063 0           returnval_SV = sv_newmortal();
8064 0           returnval = PDL->null();
8065 0           PDL->SetSV_PDL(returnval_SV,returnval);
8066 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
8067             } else {
8068 0 0         PUSHMARK(SP);
8069 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8070 0           PUTBACK;
8071 0           perl_call_method("initialize", G_SCALAR);
8072 0           SPAGAIN;
8073 0           returnval_SV = POPs;
8074 0           PUTBACK;
8075 0           returnval = PDL->SvPDLV(returnval_SV);
8076             }
8077 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8078 0           pout_SV = sv_newmortal();
8079 0           pout = PDL->null();
8080 0           PDL->SetSV_PDL(pout_SV,pout);
8081 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
8082             } else {
8083 0 0         PUSHMARK(SP);
8084 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8085 0           PUTBACK;
8086 0           perl_call_method("initialize", G_SCALAR);
8087 0           SPAGAIN;
8088 0           pout_SV = POPs;
8089 0           PUTBACK;
8090 0           pout = PDL->SvPDLV(pout_SV);
8091             }
8092 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8093 0           info_SV = sv_newmortal();
8094 0           info = PDL->null();
8095 0           PDL->SetSV_PDL(info_SV,info);
8096 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
8097             } else {
8098 0 0         PUSHMARK(SP);
8099 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8100 0           PUTBACK;
8101 0           perl_call_method("initialize", G_SCALAR);
8102 0           SPAGAIN;
8103 0           info_SV = POPs;
8104 0           PUTBACK;
8105 0           info = PDL->SvPDLV(info_SV);
8106             }
8107             }
8108             else {
8109 0           croak ("Usage: PDL::levmar_der_lb(p,x,t,lb,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave temporaries or output variables out of list)");
8110             }
8111             }
8112             {
8113             }
8114             { pdl_levmar_der_lb_struct *__privtrans;
8115 0           int badflag_cache = 0;
8116 0           __privtrans = malloc(sizeof(*__privtrans));
8117 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
8118 0           PDL_TR_SETMAGIC(__privtrans);
8119 0           __privtrans->flags = 0;
8120 0           __privtrans->__ddone = 0;
8121 0           __privtrans->vtable = &pdl_levmar_der_lb_vtable;
8122 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
8123 0           __privtrans->bvalflag = 0;
8124 0 0         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((lb->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
8125 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
8126 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
8127 0           __privtrans->__datatype = p->datatype;
8128             }
8129 0 0         if(__privtrans->__datatype < x->datatype) {
8130 0           __privtrans->__datatype = x->datatype;
8131             }
8132 0 0         if(__privtrans->__datatype < t->datatype) {
8133 0           __privtrans->__datatype = t->datatype;
8134             }
8135 0 0         if(__privtrans->__datatype < lb->datatype) {
8136 0           __privtrans->__datatype = lb->datatype;
8137             }
8138 0 0         if(__privtrans->__datatype < opts->datatype) {
8139 0           __privtrans->__datatype = opts->datatype;
8140             }
8141 0 0         if(!((work->state & PDL_NOMYDIMS) &&
    0          
8142 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
8143 0           __privtrans->__datatype = work->datatype;
8144             }
8145 0 0         if(!((covar->state & PDL_NOMYDIMS) &&
    0          
8146 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
8147 0           __privtrans->__datatype = covar->datatype;
8148             }
8149 0 0         if(!((pout->state & PDL_NOMYDIMS) &&
    0          
8150 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
8151 0           __privtrans->__datatype = pout->datatype;
8152             }
8153 0 0         if(!((info->state & PDL_NOMYDIMS) &&
    0          
8154 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
8155 0           __privtrans->__datatype = info->datatype;
8156             }
8157 0 0         if(__privtrans->__datatype == PDL_F) {}
8158 0 0         else if(__privtrans->__datatype == PDL_D) {}
8159 0           else __privtrans->__datatype = PDL_D;
8160 0 0         if(__privtrans->__datatype != p->datatype) {
8161 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
8162 0 0         }if(__privtrans->__datatype != x->datatype) {
8163 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
8164 0 0         }if(__privtrans->__datatype != t->datatype) {
8165 0           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
8166 0 0         }if(__privtrans->__datatype != lb->datatype) {
8167 0           lb = PDL->get_convertedpdl(lb,__privtrans->__datatype);
8168 0 0         }if(PDL_L != iopts->datatype) {
8169 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
8170 0 0         }if(__privtrans->__datatype != opts->datatype) {
8171 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
8172 0 0         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    0          
8173 0           work->datatype = __privtrans->__datatype;
8174 0 0         } else if(__privtrans->__datatype != work->datatype) {
8175 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
8176 0 0         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    0          
8177 0           covar->datatype = __privtrans->__datatype;
8178 0 0         } else if(__privtrans->__datatype != covar->datatype) {
8179 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
8180 0 0         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    0          
8181 0           returnval->datatype = PDL_L;
8182 0 0         } else if(PDL_L != returnval->datatype) {
8183 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
8184 0 0         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    0          
8185 0           pout->datatype = __privtrans->__datatype;
8186 0 0         } else if(__privtrans->__datatype != pout->datatype) {
8187 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
8188 0 0         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    0          
8189 0           info->datatype = __privtrans->__datatype;
8190 0 0         } else if(__privtrans->__datatype != info->datatype) {
8191 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
8192 0           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->jacn) = (jacn);(__privtrans->sjacn) = (sjacn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
8193 0           __privtrans->pdls[1] = x;
8194 0           __privtrans->pdls[2] = t;
8195 0           __privtrans->pdls[3] = lb;
8196 0           __privtrans->pdls[4] = iopts;
8197 0           __privtrans->pdls[5] = opts;
8198 0           __privtrans->pdls[6] = work;
8199 0           __privtrans->pdls[7] = covar;
8200 0           __privtrans->pdls[8] = returnval;
8201 0           __privtrans->pdls[9] = pout;
8202 0           __privtrans->pdls[10] = info;
8203 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
8204 0 0         if (badflag_cache) {
8205 0           covar->state |= PDL_BADVAL;
8206 0           returnval->state |= PDL_BADVAL;
8207 0           pout->state |= PDL_BADVAL;
8208 0           info->state |= PDL_BADVAL;
8209             }
8210 0 0         if (nreturn) {
8211 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
8212 0           ST(0) = covar_SV;
8213 0           ST(1) = returnval_SV;
8214 0           ST(2) = pout_SV;
8215 0           ST(3) = info_SV;
8216 0           XSRETURN(nreturn);
8217             } else {
8218 0           XSRETURN(0);
8219             }
8220             }
8221              
8222             void
8223             levmar_der_lb_ub(...)
8224             PREINIT:
8225 9           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
8226             by pp_bless ? (CS) */
8227 9           HV *bless_stash = 0;
8228 9           SV *parent = 0;
8229             int nreturn;
8230             SV *work_SV;
8231             SV *covar_SV;
8232             SV *returnval_SV;
8233             SV *pout_SV;
8234             SV *info_SV;
8235             pdl *p;
8236             pdl *x;
8237             pdl *t;
8238             pdl *lb;
8239             pdl *ub;
8240             pdl *iopts;
8241             pdl *opts;
8242             pdl *work;
8243             pdl *covar;
8244             pdl *returnval;
8245             pdl *pout;
8246             pdl *info;
8247             IV funcn;
8248             IV sfuncn;
8249             IV jacn;
8250             IV sjacn;
8251             IV indat;
8252             int want_covar;
8253             PPCODE:
8254             {
8255             PDL_COMMENT("Check if you can get a package name for this input value. ")
8256             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
8257             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
8258 9 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
8259 9           parent = ST(0);
8260 9 50         if (sv_isobject(parent)){
8261 9           bless_stash = SvSTASH(SvRV(ST(0)));
8262 9 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
8263             }
8264             }
8265 9 50         if (items == 18) { PDL_COMMENT("all variables on stack, read in output and temp vars")
8266 9           nreturn = 0;
8267 9           p = PDL->SvPDLV(ST(0));
8268 9           x = PDL->SvPDLV(ST(1));
8269 9           t = PDL->SvPDLV(ST(2));
8270 9           lb = PDL->SvPDLV(ST(3));
8271 9           ub = PDL->SvPDLV(ST(4));
8272 9           iopts = PDL->SvPDLV(ST(5));
8273 9           opts = PDL->SvPDLV(ST(6));
8274 9           work = PDL->SvPDLV(ST(7));
8275 9           covar = PDL->SvPDLV(ST(8));
8276 9           returnval = PDL->SvPDLV(ST(9));
8277 9           pout = PDL->SvPDLV(ST(10));
8278 9           info = PDL->SvPDLV(ST(11));
8279 9 50         funcn = (IV)SvIV(ST(12))
8280             ;
8281 9 50         sfuncn = (IV)SvIV(ST(13))
8282             ;
8283 9 50         jacn = (IV)SvIV(ST(14))
8284             ;
8285 9 50         sjacn = (IV)SvIV(ST(15))
8286             ;
8287 9 50         indat = (IV)SvIV(ST(16))
8288             ;
8289 9 50         want_covar = (int)SvIV(ST(17))
8290             ;
8291             }
8292 0 0         else if (items == 17) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
8293 0           p = PDL->SvPDLV(ST(0));
8294 0           x = PDL->SvPDLV(ST(1));
8295 0           t = PDL->SvPDLV(ST(2));
8296 0           lb = PDL->SvPDLV(ST(3));
8297 0           ub = PDL->SvPDLV(ST(4));
8298 0           iopts = PDL->SvPDLV(ST(5));
8299 0           opts = PDL->SvPDLV(ST(6));
8300 0           covar = PDL->SvPDLV(ST(7));
8301 0           returnval = PDL->SvPDLV(ST(8));
8302 0           pout = PDL->SvPDLV(ST(9));
8303 0           info = PDL->SvPDLV(ST(10));
8304 0 0         funcn = (IV)SvIV(ST(11))
8305             ;
8306 0 0         sfuncn = (IV)SvIV(ST(12))
8307             ;
8308 0 0         jacn = (IV)SvIV(ST(13))
8309             ;
8310 0 0         sjacn = (IV)SvIV(ST(14))
8311             ;
8312 0 0         indat = (IV)SvIV(ST(15))
8313             ;
8314 0 0         want_covar = (int)SvIV(ST(16))
8315             ;
8316 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8317 0           work_SV = sv_newmortal();
8318 0           work = PDL->null();
8319 0           PDL->SetSV_PDL(work_SV,work);
8320 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8321             } else {
8322 0 0         PUSHMARK(SP);
8323 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8324 0           PUTBACK;
8325 0           perl_call_method("initialize", G_SCALAR);
8326 0           SPAGAIN;
8327 0           work_SV = POPs;
8328 0           PUTBACK;
8329 0           work = PDL->SvPDLV(work_SV);
8330             }
8331             }
8332 0 0         else if (items == 13) { PDL_COMMENT("only input variables on stack, create outputs and temps")
8333 0           nreturn = 4;
8334 0           p = PDL->SvPDLV(ST(0));
8335 0           x = PDL->SvPDLV(ST(1));
8336 0           t = PDL->SvPDLV(ST(2));
8337 0           lb = PDL->SvPDLV(ST(3));
8338 0           ub = PDL->SvPDLV(ST(4));
8339 0           iopts = PDL->SvPDLV(ST(5));
8340 0           opts = PDL->SvPDLV(ST(6));
8341 0 0         funcn = (IV)SvIV(ST(7))
8342             ;
8343 0 0         sfuncn = (IV)SvIV(ST(8))
8344             ;
8345 0 0         jacn = (IV)SvIV(ST(9))
8346             ;
8347 0 0         sjacn = (IV)SvIV(ST(10))
8348             ;
8349 0 0         indat = (IV)SvIV(ST(11))
8350             ;
8351 0 0         want_covar = (int)SvIV(ST(12))
8352             ;
8353 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8354 0           work_SV = sv_newmortal();
8355 0           work = PDL->null();
8356 0           PDL->SetSV_PDL(work_SV,work);
8357 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8358             } else {
8359 0 0         PUSHMARK(SP);
8360 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8361 0           PUTBACK;
8362 0           perl_call_method("initialize", G_SCALAR);
8363 0           SPAGAIN;
8364 0           work_SV = POPs;
8365 0           PUTBACK;
8366 0           work = PDL->SvPDLV(work_SV);
8367             }
8368 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8369 0           covar_SV = sv_newmortal();
8370 0           covar = PDL->null();
8371 0           PDL->SetSV_PDL(covar_SV,covar);
8372 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
8373             } else {
8374 0 0         PUSHMARK(SP);
8375 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8376 0           PUTBACK;
8377 0           perl_call_method("initialize", G_SCALAR);
8378 0           SPAGAIN;
8379 0           covar_SV = POPs;
8380 0           PUTBACK;
8381 0           covar = PDL->SvPDLV(covar_SV);
8382             }
8383 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8384 0           returnval_SV = sv_newmortal();
8385 0           returnval = PDL->null();
8386 0           PDL->SetSV_PDL(returnval_SV,returnval);
8387 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
8388             } else {
8389 0 0         PUSHMARK(SP);
8390 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8391 0           PUTBACK;
8392 0           perl_call_method("initialize", G_SCALAR);
8393 0           SPAGAIN;
8394 0           returnval_SV = POPs;
8395 0           PUTBACK;
8396 0           returnval = PDL->SvPDLV(returnval_SV);
8397             }
8398 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8399 0           pout_SV = sv_newmortal();
8400 0           pout = PDL->null();
8401 0           PDL->SetSV_PDL(pout_SV,pout);
8402 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
8403             } else {
8404 0 0         PUSHMARK(SP);
8405 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8406 0           PUTBACK;
8407 0           perl_call_method("initialize", G_SCALAR);
8408 0           SPAGAIN;
8409 0           pout_SV = POPs;
8410 0           PUTBACK;
8411 0           pout = PDL->SvPDLV(pout_SV);
8412             }
8413 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8414 0           info_SV = sv_newmortal();
8415 0           info = PDL->null();
8416 0           PDL->SetSV_PDL(info_SV,info);
8417 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
8418             } else {
8419 0 0         PUSHMARK(SP);
8420 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8421 0           PUTBACK;
8422 0           perl_call_method("initialize", G_SCALAR);
8423 0           SPAGAIN;
8424 0           info_SV = POPs;
8425 0           PUTBACK;
8426 0           info = PDL->SvPDLV(info_SV);
8427             }
8428             }
8429             else {
8430 0           croak ("Usage: PDL::levmar_der_lb_ub(p,x,t,lb,ub,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave temporaries or output variables out of list)");
8431             }
8432             }
8433             {
8434             }
8435             { pdl_levmar_der_lb_ub_struct *__privtrans;
8436 9           int badflag_cache = 0;
8437 9           __privtrans = malloc(sizeof(*__privtrans));
8438 9           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
8439 9           PDL_TR_SETMAGIC(__privtrans);
8440 9           __privtrans->flags = 0;
8441 9           __privtrans->__ddone = 0;
8442 9           __privtrans->vtable = &pdl_levmar_der_lb_ub_vtable;
8443 9           __privtrans->freeproc = PDL->trans_mallocfreeproc;
8444 9           __privtrans->bvalflag = 0;
8445 9 50         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((lb->state & PDL_BADVAL) > 0) || ((ub->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
    50          
    50          
8446 9 50         if (badflag_cache) __privtrans->bvalflag = 1;
8447 9 50         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
8448 9           __privtrans->__datatype = p->datatype;
8449             }
8450 9 50         if(__privtrans->__datatype < x->datatype) {
8451 0           __privtrans->__datatype = x->datatype;
8452             }
8453 9 50         if(__privtrans->__datatype < t->datatype) {
8454 0           __privtrans->__datatype = t->datatype;
8455             }
8456 9 50         if(__privtrans->__datatype < lb->datatype) {
8457 0           __privtrans->__datatype = lb->datatype;
8458             }
8459 9 50         if(__privtrans->__datatype < ub->datatype) {
8460 0           __privtrans->__datatype = ub->datatype;
8461             }
8462 9 50         if(__privtrans->__datatype < opts->datatype) {
8463 0           __privtrans->__datatype = opts->datatype;
8464             }
8465 9 50         if(!((work->state & PDL_NOMYDIMS) &&
    50          
8466 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
8467 0           __privtrans->__datatype = work->datatype;
8468             }
8469 9 50         if(!((covar->state & PDL_NOMYDIMS) &&
    50          
8470 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
8471 0           __privtrans->__datatype = covar->datatype;
8472             }
8473 9 50         if(!((pout->state & PDL_NOMYDIMS) &&
    50          
8474 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
8475 0           __privtrans->__datatype = pout->datatype;
8476             }
8477 9 50         if(!((info->state & PDL_NOMYDIMS) &&
    50          
8478 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
8479 0           __privtrans->__datatype = info->datatype;
8480             }
8481 9 100         if(__privtrans->__datatype == PDL_F) {}
8482 6 50         else if(__privtrans->__datatype == PDL_D) {}
8483 0           else __privtrans->__datatype = PDL_D;
8484 9 50         if(__privtrans->__datatype != p->datatype) {
8485 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
8486 9 100         }if(__privtrans->__datatype != x->datatype) {
8487 1           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
8488 9 100         }if(__privtrans->__datatype != t->datatype) {
8489 8           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
8490 9 100         }if(__privtrans->__datatype != lb->datatype) {
8491 1           lb = PDL->get_convertedpdl(lb,__privtrans->__datatype);
8492 9 100         }if(__privtrans->__datatype != ub->datatype) {
8493 1           ub = PDL->get_convertedpdl(ub,__privtrans->__datatype);
8494 9 50         }if(PDL_L != iopts->datatype) {
8495 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
8496 9 50         }if(__privtrans->__datatype != opts->datatype) {
8497 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
8498 9 50         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    50          
8499 9           work->datatype = __privtrans->__datatype;
8500 0 0         } else if(__privtrans->__datatype != work->datatype) {
8501 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
8502 9 50         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    50          
8503 9           covar->datatype = __privtrans->__datatype;
8504 0 0         } else if(__privtrans->__datatype != covar->datatype) {
8505 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
8506 9 50         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    50          
8507 9           returnval->datatype = PDL_L;
8508 0 0         } else if(PDL_L != returnval->datatype) {
8509 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
8510 9 50         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    50          
8511 9           pout->datatype = __privtrans->__datatype;
8512 0 0         } else if(__privtrans->__datatype != pout->datatype) {
8513 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
8514 9 50         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    50          
8515 9           info->datatype = __privtrans->__datatype;
8516 0 0         } else if(__privtrans->__datatype != info->datatype) {
8517 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
8518 9           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->jacn) = (jacn);(__privtrans->sjacn) = (sjacn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
8519 9           __privtrans->pdls[1] = x;
8520 9           __privtrans->pdls[2] = t;
8521 9           __privtrans->pdls[3] = lb;
8522 9           __privtrans->pdls[4] = ub;
8523 9           __privtrans->pdls[5] = iopts;
8524 9           __privtrans->pdls[6] = opts;
8525 9           __privtrans->pdls[7] = work;
8526 9           __privtrans->pdls[8] = covar;
8527 9           __privtrans->pdls[9] = returnval;
8528 9           __privtrans->pdls[10] = pout;
8529 9           __privtrans->pdls[11] = info;
8530 9           PDL->make_trans_mutual((pdl_trans *)__privtrans);
8531 9 50         if (badflag_cache) {
8532 0           covar->state |= PDL_BADVAL;
8533 0           returnval->state |= PDL_BADVAL;
8534 0           pout->state |= PDL_BADVAL;
8535 0           info->state |= PDL_BADVAL;
8536             }
8537 9 50         if (nreturn) {
8538 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
8539 0           ST(0) = covar_SV;
8540 0           ST(1) = returnval_SV;
8541 0           ST(2) = pout_SV;
8542 0           ST(3) = info_SV;
8543 0           XSRETURN(nreturn);
8544             } else {
8545 9           XSRETURN(0);
8546             }
8547             }
8548              
8549             void
8550             levmar_der_ub(...)
8551             PREINIT:
8552 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
8553             by pp_bless ? (CS) */
8554 0           HV *bless_stash = 0;
8555 0           SV *parent = 0;
8556             int nreturn;
8557             SV *work_SV;
8558             SV *covar_SV;
8559             SV *returnval_SV;
8560             SV *pout_SV;
8561             SV *info_SV;
8562             pdl *p;
8563             pdl *x;
8564             pdl *t;
8565             pdl *ub;
8566             pdl *iopts;
8567             pdl *opts;
8568             pdl *work;
8569             pdl *covar;
8570             pdl *returnval;
8571             pdl *pout;
8572             pdl *info;
8573             IV funcn;
8574             IV sfuncn;
8575             IV jacn;
8576             IV sjacn;
8577             IV indat;
8578             int want_covar;
8579             PPCODE:
8580             {
8581             PDL_COMMENT("Check if you can get a package name for this input value. ")
8582             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
8583             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
8584 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
8585 0           parent = ST(0);
8586 0 0         if (sv_isobject(parent)){
8587 0           bless_stash = SvSTASH(SvRV(ST(0)));
8588 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
8589             }
8590             }
8591 0 0         if (items == 17) { PDL_COMMENT("all variables on stack, read in output and temp vars")
8592 0           nreturn = 0;
8593 0           p = PDL->SvPDLV(ST(0));
8594 0           x = PDL->SvPDLV(ST(1));
8595 0           t = PDL->SvPDLV(ST(2));
8596 0           ub = PDL->SvPDLV(ST(3));
8597 0           iopts = PDL->SvPDLV(ST(4));
8598 0           opts = PDL->SvPDLV(ST(5));
8599 0           work = PDL->SvPDLV(ST(6));
8600 0           covar = PDL->SvPDLV(ST(7));
8601 0           returnval = PDL->SvPDLV(ST(8));
8602 0           pout = PDL->SvPDLV(ST(9));
8603 0           info = PDL->SvPDLV(ST(10));
8604 0 0         funcn = (IV)SvIV(ST(11))
8605             ;
8606 0 0         sfuncn = (IV)SvIV(ST(12))
8607             ;
8608 0 0         jacn = (IV)SvIV(ST(13))
8609             ;
8610 0 0         sjacn = (IV)SvIV(ST(14))
8611             ;
8612 0 0         indat = (IV)SvIV(ST(15))
8613             ;
8614 0 0         want_covar = (int)SvIV(ST(16))
8615             ;
8616             }
8617 0 0         else if (items == 16) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
8618 0           p = PDL->SvPDLV(ST(0));
8619 0           x = PDL->SvPDLV(ST(1));
8620 0           t = PDL->SvPDLV(ST(2));
8621 0           ub = PDL->SvPDLV(ST(3));
8622 0           iopts = PDL->SvPDLV(ST(4));
8623 0           opts = PDL->SvPDLV(ST(5));
8624 0           covar = PDL->SvPDLV(ST(6));
8625 0           returnval = PDL->SvPDLV(ST(7));
8626 0           pout = PDL->SvPDLV(ST(8));
8627 0           info = PDL->SvPDLV(ST(9));
8628 0 0         funcn = (IV)SvIV(ST(10))
8629             ;
8630 0 0         sfuncn = (IV)SvIV(ST(11))
8631             ;
8632 0 0         jacn = (IV)SvIV(ST(12))
8633             ;
8634 0 0         sjacn = (IV)SvIV(ST(13))
8635             ;
8636 0 0         indat = (IV)SvIV(ST(14))
8637             ;
8638 0 0         want_covar = (int)SvIV(ST(15))
8639             ;
8640 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8641 0           work_SV = sv_newmortal();
8642 0           work = PDL->null();
8643 0           PDL->SetSV_PDL(work_SV,work);
8644 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8645             } else {
8646 0 0         PUSHMARK(SP);
8647 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8648 0           PUTBACK;
8649 0           perl_call_method("initialize", G_SCALAR);
8650 0           SPAGAIN;
8651 0           work_SV = POPs;
8652 0           PUTBACK;
8653 0           work = PDL->SvPDLV(work_SV);
8654             }
8655             }
8656 0 0         else if (items == 12) { PDL_COMMENT("only input variables on stack, create outputs and temps")
8657 0           nreturn = 4;
8658 0           p = PDL->SvPDLV(ST(0));
8659 0           x = PDL->SvPDLV(ST(1));
8660 0           t = PDL->SvPDLV(ST(2));
8661 0           ub = PDL->SvPDLV(ST(3));
8662 0           iopts = PDL->SvPDLV(ST(4));
8663 0           opts = PDL->SvPDLV(ST(5));
8664 0 0         funcn = (IV)SvIV(ST(6))
8665             ;
8666 0 0         sfuncn = (IV)SvIV(ST(7))
8667             ;
8668 0 0         jacn = (IV)SvIV(ST(8))
8669             ;
8670 0 0         sjacn = (IV)SvIV(ST(9))
8671             ;
8672 0 0         indat = (IV)SvIV(ST(10))
8673             ;
8674 0 0         want_covar = (int)SvIV(ST(11))
8675             ;
8676 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8677 0           work_SV = sv_newmortal();
8678 0           work = PDL->null();
8679 0           PDL->SetSV_PDL(work_SV,work);
8680 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8681             } else {
8682 0 0         PUSHMARK(SP);
8683 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8684 0           PUTBACK;
8685 0           perl_call_method("initialize", G_SCALAR);
8686 0           SPAGAIN;
8687 0           work_SV = POPs;
8688 0           PUTBACK;
8689 0           work = PDL->SvPDLV(work_SV);
8690             }
8691 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8692 0           covar_SV = sv_newmortal();
8693 0           covar = PDL->null();
8694 0           PDL->SetSV_PDL(covar_SV,covar);
8695 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
8696             } else {
8697 0 0         PUSHMARK(SP);
8698 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8699 0           PUTBACK;
8700 0           perl_call_method("initialize", G_SCALAR);
8701 0           SPAGAIN;
8702 0           covar_SV = POPs;
8703 0           PUTBACK;
8704 0           covar = PDL->SvPDLV(covar_SV);
8705             }
8706 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8707 0           returnval_SV = sv_newmortal();
8708 0           returnval = PDL->null();
8709 0           PDL->SetSV_PDL(returnval_SV,returnval);
8710 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
8711             } else {
8712 0 0         PUSHMARK(SP);
8713 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8714 0           PUTBACK;
8715 0           perl_call_method("initialize", G_SCALAR);
8716 0           SPAGAIN;
8717 0           returnval_SV = POPs;
8718 0           PUTBACK;
8719 0           returnval = PDL->SvPDLV(returnval_SV);
8720             }
8721 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8722 0           pout_SV = sv_newmortal();
8723 0           pout = PDL->null();
8724 0           PDL->SetSV_PDL(pout_SV,pout);
8725 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
8726             } else {
8727 0 0         PUSHMARK(SP);
8728 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8729 0           PUTBACK;
8730 0           perl_call_method("initialize", G_SCALAR);
8731 0           SPAGAIN;
8732 0           pout_SV = POPs;
8733 0           PUTBACK;
8734 0           pout = PDL->SvPDLV(pout_SV);
8735             }
8736 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8737 0           info_SV = sv_newmortal();
8738 0           info = PDL->null();
8739 0           PDL->SetSV_PDL(info_SV,info);
8740 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
8741             } else {
8742 0 0         PUSHMARK(SP);
8743 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8744 0           PUTBACK;
8745 0           perl_call_method("initialize", G_SCALAR);
8746 0           SPAGAIN;
8747 0           info_SV = POPs;
8748 0           PUTBACK;
8749 0           info = PDL->SvPDLV(info_SV);
8750             }
8751             }
8752             else {
8753 0           croak ("Usage: PDL::levmar_der_ub(p,x,t,ub,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave temporaries or output variables out of list)");
8754             }
8755             }
8756             {
8757             }
8758             { pdl_levmar_der_ub_struct *__privtrans;
8759 0           int badflag_cache = 0;
8760 0           __privtrans = malloc(sizeof(*__privtrans));
8761 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
8762 0           PDL_TR_SETMAGIC(__privtrans);
8763 0           __privtrans->flags = 0;
8764 0           __privtrans->__ddone = 0;
8765 0           __privtrans->vtable = &pdl_levmar_der_ub_vtable;
8766 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
8767 0           __privtrans->bvalflag = 0;
8768 0 0         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((ub->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
8769 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
8770 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
8771 0           __privtrans->__datatype = p->datatype;
8772             }
8773 0 0         if(__privtrans->__datatype < x->datatype) {
8774 0           __privtrans->__datatype = x->datatype;
8775             }
8776 0 0         if(__privtrans->__datatype < t->datatype) {
8777 0           __privtrans->__datatype = t->datatype;
8778             }
8779 0 0         if(__privtrans->__datatype < ub->datatype) {
8780 0           __privtrans->__datatype = ub->datatype;
8781             }
8782 0 0         if(__privtrans->__datatype < opts->datatype) {
8783 0           __privtrans->__datatype = opts->datatype;
8784             }
8785 0 0         if(!((work->state & PDL_NOMYDIMS) &&
    0          
8786 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
8787 0           __privtrans->__datatype = work->datatype;
8788             }
8789 0 0         if(!((covar->state & PDL_NOMYDIMS) &&
    0          
8790 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
8791 0           __privtrans->__datatype = covar->datatype;
8792             }
8793 0 0         if(!((pout->state & PDL_NOMYDIMS) &&
    0          
8794 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
8795 0           __privtrans->__datatype = pout->datatype;
8796             }
8797 0 0         if(!((info->state & PDL_NOMYDIMS) &&
    0          
8798 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
8799 0           __privtrans->__datatype = info->datatype;
8800             }
8801 0 0         if(__privtrans->__datatype == PDL_F) {}
8802 0 0         else if(__privtrans->__datatype == PDL_D) {}
8803 0           else __privtrans->__datatype = PDL_D;
8804 0 0         if(__privtrans->__datatype != p->datatype) {
8805 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
8806 0 0         }if(__privtrans->__datatype != x->datatype) {
8807 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
8808 0 0         }if(__privtrans->__datatype != t->datatype) {
8809 0           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
8810 0 0         }if(__privtrans->__datatype != ub->datatype) {
8811 0           ub = PDL->get_convertedpdl(ub,__privtrans->__datatype);
8812 0 0         }if(PDL_L != iopts->datatype) {
8813 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
8814 0 0         }if(__privtrans->__datatype != opts->datatype) {
8815 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
8816 0 0         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    0          
8817 0           work->datatype = __privtrans->__datatype;
8818 0 0         } else if(__privtrans->__datatype != work->datatype) {
8819 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
8820 0 0         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    0          
8821 0           covar->datatype = __privtrans->__datatype;
8822 0 0         } else if(__privtrans->__datatype != covar->datatype) {
8823 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
8824 0 0         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    0          
8825 0           returnval->datatype = PDL_L;
8826 0 0         } else if(PDL_L != returnval->datatype) {
8827 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
8828 0 0         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    0          
8829 0           pout->datatype = __privtrans->__datatype;
8830 0 0         } else if(__privtrans->__datatype != pout->datatype) {
8831 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
8832 0 0         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    0          
8833 0           info->datatype = __privtrans->__datatype;
8834 0 0         } else if(__privtrans->__datatype != info->datatype) {
8835 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
8836 0           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->jacn) = (jacn);(__privtrans->sjacn) = (sjacn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
8837 0           __privtrans->pdls[1] = x;
8838 0           __privtrans->pdls[2] = t;
8839 0           __privtrans->pdls[3] = ub;
8840 0           __privtrans->pdls[4] = iopts;
8841 0           __privtrans->pdls[5] = opts;
8842 0           __privtrans->pdls[6] = work;
8843 0           __privtrans->pdls[7] = covar;
8844 0           __privtrans->pdls[8] = returnval;
8845 0           __privtrans->pdls[9] = pout;
8846 0           __privtrans->pdls[10] = info;
8847 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
8848 0 0         if (badflag_cache) {
8849 0           covar->state |= PDL_BADVAL;
8850 0           returnval->state |= PDL_BADVAL;
8851 0           pout->state |= PDL_BADVAL;
8852 0           info->state |= PDL_BADVAL;
8853             }
8854 0 0         if (nreturn) {
8855 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
8856 0           ST(0) = covar_SV;
8857 0           ST(1) = returnval_SV;
8858 0           ST(2) = pout_SV;
8859 0           ST(3) = info_SV;
8860 0           XSRETURN(nreturn);
8861             } else {
8862 0           XSRETURN(0);
8863             }
8864             }
8865              
8866             void
8867             levmar_der_(...)
8868             PREINIT:
8869 60           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
8870             by pp_bless ? (CS) */
8871 60           HV *bless_stash = 0;
8872 60           SV *parent = 0;
8873             int nreturn;
8874             SV *work_SV;
8875             SV *covar_SV;
8876             SV *returnval_SV;
8877             SV *pout_SV;
8878             SV *info_SV;
8879             pdl *p;
8880             pdl *x;
8881             pdl *t;
8882             pdl *iopts;
8883             pdl *opts;
8884             pdl *work;
8885             pdl *covar;
8886             pdl *returnval;
8887             pdl *pout;
8888             pdl *info;
8889             IV funcn;
8890             IV sfuncn;
8891             IV jacn;
8892             IV sjacn;
8893             IV indat;
8894             int want_covar;
8895             PPCODE:
8896             {
8897             PDL_COMMENT("Check if you can get a package name for this input value. ")
8898             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
8899             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
8900 60 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
8901 60           parent = ST(0);
8902 60 50         if (sv_isobject(parent)){
8903 60           bless_stash = SvSTASH(SvRV(ST(0)));
8904 60 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
8905             }
8906             }
8907 60 50         if (items == 16) { PDL_COMMENT("all variables on stack, read in output and temp vars")
8908 60           nreturn = 0;
8909 60           p = PDL->SvPDLV(ST(0));
8910 60           x = PDL->SvPDLV(ST(1));
8911 60           t = PDL->SvPDLV(ST(2));
8912 60           iopts = PDL->SvPDLV(ST(3));
8913 60           opts = PDL->SvPDLV(ST(4));
8914 60           work = PDL->SvPDLV(ST(5));
8915 60           covar = PDL->SvPDLV(ST(6));
8916 60           returnval = PDL->SvPDLV(ST(7));
8917 60           pout = PDL->SvPDLV(ST(8));
8918 60           info = PDL->SvPDLV(ST(9));
8919 60 50         funcn = (IV)SvIV(ST(10))
8920             ;
8921 60 50         sfuncn = (IV)SvIV(ST(11))
8922             ;
8923 60 50         jacn = (IV)SvIV(ST(12))
8924             ;
8925 60 50         sjacn = (IV)SvIV(ST(13))
8926             ;
8927 60 50         indat = (IV)SvIV(ST(14))
8928             ;
8929 60 50         want_covar = (int)SvIV(ST(15))
8930             ;
8931             }
8932 0 0         else if (items == 15) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
8933 0           p = PDL->SvPDLV(ST(0));
8934 0           x = PDL->SvPDLV(ST(1));
8935 0           t = PDL->SvPDLV(ST(2));
8936 0           iopts = PDL->SvPDLV(ST(3));
8937 0           opts = PDL->SvPDLV(ST(4));
8938 0           covar = PDL->SvPDLV(ST(5));
8939 0           returnval = PDL->SvPDLV(ST(6));
8940 0           pout = PDL->SvPDLV(ST(7));
8941 0           info = PDL->SvPDLV(ST(8));
8942 0 0         funcn = (IV)SvIV(ST(9))
8943             ;
8944 0 0         sfuncn = (IV)SvIV(ST(10))
8945             ;
8946 0 0         jacn = (IV)SvIV(ST(11))
8947             ;
8948 0 0         sjacn = (IV)SvIV(ST(12))
8949             ;
8950 0 0         indat = (IV)SvIV(ST(13))
8951             ;
8952 0 0         want_covar = (int)SvIV(ST(14))
8953             ;
8954 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8955 0           work_SV = sv_newmortal();
8956 0           work = PDL->null();
8957 0           PDL->SetSV_PDL(work_SV,work);
8958 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8959             } else {
8960 0 0         PUSHMARK(SP);
8961 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8962 0           PUTBACK;
8963 0           perl_call_method("initialize", G_SCALAR);
8964 0           SPAGAIN;
8965 0           work_SV = POPs;
8966 0           PUTBACK;
8967 0           work = PDL->SvPDLV(work_SV);
8968             }
8969             }
8970 0 0         else if (items == 11) { PDL_COMMENT("only input variables on stack, create outputs and temps")
8971 0           nreturn = 4;
8972 0           p = PDL->SvPDLV(ST(0));
8973 0           x = PDL->SvPDLV(ST(1));
8974 0           t = PDL->SvPDLV(ST(2));
8975 0           iopts = PDL->SvPDLV(ST(3));
8976 0           opts = PDL->SvPDLV(ST(4));
8977 0 0         funcn = (IV)SvIV(ST(5))
8978             ;
8979 0 0         sfuncn = (IV)SvIV(ST(6))
8980             ;
8981 0 0         jacn = (IV)SvIV(ST(7))
8982             ;
8983 0 0         sjacn = (IV)SvIV(ST(8))
8984             ;
8985 0 0         indat = (IV)SvIV(ST(9))
8986             ;
8987 0 0         want_covar = (int)SvIV(ST(10))
8988             ;
8989 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
8990 0           work_SV = sv_newmortal();
8991 0           work = PDL->null();
8992 0           PDL->SetSV_PDL(work_SV,work);
8993 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
8994             } else {
8995 0 0         PUSHMARK(SP);
8996 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
8997 0           PUTBACK;
8998 0           perl_call_method("initialize", G_SCALAR);
8999 0           SPAGAIN;
9000 0           work_SV = POPs;
9001 0           PUTBACK;
9002 0           work = PDL->SvPDLV(work_SV);
9003             }
9004 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9005 0           covar_SV = sv_newmortal();
9006 0           covar = PDL->null();
9007 0           PDL->SetSV_PDL(covar_SV,covar);
9008 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
9009             } else {
9010 0 0         PUSHMARK(SP);
9011 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9012 0           PUTBACK;
9013 0           perl_call_method("initialize", G_SCALAR);
9014 0           SPAGAIN;
9015 0           covar_SV = POPs;
9016 0           PUTBACK;
9017 0           covar = PDL->SvPDLV(covar_SV);
9018             }
9019 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9020 0           returnval_SV = sv_newmortal();
9021 0           returnval = PDL->null();
9022 0           PDL->SetSV_PDL(returnval_SV,returnval);
9023 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
9024             } else {
9025 0 0         PUSHMARK(SP);
9026 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9027 0           PUTBACK;
9028 0           perl_call_method("initialize", G_SCALAR);
9029 0           SPAGAIN;
9030 0           returnval_SV = POPs;
9031 0           PUTBACK;
9032 0           returnval = PDL->SvPDLV(returnval_SV);
9033             }
9034 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9035 0           pout_SV = sv_newmortal();
9036 0           pout = PDL->null();
9037 0           PDL->SetSV_PDL(pout_SV,pout);
9038 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
9039             } else {
9040 0 0         PUSHMARK(SP);
9041 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9042 0           PUTBACK;
9043 0           perl_call_method("initialize", G_SCALAR);
9044 0           SPAGAIN;
9045 0           pout_SV = POPs;
9046 0           PUTBACK;
9047 0           pout = PDL->SvPDLV(pout_SV);
9048             }
9049 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9050 0           info_SV = sv_newmortal();
9051 0           info = PDL->null();
9052 0           PDL->SetSV_PDL(info_SV,info);
9053 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
9054             } else {
9055 0 0         PUSHMARK(SP);
9056 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9057 0           PUTBACK;
9058 0           perl_call_method("initialize", G_SCALAR);
9059 0           SPAGAIN;
9060 0           info_SV = POPs;
9061 0           PUTBACK;
9062 0           info = PDL->SvPDLV(info_SV);
9063             }
9064             }
9065             else {
9066 0           croak ("Usage: PDL::levmar_der_(p,x,t,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave temporaries or output variables out of list)");
9067             }
9068             }
9069             {
9070             }
9071             { pdl_levmar_der__struct *__privtrans;
9072 60           int badflag_cache = 0;
9073 60           __privtrans = malloc(sizeof(*__privtrans));
9074 60           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
9075 60           PDL_TR_SETMAGIC(__privtrans);
9076 60           __privtrans->flags = 0;
9077 60           __privtrans->__ddone = 0;
9078 60           __privtrans->vtable = &pdl_levmar_der__vtable;
9079 60           __privtrans->freeproc = PDL->trans_mallocfreeproc;
9080 60           __privtrans->bvalflag = 0;
9081 60 50         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
9082 60 50         if (badflag_cache) __privtrans->bvalflag = 1;
9083 60 50         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
9084 60           __privtrans->__datatype = p->datatype;
9085             }
9086 60 50         if(__privtrans->__datatype < x->datatype) {
9087 0           __privtrans->__datatype = x->datatype;
9088             }
9089 60 50         if(__privtrans->__datatype < t->datatype) {
9090 0           __privtrans->__datatype = t->datatype;
9091             }
9092 60 50         if(__privtrans->__datatype < opts->datatype) {
9093 0           __privtrans->__datatype = opts->datatype;
9094             }
9095 60 100         if(!((work->state & PDL_NOMYDIMS) &&
    50          
9096 1 50         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
9097 0           __privtrans->__datatype = work->datatype;
9098             }
9099 60 100         if(!((covar->state & PDL_NOMYDIMS) &&
    50          
9100 1 50         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
9101 0           __privtrans->__datatype = covar->datatype;
9102             }
9103 60 50         if(!((pout->state & PDL_NOMYDIMS) &&
    50          
9104 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
9105 0           __privtrans->__datatype = pout->datatype;
9106             }
9107 60 50         if(!((info->state & PDL_NOMYDIMS) &&
    50          
9108 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
9109 0           __privtrans->__datatype = info->datatype;
9110             }
9111 60 100         if(__privtrans->__datatype == PDL_F) {}
9112 54 50         else if(__privtrans->__datatype == PDL_D) {}
9113 0           else __privtrans->__datatype = PDL_D;
9114 60 50         if(__privtrans->__datatype != p->datatype) {
9115 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
9116 60 50         }if(__privtrans->__datatype != x->datatype) {
9117 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
9118 60 100         }if(__privtrans->__datatype != t->datatype) {
9119 12           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
9120 60 50         }if(PDL_L != iopts->datatype) {
9121 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
9122 60 50         }if(__privtrans->__datatype != opts->datatype) {
9123 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
9124 60 100         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    50          
9125 59           work->datatype = __privtrans->__datatype;
9126 1 50         } else if(__privtrans->__datatype != work->datatype) {
9127 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
9128 60 100         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    50          
9129 59           covar->datatype = __privtrans->__datatype;
9130 1 50         } else if(__privtrans->__datatype != covar->datatype) {
9131 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
9132 60 50         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    50          
9133 60           returnval->datatype = PDL_L;
9134 0 0         } else if(PDL_L != returnval->datatype) {
9135 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
9136 60 50         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    50          
9137 60           pout->datatype = __privtrans->__datatype;
9138 0 0         } else if(__privtrans->__datatype != pout->datatype) {
9139 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
9140 60 50         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    50          
9141 60           info->datatype = __privtrans->__datatype;
9142 0 0         } else if(__privtrans->__datatype != info->datatype) {
9143 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
9144 60           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->jacn) = (jacn);(__privtrans->sjacn) = (sjacn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
9145 60           __privtrans->pdls[1] = x;
9146 60           __privtrans->pdls[2] = t;
9147 60           __privtrans->pdls[3] = iopts;
9148 60           __privtrans->pdls[4] = opts;
9149 60           __privtrans->pdls[5] = work;
9150 60           __privtrans->pdls[6] = covar;
9151 60           __privtrans->pdls[7] = returnval;
9152 60           __privtrans->pdls[8] = pout;
9153 60           __privtrans->pdls[9] = info;
9154 60           PDL->make_trans_mutual((pdl_trans *)__privtrans);
9155 60 50         if (badflag_cache) {
9156 0           covar->state |= PDL_BADVAL;
9157 0           returnval->state |= PDL_BADVAL;
9158 0           pout->state |= PDL_BADVAL;
9159 0           info->state |= PDL_BADVAL;
9160             }
9161 60 50         if (nreturn) {
9162 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
9163 0           ST(0) = covar_SV;
9164 0           ST(1) = returnval_SV;
9165 0           ST(2) = pout_SV;
9166 0           ST(3) = info_SV;
9167 0           XSRETURN(nreturn);
9168             } else {
9169 60           XSRETURN(0);
9170             }
9171             }
9172              
9173             void
9174             levmar_diff_lb(...)
9175             PREINIT:
9176 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
9177             by pp_bless ? (CS) */
9178 0           HV *bless_stash = 0;
9179 0           SV *parent = 0;
9180             int nreturn;
9181             SV *work_SV;
9182             SV *covar_SV;
9183             SV *returnval_SV;
9184             SV *pout_SV;
9185             SV *info_SV;
9186             pdl *p;
9187             pdl *x;
9188             pdl *t;
9189             pdl *lb;
9190             pdl *iopts;
9191             pdl *opts;
9192             pdl *work;
9193             pdl *covar;
9194             pdl *returnval;
9195             pdl *pout;
9196             pdl *info;
9197             IV funcn;
9198             IV sfuncn;
9199             IV indat;
9200             int want_covar;
9201             PPCODE:
9202             {
9203             PDL_COMMENT("Check if you can get a package name for this input value. ")
9204             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
9205             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
9206 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
9207 0           parent = ST(0);
9208 0 0         if (sv_isobject(parent)){
9209 0           bless_stash = SvSTASH(SvRV(ST(0)));
9210 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
9211             }
9212             }
9213 0 0         if (items == 15) { PDL_COMMENT("all variables on stack, read in output and temp vars")
9214 0           nreturn = 0;
9215 0           p = PDL->SvPDLV(ST(0));
9216 0           x = PDL->SvPDLV(ST(1));
9217 0           t = PDL->SvPDLV(ST(2));
9218 0           lb = PDL->SvPDLV(ST(3));
9219 0           iopts = PDL->SvPDLV(ST(4));
9220 0           opts = PDL->SvPDLV(ST(5));
9221 0           work = PDL->SvPDLV(ST(6));
9222 0           covar = PDL->SvPDLV(ST(7));
9223 0           returnval = PDL->SvPDLV(ST(8));
9224 0           pout = PDL->SvPDLV(ST(9));
9225 0           info = PDL->SvPDLV(ST(10));
9226 0 0         funcn = (IV)SvIV(ST(11))
9227             ;
9228 0 0         sfuncn = (IV)SvIV(ST(12))
9229             ;
9230 0 0         indat = (IV)SvIV(ST(13))
9231             ;
9232 0 0         want_covar = (int)SvIV(ST(14))
9233             ;
9234             }
9235 0 0         else if (items == 14) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
9236 0           p = PDL->SvPDLV(ST(0));
9237 0           x = PDL->SvPDLV(ST(1));
9238 0           t = PDL->SvPDLV(ST(2));
9239 0           lb = PDL->SvPDLV(ST(3));
9240 0           iopts = PDL->SvPDLV(ST(4));
9241 0           opts = PDL->SvPDLV(ST(5));
9242 0           covar = PDL->SvPDLV(ST(6));
9243 0           returnval = PDL->SvPDLV(ST(7));
9244 0           pout = PDL->SvPDLV(ST(8));
9245 0           info = PDL->SvPDLV(ST(9));
9246 0 0         funcn = (IV)SvIV(ST(10))
9247             ;
9248 0 0         sfuncn = (IV)SvIV(ST(11))
9249             ;
9250 0 0         indat = (IV)SvIV(ST(12))
9251             ;
9252 0 0         want_covar = (int)SvIV(ST(13))
9253             ;
9254 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9255 0           work_SV = sv_newmortal();
9256 0           work = PDL->null();
9257 0           PDL->SetSV_PDL(work_SV,work);
9258 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9259             } else {
9260 0 0         PUSHMARK(SP);
9261 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9262 0           PUTBACK;
9263 0           perl_call_method("initialize", G_SCALAR);
9264 0           SPAGAIN;
9265 0           work_SV = POPs;
9266 0           PUTBACK;
9267 0           work = PDL->SvPDLV(work_SV);
9268             }
9269             }
9270 0 0         else if (items == 10) { PDL_COMMENT("only input variables on stack, create outputs and temps")
9271 0           nreturn = 4;
9272 0           p = PDL->SvPDLV(ST(0));
9273 0           x = PDL->SvPDLV(ST(1));
9274 0           t = PDL->SvPDLV(ST(2));
9275 0           lb = PDL->SvPDLV(ST(3));
9276 0           iopts = PDL->SvPDLV(ST(4));
9277 0           opts = PDL->SvPDLV(ST(5));
9278 0 0         funcn = (IV)SvIV(ST(6))
9279             ;
9280 0 0         sfuncn = (IV)SvIV(ST(7))
9281             ;
9282 0 0         indat = (IV)SvIV(ST(8))
9283             ;
9284 0 0         want_covar = (int)SvIV(ST(9))
9285             ;
9286 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9287 0           work_SV = sv_newmortal();
9288 0           work = PDL->null();
9289 0           PDL->SetSV_PDL(work_SV,work);
9290 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9291             } else {
9292 0 0         PUSHMARK(SP);
9293 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9294 0           PUTBACK;
9295 0           perl_call_method("initialize", G_SCALAR);
9296 0           SPAGAIN;
9297 0           work_SV = POPs;
9298 0           PUTBACK;
9299 0           work = PDL->SvPDLV(work_SV);
9300             }
9301 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9302 0           covar_SV = sv_newmortal();
9303 0           covar = PDL->null();
9304 0           PDL->SetSV_PDL(covar_SV,covar);
9305 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
9306             } else {
9307 0 0         PUSHMARK(SP);
9308 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9309 0           PUTBACK;
9310 0           perl_call_method("initialize", G_SCALAR);
9311 0           SPAGAIN;
9312 0           covar_SV = POPs;
9313 0           PUTBACK;
9314 0           covar = PDL->SvPDLV(covar_SV);
9315             }
9316 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9317 0           returnval_SV = sv_newmortal();
9318 0           returnval = PDL->null();
9319 0           PDL->SetSV_PDL(returnval_SV,returnval);
9320 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
9321             } else {
9322 0 0         PUSHMARK(SP);
9323 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9324 0           PUTBACK;
9325 0           perl_call_method("initialize", G_SCALAR);
9326 0           SPAGAIN;
9327 0           returnval_SV = POPs;
9328 0           PUTBACK;
9329 0           returnval = PDL->SvPDLV(returnval_SV);
9330             }
9331 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9332 0           pout_SV = sv_newmortal();
9333 0           pout = PDL->null();
9334 0           PDL->SetSV_PDL(pout_SV,pout);
9335 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
9336             } else {
9337 0 0         PUSHMARK(SP);
9338 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9339 0           PUTBACK;
9340 0           perl_call_method("initialize", G_SCALAR);
9341 0           SPAGAIN;
9342 0           pout_SV = POPs;
9343 0           PUTBACK;
9344 0           pout = PDL->SvPDLV(pout_SV);
9345             }
9346 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9347 0           info_SV = sv_newmortal();
9348 0           info = PDL->null();
9349 0           PDL->SetSV_PDL(info_SV,info);
9350 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
9351             } else {
9352 0 0         PUSHMARK(SP);
9353 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9354 0           PUTBACK;
9355 0           perl_call_method("initialize", G_SCALAR);
9356 0           SPAGAIN;
9357 0           info_SV = POPs;
9358 0           PUTBACK;
9359 0           info = PDL->SvPDLV(info_SV);
9360             }
9361             }
9362             else {
9363 0           croak ("Usage: PDL::levmar_diff_lb(p,x,t,lb,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar) (you may leave temporaries or output variables out of list)");
9364             }
9365             }
9366             {
9367             }
9368             { pdl_levmar_diff_lb_struct *__privtrans;
9369 0           int badflag_cache = 0;
9370 0           __privtrans = malloc(sizeof(*__privtrans));
9371 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
9372 0           PDL_TR_SETMAGIC(__privtrans);
9373 0           __privtrans->flags = 0;
9374 0           __privtrans->__ddone = 0;
9375 0           __privtrans->vtable = &pdl_levmar_diff_lb_vtable;
9376 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
9377 0           __privtrans->bvalflag = 0;
9378 0 0         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((lb->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
9379 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
9380 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
9381 0           __privtrans->__datatype = p->datatype;
9382             }
9383 0 0         if(__privtrans->__datatype < x->datatype) {
9384 0           __privtrans->__datatype = x->datatype;
9385             }
9386 0 0         if(__privtrans->__datatype < t->datatype) {
9387 0           __privtrans->__datatype = t->datatype;
9388             }
9389 0 0         if(__privtrans->__datatype < lb->datatype) {
9390 0           __privtrans->__datatype = lb->datatype;
9391             }
9392 0 0         if(__privtrans->__datatype < opts->datatype) {
9393 0           __privtrans->__datatype = opts->datatype;
9394             }
9395 0 0         if(!((work->state & PDL_NOMYDIMS) &&
    0          
9396 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
9397 0           __privtrans->__datatype = work->datatype;
9398             }
9399 0 0         if(!((covar->state & PDL_NOMYDIMS) &&
    0          
9400 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
9401 0           __privtrans->__datatype = covar->datatype;
9402             }
9403 0 0         if(!((pout->state & PDL_NOMYDIMS) &&
    0          
9404 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
9405 0           __privtrans->__datatype = pout->datatype;
9406             }
9407 0 0         if(!((info->state & PDL_NOMYDIMS) &&
    0          
9408 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
9409 0           __privtrans->__datatype = info->datatype;
9410             }
9411 0 0         if(__privtrans->__datatype == PDL_F) {}
9412 0 0         else if(__privtrans->__datatype == PDL_D) {}
9413 0           else __privtrans->__datatype = PDL_D;
9414 0 0         if(__privtrans->__datatype != p->datatype) {
9415 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
9416 0 0         }if(__privtrans->__datatype != x->datatype) {
9417 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
9418 0 0         }if(__privtrans->__datatype != t->datatype) {
9419 0           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
9420 0 0         }if(__privtrans->__datatype != lb->datatype) {
9421 0           lb = PDL->get_convertedpdl(lb,__privtrans->__datatype);
9422 0 0         }if(PDL_L != iopts->datatype) {
9423 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
9424 0 0         }if(__privtrans->__datatype != opts->datatype) {
9425 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
9426 0 0         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    0          
9427 0           work->datatype = __privtrans->__datatype;
9428 0 0         } else if(__privtrans->__datatype != work->datatype) {
9429 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
9430 0 0         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    0          
9431 0           covar->datatype = __privtrans->__datatype;
9432 0 0         } else if(__privtrans->__datatype != covar->datatype) {
9433 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
9434 0 0         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    0          
9435 0           returnval->datatype = PDL_L;
9436 0 0         } else if(PDL_L != returnval->datatype) {
9437 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
9438 0 0         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    0          
9439 0           pout->datatype = __privtrans->__datatype;
9440 0 0         } else if(__privtrans->__datatype != pout->datatype) {
9441 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
9442 0 0         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    0          
9443 0           info->datatype = __privtrans->__datatype;
9444 0 0         } else if(__privtrans->__datatype != info->datatype) {
9445 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
9446 0           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
9447 0           __privtrans->pdls[1] = x;
9448 0           __privtrans->pdls[2] = t;
9449 0           __privtrans->pdls[3] = lb;
9450 0           __privtrans->pdls[4] = iopts;
9451 0           __privtrans->pdls[5] = opts;
9452 0           __privtrans->pdls[6] = work;
9453 0           __privtrans->pdls[7] = covar;
9454 0           __privtrans->pdls[8] = returnval;
9455 0           __privtrans->pdls[9] = pout;
9456 0           __privtrans->pdls[10] = info;
9457 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
9458 0 0         if (badflag_cache) {
9459 0           covar->state |= PDL_BADVAL;
9460 0           returnval->state |= PDL_BADVAL;
9461 0           pout->state |= PDL_BADVAL;
9462 0           info->state |= PDL_BADVAL;
9463             }
9464 0 0         if (nreturn) {
9465 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
9466 0           ST(0) = covar_SV;
9467 0           ST(1) = returnval_SV;
9468 0           ST(2) = pout_SV;
9469 0           ST(3) = info_SV;
9470 0           XSRETURN(nreturn);
9471             } else {
9472 0           XSRETURN(0);
9473             }
9474             }
9475              
9476             void
9477             levmar_diff_lb_ub(...)
9478             PREINIT:
9479 5           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
9480             by pp_bless ? (CS) */
9481 5           HV *bless_stash = 0;
9482 5           SV *parent = 0;
9483             int nreturn;
9484             SV *work_SV;
9485             SV *covar_SV;
9486             SV *returnval_SV;
9487             SV *pout_SV;
9488             SV *info_SV;
9489             pdl *p;
9490             pdl *x;
9491             pdl *t;
9492             pdl *lb;
9493             pdl *ub;
9494             pdl *iopts;
9495             pdl *opts;
9496             pdl *work;
9497             pdl *covar;
9498             pdl *returnval;
9499             pdl *pout;
9500             pdl *info;
9501             IV funcn;
9502             IV sfuncn;
9503             IV indat;
9504             int want_covar;
9505             PPCODE:
9506             {
9507             PDL_COMMENT("Check if you can get a package name for this input value. ")
9508             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
9509             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
9510 5 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
9511 5           parent = ST(0);
9512 5 50         if (sv_isobject(parent)){
9513 5           bless_stash = SvSTASH(SvRV(ST(0)));
9514 5 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
9515             }
9516             }
9517 5 50         if (items == 16) { PDL_COMMENT("all variables on stack, read in output and temp vars")
9518 5           nreturn = 0;
9519 5           p = PDL->SvPDLV(ST(0));
9520 5           x = PDL->SvPDLV(ST(1));
9521 5           t = PDL->SvPDLV(ST(2));
9522 5           lb = PDL->SvPDLV(ST(3));
9523 5           ub = PDL->SvPDLV(ST(4));
9524 5           iopts = PDL->SvPDLV(ST(5));
9525 5           opts = PDL->SvPDLV(ST(6));
9526 5           work = PDL->SvPDLV(ST(7));
9527 5           covar = PDL->SvPDLV(ST(8));
9528 5           returnval = PDL->SvPDLV(ST(9));
9529 5           pout = PDL->SvPDLV(ST(10));
9530 5           info = PDL->SvPDLV(ST(11));
9531 5 50         funcn = (IV)SvIV(ST(12))
9532             ;
9533 5 50         sfuncn = (IV)SvIV(ST(13))
9534             ;
9535 5 50         indat = (IV)SvIV(ST(14))
9536             ;
9537 5 50         want_covar = (int)SvIV(ST(15))
9538             ;
9539             }
9540 0 0         else if (items == 15) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
9541 0           p = PDL->SvPDLV(ST(0));
9542 0           x = PDL->SvPDLV(ST(1));
9543 0           t = PDL->SvPDLV(ST(2));
9544 0           lb = PDL->SvPDLV(ST(3));
9545 0           ub = PDL->SvPDLV(ST(4));
9546 0           iopts = PDL->SvPDLV(ST(5));
9547 0           opts = PDL->SvPDLV(ST(6));
9548 0           covar = PDL->SvPDLV(ST(7));
9549 0           returnval = PDL->SvPDLV(ST(8));
9550 0           pout = PDL->SvPDLV(ST(9));
9551 0           info = PDL->SvPDLV(ST(10));
9552 0 0         funcn = (IV)SvIV(ST(11))
9553             ;
9554 0 0         sfuncn = (IV)SvIV(ST(12))
9555             ;
9556 0 0         indat = (IV)SvIV(ST(13))
9557             ;
9558 0 0         want_covar = (int)SvIV(ST(14))
9559             ;
9560 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9561 0           work_SV = sv_newmortal();
9562 0           work = PDL->null();
9563 0           PDL->SetSV_PDL(work_SV,work);
9564 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9565             } else {
9566 0 0         PUSHMARK(SP);
9567 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9568 0           PUTBACK;
9569 0           perl_call_method("initialize", G_SCALAR);
9570 0           SPAGAIN;
9571 0           work_SV = POPs;
9572 0           PUTBACK;
9573 0           work = PDL->SvPDLV(work_SV);
9574             }
9575             }
9576 0 0         else if (items == 11) { PDL_COMMENT("only input variables on stack, create outputs and temps")
9577 0           nreturn = 4;
9578 0           p = PDL->SvPDLV(ST(0));
9579 0           x = PDL->SvPDLV(ST(1));
9580 0           t = PDL->SvPDLV(ST(2));
9581 0           lb = PDL->SvPDLV(ST(3));
9582 0           ub = PDL->SvPDLV(ST(4));
9583 0           iopts = PDL->SvPDLV(ST(5));
9584 0           opts = PDL->SvPDLV(ST(6));
9585 0 0         funcn = (IV)SvIV(ST(7))
9586             ;
9587 0 0         sfuncn = (IV)SvIV(ST(8))
9588             ;
9589 0 0         indat = (IV)SvIV(ST(9))
9590             ;
9591 0 0         want_covar = (int)SvIV(ST(10))
9592             ;
9593 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9594 0           work_SV = sv_newmortal();
9595 0           work = PDL->null();
9596 0           PDL->SetSV_PDL(work_SV,work);
9597 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9598             } else {
9599 0 0         PUSHMARK(SP);
9600 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9601 0           PUTBACK;
9602 0           perl_call_method("initialize", G_SCALAR);
9603 0           SPAGAIN;
9604 0           work_SV = POPs;
9605 0           PUTBACK;
9606 0           work = PDL->SvPDLV(work_SV);
9607             }
9608 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9609 0           covar_SV = sv_newmortal();
9610 0           covar = PDL->null();
9611 0           PDL->SetSV_PDL(covar_SV,covar);
9612 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
9613             } else {
9614 0 0         PUSHMARK(SP);
9615 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9616 0           PUTBACK;
9617 0           perl_call_method("initialize", G_SCALAR);
9618 0           SPAGAIN;
9619 0           covar_SV = POPs;
9620 0           PUTBACK;
9621 0           covar = PDL->SvPDLV(covar_SV);
9622             }
9623 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9624 0           returnval_SV = sv_newmortal();
9625 0           returnval = PDL->null();
9626 0           PDL->SetSV_PDL(returnval_SV,returnval);
9627 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
9628             } else {
9629 0 0         PUSHMARK(SP);
9630 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9631 0           PUTBACK;
9632 0           perl_call_method("initialize", G_SCALAR);
9633 0           SPAGAIN;
9634 0           returnval_SV = POPs;
9635 0           PUTBACK;
9636 0           returnval = PDL->SvPDLV(returnval_SV);
9637             }
9638 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9639 0           pout_SV = sv_newmortal();
9640 0           pout = PDL->null();
9641 0           PDL->SetSV_PDL(pout_SV,pout);
9642 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
9643             } else {
9644 0 0         PUSHMARK(SP);
9645 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9646 0           PUTBACK;
9647 0           perl_call_method("initialize", G_SCALAR);
9648 0           SPAGAIN;
9649 0           pout_SV = POPs;
9650 0           PUTBACK;
9651 0           pout = PDL->SvPDLV(pout_SV);
9652             }
9653 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9654 0           info_SV = sv_newmortal();
9655 0           info = PDL->null();
9656 0           PDL->SetSV_PDL(info_SV,info);
9657 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
9658             } else {
9659 0 0         PUSHMARK(SP);
9660 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9661 0           PUTBACK;
9662 0           perl_call_method("initialize", G_SCALAR);
9663 0           SPAGAIN;
9664 0           info_SV = POPs;
9665 0           PUTBACK;
9666 0           info = PDL->SvPDLV(info_SV);
9667             }
9668             }
9669             else {
9670 0           croak ("Usage: PDL::levmar_diff_lb_ub(p,x,t,lb,ub,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar) (you may leave temporaries or output variables out of list)");
9671             }
9672             }
9673             {
9674             }
9675             { pdl_levmar_diff_lb_ub_struct *__privtrans;
9676 5           int badflag_cache = 0;
9677 5           __privtrans = malloc(sizeof(*__privtrans));
9678 5           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
9679 5           PDL_TR_SETMAGIC(__privtrans);
9680 5           __privtrans->flags = 0;
9681 5           __privtrans->__ddone = 0;
9682 5           __privtrans->vtable = &pdl_levmar_diff_lb_ub_vtable;
9683 5           __privtrans->freeproc = PDL->trans_mallocfreeproc;
9684 5           __privtrans->bvalflag = 0;
9685 5 50         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((lb->state & PDL_BADVAL) > 0) || ((ub->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
    50          
    50          
9686 5 50         if (badflag_cache) __privtrans->bvalflag = 1;
9687 5 50         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
9688 5           __privtrans->__datatype = p->datatype;
9689             }
9690 5 50         if(__privtrans->__datatype < x->datatype) {
9691 0           __privtrans->__datatype = x->datatype;
9692             }
9693 5 50         if(__privtrans->__datatype < t->datatype) {
9694 0           __privtrans->__datatype = t->datatype;
9695             }
9696 5 50         if(__privtrans->__datatype < lb->datatype) {
9697 0           __privtrans->__datatype = lb->datatype;
9698             }
9699 5 50         if(__privtrans->__datatype < ub->datatype) {
9700 0           __privtrans->__datatype = ub->datatype;
9701             }
9702 5 50         if(__privtrans->__datatype < opts->datatype) {
9703 0           __privtrans->__datatype = opts->datatype;
9704             }
9705 5 50         if(!((work->state & PDL_NOMYDIMS) &&
    50          
9706 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
9707 0           __privtrans->__datatype = work->datatype;
9708             }
9709 5 50         if(!((covar->state & PDL_NOMYDIMS) &&
    50          
9710 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
9711 0           __privtrans->__datatype = covar->datatype;
9712             }
9713 5 50         if(!((pout->state & PDL_NOMYDIMS) &&
    50          
9714 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
9715 0           __privtrans->__datatype = pout->datatype;
9716             }
9717 5 50         if(!((info->state & PDL_NOMYDIMS) &&
    50          
9718 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
9719 0           __privtrans->__datatype = info->datatype;
9720             }
9721 5 100         if(__privtrans->__datatype == PDL_F) {}
9722 3 50         else if(__privtrans->__datatype == PDL_D) {}
9723 0           else __privtrans->__datatype = PDL_D;
9724 5 50         if(__privtrans->__datatype != p->datatype) {
9725 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
9726 5 50         }if(__privtrans->__datatype != x->datatype) {
9727 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
9728 5 100         }if(__privtrans->__datatype != t->datatype) {
9729 4           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
9730 5 50         }if(__privtrans->__datatype != lb->datatype) {
9731 0           lb = PDL->get_convertedpdl(lb,__privtrans->__datatype);
9732 5 50         }if(__privtrans->__datatype != ub->datatype) {
9733 0           ub = PDL->get_convertedpdl(ub,__privtrans->__datatype);
9734 5 50         }if(PDL_L != iopts->datatype) {
9735 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
9736 5 50         }if(__privtrans->__datatype != opts->datatype) {
9737 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
9738 5 50         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    50          
9739 5           work->datatype = __privtrans->__datatype;
9740 0 0         } else if(__privtrans->__datatype != work->datatype) {
9741 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
9742 5 50         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    50          
9743 5           covar->datatype = __privtrans->__datatype;
9744 0 0         } else if(__privtrans->__datatype != covar->datatype) {
9745 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
9746 5 50         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    50          
9747 5           returnval->datatype = PDL_L;
9748 0 0         } else if(PDL_L != returnval->datatype) {
9749 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
9750 5 50         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    50          
9751 5           pout->datatype = __privtrans->__datatype;
9752 0 0         } else if(__privtrans->__datatype != pout->datatype) {
9753 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
9754 5 50         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    50          
9755 5           info->datatype = __privtrans->__datatype;
9756 0 0         } else if(__privtrans->__datatype != info->datatype) {
9757 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
9758 5           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
9759 5           __privtrans->pdls[1] = x;
9760 5           __privtrans->pdls[2] = t;
9761 5           __privtrans->pdls[3] = lb;
9762 5           __privtrans->pdls[4] = ub;
9763 5           __privtrans->pdls[5] = iopts;
9764 5           __privtrans->pdls[6] = opts;
9765 5           __privtrans->pdls[7] = work;
9766 5           __privtrans->pdls[8] = covar;
9767 5           __privtrans->pdls[9] = returnval;
9768 5           __privtrans->pdls[10] = pout;
9769 5           __privtrans->pdls[11] = info;
9770 5           PDL->make_trans_mutual((pdl_trans *)__privtrans);
9771 5 50         if (badflag_cache) {
9772 0           covar->state |= PDL_BADVAL;
9773 0           returnval->state |= PDL_BADVAL;
9774 0           pout->state |= PDL_BADVAL;
9775 0           info->state |= PDL_BADVAL;
9776             }
9777 5 50         if (nreturn) {
9778 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
9779 0           ST(0) = covar_SV;
9780 0           ST(1) = returnval_SV;
9781 0           ST(2) = pout_SV;
9782 0           ST(3) = info_SV;
9783 0           XSRETURN(nreturn);
9784             } else {
9785 5           XSRETURN(0);
9786             }
9787             }
9788              
9789             void
9790             levmar_diff_ub(...)
9791             PREINIT:
9792 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
9793             by pp_bless ? (CS) */
9794 0           HV *bless_stash = 0;
9795 0           SV *parent = 0;
9796             int nreturn;
9797             SV *work_SV;
9798             SV *covar_SV;
9799             SV *returnval_SV;
9800             SV *pout_SV;
9801             SV *info_SV;
9802             pdl *p;
9803             pdl *x;
9804             pdl *t;
9805             pdl *ub;
9806             pdl *iopts;
9807             pdl *opts;
9808             pdl *work;
9809             pdl *covar;
9810             pdl *returnval;
9811             pdl *pout;
9812             pdl *info;
9813             IV funcn;
9814             IV sfuncn;
9815             IV indat;
9816             int want_covar;
9817             PPCODE:
9818             {
9819             PDL_COMMENT("Check if you can get a package name for this input value. ")
9820             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
9821             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
9822 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
9823 0           parent = ST(0);
9824 0 0         if (sv_isobject(parent)){
9825 0           bless_stash = SvSTASH(SvRV(ST(0)));
9826 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
9827             }
9828             }
9829 0 0         if (items == 15) { PDL_COMMENT("all variables on stack, read in output and temp vars")
9830 0           nreturn = 0;
9831 0           p = PDL->SvPDLV(ST(0));
9832 0           x = PDL->SvPDLV(ST(1));
9833 0           t = PDL->SvPDLV(ST(2));
9834 0           ub = PDL->SvPDLV(ST(3));
9835 0           iopts = PDL->SvPDLV(ST(4));
9836 0           opts = PDL->SvPDLV(ST(5));
9837 0           work = PDL->SvPDLV(ST(6));
9838 0           covar = PDL->SvPDLV(ST(7));
9839 0           returnval = PDL->SvPDLV(ST(8));
9840 0           pout = PDL->SvPDLV(ST(9));
9841 0           info = PDL->SvPDLV(ST(10));
9842 0 0         funcn = (IV)SvIV(ST(11))
9843             ;
9844 0 0         sfuncn = (IV)SvIV(ST(12))
9845             ;
9846 0 0         indat = (IV)SvIV(ST(13))
9847             ;
9848 0 0         want_covar = (int)SvIV(ST(14))
9849             ;
9850             }
9851 0 0         else if (items == 14) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
9852 0           p = PDL->SvPDLV(ST(0));
9853 0           x = PDL->SvPDLV(ST(1));
9854 0           t = PDL->SvPDLV(ST(2));
9855 0           ub = PDL->SvPDLV(ST(3));
9856 0           iopts = PDL->SvPDLV(ST(4));
9857 0           opts = PDL->SvPDLV(ST(5));
9858 0           covar = PDL->SvPDLV(ST(6));
9859 0           returnval = PDL->SvPDLV(ST(7));
9860 0           pout = PDL->SvPDLV(ST(8));
9861 0           info = PDL->SvPDLV(ST(9));
9862 0 0         funcn = (IV)SvIV(ST(10))
9863             ;
9864 0 0         sfuncn = (IV)SvIV(ST(11))
9865             ;
9866 0 0         indat = (IV)SvIV(ST(12))
9867             ;
9868 0 0         want_covar = (int)SvIV(ST(13))
9869             ;
9870 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9871 0           work_SV = sv_newmortal();
9872 0           work = PDL->null();
9873 0           PDL->SetSV_PDL(work_SV,work);
9874 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9875             } else {
9876 0 0         PUSHMARK(SP);
9877 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9878 0           PUTBACK;
9879 0           perl_call_method("initialize", G_SCALAR);
9880 0           SPAGAIN;
9881 0           work_SV = POPs;
9882 0           PUTBACK;
9883 0           work = PDL->SvPDLV(work_SV);
9884             }
9885             }
9886 0 0         else if (items == 10) { PDL_COMMENT("only input variables on stack, create outputs and temps")
9887 0           nreturn = 4;
9888 0           p = PDL->SvPDLV(ST(0));
9889 0           x = PDL->SvPDLV(ST(1));
9890 0           t = PDL->SvPDLV(ST(2));
9891 0           ub = PDL->SvPDLV(ST(3));
9892 0           iopts = PDL->SvPDLV(ST(4));
9893 0           opts = PDL->SvPDLV(ST(5));
9894 0 0         funcn = (IV)SvIV(ST(6))
9895             ;
9896 0 0         sfuncn = (IV)SvIV(ST(7))
9897             ;
9898 0 0         indat = (IV)SvIV(ST(8))
9899             ;
9900 0 0         want_covar = (int)SvIV(ST(9))
9901             ;
9902 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9903 0           work_SV = sv_newmortal();
9904 0           work = PDL->null();
9905 0           PDL->SetSV_PDL(work_SV,work);
9906 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
9907             } else {
9908 0 0         PUSHMARK(SP);
9909 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9910 0           PUTBACK;
9911 0           perl_call_method("initialize", G_SCALAR);
9912 0           SPAGAIN;
9913 0           work_SV = POPs;
9914 0           PUTBACK;
9915 0           work = PDL->SvPDLV(work_SV);
9916             }
9917 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9918 0           covar_SV = sv_newmortal();
9919 0           covar = PDL->null();
9920 0           PDL->SetSV_PDL(covar_SV,covar);
9921 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
9922             } else {
9923 0 0         PUSHMARK(SP);
9924 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9925 0           PUTBACK;
9926 0           perl_call_method("initialize", G_SCALAR);
9927 0           SPAGAIN;
9928 0           covar_SV = POPs;
9929 0           PUTBACK;
9930 0           covar = PDL->SvPDLV(covar_SV);
9931             }
9932 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9933 0           returnval_SV = sv_newmortal();
9934 0           returnval = PDL->null();
9935 0           PDL->SetSV_PDL(returnval_SV,returnval);
9936 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
9937             } else {
9938 0 0         PUSHMARK(SP);
9939 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9940 0           PUTBACK;
9941 0           perl_call_method("initialize", G_SCALAR);
9942 0           SPAGAIN;
9943 0           returnval_SV = POPs;
9944 0           PUTBACK;
9945 0           returnval = PDL->SvPDLV(returnval_SV);
9946             }
9947 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9948 0           pout_SV = sv_newmortal();
9949 0           pout = PDL->null();
9950 0           PDL->SetSV_PDL(pout_SV,pout);
9951 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
9952             } else {
9953 0 0         PUSHMARK(SP);
9954 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9955 0           PUTBACK;
9956 0           perl_call_method("initialize", G_SCALAR);
9957 0           SPAGAIN;
9958 0           pout_SV = POPs;
9959 0           PUTBACK;
9960 0           pout = PDL->SvPDLV(pout_SV);
9961             }
9962 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
9963 0           info_SV = sv_newmortal();
9964 0           info = PDL->null();
9965 0           PDL->SetSV_PDL(info_SV,info);
9966 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
9967             } else {
9968 0 0         PUSHMARK(SP);
9969 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
9970 0           PUTBACK;
9971 0           perl_call_method("initialize", G_SCALAR);
9972 0           SPAGAIN;
9973 0           info_SV = POPs;
9974 0           PUTBACK;
9975 0           info = PDL->SvPDLV(info_SV);
9976             }
9977             }
9978             else {
9979 0           croak ("Usage: PDL::levmar_diff_ub(p,x,t,ub,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar) (you may leave temporaries or output variables out of list)");
9980             }
9981             }
9982             {
9983             }
9984             { pdl_levmar_diff_ub_struct *__privtrans;
9985 0           int badflag_cache = 0;
9986 0           __privtrans = malloc(sizeof(*__privtrans));
9987 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
9988 0           PDL_TR_SETMAGIC(__privtrans);
9989 0           __privtrans->flags = 0;
9990 0           __privtrans->__ddone = 0;
9991 0           __privtrans->vtable = &pdl_levmar_diff_ub_vtable;
9992 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
9993 0           __privtrans->bvalflag = 0;
9994 0 0         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((ub->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
9995 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
9996 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
9997 0           __privtrans->__datatype = p->datatype;
9998             }
9999 0 0         if(__privtrans->__datatype < x->datatype) {
10000 0           __privtrans->__datatype = x->datatype;
10001             }
10002 0 0         if(__privtrans->__datatype < t->datatype) {
10003 0           __privtrans->__datatype = t->datatype;
10004             }
10005 0 0         if(__privtrans->__datatype < ub->datatype) {
10006 0           __privtrans->__datatype = ub->datatype;
10007             }
10008 0 0         if(__privtrans->__datatype < opts->datatype) {
10009 0           __privtrans->__datatype = opts->datatype;
10010             }
10011 0 0         if(!((work->state & PDL_NOMYDIMS) &&
    0          
10012 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
10013 0           __privtrans->__datatype = work->datatype;
10014             }
10015 0 0         if(!((covar->state & PDL_NOMYDIMS) &&
    0          
10016 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
10017 0           __privtrans->__datatype = covar->datatype;
10018             }
10019 0 0         if(!((pout->state & PDL_NOMYDIMS) &&
    0          
10020 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
10021 0           __privtrans->__datatype = pout->datatype;
10022             }
10023 0 0         if(!((info->state & PDL_NOMYDIMS) &&
    0          
10024 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
10025 0           __privtrans->__datatype = info->datatype;
10026             }
10027 0 0         if(__privtrans->__datatype == PDL_F) {}
10028 0 0         else if(__privtrans->__datatype == PDL_D) {}
10029 0           else __privtrans->__datatype = PDL_D;
10030 0 0         if(__privtrans->__datatype != p->datatype) {
10031 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
10032 0 0         }if(__privtrans->__datatype != x->datatype) {
10033 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
10034 0 0         }if(__privtrans->__datatype != t->datatype) {
10035 0           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
10036 0 0         }if(__privtrans->__datatype != ub->datatype) {
10037 0           ub = PDL->get_convertedpdl(ub,__privtrans->__datatype);
10038 0 0         }if(PDL_L != iopts->datatype) {
10039 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
10040 0 0         }if(__privtrans->__datatype != opts->datatype) {
10041 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
10042 0 0         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    0          
10043 0           work->datatype = __privtrans->__datatype;
10044 0 0         } else if(__privtrans->__datatype != work->datatype) {
10045 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
10046 0 0         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    0          
10047 0           covar->datatype = __privtrans->__datatype;
10048 0 0         } else if(__privtrans->__datatype != covar->datatype) {
10049 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
10050 0 0         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    0          
10051 0           returnval->datatype = PDL_L;
10052 0 0         } else if(PDL_L != returnval->datatype) {
10053 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
10054 0 0         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    0          
10055 0           pout->datatype = __privtrans->__datatype;
10056 0 0         } else if(__privtrans->__datatype != pout->datatype) {
10057 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
10058 0 0         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    0          
10059 0           info->datatype = __privtrans->__datatype;
10060 0 0         } else if(__privtrans->__datatype != info->datatype) {
10061 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
10062 0           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
10063 0           __privtrans->pdls[1] = x;
10064 0           __privtrans->pdls[2] = t;
10065 0           __privtrans->pdls[3] = ub;
10066 0           __privtrans->pdls[4] = iopts;
10067 0           __privtrans->pdls[5] = opts;
10068 0           __privtrans->pdls[6] = work;
10069 0           __privtrans->pdls[7] = covar;
10070 0           __privtrans->pdls[8] = returnval;
10071 0           __privtrans->pdls[9] = pout;
10072 0           __privtrans->pdls[10] = info;
10073 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
10074 0 0         if (badflag_cache) {
10075 0           covar->state |= PDL_BADVAL;
10076 0           returnval->state |= PDL_BADVAL;
10077 0           pout->state |= PDL_BADVAL;
10078 0           info->state |= PDL_BADVAL;
10079             }
10080 0 0         if (nreturn) {
10081 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
10082 0           ST(0) = covar_SV;
10083 0           ST(1) = returnval_SV;
10084 0           ST(2) = pout_SV;
10085 0           ST(3) = info_SV;
10086 0           XSRETURN(nreturn);
10087             } else {
10088 0           XSRETURN(0);
10089             }
10090             }
10091              
10092             void
10093             levmar_diff_(...)
10094             PREINIT:
10095 15           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
10096             by pp_bless ? (CS) */
10097 15           HV *bless_stash = 0;
10098 15           SV *parent = 0;
10099             int nreturn;
10100             SV *work_SV;
10101             SV *covar_SV;
10102             SV *returnval_SV;
10103             SV *pout_SV;
10104             SV *info_SV;
10105             pdl *p;
10106             pdl *x;
10107             pdl *t;
10108             pdl *iopts;
10109             pdl *opts;
10110             pdl *work;
10111             pdl *covar;
10112             pdl *returnval;
10113             pdl *pout;
10114             pdl *info;
10115             IV funcn;
10116             IV sfuncn;
10117             IV indat;
10118             int want_covar;
10119             PPCODE:
10120             {
10121             PDL_COMMENT("Check if you can get a package name for this input value. ")
10122             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
10123             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
10124 15 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
10125 15           parent = ST(0);
10126 15 50         if (sv_isobject(parent)){
10127 15           bless_stash = SvSTASH(SvRV(ST(0)));
10128 15 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
10129             }
10130             }
10131 15 50         if (items == 14) { PDL_COMMENT("all variables on stack, read in output and temp vars")
10132 15           nreturn = 0;
10133 15           p = PDL->SvPDLV(ST(0));
10134 15           x = PDL->SvPDLV(ST(1));
10135 15           t = PDL->SvPDLV(ST(2));
10136 15           iopts = PDL->SvPDLV(ST(3));
10137 15           opts = PDL->SvPDLV(ST(4));
10138 15           work = PDL->SvPDLV(ST(5));
10139 15           covar = PDL->SvPDLV(ST(6));
10140 15           returnval = PDL->SvPDLV(ST(7));
10141 15           pout = PDL->SvPDLV(ST(8));
10142 15           info = PDL->SvPDLV(ST(9));
10143 15 50         funcn = (IV)SvIV(ST(10))
10144             ;
10145 15 50         sfuncn = (IV)SvIV(ST(11))
10146             ;
10147 15 50         indat = (IV)SvIV(ST(12))
10148             ;
10149 15 50         want_covar = (int)SvIV(ST(13))
10150             ;
10151             }
10152 0 0         else if (items == 13) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
10153 0           p = PDL->SvPDLV(ST(0));
10154 0           x = PDL->SvPDLV(ST(1));
10155 0           t = PDL->SvPDLV(ST(2));
10156 0           iopts = PDL->SvPDLV(ST(3));
10157 0           opts = PDL->SvPDLV(ST(4));
10158 0           covar = PDL->SvPDLV(ST(5));
10159 0           returnval = PDL->SvPDLV(ST(6));
10160 0           pout = PDL->SvPDLV(ST(7));
10161 0           info = PDL->SvPDLV(ST(8));
10162 0 0         funcn = (IV)SvIV(ST(9))
10163             ;
10164 0 0         sfuncn = (IV)SvIV(ST(10))
10165             ;
10166 0 0         indat = (IV)SvIV(ST(11))
10167             ;
10168 0 0         want_covar = (int)SvIV(ST(12))
10169             ;
10170 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10171 0           work_SV = sv_newmortal();
10172 0           work = PDL->null();
10173 0           PDL->SetSV_PDL(work_SV,work);
10174 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
10175             } else {
10176 0 0         PUSHMARK(SP);
10177 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10178 0           PUTBACK;
10179 0           perl_call_method("initialize", G_SCALAR);
10180 0           SPAGAIN;
10181 0           work_SV = POPs;
10182 0           PUTBACK;
10183 0           work = PDL->SvPDLV(work_SV);
10184             }
10185             }
10186 0 0         else if (items == 9) { PDL_COMMENT("only input variables on stack, create outputs and temps")
10187 0           nreturn = 4;
10188 0           p = PDL->SvPDLV(ST(0));
10189 0           x = PDL->SvPDLV(ST(1));
10190 0           t = PDL->SvPDLV(ST(2));
10191 0           iopts = PDL->SvPDLV(ST(3));
10192 0           opts = PDL->SvPDLV(ST(4));
10193 0 0         funcn = (IV)SvIV(ST(5))
10194             ;
10195 0 0         sfuncn = (IV)SvIV(ST(6))
10196             ;
10197 0 0         indat = (IV)SvIV(ST(7))
10198             ;
10199 0 0         want_covar = (int)SvIV(ST(8))
10200             ;
10201 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10202 0           work_SV = sv_newmortal();
10203 0           work = PDL->null();
10204 0           PDL->SetSV_PDL(work_SV,work);
10205 0 0         if (bless_stash) work_SV = sv_bless(work_SV, bless_stash);
10206             } else {
10207 0 0         PUSHMARK(SP);
10208 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10209 0           PUTBACK;
10210 0           perl_call_method("initialize", G_SCALAR);
10211 0           SPAGAIN;
10212 0           work_SV = POPs;
10213 0           PUTBACK;
10214 0           work = PDL->SvPDLV(work_SV);
10215             }
10216 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10217 0           covar_SV = sv_newmortal();
10218 0           covar = PDL->null();
10219 0           PDL->SetSV_PDL(covar_SV,covar);
10220 0 0         if (bless_stash) covar_SV = sv_bless(covar_SV, bless_stash);
10221             } else {
10222 0 0         PUSHMARK(SP);
10223 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10224 0           PUTBACK;
10225 0           perl_call_method("initialize", G_SCALAR);
10226 0           SPAGAIN;
10227 0           covar_SV = POPs;
10228 0           PUTBACK;
10229 0           covar = PDL->SvPDLV(covar_SV);
10230             }
10231 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10232 0           returnval_SV = sv_newmortal();
10233 0           returnval = PDL->null();
10234 0           PDL->SetSV_PDL(returnval_SV,returnval);
10235 0 0         if (bless_stash) returnval_SV = sv_bless(returnval_SV, bless_stash);
10236             } else {
10237 0 0         PUSHMARK(SP);
10238 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10239 0           PUTBACK;
10240 0           perl_call_method("initialize", G_SCALAR);
10241 0           SPAGAIN;
10242 0           returnval_SV = POPs;
10243 0           PUTBACK;
10244 0           returnval = PDL->SvPDLV(returnval_SV);
10245             }
10246 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10247 0           pout_SV = sv_newmortal();
10248 0           pout = PDL->null();
10249 0           PDL->SetSV_PDL(pout_SV,pout);
10250 0 0         if (bless_stash) pout_SV = sv_bless(pout_SV, bless_stash);
10251             } else {
10252 0 0         PUSHMARK(SP);
10253 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10254 0           PUTBACK;
10255 0           perl_call_method("initialize", G_SCALAR);
10256 0           SPAGAIN;
10257 0           pout_SV = POPs;
10258 0           PUTBACK;
10259 0           pout = PDL->SvPDLV(pout_SV);
10260             }
10261 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10262 0           info_SV = sv_newmortal();
10263 0           info = PDL->null();
10264 0           PDL->SetSV_PDL(info_SV,info);
10265 0 0         if (bless_stash) info_SV = sv_bless(info_SV, bless_stash);
10266             } else {
10267 0 0         PUSHMARK(SP);
10268 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10269 0           PUTBACK;
10270 0           perl_call_method("initialize", G_SCALAR);
10271 0           SPAGAIN;
10272 0           info_SV = POPs;
10273 0           PUTBACK;
10274 0           info = PDL->SvPDLV(info_SV);
10275             }
10276             }
10277             else {
10278 0           croak ("Usage: PDL::levmar_diff_(p,x,t,iopts,opts,work,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar) (you may leave temporaries or output variables out of list)");
10279             }
10280             }
10281             {
10282             }
10283             { pdl_levmar_diff__struct *__privtrans;
10284 15           int badflag_cache = 0;
10285 15           __privtrans = malloc(sizeof(*__privtrans));
10286 15           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
10287 15           PDL_TR_SETMAGIC(__privtrans);
10288 15           __privtrans->flags = 0;
10289 15           __privtrans->__ddone = 0;
10290 15           __privtrans->vtable = &pdl_levmar_diff__vtable;
10291 15           __privtrans->freeproc = PDL->trans_mallocfreeproc;
10292 15           __privtrans->bvalflag = 0;
10293 15 50         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((x->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0) || ((iopts->state & PDL_BADVAL) > 0) || ((opts->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
10294 15 50         if (badflag_cache) __privtrans->bvalflag = 1;
10295 15 50         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
10296 15           __privtrans->__datatype = p->datatype;
10297             }
10298 15 50         if(__privtrans->__datatype < x->datatype) {
10299 0           __privtrans->__datatype = x->datatype;
10300             }
10301 15 50         if(__privtrans->__datatype < t->datatype) {
10302 0           __privtrans->__datatype = t->datatype;
10303             }
10304 15 50         if(__privtrans->__datatype < opts->datatype) {
10305 0           __privtrans->__datatype = opts->datatype;
10306             }
10307 15 50         if(!((work->state & PDL_NOMYDIMS) &&
    50          
10308 0 0         work->trans == NULL) && __privtrans->__datatype < work->datatype) {
10309 0           __privtrans->__datatype = work->datatype;
10310             }
10311 15 50         if(!((covar->state & PDL_NOMYDIMS) &&
    50          
10312 0 0         covar->trans == NULL) && __privtrans->__datatype < covar->datatype) {
10313 0           __privtrans->__datatype = covar->datatype;
10314             }
10315 15 50         if(!((pout->state & PDL_NOMYDIMS) &&
    50          
10316 0 0         pout->trans == NULL) && __privtrans->__datatype < pout->datatype) {
10317 0           __privtrans->__datatype = pout->datatype;
10318             }
10319 15 50         if(!((info->state & PDL_NOMYDIMS) &&
    50          
10320 0 0         info->trans == NULL) && __privtrans->__datatype < info->datatype) {
10321 0           __privtrans->__datatype = info->datatype;
10322             }
10323 15 100         if(__privtrans->__datatype == PDL_F) {}
10324 10 50         else if(__privtrans->__datatype == PDL_D) {}
10325 0           else __privtrans->__datatype = PDL_D;
10326 15 50         if(__privtrans->__datatype != p->datatype) {
10327 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
10328 15 50         }if(__privtrans->__datatype != x->datatype) {
10329 0           x = PDL->get_convertedpdl(x,__privtrans->__datatype);
10330 15 100         }if(__privtrans->__datatype != t->datatype) {
10331 9           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
10332 15 50         }if(PDL_L != iopts->datatype) {
10333 0           iopts = PDL->get_convertedpdl(iopts,PDL_L);
10334 15 50         }if(__privtrans->__datatype != opts->datatype) {
10335 0           opts = PDL->get_convertedpdl(opts,__privtrans->__datatype);
10336 15 50         }if( (work->state & PDL_NOMYDIMS) && work->trans == NULL ) {
    50          
10337 15           work->datatype = __privtrans->__datatype;
10338 0 0         } else if(__privtrans->__datatype != work->datatype) {
10339 0           work = PDL->get_convertedpdl(work,__privtrans->__datatype);
10340 15 50         }if( (covar->state & PDL_NOMYDIMS) && covar->trans == NULL ) {
    50          
10341 15           covar->datatype = __privtrans->__datatype;
10342 0 0         } else if(__privtrans->__datatype != covar->datatype) {
10343 0           covar = PDL->get_convertedpdl(covar,__privtrans->__datatype);
10344 15 50         }if( (returnval->state & PDL_NOMYDIMS) && returnval->trans == NULL ) {
    50          
10345 15           returnval->datatype = PDL_L;
10346 0 0         } else if(PDL_L != returnval->datatype) {
10347 0           returnval = PDL->get_convertedpdl(returnval,PDL_L);
10348 15 50         }if( (pout->state & PDL_NOMYDIMS) && pout->trans == NULL ) {
    50          
10349 15           pout->datatype = __privtrans->__datatype;
10350 0 0         } else if(__privtrans->__datatype != pout->datatype) {
10351 0           pout = PDL->get_convertedpdl(pout,__privtrans->__datatype);
10352 15 50         }if( (info->state & PDL_NOMYDIMS) && info->trans == NULL ) {
    50          
10353 15           info->datatype = __privtrans->__datatype;
10354 0 0         } else if(__privtrans->__datatype != info->datatype) {
10355 0           info = PDL->get_convertedpdl(info,__privtrans->__datatype);
10356 15           }{(__privtrans->funcn) = (funcn);(__privtrans->sfuncn) = (sfuncn);(__privtrans->indat) = (indat);(__privtrans->want_covar) = (want_covar);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
10357 15           __privtrans->pdls[1] = x;
10358 15           __privtrans->pdls[2] = t;
10359 15           __privtrans->pdls[3] = iopts;
10360 15           __privtrans->pdls[4] = opts;
10361 15           __privtrans->pdls[5] = work;
10362 15           __privtrans->pdls[6] = covar;
10363 15           __privtrans->pdls[7] = returnval;
10364 15           __privtrans->pdls[8] = pout;
10365 15           __privtrans->pdls[9] = info;
10366 15           PDL->make_trans_mutual((pdl_trans *)__privtrans);
10367 15 50         if (badflag_cache) {
10368 0           covar->state |= PDL_BADVAL;
10369 0           returnval->state |= PDL_BADVAL;
10370 0           pout->state |= PDL_BADVAL;
10371 0           info->state |= PDL_BADVAL;
10372             }
10373 15 50         if (nreturn) {
10374 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
10375 0           ST(0) = covar_SV;
10376 0           ST(1) = returnval_SV;
10377 0           ST(2) = pout_SV;
10378 0           ST(3) = info_SV;
10379 0           XSRETURN(nreturn);
10380             } else {
10381 15           XSRETURN(0);
10382             }
10383             }
10384              
10385             void
10386             _levmar_chkjac(...)
10387             PREINIT:
10388 4           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
10389             by pp_bless ? (CS) */
10390 4           HV *bless_stash = 0;
10391 4           SV *parent = 0;
10392             int nreturn;
10393             SV *err_SV;
10394             pdl *p;
10395             pdl *t;
10396             pdl *err;
10397             IV func;
10398             IV sfunc;
10399             IV jac;
10400             IV sjac;
10401             IV indat;
10402             PPCODE:
10403             {
10404             PDL_COMMENT("Check if you can get a package name for this input value. ")
10405             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
10406             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
10407 4 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
10408 4           parent = ST(0);
10409 4 50         if (sv_isobject(parent)){
10410 4           bless_stash = SvSTASH(SvRV(ST(0)));
10411 4 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
10412             }
10413             }
10414 4 50         if (items == 8) { PDL_COMMENT("all variables on stack, read in output and temp vars")
10415 0           nreturn = 0;
10416 0           p = PDL->SvPDLV(ST(0));
10417 0           t = PDL->SvPDLV(ST(1));
10418 0           err = PDL->SvPDLV(ST(2));
10419 0 0         func = (IV)SvIV(ST(3))
10420             ;
10421 0 0         sfunc = (IV)SvIV(ST(4))
10422             ;
10423 0 0         jac = (IV)SvIV(ST(5))
10424             ;
10425 0 0         sjac = (IV)SvIV(ST(6))
10426             ;
10427 0 0         indat = (IV)SvIV(ST(7))
10428             ;
10429             }
10430 4 50         else if (items == 7) { PDL_COMMENT("only input variables on stack, create outputs and temps")
10431 4           nreturn = 1;
10432 4           p = PDL->SvPDLV(ST(0));
10433 4           t = PDL->SvPDLV(ST(1));
10434 4 50         func = (IV)SvIV(ST(2))
10435             ;
10436 4 50         sfunc = (IV)SvIV(ST(3))
10437             ;
10438 4 50         jac = (IV)SvIV(ST(4))
10439             ;
10440 4 50         sjac = (IV)SvIV(ST(5))
10441             ;
10442 4 50         indat = (IV)SvIV(ST(6))
10443             ;
10444 4 50         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10445 4           err_SV = sv_newmortal();
10446 4           err = PDL->null();
10447 4           PDL->SetSV_PDL(err_SV,err);
10448 4 50         if (bless_stash) err_SV = sv_bless(err_SV, bless_stash);
10449             } else {
10450 0 0         PUSHMARK(SP);
10451 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10452 0           PUTBACK;
10453 0           perl_call_method("initialize", G_SCALAR);
10454 0           SPAGAIN;
10455 0           err_SV = POPs;
10456 0           PUTBACK;
10457 4           err = PDL->SvPDLV(err_SV);
10458             }
10459             }
10460             else {
10461 0           croak ("Usage: PDL::_levmar_chkjac(p,t,err,func,sfunc,jac,sjac,indat) (you may leave temporaries or output variables out of list)");
10462             }
10463             }
10464             {
10465             }
10466             { pdl__levmar_chkjac_struct *__privtrans;
10467 4           int badflag_cache = 0;
10468 4           __privtrans = malloc(sizeof(*__privtrans));
10469 4           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
10470 4           PDL_TR_SETMAGIC(__privtrans);
10471 4           __privtrans->flags = 0;
10472 4           __privtrans->__ddone = 0;
10473 4           __privtrans->vtable = &pdl__levmar_chkjac_vtable;
10474 4           __privtrans->freeproc = PDL->trans_mallocfreeproc;
10475 4           __privtrans->bvalflag = 0;
10476 4 50         badflag_cache = ((p->state & PDL_BADVAL) > 0) || ((t->state & PDL_BADVAL) > 0);
    50          
10477 4 50         if (badflag_cache) __privtrans->bvalflag = 1;
10478 4 50         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
10479 4           __privtrans->__datatype = p->datatype;
10480             }
10481 4 50         if(__privtrans->__datatype < t->datatype) {
10482 0           __privtrans->__datatype = t->datatype;
10483             }
10484 4 50         if(!((err->state & PDL_NOMYDIMS) &&
    50          
10485 0 0         err->trans == NULL) && __privtrans->__datatype < err->datatype) {
10486 0           __privtrans->__datatype = err->datatype;
10487             }
10488 4 100         if(__privtrans->__datatype == PDL_F) {}
10489 2 50         else if(__privtrans->__datatype == PDL_D) {}
10490 0           else __privtrans->__datatype = PDL_D;
10491 4 50         if(__privtrans->__datatype != p->datatype) {
10492 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
10493 4 50         }if(__privtrans->__datatype != t->datatype) {
10494 0           t = PDL->get_convertedpdl(t,__privtrans->__datatype);
10495 4 50         }if( (err->state & PDL_NOMYDIMS) && err->trans == NULL ) {
    50          
10496 4           err->datatype = __privtrans->__datatype;
10497 0 0         } else if(__privtrans->__datatype != err->datatype) {
10498 0           err = PDL->get_convertedpdl(err,__privtrans->__datatype);
10499 4           }{(__privtrans->func) = (func);(__privtrans->sfunc) = (sfunc);(__privtrans->jac) = (jac);(__privtrans->sjac) = (sjac);(__privtrans->indat) = (indat);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
10500 4           __privtrans->pdls[1] = t;
10501 4           __privtrans->pdls[2] = err;
10502 4           PDL->make_trans_mutual((pdl_trans *)__privtrans);
10503 4 50         if (badflag_cache) {
10504 0           err->state |= PDL_BADVAL;
10505             }
10506 4 50         if (nreturn) {
10507 4 50         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
10508 4           ST(0) = err_SV;
10509 4           XSRETURN(nreturn);
10510             } else {
10511 0           XSRETURN(0);
10512             }
10513             }
10514              
10515             void
10516             _levmar_chkjac_no_t(...)
10517             PREINIT:
10518 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
10519             by pp_bless ? (CS) */
10520 0           HV *bless_stash = 0;
10521 0           SV *parent = 0;
10522             int nreturn;
10523             SV *err_SV;
10524             pdl *p;
10525             pdl *err;
10526             IV func;
10527             IV sfunc;
10528             IV jac;
10529             IV sjac;
10530             int N;
10531             IV indat;
10532             PPCODE:
10533             {
10534             PDL_COMMENT("Check if you can get a package name for this input value. ")
10535             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
10536             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
10537 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
10538 0           parent = ST(0);
10539 0 0         if (sv_isobject(parent)){
10540 0           bless_stash = SvSTASH(SvRV(ST(0)));
10541 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
10542             }
10543             }
10544 0 0         if (items == 8) { PDL_COMMENT("all variables on stack, read in output and temp vars")
10545 0           nreturn = 0;
10546 0           p = PDL->SvPDLV(ST(0));
10547 0           err = PDL->SvPDLV(ST(1));
10548 0 0         func = (IV)SvIV(ST(2))
10549             ;
10550 0 0         sfunc = (IV)SvIV(ST(3))
10551             ;
10552 0 0         jac = (IV)SvIV(ST(4))
10553             ;
10554 0 0         sjac = (IV)SvIV(ST(5))
10555             ;
10556 0 0         N = (int)SvIV(ST(6))
10557             ;
10558 0 0         indat = (IV)SvIV(ST(7))
10559             ;
10560             }
10561 0 0         else if (items == 7) { PDL_COMMENT("only input variables on stack, create outputs and temps")
10562 0           nreturn = 1;
10563 0           p = PDL->SvPDLV(ST(0));
10564 0 0         func = (IV)SvIV(ST(1))
10565             ;
10566 0 0         sfunc = (IV)SvIV(ST(2))
10567             ;
10568 0 0         jac = (IV)SvIV(ST(3))
10569             ;
10570 0 0         sjac = (IV)SvIV(ST(4))
10571             ;
10572 0 0         N = (int)SvIV(ST(5))
10573             ;
10574 0 0         indat = (IV)SvIV(ST(6))
10575             ;
10576 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
10577 0           err_SV = sv_newmortal();
10578 0           err = PDL->null();
10579 0           PDL->SetSV_PDL(err_SV,err);
10580 0 0         if (bless_stash) err_SV = sv_bless(err_SV, bless_stash);
10581             } else {
10582 0 0         PUSHMARK(SP);
10583 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
10584 0           PUTBACK;
10585 0           perl_call_method("initialize", G_SCALAR);
10586 0           SPAGAIN;
10587 0           err_SV = POPs;
10588 0           PUTBACK;
10589 0           err = PDL->SvPDLV(err_SV);
10590             }
10591             }
10592             else {
10593 0           croak ("Usage: PDL::_levmar_chkjac_no_t(p,err,func,sfunc,jac,sjac,N,indat) (you may leave temporaries or output variables out of list)");
10594             }
10595             }
10596             {
10597             }
10598             { pdl__levmar_chkjac_no_t_struct *__privtrans;
10599 0           int badflag_cache = 0;
10600 0           __privtrans = malloc(sizeof(*__privtrans));
10601 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
10602 0           PDL_TR_SETMAGIC(__privtrans);
10603 0           __privtrans->flags = 0;
10604 0           __privtrans->__ddone = 0;
10605 0           __privtrans->vtable = &pdl__levmar_chkjac_no_t_vtable;
10606 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
10607 0           __privtrans->bvalflag = 0;
10608 0           badflag_cache = ((p->state & PDL_BADVAL) > 0);
10609 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
10610 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < p->datatype) {
10611 0           __privtrans->__datatype = p->datatype;
10612             }
10613 0 0         if(!((err->state & PDL_NOMYDIMS) &&
    0          
10614 0 0         err->trans == NULL) && __privtrans->__datatype < err->datatype) {
10615 0           __privtrans->__datatype = err->datatype;
10616             }
10617 0 0         if(__privtrans->__datatype == PDL_F) {}
10618 0 0         else if(__privtrans->__datatype == PDL_D) {}
10619 0           else __privtrans->__datatype = PDL_D;
10620 0 0         if(__privtrans->__datatype != p->datatype) {
10621 0           p = PDL->get_convertedpdl(p,__privtrans->__datatype);
10622 0 0         }if( (err->state & PDL_NOMYDIMS) && err->trans == NULL ) {
    0          
10623 0           err->datatype = __privtrans->__datatype;
10624 0 0         } else if(__privtrans->__datatype != err->datatype) {
10625 0           err = PDL->get_convertedpdl(err,__privtrans->__datatype);
10626 0           }{(__privtrans->func) = (func);(__privtrans->sfunc) = (sfunc);(__privtrans->jac) = (jac);(__privtrans->sjac) = (sjac);(__privtrans->N) = (N);(__privtrans->indat) = (indat);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = p;
10627 0           __privtrans->pdls[1] = err;
10628 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
10629 0 0         if (badflag_cache) {
10630 0           err->state |= PDL_BADVAL;
10631             }
10632 0 0         if (nreturn) {
10633 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
10634 0           ST(0) = err_SV;
10635 0           XSRETURN(nreturn);
10636             } else {
10637 0           XSRETURN(0);
10638             }
10639             }
10640              
10641             MODULE = PDL::Fit::Levmar PACKAGE = PDL::Fit::Levmar
10642              
10643              
10644              
10645              
10646             void *
10647             DFP_create()
10648              
10649             CODE:
10650             DFP * dat;
10651 10           dat = (DFP *)malloc(sizeof( DFP ));
10652 10 50         if ( NULL == dat ) {
10653 0           fprintf(stderr, "Can't allocate storage for dat in DFP_create\n");
10654 0           exit(1);
10655             }
10656 10           RETVAL = dat;
10657             OUTPUT:
10658             RETVAL
10659              
10660             void
10661             DFP_free( dat )
10662             IV dat
10663            
10664             CODE:
10665 12 100         if ( (DFP *) dat) free( (DFP *) dat);
10666              
10667              
10668             void
10669             DFP_set_perl_funcs ( data, perl_fit_func, perl_jac_func )
10670             IV data
10671             SV* perl_fit_func
10672             SV* perl_jac_func
10673              
10674             CODE:
10675 10           DFP *dat = (DFP *) data;
10676 10 50         if ( dat == NULL ) {
10677 0           fprintf(stderr, "DFP_set_perl_funcs got null struct\n");
10678 0           exit(1);
10679             }
10680 10           dat->perl_fit_func = perl_fit_func;
10681 10           dat->perl_jac_func = perl_jac_func;
10682              
10683              
10684             double
10685             get_dbl_max( )
10686             CODE:
10687 9           RETVAL = DBL_MAX;
10688             OUTPUT:
10689             RETVAL
10690              
10691             double
10692             LM_INIT_MU( )
10693             CODE:
10694 7           RETVAL = LM_INIT_MU;
10695             OUTPUT:
10696             RETVAL
10697              
10698             double
10699             LM_STOP_THRESH( )
10700             CODE:
10701 21           RETVAL = LM_STOP_THRESH;
10702             OUTPUT:
10703             RETVAL
10704              
10705             double
10706             LM_DIFF_DELTA( )
10707             CODE:
10708 7           RETVAL = LM_DIFF_DELTA;
10709             OUTPUT:
10710             RETVAL
10711              
10712              
10713             =pod
10714              
10715              
10716             =begin comment
10717              
10718             The next two routines just get pointers to functions from
10719             the C code and return them as SVs to perl. The functions
10720             are the C wrappers to the users _perl_ fit and jacobian
10721             functions. LEVFUNC and JLEVFUNC should be re-entrant so
10722             the following two routines can called once when the
10723             Levmar::Func module is loaded and can be shared by all
10724             object instances.
10725              
10726             =end comment
10727              
10728             =cut
10729              
10730             void *
10731             get_perl_func_wrapper( )
10732              
10733             CODE:
10734 7           RETVAL = &LEVFUNC;
10735             OUTPUT:
10736             RETVAL
10737              
10738             void *
10739             get_perl_jac_wrapper( )
10740              
10741             CODE:
10742 7           RETVAL = &JLEVFUNC;
10743             OUTPUT:
10744             RETVAL
10745              
10746              
10747              
10748              
10749             MODULE = PDL::Fit::Levmar PACKAGE = PDL
10750              
10751              
10752              
10753             BOOT:
10754              
10755             PDL_COMMENT("Get pointer to structure of core shared C routines")
10756             PDL_COMMENT("make sure PDL::Core is loaded")
10757            
10758 7           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
10759             #ifndef aTHX_
10760             #define aTHX_
10761             #endif
10762 7 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    50          
    50          
    0          
    50          
    50          
    0          
    0          
    0          
    0          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    50          
    0          
    0          
    0          
    0          
10763 7           CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* SV* value */
10764 7 50         if (CoreSV==NULL)
10765 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
10766 7 50         PDL = INT2PTR(Core*,SvIV( CoreSV )); /* Core* value */
10767 7 50         if (PDL->Version != PDL_CORE_VERSION)
10768 0           Perl_croak(aTHX_ "[PDL->Version: %d PDL_CORE_VERSION: %d XS_VERSION: %s] PDL::Fit::Levmar needs to be recompiled against the newly installed PDL", PDL->Version, PDL_CORE_VERSION, XS_VERSION);
10769              
10770              
10771