lib/PDL/Slices-pp-xchg.c

filter: Statementstmt 100% 30 / 30 Branchbran 61.1% 11 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 85.4% 41 / 48 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« blib/lib/PDL/Transform.pm ↑ Summary lib/PDL/MatrixOps-pp-svd.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_xchg {
25 #line 26 "lib/PDL/Slices-pp-xchg.c"
26 PDL_Indx n1;
27 PDL_Indx n2;
28 } pdl_params_xchg;
29  
30  
31 #line 1888 "lib/PDL/PP.pm"
32 pdl_error pdl_xchg_redodims(pdl_trans *__privtrans) {
33 pdl_error PDL_err = {0, NULL, 0};
34 #line 35 "lib/PDL/Slices-pp-xchg.c"
35 449 pdl_params_xchg *__params = __privtrans->params; (void)__params;
36 449 pdl *__it = __privtrans->pdls[1]; (void) __it;
37 449 ▶ PDL->hdr_childcopy(__privtrans); __privtrans->dims_redone = 1;
Branch: 1 branch
BranchTrueFalseTotal
PDL->hdr_childcopy(__privtrans); __privtrans->dims_redone = 1; 0 449 449
38 PDL_Indx i,cor;
39
40 #line 1408 "lib/PDL/Slices.pd"
41 if (__params->n1 <0)
42 __params->n1 += __privtrans->pdls[0]->broadcastids[0];
43 if (__params->n2 <0)
44 __params->n2 += __privtrans->pdls[0]->broadcastids[0];
45 if (PDLMIN(__params->n1,__params->n2) <0 ||
46 PDLMAX(__params->n1,__params->n2) >= __privtrans->pdls[0]->broadcastids[0])
47 return PDL->make_error(PDL_EUSERERROR, "Error in xchg:" "One of dims %"IND_FLAG", %"IND_FLAG" out of range: should be 0<=dim<%"IND_FLAG"",__params->n1,__params->n2,__privtrans->pdls[0]->broadcastids[0]);
48 #line 49 "lib/PDL/Slices-pp-xchg.c"
49  
50 449 ▶ PDL_RETERROR(PDL_err, PDL->reallocdims(__it,__privtrans->pdls[0]->ndims));;
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->reallocdims(__it,__privtrans->pdls[0]->ndims));; 0 449 449
51 449 __privtrans->incs = malloc(sizeof(*__privtrans->incs) * __privtrans->pdls[1]->ndims); /* CType.get_malloc */
52 ;
53 449 __privtrans->offs = 0;
54 1445 ▶ for(i=0; i<__privtrans->pdls[1]->ndims; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i<__privtrans->pdls[1]->ndims; i++) { 996 449 1445
55 996 cor =
56 #line 1418 "lib/PDL/Slices.pd"
57 ((i == __params->n1) ? __params->n2 : (i == __params->n2) ? __params->n1 : i)
58 #line 59 "lib/PDL/Slices-pp-xchg.c"
59 ;
60 996 __privtrans->pdls[1]->dims[i] = __privtrans->pdls[0]->dims[cor];
61 996 __privtrans->incs[i] = __privtrans->pdls[0]->dimincs[cor];
62 }
63 449 ▶ PDL_RETERROR(PDL_err, PDL->setdims_careful(__it));;
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->setdims_careful(__it));; 0 449 449
64
65 #line 384 "lib/PDL/PP.pm"
66 {int __ind; PDL_RETERROR(PDL_err, PDL->reallocbroadcastids(__privtrans->pdls[1], __privtrans->pdls[0]->nbroadcastids));
67 for(__ind=0; __ind<__privtrans->pdls[0]->nbroadcastids; __ind++)
68 __privtrans->pdls[1]->broadcastids[__ind] = __privtrans->pdls[0]->broadcastids[__ind] + (0);
69 }
70 #line 71 "lib/PDL/Slices-pp-xchg.c"
71 ;
72 449 __privtrans->dims_redone = 1;
73 449 return PDL_err;
74 }
75  
76  
77 #line 1888 "lib/PDL/PP.pm"
78 pdl_error pdl_xchg_free(pdl_trans *__privtrans, char destroy) {
79 pdl_error PDL_err = {0, NULL, 0};
80 #line 81 "lib/PDL/Slices-pp-xchg.c"
81 451 pdl_params_xchg *__params = __privtrans->params; (void)__params;
82 451 pdl *__it = __privtrans->pdls[1]; (void) __it;
83 451 ▶ 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 */ 449 2 451
84 451 ) return PDL_err;
85 }
86  
87 static pdl_datatypes pdl_xchg_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 };
88 static PDL_Indx pdl_xchg_vtable_realdims[] = { 0, 0 };
89 static char *pdl_xchg_vtable_parnames[] = { "PARENT","CHILD" };
90 static short pdl_xchg_vtable_parflags[] = {
91 0,
92 PDL_PARAM_ISCREAT|PDL_PARAM_ISCREATEALWAYS|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE
93 };
94 static pdl_datatypes pdl_xchg_vtable_partypes[] = { -1, -1 };
95 static PDL_Indx pdl_xchg_vtable_realdims_starts[] = { 0, 0 };
96 static PDL_Indx pdl_xchg_vtable_realdims_ind_ids[] = { 0 };
97 static char *pdl_xchg_vtable_indnames[] = { "" };
98 pdl_transvtable pdl_xchg_vtable = {
99 0, PDL_ITRANS_ISAFFINE|PDL_ITRANS_DO_DATAFLOW_ANY, pdl_xchg_vtable_gentypes, 1, 2, NULL /*CORE21*/,
100 pdl_xchg_vtable_realdims, pdl_xchg_vtable_parnames,
101 pdl_xchg_vtable_parflags, pdl_xchg_vtable_partypes,
102 pdl_xchg_vtable_realdims_starts, pdl_xchg_vtable_realdims_ind_ids, 0,
103 0, pdl_xchg_vtable_indnames,
104 pdl_xchg_redodims, NULL, NULL,
105 pdl_xchg_free,
106 sizeof(pdl_params_xchg),"PDL::Slices::xchg"
107 };
108  
109  
110 451 pdl_error pdl_run_xchg(pdl *PARENT,pdl *CHILD,PDL_Indx n1,PDL_Indx n2) {
111 451 pdl_error PDL_err = {0, NULL, 0};
112 451 ▶ 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 451 451
113 451 pdl_trans *__privtrans = PDL->create_trans(&pdl_xchg_vtable);
114 451 ▶ 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 451 451
115 451 pdl_params_xchg *__params = __privtrans->params;
116 451 __privtrans->pdls[0] = PARENT;
117 451 __privtrans->pdls[1] = CHILD;
118 451 ▶ PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); 0 451 451
119 451 (__params->n1) = (n1); /* CType.get_copy */
120 451 (__params->n2) = (n2); /* CType.get_copy */
121 451 ▶ PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); 0 451 451
122 451 return PDL_err;
123 }
« blib/lib/PDL/Transform.pm ↑ Summary lib/PDL/MatrixOps-pp-svd.c »