File Coverage

lib/PDL/MatrixOps-pp-simq.c
Criterion Covered Total %
statement 37 38 97.3
branch 30 54 55.5
condition n/a
subroutine n/a
pod n/a
total 67 92 72.8


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/MatrixOps.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_MatrixOps
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/MatrixOps-pp-simq.c"
23              
24             #include
25              
26             #line 1846 "lib/PDL/PP.pm"
27             typedef struct pdl_params_simq {
28             #line 29 "lib/PDL/MatrixOps-pp-simq.c"
29             int flag;
30             } pdl_params_simq;
31              
32              
33             #line 1857 "lib/PDL/PP.pm"
34             pdl_error pdl_simq_readdata(pdl_trans *__privtrans) {
35             pdl_error PDL_err = {0, NULL, 0};
36             #line 37 "lib/PDL/MatrixOps-pp-simq.c"
37 4           pdl_params_simq *__params = __privtrans->params; (void)__params;
38 4 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in simq:" "broadcast.incs NULL");
39             /* broadcastloop declarations */
40             int __brcloopval;
41             register PDL_Indx __tind0,__tind1; /* counters along dim */
42 4           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
43             /* dims here are how many steps along those dims */
44 4           register PDL_Indx __tinc0_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
45 4           register PDL_Indx __tinc0_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
46 4           register PDL_Indx __tinc0_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
47 4           register PDL_Indx __tinc0_ips = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
48 4           register PDL_Indx __tinc1_b = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
49 4           register PDL_Indx __tinc1_a = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
50 4           register PDL_Indx __tinc1_x = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
51 4           register PDL_Indx __tinc1_ips = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
52             #define PDL_BROADCASTLOOP_START_simq_readdata PDL_BROADCASTLOOP_START( \
53             readdata, \
54             __privtrans->broadcast, \
55             __privtrans->vtable, \
56             b_datap += __offsp[0]; \
57             a_datap += __offsp[1]; \
58             x_datap += __offsp[2]; \
59             ips_datap += __offsp[3]; \
60             , \
61             ( ,b_datap += __tinc1_b - __tinc0_b * __tdims0 \
62             ,a_datap += __tinc1_a - __tinc0_a * __tdims0 \
63             ,x_datap += __tinc1_x - __tinc0_x * __tdims0 \
64             ,ips_datap += __tinc1_ips - __tinc0_ips * __tdims0 \
65             ), \
66             ( ,b_datap += __tinc0_b \
67             ,a_datap += __tinc0_a \
68             ,x_datap += __tinc0_x \
69             ,ips_datap += __tinc0_ips \
70             ) \
71             )
72             #define PDL_BROADCASTLOOP_END_simq_readdata PDL_BROADCASTLOOP_END( \
73             __privtrans->broadcast, \
74             b_datap -= __tinc1_b * __tdims1 + __offsp[0]; \
75             a_datap -= __tinc1_a * __tdims1 + __offsp[1]; \
76             x_datap -= __tinc1_x * __tdims1 + __offsp[2]; \
77             ips_datap -= __tinc1_ips * __tdims1 + __offsp[3]; \
78             )
79 4           register PDL_Indx __inc_a_n0 = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_a_n0;register PDL_Indx __inc_a_n1 = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,1)]; (void)__inc_a_n1;
80 4           register PDL_Indx __inc_b_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_b_n;
81 4           register PDL_Indx __inc_ips_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_ips_n;
82 4           register PDL_Indx __inc_x_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_x_n;
83             #ifndef PDL_DECLARE_PARAMS_simq_1
84             #define PDL_DECLARE_PARAMS_simq_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_ips,PDL_PPSYM_PARAM_ips) \
85             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, b, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
86             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, a, (__privtrans->pdls[1]), 1, PDL_PPSYM_OP) \
87             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, x, (__privtrans->pdls[2]), 1, PDL_PPSYM_OP) \
88             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_ips, ips, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_ips)
89             #endif
90             #define PDL_IF_BAD(t,f) f
91 4 50         switch (__privtrans->__datatype) { /* Start generic switch */
92 4           case PDL_D: {
93 4 50         PDL_DECLARE_PARAMS_simq_1(PDL_Double,D,PDL_Long,L)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
94 16 50         PDL_BROADCASTLOOP_START_simq_readdata {
    50          
    50          
    50          
    50          
    100          
    100          
95             extern int simq( double *A, double *B, double *X,
96             int n, int flag, int *IPS );
97 4           simq(a_datap, b_datap, x_datap, __privtrans->ind_sizes[0], __params->flag, ips_datap);
98 4 50         }PDL_BROADCASTLOOP_END_simq_readdata
    50          
99 4           } break;
100 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in simq: unhandled datatype(%d), only handles (D)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
101             }
102             #undef PDL_IF_BAD
103 4           return PDL_err;
104             }
105              
106             static pdl_datatypes pdl_simq_vtable_gentypes[] = { PDL_D, -1 };
107             static PDL_Indx pdl_simq_vtable_realdims[] = { 1, 2, 1, 1 };
108             static char *pdl_simq_vtable_parnames[] = { "b","a","x","ips" };
109             static short pdl_simq_vtable_parflags[] = {
110             PDL_PARAM_ISPHYS,
111             PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE,
112             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISPHYS|PDL_PARAM_ISWRITE,
113             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISPHYS|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
114             };
115             static pdl_datatypes pdl_simq_vtable_partypes[] = { -1, -1, -1, PDL_L };
116             static PDL_Indx pdl_simq_vtable_realdims_starts[] = { 0, 1, 3, 4 };
117             static PDL_Indx pdl_simq_vtable_realdims_ind_ids[] = { 0, 0, 0, 0, 0 };
118             static char *pdl_simq_vtable_indnames[] = { "n" };
119             pdl_transvtable pdl_simq_vtable = {
120             PDL_TRANS_DO_BROADCAST|PDL_TRANS_BADIGNORE, 0, pdl_simq_vtable_gentypes, 1, 4, NULL /*CORE21*/,
121             pdl_simq_vtable_realdims, pdl_simq_vtable_parnames,
122             pdl_simq_vtable_parflags, pdl_simq_vtable_partypes,
123             pdl_simq_vtable_realdims_starts, pdl_simq_vtable_realdims_ind_ids, 5,
124             1, pdl_simq_vtable_indnames,
125             NULL, pdl_simq_readdata, NULL,
126             NULL,
127             sizeof(pdl_params_simq),"PDL::MatrixOps::simq"
128             };
129              
130              
131 7           pdl_error pdl_run_simq(pdl *a,pdl *b,pdl *x,pdl *ips,int flag) {
132 7           pdl_error PDL_err = {0, NULL, 0};
133 7 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
134 7           pdl_trans *__privtrans = PDL->create_trans(&pdl_simq_vtable);
135 7 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
136 7           pdl_params_simq *__params = __privtrans->params;
137 7           __privtrans->pdls[0] = b;
138 7           __privtrans->pdls[1] = a;
139 7           __privtrans->pdls[2] = x;
140 7           __privtrans->pdls[3] = ips;
141 7 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
142 7           (__params->flag) = (flag); /* CType.get_copy */
143 7 100         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
144 4           return PDL_err;
145             }