File Coverage

lib/PDL/Primitive-pp-pchip_chid.c
Criterion Covered Total %
statement 64 120 53.3
branch 62 324 19.1
condition n/a
subroutine n/a
pod n/a
total 126 444 28.3


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 lib/PDL/Primitive.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_Primitive
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/Primitive-pp-pchip_chid.c"
23             extern int pdl_srand_threads;
24             extern uint64_t *pdl_rand_state;
25             void pdl_srand(uint64_t **s, uint64_t seed, int n);
26             double pdl_drand(uint64_t *s);
27             #define PDL_MAYBE_SRAND \
28             if (pdl_srand_threads < 0) \
29             pdl_srand(&pdl_rand_state, PDL->pdl_seed(), PDL->online_cpus());
30             #define PDL_RAND_SET_OFFSET(v, thr, pdl) \
31             if (v < 0) { \
32             if (thr.mag_nthr >= 0) { \
33             int thr_no = PDL->magic_get_thread(pdl); \
34             if (thr_no < 0) return PDL->make_error_simple(PDL_EFATAL, "Invalid pdl_magic_get_thread!"); \
35             v = thr_no == 0 ? thr_no : thr_no % PDL->online_cpus(); \
36             } else { \
37             v = 0; \
38             } \
39             }
40              
41             #line 1857 "lib/PDL/PP.pm"
42             pdl_error pdl_pchip_chid_redodims(pdl_trans *__privtrans) {
43             pdl_error PDL_err = {0, NULL, 0};
44             #line 45 "lib/PDL/Primitive-pp-pchip_chid.c"
45             #ifndef PDL_DECLARE_PARAMS_pchip_chid_0
46             #define PDL_DECLARE_PARAMS_pchip_chid_0(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_ia,PDL_PPSYM_PARAM_ia,PDL_TYPE_PARAM_ib,PDL_PPSYM_PARAM_ib,PDL_TYPE_PARAM_ierr,PDL_PPSYM_PARAM_ierr,PDL_TYPE_PARAM_skip,PDL_PPSYM_PARAM_skip) \
47             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 0, PDL_PPSYM_OP) \
48             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, f, (__privtrans->pdls[1]), 0, PDL_PPSYM_OP) \
49             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, d, (__privtrans->pdls[2]), 0, PDL_PPSYM_OP) \
50             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ia, ia, (__privtrans->pdls[3]), 0, PDL_PPSYM_PARAM_ia) \
51             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ib, ib, (__privtrans->pdls[4]), 0, PDL_PPSYM_PARAM_ib) \
52             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ans, (__privtrans->pdls[5]), 0, PDL_PPSYM_OP) \
53             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ierr, ierr, (__privtrans->pdls[6]), 0, PDL_PPSYM_PARAM_ierr) \
54             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_skip, skip, (__privtrans->pdls[7]), 0, PDL_PPSYM_PARAM_skip)
55             #endif
56             #define PDL_IF_BAD(t,f) f
57 2           switch (__privtrans->__datatype) { /* Start generic switch */
58 0           case PDL_F: {
59 0 0         PDL_DECLARE_PARAMS_pchip_chid_0(PDL_Float,F,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
60 0 0         {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "NUMBER OF DATA POINTS LESS THAN TWO");
61             }
62 0           } break;
63 2           case PDL_D: {
64 2 50         PDL_DECLARE_PARAMS_pchip_chid_0(PDL_Double,D,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
65 2 50         {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "NUMBER OF DATA POINTS LESS THAN TWO");
66             }
67 2           } break;
68 0           case PDL_LD: {
69 0 0         PDL_DECLARE_PARAMS_pchip_chid_0(PDL_LDouble,E,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
70 0 0         {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "NUMBER OF DATA POINTS LESS THAN TWO");
71             }
72 0           } break;
73 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in pchip_chid: unhandled datatype(%d), only handles (FDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
74             }
75             #undef PDL_IF_BAD
76              
77 2 50         PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans));
78 2           return PDL_err;
79             }
80              
81              
82             #line 1857 "lib/PDL/PP.pm"
83             pdl_error pdl_pchip_chid_readdata(pdl_trans *__privtrans) {
84             pdl_error PDL_err = {0, NULL, 0};
85             #line 86 "lib/PDL/Primitive-pp-pchip_chid.c"
86 2           register PDL_Indx __n_size = __privtrans->ind_sizes[0];
87 2 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "broadcast.incs NULL");
88             /* broadcastloop declarations */
89             int __brcloopval;
90             register PDL_Indx __tind0,__tind1; /* counters along dim */
91 2           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
92             /* dims here are how many steps along those dims */
93 2           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
94 2           register PDL_Indx __tinc0_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
95 2           register PDL_Indx __tinc0_d = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
96 2           register PDL_Indx __tinc0_ia = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
97 2           register PDL_Indx __tinc0_ib = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
98 2           register PDL_Indx __tinc0_ans = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
99 2           register PDL_Indx __tinc0_ierr = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
100 2           register PDL_Indx __tinc0_skip = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0);
101 2           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
102 2           register PDL_Indx __tinc1_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
103 2           register PDL_Indx __tinc1_d = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
104 2           register PDL_Indx __tinc1_ia = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
105 2           register PDL_Indx __tinc1_ib = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
106 2           register PDL_Indx __tinc1_ans = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
107 2           register PDL_Indx __tinc1_ierr = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
108 2           register PDL_Indx __tinc1_skip = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1);
109             #define PDL_BROADCASTLOOP_START_pchip_chid_readdata PDL_BROADCASTLOOP_START( \
110             readdata, \
111             __privtrans->broadcast, \
112             __privtrans->vtable, \
113             x_datap += __offsp[0]; \
114             f_datap += __offsp[1]; \
115             d_datap += __offsp[2]; \
116             ia_datap += __offsp[3]; \
117             ib_datap += __offsp[4]; \
118             ans_datap += __offsp[5]; \
119             ierr_datap += __offsp[6]; \
120             skip_datap += __offsp[7]; \
121             , \
122             ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
123             ,f_datap += __tinc1_f - __tinc0_f * __tdims0 \
124             ,d_datap += __tinc1_d - __tinc0_d * __tdims0 \
125             ,ia_datap += __tinc1_ia - __tinc0_ia * __tdims0 \
126             ,ib_datap += __tinc1_ib - __tinc0_ib * __tdims0 \
127             ,ans_datap += __tinc1_ans - __tinc0_ans * __tdims0 \
128             ,ierr_datap += __tinc1_ierr - __tinc0_ierr * __tdims0 \
129             ,skip_datap += __tinc1_skip - __tinc0_skip * __tdims0 \
130             ), \
131             ( ,x_datap += __tinc0_x \
132             ,f_datap += __tinc0_f \
133             ,d_datap += __tinc0_d \
134             ,ia_datap += __tinc0_ia \
135             ,ib_datap += __tinc0_ib \
136             ,ans_datap += __tinc0_ans \
137             ,ierr_datap += __tinc0_ierr \
138             ,skip_datap += __tinc0_skip \
139             ) \
140             )
141             #define PDL_BROADCASTLOOP_END_pchip_chid_readdata PDL_BROADCASTLOOP_END( \
142             __privtrans->broadcast, \
143             x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \
144             f_datap -= __tinc1_f * __tdims1 + __offsp[1]; \
145             d_datap -= __tinc1_d * __tdims1 + __offsp[2]; \
146             ia_datap -= __tinc1_ia * __tdims1 + __offsp[3]; \
147             ib_datap -= __tinc1_ib * __tdims1 + __offsp[4]; \
148             ans_datap -= __tinc1_ans * __tdims1 + __offsp[5]; \
149             ierr_datap -= __tinc1_ierr * __tdims1 + __offsp[6]; \
150             skip_datap -= __tinc1_skip * __tdims1 + __offsp[7]; \
151             )
152 2           register PDL_Indx __inc_d_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_d_n;
153 2           register PDL_Indx __inc_f_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_f_n;
154 2           register PDL_Indx __inc_x_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_n;
155             #ifndef PDL_DECLARE_PARAMS_pchip_chid_1
156             #define PDL_DECLARE_PARAMS_pchip_chid_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_ia,PDL_PPSYM_PARAM_ia,PDL_TYPE_PARAM_ib,PDL_PPSYM_PARAM_ib,PDL_TYPE_PARAM_ierr,PDL_PPSYM_PARAM_ierr,PDL_TYPE_PARAM_skip,PDL_PPSYM_PARAM_skip) \
157             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
158             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, f, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
159             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, d, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
160             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ia, ia, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_ia) \
161             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ib, ib, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_ib) \
162             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, ans, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP) \
163             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ierr, ierr, (__privtrans->pdls[6]), 1, PDL_PPSYM_PARAM_ierr) \
164             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_skip, skip, (__privtrans->pdls[7]), 1, PDL_PPSYM_PARAM_skip)
165             #endif
166             #define PDL_IF_BAD(t,f) f
167 2           switch (__privtrans->__datatype) { /* Start generic switch */
168 0           case PDL_F: {
169 0 0         PDL_DECLARE_PARAMS_pchip_chid_1(PDL_Float,F,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
170 0 0         PDL_BROADCASTLOOP_START_pchip_chid_readdata {if (!(skip_datap)[0]) {
    0          
    0          
    0          
    0          
    0          
    0          
    0          
171 0 0         {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
172 0 0         if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue;
173 0           (ierr_datap)[0] = -1;
174 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "X-ARRAY NOT STRICTLY INCREASING");
175             }} /* Close n=1 */
176             }
177              
178             /* Programming notes: */
179             /* 1. This routine uses a special formula that is valid only for */
180             /* integrals whose limits coincide with data values. This is */
181             /* mathematically equivalent to, but much more efficient than, */
182             /* calls to DCHFIE. */
183             /* VALIDITY-CHECK ARGUMENTS. */
184             do {
185             /* FUNCTION DEFINITION IS OK, GO ON. */
186 0           (skip_datap)[0] = 1;
187 0 0         if ((ia_datap)[0] < 0 || (ia_datap)[0] > __privtrans->ind_sizes[0]-1 || (ib_datap)[0] < 0 || (ib_datap)[0] > __privtrans->ind_sizes[0]-1) {
    0          
    0          
    0          
188 0           (ierr_datap)[0] = -4;
189 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "IA OR IB OUT OF RANGE");
190             }
191 0           (ierr_datap)[0] = 0;
192             /* COMPUTE INTEGRAL VALUE. */
193 0 0         if ((ia_datap)[0] == (ib_datap)[0]) { (ans_datap)[0] = 0; continue; }
194 0           PDL_Indx low = PDLMIN((ia_datap)[0],(ib_datap)[0]), iup = PDLMAX((ia_datap)[0],(ib_datap)[0]);
195 0           PDL_Float sum = 0.;
196 0 0         {/* Open n=low:iup */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((low),0), __n_stop=PDLMIN(iup, (__n_size))); for(; n<__n_stop; n+=1) {
197 0           PDL_Float h = (x_datap)[0+(__inc_x_n*(n+1))] - (x_datap)[0+(__inc_x_n*(n))];
198 0           sum += h * ((f_datap)[0+(__inc_f_n*(n))] + (f_datap)[0+(__inc_f_n*(n+1))] + ((d_datap)[0+(__inc_d_n*(n))] - (d_datap)[0+(__inc_d_n*(n+1))]) * (h / 6.));
199             }} /* Close n=low:iup */
200 0 0         (ans_datap)[0] = 0.5 * ((ia_datap)[0] > (ib_datap)[0] ? -sum : sum);
201             } while(0)
202             ;
203 0 0         }PDL_BROADCASTLOOP_END_pchip_chid_readdata
    0          
204 0           } break;
205 2           case PDL_D: {
206 2 50         PDL_DECLARE_PARAMS_pchip_chid_1(PDL_Double,D,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
207 10 50         PDL_BROADCASTLOOP_START_pchip_chid_readdata {if (!(skip_datap)[0]) {
    50          
    50          
    50          
    50          
    50          
    100          
    100          
208 42 100         {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
209 38 50         if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue;
210 0           (ierr_datap)[0] = -1;
211 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "X-ARRAY NOT STRICTLY INCREASING");
212             }} /* Close n=1 */
213             }
214              
215             /* Programming notes: */
216             /* 1. This routine uses a special formula that is valid only for */
217             /* integrals whose limits coincide with data values. This is */
218             /* mathematically equivalent to, but much more efficient than, */
219             /* calls to DCHFIE. */
220             /* VALIDITY-CHECK ARGUMENTS. */
221             do {
222             /* FUNCTION DEFINITION IS OK, GO ON. */
223 4           (skip_datap)[0] = 1;
224 4 50         if ((ia_datap)[0] < 0 || (ia_datap)[0] > __privtrans->ind_sizes[0]-1 || (ib_datap)[0] < 0 || (ib_datap)[0] > __privtrans->ind_sizes[0]-1) {
    50          
    50          
    50          
225 0           (ierr_datap)[0] = -4;
226 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "IA OR IB OUT OF RANGE");
227             }
228 4           (ierr_datap)[0] = 0;
229             /* COMPUTE INTEGRAL VALUE. */
230 4 50         if ((ia_datap)[0] == (ib_datap)[0]) { (ans_datap)[0] = 0; continue; }
231 4           PDL_Indx low = PDLMIN((ia_datap)[0],(ib_datap)[0]), iup = PDLMAX((ia_datap)[0],(ib_datap)[0]);
232 4           PDL_Double sum = 0.;
233 21 100         {/* Open n=low:iup */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((low),0), __n_stop=PDLMIN(iup, (__n_size))); for(; n<__n_stop; n+=1) {
234 17           PDL_Double h = (x_datap)[0+(__inc_x_n*(n+1))] - (x_datap)[0+(__inc_x_n*(n))];
235 17           sum += h * ((f_datap)[0+(__inc_f_n*(n))] + (f_datap)[0+(__inc_f_n*(n+1))] + ((d_datap)[0+(__inc_d_n*(n))] - (d_datap)[0+(__inc_d_n*(n+1))]) * (h / 6.));
236             }} /* Close n=low:iup */
237 4 50         (ans_datap)[0] = 0.5 * ((ia_datap)[0] > (ib_datap)[0] ? -sum : sum);
238             } while(0)
239             ;
240 2 50         }PDL_BROADCASTLOOP_END_pchip_chid_readdata
    50          
241 2           } break;
242 0           case PDL_LD: {
243 0 0         PDL_DECLARE_PARAMS_pchip_chid_1(PDL_LDouble,E,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Long,L)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
244 0 0         PDL_BROADCASTLOOP_START_pchip_chid_readdata {if (!(skip_datap)[0]) {
    0          
    0          
    0          
    0          
    0          
    0          
    0          
245 0 0         {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
246 0 0         if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue;
247 0           (ierr_datap)[0] = -1;
248 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "X-ARRAY NOT STRICTLY INCREASING");
249             }} /* Close n=1 */
250             }
251              
252             /* Programming notes: */
253             /* 1. This routine uses a special formula that is valid only for */
254             /* integrals whose limits coincide with data values. This is */
255             /* mathematically equivalent to, but much more efficient than, */
256             /* calls to DCHFIE. */
257             /* VALIDITY-CHECK ARGUMENTS. */
258             do {
259             /* FUNCTION DEFINITION IS OK, GO ON. */
260 0           (skip_datap)[0] = 1;
261 0 0         if ((ia_datap)[0] < 0 || (ia_datap)[0] > __privtrans->ind_sizes[0]-1 || (ib_datap)[0] < 0 || (ib_datap)[0] > __privtrans->ind_sizes[0]-1) {
    0          
    0          
    0          
262 0           (ierr_datap)[0] = -4;
263 0           return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chid:" "IA OR IB OUT OF RANGE");
264             }
265 0           (ierr_datap)[0] = 0;
266             /* COMPUTE INTEGRAL VALUE. */
267 0 0         if ((ia_datap)[0] == (ib_datap)[0]) { (ans_datap)[0] = 0; continue; }
268 0           PDL_Indx low = PDLMIN((ia_datap)[0],(ib_datap)[0]), iup = PDLMAX((ia_datap)[0],(ib_datap)[0]);
269 0           PDL_LDouble sum = 0.;
270 0 0         {/* Open n=low:iup */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((low),0), __n_stop=PDLMIN(iup, (__n_size))); for(; n<__n_stop; n+=1) {
271 0           PDL_LDouble h = (x_datap)[0+(__inc_x_n*(n+1))] - (x_datap)[0+(__inc_x_n*(n))];
272 0           sum += h * ((f_datap)[0+(__inc_f_n*(n))] + (f_datap)[0+(__inc_f_n*(n+1))] + ((d_datap)[0+(__inc_d_n*(n))] - (d_datap)[0+(__inc_d_n*(n+1))]) * (h / 6.));
273             }} /* Close n=low:iup */
274 0 0         (ans_datap)[0] = 0.5 * ((ia_datap)[0] > (ib_datap)[0] ? -sum : sum);
275             } while(0)
276             ;
277 0 0         }PDL_BROADCASTLOOP_END_pchip_chid_readdata
    0          
278 0           } break;
279 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in pchip_chid: unhandled datatype(%d), only handles (FDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
280             }
281             #undef PDL_IF_BAD
282 2           return PDL_err;
283             }
284              
285             static pdl_datatypes pdl_pchip_chid_vtable_gentypes[] = { PDL_F, PDL_D, PDL_LD, -1 };
286             static PDL_Indx pdl_pchip_chid_vtable_realdims[] = { 1, 1, 1, 0, 0, 0, 0, 0 };
287             static char *pdl_pchip_chid_vtable_parnames[] = { "x","f","d","ia","ib","ans","ierr","skip" };
288             static short pdl_pchip_chid_vtable_parflags[] = {
289             0,
290             0,
291             0,
292             PDL_PARAM_ISTYPED,
293             PDL_PARAM_ISTYPED,
294             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE,
295             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
296             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
297             };
298             static pdl_datatypes pdl_pchip_chid_vtable_partypes[] = { -1, -1, -1, PDL_IND, PDL_IND, -1, PDL_IND, PDL_L };
299             static PDL_Indx pdl_pchip_chid_vtable_realdims_starts[] = { 0, 1, 2, 3, 3, 3, 3, 3 };
300             static PDL_Indx pdl_pchip_chid_vtable_realdims_ind_ids[] = { 0, 0, 0 };
301             static char *pdl_pchip_chid_vtable_indnames[] = { "n" };
302             pdl_transvtable pdl_pchip_chid_vtable = {
303             PDL_TRANS_DO_BROADCAST, 0, pdl_pchip_chid_vtable_gentypes, 5, 8, NULL /*CORE21*/,
304             pdl_pchip_chid_vtable_realdims, pdl_pchip_chid_vtable_parnames,
305             pdl_pchip_chid_vtable_parflags, pdl_pchip_chid_vtable_partypes,
306             pdl_pchip_chid_vtable_realdims_starts, pdl_pchip_chid_vtable_realdims_ind_ids, 3,
307             1, pdl_pchip_chid_vtable_indnames,
308             pdl_pchip_chid_redodims, pdl_pchip_chid_readdata, NULL,
309             NULL,
310             0,"PDL::Primitive::pchip_chid"
311             };
312              
313              
314 2           pdl_error pdl_run_pchip_chid(pdl *x,pdl *f,pdl *d,pdl *ia,pdl *ib,pdl *ans,pdl *ierr,pdl *skip) {
315 2           pdl_error PDL_err = {0, NULL, 0};
316 2 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
317 2           pdl_trans *__privtrans = PDL->create_trans(&pdl_pchip_chid_vtable);
318 2 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
319 2           __privtrans->pdls[0] = x;
320 2           __privtrans->pdls[1] = f;
321 2           __privtrans->pdls[2] = d;
322 2           __privtrans->pdls[3] = ia;
323 2           __privtrans->pdls[4] = ib;
324 2           __privtrans->pdls[5] = ans;
325 2           __privtrans->pdls[6] = ierr;
326 2           __privtrans->pdls[7] = skip;
327 2 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
328 2 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
329 2           return PDL_err;
330             }