lib/PDL/Slices-pp-unbroadcast.c

filter: Statementstmt 100% 20 / 20 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 83.3% 25 / 30 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/PDL/Core/pdl.h.PL ↑ Summary lib/PDL/Slices-pp-diagonal.c »
1  
2 #line 453 "lib/PDL/PP.pm"
3 /*
4 * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/Slices.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_Slices
21 extern Core* PDL; /* Structure hold core C functions */
22  
23 #line 1877 "lib/PDL/PP.pm"
24 typedef struct pdl_params_unbroadcast {
25 #line 26 "lib/PDL/Slices-pp-unbroadcast.c"
26 PDL_Indx atind;
27 } pdl_params_unbroadcast;
28  
29  
30 #line 1888 "lib/PDL/PP.pm"
31 pdl_error pdl_unbroadcast_redodims(pdl_trans *__privtrans) {
32 pdl_error PDL_err = {0, NULL, 0};
33 #line 34 "lib/PDL/Slices-pp-unbroadcast.c"
34 87 pdl_params_unbroadcast *__params = __privtrans->params; (void)__params;
35 87 pdl *__it = __privtrans->pdls[1]; (void) __it;
36 87 PDL->hdr_childcopy(__privtrans); __privtrans->dims_redone = 1;
37  
38 #line 1912 "lib/PDL/Slices.pd"
39 PDL_Indx i;
40 PDL_RETERROR(PDL_err, PDL->reallocdims(__it,__privtrans->pdls[0]->ndims));;
41 __privtrans->incs = malloc(sizeof(*__privtrans->incs) * __privtrans->pdls[1]->ndims); /* CType.get_malloc */
42 ;
43 __privtrans->offs = 0;
44 for(i=0; i<__privtrans->pdls[0]->ndims; i++) {
45 PDL_Indx corc;
46 if(i<__params->atind) {
47 corc = i;
48 } else if(i < __privtrans->pdls[0]->broadcastids[0]) {
49 corc = i + __privtrans->pdls[0]->ndims-__privtrans->pdls[0]->broadcastids[0];
50 } else {
51 corc = i - __privtrans->pdls[0]->broadcastids[0] + __params->atind;
52 }
53 __privtrans->pdls[1]->dims[corc] = __privtrans->pdls[0]->dims[i];
54 __privtrans->incs[corc] = __privtrans->pdls[0]->dimincs[i];
55 }
56 PDL_RETERROR(PDL_err, PDL->setdims_careful(__it));;
57 #line 58 "lib/PDL/Slices-pp-unbroadcast.c"
58 87 return PDL_err;
59 }
60  
61  
62 #line 1888 "lib/PDL/PP.pm"
63 pdl_error pdl_unbroadcast_free(pdl_trans *__privtrans, char destroy) {
64 pdl_error PDL_err = {0, NULL, 0};
65 #line 66 "lib/PDL/Slices-pp-unbroadcast.c"
66 87 pdl_params_unbroadcast *__params = __privtrans->params; (void)__params;
67 87 pdl *__it = __privtrans->pdls[1]; (void) __it;
68 87 ▶ PDL_FREE_CODE(__privtrans, destroy, , free(__privtrans->incs); /* CType.get_free */
Branch: 1 branch
BranchTrueFalseTotal
PDL_FREE_CODE(__privtrans, destroy, , free(__privtrans->incs); /* CType.get_free */ 87 0 87
69 87 ) return PDL_err;
70 }
71  
72 static pdl_datatypes pdl_unbroadcast_vtable_gentypes[] = { PDL_SB, PDL_B, PDL_S, PDL_US, PDL_L, PDL_UL, PDL_IND, PDL_ULL, PDL_LL, PDL_F, PDL_D, PDL_LD, PDL_CF, PDL_CD, PDL_CLD, -1 };
73 static PDL_Indx pdl_unbroadcast_vtable_realdims[] = { 0, 0 };
74 static char *pdl_unbroadcast_vtable_parnames[] = { "PARENT","CHILD" };
75 static short pdl_unbroadcast_vtable_parflags[] = {
76 0,
77 PDL_PARAM_ISCREAT|PDL_PARAM_ISCREATEALWAYS|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE
78 };
79 static pdl_datatypes pdl_unbroadcast_vtable_partypes[] = { -1, -1 };
80 static PDL_Indx pdl_unbroadcast_vtable_realdims_starts[] = { 0, 0 };
81 static PDL_Indx pdl_unbroadcast_vtable_realdims_ind_ids[] = { 0 };
82 static char *pdl_unbroadcast_vtable_indnames[] = { "" };
83 pdl_transvtable pdl_unbroadcast_vtable = {
84 0, PDL_ITRANS_ISAFFINE|PDL_ITRANS_DO_DATAFLOW_ANY, pdl_unbroadcast_vtable_gentypes, 1, 2, NULL /*CORE21*/,
85 pdl_unbroadcast_vtable_realdims, pdl_unbroadcast_vtable_parnames,
86 pdl_unbroadcast_vtable_parflags, pdl_unbroadcast_vtable_partypes,
87 pdl_unbroadcast_vtable_realdims_starts, pdl_unbroadcast_vtable_realdims_ind_ids, 0,
88 0, pdl_unbroadcast_vtable_indnames,
89 pdl_unbroadcast_redodims, NULL, NULL,
90 pdl_unbroadcast_free,
91 sizeof(pdl_params_unbroadcast),"PDL::Slices::unbroadcast"
92 };
93  
94  
95 87 pdl_error pdl_run_unbroadcast(pdl *PARENT,pdl *CHILD,PDL_Indx atind) {
96 87 pdl_error PDL_err = {0, NULL, 0};
97 87 ▶ if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
Branch: 1 branch
BranchTrueFalseTotal
if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0}; 0 87 87
98 87 pdl_trans *__privtrans = PDL->create_trans(&pdl_unbroadcast_vtable);
99 87 ▶ if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
Branch: 1 branch
BranchTrueFalseTotal
if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans"); 0 87 87
100 87 pdl_params_unbroadcast *__params = __privtrans->params;
101 87 __privtrans->pdls[0] = PARENT;
102 87 __privtrans->pdls[1] = CHILD;
103 87 ▶ PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); 0 87 87
104 87 (__params->atind) = (atind); /* CType.get_copy */
105 87 ▶ PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); 0 87 87
106 87 return PDL_err;
107 }
« lib/PDL/Core/pdl.h.PL ↑ Summary lib/PDL/Slices-pp-diagonal.c »