File Coverage

lib/PDL/ImageND-pp-path_join.c
Criterion Covered Total %
statement 109 782 13.9
branch 100 1692 5.9
condition n/a
subroutine n/a
pod n/a
total 209 2474 8.4


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/ImageND.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_ImageND
21             extern Core* PDL; /* Structure hold core C functions */
22              
23             #line 1846 "lib/PDL/PP.pm"
24             typedef struct pdl_params_path_join {
25             #line 26 "lib/PDL/ImageND-pp-path_join.c"
26             PDL_Indx d;
27             int directed;
28             } pdl_params_path_join;
29              
30              
31             #line 1857 "lib/PDL/PP.pm"
32             pdl_error pdl_path_join_redodims(pdl_trans *__privtrans) {
33             pdl_error PDL_err = {0, NULL, 0};
34             #line 35 "lib/PDL/ImageND-pp-path_join.c"
35 5           pdl_params_path_join *__params = __privtrans->params; (void)__params;
36 5           __privtrans->ind_sizes[0] = __params->d;
37 5           __privtrans->ind_sizes[2] = __privtrans->ind_sizes[1]*2;
38 5           __privtrans->ind_sizes[3] = 2;
39 5 50         PDL_RETERROR(PDL_err, PDL->redodims_default(__privtrans));
40 5           return PDL_err;
41             }
42              
43              
44             #line 1857 "lib/PDL/PP.pm"
45             pdl_error pdl_path_join_readdata(pdl_trans *__privtrans) {
46             pdl_error PDL_err = {0, NULL, 0};
47             #line 48 "lib/PDL/ImageND-pp-path_join.c"
48 5           pdl_params_path_join *__params = __privtrans->params; (void)__params;
49 5           register PDL_Indx __d_size = __privtrans->ind_sizes[0];
50 5           register PDL_Indx __n_size = __privtrans->ind_sizes[1];
51 5           register PDL_Indx __nout_size = __privtrans->ind_sizes[2];
52 5 50         if (!__privtrans->broadcast.incs) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "broadcast.incs NULL");
53             /* broadcastloop declarations */
54             int __brcloopval;
55             register PDL_Indx __tind0,__tind1; /* counters along dim */
56 5           register PDL_Indx __tnpdls = __privtrans->broadcast.npdls;
57             /* dims here are how many steps along those dims */
58 5           register PDL_Indx __tinc0_e = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,0);
59 5           register PDL_Indx __tinc0_pathendindex = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,0);
60 5           register PDL_Indx __tinc0_paths = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,0);
61 5           register PDL_Indx __tinc0_highestoutedge = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,0);
62 5           register PDL_Indx __tinc0_outedges = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,0);
63 5           register PDL_Indx __tinc0_hasinward = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,0);
64 5           register PDL_Indx __tinc0_sourceids = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,0);
65 5           register PDL_Indx __tinc1_e = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,0,1);
66 5           register PDL_Indx __tinc1_pathendindex = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,1,1);
67 5           register PDL_Indx __tinc1_paths = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,2,1);
68 5           register PDL_Indx __tinc1_highestoutedge = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,3,1);
69 5           register PDL_Indx __tinc1_outedges = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,4,1);
70 5           register PDL_Indx __tinc1_hasinward = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,5,1);
71 5           register PDL_Indx __tinc1_sourceids = PDL_BRC_INC(__privtrans->broadcast.incs,__tnpdls,6,1);
72             #define PDL_BROADCASTLOOP_START_path_join_readdata PDL_BROADCASTLOOP_START( \
73             readdata, \
74             __privtrans->broadcast, \
75             __privtrans->vtable, \
76             e_datap += __offsp[0]; \
77             pathendindex_datap += __offsp[1]; \
78             paths_datap += __offsp[2]; \
79             highestoutedge_datap += __offsp[3]; \
80             outedges_datap += __offsp[4]; \
81             hasinward_datap += __offsp[5]; \
82             sourceids_datap += __offsp[6]; \
83             , \
84             ( ,e_datap += __tinc1_e - __tinc0_e * __tdims0 \
85             ,pathendindex_datap += __tinc1_pathendindex - __tinc0_pathendindex * __tdims0 \
86             ,paths_datap += __tinc1_paths - __tinc0_paths * __tdims0 \
87             ,highestoutedge_datap += __tinc1_highestoutedge - __tinc0_highestoutedge * __tdims0 \
88             ,outedges_datap += __tinc1_outedges - __tinc0_outedges * __tdims0 \
89             ,hasinward_datap += __tinc1_hasinward - __tinc0_hasinward * __tdims0 \
90             ,sourceids_datap += __tinc1_sourceids - __tinc0_sourceids * __tdims0 \
91             ), \
92             ( ,e_datap += __tinc0_e \
93             ,pathendindex_datap += __tinc0_pathendindex \
94             ,paths_datap += __tinc0_paths \
95             ,highestoutedge_datap += __tinc0_highestoutedge \
96             ,outedges_datap += __tinc0_outedges \
97             ,hasinward_datap += __tinc0_hasinward \
98             ,sourceids_datap += __tinc0_sourceids \
99             ) \
100             )
101             #define PDL_BROADCASTLOOP_END_path_join_readdata PDL_BROADCASTLOOP_END( \
102             __privtrans->broadcast, \
103             e_datap -= __tinc1_e * __tdims1 + __offsp[0]; \
104             pathendindex_datap -= __tinc1_pathendindex * __tdims1 + __offsp[1]; \
105             paths_datap -= __tinc1_paths * __tdims1 + __offsp[2]; \
106             highestoutedge_datap -= __tinc1_highestoutedge * __tdims1 + __offsp[3]; \
107             outedges_datap -= __tinc1_outedges * __tdims1 + __offsp[4]; \
108             hasinward_datap -= __tinc1_hasinward * __tdims1 + __offsp[5]; \
109             sourceids_datap -= __tinc1_sourceids * __tdims1 + __offsp[6]; \
110             )
111 5           register PDL_Indx __inc_e_v = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,0)]; (void)__inc_e_v;register PDL_Indx __inc_e_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,0,1)]; (void)__inc_e_n;
112 5           register PDL_Indx __inc_hasinward_d = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,5,0)]; (void)__inc_hasinward_d;
113 5           register PDL_Indx __inc_highestoutedge_d = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,3,0)]; (void)__inc_highestoutedge_d;
114 5           register PDL_Indx __inc_outedges_d0 = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,0)]; (void)__inc_outedges_d0;register PDL_Indx __inc_outedges_d1 = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,4,1)]; (void)__inc_outedges_d1;
115 5           register PDL_Indx __inc_pathendindex_n = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,1,0)]; (void)__inc_pathendindex_n;
116 5           register PDL_Indx __inc_paths_nout = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,2,0)]; (void)__inc_paths_nout;
117 5           register PDL_Indx __inc_sourceids_d = __privtrans->inc_sizes[PDL_INC_ID(__privtrans->vtable,6,0)]; (void)__inc_sourceids_d;
118             #ifndef PDL_DECLARE_PARAMS_path_join_1
119             #define PDL_DECLARE_PARAMS_path_join_1(PDL_TYPE_OP,PDL_PPSYM_OP,PDL_TYPE_PARAM_pathendindex,PDL_PPSYM_PARAM_pathendindex,PDL_TYPE_PARAM_paths,PDL_PPSYM_PARAM_paths,PDL_TYPE_PARAM_highestoutedge,PDL_PPSYM_PARAM_highestoutedge,PDL_TYPE_PARAM_outedges,PDL_PPSYM_PARAM_outedges,PDL_TYPE_PARAM_hasinward,PDL_PPSYM_PARAM_hasinward,PDL_TYPE_PARAM_sourceids,PDL_PPSYM_PARAM_sourceids) \
120             PDL_DECLARE_PARAMETER(PDL_TYPE_OP, e, (__privtrans->pdls[0]), 1, PDL_PPSYM_OP) \
121             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_pathendindex, pathendindex, (__privtrans->pdls[1]), 1, PDL_PPSYM_PARAM_pathendindex) \
122             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_paths, paths, (__privtrans->pdls[2]), 1, PDL_PPSYM_PARAM_paths) \
123             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_highestoutedge, highestoutedge, (__privtrans->pdls[3]), 1, PDL_PPSYM_PARAM_highestoutedge) \
124             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_outedges, outedges, (__privtrans->pdls[4]), 1, PDL_PPSYM_PARAM_outedges) \
125             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_hasinward, hasinward, (__privtrans->pdls[5]), 1, PDL_PPSYM_PARAM_hasinward) \
126             PDL_DECLARE_PARAMETER(PDL_TYPE_PARAM_sourceids, sourceids, (__privtrans->pdls[6]), 1, PDL_PPSYM_PARAM_sourceids)
127             #endif
128             #define PDL_IF_BAD(t,f) f
129 5           switch (__privtrans->__datatype) { /* Start generic switch */
130 0           case PDL_SB: {
131 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_SByte,A,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
132 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
133 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
134 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
135             #define PDL_ADJ_ADD(idfrom,idto) \
136             do { \
137             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
138             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
139             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
140             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
141             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
142             if (setind >= __privtrans->ind_sizes[0]) \
143             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
144             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
145             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
146             } while (0)
147 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
148 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
149 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
150 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
151             }} /* Close n */
152             #undef PDL_ADJ_ADD
153 0           PDL_Indx highest_no_inward = -1;
154 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
155 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
156 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
157             }} /* Close d */
158 0           PDL_Indx pind = 0, pcount = 0;
159 0           while (1) {
160 0           PDL_Indx idthis = -1, idnext = -1;
161 0 0         if (highest_no_inward >= 0) {
162 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
163 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
164             }
165 0 0         if (idthis == -1)
166 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
167 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
168 0           idthis = d; break;
169             }} /* Close d */
170 0 0         if (idthis == -1) break;
171 0           while (1) {
172 0 0         if (idthis == -1) break;
173 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
174 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
175 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
176 0 0         if (edgehighest < 0) break;
177 0           idnext = -1;
178 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
179 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
180 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
181 0           edgeidnext = d0;
182             }} /* Close d0=edgehighest:0:-1 */
183 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
184 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
185 0 0         if (edgeidnext != edgehighest)
186 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
187 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
188             }} /* Close d0=edgeidnext:edgehighest */
189 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
190 0 0         if (!__params->directed) { /* remove the edge in the other direction */
191 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
192 0           edgeidnext = -1;
193 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
194 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
195 0 0         if (maybe_other != idthis) continue;
196 0           edgeidnext = d0;
197 0           break;
198             }} /* Close d0=edgehighest:0:-1 */
199 0 0         if (edgeidnext == -1)
200 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
201 0 0         if (edgeidnext != edgehighest)
202 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
203 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
204             }} /* Close d0=edgeidnext:edgehighest */
205 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
206             }
207 0           idthis = idnext;
208             }
209 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
210 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
211 0 0         if (idthis == -1) break;
212             }
213 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
214 0           } break;
215 0           case PDL_B: {
216 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Byte,B,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
217 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
218 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
219 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
220             #define PDL_ADJ_ADD(idfrom,idto) \
221             do { \
222             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
223             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
224             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
225             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
226             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
227             if (setind >= __privtrans->ind_sizes[0]) \
228             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
229             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
230             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
231             } while (0)
232 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
233 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
234 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
235 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
236             }} /* Close n */
237             #undef PDL_ADJ_ADD
238 0           PDL_Indx highest_no_inward = -1;
239 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
240 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
241 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
242             }} /* Close d */
243 0           PDL_Indx pind = 0, pcount = 0;
244 0           while (1) {
245 0           PDL_Indx idthis = -1, idnext = -1;
246 0 0         if (highest_no_inward >= 0) {
247 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
248 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
249             }
250 0 0         if (idthis == -1)
251 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
252 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
253 0           idthis = d; break;
254             }} /* Close d */
255 0 0         if (idthis == -1) break;
256 0           while (1) {
257 0 0         if (idthis == -1) break;
258 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
259 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
260 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
261 0 0         if (edgehighest < 0) break;
262 0           idnext = -1;
263 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
264 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
265 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
266 0           edgeidnext = d0;
267             }} /* Close d0=edgehighest:0:-1 */
268 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
269 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
270 0 0         if (edgeidnext != edgehighest)
271 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
272 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
273             }} /* Close d0=edgeidnext:edgehighest */
274 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
275 0 0         if (!__params->directed) { /* remove the edge in the other direction */
276 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
277 0           edgeidnext = -1;
278 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
279 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
280 0 0         if (maybe_other != idthis) continue;
281 0           edgeidnext = d0;
282 0           break;
283             }} /* Close d0=edgehighest:0:-1 */
284 0 0         if (edgeidnext == -1)
285 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
286 0 0         if (edgeidnext != edgehighest)
287 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
288 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
289             }} /* Close d0=edgeidnext:edgehighest */
290 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
291             }
292 0           idthis = idnext;
293             }
294 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
295 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
296 0 0         if (idthis == -1) break;
297             }
298 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
299 0           } break;
300 0           case PDL_S: {
301 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Short,S,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
302 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
303 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
304 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
305             #define PDL_ADJ_ADD(idfrom,idto) \
306             do { \
307             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
308             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
309             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
310             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
311             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
312             if (setind >= __privtrans->ind_sizes[0]) \
313             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
314             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
315             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
316             } while (0)
317 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
318 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
319 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
320 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
321             }} /* Close n */
322             #undef PDL_ADJ_ADD
323 0           PDL_Indx highest_no_inward = -1;
324 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
325 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
326 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
327             }} /* Close d */
328 0           PDL_Indx pind = 0, pcount = 0;
329 0           while (1) {
330 0           PDL_Indx idthis = -1, idnext = -1;
331 0 0         if (highest_no_inward >= 0) {
332 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
333 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
334             }
335 0 0         if (idthis == -1)
336 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
337 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
338 0           idthis = d; break;
339             }} /* Close d */
340 0 0         if (idthis == -1) break;
341 0           while (1) {
342 0 0         if (idthis == -1) break;
343 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
344 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
345 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
346 0 0         if (edgehighest < 0) break;
347 0           idnext = -1;
348 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
349 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
350 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
351 0           edgeidnext = d0;
352             }} /* Close d0=edgehighest:0:-1 */
353 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
354 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
355 0 0         if (edgeidnext != edgehighest)
356 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
357 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
358             }} /* Close d0=edgeidnext:edgehighest */
359 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
360 0 0         if (!__params->directed) { /* remove the edge in the other direction */
361 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
362 0           edgeidnext = -1;
363 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
364 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
365 0 0         if (maybe_other != idthis) continue;
366 0           edgeidnext = d0;
367 0           break;
368             }} /* Close d0=edgehighest:0:-1 */
369 0 0         if (edgeidnext == -1)
370 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
371 0 0         if (edgeidnext != edgehighest)
372 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
373 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
374             }} /* Close d0=edgeidnext:edgehighest */
375 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
376             }
377 0           idthis = idnext;
378             }
379 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
380 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
381 0 0         if (idthis == -1) break;
382             }
383 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
384 0           } break;
385 0           case PDL_US: {
386 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Ushort,U,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
387 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
388 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
389 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
390             #define PDL_ADJ_ADD(idfrom,idto) \
391             do { \
392             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
393             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
394             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
395             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
396             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
397             if (setind >= __privtrans->ind_sizes[0]) \
398             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
399             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
400             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
401             } while (0)
402 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
403 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
404 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
405 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
406             }} /* Close n */
407             #undef PDL_ADJ_ADD
408 0           PDL_Indx highest_no_inward = -1;
409 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
410 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
411 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
412             }} /* Close d */
413 0           PDL_Indx pind = 0, pcount = 0;
414 0           while (1) {
415 0           PDL_Indx idthis = -1, idnext = -1;
416 0 0         if (highest_no_inward >= 0) {
417 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
418 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
419             }
420 0 0         if (idthis == -1)
421 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
422 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
423 0           idthis = d; break;
424             }} /* Close d */
425 0 0         if (idthis == -1) break;
426 0           while (1) {
427 0 0         if (idthis == -1) break;
428 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
429 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
430 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
431 0 0         if (edgehighest < 0) break;
432 0           idnext = -1;
433 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
434 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
435 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
436 0           edgeidnext = d0;
437             }} /* Close d0=edgehighest:0:-1 */
438 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
439 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
440 0 0         if (edgeidnext != edgehighest)
441 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
442 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
443             }} /* Close d0=edgeidnext:edgehighest */
444 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
445 0 0         if (!__params->directed) { /* remove the edge in the other direction */
446 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
447 0           edgeidnext = -1;
448 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
449 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
450 0 0         if (maybe_other != idthis) continue;
451 0           edgeidnext = d0;
452 0           break;
453             }} /* Close d0=edgehighest:0:-1 */
454 0 0         if (edgeidnext == -1)
455 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
456 0 0         if (edgeidnext != edgehighest)
457 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
458 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
459             }} /* Close d0=edgeidnext:edgehighest */
460 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
461             }
462 0           idthis = idnext;
463             }
464 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
465 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
466 0 0         if (idthis == -1) break;
467             }
468 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
469 0           } break;
470 0           case PDL_L: {
471 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Long,L,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
472 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
473 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
474 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
475             #define PDL_ADJ_ADD(idfrom,idto) \
476             do { \
477             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
478             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
479             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
480             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
481             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
482             if (setind >= __privtrans->ind_sizes[0]) \
483             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
484             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
485             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
486             } while (0)
487 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
488 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
489 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
490 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
491             }} /* Close n */
492             #undef PDL_ADJ_ADD
493 0           PDL_Indx highest_no_inward = -1;
494 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
495 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
496 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
497             }} /* Close d */
498 0           PDL_Indx pind = 0, pcount = 0;
499 0           while (1) {
500 0           PDL_Indx idthis = -1, idnext = -1;
501 0 0         if (highest_no_inward >= 0) {
502 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
503 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
504             }
505 0 0         if (idthis == -1)
506 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
507 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
508 0           idthis = d; break;
509             }} /* Close d */
510 0 0         if (idthis == -1) break;
511 0           while (1) {
512 0 0         if (idthis == -1) break;
513 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
514 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
515 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
516 0 0         if (edgehighest < 0) break;
517 0           idnext = -1;
518 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
519 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
520 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
521 0           edgeidnext = d0;
522             }} /* Close d0=edgehighest:0:-1 */
523 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
524 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
525 0 0         if (edgeidnext != edgehighest)
526 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
527 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
528             }} /* Close d0=edgeidnext:edgehighest */
529 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
530 0 0         if (!__params->directed) { /* remove the edge in the other direction */
531 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
532 0           edgeidnext = -1;
533 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
534 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
535 0 0         if (maybe_other != idthis) continue;
536 0           edgeidnext = d0;
537 0           break;
538             }} /* Close d0=edgehighest:0:-1 */
539 0 0         if (edgeidnext == -1)
540 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
541 0 0         if (edgeidnext != edgehighest)
542 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
543 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
544             }} /* Close d0=edgeidnext:edgehighest */
545 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
546             }
547 0           idthis = idnext;
548             }
549 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
550 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
551 0 0         if (idthis == -1) break;
552             }
553 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
554 0           } break;
555 0           case PDL_UL: {
556 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_ULong,K,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
557 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
558 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
559 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
560             #define PDL_ADJ_ADD(idfrom,idto) \
561             do { \
562             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
563             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
564             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
565             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
566             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
567             if (setind >= __privtrans->ind_sizes[0]) \
568             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
569             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
570             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
571             } while (0)
572 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
573 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
574 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
575 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
576             }} /* Close n */
577             #undef PDL_ADJ_ADD
578 0           PDL_Indx highest_no_inward = -1;
579 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
580 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
581 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
582             }} /* Close d */
583 0           PDL_Indx pind = 0, pcount = 0;
584 0           while (1) {
585 0           PDL_Indx idthis = -1, idnext = -1;
586 0 0         if (highest_no_inward >= 0) {
587 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
588 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
589             }
590 0 0         if (idthis == -1)
591 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
592 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
593 0           idthis = d; break;
594             }} /* Close d */
595 0 0         if (idthis == -1) break;
596 0           while (1) {
597 0 0         if (idthis == -1) break;
598 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
599 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
600 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
601 0 0         if (edgehighest < 0) break;
602 0           idnext = -1;
603 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
604 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
605 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
606 0           edgeidnext = d0;
607             }} /* Close d0=edgehighest:0:-1 */
608 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
609 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
610 0 0         if (edgeidnext != edgehighest)
611 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
612 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
613             }} /* Close d0=edgeidnext:edgehighest */
614 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
615 0 0         if (!__params->directed) { /* remove the edge in the other direction */
616 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
617 0           edgeidnext = -1;
618 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
619 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
620 0 0         if (maybe_other != idthis) continue;
621 0           edgeidnext = d0;
622 0           break;
623             }} /* Close d0=edgehighest:0:-1 */
624 0 0         if (edgeidnext == -1)
625 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
626 0 0         if (edgeidnext != edgehighest)
627 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
628 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
629             }} /* Close d0=edgeidnext:edgehighest */
630 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
631             }
632 0           idthis = idnext;
633             }
634 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
635 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
636 0 0         if (idthis == -1) break;
637             }
638 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
639 0           } break;
640 0           case PDL_IND: {
641 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
642 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
643 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
644 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
645             #define PDL_ADJ_ADD(idfrom,idto) \
646             do { \
647             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
648             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
649             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
650             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
651             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
652             if (setind >= __privtrans->ind_sizes[0]) \
653             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
654             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
655             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
656             } while (0)
657 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
658 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
659 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
660 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
661             }} /* Close n */
662             #undef PDL_ADJ_ADD
663 0           PDL_Indx highest_no_inward = -1;
664 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
665 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
666 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
667             }} /* Close d */
668 0           PDL_Indx pind = 0, pcount = 0;
669 0           while (1) {
670 0           PDL_Indx idthis = -1, idnext = -1;
671 0 0         if (highest_no_inward >= 0) {
672 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
673 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
674             }
675 0 0         if (idthis == -1)
676 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
677 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
678 0           idthis = d; break;
679             }} /* Close d */
680 0 0         if (idthis == -1) break;
681 0           while (1) {
682 0 0         if (idthis == -1) break;
683 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
684 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
685 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
686 0 0         if (edgehighest < 0) break;
687 0           idnext = -1;
688 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
689 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
690 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
691 0           edgeidnext = d0;
692             }} /* Close d0=edgehighest:0:-1 */
693 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
694 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
695 0 0         if (edgeidnext != edgehighest)
696 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
697 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
698             }} /* Close d0=edgeidnext:edgehighest */
699 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
700 0 0         if (!__params->directed) { /* remove the edge in the other direction */
701 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
702 0           edgeidnext = -1;
703 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
704 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
705 0 0         if (maybe_other != idthis) continue;
706 0           edgeidnext = d0;
707 0           break;
708             }} /* Close d0=edgehighest:0:-1 */
709 0 0         if (edgeidnext == -1)
710 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
711 0 0         if (edgeidnext != edgehighest)
712 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
713 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
714             }} /* Close d0=edgeidnext:edgehighest */
715 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
716             }
717 0           idthis = idnext;
718             }
719 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
720 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
721 0 0         if (idthis == -1) break;
722             }
723 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
724 0           } break;
725 0           case PDL_ULL: {
726 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_ULongLong,P,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
727 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
728 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
729 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
730             #define PDL_ADJ_ADD(idfrom,idto) \
731             do { \
732             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
733             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
734             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
735             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
736             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
737             if (setind >= __privtrans->ind_sizes[0]) \
738             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
739             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
740             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
741             } while (0)
742 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
743 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
744 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
745 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
746             }} /* Close n */
747             #undef PDL_ADJ_ADD
748 0           PDL_Indx highest_no_inward = -1;
749 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
750 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
751 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
752             }} /* Close d */
753 0           PDL_Indx pind = 0, pcount = 0;
754 0           while (1) {
755 0           PDL_Indx idthis = -1, idnext = -1;
756 0 0         if (highest_no_inward >= 0) {
757 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
758 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
759             }
760 0 0         if (idthis == -1)
761 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
762 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
763 0           idthis = d; break;
764             }} /* Close d */
765 0 0         if (idthis == -1) break;
766 0           while (1) {
767 0 0         if (idthis == -1) break;
768 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
769 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
770 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
771 0 0         if (edgehighest < 0) break;
772 0           idnext = -1;
773 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
774 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
775 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
776 0           edgeidnext = d0;
777             }} /* Close d0=edgehighest:0:-1 */
778 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
779 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
780 0 0         if (edgeidnext != edgehighest)
781 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
782 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
783             }} /* Close d0=edgeidnext:edgehighest */
784 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
785 0 0         if (!__params->directed) { /* remove the edge in the other direction */
786 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
787 0           edgeidnext = -1;
788 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
789 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
790 0 0         if (maybe_other != idthis) continue;
791 0           edgeidnext = d0;
792 0           break;
793             }} /* Close d0=edgehighest:0:-1 */
794 0 0         if (edgeidnext == -1)
795 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
796 0 0         if (edgeidnext != edgehighest)
797 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
798 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
799             }} /* Close d0=edgeidnext:edgehighest */
800 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
801             }
802 0           idthis = idnext;
803             }
804 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
805 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
806 0 0         if (idthis == -1) break;
807             }
808 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
809 0           } break;
810 0           case PDL_LL: {
811 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_LongLong,Q,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
812 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
813 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
814 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
815             #define PDL_ADJ_ADD(idfrom,idto) \
816             do { \
817             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
818             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
819             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
820             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
821             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
822             if (setind >= __privtrans->ind_sizes[0]) \
823             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
824             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
825             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
826             } while (0)
827 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
828 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
829 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
830 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
831             }} /* Close n */
832             #undef PDL_ADJ_ADD
833 0           PDL_Indx highest_no_inward = -1;
834 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
835 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
836 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
837             }} /* Close d */
838 0           PDL_Indx pind = 0, pcount = 0;
839 0           while (1) {
840 0           PDL_Indx idthis = -1, idnext = -1;
841 0 0         if (highest_no_inward >= 0) {
842 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
843 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
844             }
845 0 0         if (idthis == -1)
846 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
847 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
848 0           idthis = d; break;
849             }} /* Close d */
850 0 0         if (idthis == -1) break;
851 0           while (1) {
852 0 0         if (idthis == -1) break;
853 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
854 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
855 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
856 0 0         if (edgehighest < 0) break;
857 0           idnext = -1;
858 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
859 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
860 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
861 0           edgeidnext = d0;
862             }} /* Close d0=edgehighest:0:-1 */
863 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
864 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
865 0 0         if (edgeidnext != edgehighest)
866 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
867 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
868             }} /* Close d0=edgeidnext:edgehighest */
869 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
870 0 0         if (!__params->directed) { /* remove the edge in the other direction */
871 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
872 0           edgeidnext = -1;
873 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
874 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
875 0 0         if (maybe_other != idthis) continue;
876 0           edgeidnext = d0;
877 0           break;
878             }} /* Close d0=edgehighest:0:-1 */
879 0 0         if (edgeidnext == -1)
880 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
881 0 0         if (edgeidnext != edgehighest)
882 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
883 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
884             }} /* Close d0=edgeidnext:edgehighest */
885 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
886             }
887 0           idthis = idnext;
888             }
889 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
890 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
891 0 0         if (idthis == -1) break;
892             }
893 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
894 0           } break;
895 0           case PDL_F: {
896 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_Float,F,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
897 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
898 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
899 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
900             #define PDL_ADJ_ADD(idfrom,idto) \
901             do { \
902             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
903             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
904             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
905             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
906             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
907             if (setind >= __privtrans->ind_sizes[0]) \
908             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
909             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
910             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
911             } while (0)
912 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
913 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
914 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
915 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
916             }} /* Close n */
917             #undef PDL_ADJ_ADD
918 0           PDL_Indx highest_no_inward = -1;
919 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
920 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
921 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
922             }} /* Close d */
923 0           PDL_Indx pind = 0, pcount = 0;
924 0           while (1) {
925 0           PDL_Indx idthis = -1, idnext = -1;
926 0 0         if (highest_no_inward >= 0) {
927 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
928 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
929             }
930 0 0         if (idthis == -1)
931 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
932 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
933 0           idthis = d; break;
934             }} /* Close d */
935 0 0         if (idthis == -1) break;
936 0           while (1) {
937 0 0         if (idthis == -1) break;
938 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
939 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
940 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
941 0 0         if (edgehighest < 0) break;
942 0           idnext = -1;
943 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
944 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
945 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
946 0           edgeidnext = d0;
947             }} /* Close d0=edgehighest:0:-1 */
948 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
949 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
950 0 0         if (edgeidnext != edgehighest)
951 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
952 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
953             }} /* Close d0=edgeidnext:edgehighest */
954 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
955 0 0         if (!__params->directed) { /* remove the edge in the other direction */
956 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
957 0           edgeidnext = -1;
958 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
959 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
960 0 0         if (maybe_other != idthis) continue;
961 0           edgeidnext = d0;
962 0           break;
963             }} /* Close d0=edgehighest:0:-1 */
964 0 0         if (edgeidnext == -1)
965 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
966 0 0         if (edgeidnext != edgehighest)
967 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
968 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
969             }} /* Close d0=edgeidnext:edgehighest */
970 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
971             }
972 0           idthis = idnext;
973             }
974 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
975 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
976 0 0         if (idthis == -1) break;
977             }
978 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
979 0           } break;
980 5           case PDL_D: {
981 5 50         PDL_DECLARE_PARAMS_path_join_1(PDL_Double,D,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
982 53 50         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    50          
    50          
    50          
    50          
    100          
    100          
    100          
983 35 100         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
984 65 100         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
985             #define PDL_ADJ_ADD(idfrom,idto) \
986             do { \
987             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
988             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
989             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
990             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
991             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
992             if (setind >= __privtrans->ind_sizes[0]) \
993             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
994             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
995             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
996             } while (0)
997 35 100         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
998 30           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
999 30 50         PDL_ADJ_ADD(from,to);
    50          
    50          
    50          
    50          
1000 30 100         if (!__params->directed) PDL_ADJ_ADD(to,from);
    50          
    50          
    50          
    50          
    50          
1001             }} /* Close n */
1002             #undef PDL_ADJ_ADD
1003 5           PDL_Indx highest_no_inward = -1;
1004 38 100         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
1005 33 100         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    50          
1006 7           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
1007             }} /* Close d */
1008 5           PDL_Indx pind = 0, pcount = 0;
1009 16           while (1) {
1010 21           PDL_Indx idthis = -1, idnext = -1;
1011 21 100         if (highest_no_inward >= 0) {
1012 7           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
1013 7 50         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
1014             }
1015 21 100         if (idthis == -1)
1016 71 100         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
1017 66 100         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
1018 9           idthis = d; break;
1019             }} /* Close d */
1020 21 100         if (idthis == -1) break;
1021 30           while (1) {
1022 46 50         if (idthis == -1) break;
1023 46 50         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
1024 46           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
1025 46           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
1026 46 100         if (edgehighest < 0) break;
1027 30           idnext = -1;
1028 68 100         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
1029 38           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
1030 38 100         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
1031 12           edgeidnext = d0;
1032             }} /* Close d0=edgehighest:0:-1 */
1033 30 100         if (edgeidnext == -1) edgeidnext = edgehighest;
1034 30           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
1035 30 100         if (edgeidnext != edgehighest)
1036 8 100         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
1037 4           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
1038             }} /* Close d0=edgeidnext:edgehighest */
1039 30           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
1040 30 100         if (!__params->directed) { /* remove the edge in the other direction */
1041 12           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
1042 12           edgeidnext = -1;
1043 20 50         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
1044 20           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
1045 20 100         if (maybe_other != idthis) continue;
1046 12           edgeidnext = d0;
1047 12           break;
1048             }} /* Close d0=edgehighest:0:-1 */
1049 12 50         if (edgeidnext == -1)
1050 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
1051 12 100         if (edgeidnext != edgehighest)
1052 12 100         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
1053 8           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
1054             }} /* Close d0=edgeidnext:edgehighest */
1055 12           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
1056             }
1057 30           idthis = idnext;
1058             }
1059 16 50         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
1060 16           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
1061 16 50         if (idthis == -1) break;
1062             }
1063 5 50         }PDL_BROADCASTLOOP_END_path_join_readdata
    50          
1064 5           } break;
1065 0           case PDL_LD: {
1066 0 0         PDL_DECLARE_PARAMS_path_join_1(PDL_LDouble,E,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Indx,N,PDL_Byte,B,PDL_Indx,N)
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
1067 0 0         PDL_BROADCASTLOOP_START_path_join_readdata {{/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) { (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] = -1; (hasinward_datap)[0+(__inc_hasinward_d*(d))] = 0; }} /* Close d */
    0          
    0          
    0          
    0          
    0          
    0          
    0          
1068 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) { (pathendindex_datap)[0+(__inc_pathendindex_n*(n))] = -1; }} /* Close n */
1069 0 0         {/* Open nout */ PDL_EXPAND2(register PDL_Indx nout=0, __nout_stop=(__nout_size)); for(; nout<__nout_stop; nout+=1) { (paths_datap)[0+(__inc_paths_nout*(nout))] = -1; }} /* Close nout */
1070             #define PDL_ADJ_ADD(idfrom,idto) \
1071             do { \
1072             if (idfrom >= __privtrans->ind_sizes[0] || idfrom < 0) \
1073             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "from index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idfrom); \
1074             if (idto >= __privtrans->ind_sizes[0] || idto < 0) \
1075             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "to index %"IND_FLAG"=%"IND_FLAG" out of bounds",n,idto); \
1076             PDL_Indx setind = ++(highestoutedge_datap)[0+(__inc_highestoutedge_d*(idfrom))]; \
1077             if (setind >= __privtrans->ind_sizes[0]) \
1078             return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "setind=%"IND_FLAG" exceeded d=%"IND_FLAG,setind,__privtrans->ind_sizes[0]); \
1079             (outedges_datap)[0+(__inc_outedges_d0*(setind))+(__inc_outedges_d1*(idfrom))] = idto; \
1080             (hasinward_datap)[0+(__inc_hasinward_d*(idto))] = 1; \
1081             } while (0)
1082 0 0         {/* Open n */ PDL_EXPAND2(register PDL_Indx n=0, __n_stop=(__n_size)); for(; n<__n_stop; n+=1) {
1083 0           PDL_Indx from = (e_datap)[0+(__inc_e_v*(0))+(__inc_e_n*(n))], to = (e_datap)[0+(__inc_e_v*(1))+(__inc_e_n*(n))];
1084 0 0         PDL_ADJ_ADD(from,to);
    0          
    0          
    0          
    0          
1085 0 0         if (!__params->directed) PDL_ADJ_ADD(to,from);
    0          
    0          
    0          
    0          
    0          
1086             }} /* Close n */
1087             #undef PDL_ADJ_ADD
1088 0           PDL_Indx highest_no_inward = -1;
1089 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
1090 0 0         if ((hasinward_datap)[0+(__inc_hasinward_d*(d))] || (highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
    0          
1091 0           (sourceids_datap)[0+(__inc_sourceids_d*(++highest_no_inward))] = d;
1092             }} /* Close d */
1093 0           PDL_Indx pind = 0, pcount = 0;
1094 0           while (1) {
1095 0           PDL_Indx idthis = -1, idnext = -1;
1096 0 0         if (highest_no_inward >= 0) {
1097 0           idthis = (sourceids_datap)[0+(__inc_sourceids_d*(highest_no_inward))];
1098 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] == 0) highest_no_inward--;
1099             }
1100 0 0         if (idthis == -1)
1101 0 0         {/* Open d */ PDL_EXPAND2(register PDL_Indx d=0, __d_stop=(__d_size)); for(; d<__d_stop; d+=1) {
1102 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(d))] == -1) continue;
1103 0           idthis = d; break;
1104             }} /* Close d */
1105 0 0         if (idthis == -1) break;
1106 0           while (1) {
1107 0 0         if (idthis == -1) break;
1108 0 0         if (pind >= __privtrans->ind_sizes[2]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pind exceeded nout");
1109 0           (paths_datap)[0+(__inc_paths_nout*(pind++))] = idthis;
1110 0           PDL_Indx edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))], edgeidnext = -1;
1111 0 0         if (edgehighest < 0) break;
1112 0           idnext = -1;
1113 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) { /* look for non-sink */
1114 0           PDL_Indx maybe_next = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))];
1115 0 0         if ((highestoutedge_datap)[0+(__inc_highestoutedge_d*(maybe_next))] <= 0) continue;
1116 0           edgeidnext = d0;
1117             }} /* Close d0=edgehighest:0:-1 */
1118 0 0         if (edgeidnext == -1) edgeidnext = edgehighest;
1119 0           idnext = (outedges_datap)[0+(__inc_outedges_d0*(edgeidnext))+(__inc_outedges_d1*(idthis))];
1120 0 0         if (edgeidnext != edgehighest)
1121 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
1122 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idthis))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idthis))];
1123             }} /* Close d0=edgeidnext:edgehighest */
1124 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idthis))] = edgehighest - 1;
1125 0 0         if (!__params->directed) { /* remove the edge in the other direction */
1126 0           edgehighest = (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))];
1127 0           edgeidnext = -1;
1128 0 0         {/* Open d0=edgehighest:0:-1 */ PDL_EXPAND2(register PDL_Indx d0=PDLMIN(edgehighest, (__d_size-1)), __d0_stop=0); for(; d0>=__d0_stop; d0+=-1) {
1129 0           PDL_Indx maybe_other = (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))];
1130 0 0         if (maybe_other != idthis) continue;
1131 0           edgeidnext = d0;
1132 0           break;
1133             }} /* Close d0=edgehighest:0:-1 */
1134 0 0         if (edgeidnext == -1)
1135 0           return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "no other edge %"IND_FLAG"-%"IND_FLAG,idthis,idnext);
1136 0 0         if (edgeidnext != edgehighest)
1137 0 0         {/* Open d0=edgeidnext:edgehighest */ PDL_EXPAND2(register PDL_Indx d0=PDLMAX((edgeidnext),0), __d0_stop=PDLMIN(edgehighest, (__d_size))); for(; d0<__d0_stop; d0+=1) {
1138 0           (outedges_datap)[0+(__inc_outedges_d0*(d0))+(__inc_outedges_d1*(idnext))] = (outedges_datap)[0+(__inc_outedges_d0*(d0+1))+(__inc_outedges_d1*(idnext))];
1139             }} /* Close d0=edgeidnext:edgehighest */
1140 0           (highestoutedge_datap)[0+(__inc_highestoutedge_d*(idnext))] = edgehighest - 1;
1141             }
1142 0           idthis = idnext;
1143             }
1144 0 0         if (pcount >= __privtrans->ind_sizes[1]) return PDL->make_error(PDL_EUSERERROR, "Error in path_join:" "pcount exceeded n");
1145 0           (pathendindex_datap)[0+(__inc_pathendindex_n*(pcount++))] = pind - 1;
1146 0 0         if (idthis == -1) break;
1147             }
1148 0 0         }PDL_BROADCASTLOOP_END_path_join_readdata
    0          
1149 0           } break;
1150 0           default: return PDL->make_error(PDL_EUSERERROR, "PP INTERNAL ERROR in path_join: unhandled datatype(%d), only handles (ABSULKNPQFDE)! PLEASE MAKE A BUG REPORT\n", __privtrans->__datatype);
1151             }
1152             #undef PDL_IF_BAD
1153 5           return PDL_err;
1154             }
1155              
1156             static pdl_datatypes pdl_path_join_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, -1 };
1157             static PDL_Indx pdl_path_join_vtable_realdims[] = { 2, 1, 1, 1, 2, 1, 1 };
1158             static char *pdl_path_join_vtable_parnames[] = { "e","pathendindex","paths","highestoutedge","outedges","hasinward","sourceids" };
1159             static short pdl_path_join_vtable_parflags[] = {
1160             0,
1161             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
1162             PDL_PARAM_ISCREAT|PDL_PARAM_ISOUT|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
1163             PDL_PARAM_ISCREAT|PDL_PARAM_ISTEMP|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
1164             PDL_PARAM_ISCREAT|PDL_PARAM_ISTEMP|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
1165             PDL_PARAM_ISCREAT|PDL_PARAM_ISTEMP|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE,
1166             PDL_PARAM_ISCREAT|PDL_PARAM_ISTEMP|PDL_PARAM_ISTYPED|PDL_PARAM_ISWRITE
1167             };
1168             static pdl_datatypes pdl_path_join_vtable_partypes[] = { -1, PDL_IND, PDL_IND, PDL_IND, PDL_IND, PDL_B, PDL_IND };
1169             static PDL_Indx pdl_path_join_vtable_realdims_starts[] = { 0, 2, 3, 4, 5, 7, 8 };
1170             static PDL_Indx pdl_path_join_vtable_realdims_ind_ids[] = { 3, 1, 1, 2, 0, 0, 0, 0, 0 };
1171             static char *pdl_path_join_vtable_indnames[] = { "d","n","nout","v" };
1172             pdl_transvtable pdl_path_join_vtable = {
1173             PDL_TRANS_DO_BROADCAST, 0, pdl_path_join_vtable_gentypes, 1, 7, NULL /*CORE21*/,
1174             pdl_path_join_vtable_realdims, pdl_path_join_vtable_parnames,
1175             pdl_path_join_vtable_parflags, pdl_path_join_vtable_partypes,
1176             pdl_path_join_vtable_realdims_starts, pdl_path_join_vtable_realdims_ind_ids, 9,
1177             4, pdl_path_join_vtable_indnames,
1178             pdl_path_join_redodims, pdl_path_join_readdata, NULL,
1179             NULL,
1180             sizeof(pdl_params_path_join),"PDL::ImageND::path_join"
1181             };
1182              
1183              
1184 5           pdl_error pdl_run_path_join(pdl *e,pdl *pathendindex,pdl *paths,PDL_Indx d,int directed) {
1185 5           pdl_error PDL_err = {0, NULL, 0};
1186 5 50         if (!PDL) return (pdl_error){PDL_EFATAL, "PDL core struct is NULL, can't continue",0};
1187 5           pdl_trans *__privtrans = PDL->create_trans(&pdl_path_join_vtable);
1188 5 50         if (!__privtrans) return PDL->make_error_simple(PDL_EFATAL, "Couldn't create trans");
1189 5           pdl_params_path_join *__params = __privtrans->params;
1190 5           __privtrans->pdls[0] = e;
1191 5           __privtrans->pdls[1] = pathendindex;
1192 5           __privtrans->pdls[2] = paths;
1193 5 50         PDL_RETERROR(PDL_err, PDL->type_coerce(__privtrans));
1194 5           (__params->d) = (d); /* CType.get_copy */
1195 5           (__params->directed) = (directed); /* CType.get_copy */
1196 5 50         PDL_RETERROR(PDL_err, PDL->make_trans_mutual(__privtrans));
1197 5           return PDL_err;
1198             }