| 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_chfd.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 1888 "lib/PDL/PP.pm" |
| 42 |
|
| pdl_error pdl_pchip_chfd_redodims(pdl_trans *__privtrans) { |
| 43 |
|
| pdl_error PDL_err = {0, NULL, 0}; |
| 44 |
|
| #line 45 "lib/PDL/Primitive-pp-pchip_chfd.c" |
| 45 |
|
| #ifndef PDL_DECLARE_PARAMS_pchip_chfd_0 |
| 46 |
|
| #define PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_TYPE_OP,PDL_PPSYM_OP,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_OP, xe, (__privtrans->pdls[3]), 0, PDL_PPSYM_OP) \ |
| 51 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, fe, (__privtrans->pdls[4]), 0, PDL_PPSYM_OP) \ |
| 52 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, de, (__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 |
3 |
| switch (__privtrans->__datatype) { /* Start generic switch */ |
| 58 |
0 |
| case PDL_F: { |
| 59 |
0 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
Branch: 8 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
|
| 60 |
0 |
▶ | {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
Branch: 1 branch
| Branch | True | False | Total |
| {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
0 |
0 |
0 |
|
| 61 |
0 |
▶ | if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
0 |
0 |
0 |
|
| 62 |
|
| } |
| 63 |
0 |
| } break; |
| 64 |
3 |
| case PDL_D: { |
| 65 |
3 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
Branch: 8 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
|
| 66 |
3 |
▶ | {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
Branch: 1 branch
| Branch | True | False | Total |
| {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
0 |
3 |
3 |
|
| 67 |
3 |
▶ | if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
0 |
3 |
3 |
|
| 68 |
|
| } |
| 69 |
3 |
| } break; |
| 70 |
0 |
| case PDL_LD: { |
| 71 |
0 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
Branch: 8 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_0(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
|
| 72 |
0 |
▶ | {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
Branch: 1 branch
| Branch | True | False | Total |
| {if (__privtrans->ind_sizes[0] < 2) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF DATA POINTS LESS THAN TWO"); |
0 |
0 |
0 |
|
| 73 |
0 |
▶ | if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (__privtrans->ind_sizes[1] < 1) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "NUMBER OF EVALUATION POINTS LESS THAN ONE"); |
0 |
0 |
0 |
|
| 74 |
|
| } |
| 75 |
0 |
| } break; |
| 76 |
0 |
| default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in pchip_chfd: unhandled datatype(%d), only handles (FDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
| 77 |
|
| } |
| 78 |
|
| #undef PDL_IF_BAD |
| 79 |
|
| |
| 80 |
3 |
▶ | PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans)); |
0 |
3 |
3 |
|
| 81 |
3 |
| return PDL_err; |
| 82 |
|
| } |
| 83 |
|
| |
| 84 |
|
| |
| 85 |
|
| #line 1888 "lib/PDL/PP.pm" |
| 86 |
|
| pdl_error pdl_pchip_chfd_readdata(pdl_trans *__privtrans) { |
| 87 |
|
| pdl_error PDL_err = {0, NULL, 0}; |
| 88 |
|
| #line 89 "lib/PDL/Primitive-pp-pchip_chfd.c" |
| 89 |
3 |
| register PDL_Indx __n_size = __privtrans->ind_sizes[0]; |
| 90 |
3 |
| register PDL_Indx __ne_size = __privtrans->ind_sizes[1]; |
| 91 |
3 |
▶ | if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "broadcast.incs NULL"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "broadcast.incs NULL"); |
0 |
3 |
3 |
|
| 92 |
|
| /* broadcastloop declarations */ |
| 93 |
|
| int __brcloopval; |
| 94 |
|
| register PDL_Indx __tind0,__tind1; /* counters along dim */ |
| 95 |
3 |
| register PDL_Indx __tnpdls = __privtrans->broadcast.npdls; |
| 96 |
|
| /* dims here are how many steps along those dims */ |
| 97 |
3 |
| register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0); |
| 98 |
3 |
| register PDL_Indx __tinc0_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0); |
| 99 |
3 |
| register PDL_Indx __tinc0_d = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0); |
| 100 |
3 |
| register PDL_Indx __tinc0_xe = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0); |
| 101 |
3 |
| register PDL_Indx __tinc0_fe = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0); |
| 102 |
3 |
| register PDL_Indx __tinc0_de = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0); |
| 103 |
3 |
| register PDL_Indx __tinc0_ierr = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0); |
| 104 |
3 |
| register PDL_Indx __tinc0_skip = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,0); |
| 105 |
3 |
| register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1); |
| 106 |
3 |
| register PDL_Indx __tinc1_f = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1); |
| 107 |
3 |
| register PDL_Indx __tinc1_d = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1); |
| 108 |
3 |
| register PDL_Indx __tinc1_xe = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1); |
| 109 |
3 |
| register PDL_Indx __tinc1_fe = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1); |
| 110 |
3 |
| register PDL_Indx __tinc1_de = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1); |
| 111 |
3 |
| register PDL_Indx __tinc1_ierr = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1); |
| 112 |
3 |
| register PDL_Indx __tinc1_skip = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,7,1); |
| 113 |
|
| #define PDL_BROADCASTLOOP_START_pchip_chfd_readdata PDL_BROADCASTLOOP_START( \ |
| 114 |
|
| readdata, \ |
| 115 |
|
| __privtrans->broadcast, \ |
| 116 |
|
| __privtrans->vtable, \ |
| 117 |
|
| x_datap += __offsp[0]; \ |
| 118 |
|
| f_datap += __offsp[1]; \ |
| 119 |
|
| d_datap += __offsp[2]; \ |
| 120 |
|
| xe_datap += __offsp[3]; \ |
| 121 |
|
| fe_datap += __offsp[4]; \ |
| 122 |
|
| de_datap += __offsp[5]; \ |
| 123 |
|
| ierr_datap += __offsp[6]; \ |
| 124 |
|
| skip_datap += __offsp[7]; \ |
| 125 |
|
| , \ |
| 126 |
|
| ( ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \ |
| 127 |
|
| ,f_datap += __tinc1_f - __tinc0_f * __tdims0 \ |
| 128 |
|
| ,d_datap += __tinc1_d - __tinc0_d * __tdims0 \ |
| 129 |
|
| ,xe_datap += __tinc1_xe - __tinc0_xe * __tdims0 \ |
| 130 |
|
| ,fe_datap += __tinc1_fe - __tinc0_fe * __tdims0 \ |
| 131 |
|
| ,de_datap += __tinc1_de - __tinc0_de * __tdims0 \ |
| 132 |
|
| ,ierr_datap += __tinc1_ierr - __tinc0_ierr * __tdims0 \ |
| 133 |
|
| ,skip_datap += __tinc1_skip - __tinc0_skip * __tdims0 \ |
| 134 |
|
| ), \ |
| 135 |
|
| ( ,x_datap += __tinc0_x \ |
| 136 |
|
| ,f_datap += __tinc0_f \ |
| 137 |
|
| ,d_datap += __tinc0_d \ |
| 138 |
|
| ,xe_datap += __tinc0_xe \ |
| 139 |
|
| ,fe_datap += __tinc0_fe \ |
| 140 |
|
| ,de_datap += __tinc0_de \ |
| 141 |
|
| ,ierr_datap += __tinc0_ierr \ |
| 142 |
|
| ,skip_datap += __tinc0_skip \ |
| 143 |
|
| ) \ |
| 144 |
|
| ) |
| 145 |
|
| #define PDL_BROADCASTLOOP_END_pchip_chfd_readdata PDL_BROADCASTLOOP_END( \ |
| 146 |
|
| __privtrans->broadcast, \ |
| 147 |
|
| x_datap -= __tinc1_x * __tdims1 + __offsp[0]; \ |
| 148 |
|
| f_datap -= __tinc1_f * __tdims1 + __offsp[1]; \ |
| 149 |
|
| d_datap -= __tinc1_d * __tdims1 + __offsp[2]; \ |
| 150 |
|
| xe_datap -= __tinc1_xe * __tdims1 + __offsp[3]; \ |
| 151 |
|
| fe_datap -= __tinc1_fe * __tdims1 + __offsp[4]; \ |
| 152 |
|
| de_datap -= __tinc1_de * __tdims1 + __offsp[5]; \ |
| 153 |
|
| ierr_datap -= __tinc1_ierr * __tdims1 + __offsp[6]; \ |
| 154 |
|
| skip_datap -= __tinc1_skip * __tdims1 + __offsp[7]; \ |
| 155 |
|
| ) |
| 156 |
3 |
| register PDL_Indx __inc_d_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_d_n; |
| 157 |
3 |
| register PDL_Indx __inc_de_ne = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,5,0)]; (void)__inc_de_ne; |
| 158 |
3 |
| register PDL_Indx __inc_f_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_f_n; |
| 159 |
3 |
| register PDL_Indx __inc_fe_ne = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_fe_ne; |
| 160 |
3 |
| register PDL_Indx __inc_x_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_x_n; |
| 161 |
3 |
| register PDL_Indx __inc_xe_ne = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_xe_ne; |
| 162 |
|
| #ifndef PDL_DECLARE_PARAMS_pchip_chfd_1 |
| 163 |
|
| #define PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_ierr,PDL_PPSYM_PARAM_ierr,PDL_TYPE_PARAM_skip,PDL_PPSYM_PARAM_skip) \ |
| 164 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \ |
| 165 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, f, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \ |
| 166 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, d, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \ |
| 167 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, xe, (__privtrans->pdls[3]), 1, PDL_PPSYM_OP) \ |
| 168 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, fe, (__privtrans->pdls[4]), 1, PDL_PPSYM_OP) \ |
| 169 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_OP, de, (__privtrans->pdls[5]), 1, PDL_PPSYM_OP) \ |
| 170 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ierr, ierr, (__privtrans->pdls[6]), 1, PDL_PPSYM_PARAM_ierr) \ |
| 171 |
|
| PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_skip, skip, (__privtrans->pdls[7]), 1, PDL_PPSYM_PARAM_skip) |
| 172 |
|
| #endif |
| 173 |
|
| #define PDL_IF_BAD(t,f) f |
| 174 |
3 |
| switch (__privtrans->__datatype) { /* Start generic switch */ |
| 175 |
0 |
| case PDL_F: { |
| 176 |
0 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
Branch: 24 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Float,F,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
|
| 177 |
0 |
▶ | PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
|
| 178 |
|
| #line 5456 "lib/PDL/Primitive.pd" |
| 179 |
|
| |
| 180 |
|
| /* Programming notes: */ |
| 181 |
|
| /* 2. Most of the coding between the call to DCHFDV and the end of */ |
| 182 |
|
| /* the IR-loop could be eliminated if it were permissible to */ |
| 183 |
|
| /* assume that XE is ordered relative to X. */ |
| 184 |
|
| /* 3. DCHFDV does not assume that X1 is less than X2. thus, it would */ |
| 185 |
|
| /* be possible to write a version of DPCHFD that assumes a strict- */ |
| 186 |
|
| /* ly decreasing X-array by simply running the IR-loop backwards */ |
| 187 |
|
| /* (and reversing the order of appropriate tests). */ |
| 188 |
|
| /* 4. The present code has a minor bug, which I have decided is not */ |
| 189 |
|
| /* worth the effort that would be required to fix it. */ |
| 190 |
|
| /* If XE contains points in [X(N-1),X(N)], followed by points .LT. */ |
| 191 |
|
| /* X(N-1), followed by points .GT.X(N), the extrapolation points */ |
| 192 |
|
| /* will be counted (at least) twice in the total returned in IERR. */ |
| 193 |
|
| /* VALIDITY-CHECK ARGUMENTS. */ |
| 194 |
|
| if (!(skip_datap)[0]) { |
| 195 |
|
| {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { |
| 196 |
|
| if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue; |
| 197 |
|
| (ierr_datap)[0] = -3; |
| 198 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "X-ARRAY NOT STRICTLY INCREASING"); |
| 199 |
|
| }} /* Close n=1 */ |
| 200 |
|
| } |
| 201 |
|
| /* FUNCTION DEFINITION IS OK, GO ON. */ |
| 202 |
|
| (ierr_datap)[0] = 0; |
| 203 |
|
| (skip_datap)[0] = 1; |
| 204 |
|
| /* LOOP OVER INTERVALS. ( INTERVAL INDEX IS IL = IR-1 . ) */ |
| 205 |
|
| /* ( INTERVAL IS X(IL).LE.X.LT.X(IR) . ) */ |
| 206 |
|
| PDL_Indx n = __privtrans->ind_sizes[0], ne = __privtrans->ind_sizes[1]; |
| 207 |
|
| PDL_Indx jfirst = 0, ir; |
| 208 |
|
| for (ir = 1; ir < n && jfirst < ne; ++ir) { |
| 209 |
|
| /* SKIP OUT OF LOOP IF HAVE PROCESSED ALL EVALUATION POINTS. */ |
| 210 |
|
| /* LOCATE ALL POINTS IN INTERVAL. */ |
| 211 |
|
| char located = 0; |
| 212 |
|
| PDL_Indx j = jfirst; |
| 213 |
|
| {/* Open ne=jfirst */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=(__ne_size)); for(; ne<__ne_stop; ne+=1) { |
| 214 |
|
| j = ne; |
| 215 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] >= (x_datap)[0+(__inc_x_n*(ir))]) { |
| 216 |
|
| located = 1; |
| 217 |
|
| break; |
| 218 |
|
| } |
| 219 |
|
| }} /* Close ne=jfirst */ |
| 220 |
|
| if (!located || ir == n-1) |
| 221 |
|
| j = ne; |
| 222 |
|
| /* HAVE LOCATED FIRST POINT BEYOND INTERVAL. */ |
| 223 |
|
| PDL_Indx nj = j - jfirst; |
| 224 |
|
| /* SKIP EVALUATION IF NO POINTS IN INTERVAL. */ |
| 225 |
|
| if (nj == 0) |
| 226 |
|
| continue; |
| 227 |
|
| /* EVALUATE CUBIC AT XE(I), I = JFIRST (1) J-1 . */ |
| 228 |
|
| /* ---------------------------------------------------------------- */ |
| 229 |
|
| PDL_Indx next[] = {0,0}; |
| 230 |
|
| do { /* inline dchfdv */ |
| 231 |
|
| /* Local variables */ |
| 232 |
|
| PDL_Float x1 = (x_datap)[0+(__inc_x_n*(ir-1))], x2 = (x_datap)[0+(__inc_x_n*(ir))]; |
| 233 |
|
| PDL_Float f1 = (f_datap)[0+(__inc_f_n*(ir-1))], f2 = (f_datap)[0+(__inc_f_n*(ir))]; |
| 234 |
|
| PDL_Float d1 = (d_datap)[0+(__inc_d_n*(ir-1))], d2 = (d_datap)[0+(__inc_d_n*(ir))]; |
| 235 |
|
| PDL_Float h = x2 - x1; |
| 236 |
|
| if (h == 0.) |
| 237 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "INTERVAL ENDPOINTS EQUAL"); |
| 238 |
|
| /* INITIALIZE. */ |
| 239 |
|
| PDL_Float xmi = PDLMIN(0.,h); |
| 240 |
|
| PDL_Float xma = PDLMAX(0.,h); |
| 241 |
|
| /* COMPUTE CUBIC COEFFICIENTS (EXPANDED ABOUT X1). */ |
| 242 |
|
| PDL_Float delta = (f2 - f1) / h; |
| 243 |
|
| PDL_Float del1 = (d1 - delta) / h; |
| 244 |
|
| PDL_Float del2 = (d2 - delta) / h; |
| 245 |
|
| /* (DELTA IS NO LONGER NEEDED.) */ |
| 246 |
|
| PDL_Float c2 = -(del1 + del1 + del2); |
| 247 |
|
| PDL_Float c2t2 = c2 + c2; |
| 248 |
|
| PDL_Float c3 = (del1 + del2) / h; |
| 249 |
|
| /* (H, DEL1 AND DEL2 ARE NO LONGER NEEDED.) */ |
| 250 |
|
| PDL_Float c3t3 = c3 + c3 + c3; |
| 251 |
|
| /* EVALUATION LOOP. */ |
| 252 |
|
| {/* Open ne=:nj */ PDL_EXPAND2(register PDL_Indx ne=0, __ne_stop=PDLMIN(nj, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 253 |
|
| PDL_Float x = (xe_datap)[0+(__inc_xe_ne*(ne+jfirst))] - x1; |
| 254 |
|
| (fe_datap)[0+(__inc_fe_ne*(ne+jfirst))] = f1 + x * (d1 + x * (c2 + x * c3)); |
| 255 |
|
| (de_datap)[0+(__inc_de_ne*(ne+jfirst))] = d1 + x * (c2t2 + x * c3t3); |
| 256 |
|
| /* COUNT EXTRAPOLATION POINTS. */ |
| 257 |
|
| if (x < xmi) |
| 258 |
|
| ++next[0]; |
| 259 |
|
| if (x > xma) |
| 260 |
|
| ++next[1]; |
| 261 |
|
| /* (NOTE REDUNDANCY--IF EITHER CONDITION IS TRUE, OTHER IS FALSE.) */ |
| 262 |
|
| }} /* Close ne=:nj */ |
| 263 |
|
| } while (0); /* end inline dchfdv */ |
| 264 |
|
| /* ---------------------------------------------------------------- */ |
| 265 |
|
| if (next[1] != 0) { |
| 266 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(2) TO THE */ |
| 267 |
|
| /* RIGHT OF X(IR). */ |
| 268 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 269 |
|
| (ierr_datap)[0] += next[1]; |
| 270 |
|
| } |
| 271 |
|
| if (next[0] != 0) { |
| 272 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(1) TO THE */ |
| 273 |
|
| /* LEFT OF X(IR-1). */ |
| 274 |
|
| if (ir < 2) { |
| 275 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 276 |
|
| (ierr_datap)[0] += next[0]; |
| 277 |
|
| jfirst = j; |
| 278 |
|
| continue; |
| 279 |
|
| } |
| 280 |
|
| /* XE IS NOT ORDERED RELATIVE TO X, SO MUST ADJUST */ |
| 281 |
|
| /* EVALUATION INTERVAL. */ |
| 282 |
|
| /* FIRST, LOCATE FIRST POINT TO LEFT OF X(IR-1). */ |
| 283 |
|
| located = 0; |
| 284 |
|
| PDL_Indx i = jfirst; |
| 285 |
|
| {/* Open ne=jfirst:j */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=PDLMIN(j, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 286 |
|
| i = ne; |
| 287 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] < (x_datap)[0+(__inc_x_n*(ir-1))]) { |
| 288 |
|
| located = 1; |
| 289 |
|
| break; |
| 290 |
|
| } |
| 291 |
|
| }} /* Close ne=jfirst:j */ |
| 292 |
|
| if (!located) { |
| 293 |
|
| /* NOTE-- CANNOT DROP THROUGH HERE UNLESS THERE IS AN ERROR */ |
| 294 |
|
| /* IN DCHFDV. */ |
| 295 |
|
| (ierr_datap)[0] = -5; |
| 296 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "ERROR RETURN FROM DCHFDV -- FATAL"); |
| 297 |
|
| } |
| 298 |
|
| /* RESET J. (THIS WILL BE THE NEW JFIRST.) */ |
| 299 |
|
| j = i; |
| 300 |
|
| /* NOW FIND OUT HOW FAR TO BACK UP IN THE X-ARRAY. */ |
| 301 |
|
| {/* Open n=:ir */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=PDLMIN(ir, (__n_size))); for(; n<__n_stop; n+=1) { |
| 302 |
|
| i = n; |
| 303 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(j))] < (x_datap)[0+(__inc_x_n*(n))]) |
| 304 |
|
| break; |
| 305 |
|
| }} /* Close n=:ir */ |
| 306 |
|
| /* NB-- CAN NEVER DROP THROUGH HERE, SINCE XE(J).LT.X(IR-1). */ |
| 307 |
|
| /* AT THIS POINT, EITHER XE(J) .LT. X(1) */ |
| 308 |
|
| /* OR X(I-1) .LE. XE(J) .LT. X(I) . */ |
| 309 |
|
| /* RESET IR, RECOGNIZING THAT IT WILL BE INCREMENTED BEFORE */ |
| 310 |
|
| /* CYCLING. */ |
| 311 |
|
| /* Computing MAX */ |
| 312 |
|
| ir = PDLMAX(0,i-1); |
| 313 |
|
| } |
| 314 |
|
| jfirst = j; |
| 315 |
|
| /* END OF IR-LOOP. */ |
| 316 |
|
| } |
| 317 |
|
| ; |
| 318 |
|
| #line 319 "lib/PDL/Primitive-pp-pchip_chfd.c" |
| 319 |
0 |
▶ | }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
0 |
0 |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
0 |
0 |
|
| 320 |
0 |
| } break; |
| 321 |
3 |
| case PDL_D: { |
| 322 |
3 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
Branch: 24 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
3 |
0 |
3 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_Double,D,PDL_Indx,N,PDL_Long,L) |
0 |
3 |
3 |
|
| 323 |
13 |
▶ | PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
3 |
3 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
3 |
3 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
3 |
3 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
3 |
3 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
3 |
3 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
4 |
3 |
7 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
3 |
3 |
6 |
|
| 324 |
|
| #line 5456 "lib/PDL/Primitive.pd" |
| 325 |
|
| |
| 326 |
|
| /* Programming notes: */ |
| 327 |
|
| /* 2. Most of the coding between the call to DCHFDV and the end of */ |
| 328 |
|
| /* the IR-loop could be eliminated if it were permissible to */ |
| 329 |
|
| /* assume that XE is ordered relative to X. */ |
| 330 |
|
| /* 3. DCHFDV does not assume that X1 is less than X2. thus, it would */ |
| 331 |
|
| /* be possible to write a version of DPCHFD that assumes a strict- */ |
| 332 |
|
| /* ly decreasing X-array by simply running the IR-loop backwards */ |
| 333 |
|
| /* (and reversing the order of appropriate tests). */ |
| 334 |
|
| /* 4. The present code has a minor bug, which I have decided is not */ |
| 335 |
|
| /* worth the effort that would be required to fix it. */ |
| 336 |
|
| /* If XE contains points in [X(N-1),X(N)], followed by points .LT. */ |
| 337 |
|
| /* X(N-1), followed by points .GT.X(N), the extrapolation points */ |
| 338 |
|
| /* will be counted (at least) twice in the total returned in IERR. */ |
| 339 |
|
| /* VALIDITY-CHECK ARGUMENTS. */ |
| 340 |
|
| if (!(skip_datap)[0]) { |
| 341 |
|
| {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { |
| 342 |
|
| if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue; |
| 343 |
|
| (ierr_datap)[0] = -3; |
| 344 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "X-ARRAY NOT STRICTLY INCREASING"); |
| 345 |
|
| }} /* Close n=1 */ |
| 346 |
|
| } |
| 347 |
|
| /* FUNCTION DEFINITION IS OK, GO ON. */ |
| 348 |
|
| (ierr_datap)[0] = 0; |
| 349 |
|
| (skip_datap)[0] = 1; |
| 350 |
|
| /* LOOP OVER INTERVALS. ( INTERVAL INDEX IS IL = IR-1 . ) */ |
| 351 |
|
| /* ( INTERVAL IS X(IL).LE.X.LT.X(IR) . ) */ |
| 352 |
|
| PDL_Indx n = __privtrans->ind_sizes[0], ne = __privtrans->ind_sizes[1]; |
| 353 |
|
| PDL_Indx jfirst = 0, ir; |
| 354 |
|
| for (ir = 1; ir < n && jfirst < ne; ++ir) { |
| 355 |
|
| /* SKIP OUT OF LOOP IF HAVE PROCESSED ALL EVALUATION POINTS. */ |
| 356 |
|
| /* LOCATE ALL POINTS IN INTERVAL. */ |
| 357 |
|
| char located = 0; |
| 358 |
|
| PDL_Indx j = jfirst; |
| 359 |
|
| {/* Open ne=jfirst */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=(__ne_size)); for(; ne<__ne_stop; ne+=1) { |
| 360 |
|
| j = ne; |
| 361 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] >= (x_datap)[0+(__inc_x_n*(ir))]) { |
| 362 |
|
| located = 1; |
| 363 |
|
| break; |
| 364 |
|
| } |
| 365 |
|
| }} /* Close ne=jfirst */ |
| 366 |
|
| if (!located || ir == n-1) |
| 367 |
|
| j = ne; |
| 368 |
|
| /* HAVE LOCATED FIRST POINT BEYOND INTERVAL. */ |
| 369 |
|
| PDL_Indx nj = j - jfirst; |
| 370 |
|
| /* SKIP EVALUATION IF NO POINTS IN INTERVAL. */ |
| 371 |
|
| if (nj == 0) |
| 372 |
|
| continue; |
| 373 |
|
| /* EVALUATE CUBIC AT XE(I), I = JFIRST (1) J-1 . */ |
| 374 |
|
| /* ---------------------------------------------------------------- */ |
| 375 |
|
| PDL_Indx next[] = {0,0}; |
| 376 |
|
| do { /* inline dchfdv */ |
| 377 |
|
| /* Local variables */ |
| 378 |
|
| PDL_Double x1 = (x_datap)[0+(__inc_x_n*(ir-1))], x2 = (x_datap)[0+(__inc_x_n*(ir))]; |
| 379 |
|
| PDL_Double f1 = (f_datap)[0+(__inc_f_n*(ir-1))], f2 = (f_datap)[0+(__inc_f_n*(ir))]; |
| 380 |
|
| PDL_Double d1 = (d_datap)[0+(__inc_d_n*(ir-1))], d2 = (d_datap)[0+(__inc_d_n*(ir))]; |
| 381 |
|
| PDL_Double h = x2 - x1; |
| 382 |
|
| if (h == 0.) |
| 383 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "INTERVAL ENDPOINTS EQUAL"); |
| 384 |
|
| /* INITIALIZE. */ |
| 385 |
|
| PDL_Double xmi = PDLMIN(0.,h); |
| 386 |
|
| PDL_Double xma = PDLMAX(0.,h); |
| 387 |
|
| /* COMPUTE CUBIC COEFFICIENTS (EXPANDED ABOUT X1). */ |
| 388 |
|
| PDL_Double delta = (f2 - f1) / h; |
| 389 |
|
| PDL_Double del1 = (d1 - delta) / h; |
| 390 |
|
| PDL_Double del2 = (d2 - delta) / h; |
| 391 |
|
| /* (DELTA IS NO LONGER NEEDED.) */ |
| 392 |
|
| PDL_Double c2 = -(del1 + del1 + del2); |
| 393 |
|
| PDL_Double c2t2 = c2 + c2; |
| 394 |
|
| PDL_Double c3 = (del1 + del2) / h; |
| 395 |
|
| /* (H, DEL1 AND DEL2 ARE NO LONGER NEEDED.) */ |
| 396 |
|
| PDL_Double c3t3 = c3 + c3 + c3; |
| 397 |
|
| /* EVALUATION LOOP. */ |
| 398 |
|
| {/* Open ne=:nj */ PDL_EXPAND2(register PDL_Indx ne=0, __ne_stop=PDLMIN(nj, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 399 |
|
| PDL_Double x = (xe_datap)[0+(__inc_xe_ne*(ne+jfirst))] - x1; |
| 400 |
|
| (fe_datap)[0+(__inc_fe_ne*(ne+jfirst))] = f1 + x * (d1 + x * (c2 + x * c3)); |
| 401 |
|
| (de_datap)[0+(__inc_de_ne*(ne+jfirst))] = d1 + x * (c2t2 + x * c3t3); |
| 402 |
|
| /* COUNT EXTRAPOLATION POINTS. */ |
| 403 |
|
| if (x < xmi) |
| 404 |
|
| ++next[0]; |
| 405 |
|
| if (x > xma) |
| 406 |
|
| ++next[1]; |
| 407 |
|
| /* (NOTE REDUNDANCY--IF EITHER CONDITION IS TRUE, OTHER IS FALSE.) */ |
| 408 |
|
| }} /* Close ne=:nj */ |
| 409 |
|
| } while (0); /* end inline dchfdv */ |
| 410 |
|
| /* ---------------------------------------------------------------- */ |
| 411 |
|
| if (next[1] != 0) { |
| 412 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(2) TO THE */ |
| 413 |
|
| /* RIGHT OF X(IR). */ |
| 414 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 415 |
|
| (ierr_datap)[0] += next[1]; |
| 416 |
|
| } |
| 417 |
|
| if (next[0] != 0) { |
| 418 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(1) TO THE */ |
| 419 |
|
| /* LEFT OF X(IR-1). */ |
| 420 |
|
| if (ir < 2) { |
| 421 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 422 |
|
| (ierr_datap)[0] += next[0]; |
| 423 |
|
| jfirst = j; |
| 424 |
|
| continue; |
| 425 |
|
| } |
| 426 |
|
| /* XE IS NOT ORDERED RELATIVE TO X, SO MUST ADJUST */ |
| 427 |
|
| /* EVALUATION INTERVAL. */ |
| 428 |
|
| /* FIRST, LOCATE FIRST POINT TO LEFT OF X(IR-1). */ |
| 429 |
|
| located = 0; |
| 430 |
|
| PDL_Indx i = jfirst; |
| 431 |
|
| {/* Open ne=jfirst:j */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=PDLMIN(j, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 432 |
|
| i = ne; |
| 433 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] < (x_datap)[0+(__inc_x_n*(ir-1))]) { |
| 434 |
|
| located = 1; |
| 435 |
|
| break; |
| 436 |
|
| } |
| 437 |
|
| }} /* Close ne=jfirst:j */ |
| 438 |
|
| if (!located) { |
| 439 |
|
| /* NOTE-- CANNOT DROP THROUGH HERE UNLESS THERE IS AN ERROR */ |
| 440 |
|
| /* IN DCHFDV. */ |
| 441 |
|
| (ierr_datap)[0] = -5; |
| 442 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "ERROR RETURN FROM DCHFDV -- FATAL"); |
| 443 |
|
| } |
| 444 |
|
| /* RESET J. (THIS WILL BE THE NEW JFIRST.) */ |
| 445 |
|
| j = i; |
| 446 |
|
| /* NOW FIND OUT HOW FAR TO BACK UP IN THE X-ARRAY. */ |
| 447 |
|
| {/* Open n=:ir */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=PDLMIN(ir, (__n_size))); for(; n<__n_stop; n+=1) { |
| 448 |
|
| i = n; |
| 449 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(j))] < (x_datap)[0+(__inc_x_n*(n))]) |
| 450 |
|
| break; |
| 451 |
|
| }} /* Close n=:ir */ |
| 452 |
|
| /* NB-- CAN NEVER DROP THROUGH HERE, SINCE XE(J).LT.X(IR-1). */ |
| 453 |
|
| /* AT THIS POINT, EITHER XE(J) .LT. X(1) */ |
| 454 |
|
| /* OR X(I-1) .LE. XE(J) .LT. X(I) . */ |
| 455 |
|
| /* RESET IR, RECOGNIZING THAT IT WILL BE INCREMENTED BEFORE */ |
| 456 |
|
| /* CYCLING. */ |
| 457 |
|
| /* Computing MAX */ |
| 458 |
|
| ir = PDLMAX(0,i-1); |
| 459 |
|
| } |
| 460 |
|
| jfirst = j; |
| 461 |
|
| /* END OF IR-LOOP. */ |
| 462 |
|
| } |
| 463 |
|
| ; |
| 464 |
|
| #line 465 "lib/PDL/Primitive-pp-pchip_chfd.c" |
| 465 |
3 |
▶ | }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
3 |
3 |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
3 |
3 |
|
| 466 |
3 |
| } break; |
| 467 |
0 |
| case PDL_LD: { |
| 468 |
0 |
▶ | PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
Branch: 24 branches
| Branch | True | False | Total |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
| PDL_DECLARE_PARAMS_pchip_chfd_1(PDL_LDouble,E,PDL_Indx,N,PDL_Long,L) |
0 |
0 |
0 |
|
| 469 |
0 |
▶ | PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
Branch: 7 branches
| Branch | True | False | Total |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
| PDL_BROADCASTLOOP_START_pchip_chfd_readdata { |
0 |
0 |
0 |
|
| 470 |
|
| #line 5456 "lib/PDL/Primitive.pd" |
| 471 |
|
| |
| 472 |
|
| /* Programming notes: */ |
| 473 |
|
| /* 2. Most of the coding between the call to DCHFDV and the end of */ |
| 474 |
|
| /* the IR-loop could be eliminated if it were permissible to */ |
| 475 |
|
| /* assume that XE is ordered relative to X. */ |
| 476 |
|
| /* 3. DCHFDV does not assume that X1 is less than X2. thus, it would */ |
| 477 |
|
| /* be possible to write a version of DPCHFD that assumes a strict- */ |
| 478 |
|
| /* ly decreasing X-array by simply running the IR-loop backwards */ |
| 479 |
|
| /* (and reversing the order of appropriate tests). */ |
| 480 |
|
| /* 4. The present code has a minor bug, which I have decided is not */ |
| 481 |
|
| /* worth the effort that would be required to fix it. */ |
| 482 |
|
| /* If XE contains points in [X(N-1),X(N)], followed by points .LT. */ |
| 483 |
|
| /* X(N-1), followed by points .GT.X(N), the extrapolation points */ |
| 484 |
|
| /* will be counted (at least) twice in the total returned in IERR. */ |
| 485 |
|
| /* VALIDITY-CHECK ARGUMENTS. */ |
| 486 |
|
| if (!(skip_datap)[0]) { |
| 487 |
|
| {/* Open n=1 */ PDL_EXPAND2(register PDL_Indx n=PDLMAX((1),0), __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { |
| 488 |
|
| if ((x_datap)[0+(__inc_x_n*(n))] > (x_datap)[0+(__inc_x_n*(n-1))]) continue; |
| 489 |
|
| (ierr_datap)[0] = -3; |
| 490 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "X-ARRAY NOT STRICTLY INCREASING"); |
| 491 |
|
| }} /* Close n=1 */ |
| 492 |
|
| } |
| 493 |
|
| /* FUNCTION DEFINITION IS OK, GO ON. */ |
| 494 |
|
| (ierr_datap)[0] = 0; |
| 495 |
|
| (skip_datap)[0] = 1; |
| 496 |
|
| /* LOOP OVER INTERVALS. ( INTERVAL INDEX IS IL = IR-1 . ) */ |
| 497 |
|
| /* ( INTERVAL IS X(IL).LE.X.LT.X(IR) . ) */ |
| 498 |
|
| PDL_Indx n = __privtrans->ind_sizes[0], ne = __privtrans->ind_sizes[1]; |
| 499 |
|
| PDL_Indx jfirst = 0, ir; |
| 500 |
|
| for (ir = 1; ir < n && jfirst < ne; ++ir) { |
| 501 |
|
| /* SKIP OUT OF LOOP IF HAVE PROCESSED ALL EVALUATION POINTS. */ |
| 502 |
|
| /* LOCATE ALL POINTS IN INTERVAL. */ |
| 503 |
|
| char located = 0; |
| 504 |
|
| PDL_Indx j = jfirst; |
| 505 |
|
| {/* Open ne=jfirst */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=(__ne_size)); for(; ne<__ne_stop; ne+=1) { |
| 506 |
|
| j = ne; |
| 507 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] >= (x_datap)[0+(__inc_x_n*(ir))]) { |
| 508 |
|
| located = 1; |
| 509 |
|
| break; |
| 510 |
|
| } |
| 511 |
|
| }} /* Close ne=jfirst */ |
| 512 |
|
| if (!located || ir == n-1) |
| 513 |
|
| j = ne; |
| 514 |
|
| /* HAVE LOCATED FIRST POINT BEYOND INTERVAL. */ |
| 515 |
|
| PDL_Indx nj = j - jfirst; |
| 516 |
|
| /* SKIP EVALUATION IF NO POINTS IN INTERVAL. */ |
| 517 |
|
| if (nj == 0) |
| 518 |
|
| continue; |
| 519 |
|
| /* EVALUATE CUBIC AT XE(I), I = JFIRST (1) J-1 . */ |
| 520 |
|
| /* ---------------------------------------------------------------- */ |
| 521 |
|
| PDL_Indx next[] = {0,0}; |
| 522 |
|
| do { /* inline dchfdv */ |
| 523 |
|
| /* Local variables */ |
| 524 |
|
| PDL_LDouble x1 = (x_datap)[0+(__inc_x_n*(ir-1))], x2 = (x_datap)[0+(__inc_x_n*(ir))]; |
| 525 |
|
| PDL_LDouble f1 = (f_datap)[0+(__inc_f_n*(ir-1))], f2 = (f_datap)[0+(__inc_f_n*(ir))]; |
| 526 |
|
| PDL_LDouble d1 = (d_datap)[0+(__inc_d_n*(ir-1))], d2 = (d_datap)[0+(__inc_d_n*(ir))]; |
| 527 |
|
| PDL_LDouble h = x2 - x1; |
| 528 |
|
| if (h == 0.) |
| 529 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "INTERVAL ENDPOINTS EQUAL"); |
| 530 |
|
| /* INITIALIZE. */ |
| 531 |
|
| PDL_LDouble xmi = PDLMIN(0.,h); |
| 532 |
|
| PDL_LDouble xma = PDLMAX(0.,h); |
| 533 |
|
| /* COMPUTE CUBIC COEFFICIENTS (EXPANDED ABOUT X1). */ |
| 534 |
|
| PDL_LDouble delta = (f2 - f1) / h; |
| 535 |
|
| PDL_LDouble del1 = (d1 - delta) / h; |
| 536 |
|
| PDL_LDouble del2 = (d2 - delta) / h; |
| 537 |
|
| /* (DELTA IS NO LONGER NEEDED.) */ |
| 538 |
|
| PDL_LDouble c2 = -(del1 + del1 + del2); |
| 539 |
|
| PDL_LDouble c2t2 = c2 + c2; |
| 540 |
|
| PDL_LDouble c3 = (del1 + del2) / h; |
| 541 |
|
| /* (H, DEL1 AND DEL2 ARE NO LONGER NEEDED.) */ |
| 542 |
|
| PDL_LDouble c3t3 = c3 + c3 + c3; |
| 543 |
|
| /* EVALUATION LOOP. */ |
| 544 |
|
| {/* Open ne=:nj */ PDL_EXPAND2(register PDL_Indx ne=0, __ne_stop=PDLMIN(nj, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 545 |
|
| PDL_LDouble x = (xe_datap)[0+(__inc_xe_ne*(ne+jfirst))] - x1; |
| 546 |
|
| (fe_datap)[0+(__inc_fe_ne*(ne+jfirst))] = f1 + x * (d1 + x * (c2 + x * c3)); |
| 547 |
|
| (de_datap)[0+(__inc_de_ne*(ne+jfirst))] = d1 + x * (c2t2 + x * c3t3); |
| 548 |
|
| /* COUNT EXTRAPOLATION POINTS. */ |
| 549 |
|
| if (x < xmi) |
| 550 |
|
| ++next[0]; |
| 551 |
|
| if (x > xma) |
| 552 |
|
| ++next[1]; |
| 553 |
|
| /* (NOTE REDUNDANCY--IF EITHER CONDITION IS TRUE, OTHER IS FALSE.) */ |
| 554 |
|
| }} /* Close ne=:nj */ |
| 555 |
|
| } while (0); /* end inline dchfdv */ |
| 556 |
|
| /* ---------------------------------------------------------------- */ |
| 557 |
|
| if (next[1] != 0) { |
| 558 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(2) TO THE */ |
| 559 |
|
| /* RIGHT OF X(IR). */ |
| 560 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 561 |
|
| (ierr_datap)[0] += next[1]; |
| 562 |
|
| } |
| 563 |
|
| if (next[0] != 0) { |
| 564 |
|
| /* IN THE CURRENT SET OF XE-POINTS, THERE ARE NEXT(1) TO THE */ |
| 565 |
|
| /* LEFT OF X(IR-1). */ |
| 566 |
|
| if (ir < 2) { |
| 567 |
|
| /* THESE ARE ACTUALLY EXTRAPOLATION POINTS. */ |
| 568 |
|
| (ierr_datap)[0] += next[0]; |
| 569 |
|
| jfirst = j; |
| 570 |
|
| continue; |
| 571 |
|
| } |
| 572 |
|
| /* XE IS NOT ORDERED RELATIVE TO X, SO MUST ADJUST */ |
| 573 |
|
| /* EVALUATION INTERVAL. */ |
| 574 |
|
| /* FIRST, LOCATE FIRST POINT TO LEFT OF X(IR-1). */ |
| 575 |
|
| located = 0; |
| 576 |
|
| PDL_Indx i = jfirst; |
| 577 |
|
| {/* Open ne=jfirst:j */ PDL_EXPAND2(register PDL_Indx ne=PDLMAX((jfirst),0), __ne_stop=PDLMIN(j, (__ne_size))); for(; ne<__ne_stop; ne+=1) { |
| 578 |
|
| i = ne; |
| 579 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(ne))] < (x_datap)[0+(__inc_x_n*(ir-1))]) { |
| 580 |
|
| located = 1; |
| 581 |
|
| break; |
| 582 |
|
| } |
| 583 |
|
| }} /* Close ne=jfirst:j */ |
| 584 |
|
| if (!located) { |
| 585 |
|
| /* NOTE-- CANNOT DROP THROUGH HERE UNLESS THERE IS AN ERROR */ |
| 586 |
|
| /* IN DCHFDV. */ |
| 587 |
|
| (ierr_datap)[0] = -5; |
| 588 |
|
| return PDL->make_error(PDL_EUSERERROR, "Error in pchip_chfd:" "ERROR RETURN FROM DCHFDV -- FATAL"); |
| 589 |
|
| } |
| 590 |
|
| /* RESET J. (THIS WILL BE THE NEW JFIRST.) */ |
| 591 |
|
| j = i; |
| 592 |
|
| /* NOW FIND OUT HOW FAR TO BACK UP IN THE X-ARRAY. */ |
| 593 |
|
| {/* Open n=:ir */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=PDLMIN(ir, (__n_size))); for(; n<__n_stop; n+=1) { |
| 594 |
|
| i = n; |
| 595 |
|
| if ((xe_datap)[0+(__inc_xe_ne*(j))] < (x_datap)[0+(__inc_x_n*(n))]) |
| 596 |
|
| break; |
| 597 |
|
| }} /* Close n=:ir */ |
| 598 |
|
| /* NB-- CAN NEVER DROP THROUGH HERE, SINCE XE(J).LT.X(IR-1). */ |
| 599 |
|
| /* AT THIS POINT, EITHER XE(J) .LT. X(1) */ |
| 600 |
|
| /* OR X(I-1) .LE. XE(J) .LT. X(I) . */ |
| 601 |
|
| /* RESET IR, RECOGNIZING THAT IT WILL BE INCREMENTED BEFORE */ |
| 602 |
|
| /* CYCLING. */ |
| 603 |
|
| /* Computing MAX */ |
| 604 |
|
| ir = PDLMAX(0,i-1); |
| 605 |
|
| } |
| 606 |
|
| jfirst = j; |
| 607 |
|
| /* END OF IR-LOOP. */ |
| 608 |
|
| } |
| 609 |
|
| ; |
| 610 |
|
| #line 611 "lib/PDL/Primitive-pp-pchip_chfd.c" |
| 611 |
0 |
▶ | }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
Branch: 2 branches
| Branch | True | False | Total |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
0 |
0 |
| }PDL_BROADCASTLOOP_END_pchip_chfd_readdata |
0 |
0 |
0 |
|
| 612 |
0 |
| } break; |
| 613 |
0 |
| default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in pchip_chfd: unhandled datatype(%d), only handles (FDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype); |
| 614 |
|
| } |
| 615 |
|
| #undef PDL_IF_BAD |
| 616 |
3 |
| return PDL_err; |
| 617 |
|
| } |
| 618 |
|
| |
| 619 |
|
| static pdl_datatypes pdl_pchip_chfd_vtable_gentypes[] = { PDL_F, PDL_D, PDL_LD, -1 }; |
| 620 |
|
| static PDL_Indx pdl_pchip_chfd_vtable_realdims[] = { 1, 1, 1, 1, 1, 1, 0, 0 }; |
| 621 |
|
| static char *pdl_pchip_chfd_vtable_parnames[] = { "x","f","d","xe","fe","de","ierr","skip" }; |
| 622 |
|
| static short pdl_pchip_chfd_vtable_parflags[] = { |
| 623 |
|
| 0, |
| 624 |
|
| 0, |
| 625 |
|
| 0, |
| 626 |
|
| 0, |
| 627 |
|
| PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE, |
| 628 |
|
| PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE, |
| 629 |
|
| PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE, |
| 630 |
|
| PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE |
| 631 |
|
| }; |
| 632 |
|
| static pdl_datatypes pdl_pchip_chfd_vtable_partypes[] = { -1, -1, -1, -1, -1, -1, PDL_IND, PDL_L }; |
| 633 |
|
| static PDL_Indx pdl_pchip_chfd_vtable_realdims_starts[] = { 0, 1, 2, 3, 4, 5, 6, 6 }; |
| 634 |
|
| static PDL_Indx pdl_pchip_chfd_vtable_realdims_ind_ids[] = { 0, 0, 0, 1, 1, 1 }; |
| 635 |
|
| static char *pdl_pchip_chfd_vtable_indnames[] = { "n","ne" }; |
| 636 |
|
| pdl_transvtable pdl_pchip_chfd_vtable = { |
| 637 |
|
| PDL_TRANS_DO_BROADCAST, 0, pdl_pchip_chfd_vtable_gentypes, 4, 8, NULL /*CORE21*/, |
| 638 |
|
| pdl_pchip_chfd_vtable_realdims, pdl_pchip_chfd_vtable_parnames, |
| 639 |
|
| pdl_pchip_chfd_vtable_parflags, pdl_pchip_chfd_vtable_partypes, |
| 640 |
|
| pdl_pchip_chfd_vtable_realdims_starts, pdl_pchip_chfd_vtable_realdims_ind_ids, 6, |
| 641 |
|
| 2, pdl_pchip_chfd_vtable_indnames, |
| 642 |
|
| pdl_pchip_chfd_redodims, pdl_pchip_chfd_readdata, NULL, |
| 643 |
|
| NULL, |
| 644 |
|
| 0,"PDL::Primitive::pchip_chfd" |
| 645 |
|
| }; |
| 646 |
|
| |
| 647 |
|
| |
| 648 |
3 |
| pdl_error pdl_run_pchip_chfd(pdl *x,pdl *f,pdl *d,pdl *xe,pdl *fe,pdl *de,pdl *ierr,pdl *skip) { |
| 649 |
3 |
| pdl_error PDL_err = {0, NULL, 0}; |
| 650 |
3 |
▶ | if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
Branch: 1 branch
| Branch | True | False | Total |
| if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; |
0 |
3 |
3 |
|
| 651 |
3 |
| pdl_trans *__privtrans = PDL->create_trans(&pdl_pchip_chfd_vtable); |
| 652 |
3 |
▶ | if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
Branch: 1 branch
| Branch | True | False | Total |
| if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); |
0 |
3 |
3 |
|
| 653 |
3 |
| __privtrans->pdls[0] = x; |
| 654 |
3 |
| __privtrans->pdls[1] = f; |
| 655 |
3 |
| __privtrans->pdls[2] = d; |
| 656 |
3 |
| __privtrans->pdls[3] = xe; |
| 657 |
3 |
| __privtrans->pdls[4] = fe; |
| 658 |
3 |
| __privtrans->pdls[5] = de; |
| 659 |
3 |
| __privtrans->pdls[6] = ierr; |
| 660 |
3 |
| __privtrans->pdls[7] = skip; |
| 661 |
3 |
▶ | PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); |
0 |
3 |
3 |
|
| 662 |
3 |
▶ | PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
Branch: 1 branch
| Branch | True | False | Total |
| PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); |
0 |
3 |
3 |
|
| 663 |
3 |
| return PDL_err; |
| 664 |
|
| } |