lib/PDL/Slices-pp-mv.c

filter: Statementstmt 100% 30 / 30 Branchbran 66.6% 12 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 87.5% 42 / 48 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« lib/PDL/MatrixOps-pp-svd.c ↑ Summary lib/PDL/Math.pd »
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 #line 23 "lib/PDL/Slices-pp-mv.c"
23 #define EQUIVDIM(dima,dimb,cdim,inc) \
24 ((cdim < PDLMIN(dima,dimb) || cdim > PDLMAX(dima,dimb)) ? \
25 cdim : ((cdim == dimb) ? dima : cdim + inc))
26  
27  
28  
29 #line 1877 "lib/PDL/PP.pm"
30 typedef struct pdl_params_mv {
31 #line 32 "lib/PDL/Slices-pp-mv.c"
32 PDL_Indx n1;
33 PDL_Indx n2;
34 } pdl_params_mv;
35  
36  
37 #line 1888 "lib/PDL/PP.pm"
38 pdl_error pdl_mv_redodims(pdl_trans *__privtrans) {
39 pdl_error PDL_err = {0, NULL, 0};
40 #line 41 "lib/PDL/Slices-pp-mv.c"
41 12615 pdl_params_mv *__params = __privtrans->params; (void)__params;
42 12615 pdl *__it = __privtrans->pdls[1]; (void) __it;
43 12615 ▶ PDL->hdr_childcopy(__privtrans); __privtrans->dims_redone = 1;
Branch: 1 branch
BranchTrueFalseTotal
PDL->hdr_childcopy(__privtrans); __privtrans->dims_redone = 1; 335 12280 12615
44 PDL_Indx i,cor;
45
46 #line 1572 "lib/PDL/Slices.pd"
47 if (__params->n1 <0)
48 __params->n1 += __privtrans->pdls[0]->broadcastids[0];
49 if (__params->n2 <0)
50 __params->n2 += __privtrans->pdls[0]->broadcastids[0];
51 if (PDLMIN(__params->n1,__params->n2) <0 ||
52 PDLMAX(__params->n1,__params->n2) >= __privtrans->pdls[0]->broadcastids[0])
53 return PDL->make_error(PDL_EUSERERROR, "Error in mv:" "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]);
54 #line 55 "lib/PDL/Slices-pp-mv.c"
55  
56 12615 ▶ 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 12615 12615
57 12615 __privtrans->incs = malloc(sizeof(*__privtrans->incs) * __privtrans->pdls[1]->ndims); /* CType.get_malloc */
58 ;
59 12615 __privtrans->offs = 0;
60 26418 ▶ for(i=0; i<__privtrans->pdls[1]->ndims; i++) {
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i<__privtrans->pdls[1]->ndims; i++) { 13803 12615 26418
61 13803 cor =
62 #line 1582 "lib/PDL/Slices.pd"
63 (
64 __params->n1 == __params->n2 ? i :
65 __params->n1 < __params->n2 ? EQUIVDIM(__params->n1,__params->n2,i,1) :
66 EQUIVDIM(__params->n1,__params->n2,i,-1)
67 )
68 #line 69 "lib/PDL/Slices-pp-mv.c"
69 ;
70 13803 __privtrans->pdls[1]->dims[i] = __privtrans->pdls[0]->dims[cor];
71 13803 __privtrans->incs[i] = __privtrans->pdls[0]->dimincs[cor];
72 }
73 12615 ▶ PDL_RETERROR(PDL_err, PDL->setdims_careful(__it));;
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->setdims_careful(__it));; 0 12615 12615
74
75 #line 384 "lib/PDL/PP.pm"
76 {int __ind; PDL_RETERROR(PDL_err, PDL->reallocbroadcastids(__privtrans->pdls[1], __privtrans->pdls[0]->nbroadcastids));
77 for(__ind=0; __ind<__privtrans->pdls[0]->nbroadcastids; __ind++)
78 __privtrans->pdls[1]->broadcastids[__ind] = __privtrans->pdls[0]->broadcastids[__ind] + (0);
79 }
80 #line 81 "lib/PDL/Slices-pp-mv.c"
81 ;
82 12615 __privtrans->dims_redone = 1;
83 12615 return PDL_err;
84 }
85  
86  
87 #line 1888 "lib/PDL/PP.pm"
88 pdl_error pdl_mv_free(pdl_trans *__privtrans, char destroy) {
89 pdl_error PDL_err = {0, NULL, 0};
90 #line 91 "lib/PDL/Slices-pp-mv.c"
91 12620 pdl_params_mv *__params = __privtrans->params; (void)__params;
92 12620 pdl *__it = __privtrans->pdls[1]; (void) __it;
93 12620 ▶ 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 */ 12615 5 12620
94 12620 ) return PDL_err;
95 }
96  
97 static pdl_datatypes pdl_mv_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 };
98 static PDL_Indx pdl_mv_vtable_realdims[] = { 0, 0 };
99 static char *pdl_mv_vtable_parnames[] = { "PARENT","CHILD" };
100 static short pdl_mv_vtable_parflags[] = {
101 0,
102 PDL_PARAM_ISCREAT|PDL_PARAM_ISCREATEALWAYS|PDL_PARAM_ISOUT|PDL_PARAM_ISWRITE
103 };
104 static pdl_datatypes pdl_mv_vtable_partypes[] = { -1, -1 };
105 static PDL_Indx pdl_mv_vtable_realdims_starts[] = { 0, 0 };
106 static PDL_Indx pdl_mv_vtable_realdims_ind_ids[] = { 0 };
107 static char *pdl_mv_vtable_indnames[] = { "" };
108 pdl_transvtable pdl_mv_vtable = {
109 0, PDL_ITRANS_ISAFFINE|PDL_ITRANS_DO_DATAFLOW_ANY, pdl_mv_vtable_gentypes, 1, 2, NULL /*CORE21*/,
110 pdl_mv_vtable_realdims, pdl_mv_vtable_parnames,
111 pdl_mv_vtable_parflags, pdl_mv_vtable_partypes,
112 pdl_mv_vtable_realdims_starts, pdl_mv_vtable_realdims_ind_ids, 0,
113 0, pdl_mv_vtable_indnames,
114 pdl_mv_redodims, NULL, NULL,
115 pdl_mv_free,
116 sizeof(pdl_params_mv),"PDL::Slices::mv"
117 };
118  
119  
120 12620 pdl_error pdl_run_mv(pdl *PARENT,pdl *CHILD,PDL_Indx n1,PDL_Indx n2) {
121 12620 pdl_error PDL_err = {0, NULL, 0};
122 12620 ▶ 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 12620 12620
123 12620 pdl_trans *__privtrans = PDL->create_trans(&pdl_mv_vtable);
124 12620 ▶ 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 12620 12620
125 12620 pdl_params_mv *__params = __privtrans->params;
126 12620 __privtrans->pdls[0] = PARENT;
127 12620 __privtrans->pdls[1] = CHILD;
128 12620 ▶ PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans)); 0 12620 12620
129 12620 (__params->n1) = (n1); /* CType.get_copy */
130 12620 (__params->n2) = (n2); /* CType.get_copy */
131 12620 ▶ PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
Branch: 1 branch
BranchTrueFalseTotal
PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans)); 0 12620 12620
132 12620 return PDL_err;
133 }
« lib/PDL/MatrixOps-pp-svd.c ↑ Summary lib/PDL/Math.pd »