File Coverage

Levmar.xs
Criterion Covered Total %
statement 57 111 51.3
branch 100 524 19.0
condition n/a
subroutine n/a
pod n/a
total 157 635 24.7


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from levmar.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_Fit_Levmar
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "Levmar.xs"
23              
24             #include
25             #include
26             #include
27             #include
28             #include "pdlperlfunc.h"
29             #include "levmar.h"
30             pdl_error pdl_run_levmar_der_(pdl *p,pdl *x,pdl *t,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV jacn,IV sjacn,IV indat,int want_covar);
31             pdl_error pdl_run_levmar_der_lb_ub(pdl *p,pdl *x,pdl *t,pdl *lb,pdl *ub,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV jacn,IV sjacn,IV indat,int want_covar);
32             pdl_error pdl_run_levmar_der_ub(pdl *p,pdl *x,pdl *t,pdl *ub,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV jacn,IV sjacn,IV indat,int want_covar);
33             pdl_error pdl_run_levmar_der_lb(pdl *p,pdl *x,pdl *t,pdl *lb,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV jacn,IV sjacn,IV indat,int want_covar);
34             pdl_error pdl_run_levmar_diff_(pdl *p,pdl *x,pdl *t,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV indat,int want_covar);
35             pdl_error pdl_run_levmar_diff_lb_ub(pdl *p,pdl *x,pdl *t,pdl *lb,pdl *ub,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV indat,int want_covar);
36             pdl_error pdl_run_levmar_diff_ub(pdl *p,pdl *x,pdl *t,pdl *ub,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV indat,int want_covar);
37             pdl_error pdl_run_levmar_diff_lb(pdl *p,pdl *x,pdl *t,pdl *lb,pdl *iopts,pdl *opts,pdl *covar,pdl *returnval,pdl *pout,pdl *info,IV funcn,IV sfuncn,IV indat,int want_covar);
38             pdl_error pdl_run__levmar_chkjac(pdl *p,pdl *t,pdl *err,IV func,IV sfunc,IV jac,IV sjac,IV indat);
39             pdl_error pdl_run__levmar_chkjac_no_t(pdl *p,pdl *err,IV func,IV sfunc,IV jac,IV sjac,int N,IV indat);
40              
41             #line 449 "lib/PDL/PP.pm"
42             #include "pdlperl.h"
43             #line 44 "Levmar.xs"
44              
45             Core* PDL = NULL; /* Structure hold core C functions */
46              
47             MODULE = PDL::Fit::Levmar PACKAGE = PDL PREFIX=pdl_run_
48              
49             PROTOTYPES: DISABLE
50              
51              
52             void
53             pdl_run_levmar_der_(p, x, t, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, jacn=jacn, sjacn=sjacn, indat=indat, want_covar=want_covar)
54             SV *covar_SV = (items == 15) ? ST(5) : NULL;
55             SV *returnval_SV = (items == 15) ? ST(6) : NULL;
56             SV *pout_SV = (items == 15) ? ST(7) : NULL;
57             SV *info_SV = (items == 15) ? ST(8) : NULL;
58             SV *funcn_SV = (items == 15) ? ST(9) : ST(5);
59             SV *sfuncn_SV = (items == 15) ? ST(10) : ST(6);
60             SV *jacn_SV = (items == 15) ? ST(11) : ST(7);
61             SV *sjacn_SV = (items == 15) ? ST(12) : ST(8);
62             SV *indat_SV = (items == 15) ? ST(13) : ST(9);
63             SV *want_covar_SV = (items == 15) ? ST(14) : ST(10);
64             PREINIT:
65 60 50         PDL_XS_PREAMBLE((items == 15) ? 0 : 4);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
66 60 50         if (!((items == 11) || (items == 15)))
    50          
67 0           croak("Usage: PDL::levmar_der_(p,x,t,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
68             INPUT:
69             pdl *p
70             pdl *x
71             pdl *t
72             pdl *iopts
73             pdl *opts
74             pdl *covar=NO_INIT
75             pdl *returnval=NO_INIT
76             pdl *pout=NO_INIT
77             pdl *info=NO_INIT
78             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
79             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
80             IV jacn; { jacn = (IV)SvIV(jacn_SV); }
81             IV sjacn; { sjacn = (IV)SvIV(sjacn_SV); }
82             IV indat; { indat = (IV)SvIV(indat_SV); }
83             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
84             PPCODE:
85 60 50         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
86 60 50         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
87 60 50         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
88 60 50         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
89 60           PDL->barf_if_error(pdl_run_levmar_der_(p,x,t,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar));
90 60 50         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    50          
91              
92             void
93             pdl_run_levmar_der_lb_ub(p, x, t, lb, ub, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, jacn=jacn, sjacn=sjacn, indat=indat, want_covar=want_covar)
94             SV *covar_SV = (items == 17) ? ST(7) : NULL;
95             SV *returnval_SV = (items == 17) ? ST(8) : NULL;
96             SV *pout_SV = (items == 17) ? ST(9) : NULL;
97             SV *info_SV = (items == 17) ? ST(10) : NULL;
98             SV *funcn_SV = (items == 17) ? ST(11) : ST(7);
99             SV *sfuncn_SV = (items == 17) ? ST(12) : ST(8);
100             SV *jacn_SV = (items == 17) ? ST(13) : ST(9);
101             SV *sjacn_SV = (items == 17) ? ST(14) : ST(10);
102             SV *indat_SV = (items == 17) ? ST(15) : ST(11);
103             SV *want_covar_SV = (items == 17) ? ST(16) : ST(12);
104             PREINIT:
105 10 50         PDL_XS_PREAMBLE((items == 17) ? 0 : 4);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
106 10 50         if (!((items == 13) || (items == 17)))
    50          
107 0           croak("Usage: PDL::levmar_der_lb_ub(p,x,t,lb,ub,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
108             INPUT:
109             pdl *p
110             pdl *x
111             pdl *t
112             pdl *lb
113             pdl *ub
114             pdl *iopts
115             pdl *opts
116             pdl *covar=NO_INIT
117             pdl *returnval=NO_INIT
118             pdl *pout=NO_INIT
119             pdl *info=NO_INIT
120             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
121             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
122             IV jacn; { jacn = (IV)SvIV(jacn_SV); }
123             IV sjacn; { sjacn = (IV)SvIV(sjacn_SV); }
124             IV indat; { indat = (IV)SvIV(indat_SV); }
125             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
126             PPCODE:
127 10 50         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
128 10 50         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
129 10 50         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
130 10 50         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
131 10           PDL->barf_if_error(pdl_run_levmar_der_lb_ub(p,x,t,lb,ub,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar));
132 10 50         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    50          
133              
134             void
135             pdl_run_levmar_der_ub(p, x, t, ub, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, jacn=jacn, sjacn=sjacn, indat=indat, want_covar=want_covar)
136             SV *covar_SV = (items == 16) ? ST(6) : NULL;
137             SV *returnval_SV = (items == 16) ? ST(7) : NULL;
138             SV *pout_SV = (items == 16) ? ST(8) : NULL;
139             SV *info_SV = (items == 16) ? ST(9) : NULL;
140             SV *funcn_SV = (items == 16) ? ST(10) : ST(6);
141             SV *sfuncn_SV = (items == 16) ? ST(11) : ST(7);
142             SV *jacn_SV = (items == 16) ? ST(12) : ST(8);
143             SV *sjacn_SV = (items == 16) ? ST(13) : ST(9);
144             SV *indat_SV = (items == 16) ? ST(14) : ST(10);
145             SV *want_covar_SV = (items == 16) ? ST(15) : ST(11);
146             PREINIT:
147 0 0         PDL_XS_PREAMBLE((items == 16) ? 0 : 4);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
148 0 0         if (!((items == 12) || (items == 16)))
    0          
149 0           croak("Usage: PDL::levmar_der_ub(p,x,t,ub,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
150             INPUT:
151             pdl *p
152             pdl *x
153             pdl *t
154             pdl *ub
155             pdl *iopts
156             pdl *opts
157             pdl *covar=NO_INIT
158             pdl *returnval=NO_INIT
159             pdl *pout=NO_INIT
160             pdl *info=NO_INIT
161             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
162             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
163             IV jacn; { jacn = (IV)SvIV(jacn_SV); }
164             IV sjacn; { sjacn = (IV)SvIV(sjacn_SV); }
165             IV indat; { indat = (IV)SvIV(indat_SV); }
166             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
167             PPCODE:
168 0 0         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
169 0 0         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
170 0 0         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
171 0 0         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
172 0           PDL->barf_if_error(pdl_run_levmar_der_ub(p,x,t,ub,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar));
173 0 0         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    0          
174              
175             void
176             pdl_run_levmar_der_lb(p, x, t, lb, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, jacn=jacn, sjacn=sjacn, indat=indat, want_covar=want_covar)
177             SV *covar_SV = (items == 16) ? ST(6) : NULL;
178             SV *returnval_SV = (items == 16) ? ST(7) : NULL;
179             SV *pout_SV = (items == 16) ? ST(8) : NULL;
180             SV *info_SV = (items == 16) ? ST(9) : NULL;
181             SV *funcn_SV = (items == 16) ? ST(10) : ST(6);
182             SV *sfuncn_SV = (items == 16) ? ST(11) : ST(7);
183             SV *jacn_SV = (items == 16) ? ST(12) : ST(8);
184             SV *sjacn_SV = (items == 16) ? ST(13) : ST(9);
185             SV *indat_SV = (items == 16) ? ST(14) : ST(10);
186             SV *want_covar_SV = (items == 16) ? ST(15) : ST(11);
187             PREINIT:
188 0 0         PDL_XS_PREAMBLE((items == 16) ? 0 : 4);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
189 0 0         if (!((items == 12) || (items == 16)))
    0          
190 0           croak("Usage: PDL::levmar_der_lb(p,x,t,lb,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,jacn,sjacn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
191             INPUT:
192             pdl *p
193             pdl *x
194             pdl *t
195             pdl *lb
196             pdl *iopts
197             pdl *opts
198             pdl *covar=NO_INIT
199             pdl *returnval=NO_INIT
200             pdl *pout=NO_INIT
201             pdl *info=NO_INIT
202             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
203             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
204             IV jacn; { jacn = (IV)SvIV(jacn_SV); }
205             IV sjacn; { sjacn = (IV)SvIV(sjacn_SV); }
206             IV indat; { indat = (IV)SvIV(indat_SV); }
207             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
208             PPCODE:
209 0 0         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
210 0 0         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
211 0 0         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
212 0 0         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
213 0           PDL->barf_if_error(pdl_run_levmar_der_lb(p,x,t,lb,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,jacn,sjacn,indat,want_covar));
214 0 0         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    0          
215              
216             void
217             pdl_run_levmar_diff_(p, x, t, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, indat=indat, want_covar=want_covar)
218             SV *covar_SV = (items == 13) ? ST(5) : NULL;
219             SV *returnval_SV = (items == 13) ? ST(6) : NULL;
220             SV *pout_SV = (items == 13) ? ST(7) : NULL;
221             SV *info_SV = (items == 13) ? ST(8) : NULL;
222             SV *funcn_SV = (items == 13) ? ST(9) : ST(5);
223             SV *sfuncn_SV = (items == 13) ? ST(10) : ST(6);
224             SV *indat_SV = (items == 13) ? ST(11) : ST(7);
225             SV *want_covar_SV = (items == 13) ? ST(12) : ST(8);
226             PREINIT:
227 15 50         PDL_XS_PREAMBLE((items == 13) ? 0 : 4);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
228 15 50         if (!((items == 13) || (items == 9)))
    0          
229 0           croak("Usage: PDL::levmar_diff_(p,x,t,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
230             INPUT:
231             pdl *p
232             pdl *x
233             pdl *t
234             pdl *iopts
235             pdl *opts
236             pdl *covar=NO_INIT
237             pdl *returnval=NO_INIT
238             pdl *pout=NO_INIT
239             pdl *info=NO_INIT
240             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
241             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
242             IV indat; { indat = (IV)SvIV(indat_SV); }
243             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
244             PPCODE:
245 15 50         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
246 15 50         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
247 15 50         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
248 15 50         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
249 15           PDL->barf_if_error(pdl_run_levmar_diff_(p,x,t,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar));
250 15 50         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    50          
251              
252             void
253             pdl_run_levmar_diff_lb_ub(p, x, t, lb, ub, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, indat=indat, want_covar=want_covar)
254             SV *covar_SV = (items == 15) ? ST(7) : NULL;
255             SV *returnval_SV = (items == 15) ? ST(8) : NULL;
256             SV *pout_SV = (items == 15) ? ST(9) : NULL;
257             SV *info_SV = (items == 15) ? ST(10) : NULL;
258             SV *funcn_SV = (items == 15) ? ST(11) : ST(7);
259             SV *sfuncn_SV = (items == 15) ? ST(12) : ST(8);
260             SV *indat_SV = (items == 15) ? ST(13) : ST(9);
261             SV *want_covar_SV = (items == 15) ? ST(14) : ST(10);
262             PREINIT:
263 5 50         PDL_XS_PREAMBLE((items == 15) ? 0 : 4);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
264 5 50         if (!((items == 11) || (items == 15)))
    50          
265 0           croak("Usage: PDL::levmar_diff_lb_ub(p,x,t,lb,ub,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
266             INPUT:
267             pdl *p
268             pdl *x
269             pdl *t
270             pdl *lb
271             pdl *ub
272             pdl *iopts
273             pdl *opts
274             pdl *covar=NO_INIT
275             pdl *returnval=NO_INIT
276             pdl *pout=NO_INIT
277             pdl *info=NO_INIT
278             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
279             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
280             IV indat; { indat = (IV)SvIV(indat_SV); }
281             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
282             PPCODE:
283 5 50         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
284 5 50         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
285 5 50         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
286 5 50         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
287 5           PDL->barf_if_error(pdl_run_levmar_diff_lb_ub(p,x,t,lb,ub,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar));
288 5 50         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    50          
289              
290             void
291             pdl_run_levmar_diff_ub(p, x, t, ub, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, indat=indat, want_covar=want_covar)
292             SV *covar_SV = (items == 14) ? ST(6) : NULL;
293             SV *returnval_SV = (items == 14) ? ST(7) : NULL;
294             SV *pout_SV = (items == 14) ? ST(8) : NULL;
295             SV *info_SV = (items == 14) ? ST(9) : NULL;
296             SV *funcn_SV = (items == 14) ? ST(10) : ST(6);
297             SV *sfuncn_SV = (items == 14) ? ST(11) : ST(7);
298             SV *indat_SV = (items == 14) ? ST(12) : ST(8);
299             SV *want_covar_SV = (items == 14) ? ST(13) : ST(9);
300             PREINIT:
301 0 0         PDL_XS_PREAMBLE((items == 14) ? 0 : 4);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
302 0 0         if (!((items == 10) || (items == 14)))
    0          
303 0           croak("Usage: PDL::levmar_diff_ub(p,x,t,ub,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
304             INPUT:
305             pdl *p
306             pdl *x
307             pdl *t
308             pdl *ub
309             pdl *iopts
310             pdl *opts
311             pdl *covar=NO_INIT
312             pdl *returnval=NO_INIT
313             pdl *pout=NO_INIT
314             pdl *info=NO_INIT
315             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
316             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
317             IV indat; { indat = (IV)SvIV(indat_SV); }
318             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
319             PPCODE:
320 0 0         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
321 0 0         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
322 0 0         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
323 0 0         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
324 0           PDL->barf_if_error(pdl_run_levmar_diff_ub(p,x,t,ub,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar));
325 0 0         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    0          
326              
327             void
328             pdl_run_levmar_diff_lb(p, x, t, lb, iopts, opts, covar=covar, returnval=returnval, pout=pout, info=info, funcn=funcn, sfuncn=sfuncn, indat=indat, want_covar=want_covar)
329             SV *covar_SV = (items == 14) ? ST(6) : NULL;
330             SV *returnval_SV = (items == 14) ? ST(7) : NULL;
331             SV *pout_SV = (items == 14) ? ST(8) : NULL;
332             SV *info_SV = (items == 14) ? ST(9) : NULL;
333             SV *funcn_SV = (items == 14) ? ST(10) : ST(6);
334             SV *sfuncn_SV = (items == 14) ? ST(11) : ST(7);
335             SV *indat_SV = (items == 14) ? ST(12) : ST(8);
336             SV *want_covar_SV = (items == 14) ? ST(13) : ST(9);
337             PREINIT:
338 0 0         PDL_XS_PREAMBLE((items == 14) ? 0 : 4);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
339 0 0         if (!((items == 10) || (items == 14)))
    0          
340 0           croak("Usage: PDL::levmar_diff_lb(p,x,t,lb,iopts,opts,[covar],[returnval],[pout],[info],funcn,sfuncn,indat,want_covar) (you may leave [outputs] and values with =defaults out of list)");
341             INPUT:
342             pdl *p
343             pdl *x
344             pdl *t
345             pdl *lb
346             pdl *iopts
347             pdl *opts
348             pdl *covar=NO_INIT
349             pdl *returnval=NO_INIT
350             pdl *pout=NO_INIT
351             pdl *info=NO_INIT
352             IV funcn; { funcn = (IV)SvIV(funcn_SV); }
353             IV sfuncn; { sfuncn = (IV)SvIV(sfuncn_SV); }
354             IV indat; { indat = (IV)SvIV(indat_SV); }
355             int want_covar; { want_covar = (int)SvIV(want_covar_SV); }
356             PPCODE:
357 0 0         if (covar_SV) { covar = PDL_CORE_(SvPDLV)(covar_SV); } else covar = PDL_XS_PERLINIT_initsv(covar_SV);
    0          
358 0 0         if (returnval_SV) { returnval = PDL_CORE_(SvPDLV)(returnval_SV); } else returnval = PDL_XS_PERLINIT_initsv(returnval_SV);
    0          
359 0 0         if (pout_SV) { pout = PDL_CORE_(SvPDLV)(pout_SV); } else pout = PDL_XS_PERLINIT_initsv(pout_SV);
    0          
360 0 0         if (info_SV) { info = PDL_CORE_(SvPDLV)(info_SV); } else info = PDL_XS_PERLINIT_initsv(info_SV);
    0          
361 0           PDL->barf_if_error(pdl_run_levmar_diff_lb(p,x,t,lb,iopts,opts,covar,returnval,pout,info,funcn,sfuncn,indat,want_covar));
362 0 0         PDL_XS_RETURN(ST(0) = covar_SV;ST(1) = returnval_SV;ST(2) = pout_SV;ST(3) = info_SV)
    0          
    0          
    0          
    0          
363              
364             void
365             pdl_run__levmar_chkjac(p, t, err=err, func=func, sfunc=sfunc, jac=jac, sjac=sjac, indat=indat)
366             SV *err_SV = (items == 8) ? ST(2) : NULL;
367             SV *func_SV = (items == 8) ? ST(3) : ST(2);
368             SV *sfunc_SV = (items == 8) ? ST(4) : ST(3);
369             SV *jac_SV = (items == 8) ? ST(5) : ST(4);
370             SV *sjac_SV = (items == 8) ? ST(6) : ST(5);
371             SV *indat_SV = (items == 8) ? ST(7) : ST(6);
372             PREINIT:
373 4 50         PDL_XS_PREAMBLE((items == 8) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
374 4 50         if (!((items == 7) || (items == 8)))
    0          
375 0           croak("Usage: PDL::_levmar_chkjac(p,t,[err],func,sfunc,jac,sjac,indat) (you may leave [outputs] and values with =defaults out of list)");
376             INPUT:
377             pdl *p
378             pdl *t
379             pdl *err=NO_INIT
380             IV func; { func = (IV)SvIV(func_SV); }
381             IV sfunc; { sfunc = (IV)SvIV(sfunc_SV); }
382             IV jac; { jac = (IV)SvIV(jac_SV); }
383             IV sjac; { sjac = (IV)SvIV(sjac_SV); }
384             IV indat; { indat = (IV)SvIV(indat_SV); }
385             PPCODE:
386 4 50         if (err_SV) { err = PDL_CORE_(SvPDLV)(err_SV); } else err = PDL_XS_PERLINIT_initsv(err_SV);
    50          
387 4           PDL->barf_if_error(pdl_run__levmar_chkjac(p,t,err,func,sfunc,jac,sjac,indat));
388 4 50         PDL_XS_RETURN(ST(0) = err_SV)
    50          
    50          
    50          
    0          
389              
390             void
391             pdl_run__levmar_chkjac_no_t(p, err=err, func=func, sfunc=sfunc, jac=jac, sjac=sjac, N=N, indat=indat)
392             SV *err_SV = (items == 8) ? ST(1) : NULL;
393             SV *func_SV = (items == 8) ? ST(2) : ST(1);
394             SV *sfunc_SV = (items == 8) ? ST(3) : ST(2);
395             SV *jac_SV = (items == 8) ? ST(4) : ST(3);
396             SV *sjac_SV = (items == 8) ? ST(5) : ST(4);
397             SV *N_SV = (items == 8) ? ST(6) : ST(5);
398             SV *indat_SV = (items == 8) ? ST(7) : ST(6);
399             PREINIT:
400 0 0         PDL_XS_PREAMBLE((items == 8) ? 0 : 1);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
401 0 0         if (!((items == 7) || (items == 8)))
    0          
402 0           croak("Usage: PDL::_levmar_chkjac_no_t(p,[err],func,sfunc,jac,sjac,N,indat) (you may leave [outputs] and values with =defaults out of list)");
403             INPUT:
404             pdl *p
405             pdl *err=NO_INIT
406             IV func; { func = (IV)SvIV(func_SV); }
407             IV sfunc; { sfunc = (IV)SvIV(sfunc_SV); }
408             IV jac; { jac = (IV)SvIV(jac_SV); }
409             IV sjac; { sjac = (IV)SvIV(sjac_SV); }
410             int N; { N = (int)SvIV(N_SV); }
411             IV indat; { indat = (IV)SvIV(indat_SV); }
412             PPCODE:
413 0 0         if (err_SV) { err = PDL_CORE_(SvPDLV)(err_SV); } else err = PDL_XS_PERLINIT_initsv(err_SV);
    0          
414 0           PDL->barf_if_error(pdl_run__levmar_chkjac_no_t(p,err,func,sfunc,jac,sjac,N,indat));
415 0 0         PDL_XS_RETURN(ST(0) = err_SV)
    0          
    0          
    0          
    0          
416              
417             MODULE = PDL::Fit::Levmar PACKAGE = PDL::Fit::Levmar
418              
419              
420              
421              
422             void *
423             DFP_create()
424              
425             CODE:
426             DFP * dat;
427 10           dat = (DFP *)malloc(sizeof( DFP ));
428 10 50         if ( NULL == dat ) {
429 0           fprintf(stderr, "Can't allocate storage for dat in DFP_create\n");
430 0           exit(1);
431             }
432 10 100         RETVAL = dat;
433             OUTPUT:
434             RETVAL
435              
436             void
437             DFP_free( dat )
438             IV dat
439            
440             CODE:
441 12 100         if ( (DFP *) dat) free( (DFP *) dat);
442              
443              
444             void
445             DFP_set_perl_funcs ( data, perl_fit_func, perl_jac_func )
446             IV data
447             SV* perl_fit_func
448             SV* perl_jac_func
449              
450             CODE:
451 10           DFP *dat = (DFP *) data;
452 10 50         if ( dat == NULL ) {
453 0           fprintf(stderr, "DFP_set_perl_funcs got null struct\n");
454 0           exit(1);
455             }
456 10           dat->perl_fit_func = perl_fit_func;
457 10           dat->perl_jac_func = perl_jac_func;
458              
459              
460             double
461             get_dbl_max( )
462             CODE:
463 9 100         RETVAL = DBL_MAX;
464             OUTPUT:
465             RETVAL
466              
467             double
468             LM_INIT_MU( )
469             CODE:
470 7 50         RETVAL = LM_INIT_MU;
471             OUTPUT:
472             RETVAL
473              
474             double
475             LM_STOP_THRESH( )
476             CODE:
477 21 50         RETVAL = LM_STOP_THRESH;
478             OUTPUT:
479             RETVAL
480              
481             double
482             LM_DIFF_DELTA( )
483             CODE:
484 7 50         RETVAL = LM_DIFF_DELTA;
485             OUTPUT:
486             RETVAL
487              
488              
489             =pod
490              
491              
492             =begin comment
493              
494             The next two routines just get pointers to functions from
495             the C code and return them as SVs to perl. The functions
496             are the C wrappers to the users _perl_ fit and jacobian
497             functions. LEVFUNC and JLEVFUNC should be re-entrant so
498             the following two routines can called once when the
499             Levmar::Func module is loaded and can be shared by all
500             object instances.
501              
502             =end comment
503              
504             =cut
505              
506             void *
507             get_perl_func_wrapper( )
508              
509             CODE:
510 7 50         RETVAL = &LEVFUNC;
511             OUTPUT:
512             RETVAL
513              
514             void *
515             get_perl_jac_wrapper( )
516              
517             CODE:
518 7 50         RETVAL = &JLEVFUNC;
519             OUTPUT:
520             RETVAL
521              
522              
523              
524              
525             MODULE = PDL::Fit::Levmar PACKAGE = PDL PREFIX=pdl_run_
526              
527              
528              
529             #line 483 "lib/PDL/PP.pm"
530             BOOT:
531             /* Get pointer to structure of core shared C routines */
532             /* make sure PDL::Core is loaded */
533             #line 534 "Levmar.xs"
534 7           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
535             #ifndef aTHX_
536             #define aTHX_
537             #endif
538 7 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
539 7           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
540 7 50         if (!CoreSV)
541 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
542 7 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
543 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
544 7 50         if (PDL->Version != PDL_CORE_VERSION)
545 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::Fit::Levmar needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);