File Coverage

Cluster.xs
Criterion Covered Total %
statement 2101 24240 8.6
branch 1050 20112 5.2
condition n/a
subroutine n/a
pod n/a
total 3151 44352 7.1


line stmt bran cond sub pod time code
1              
2             /*
3             * THIS FILE WAS GENERATED BY PDL::PP! Do not modify!
4             */
5              
6             #define PDL_COMMENT(comment)
7             PDL_COMMENT("This preprocessor symbol is used to add commentary in the PDL ")
8             PDL_COMMENT("autogenerated code. Normally, one would use typical C-style ")
9             PDL_COMMENT("multiline comments (i.e. /* comment */). However, because such ")
10             PDL_COMMENT("comments do not nest, it's not possible for PDL::PP users to ")
11             PDL_COMMENT("comment-out sections of code using multiline comments, as is ")
12             PDL_COMMENT("often the practice when debugging, for example. So, when you ")
13             PDL_COMMENT("see something like this: ")
14             PDL_COMMENT(" ")
15             PDL_COMMENT("Memory access")
16             PDL_COMMENT(" ")
17             PDL_COMMENT("just think of it as a C multiline comment like: ")
18             PDL_COMMENT(" ")
19             PDL_COMMENT(" /* Memory access */ ")
20              
21             #include "EXTERN.h"
22             #include "perl.h"
23             #include "XSUB.h"
24             #include "pdl.h"
25             #include "pdlcore.h"
26             static Core* PDL; PDL_COMMENT("Structure hold core C functions")
27             static int __pdl_debugging = 0;
28             static int __pdl_boundscheck = 0;
29             static SV* CoreSV; PDL_COMMENT("Gets pointer to perl var holding core structure")
30              
31             #if ! 1
32             # define PP_INDTERM(max, at) at
33             #else
34             # define PP_INDTERM(max, at) (__pdl_boundscheck? PDL->safe_indterm(max,at, __FILE__, __LINE__) : at)
35             #endif
36              
37             #include "cluster.h"
38              
39             //#define CDEBUG 1
40             //#undef CDEBUG
41              
42 0           void print_pp_dbl(int nrows, int ncols, double **pp) {
43             int i,j;
44 0 0         for (i=0; i
45 0           printf(" %d:[ ", i);
46 0 0         for (j=0; j
47 0           printf("%d=%lf ", j, pp[i][j]);
48             }
49 0           printf("]\n");
50             }
51 0           }
52             static
53 57           void **pp_alloc(int nrows)
54             {
55 57           return ((void **)malloc(nrows*sizeof(void**)));
56             }
57             static
58 25           double **p2pp_dbl(int nrows, int ncols, double *p, double **matrix)
59             {
60             int i;
61 25 50         if (!(p && nrows && ncols)) return NULL;
    50          
    50          
62 25 50         if (!matrix) matrix = (double **)pp_alloc(nrows);
63 215 100         for (i=0; i < nrows; i++) {
64 190           matrix[i] = p + (i*ncols);
65             #ifdef CDEBUG
66             printf("p2pp_dbl(nr=%d,nc=%d,p=%p) : (p+%d*%d)=%p\n", nrows,ncols,p, i,ncols,matrix[i]);
67             #endif
68             }
69 25           return matrix;
70             }
71 30           int **p2pp_int(int nrows, int ncols, int *p, int **matrix)
72             {
73             int i;
74 30 50         if (!(p && nrows && ncols)) return NULL;
    50          
    50          
75 30 50         if (!matrix) matrix = (int **)pp_alloc(nrows);
76 230 100         for (i=0; i < nrows; i++) {
77 200           matrix[i] = p + (i*ncols);
78             }
79 30           return matrix;
80             }
81             static
82 2           double **p2pp_dbl_ragged(int nrows, int ncols, double *p, double **matrix)
83             {
84             int i;
85 2 50         if (!(p && nrows && ncols)) return NULL;
    50          
    50          
86 2 50         if (!matrix) matrix = (double **)pp_alloc(nrows);
87 26 100         for (i=0; i < nrows; i++) {
88 24           matrix[i] = p + (i*ncols);
89             }
90 2           return matrix;
91             }
92             static
93 1           void pp2pdl_ragged_dbl(int nrows, int ncols, double **pp, double *p)
94             {
95             int i,j;
96 1 50         if (!(pp && nrows && ncols)) return;
    50          
    50          
97 5 100         for (i=0; i
98 10 100         for (j=0; j
99 6           p[i*ncols+j] = pp[i][j];
100 6           p[j*ncols+i] = pp[i][j];
101             }
102 4           p[i*ncols+i] = 0;
103             }
104             }
105             static
106 0           void pp2pdl_dbl(int nrows, int ncols, double **pp, double *p)
107             {
108             int i,j;
109 0 0         if (!(pp && nrows && ncols)) return;
    0          
    0          
110 0 0         for (i=0; i
111 0 0         for (j=0; j
112 0           p[i*ncols+j] = pp[i][j];
113             }
114             }
115             }
116             static
117 0           Node* p2node(int nnodes, int* tree, double *lnkdist)
118             {
119             int i;
120 0           Node *nod = NULL;
121 0 0         if (!(nnodes && (tree || lnkdist))) return NULL;
    0          
    0          
122 0           nod = (Node*)malloc(nnodes*sizeof(Node));
123 0 0         for (i=0; i < nnodes; ++i) {
124 0 0         nod[i].left = tree ? tree[i*2+0] : 0;
125 0 0         nod[i].right = tree ? tree[i*2+1] : 0;
126 0 0         nod[i].distance = lnkdist ? lnkdist[i] : 0;
127             }
128 0           return nod;
129             }
130              
131 8           void node2p(int nnodes, Node* nod, int* tree, double *lnkdist)
132             {
133             int i;
134 8 50         if (!(nnodes && nod && (tree || lnkdist))) return;
    50          
    50          
    0          
135 68 100         for (i=0; i < nnodes; ++i) {
136 60 50         if (tree) {
137 60           tree[i*2+0] = nod[i].left;
138 60           tree[i*2+1] = nod[i].right;
139             }
140 60 50         if (lnkdist) {
141 60           lnkdist[i] = nod[i].distance;
142             }
143             }
144 8           return;
145             }
146              
147             typedef struct pdl_cmean_struct {
148             PDL_TRANS_START(2);
149             pdl_thread __pdlthread;PDL_Indx __inc_a_n;PDL_Indx __n_size;
150            
151             char __ddone; PDL_COMMENT("Dims done")
152             } pdl_cmean_struct;
153              
154 2           void pdl_cmean_redodims(pdl_trans *__tr ) {
155             int __dim;
156 2           pdl_cmean_struct *__privtrans = (pdl_cmean_struct *) __tr;
157            
158             {
159             PDL_Indx __creating[2];
160 2           __privtrans->__n_size = -1;
161 2           __creating[0] = 0;
162 2 50         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    50          
163             {
164             {PDL_COMMENT("Start generic loop")
165              
166 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
167 0           } break; case PDL_D: {
168 2 50         PDL_Double * a_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
169 2           PDL_Double * a_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
170              
171 2 50         PDL_Double * b_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
172 2           PDL_Double * b_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
173              
174 2           {register PDL_Indx __inc_a_n = __privtrans->__inc_a_n;
175              
176             PDL_COMMENT("none")
177 2           } break;}
178 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
179             }
180             }
181             {
182             static char *__parnames[] = {"a","b"};
183             static PDL_Indx __realdims[] = {1,0};
184             static char __funcname[] = "PDL::Cluster::cmean";
185             static pdl_errorinfo __einfo = {
186             __funcname, __parnames, 2
187             };
188            
189 2           PDL->initthreadstruct(2,__privtrans->pdls,
190             __realdims,__creating,2,
191             &__einfo,&(__privtrans->__pdlthread),
192 2           __privtrans->vtable->per_pdl_flags,
193             0 );
194             }
195 2 50         if(((__privtrans->pdls[0]))->ndims < 1) {
196 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
197             }
198 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
199 2           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
200 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
201 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
202 0           PDL->pdl_barf("Error in cmean:" "Wrong dims\n");
203             }
204             }
205 2           PDL->make_physical(((__privtrans->pdls[0])));
206 2 50         if(!__creating[1]) {
207             } else {
208             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
209 2           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
210             }
211             { PDL_COMMENT("convenience block")
212 2           void *hdrp = NULL;
213 2           char propagate_hdrcpy = 0;
214 2           SV *hdr_copy = NULL;
215 2 50         if(!hdrp &&
    50          
216 0 0         __privtrans->pdls[0]->hdrsv &&
217 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
218             ) {
219 0           hdrp = __privtrans->pdls[0]->hdrsv;
220 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
221             }
222 2 50         if(!hdrp &&
    50          
223 0 0         !__creating[1] &&
224 0 0         __privtrans->pdls[1]->hdrsv &&
225 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
226             ) {
227 0           hdrp = __privtrans->pdls[1]->hdrsv;
228 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
229             }
230 2 50         if (hdrp) {
231 0 0         if(hdrp == &PL_sv_undef)
232 0           hdr_copy = &PL_sv_undef;
233             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
234             int count;
235             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
236 0           dSP;
237 0           ENTER ;
238 0           SAVETMPS ;
239 0 0         PUSHMARK(SP) ;
240 0 0         XPUSHs( hdrp );
241 0           PUTBACK ;
242 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
243 0           SPAGAIN ;
244 0 0         if(count != 1)
245 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
246              
247 0           hdr_copy = (SV *)POPs;
248              
249 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
250 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
251             }
252              
253 0 0         FREETMPS ;
254 0           LEAVE ;
255              
256              
257             } PDL_COMMENT("end of callback block")
258              
259 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
260 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
261 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
262 0 0         if( hdr_copy != &PL_sv_undef )
263 0           (void)SvREFCNT_inc(hdr_copy);
264 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
265             }
266 0 0         if(propagate_hdrcpy)
267 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
268              
269 0 0         if(hdr_copy != &PL_sv_undef)
270 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
271             } PDL_COMMENT("end of if(hdrp) block")
272             } PDL_COMMENT("end of conv. block")
273 2 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
274 0           __privtrans->__inc_a_n = 0; else
275 2           __privtrans->__inc_a_n = __privtrans->pdls[0]->dimincs[0]; __privtrans->__ddone = 1;
276             }
277 2           }
278            
279              
280 0           pdl_trans * pdl_cmean_copy(pdl_trans *__tr ) {
281             int __dim;
282 0           pdl_cmean_struct *__privtrans = (pdl_cmean_struct *) __tr;
283            
284             {
285 0           pdl_cmean_struct *__copy = malloc(sizeof(pdl_cmean_struct));
286 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
287 0           __copy->has_badvalue = __privtrans->has_badvalue;
288 0           __copy->badvalue = __privtrans->badvalue;
289 0           __copy->flags = __privtrans->flags;
290 0           __copy->vtable = __privtrans->vtable;
291 0           __copy->__datatype = __privtrans->__datatype;
292 0           __copy->freeproc = NULL;
293 0           __copy->__ddone = __privtrans->__ddone;
294             {int i;
295 0 0         for(i=0; i<__copy->vtable->npdls; i++)
296 0           __copy->pdls[i] = __privtrans->pdls[i];
297             }
298            
299 0 0         if(__copy->__ddone) {
300 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_a_n=__copy->__inc_a_n;__copy->__n_size=__privtrans->__n_size;
301             }
302 0           return (pdl_trans*)__copy;
303             }
304             }
305            
306              
307 2           void pdl_cmean_readdata(pdl_trans *__tr ) {
308             int __dim;
309 2           pdl_cmean_struct *__privtrans = (pdl_cmean_struct *) __tr;
310            
311             {
312             {PDL_COMMENT("Start generic loop")
313              
314 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
315 0           } break; case PDL_D: {
316 2 50         PDL_Double * a_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
317 2           PDL_Double * a_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
318              
319 2 50         PDL_Double * b_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
320 2           PDL_Double * b_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
321              
322              
323             PDL_COMMENT("THREADLOOPBEGIN")
324 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
325 2           do { register PDL_Indx __tind1=0,__tind2=0;
326 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
327 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
328 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
329 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
330 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
331 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
332 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
333 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
334 2           a_datap += __offsp[0];
335 2           b_datap += __offsp[1];
336 4 100         for( __tind2 = 0 ;
337             __tind2 < __tdims1 ;
338 2           __tind2++
339 2           ,a_datap += __tinc1_0 - __tinc0_0 * __tdims0
340 2           ,b_datap += __tinc1_1 - __tinc0_1 * __tdims0
341             )
342             {
343 4 100         for( __tind1 = 0 ;
344             __tind1 < __tdims0 ;
345 2           __tind1++
346 2           ,a_datap += __tinc0_0
347 2           ,b_datap += __tinc0_1
348             )
349 2           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_a_n = __privtrans->__inc_a_n;
350              
351 2           (b_datap)[0] PDL_COMMENT("ACCESS()") = mean(__privtrans->__n_size, a_datap);
352             }
353             PDL_COMMENT("THREADLOOPEND")
354             }
355             }
356 2           a_datap -= __tinc1_0 * __tdims1 + __offsp[0];
357 2           b_datap -= __tinc1_1 * __tdims1 + __offsp[1];
358 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
359 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
360             }
361             }
362             }
363            
364              
365              
366              
367 2           void pdl_cmean_free(pdl_trans *__tr ) {
368             int __dim;
369 2           pdl_cmean_struct *__privtrans = (pdl_cmean_struct *) __tr;
370            
371             {
372            
373 2           PDL_TR_CLRMAGIC(__privtrans);
374            
375 2 50         if(__privtrans->__ddone) {
376 2           PDL->freethreadloop(&(__privtrans->__pdlthread));
377             ;;;
378             }
379            
380             }
381 2           }
382            
383              
384              
385              
386             static char pdl_cmean_vtable_flags[] =
387             { 0,PDL_TPDL_VAFFINE_OK};
388             pdl_transvtable pdl_cmean_vtable = {
389             0,0, 1, 2, pdl_cmean_vtable_flags,
390             pdl_cmean_redodims, pdl_cmean_readdata, NULL,
391             pdl_cmean_free,NULL,NULL,pdl_cmean_copy,
392             sizeof(pdl_cmean_struct),"pdl_cmean_vtable"
393             };
394              
395             typedef struct pdl_cmedian_struct {
396             PDL_TRANS_START(2);
397             pdl_thread __pdlthread;PDL_Indx __inc_a_n;PDL_Indx __n_size;
398            
399             char __ddone; PDL_COMMENT("Dims done")
400             } pdl_cmedian_struct;
401              
402 2           void pdl_cmedian_redodims(pdl_trans *__tr ) {
403             int __dim;
404 2           pdl_cmedian_struct *__privtrans = (pdl_cmedian_struct *) __tr;
405            
406             {
407             PDL_Indx __creating[2];
408 2           __privtrans->__n_size = -1;
409 2           __creating[0] = 0;
410 2 50         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    50          
411             {
412             {PDL_COMMENT("Start generic loop")
413              
414 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
415 0           } break; case PDL_D: {
416 2 50         PDL_Double * a_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
417 2           PDL_Double * a_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
418              
419 2 50         PDL_Double * b_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
420 2           PDL_Double * b_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
421              
422 2           {register PDL_Indx __inc_a_n = __privtrans->__inc_a_n;
423              
424             PDL_COMMENT("none")
425 2           } break;}
426 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
427             }
428             }
429             {
430             static char *__parnames[] = {"a","b"};
431             static PDL_Indx __realdims[] = {1,0};
432             static char __funcname[] = "PDL::Cluster::cmedian";
433             static pdl_errorinfo __einfo = {
434             __funcname, __parnames, 2
435             };
436            
437 2           PDL->initthreadstruct(2,__privtrans->pdls,
438             __realdims,__creating,2,
439             &__einfo,&(__privtrans->__pdlthread),
440 2           __privtrans->vtable->per_pdl_flags,
441             0 );
442             }
443 2 50         if(((__privtrans->pdls[0]))->ndims < 1) {
444 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
445             }
446 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
447 2           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
448 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
449 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
450 0           PDL->pdl_barf("Error in cmedian:" "Wrong dims\n");
451             }
452             }
453 2           PDL->make_physical(((__privtrans->pdls[0])));
454 2 50         if(!__creating[1]) {
455             } else {
456             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
457 2           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
458             }
459             { PDL_COMMENT("convenience block")
460 2           void *hdrp = NULL;
461 2           char propagate_hdrcpy = 0;
462 2           SV *hdr_copy = NULL;
463 2 50         if(!hdrp &&
    50          
464 0 0         __privtrans->pdls[0]->hdrsv &&
465 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
466             ) {
467 0           hdrp = __privtrans->pdls[0]->hdrsv;
468 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
469             }
470 2 50         if(!hdrp &&
    50          
471 0 0         !__creating[1] &&
472 0 0         __privtrans->pdls[1]->hdrsv &&
473 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
474             ) {
475 0           hdrp = __privtrans->pdls[1]->hdrsv;
476 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
477             }
478 2 50         if (hdrp) {
479 0 0         if(hdrp == &PL_sv_undef)
480 0           hdr_copy = &PL_sv_undef;
481             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
482             int count;
483             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
484 0           dSP;
485 0           ENTER ;
486 0           SAVETMPS ;
487 0 0         PUSHMARK(SP) ;
488 0 0         XPUSHs( hdrp );
489 0           PUTBACK ;
490 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
491 0           SPAGAIN ;
492 0 0         if(count != 1)
493 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
494              
495 0           hdr_copy = (SV *)POPs;
496              
497 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
498 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
499             }
500              
501 0 0         FREETMPS ;
502 0           LEAVE ;
503              
504              
505             } PDL_COMMENT("end of callback block")
506              
507 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
508 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
509 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
510 0 0         if( hdr_copy != &PL_sv_undef )
511 0           (void)SvREFCNT_inc(hdr_copy);
512 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
513             }
514 0 0         if(propagate_hdrcpy)
515 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
516              
517 0 0         if(hdr_copy != &PL_sv_undef)
518 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
519             } PDL_COMMENT("end of if(hdrp) block")
520             } PDL_COMMENT("end of conv. block")
521 2 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
522 0           __privtrans->__inc_a_n = 0; else
523 2           __privtrans->__inc_a_n = __privtrans->pdls[0]->dimincs[0]; __privtrans->__ddone = 1;
524             }
525 2           }
526            
527              
528 0           pdl_trans * pdl_cmedian_copy(pdl_trans *__tr ) {
529             int __dim;
530 0           pdl_cmedian_struct *__privtrans = (pdl_cmedian_struct *) __tr;
531            
532             {
533 0           pdl_cmedian_struct *__copy = malloc(sizeof(pdl_cmedian_struct));
534 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
535 0           __copy->has_badvalue = __privtrans->has_badvalue;
536 0           __copy->badvalue = __privtrans->badvalue;
537 0           __copy->flags = __privtrans->flags;
538 0           __copy->vtable = __privtrans->vtable;
539 0           __copy->__datatype = __privtrans->__datatype;
540 0           __copy->freeproc = NULL;
541 0           __copy->__ddone = __privtrans->__ddone;
542             {int i;
543 0 0         for(i=0; i<__copy->vtable->npdls; i++)
544 0           __copy->pdls[i] = __privtrans->pdls[i];
545             }
546            
547 0 0         if(__copy->__ddone) {
548 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_a_n=__copy->__inc_a_n;__copy->__n_size=__privtrans->__n_size;
549             }
550 0           return (pdl_trans*)__copy;
551             }
552             }
553            
554              
555 2           void pdl_cmedian_readdata(pdl_trans *__tr ) {
556             int __dim;
557 2           pdl_cmedian_struct *__privtrans = (pdl_cmedian_struct *) __tr;
558            
559             {
560             {PDL_COMMENT("Start generic loop")
561              
562 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
563 0           } break; case PDL_D: {
564 2 50         PDL_Double * a_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
565 2           PDL_Double * a_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
566              
567 2 50         PDL_Double * b_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
568 2           PDL_Double * b_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
569              
570              
571             PDL_COMMENT("THREADLOOPBEGIN")
572 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
573 2           do { register PDL_Indx __tind1=0,__tind2=0;
574 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
575 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
576 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
577 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
578 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
579 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
580 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
581 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
582 2           a_datap += __offsp[0];
583 2           b_datap += __offsp[1];
584 4 100         for( __tind2 = 0 ;
585             __tind2 < __tdims1 ;
586 2           __tind2++
587 2           ,a_datap += __tinc1_0 - __tinc0_0 * __tdims0
588 2           ,b_datap += __tinc1_1 - __tinc0_1 * __tdims0
589             )
590             {
591 4 100         for( __tind1 = 0 ;
592             __tind1 < __tdims0 ;
593 2           __tind1++
594 2           ,a_datap += __tinc0_0
595 2           ,b_datap += __tinc0_1
596             )
597 2           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_a_n = __privtrans->__inc_a_n;
598              
599 2           (b_datap)[0] PDL_COMMENT("ACCESS()") = median(__privtrans->__n_size, a_datap);
600             }
601             PDL_COMMENT("THREADLOOPEND")
602             }
603             }
604 2           a_datap -= __tinc1_0 * __tdims1 + __offsp[0];
605 2           b_datap -= __tinc1_1 * __tdims1 + __offsp[1];
606 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
607 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
608             }
609             }
610             }
611            
612              
613              
614              
615 2           void pdl_cmedian_free(pdl_trans *__tr ) {
616             int __dim;
617 2           pdl_cmedian_struct *__privtrans = (pdl_cmedian_struct *) __tr;
618            
619             {
620            
621 2           PDL_TR_CLRMAGIC(__privtrans);
622            
623 2 50         if(__privtrans->__ddone) {
624 2           PDL->freethreadloop(&(__privtrans->__pdlthread));
625             ;;;
626             }
627            
628             }
629 2           }
630            
631              
632              
633              
634             static char pdl_cmedian_vtable_flags[] =
635             { 0,PDL_TPDL_VAFFINE_OK};
636             pdl_transvtable pdl_cmedian_vtable = {
637             0,0, 1, 2, pdl_cmedian_vtable_flags,
638             pdl_cmedian_redodims, pdl_cmedian_readdata, NULL,
639             pdl_cmedian_free,NULL,NULL,pdl_cmedian_copy,
640             sizeof(pdl_cmedian_struct),"pdl_cmedian_vtable"
641             };
642              
643             typedef struct pdl_calculate_weights_struct {
644             PDL_TRANS_START(6);
645             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_oweights_d;PDL_Indx __n_size;PDL_Indx __d_size;
646             char *distFlag;
647             char __ddone; PDL_COMMENT("Dims done")
648             } pdl_calculate_weights_struct;
649              
650 0           void pdl_calculate_weights_redodims(pdl_trans *__tr ) {
651             int __dim;
652 0           pdl_calculate_weights_struct *__privtrans = (pdl_calculate_weights_struct *) __tr;
653            
654             {
655             PDL_Indx __creating[6];
656 0           __privtrans->__n_size = -1;
657 0           __privtrans->__d_size = -1;
658 0           __creating[0] = 0;
659 0           __creating[1] = 0;
660 0           __creating[2] = 0;
661 0           __creating[3] = 0;
662 0           __creating[4] = 0;
663 0 0         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    0          
664             {
665             {PDL_COMMENT("Start generic loop")
666              
667 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
668 0           } break; case PDL_B: {
669 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
670 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
671              
672 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
673 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
674              
675 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
676 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
677              
678 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
679 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
680              
681 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
682 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
683              
684 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
685 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
686              
687 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
688 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
689 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
690 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
691 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
692 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
693              
694             PDL_COMMENT("none")
695 0           } } break; case PDL_S: {
696 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
697 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
698              
699 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
700 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
701              
702 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
703 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
704              
705 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
706 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
707              
708 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
709 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
710              
711 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
712 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
713              
714 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
715 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
716 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
717 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
718 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
719 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
720              
721             PDL_COMMENT("none")
722 0           } } break; case PDL_US: {
723 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
724 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
725              
726 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
727 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
728              
729 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
730 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
731              
732 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
733 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
734              
735 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
736 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
737              
738 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
739 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
740              
741 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
742 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
743 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
744 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
745 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
746 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
747              
748             PDL_COMMENT("none")
749 0           } } break; case PDL_L: {
750 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
751 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
752              
753 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
754 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
755              
756 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
757 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
758              
759 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
760 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
761              
762 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
763 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
764              
765 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
766 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
767              
768 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
769 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
770 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
771 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
772 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
773 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
774              
775             PDL_COMMENT("none")
776 0           } } break; case PDL_IND: {
777 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
778 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
779              
780 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
781 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
782              
783 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
784 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
785              
786 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
787 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
788              
789 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
790 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
791              
792 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
793 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
794              
795 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
796 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
797 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
798 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
799 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
800 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
801              
802             PDL_COMMENT("none")
803 0           } } break; case PDL_LL: {
804 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
805 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
806              
807 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
808 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
809              
810 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
811 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
812              
813 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
814 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
815              
816 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
817 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
818              
819 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
820 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
821              
822 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
823 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
824 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
825 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
826 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
827 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
828              
829             PDL_COMMENT("none")
830 0           } } break; case PDL_F: {
831 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
832 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
833              
834 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
835 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
836              
837 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
838 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
839              
840 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
841 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
842              
843 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
844 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
845              
846 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
847 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
848              
849 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
850 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
851 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
852 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
853 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
854 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
855              
856             PDL_COMMENT("none")
857 0           } } break; case PDL_D: {
858 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
859 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
860              
861 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
862 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
863              
864 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
865 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
866              
867 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
868 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
869              
870 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
871 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
872              
873 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
874 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
875              
876 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
877 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
878 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
879 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
880 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
881 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
882              
883             PDL_COMMENT("none")
884 0           } break;}
885 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
886             }
887             }
888             {
889             static char *__parnames[] = {"data","mask","weight","cutoff","exponent","oweights"};
890             static PDL_Indx __realdims[] = {2,2,1,0,0,1};
891             static char __funcname[] = "PDL::Cluster::calculate_weights";
892             static pdl_errorinfo __einfo = {
893             __funcname, __parnames, 6
894             };
895            
896 0           PDL->initthreadstruct(2,__privtrans->pdls,
897             __realdims,__creating,6,
898             &__einfo,&(__privtrans->__pdlthread),
899 0           __privtrans->vtable->per_pdl_flags,
900             0 );
901             }
902 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
903 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
904 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
905             }
906 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
907 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
908 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
909 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
910 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
911             }
912             }
913 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
914 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
915 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
916 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
917 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
918             }
919             }
920 0           PDL->make_physical(((__privtrans->pdls[0])));
921 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
922 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
923 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
924             }
925 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
926 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
927 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
928 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
929 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
930             }
931             }
932 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
933 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
934 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
935 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
936 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
937             }
938             }
939 0           PDL->make_physical(((__privtrans->pdls[1])));
940 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
941 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
942             }
943 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
944 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
945 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
946 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
947 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
948             }
949             }
950 0           PDL->make_physical(((__privtrans->pdls[2])));
951 0 0         if(!__creating[5]) {
952 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
953 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
954             }
955 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
956 0           __privtrans->__d_size = ((__privtrans->pdls[5]))->dims[0];
957 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
958 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
959 0           PDL->pdl_barf("Error in calculate_weights:" "Wrong dims\n");
960             }
961             }
962             } else {
963 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;
964 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
965             }
966             { PDL_COMMENT("convenience block")
967 0           void *hdrp = NULL;
968 0           char propagate_hdrcpy = 0;
969 0           SV *hdr_copy = NULL;
970 0 0         if(!hdrp &&
    0          
971 0 0         __privtrans->pdls[0]->hdrsv &&
972 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
973             ) {
974 0           hdrp = __privtrans->pdls[0]->hdrsv;
975 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
976             }
977 0 0         if(!hdrp &&
    0          
978 0 0         __privtrans->pdls[1]->hdrsv &&
979 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
980             ) {
981 0           hdrp = __privtrans->pdls[1]->hdrsv;
982 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
983             }
984 0 0         if(!hdrp &&
    0          
985 0 0         __privtrans->pdls[2]->hdrsv &&
986 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
987             ) {
988 0           hdrp = __privtrans->pdls[2]->hdrsv;
989 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
990             }
991 0 0         if(!hdrp &&
    0          
992 0 0         __privtrans->pdls[3]->hdrsv &&
993 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
994             ) {
995 0           hdrp = __privtrans->pdls[3]->hdrsv;
996 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
997             }
998 0 0         if(!hdrp &&
    0          
999 0 0         __privtrans->pdls[4]->hdrsv &&
1000 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
1001             ) {
1002 0           hdrp = __privtrans->pdls[4]->hdrsv;
1003 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
1004             }
1005 0 0         if(!hdrp &&
    0          
1006 0 0         !__creating[5] &&
1007 0 0         __privtrans->pdls[5]->hdrsv &&
1008 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
1009             ) {
1010 0           hdrp = __privtrans->pdls[5]->hdrsv;
1011 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
1012             }
1013 0 0         if (hdrp) {
1014 0 0         if(hdrp == &PL_sv_undef)
1015 0           hdr_copy = &PL_sv_undef;
1016             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
1017             int count;
1018             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
1019 0           dSP;
1020 0           ENTER ;
1021 0           SAVETMPS ;
1022 0 0         PUSHMARK(SP) ;
1023 0 0         XPUSHs( hdrp );
1024 0           PUTBACK ;
1025 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
1026 0           SPAGAIN ;
1027 0 0         if(count != 1)
1028 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
1029              
1030 0           hdr_copy = (SV *)POPs;
1031              
1032 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
1033 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
1034             }
1035              
1036 0 0         FREETMPS ;
1037 0           LEAVE ;
1038              
1039              
1040             } PDL_COMMENT("end of callback block")
1041              
1042 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
1043 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
1044 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
1045 0 0         if( hdr_copy != &PL_sv_undef )
1046 0           (void)SvREFCNT_inc(hdr_copy);
1047 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
1048             }
1049 0 0         if(propagate_hdrcpy)
1050 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
1051              
1052 0 0         if(hdr_copy != &PL_sv_undef)
1053 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
1054             } PDL_COMMENT("end of if(hdrp) block")
1055             } PDL_COMMENT("end of conv. block")
1056 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
1057 0           __privtrans->__inc_data_d = 0; else
1058 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
1059 0           __privtrans->__inc_data_n = 0; else
1060 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
1061 0           __privtrans->__inc_mask_d = 0; else
1062 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
1063 0           __privtrans->__inc_mask_n = 0; else
1064 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
1065 0           __privtrans->__inc_weight_d = 0; else
1066 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
1067 0           __privtrans->__inc_oweights_d = 0; else
1068 0 0         __privtrans->__inc_oweights_d = PDL_REPRINC(__privtrans->pdls[5],0); __privtrans->__ddone = 1;
1069             }
1070 0           }
1071            
1072              
1073 0           pdl_trans * pdl_calculate_weights_copy(pdl_trans *__tr ) {
1074             int __dim;
1075 0           pdl_calculate_weights_struct *__privtrans = (pdl_calculate_weights_struct *) __tr;
1076            
1077             {
1078 0           pdl_calculate_weights_struct *__copy = malloc(sizeof(pdl_calculate_weights_struct));
1079 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
1080 0           __copy->has_badvalue = __privtrans->has_badvalue;
1081 0           __copy->badvalue = __privtrans->badvalue;
1082 0           __copy->flags = __privtrans->flags;
1083 0           __copy->vtable = __privtrans->vtable;
1084 0           __copy->__datatype = __privtrans->__datatype;
1085 0           __copy->freeproc = NULL;
1086 0           __copy->__ddone = __privtrans->__ddone;
1087             {int i;
1088 0 0         for(i=0; i<__copy->vtable->npdls; i++)
1089 0           __copy->pdls[i] = __privtrans->pdls[i];
1090             }
1091 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;
1092 0 0         if(__copy->__ddone) {
1093 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_oweights_d=__copy->__inc_oweights_d;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;
1094             }
1095 0           return (pdl_trans*)__copy;
1096             }
1097             }
1098            
1099              
1100 0           void pdl_calculate_weights_readdata(pdl_trans *__tr ) {
1101             int __dim;
1102 0           pdl_calculate_weights_struct *__privtrans = (pdl_calculate_weights_struct *) __tr;
1103            
1104             {
1105 0           {register PDL_Indx __d_size = __privtrans->__d_size;
1106             PDL_COMMENT("Start generic loop")
1107              
1108 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
1109 0           } break; case PDL_B: {
1110 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1111 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1112              
1113 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1114 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1115              
1116 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1117 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1118              
1119 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1120 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1121              
1122 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1123 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1124              
1125 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1126 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1127              
1128 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1129 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1130 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1131 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1132 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1133 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1134              
1135              
1136 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1137 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1138 0           int transpose=0;
1139             int i;
1140             double *owp;
1141            
1142             PDL_COMMENT("THREADLOOPBEGIN")
1143 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1144 0           do { register PDL_Indx __tind1=0,__tind2=0;
1145 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1146 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1147 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1148 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1149 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1150 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1151 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1152 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1153 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1154 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1155 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1156 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1157 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1158 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1159 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1160 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1161 0           data_datap += __offsp[0];
1162 0           mask_datap += __offsp[1];
1163 0           weight_datap += __offsp[2];
1164 0           cutoff_datap += __offsp[3];
1165 0           exponent_datap += __offsp[4];
1166 0           oweights_datap += __offsp[5];
1167 0 0         for( __tind2 = 0 ;
1168             __tind2 < __tdims1 ;
1169 0           __tind2++
1170 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1171 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1172 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1173 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1174 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1175 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1176             )
1177             {
1178 0 0         for( __tind1 = 0 ;
1179             __tind1 < __tdims0 ;
1180 0           __tind1++
1181 0           ,data_datap += __tinc0_0
1182 0           ,mask_datap += __tinc0_1
1183 0           ,weight_datap += __tinc0_2
1184 0           ,cutoff_datap += __tinc0_3
1185 0           ,exponent_datap += __tinc0_4
1186 0           ,oweights_datap += __tinc0_5
1187             )
1188             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1189 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1190 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1191 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1192 0           weight_datap, transpose, *__privtrans->distFlag,
1193             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1194 0 0         if (owp) {
1195             {PDL_COMMENT("Open d") register PDL_Indx d;
1196 0 0         for(d=0; d<(__d_size); d++) {
1197 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1198             }} PDL_COMMENT("Close d")
1199 0           free(owp);
1200             }
1201            
1202             PDL_COMMENT("THREADLOOPEND")
1203             }
1204             }
1205 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1206 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1207 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1208 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1209 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1210 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1211 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1212             /*-- cleanup --*/
1213 0 0         if (datapp) free(datapp);
1214 0 0         if (maskpp) free(maskpp);
1215              
1216 0           } } break; case PDL_S: {
1217 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1218 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1219              
1220 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1221 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1222              
1223 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1224 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1225              
1226 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1227 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1228              
1229 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1230 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1231              
1232 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1233 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1234              
1235 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1236 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1237 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1238 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1239 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1240 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1241              
1242              
1243 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1244 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1245 0           int transpose=0;
1246             int i;
1247             double *owp;
1248            
1249             PDL_COMMENT("THREADLOOPBEGIN")
1250 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1251 0           do { register PDL_Indx __tind1=0,__tind2=0;
1252 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1253 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1254 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1255 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1256 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1257 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1258 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1259 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1260 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1261 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1262 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1263 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1264 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1265 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1266 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1267 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1268 0           data_datap += __offsp[0];
1269 0           mask_datap += __offsp[1];
1270 0           weight_datap += __offsp[2];
1271 0           cutoff_datap += __offsp[3];
1272 0           exponent_datap += __offsp[4];
1273 0           oweights_datap += __offsp[5];
1274 0 0         for( __tind2 = 0 ;
1275             __tind2 < __tdims1 ;
1276 0           __tind2++
1277 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1278 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1279 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1280 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1281 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1282 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1283             )
1284             {
1285 0 0         for( __tind1 = 0 ;
1286             __tind1 < __tdims0 ;
1287 0           __tind1++
1288 0           ,data_datap += __tinc0_0
1289 0           ,mask_datap += __tinc0_1
1290 0           ,weight_datap += __tinc0_2
1291 0           ,cutoff_datap += __tinc0_3
1292 0           ,exponent_datap += __tinc0_4
1293 0           ,oweights_datap += __tinc0_5
1294             )
1295             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1296 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1297 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1298 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1299 0           weight_datap, transpose, *__privtrans->distFlag,
1300             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1301 0 0         if (owp) {
1302             {PDL_COMMENT("Open d") register PDL_Indx d;
1303 0 0         for(d=0; d<(__d_size); d++) {
1304 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1305             }} PDL_COMMENT("Close d")
1306 0           free(owp);
1307             }
1308            
1309             PDL_COMMENT("THREADLOOPEND")
1310             }
1311             }
1312 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1313 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1314 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1315 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1316 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1317 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1318 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1319             /*-- cleanup --*/
1320 0 0         if (datapp) free(datapp);
1321 0 0         if (maskpp) free(maskpp);
1322              
1323 0           } } break; case PDL_US: {
1324 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1325 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1326              
1327 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1328 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1329              
1330 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1331 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1332              
1333 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1334 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1335              
1336 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1337 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1338              
1339 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1340 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1341              
1342 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1343 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1344 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1345 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1346 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1347 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1348              
1349              
1350 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1351 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1352 0           int transpose=0;
1353             int i;
1354             double *owp;
1355            
1356             PDL_COMMENT("THREADLOOPBEGIN")
1357 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1358 0           do { register PDL_Indx __tind1=0,__tind2=0;
1359 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1360 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1361 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1362 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1363 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1364 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1365 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1366 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1367 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1368 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1369 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1370 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1371 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1372 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1373 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1374 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1375 0           data_datap += __offsp[0];
1376 0           mask_datap += __offsp[1];
1377 0           weight_datap += __offsp[2];
1378 0           cutoff_datap += __offsp[3];
1379 0           exponent_datap += __offsp[4];
1380 0           oweights_datap += __offsp[5];
1381 0 0         for( __tind2 = 0 ;
1382             __tind2 < __tdims1 ;
1383 0           __tind2++
1384 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1385 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1386 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1387 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1388 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1389 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1390             )
1391             {
1392 0 0         for( __tind1 = 0 ;
1393             __tind1 < __tdims0 ;
1394 0           __tind1++
1395 0           ,data_datap += __tinc0_0
1396 0           ,mask_datap += __tinc0_1
1397 0           ,weight_datap += __tinc0_2
1398 0           ,cutoff_datap += __tinc0_3
1399 0           ,exponent_datap += __tinc0_4
1400 0           ,oweights_datap += __tinc0_5
1401             )
1402             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1403 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1404 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1405 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1406 0           weight_datap, transpose, *__privtrans->distFlag,
1407             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1408 0 0         if (owp) {
1409             {PDL_COMMENT("Open d") register PDL_Indx d;
1410 0 0         for(d=0; d<(__d_size); d++) {
1411 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1412             }} PDL_COMMENT("Close d")
1413 0           free(owp);
1414             }
1415            
1416             PDL_COMMENT("THREADLOOPEND")
1417             }
1418             }
1419 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1420 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1421 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1422 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1423 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1424 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1425 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1426             /*-- cleanup --*/
1427 0 0         if (datapp) free(datapp);
1428 0 0         if (maskpp) free(maskpp);
1429              
1430 0           } } break; case PDL_L: {
1431 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1432 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1433              
1434 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1435 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1436              
1437 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1438 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1439              
1440 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1441 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1442              
1443 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1444 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1445              
1446 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1447 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1448              
1449 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1450 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1451 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1452 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1453 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1454 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1455              
1456              
1457 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1458 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1459 0           int transpose=0;
1460             int i;
1461             double *owp;
1462            
1463             PDL_COMMENT("THREADLOOPBEGIN")
1464 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1465 0           do { register PDL_Indx __tind1=0,__tind2=0;
1466 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1467 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1468 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1469 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1470 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1471 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1472 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1473 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1474 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1475 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1476 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1477 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1478 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1479 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1480 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1481 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1482 0           data_datap += __offsp[0];
1483 0           mask_datap += __offsp[1];
1484 0           weight_datap += __offsp[2];
1485 0           cutoff_datap += __offsp[3];
1486 0           exponent_datap += __offsp[4];
1487 0           oweights_datap += __offsp[5];
1488 0 0         for( __tind2 = 0 ;
1489             __tind2 < __tdims1 ;
1490 0           __tind2++
1491 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1492 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1493 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1494 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1495 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1496 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1497             )
1498             {
1499 0 0         for( __tind1 = 0 ;
1500             __tind1 < __tdims0 ;
1501 0           __tind1++
1502 0           ,data_datap += __tinc0_0
1503 0           ,mask_datap += __tinc0_1
1504 0           ,weight_datap += __tinc0_2
1505 0           ,cutoff_datap += __tinc0_3
1506 0           ,exponent_datap += __tinc0_4
1507 0           ,oweights_datap += __tinc0_5
1508             )
1509             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1510 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1511 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1512 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1513 0           weight_datap, transpose, *__privtrans->distFlag,
1514             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1515 0 0         if (owp) {
1516             {PDL_COMMENT("Open d") register PDL_Indx d;
1517 0 0         for(d=0; d<(__d_size); d++) {
1518 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1519             }} PDL_COMMENT("Close d")
1520 0           free(owp);
1521             }
1522            
1523             PDL_COMMENT("THREADLOOPEND")
1524             }
1525             }
1526 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1527 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1528 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1529 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1530 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1531 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1532 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1533             /*-- cleanup --*/
1534 0 0         if (datapp) free(datapp);
1535 0 0         if (maskpp) free(maskpp);
1536              
1537 0           } } break; case PDL_IND: {
1538 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1539 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1540              
1541 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1542 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1543              
1544 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1545 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1546              
1547 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1548 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1549              
1550 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1551 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1552              
1553 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1554 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1555              
1556 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1557 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1558 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1559 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1560 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1561 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1562              
1563              
1564 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1565 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1566 0           int transpose=0;
1567             int i;
1568             double *owp;
1569            
1570             PDL_COMMENT("THREADLOOPBEGIN")
1571 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1572 0           do { register PDL_Indx __tind1=0,__tind2=0;
1573 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1574 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1575 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1576 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1577 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1578 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1579 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1580 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1581 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1582 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1583 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1584 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1585 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1586 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1587 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1588 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1589 0           data_datap += __offsp[0];
1590 0           mask_datap += __offsp[1];
1591 0           weight_datap += __offsp[2];
1592 0           cutoff_datap += __offsp[3];
1593 0           exponent_datap += __offsp[4];
1594 0           oweights_datap += __offsp[5];
1595 0 0         for( __tind2 = 0 ;
1596             __tind2 < __tdims1 ;
1597 0           __tind2++
1598 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1599 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1600 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1601 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1602 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1603 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1604             )
1605             {
1606 0 0         for( __tind1 = 0 ;
1607             __tind1 < __tdims0 ;
1608 0           __tind1++
1609 0           ,data_datap += __tinc0_0
1610 0           ,mask_datap += __tinc0_1
1611 0           ,weight_datap += __tinc0_2
1612 0           ,cutoff_datap += __tinc0_3
1613 0           ,exponent_datap += __tinc0_4
1614 0           ,oweights_datap += __tinc0_5
1615             )
1616             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1617 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1618 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1619 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1620 0           weight_datap, transpose, *__privtrans->distFlag,
1621             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1622 0 0         if (owp) {
1623             {PDL_COMMENT("Open d") register PDL_Indx d;
1624 0 0         for(d=0; d<(__d_size); d++) {
1625 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1626             }} PDL_COMMENT("Close d")
1627 0           free(owp);
1628             }
1629            
1630             PDL_COMMENT("THREADLOOPEND")
1631             }
1632             }
1633 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1634 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1635 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1636 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1637 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1638 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1639 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1640             /*-- cleanup --*/
1641 0 0         if (datapp) free(datapp);
1642 0 0         if (maskpp) free(maskpp);
1643              
1644 0           } } break; case PDL_LL: {
1645 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1646 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1647              
1648 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1649 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1650              
1651 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1652 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1653              
1654 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1655 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1656              
1657 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1658 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1659              
1660 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1661 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1662              
1663 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1664 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1665 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1666 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1667 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1668 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1669              
1670              
1671 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1672 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1673 0           int transpose=0;
1674             int i;
1675             double *owp;
1676            
1677             PDL_COMMENT("THREADLOOPBEGIN")
1678 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1679 0           do { register PDL_Indx __tind1=0,__tind2=0;
1680 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1681 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1682 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1683 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1684 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1685 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1686 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1687 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1688 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1689 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1690 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1691 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1692 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1693 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1694 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1695 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1696 0           data_datap += __offsp[0];
1697 0           mask_datap += __offsp[1];
1698 0           weight_datap += __offsp[2];
1699 0           cutoff_datap += __offsp[3];
1700 0           exponent_datap += __offsp[4];
1701 0           oweights_datap += __offsp[5];
1702 0 0         for( __tind2 = 0 ;
1703             __tind2 < __tdims1 ;
1704 0           __tind2++
1705 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1706 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1707 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1708 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1709 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1710 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1711             )
1712             {
1713 0 0         for( __tind1 = 0 ;
1714             __tind1 < __tdims0 ;
1715 0           __tind1++
1716 0           ,data_datap += __tinc0_0
1717 0           ,mask_datap += __tinc0_1
1718 0           ,weight_datap += __tinc0_2
1719 0           ,cutoff_datap += __tinc0_3
1720 0           ,exponent_datap += __tinc0_4
1721 0           ,oweights_datap += __tinc0_5
1722             )
1723             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1724 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1725 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1726 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1727 0           weight_datap, transpose, *__privtrans->distFlag,
1728             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1729 0 0         if (owp) {
1730             {PDL_COMMENT("Open d") register PDL_Indx d;
1731 0 0         for(d=0; d<(__d_size); d++) {
1732 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1733             }} PDL_COMMENT("Close d")
1734 0           free(owp);
1735             }
1736            
1737             PDL_COMMENT("THREADLOOPEND")
1738             }
1739             }
1740 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1741 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1742 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1743 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1744 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1745 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1746 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1747             /*-- cleanup --*/
1748 0 0         if (datapp) free(datapp);
1749 0 0         if (maskpp) free(maskpp);
1750              
1751 0           } } break; case PDL_F: {
1752 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1753 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1754              
1755 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1756 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1757              
1758 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1759 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1760              
1761 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1762 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1763              
1764 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1765 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1766              
1767 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1768 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1769              
1770 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1771 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1772 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1773 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1774 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1775 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1776              
1777              
1778 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1779 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1780 0           int transpose=0;
1781             int i;
1782             double *owp;
1783            
1784             PDL_COMMENT("THREADLOOPBEGIN")
1785 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1786 0           do { register PDL_Indx __tind1=0,__tind2=0;
1787 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1788 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1789 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1790 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1791 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1792 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1793 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1794 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1795 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1796 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1797 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1798 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1799 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1800 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1801 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1802 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1803 0           data_datap += __offsp[0];
1804 0           mask_datap += __offsp[1];
1805 0           weight_datap += __offsp[2];
1806 0           cutoff_datap += __offsp[3];
1807 0           exponent_datap += __offsp[4];
1808 0           oweights_datap += __offsp[5];
1809 0 0         for( __tind2 = 0 ;
1810             __tind2 < __tdims1 ;
1811 0           __tind2++
1812 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1813 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1814 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1815 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1816 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1817 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1818             )
1819             {
1820 0 0         for( __tind1 = 0 ;
1821             __tind1 < __tdims0 ;
1822 0           __tind1++
1823 0           ,data_datap += __tinc0_0
1824 0           ,mask_datap += __tinc0_1
1825 0           ,weight_datap += __tinc0_2
1826 0           ,cutoff_datap += __tinc0_3
1827 0           ,exponent_datap += __tinc0_4
1828 0           ,oweights_datap += __tinc0_5
1829             )
1830             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1831 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1832 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1833 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1834 0           weight_datap, transpose, *__privtrans->distFlag,
1835             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1836 0 0         if (owp) {
1837             {PDL_COMMENT("Open d") register PDL_Indx d;
1838 0 0         for(d=0; d<(__d_size); d++) {
1839 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1840             }} PDL_COMMENT("Close d")
1841 0           free(owp);
1842             }
1843            
1844             PDL_COMMENT("THREADLOOPEND")
1845             }
1846             }
1847 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1848 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1849 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1850 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1851 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1852 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1853 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1854             /*-- cleanup --*/
1855 0 0         if (datapp) free(datapp);
1856 0 0         if (maskpp) free(maskpp);
1857              
1858 0           } } break; case PDL_D: {
1859 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
1860 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
1861              
1862 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
1863 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
1864              
1865 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
1866 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
1867              
1868 0 0         PDL_Double * cutoff_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
1869 0           PDL_Double * cutoff_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
1870              
1871 0 0         PDL_Double * exponent_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
1872 0           PDL_Double * exponent_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
1873              
1874 0 0         PDL_Double * oweights_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
1875 0           PDL_Double * oweights_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
1876              
1877 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
1878 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
1879 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
1880 0           register PDL_Indx __inc_oweights_d = __privtrans->__inc_oweights_d;
1881 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
1882 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
1883              
1884              
1885 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
1886 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
1887 0           int transpose=0;
1888             int i;
1889             double *owp;
1890            
1891             PDL_COMMENT("THREADLOOPBEGIN")
1892 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
1893 0           do { register PDL_Indx __tind1=0,__tind2=0;
1894 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
1895 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
1896 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
1897 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
1898 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
1899 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
1900 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
1901 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
1902 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
1903 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
1904 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
1905 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
1906 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
1907 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
1908 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
1909 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
1910 0           data_datap += __offsp[0];
1911 0           mask_datap += __offsp[1];
1912 0           weight_datap += __offsp[2];
1913 0           cutoff_datap += __offsp[3];
1914 0           exponent_datap += __offsp[4];
1915 0           oweights_datap += __offsp[5];
1916 0 0         for( __tind2 = 0 ;
1917             __tind2 < __tdims1 ;
1918 0           __tind2++
1919 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
1920 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
1921 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
1922 0           ,cutoff_datap += __tinc1_3 - __tinc0_3 * __tdims0
1923 0           ,exponent_datap += __tinc1_4 - __tinc0_4 * __tdims0
1924 0           ,oweights_datap += __tinc1_5 - __tinc0_5 * __tdims0
1925             )
1926             {
1927 0 0         for( __tind1 = 0 ;
1928             __tind1 < __tdims0 ;
1929 0           __tind1++
1930 0           ,data_datap += __tinc0_0
1931 0           ,mask_datap += __tinc0_1
1932 0           ,weight_datap += __tinc0_2
1933 0           ,cutoff_datap += __tinc0_3
1934 0           ,exponent_datap += __tinc0_4
1935 0           ,oweights_datap += __tinc0_5
1936             )
1937             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
1938 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
1939 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
1940 0           owp = calculate_weights(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
1941 0           weight_datap, transpose, *__privtrans->distFlag,
1942             (cutoff_datap)[0] PDL_COMMENT("ACCESS()") , (exponent_datap)[0] PDL_COMMENT("ACCESS()") );
1943 0 0         if (owp) {
1944             {PDL_COMMENT("Open d") register PDL_Indx d;
1945 0 0         for(d=0; d<(__d_size); d++) {
1946 0 0         (oweights_datap)[0+(__inc_oweights_d*PP_INDTERM(__privtrans->__d_size, d))] PDL_COMMENT("ACCESS()") = owp[d];
1947             }} PDL_COMMENT("Close d")
1948 0           free(owp);
1949             }
1950            
1951             PDL_COMMENT("THREADLOOPEND")
1952             }
1953             }
1954 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
1955 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
1956 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
1957 0           cutoff_datap -= __tinc1_3 * __tdims1 + __offsp[3];
1958 0           exponent_datap -= __tinc1_4 * __tdims1 + __offsp[4];
1959 0           oweights_datap -= __tinc1_5 * __tdims1 + __offsp[5];
1960 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
1961             /*-- cleanup --*/
1962 0 0         if (datapp) free(datapp);
1963 0 0         if (maskpp) free(maskpp);
1964              
1965 0           } break;}
1966 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
1967             }
1968             }
1969             }
1970            
1971              
1972              
1973              
1974 0           void pdl_calculate_weights_free(pdl_trans *__tr ) {
1975             int __dim;
1976 0           pdl_calculate_weights_struct *__privtrans = (pdl_calculate_weights_struct *) __tr;
1977            
1978             {
1979            
1980 0           PDL_TR_CLRMAGIC(__privtrans);
1981 0           free(__privtrans->distFlag);;
1982 0 0         if(__privtrans->__ddone) {
1983 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
1984             ;;;;;;;;;
1985             }
1986            
1987             }
1988 0           }
1989            
1990              
1991              
1992              
1993             static char pdl_calculate_weights_vtable_flags[] =
1994             { 0,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
1995             pdl_transvtable pdl_calculate_weights_vtable = {
1996             0,0, 5, 6, pdl_calculate_weights_vtable_flags,
1997             pdl_calculate_weights_redodims, pdl_calculate_weights_readdata, NULL,
1998             pdl_calculate_weights_free,NULL,NULL,pdl_calculate_weights_copy,
1999             sizeof(pdl_calculate_weights_struct),"pdl_calculate_weights_vtable"
2000             };
2001              
2002             typedef struct pdl_clusterdistance_struct {
2003             PDL_TRANS_START(8);
2004             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_index1_n1;PDL_Indx __inc_index2_n2;PDL_Indx __n_size;PDL_Indx __n2_size;PDL_Indx __d_size;PDL_Indx __n1_size;
2005             char *distFlag;char *methodFlag;
2006             char __ddone; PDL_COMMENT("Dims done")
2007             } pdl_clusterdistance_struct;
2008              
2009 6           void pdl_clusterdistance_redodims(pdl_trans *__tr ) {
2010             int __dim;
2011 6           pdl_clusterdistance_struct *__privtrans = (pdl_clusterdistance_struct *) __tr;
2012            
2013             {
2014             PDL_Indx __creating[8];
2015 6           __privtrans->__n_size = -1;
2016 6           __privtrans->__n2_size = -1;
2017 6           __privtrans->__d_size = -1;
2018 6           __privtrans->__n1_size = -1;
2019 6           __creating[0] = 0;
2020 6           __creating[1] = 0;
2021 6           __creating[2] = 0;
2022 6           __creating[3] = 0;
2023 6           __creating[4] = 0;
2024 6           __creating[5] = 0;
2025 6           __creating[6] = 0;
2026 6 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
2027             {
2028             {PDL_COMMENT("Start generic loop")
2029              
2030 6           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
2031 0           } break; case PDL_B: {
2032 6 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2033 6           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2034              
2035 6 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2036 6           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2037              
2038 6 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2039 6           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2040              
2041 6 50         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2042 6           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2043              
2044 6 50         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2045 6           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2046              
2047 6 50         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2048 6           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2049              
2050 6 50         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2051 6           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2052              
2053 6 50         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2054 6           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2055              
2056 6           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2057 6           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2058 6           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2059 6           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2060 6           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2061 6           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2062 6           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2063              
2064             PDL_COMMENT("none")
2065 6           } } break; case PDL_S: {
2066 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2067 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2068              
2069 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2070 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2071              
2072 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2073 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2074              
2075 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2076 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2077              
2078 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2079 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2080              
2081 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2082 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2083              
2084 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2085 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2086              
2087 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2088 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2089              
2090 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2091 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2092 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2093 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2094 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2095 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2096 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2097              
2098             PDL_COMMENT("none")
2099 0           } } break; case PDL_US: {
2100 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2101 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2102              
2103 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2104 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2105              
2106 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2107 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2108              
2109 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2110 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2111              
2112 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2113 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2114              
2115 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2116 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2117              
2118 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2119 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2120              
2121 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2122 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2123              
2124 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2125 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2126 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2127 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2128 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2129 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2130 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2131              
2132             PDL_COMMENT("none")
2133 0           } } break; case PDL_L: {
2134 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2135 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2136              
2137 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2138 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2139              
2140 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2141 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2142              
2143 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2144 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2145              
2146 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2147 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2148              
2149 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2150 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2151              
2152 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2153 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2154              
2155 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2156 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2157              
2158 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2159 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2160 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2161 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2162 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2163 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2164 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2165              
2166             PDL_COMMENT("none")
2167 0           } } break; case PDL_IND: {
2168 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2169 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2170              
2171 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2172 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2173              
2174 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2175 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2176              
2177 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2178 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2179              
2180 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2181 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2182              
2183 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2184 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2185              
2186 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2187 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2188              
2189 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2190 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2191              
2192 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2193 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2194 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2195 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2196 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2197 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2198 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2199              
2200             PDL_COMMENT("none")
2201 0           } } break; case PDL_LL: {
2202 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2203 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2204              
2205 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2206 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2207              
2208 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2209 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2210              
2211 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2212 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2213              
2214 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2215 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2216              
2217 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2218 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2219              
2220 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2221 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2222              
2223 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2224 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2225              
2226 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2227 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2228 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2229 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2230 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2231 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2232 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2233              
2234             PDL_COMMENT("none")
2235 0           } } break; case PDL_F: {
2236 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2237 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2238              
2239 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2240 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2241              
2242 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2243 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2244              
2245 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2246 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2247              
2248 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2249 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2250              
2251 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2252 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2253              
2254 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2255 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2256              
2257 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2258 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2259              
2260 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2261 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2262 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2263 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2264 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2265 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2266 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2267              
2268             PDL_COMMENT("none")
2269 0           } } break; case PDL_D: {
2270 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2271 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2272              
2273 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2274 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2275              
2276 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2277 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2278              
2279 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2280 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2281              
2282 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2283 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2284              
2285 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2286 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2287              
2288 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2289 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2290              
2291 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2292 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2293              
2294 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2295 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2296 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2297 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2298 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2299 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2300 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2301              
2302             PDL_COMMENT("none")
2303 0           } break;}
2304 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
2305             }
2306             }
2307             {
2308             static char *__parnames[] = {"data","mask","weight","n1","n2","index1","index2","dist"};
2309             static PDL_Indx __realdims[] = {2,2,1,0,0,1,1,0};
2310             static char __funcname[] = "PDL::Cluster::clusterdistance";
2311             static pdl_errorinfo __einfo = {
2312             __funcname, __parnames, 8
2313             };
2314            
2315 6           PDL->initthreadstruct(2,__privtrans->pdls,
2316             __realdims,__creating,8,
2317             &__einfo,&(__privtrans->__pdlthread),
2318 6           __privtrans->vtable->per_pdl_flags,
2319             0 );
2320             }
2321 6 50         if(((__privtrans->pdls[0]))->ndims < 2) {
2322 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
2323 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
2324             }
2325 6 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
2326 6           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
2327 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
2328 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
2329 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2330             }
2331             }
2332 6 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
2333 6           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
2334 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
2335 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
2336 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2337             }
2338             }
2339 6           PDL->make_physical(((__privtrans->pdls[0])));
2340 6 50         if(((__privtrans->pdls[1]))->ndims < 2) {
2341 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
2342 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
2343             }
2344 6 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
2345 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
2346 6 50         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    50          
2347 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
2348 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2349             }
2350             }
2351 6 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
2352 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
2353 6 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
2354 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
2355 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2356             }
2357             }
2358 6           PDL->make_physical(((__privtrans->pdls[1])));
2359 6 50         if(((__privtrans->pdls[2]))->ndims < 1) {
2360 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
2361             }
2362 6 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
2363 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
2364 6 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
2365 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
2366 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2367             }
2368             }
2369 6           PDL->make_physical(((__privtrans->pdls[2])));
2370 6 50         if(((__privtrans->pdls[5]))->ndims < 1) {
2371 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__n1_size <= 1) __privtrans->__n1_size = 1;
    0          
2372             }
2373 6 50         if(__privtrans->__n1_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n1_size == 1)) {
    0          
    0          
2374 6           __privtrans->__n1_size = ((__privtrans->pdls[5]))->dims[0];
2375 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n1_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
2376 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
2377 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2378             }
2379             }
2380 6           PDL->make_physical(((__privtrans->pdls[5])));
2381 6 50         if(((__privtrans->pdls[6]))->ndims < 1) {
2382 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__n2_size <= 1) __privtrans->__n2_size = 1;
    0          
2383             }
2384 6 50         if(__privtrans->__n2_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__n2_size == 1)) {
    0          
    0          
2385 6           __privtrans->__n2_size = ((__privtrans->pdls[6]))->dims[0];
2386 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__n2_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
2387 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
2388 0           PDL->pdl_barf("Error in clusterdistance:" "Wrong dims\n");
2389             }
2390             }
2391 6           PDL->make_physical(((__privtrans->pdls[6])));
2392 6 50         if(!__creating[7]) {
2393             } else {
2394             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
2395 6           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
2396             }
2397             { PDL_COMMENT("convenience block")
2398 6           void *hdrp = NULL;
2399 6           char propagate_hdrcpy = 0;
2400 6           SV *hdr_copy = NULL;
2401 6 50         if(!hdrp &&
    50          
2402 0 0         __privtrans->pdls[0]->hdrsv &&
2403 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
2404             ) {
2405 0           hdrp = __privtrans->pdls[0]->hdrsv;
2406 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
2407             }
2408 6 50         if(!hdrp &&
    50          
2409 0 0         __privtrans->pdls[1]->hdrsv &&
2410 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
2411             ) {
2412 0           hdrp = __privtrans->pdls[1]->hdrsv;
2413 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
2414             }
2415 6 50         if(!hdrp &&
    50          
2416 0 0         __privtrans->pdls[2]->hdrsv &&
2417 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
2418             ) {
2419 0           hdrp = __privtrans->pdls[2]->hdrsv;
2420 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
2421             }
2422 6 50         if(!hdrp &&
    50          
2423 0 0         __privtrans->pdls[3]->hdrsv &&
2424 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
2425             ) {
2426 0           hdrp = __privtrans->pdls[3]->hdrsv;
2427 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
2428             }
2429 6 50         if(!hdrp &&
    50          
2430 0 0         __privtrans->pdls[4]->hdrsv &&
2431 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
2432             ) {
2433 0           hdrp = __privtrans->pdls[4]->hdrsv;
2434 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
2435             }
2436 6 50         if(!hdrp &&
    50          
2437 0 0         __privtrans->pdls[5]->hdrsv &&
2438 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
2439             ) {
2440 0           hdrp = __privtrans->pdls[5]->hdrsv;
2441 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
2442             }
2443 6 50         if(!hdrp &&
    50          
2444 0 0         __privtrans->pdls[6]->hdrsv &&
2445 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
2446             ) {
2447 0           hdrp = __privtrans->pdls[6]->hdrsv;
2448 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
2449             }
2450 6 50         if(!hdrp &&
    50          
2451 0 0         !__creating[7] &&
2452 0 0         __privtrans->pdls[7]->hdrsv &&
2453 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
2454             ) {
2455 0           hdrp = __privtrans->pdls[7]->hdrsv;
2456 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
2457             }
2458 6 50         if (hdrp) {
2459 0 0         if(hdrp == &PL_sv_undef)
2460 0           hdr_copy = &PL_sv_undef;
2461             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
2462             int count;
2463             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
2464 0           dSP;
2465 0           ENTER ;
2466 0           SAVETMPS ;
2467 0 0         PUSHMARK(SP) ;
2468 0 0         XPUSHs( hdrp );
2469 0           PUTBACK ;
2470 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
2471 0           SPAGAIN ;
2472 0 0         if(count != 1)
2473 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
2474              
2475 0           hdr_copy = (SV *)POPs;
2476              
2477 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
2478 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
2479             }
2480              
2481 0 0         FREETMPS ;
2482 0           LEAVE ;
2483              
2484              
2485             } PDL_COMMENT("end of callback block")
2486              
2487 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
2488 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
2489 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
2490 0 0         if( hdr_copy != &PL_sv_undef )
2491 0           (void)SvREFCNT_inc(hdr_copy);
2492 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
2493             }
2494 0 0         if(propagate_hdrcpy)
2495 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
2496              
2497 0 0         if(hdr_copy != &PL_sv_undef)
2498 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
2499             } PDL_COMMENT("end of if(hdrp) block")
2500             } PDL_COMMENT("end of conv. block")
2501 6 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
2502 0           __privtrans->__inc_data_d = 0; else
2503 6 50         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    50          
2504 0           __privtrans->__inc_data_n = 0; else
2505 6 50         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
2506 0           __privtrans->__inc_mask_d = 0; else
2507 6 50         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
2508 0           __privtrans->__inc_mask_n = 0; else
2509 6 50         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
2510 0           __privtrans->__inc_weight_d = 0; else
2511 6 50         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    100          
2512 2           __privtrans->__inc_index1_n1 = 0; else
2513 6 50         __privtrans->__inc_index1_n1 = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    100          
2514 4           __privtrans->__inc_index2_n2 = 0; else
2515 2           __privtrans->__inc_index2_n2 = __privtrans->pdls[6]->dimincs[0]; __privtrans->__ddone = 1;
2516             }
2517 6           }
2518            
2519              
2520 0           pdl_trans * pdl_clusterdistance_copy(pdl_trans *__tr ) {
2521             int __dim;
2522 0           pdl_clusterdistance_struct *__privtrans = (pdl_clusterdistance_struct *) __tr;
2523            
2524             {
2525 0           pdl_clusterdistance_struct *__copy = malloc(sizeof(pdl_clusterdistance_struct));
2526 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
2527 0           __copy->has_badvalue = __privtrans->has_badvalue;
2528 0           __copy->badvalue = __privtrans->badvalue;
2529 0           __copy->flags = __privtrans->flags;
2530 0           __copy->vtable = __privtrans->vtable;
2531 0           __copy->__datatype = __privtrans->__datatype;
2532 0           __copy->freeproc = NULL;
2533 0           __copy->__ddone = __privtrans->__ddone;
2534             {int i;
2535 0 0         for(i=0; i<__copy->vtable->npdls; i++)
2536 0           __copy->pdls[i] = __privtrans->pdls[i];
2537             }
2538 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
2539 0 0         if(__copy->__ddone) {
2540 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_index1_n1=__copy->__inc_index1_n1;__privtrans->__inc_index2_n2=__copy->__inc_index2_n2;__copy->__n_size=__privtrans->__n_size;__copy->__n2_size=__privtrans->__n2_size;__copy->__d_size=__privtrans->__d_size;__copy->__n1_size=__privtrans->__n1_size;
2541             }
2542 0           return (pdl_trans*)__copy;
2543             }
2544             }
2545            
2546              
2547 6           void pdl_clusterdistance_readdata(pdl_trans *__tr ) {
2548             int __dim;
2549 6           pdl_clusterdistance_struct *__privtrans = (pdl_clusterdistance_struct *) __tr;
2550            
2551             {
2552             {PDL_COMMENT("Start generic loop")
2553              
2554 6           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
2555 0           } break; case PDL_B: {
2556 6 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2557 6           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2558              
2559 6 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2560 6           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2561              
2562 6 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2563 6           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2564              
2565 6 50         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2566 6           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2567              
2568 6 50         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2569 6           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2570              
2571 6 50         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2572 6           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2573              
2574 6 50         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2575 6           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2576              
2577 6 50         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2578 6           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2579              
2580 6           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2581 6           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2582 6           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2583 6           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2584 6           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2585 6           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2586 6           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2587              
2588              
2589 6           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
2590 6           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
2591 6           int transpose=0;
2592             double retval;
2593              
2594            
2595             PDL_COMMENT("THREADLOOPBEGIN")
2596 6 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2597 6           do { register PDL_Indx __tind1=0,__tind2=0;
2598 6           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2599 6           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2600 6           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2601 6           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2602 6           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2603 6           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2604 6           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2605 6           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2606 6           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2607 6           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2608 6           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2609 6           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2610 6           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2611 6           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2612 6           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2613 6           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2614 6           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2615 6           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2616 6           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2617 6           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2618 6           data_datap += __offsp[0];
2619 6           mask_datap += __offsp[1];
2620 6           weight_datap += __offsp[2];
2621 6           n1_datap += __offsp[3];
2622 6           n2_datap += __offsp[4];
2623 6           index1_datap += __offsp[5];
2624 6           index2_datap += __offsp[6];
2625 6           dist_datap += __offsp[7];
2626 12 100         for( __tind2 = 0 ;
2627             __tind2 < __tdims1 ;
2628 6           __tind2++
2629 6           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
2630 6           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
2631 6           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
2632 6           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
2633 6           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
2634 6           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
2635 6           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
2636 6           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
2637             )
2638             {
2639 12 100         for( __tind1 = 0 ;
2640             __tind1 < __tdims0 ;
2641 6           __tind1++
2642 6           ,data_datap += __tinc0_0
2643 6           ,mask_datap += __tinc0_1
2644 6           ,weight_datap += __tinc0_2
2645 6           ,n1_datap += __tinc0_3
2646 6           ,n2_datap += __tinc0_4
2647 6           ,index1_datap += __tinc0_5
2648 6           ,index2_datap += __tinc0_6
2649 6           ,dist_datap += __tinc0_7
2650             )
2651             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
2652 6           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
2653 6           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
2654 6           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
2655             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
2656 12           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
2657 6           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
2658            
2659             PDL_COMMENT("THREADLOOPEND")
2660             }
2661             }
2662 6           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
2663 6           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
2664 6           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
2665 6           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
2666 6           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
2667 6           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
2668 6           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
2669 6           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
2670 6 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
2671              
2672             /*-- cleanup --*/
2673 6 50         if (datapp) free(datapp);
2674 6 50         if (maskpp) free(maskpp);
2675              
2676 6           } } break; case PDL_S: {
2677 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2678 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2679              
2680 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2681 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2682              
2683 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2684 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2685              
2686 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2687 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2688              
2689 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2690 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2691              
2692 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2693 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2694              
2695 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2696 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2697              
2698 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2699 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2700              
2701 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2702 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2703 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2704 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2705 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2706 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2707 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2708              
2709              
2710 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
2711 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
2712 0           int transpose=0;
2713             double retval;
2714              
2715            
2716             PDL_COMMENT("THREADLOOPBEGIN")
2717 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2718 0           do { register PDL_Indx __tind1=0,__tind2=0;
2719 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2720 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2721 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2722 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2723 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2724 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2725 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2726 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2727 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2728 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2729 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2730 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2731 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2732 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2733 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2734 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2735 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2736 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2737 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2738 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2739 0           data_datap += __offsp[0];
2740 0           mask_datap += __offsp[1];
2741 0           weight_datap += __offsp[2];
2742 0           n1_datap += __offsp[3];
2743 0           n2_datap += __offsp[4];
2744 0           index1_datap += __offsp[5];
2745 0           index2_datap += __offsp[6];
2746 0           dist_datap += __offsp[7];
2747 0 0         for( __tind2 = 0 ;
2748             __tind2 < __tdims1 ;
2749 0           __tind2++
2750 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
2751 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
2752 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
2753 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
2754 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
2755 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
2756 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
2757 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
2758             )
2759             {
2760 0 0         for( __tind1 = 0 ;
2761             __tind1 < __tdims0 ;
2762 0           __tind1++
2763 0           ,data_datap += __tinc0_0
2764 0           ,mask_datap += __tinc0_1
2765 0           ,weight_datap += __tinc0_2
2766 0           ,n1_datap += __tinc0_3
2767 0           ,n2_datap += __tinc0_4
2768 0           ,index1_datap += __tinc0_5
2769 0           ,index2_datap += __tinc0_6
2770 0           ,dist_datap += __tinc0_7
2771             )
2772             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
2773 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
2774 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
2775 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
2776             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
2777 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
2778 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
2779            
2780             PDL_COMMENT("THREADLOOPEND")
2781             }
2782             }
2783 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
2784 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
2785 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
2786 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
2787 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
2788 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
2789 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
2790 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
2791 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
2792              
2793             /*-- cleanup --*/
2794 0 0         if (datapp) free(datapp);
2795 0 0         if (maskpp) free(maskpp);
2796              
2797 0           } } break; case PDL_US: {
2798 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2799 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2800              
2801 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2802 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2803              
2804 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2805 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2806              
2807 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2808 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2809              
2810 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2811 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2812              
2813 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2814 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2815              
2816 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2817 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2818              
2819 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2820 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2821              
2822 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2823 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2824 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2825 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2826 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2827 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2828 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2829              
2830              
2831 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
2832 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
2833 0           int transpose=0;
2834             double retval;
2835              
2836            
2837             PDL_COMMENT("THREADLOOPBEGIN")
2838 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2839 0           do { register PDL_Indx __tind1=0,__tind2=0;
2840 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2841 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2842 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2843 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2844 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2845 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2846 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2847 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2848 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2849 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2850 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2851 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2852 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2853 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2854 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2855 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2856 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2857 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2858 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2859 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2860 0           data_datap += __offsp[0];
2861 0           mask_datap += __offsp[1];
2862 0           weight_datap += __offsp[2];
2863 0           n1_datap += __offsp[3];
2864 0           n2_datap += __offsp[4];
2865 0           index1_datap += __offsp[5];
2866 0           index2_datap += __offsp[6];
2867 0           dist_datap += __offsp[7];
2868 0 0         for( __tind2 = 0 ;
2869             __tind2 < __tdims1 ;
2870 0           __tind2++
2871 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
2872 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
2873 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
2874 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
2875 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
2876 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
2877 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
2878 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
2879             )
2880             {
2881 0 0         for( __tind1 = 0 ;
2882             __tind1 < __tdims0 ;
2883 0           __tind1++
2884 0           ,data_datap += __tinc0_0
2885 0           ,mask_datap += __tinc0_1
2886 0           ,weight_datap += __tinc0_2
2887 0           ,n1_datap += __tinc0_3
2888 0           ,n2_datap += __tinc0_4
2889 0           ,index1_datap += __tinc0_5
2890 0           ,index2_datap += __tinc0_6
2891 0           ,dist_datap += __tinc0_7
2892             )
2893             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
2894 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
2895 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
2896 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
2897             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
2898 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
2899 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
2900            
2901             PDL_COMMENT("THREADLOOPEND")
2902             }
2903             }
2904 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
2905 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
2906 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
2907 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
2908 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
2909 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
2910 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
2911 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
2912 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
2913              
2914             /*-- cleanup --*/
2915 0 0         if (datapp) free(datapp);
2916 0 0         if (maskpp) free(maskpp);
2917              
2918 0           } } break; case PDL_L: {
2919 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
2920 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
2921              
2922 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
2923 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
2924              
2925 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
2926 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
2927              
2928 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
2929 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
2930              
2931 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
2932 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
2933              
2934 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
2935 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
2936              
2937 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
2938 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
2939              
2940 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
2941 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
2942              
2943 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
2944 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
2945 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
2946 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
2947 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
2948 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
2949 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
2950              
2951              
2952 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
2953 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
2954 0           int transpose=0;
2955             double retval;
2956              
2957            
2958             PDL_COMMENT("THREADLOOPBEGIN")
2959 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
2960 0           do { register PDL_Indx __tind1=0,__tind2=0;
2961 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
2962 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
2963 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
2964 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
2965 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
2966 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
2967 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
2968 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
2969 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
2970 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
2971 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
2972 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
2973 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
2974 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
2975 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
2976 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
2977 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
2978 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
2979 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
2980 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
2981 0           data_datap += __offsp[0];
2982 0           mask_datap += __offsp[1];
2983 0           weight_datap += __offsp[2];
2984 0           n1_datap += __offsp[3];
2985 0           n2_datap += __offsp[4];
2986 0           index1_datap += __offsp[5];
2987 0           index2_datap += __offsp[6];
2988 0           dist_datap += __offsp[7];
2989 0 0         for( __tind2 = 0 ;
2990             __tind2 < __tdims1 ;
2991 0           __tind2++
2992 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
2993 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
2994 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
2995 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
2996 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
2997 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
2998 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
2999 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
3000             )
3001             {
3002 0 0         for( __tind1 = 0 ;
3003             __tind1 < __tdims0 ;
3004 0           __tind1++
3005 0           ,data_datap += __tinc0_0
3006 0           ,mask_datap += __tinc0_1
3007 0           ,weight_datap += __tinc0_2
3008 0           ,n1_datap += __tinc0_3
3009 0           ,n2_datap += __tinc0_4
3010 0           ,index1_datap += __tinc0_5
3011 0           ,index2_datap += __tinc0_6
3012 0           ,dist_datap += __tinc0_7
3013             )
3014             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3015 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
3016 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
3017 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
3018             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
3019 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
3020 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
3021            
3022             PDL_COMMENT("THREADLOOPEND")
3023             }
3024             }
3025 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3026 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3027 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3028 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3029 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3030 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3031 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3032 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3033 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3034              
3035             /*-- cleanup --*/
3036 0 0         if (datapp) free(datapp);
3037 0 0         if (maskpp) free(maskpp);
3038              
3039 0           } } break; case PDL_IND: {
3040 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3041 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3042              
3043 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3044 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3045              
3046 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3047 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3048              
3049 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3050 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3051              
3052 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3053 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3054              
3055 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3056 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
3057              
3058 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3059 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
3060              
3061 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3062 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
3063              
3064 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
3065 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3066 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3067 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3068 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3069 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3070 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
3071              
3072              
3073 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
3074 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
3075 0           int transpose=0;
3076             double retval;
3077              
3078            
3079             PDL_COMMENT("THREADLOOPBEGIN")
3080 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3081 0           do { register PDL_Indx __tind1=0,__tind2=0;
3082 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3083 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3084 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3085 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3086 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3087 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3088 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3089 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3090 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3091 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3092 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3093 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3094 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3095 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3096 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3097 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3098 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3099 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3100 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3101 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3102 0           data_datap += __offsp[0];
3103 0           mask_datap += __offsp[1];
3104 0           weight_datap += __offsp[2];
3105 0           n1_datap += __offsp[3];
3106 0           n2_datap += __offsp[4];
3107 0           index1_datap += __offsp[5];
3108 0           index2_datap += __offsp[6];
3109 0           dist_datap += __offsp[7];
3110 0 0         for( __tind2 = 0 ;
3111             __tind2 < __tdims1 ;
3112 0           __tind2++
3113 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
3114 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
3115 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
3116 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
3117 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
3118 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
3119 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
3120 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
3121             )
3122             {
3123 0 0         for( __tind1 = 0 ;
3124             __tind1 < __tdims0 ;
3125 0           __tind1++
3126 0           ,data_datap += __tinc0_0
3127 0           ,mask_datap += __tinc0_1
3128 0           ,weight_datap += __tinc0_2
3129 0           ,n1_datap += __tinc0_3
3130 0           ,n2_datap += __tinc0_4
3131 0           ,index1_datap += __tinc0_5
3132 0           ,index2_datap += __tinc0_6
3133 0           ,dist_datap += __tinc0_7
3134             )
3135             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3136 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
3137 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
3138 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
3139             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
3140 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
3141 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
3142            
3143             PDL_COMMENT("THREADLOOPEND")
3144             }
3145             }
3146 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3147 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3148 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3149 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3150 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3151 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3152 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3153 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3154 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3155              
3156             /*-- cleanup --*/
3157 0 0         if (datapp) free(datapp);
3158 0 0         if (maskpp) free(maskpp);
3159              
3160 0           } } break; case PDL_LL: {
3161 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3162 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3163              
3164 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3165 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3166              
3167 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3168 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3169              
3170 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3171 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3172              
3173 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3174 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3175              
3176 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3177 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
3178              
3179 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3180 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
3181              
3182 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3183 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
3184              
3185 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
3186 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3187 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3188 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3189 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3190 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3191 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
3192              
3193              
3194 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
3195 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
3196 0           int transpose=0;
3197             double retval;
3198              
3199            
3200             PDL_COMMENT("THREADLOOPBEGIN")
3201 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3202 0           do { register PDL_Indx __tind1=0,__tind2=0;
3203 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3204 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3205 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3206 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3207 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3208 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3209 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3210 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3211 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3212 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3213 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3214 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3215 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3216 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3217 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3218 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3219 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3220 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3221 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3222 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3223 0           data_datap += __offsp[0];
3224 0           mask_datap += __offsp[1];
3225 0           weight_datap += __offsp[2];
3226 0           n1_datap += __offsp[3];
3227 0           n2_datap += __offsp[4];
3228 0           index1_datap += __offsp[5];
3229 0           index2_datap += __offsp[6];
3230 0           dist_datap += __offsp[7];
3231 0 0         for( __tind2 = 0 ;
3232             __tind2 < __tdims1 ;
3233 0           __tind2++
3234 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
3235 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
3236 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
3237 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
3238 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
3239 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
3240 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
3241 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
3242             )
3243             {
3244 0 0         for( __tind1 = 0 ;
3245             __tind1 < __tdims0 ;
3246 0           __tind1++
3247 0           ,data_datap += __tinc0_0
3248 0           ,mask_datap += __tinc0_1
3249 0           ,weight_datap += __tinc0_2
3250 0           ,n1_datap += __tinc0_3
3251 0           ,n2_datap += __tinc0_4
3252 0           ,index1_datap += __tinc0_5
3253 0           ,index2_datap += __tinc0_6
3254 0           ,dist_datap += __tinc0_7
3255             )
3256             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3257 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
3258 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
3259 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
3260             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
3261 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
3262 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
3263            
3264             PDL_COMMENT("THREADLOOPEND")
3265             }
3266             }
3267 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3268 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3269 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3270 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3271 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3272 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3273 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3274 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3275 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3276              
3277             /*-- cleanup --*/
3278 0 0         if (datapp) free(datapp);
3279 0 0         if (maskpp) free(maskpp);
3280              
3281 0           } } break; case PDL_F: {
3282 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3283 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3284              
3285 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3286 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3287              
3288 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3289 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3290              
3291 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3292 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3293              
3294 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3295 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3296              
3297 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3298 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
3299              
3300 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3301 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
3302              
3303 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3304 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
3305              
3306 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
3307 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3308 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3309 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3310 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3311 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3312 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
3313              
3314              
3315 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
3316 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
3317 0           int transpose=0;
3318             double retval;
3319              
3320            
3321             PDL_COMMENT("THREADLOOPBEGIN")
3322 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3323 0           do { register PDL_Indx __tind1=0,__tind2=0;
3324 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3325 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3326 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3327 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3328 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3329 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3330 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3331 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3332 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3333 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3334 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3335 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3336 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3337 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3338 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3339 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3340 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3341 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3342 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3343 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3344 0           data_datap += __offsp[0];
3345 0           mask_datap += __offsp[1];
3346 0           weight_datap += __offsp[2];
3347 0           n1_datap += __offsp[3];
3348 0           n2_datap += __offsp[4];
3349 0           index1_datap += __offsp[5];
3350 0           index2_datap += __offsp[6];
3351 0           dist_datap += __offsp[7];
3352 0 0         for( __tind2 = 0 ;
3353             __tind2 < __tdims1 ;
3354 0           __tind2++
3355 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
3356 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
3357 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
3358 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
3359 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
3360 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
3361 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
3362 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
3363             )
3364             {
3365 0 0         for( __tind1 = 0 ;
3366             __tind1 < __tdims0 ;
3367 0           __tind1++
3368 0           ,data_datap += __tinc0_0
3369 0           ,mask_datap += __tinc0_1
3370 0           ,weight_datap += __tinc0_2
3371 0           ,n1_datap += __tinc0_3
3372 0           ,n2_datap += __tinc0_4
3373 0           ,index1_datap += __tinc0_5
3374 0           ,index2_datap += __tinc0_6
3375 0           ,dist_datap += __tinc0_7
3376             )
3377             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3378 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
3379 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
3380 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
3381             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
3382 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
3383 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
3384            
3385             PDL_COMMENT("THREADLOOPEND")
3386             }
3387             }
3388 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3389 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3390 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3391 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3392 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3393 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3394 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3395 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3396 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3397              
3398             /*-- cleanup --*/
3399 0 0         if (datapp) free(datapp);
3400 0 0         if (maskpp) free(maskpp);
3401              
3402 0           } } break; case PDL_D: {
3403 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3404 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3405              
3406 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3407 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3408              
3409 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3410 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3411              
3412 0 0         PDL_Long * n1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3413 0           PDL_Long * n1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
3414              
3415 0 0         PDL_Long * n2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
3416 0           PDL_Long * n2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
3417              
3418 0 0         PDL_Long * index1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
3419 0           PDL_Long * index1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
3420              
3421 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
3422 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
3423              
3424 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
3425 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
3426              
3427 0           {register PDL_Indx __inc_index1_n1 = __privtrans->__inc_index1_n1;
3428 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3429 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3430 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3431 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3432 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3433 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
3434              
3435              
3436 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
3437 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
3438 0           int transpose=0;
3439             double retval;
3440              
3441            
3442             PDL_COMMENT("THREADLOOPBEGIN")
3443 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
3444 0           do { register PDL_Indx __tind1=0,__tind2=0;
3445 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
3446 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
3447 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
3448 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
3449 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
3450 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
3451 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
3452 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
3453 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
3454 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
3455 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
3456 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
3457 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
3458 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
3459 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
3460 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
3461 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
3462 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
3463 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
3464 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
3465 0           data_datap += __offsp[0];
3466 0           mask_datap += __offsp[1];
3467 0           weight_datap += __offsp[2];
3468 0           n1_datap += __offsp[3];
3469 0           n2_datap += __offsp[4];
3470 0           index1_datap += __offsp[5];
3471 0           index2_datap += __offsp[6];
3472 0           dist_datap += __offsp[7];
3473 0 0         for( __tind2 = 0 ;
3474             __tind2 < __tdims1 ;
3475 0           __tind2++
3476 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
3477 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
3478 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
3479 0           ,n1_datap += __tinc1_3 - __tinc0_3 * __tdims0
3480 0           ,n2_datap += __tinc1_4 - __tinc0_4 * __tdims0
3481 0           ,index1_datap += __tinc1_5 - __tinc0_5 * __tdims0
3482 0           ,index2_datap += __tinc1_6 - __tinc0_6 * __tdims0
3483 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
3484             )
3485             {
3486 0 0         for( __tind1 = 0 ;
3487             __tind1 < __tdims0 ;
3488 0           __tind1++
3489 0           ,data_datap += __tinc0_0
3490 0           ,mask_datap += __tinc0_1
3491 0           ,weight_datap += __tinc0_2
3492 0           ,n1_datap += __tinc0_3
3493 0           ,n2_datap += __tinc0_4
3494 0           ,index1_datap += __tinc0_5
3495 0           ,index2_datap += __tinc0_6
3496 0           ,dist_datap += __tinc0_7
3497             )
3498             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
3499 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
3500 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
3501 0           retval = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
3502             weight_datap, (n1_datap)[0] PDL_COMMENT("ACCESS()") , (n2_datap)[0] PDL_COMMENT("ACCESS()") , index1_datap, index2_datap,
3503 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
3504 0           (dist_datap)[0] PDL_COMMENT("ACCESS()") = retval;
3505            
3506             PDL_COMMENT("THREADLOOPEND")
3507             }
3508             }
3509 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
3510 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
3511 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
3512 0           n1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
3513 0           n2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
3514 0           index1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
3515 0           index2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
3516 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
3517 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
3518              
3519             /*-- cleanup --*/
3520 0 0         if (datapp) free(datapp);
3521 0 0         if (maskpp) free(maskpp);
3522              
3523 0           } break;}
3524 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
3525             }
3526             }
3527             }
3528            
3529              
3530              
3531              
3532 6           void pdl_clusterdistance_free(pdl_trans *__tr ) {
3533             int __dim;
3534 6           pdl_clusterdistance_struct *__privtrans = (pdl_clusterdistance_struct *) __tr;
3535            
3536             {
3537            
3538 6           PDL_TR_CLRMAGIC(__privtrans);
3539 6           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
3540 6 50         if(__privtrans->__ddone) {
3541 6           PDL->freethreadloop(&(__privtrans->__pdlthread));
3542             ;;;;;;;;;;;;
3543             }
3544            
3545             }
3546 6           }
3547            
3548              
3549              
3550              
3551             static char pdl_clusterdistance_vtable_flags[] =
3552             { 0,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,0,0,PDL_TPDL_VAFFINE_OK};
3553             pdl_transvtable pdl_clusterdistance_vtable = {
3554             0,0, 7, 8, pdl_clusterdistance_vtable_flags,
3555             pdl_clusterdistance_redodims, pdl_clusterdistance_readdata, NULL,
3556             pdl_clusterdistance_free,NULL,NULL,pdl_clusterdistance_copy,
3557             sizeof(pdl_clusterdistance_struct),"pdl_clusterdistance_vtable"
3558             };
3559              
3560             typedef struct pdl_distancematrix_struct {
3561             PDL_TRANS_START(4);
3562             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_dists_n0;PDL_Indx __inc_dists_n1;PDL_Indx __d_size;PDL_Indx __n_size;
3563             char *distFlag;
3564             char __ddone; PDL_COMMENT("Dims done")
3565             } pdl_distancematrix_struct;
3566              
3567 1           void pdl_distancematrix_redodims(pdl_trans *__tr ) {
3568             int __dim;
3569 1           pdl_distancematrix_struct *__privtrans = (pdl_distancematrix_struct *) __tr;
3570            
3571             {
3572             PDL_Indx __creating[4];
3573 1           __privtrans->__d_size = -1;
3574 1           __privtrans->__n_size = -1;
3575 1           __creating[0] = 0;
3576 1           __creating[1] = 0;
3577 1           __creating[2] = 0;
3578 1 50         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    50          
3579             {
3580             {PDL_COMMENT("Start generic loop")
3581              
3582 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
3583 0           } break; case PDL_B: {
3584 1 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3585 1           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3586              
3587 1 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3588 1           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3589              
3590 1 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3591 1           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3592              
3593 1 50         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3594 1           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3595              
3596 1           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3597 1           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3598 1           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3599 1           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3600 1           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3601 1           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3602 1           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3603              
3604             PDL_COMMENT("none")
3605 1           } } break; case PDL_S: {
3606 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3607 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3608              
3609 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3610 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3611              
3612 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3613 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3614              
3615 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3616 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3617              
3618 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3619 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3620 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3621 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3622 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3623 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3624 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3625              
3626             PDL_COMMENT("none")
3627 0           } } break; case PDL_US: {
3628 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3629 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3630              
3631 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3632 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3633              
3634 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3635 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3636              
3637 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3638 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3639              
3640 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3641 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3642 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3643 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3644 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3645 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3646 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3647              
3648             PDL_COMMENT("none")
3649 0           } } break; case PDL_L: {
3650 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3651 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3652              
3653 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3654 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3655              
3656 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3657 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3658              
3659 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3660 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3661              
3662 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3663 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3664 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3665 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3666 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3667 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3668 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3669              
3670             PDL_COMMENT("none")
3671 0           } } break; case PDL_IND: {
3672 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3673 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3674              
3675 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3676 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3677              
3678 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3679 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3680              
3681 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3682 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3683              
3684 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3685 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3686 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3687 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3688 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3689 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3690 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3691              
3692             PDL_COMMENT("none")
3693 0           } } break; case PDL_LL: {
3694 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3695 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3696              
3697 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3698 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3699              
3700 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3701 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3702              
3703 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3704 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3705              
3706 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3707 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3708 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3709 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3710 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3711 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3712 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3713              
3714             PDL_COMMENT("none")
3715 0           } } break; case PDL_F: {
3716 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3717 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3718              
3719 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3720 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3721              
3722 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3723 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3724              
3725 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3726 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3727              
3728 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3729 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3730 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3731 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3732 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3733 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3734 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3735              
3736             PDL_COMMENT("none")
3737 0           } } break; case PDL_D: {
3738 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3739 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3740              
3741 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3742 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3743              
3744 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3745 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3746              
3747 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3748 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3749              
3750 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3751 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3752 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3753 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3754 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3755 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3756 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
3757              
3758             PDL_COMMENT("none")
3759 0           } break;}
3760 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
3761             }
3762             }
3763             {
3764             static char *__parnames[] = {"data","mask","weight","dists"};
3765             static PDL_Indx __realdims[] = {2,2,1,2};
3766             static char __funcname[] = "PDL::Cluster::distancematrix";
3767             static pdl_errorinfo __einfo = {
3768             __funcname, __parnames, 4
3769             };
3770            
3771 1           PDL->initthreadstruct(2,__privtrans->pdls,
3772             __realdims,__creating,4,
3773             &__einfo,&(__privtrans->__pdlthread),
3774 1           __privtrans->vtable->per_pdl_flags,
3775             0 );
3776             }
3777 1 50         if(((__privtrans->pdls[0]))->ndims < 2) {
3778 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
3779 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
3780             }
3781 1 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
3782 1           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
3783 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
3784 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
3785 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3786             }
3787             }
3788 1 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
3789 1           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
3790 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
3791 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
3792 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3793             }
3794             }
3795 1           PDL->make_physical(((__privtrans->pdls[0])));
3796 1 50         if(((__privtrans->pdls[1]))->ndims < 2) {
3797 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
3798 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
3799             }
3800 1 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
3801 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
3802 1 50         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    50          
3803 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
3804 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3805             }
3806             }
3807 1 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
3808 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
3809 1 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
3810 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
3811 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3812             }
3813             }
3814 1           PDL->make_physical(((__privtrans->pdls[1])));
3815 1 50         if(((__privtrans->pdls[2]))->ndims < 1) {
3816 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
3817             }
3818 1 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
3819 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
3820 1 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
3821 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
3822 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3823             }
3824             }
3825 1           PDL->make_physical(((__privtrans->pdls[2])));
3826 1 50         if(!__creating[3]) {
3827 0 0         if(((__privtrans->pdls[3]))->ndims < 2) {
3828 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
3829 0 0         if (((__privtrans->pdls[3]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
3830             }
3831 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
3832 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[0];
3833 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
3834 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
3835 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3836             }
3837             }
3838 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
3839 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[1];
3840 0 0         } else if(((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[1]) {
    0          
3841 0 0         if(((__privtrans->pdls[3]))->dims[1] != 1) {
3842 0           PDL->pdl_barf("Error in distancematrix:" "Wrong dims\n");
3843             }
3844             }
3845 0           PDL->make_physical(((__privtrans->pdls[3])));
3846             } else {
3847 1           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;dims[1] = __privtrans->__n_size;
3848 1           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
3849             }
3850             { PDL_COMMENT("convenience block")
3851 1           void *hdrp = NULL;
3852 1           char propagate_hdrcpy = 0;
3853 1           SV *hdr_copy = NULL;
3854 1 50         if(!hdrp &&
    50          
3855 0 0         __privtrans->pdls[0]->hdrsv &&
3856 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
3857             ) {
3858 0           hdrp = __privtrans->pdls[0]->hdrsv;
3859 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
3860             }
3861 1 50         if(!hdrp &&
    50          
3862 0 0         __privtrans->pdls[1]->hdrsv &&
3863 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
3864             ) {
3865 0           hdrp = __privtrans->pdls[1]->hdrsv;
3866 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
3867             }
3868 1 50         if(!hdrp &&
    50          
3869 0 0         __privtrans->pdls[2]->hdrsv &&
3870 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
3871             ) {
3872 0           hdrp = __privtrans->pdls[2]->hdrsv;
3873 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
3874             }
3875 1 50         if(!hdrp &&
    50          
3876 0 0         !__creating[3] &&
3877 0 0         __privtrans->pdls[3]->hdrsv &&
3878 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
3879             ) {
3880 0           hdrp = __privtrans->pdls[3]->hdrsv;
3881 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
3882             }
3883 1 50         if (hdrp) {
3884 0 0         if(hdrp == &PL_sv_undef)
3885 0           hdr_copy = &PL_sv_undef;
3886             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
3887             int count;
3888             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
3889 0           dSP;
3890 0           ENTER ;
3891 0           SAVETMPS ;
3892 0 0         PUSHMARK(SP) ;
3893 0 0         XPUSHs( hdrp );
3894 0           PUTBACK ;
3895 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
3896 0           SPAGAIN ;
3897 0 0         if(count != 1)
3898 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
3899              
3900 0           hdr_copy = (SV *)POPs;
3901              
3902 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
3903 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
3904             }
3905              
3906 0 0         FREETMPS ;
3907 0           LEAVE ;
3908              
3909              
3910             } PDL_COMMENT("end of callback block")
3911              
3912 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
3913 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
3914 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
3915 0 0         if( hdr_copy != &PL_sv_undef )
3916 0           (void)SvREFCNT_inc(hdr_copy);
3917 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
3918             }
3919 0 0         if(propagate_hdrcpy)
3920 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
3921              
3922 0 0         if(hdr_copy != &PL_sv_undef)
3923 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
3924             } PDL_COMMENT("end of if(hdrp) block")
3925             } PDL_COMMENT("end of conv. block")
3926 1 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
3927 0           __privtrans->__inc_data_d = 0; else
3928 1 50         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    50          
3929 0           __privtrans->__inc_data_n = 0; else
3930 1 50         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
3931 0           __privtrans->__inc_mask_d = 0; else
3932 1 50         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
3933 0           __privtrans->__inc_mask_n = 0; else
3934 1 50         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
3935 0           __privtrans->__inc_weight_d = 0; else
3936 1 50         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
3937 0           __privtrans->__inc_dists_n0 = 0; else
3938 1 50         __privtrans->__inc_dists_n0 = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 1 || __privtrans->pdls[3]->dims[1] <= 1)
    50          
3939 0           __privtrans->__inc_dists_n1 = 0; else
3940 1           __privtrans->__inc_dists_n1 = __privtrans->pdls[3]->dimincs[1]; __privtrans->__ddone = 1;
3941             }
3942 1           }
3943            
3944              
3945 0           pdl_trans * pdl_distancematrix_copy(pdl_trans *__tr ) {
3946             int __dim;
3947 0           pdl_distancematrix_struct *__privtrans = (pdl_distancematrix_struct *) __tr;
3948            
3949             {
3950 0           pdl_distancematrix_struct *__copy = malloc(sizeof(pdl_distancematrix_struct));
3951 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
3952 0           __copy->has_badvalue = __privtrans->has_badvalue;
3953 0           __copy->badvalue = __privtrans->badvalue;
3954 0           __copy->flags = __privtrans->flags;
3955 0           __copy->vtable = __privtrans->vtable;
3956 0           __copy->__datatype = __privtrans->__datatype;
3957 0           __copy->freeproc = NULL;
3958 0           __copy->__ddone = __privtrans->__ddone;
3959             {int i;
3960 0 0         for(i=0; i<__copy->vtable->npdls; i++)
3961 0           __copy->pdls[i] = __privtrans->pdls[i];
3962             }
3963 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;
3964 0 0         if(__copy->__ddone) {
3965 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_dists_n0=__copy->__inc_dists_n0;__privtrans->__inc_dists_n1=__copy->__inc_dists_n1;__copy->__d_size=__privtrans->__d_size;__copy->__n_size=__privtrans->__n_size;
3966             }
3967 0           return (pdl_trans*)__copy;
3968             }
3969             }
3970            
3971              
3972 1           void pdl_distancematrix_readdata(pdl_trans *__tr ) {
3973             int __dim;
3974 1           pdl_distancematrix_struct *__privtrans = (pdl_distancematrix_struct *) __tr;
3975            
3976             {
3977             {PDL_COMMENT("Start generic loop")
3978              
3979 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
3980 0           } break; case PDL_B: {
3981 1 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
3982 1           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
3983              
3984 1 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
3985 1           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
3986              
3987 1 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
3988 1           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
3989              
3990 1 50         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
3991 1           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
3992              
3993 1           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
3994 1           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
3995 1           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
3996 1           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
3997 1           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
3998 1           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
3999 1           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4000              
4001              
4002 1           int transpose = 0;
4003 1           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4004 1           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4005             double **retval;
4006            
4007             PDL_COMMENT("THREADLOOPBEGIN")
4008 1 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4009 1           do { register PDL_Indx __tind1=0,__tind2=0;
4010 1           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4011 1           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4012 1           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4013 1           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4014 1           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4015 1           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4016 1           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4017 1           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4018 1           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4019 1           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4020 1           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4021 1           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4022 1           data_datap += __offsp[0];
4023 1           mask_datap += __offsp[1];
4024 1           weight_datap += __offsp[2];
4025 1           dists_datap += __offsp[3];
4026 2 100         for( __tind2 = 0 ;
4027             __tind2 < __tdims1 ;
4028 1           __tind2++
4029 1           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4030 1           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4031 1           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4032 1           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4033             )
4034             {
4035 2 100         for( __tind1 = 0 ;
4036             __tind1 < __tdims0 ;
4037 1           __tind1++
4038 1           ,data_datap += __tinc0_0
4039 1           ,mask_datap += __tinc0_1
4040 1           ,weight_datap += __tinc0_2
4041 1           ,dists_datap += __tinc0_3
4042             )
4043             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4044 1           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4045 1           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4046 1           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4047 1           weight_datap, *__privtrans->distFlag, transpose);
4048 1 50         if (!retval) barf("Cluster matrix allocation failed!");
4049 1           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4050 1 50         if (retval) free(retval);
4051            
4052             PDL_COMMENT("THREADLOOPEND")
4053             }
4054             }
4055 1           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4056 1           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4057 1           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4058 1           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4059 1 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4060             /*-- cleanup --*/
4061 1 50         if (datapp) free(datapp);
4062 1 50         if (maskpp) free(maskpp);
4063              
4064 1           } } break; case PDL_S: {
4065 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4066 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4067              
4068 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4069 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4070              
4071 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4072 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4073              
4074 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4075 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4076              
4077 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4078 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4079 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4080 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4081 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4082 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4083 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4084              
4085              
4086 0           int transpose = 0;
4087 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4088 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4089             double **retval;
4090            
4091             PDL_COMMENT("THREADLOOPBEGIN")
4092 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4093 0           do { register PDL_Indx __tind1=0,__tind2=0;
4094 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4095 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4096 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4097 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4098 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4099 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4100 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4101 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4102 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4103 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4104 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4105 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4106 0           data_datap += __offsp[0];
4107 0           mask_datap += __offsp[1];
4108 0           weight_datap += __offsp[2];
4109 0           dists_datap += __offsp[3];
4110 0 0         for( __tind2 = 0 ;
4111             __tind2 < __tdims1 ;
4112 0           __tind2++
4113 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4114 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4115 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4116 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4117             )
4118             {
4119 0 0         for( __tind1 = 0 ;
4120             __tind1 < __tdims0 ;
4121 0           __tind1++
4122 0           ,data_datap += __tinc0_0
4123 0           ,mask_datap += __tinc0_1
4124 0           ,weight_datap += __tinc0_2
4125 0           ,dists_datap += __tinc0_3
4126             )
4127             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4128 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4129 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4130 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4131 0           weight_datap, *__privtrans->distFlag, transpose);
4132 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4133 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4134 0 0         if (retval) free(retval);
4135            
4136             PDL_COMMENT("THREADLOOPEND")
4137             }
4138             }
4139 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4140 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4141 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4142 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4143 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4144             /*-- cleanup --*/
4145 0 0         if (datapp) free(datapp);
4146 0 0         if (maskpp) free(maskpp);
4147              
4148 0           } } break; case PDL_US: {
4149 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4150 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4151              
4152 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4153 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4154              
4155 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4156 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4157              
4158 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4159 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4160              
4161 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4162 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4163 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4164 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4165 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4166 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4167 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4168              
4169              
4170 0           int transpose = 0;
4171 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4172 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4173             double **retval;
4174            
4175             PDL_COMMENT("THREADLOOPBEGIN")
4176 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4177 0           do { register PDL_Indx __tind1=0,__tind2=0;
4178 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4179 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4180 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4181 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4182 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4183 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4184 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4185 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4186 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4187 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4188 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4189 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4190 0           data_datap += __offsp[0];
4191 0           mask_datap += __offsp[1];
4192 0           weight_datap += __offsp[2];
4193 0           dists_datap += __offsp[3];
4194 0 0         for( __tind2 = 0 ;
4195             __tind2 < __tdims1 ;
4196 0           __tind2++
4197 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4198 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4199 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4200 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4201             )
4202             {
4203 0 0         for( __tind1 = 0 ;
4204             __tind1 < __tdims0 ;
4205 0           __tind1++
4206 0           ,data_datap += __tinc0_0
4207 0           ,mask_datap += __tinc0_1
4208 0           ,weight_datap += __tinc0_2
4209 0           ,dists_datap += __tinc0_3
4210             )
4211             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4212 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4213 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4214 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4215 0           weight_datap, *__privtrans->distFlag, transpose);
4216 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4217 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4218 0 0         if (retval) free(retval);
4219            
4220             PDL_COMMENT("THREADLOOPEND")
4221             }
4222             }
4223 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4224 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4225 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4226 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4227 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4228             /*-- cleanup --*/
4229 0 0         if (datapp) free(datapp);
4230 0 0         if (maskpp) free(maskpp);
4231              
4232 0           } } break; case PDL_L: {
4233 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4234 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4235              
4236 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4237 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4238              
4239 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4240 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4241              
4242 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4243 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4244              
4245 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4246 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4247 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4248 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4249 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4250 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4251 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4252              
4253              
4254 0           int transpose = 0;
4255 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4256 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4257             double **retval;
4258            
4259             PDL_COMMENT("THREADLOOPBEGIN")
4260 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4261 0           do { register PDL_Indx __tind1=0,__tind2=0;
4262 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4263 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4264 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4265 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4266 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4267 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4268 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4269 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4270 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4271 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4272 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4273 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4274 0           data_datap += __offsp[0];
4275 0           mask_datap += __offsp[1];
4276 0           weight_datap += __offsp[2];
4277 0           dists_datap += __offsp[3];
4278 0 0         for( __tind2 = 0 ;
4279             __tind2 < __tdims1 ;
4280 0           __tind2++
4281 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4282 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4283 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4284 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4285             )
4286             {
4287 0 0         for( __tind1 = 0 ;
4288             __tind1 < __tdims0 ;
4289 0           __tind1++
4290 0           ,data_datap += __tinc0_0
4291 0           ,mask_datap += __tinc0_1
4292 0           ,weight_datap += __tinc0_2
4293 0           ,dists_datap += __tinc0_3
4294             )
4295             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4296 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4297 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4298 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4299 0           weight_datap, *__privtrans->distFlag, transpose);
4300 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4301 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4302 0 0         if (retval) free(retval);
4303            
4304             PDL_COMMENT("THREADLOOPEND")
4305             }
4306             }
4307 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4308 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4309 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4310 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4311 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4312             /*-- cleanup --*/
4313 0 0         if (datapp) free(datapp);
4314 0 0         if (maskpp) free(maskpp);
4315              
4316 0           } } break; case PDL_IND: {
4317 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4318 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4319              
4320 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4321 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4322              
4323 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4324 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4325              
4326 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4327 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4328              
4329 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4330 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4331 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4332 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4333 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4334 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4335 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4336              
4337              
4338 0           int transpose = 0;
4339 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4340 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4341             double **retval;
4342            
4343             PDL_COMMENT("THREADLOOPBEGIN")
4344 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4345 0           do { register PDL_Indx __tind1=0,__tind2=0;
4346 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4347 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4348 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4349 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4350 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4351 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4352 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4353 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4354 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4355 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4356 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4357 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4358 0           data_datap += __offsp[0];
4359 0           mask_datap += __offsp[1];
4360 0           weight_datap += __offsp[2];
4361 0           dists_datap += __offsp[3];
4362 0 0         for( __tind2 = 0 ;
4363             __tind2 < __tdims1 ;
4364 0           __tind2++
4365 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4366 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4367 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4368 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4369             )
4370             {
4371 0 0         for( __tind1 = 0 ;
4372             __tind1 < __tdims0 ;
4373 0           __tind1++
4374 0           ,data_datap += __tinc0_0
4375 0           ,mask_datap += __tinc0_1
4376 0           ,weight_datap += __tinc0_2
4377 0           ,dists_datap += __tinc0_3
4378             )
4379             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4380 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4381 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4382 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4383 0           weight_datap, *__privtrans->distFlag, transpose);
4384 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4385 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4386 0 0         if (retval) free(retval);
4387            
4388             PDL_COMMENT("THREADLOOPEND")
4389             }
4390             }
4391 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4392 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4393 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4394 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4395 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4396             /*-- cleanup --*/
4397 0 0         if (datapp) free(datapp);
4398 0 0         if (maskpp) free(maskpp);
4399              
4400 0           } } break; case PDL_LL: {
4401 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4402 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4403              
4404 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4405 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4406              
4407 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4408 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4409              
4410 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4411 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4412              
4413 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4414 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4415 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4416 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4417 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4418 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4419 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4420              
4421              
4422 0           int transpose = 0;
4423 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4424 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4425             double **retval;
4426            
4427             PDL_COMMENT("THREADLOOPBEGIN")
4428 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4429 0           do { register PDL_Indx __tind1=0,__tind2=0;
4430 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4431 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4432 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4433 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4434 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4435 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4436 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4437 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4438 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4439 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4440 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4441 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4442 0           data_datap += __offsp[0];
4443 0           mask_datap += __offsp[1];
4444 0           weight_datap += __offsp[2];
4445 0           dists_datap += __offsp[3];
4446 0 0         for( __tind2 = 0 ;
4447             __tind2 < __tdims1 ;
4448 0           __tind2++
4449 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4450 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4451 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4452 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4453             )
4454             {
4455 0 0         for( __tind1 = 0 ;
4456             __tind1 < __tdims0 ;
4457 0           __tind1++
4458 0           ,data_datap += __tinc0_0
4459 0           ,mask_datap += __tinc0_1
4460 0           ,weight_datap += __tinc0_2
4461 0           ,dists_datap += __tinc0_3
4462             )
4463             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4464 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4465 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4466 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4467 0           weight_datap, *__privtrans->distFlag, transpose);
4468 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4469 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4470 0 0         if (retval) free(retval);
4471            
4472             PDL_COMMENT("THREADLOOPEND")
4473             }
4474             }
4475 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4476 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4477 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4478 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4479 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4480             /*-- cleanup --*/
4481 0 0         if (datapp) free(datapp);
4482 0 0         if (maskpp) free(maskpp);
4483              
4484 0           } } break; case PDL_F: {
4485 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4486 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4487              
4488 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4489 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4490              
4491 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4492 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4493              
4494 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4495 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4496              
4497 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4498 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4499 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4500 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4501 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4502 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4503 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4504              
4505              
4506 0           int transpose = 0;
4507 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4508 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4509             double **retval;
4510            
4511             PDL_COMMENT("THREADLOOPBEGIN")
4512 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4513 0           do { register PDL_Indx __tind1=0,__tind2=0;
4514 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4515 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4516 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4517 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4518 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4519 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4520 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4521 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4522 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4523 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4524 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4525 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4526 0           data_datap += __offsp[0];
4527 0           mask_datap += __offsp[1];
4528 0           weight_datap += __offsp[2];
4529 0           dists_datap += __offsp[3];
4530 0 0         for( __tind2 = 0 ;
4531             __tind2 < __tdims1 ;
4532 0           __tind2++
4533 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4534 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4535 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4536 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4537             )
4538             {
4539 0 0         for( __tind1 = 0 ;
4540             __tind1 < __tdims0 ;
4541 0           __tind1++
4542 0           ,data_datap += __tinc0_0
4543 0           ,mask_datap += __tinc0_1
4544 0           ,weight_datap += __tinc0_2
4545 0           ,dists_datap += __tinc0_3
4546             )
4547             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4548 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4549 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4550 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4551 0           weight_datap, *__privtrans->distFlag, transpose);
4552 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4553 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4554 0 0         if (retval) free(retval);
4555            
4556             PDL_COMMENT("THREADLOOPEND")
4557             }
4558             }
4559 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4560 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4561 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4562 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4563 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4564             /*-- cleanup --*/
4565 0 0         if (datapp) free(datapp);
4566 0 0         if (maskpp) free(maskpp);
4567              
4568 0           } } break; case PDL_D: {
4569 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4570 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4571              
4572 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4573 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4574              
4575 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4576 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
4577              
4578 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4579 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4580              
4581 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4582 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4583 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
4584 0           register PDL_Indx __inc_dists_n0 = __privtrans->__inc_dists_n0;
4585 0           register PDL_Indx __inc_dists_n1 = __privtrans->__inc_dists_n1;
4586 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4587 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4588              
4589              
4590 0           int transpose = 0;
4591 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
4592 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
4593             double **retval;
4594            
4595             PDL_COMMENT("THREADLOOPBEGIN")
4596 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
4597 0           do { register PDL_Indx __tind1=0,__tind2=0;
4598 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
4599 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
4600 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
4601 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
4602 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
4603 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
4604 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
4605 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
4606 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
4607 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
4608 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
4609 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
4610 0           data_datap += __offsp[0];
4611 0           mask_datap += __offsp[1];
4612 0           weight_datap += __offsp[2];
4613 0           dists_datap += __offsp[3];
4614 0 0         for( __tind2 = 0 ;
4615             __tind2 < __tdims1 ;
4616 0           __tind2++
4617 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
4618 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
4619 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
4620 0           ,dists_datap += __tinc1_3 - __tinc0_3 * __tdims0
4621             )
4622             {
4623 0 0         for( __tind1 = 0 ;
4624             __tind1 < __tdims0 ;
4625 0           __tind1++
4626 0           ,data_datap += __tinc0_0
4627 0           ,mask_datap += __tinc0_1
4628 0           ,weight_datap += __tinc0_2
4629 0           ,dists_datap += __tinc0_3
4630             )
4631             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
4632 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
4633 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
4634 0           retval = distancematrix(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
4635 0           weight_datap, *__privtrans->distFlag, transpose);
4636 0 0         if (!retval) barf("Cluster matrix allocation failed!");
4637 0           pp2pdl_ragged_dbl(__privtrans->__n_size, __privtrans->__n_size, retval, dists_datap);
4638 0 0         if (retval) free(retval);
4639            
4640             PDL_COMMENT("THREADLOOPEND")
4641             }
4642             }
4643 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
4644 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
4645 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
4646 0           dists_datap -= __tinc1_3 * __tdims1 + __offsp[3];
4647 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
4648             /*-- cleanup --*/
4649 0 0         if (datapp) free(datapp);
4650 0 0         if (maskpp) free(maskpp);
4651              
4652 0           } break;}
4653 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
4654             }
4655             }
4656             }
4657            
4658              
4659              
4660              
4661 1           void pdl_distancematrix_free(pdl_trans *__tr ) {
4662             int __dim;
4663 1           pdl_distancematrix_struct *__privtrans = (pdl_distancematrix_struct *) __tr;
4664            
4665             {
4666            
4667 1           PDL_TR_CLRMAGIC(__privtrans);
4668 1           free(__privtrans->distFlag);;
4669 1 50         if(__privtrans->__ddone) {
4670 1           PDL->freethreadloop(&(__privtrans->__pdlthread));
4671             ;;;;;;;;;;
4672             }
4673            
4674             }
4675 1           }
4676            
4677              
4678              
4679              
4680             static char pdl_distancematrix_vtable_flags[] =
4681             { 0,0,0,0};
4682             pdl_transvtable pdl_distancematrix_vtable = {
4683             0,0, 3, 4, pdl_distancematrix_vtable_flags,
4684             pdl_distancematrix_redodims, pdl_distancematrix_readdata, NULL,
4685             pdl_distancematrix_free,NULL,NULL,pdl_distancematrix_copy,
4686             sizeof(pdl_distancematrix_struct),"pdl_distancematrix_vtable"
4687             };
4688              
4689             typedef struct pdl_getclustercentroids_struct {
4690             PDL_TRANS_START(5);
4691             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_clusterids_n;PDL_Indx __inc_cdata_d;PDL_Indx __inc_cdata_k;PDL_Indx __inc_cmask_d;PDL_Indx __inc_cmask_k;PDL_Indx __d_size;PDL_Indx __k_size;PDL_Indx __n_size;
4692             char *ctrMethodFlag;
4693             char __ddone; PDL_COMMENT("Dims done")
4694             } pdl_getclustercentroids_struct;
4695              
4696 0           void pdl_getclustercentroids_redodims(pdl_trans *__tr ) {
4697             int __dim;
4698 0           pdl_getclustercentroids_struct *__privtrans = (pdl_getclustercentroids_struct *) __tr;
4699            
4700             {
4701             PDL_Indx __creating[5];
4702 0           __privtrans->__d_size = -1;
4703 0           __privtrans->__k_size = -1;
4704 0           __privtrans->__n_size = -1;
4705 0           __creating[0] = 0;
4706 0           __creating[1] = 0;
4707 0           __creating[2] = 0;
4708 0 0         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    0          
4709 0 0         __creating[4] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[4]);
    0          
4710             {
4711             {PDL_COMMENT("Start generic loop")
4712              
4713 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
4714 0           } break; case PDL_B: {
4715 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4716 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4717              
4718 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4719 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4720              
4721 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4722 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4723              
4724 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4725 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4726              
4727 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4728 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4729              
4730 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4731 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4732 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4733 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4734 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4735 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4736 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4737 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4738 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4739              
4740             PDL_COMMENT("none")
4741 0           } } break; case PDL_S: {
4742 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4743 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4744              
4745 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4746 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4747              
4748 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4749 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4750              
4751 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4752 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4753              
4754 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4755 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4756              
4757 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4758 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4759 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4760 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4761 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4762 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4763 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4764 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4765 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4766              
4767             PDL_COMMENT("none")
4768 0           } } break; case PDL_US: {
4769 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4770 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4771              
4772 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4773 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4774              
4775 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4776 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4777              
4778 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4779 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4780              
4781 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4782 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4783              
4784 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4785 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4786 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4787 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4788 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4789 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4790 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4791 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4792 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4793              
4794             PDL_COMMENT("none")
4795 0           } } break; case PDL_L: {
4796 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4797 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4798              
4799 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4800 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4801              
4802 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4803 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4804              
4805 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4806 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4807              
4808 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4809 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4810              
4811 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4812 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4813 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4814 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4815 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4816 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4817 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4818 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4819 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4820              
4821             PDL_COMMENT("none")
4822 0           } } break; case PDL_IND: {
4823 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4824 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4825              
4826 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4827 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4828              
4829 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4830 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4831              
4832 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4833 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4834              
4835 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4836 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4837              
4838 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4839 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4840 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4841 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4842 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4843 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4844 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4845 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4846 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4847              
4848             PDL_COMMENT("none")
4849 0           } } break; case PDL_LL: {
4850 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4851 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4852              
4853 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4854 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4855              
4856 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4857 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4858              
4859 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4860 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4861              
4862 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4863 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4864              
4865 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4866 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4867 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4868 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4869 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4870 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4871 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4872 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4873 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4874              
4875             PDL_COMMENT("none")
4876 0           } } break; case PDL_F: {
4877 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4878 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4879              
4880 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4881 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4882              
4883 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4884 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4885              
4886 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4887 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4888              
4889 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4890 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4891              
4892 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4893 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4894 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4895 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4896 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4897 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4898 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4899 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4900 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4901              
4902             PDL_COMMENT("none")
4903 0           } } break; case PDL_D: {
4904 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
4905 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
4906              
4907 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
4908 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
4909              
4910 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
4911 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
4912              
4913 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
4914 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
4915              
4916 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
4917 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
4918              
4919 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
4920 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
4921 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
4922 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
4923 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
4924 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
4925 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
4926 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
4927 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
4928              
4929             PDL_COMMENT("none")
4930 0           } break;}
4931 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
4932             }
4933             }
4934             {
4935             static char *__parnames[] = {"data","mask","clusterids","cdata","cmask"};
4936             static PDL_Indx __realdims[] = {2,2,1,2,2};
4937             static char __funcname[] = "PDL::Cluster::getclustercentroids";
4938             static pdl_errorinfo __einfo = {
4939             __funcname, __parnames, 5
4940             };
4941            
4942 0           PDL->initthreadstruct(2,__privtrans->pdls,
4943             __realdims,__creating,5,
4944             &__einfo,&(__privtrans->__pdlthread),
4945 0           __privtrans->vtable->per_pdl_flags,
4946             0 );
4947             }
4948 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
4949 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
4950 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
4951             }
4952 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
4953 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
4954 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
4955 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
4956 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
4957             }
4958             }
4959 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
4960 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
4961 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
4962 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
4963 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
4964             }
4965             }
4966 0           PDL->make_physical(((__privtrans->pdls[0])));
4967 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
4968 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
4969 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
4970             }
4971 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
4972 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
4973 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
4974 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
4975 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
4976             }
4977             }
4978 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
4979 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
4980 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
4981 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
4982 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
4983             }
4984             }
4985 0           PDL->make_physical(((__privtrans->pdls[1])));
4986 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
4987 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
4988             }
4989 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
4990 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[0];
4991 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
4992 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
4993 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
4994             }
4995             }
4996 0           PDL->make_physical(((__privtrans->pdls[2])));
4997 0 0         if(!__creating[3]) {
4998 0 0         if(((__privtrans->pdls[3]))->ndims < 2) {
4999 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
5000 0 0         if (((__privtrans->pdls[3]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
5001             }
5002 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
5003 0           __privtrans->__d_size = ((__privtrans->pdls[3]))->dims[0];
5004 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
5005 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
5006 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
5007             }
5008             }
5009 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
5010 0           __privtrans->__k_size = ((__privtrans->pdls[3]))->dims[1];
5011 0 0         } else if(((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[3]))->dims[1]) {
    0          
5012 0 0         if(((__privtrans->pdls[3]))->dims[1] != 1) {
5013 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
5014             }
5015             }
5016 0           PDL->make_physical(((__privtrans->pdls[3])));
5017             } else {
5018 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__k_size;
5019 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
5020 0 0         }if(!__creating[4]) {
5021 0 0         if(((__privtrans->pdls[4]))->ndims < 2) {
5022 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
5023 0 0         if (((__privtrans->pdls[4]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
5024             }
5025 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
5026 0           __privtrans->__d_size = ((__privtrans->pdls[4]))->dims[0];
5027 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
5028 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
5029 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
5030             }
5031             }
5032 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
5033 0           __privtrans->__k_size = ((__privtrans->pdls[4]))->dims[1];
5034 0 0         } else if(((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[4]))->dims[1]) {
    0          
5035 0 0         if(((__privtrans->pdls[4]))->dims[1] != 1) {
5036 0           PDL->pdl_barf("Error in getclustercentroids:" "Wrong dims\n");
5037             }
5038             }
5039 0           PDL->make_physical(((__privtrans->pdls[4])));
5040             } else {
5041 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__k_size;
5042 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,4,dims,0);
5043             }
5044             { PDL_COMMENT("convenience block")
5045 0           void *hdrp = NULL;
5046 0           char propagate_hdrcpy = 0;
5047 0           SV *hdr_copy = NULL;
5048 0 0         if(!hdrp &&
    0          
5049 0 0         __privtrans->pdls[0]->hdrsv &&
5050 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
5051             ) {
5052 0           hdrp = __privtrans->pdls[0]->hdrsv;
5053 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
5054             }
5055 0 0         if(!hdrp &&
    0          
5056 0 0         __privtrans->pdls[1]->hdrsv &&
5057 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
5058             ) {
5059 0           hdrp = __privtrans->pdls[1]->hdrsv;
5060 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
5061             }
5062 0 0         if(!hdrp &&
    0          
5063 0 0         __privtrans->pdls[2]->hdrsv &&
5064 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
5065             ) {
5066 0           hdrp = __privtrans->pdls[2]->hdrsv;
5067 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
5068             }
5069 0 0         if(!hdrp &&
    0          
5070 0 0         !__creating[3] &&
5071 0 0         __privtrans->pdls[3]->hdrsv &&
5072 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
5073             ) {
5074 0           hdrp = __privtrans->pdls[3]->hdrsv;
5075 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
5076             }
5077 0 0         if(!hdrp &&
    0          
5078 0 0         !__creating[4] &&
5079 0 0         __privtrans->pdls[4]->hdrsv &&
5080 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
5081             ) {
5082 0           hdrp = __privtrans->pdls[4]->hdrsv;
5083 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
5084             }
5085 0 0         if (hdrp) {
5086 0 0         if(hdrp == &PL_sv_undef)
5087 0           hdr_copy = &PL_sv_undef;
5088             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
5089             int count;
5090             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
5091 0           dSP;
5092 0           ENTER ;
5093 0           SAVETMPS ;
5094 0 0         PUSHMARK(SP) ;
5095 0 0         XPUSHs( hdrp );
5096 0           PUTBACK ;
5097 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
5098 0           SPAGAIN ;
5099 0 0         if(count != 1)
5100 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
5101              
5102 0           hdr_copy = (SV *)POPs;
5103              
5104 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
5105 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
5106             }
5107              
5108 0 0         FREETMPS ;
5109 0           LEAVE ;
5110              
5111              
5112             } PDL_COMMENT("end of callback block")
5113              
5114 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
5115 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
5116 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
5117 0 0         if( hdr_copy != &PL_sv_undef )
5118 0           (void)SvREFCNT_inc(hdr_copy);
5119 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
5120             }
5121 0 0         if(propagate_hdrcpy)
5122 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
5123 0 0         if ( __privtrans->pdls[4]->hdrsv != hdrp ){
5124 0 0         if( __privtrans->pdls[4]->hdrsv && __privtrans->pdls[4]->hdrsv != &PL_sv_undef)
    0          
5125 0           (void)SvREFCNT_dec( __privtrans->pdls[4]->hdrsv );
5126 0 0         if( hdr_copy != &PL_sv_undef )
5127 0           (void)SvREFCNT_inc(hdr_copy);
5128 0           __privtrans->pdls[4]->hdrsv = hdr_copy;
5129             }
5130 0 0         if(propagate_hdrcpy)
5131 0           __privtrans->pdls[4]->state |= PDL_HDRCPY;
5132              
5133 0 0         if(hdr_copy != &PL_sv_undef)
5134 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
5135             } PDL_COMMENT("end of if(hdrp) block")
5136             } PDL_COMMENT("end of conv. block")
5137 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
5138 0           __privtrans->__inc_data_d = 0; else
5139 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
5140 0           __privtrans->__inc_data_n = 0; else
5141 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
5142 0           __privtrans->__inc_mask_d = 0; else
5143 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
5144 0           __privtrans->__inc_mask_n = 0; else
5145 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
5146 0           __privtrans->__inc_clusterids_n = 0; else
5147 0 0         __privtrans->__inc_clusterids_n = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
5148 0           __privtrans->__inc_cdata_d = 0; else
5149 0 0         __privtrans->__inc_cdata_d = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 1 || __privtrans->pdls[3]->dims[1] <= 1)
    0          
5150 0           __privtrans->__inc_cdata_k = 0; else
5151 0 0         __privtrans->__inc_cdata_k = __privtrans->pdls[3]->dimincs[1];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
5152 0           __privtrans->__inc_cmask_d = 0; else
5153 0 0         __privtrans->__inc_cmask_d = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 1 || __privtrans->pdls[4]->dims[1] <= 1)
    0          
5154 0           __privtrans->__inc_cmask_k = 0; else
5155 0           __privtrans->__inc_cmask_k = __privtrans->pdls[4]->dimincs[1]; __privtrans->__ddone = 1;
5156             }
5157 0           }
5158            
5159              
5160 0           pdl_trans * pdl_getclustercentroids_copy(pdl_trans *__tr ) {
5161             int __dim;
5162 0           pdl_getclustercentroids_struct *__privtrans = (pdl_getclustercentroids_struct *) __tr;
5163            
5164             {
5165 0           pdl_getclustercentroids_struct *__copy = malloc(sizeof(pdl_getclustercentroids_struct));
5166 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
5167 0           __copy->has_badvalue = __privtrans->has_badvalue;
5168 0           __copy->badvalue = __privtrans->badvalue;
5169 0           __copy->flags = __privtrans->flags;
5170 0           __copy->vtable = __privtrans->vtable;
5171 0           __copy->__datatype = __privtrans->__datatype;
5172 0           __copy->freeproc = NULL;
5173 0           __copy->__ddone = __privtrans->__ddone;
5174             {int i;
5175 0 0         for(i=0; i<__copy->vtable->npdls; i++)
5176 0           __copy->pdls[i] = __privtrans->pdls[i];
5177             }
5178 0           (__copy->ctrMethodFlag) = malloc(strlen(__privtrans->ctrMethodFlag)+1); strcpy(__copy->ctrMethodFlag,__privtrans->ctrMethodFlag);;
5179 0 0         if(__copy->__ddone) {
5180 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__privtrans->__inc_cdata_d=__copy->__inc_cdata_d;__privtrans->__inc_cdata_k=__copy->__inc_cdata_k;__privtrans->__inc_cmask_d=__copy->__inc_cmask_d;__privtrans->__inc_cmask_k=__copy->__inc_cmask_k;__copy->__d_size=__privtrans->__d_size;__copy->__k_size=__privtrans->__k_size;__copy->__n_size=__privtrans->__n_size;
5181             }
5182 0           return (pdl_trans*)__copy;
5183             }
5184             }
5185            
5186              
5187 0           void pdl_getclustercentroids_readdata(pdl_trans *__tr ) {
5188             int __dim;
5189 0           pdl_getclustercentroids_struct *__privtrans = (pdl_getclustercentroids_struct *) __tr;
5190            
5191             {
5192             {PDL_COMMENT("Start generic loop")
5193              
5194 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
5195 0           } break; case PDL_B: {
5196 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5197 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5198              
5199 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5200 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5201              
5202 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5203 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5204              
5205 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5206 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5207              
5208 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5209 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5210              
5211 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5212 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5213 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5214 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5215 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5216 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5217 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5218 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5219 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5220              
5221              
5222 0           int transpose = 0;
5223 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5224 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5225 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5226 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5227              
5228            
5229             PDL_COMMENT("THREADLOOPBEGIN")
5230 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5231 0           do { register PDL_Indx __tind1=0,__tind2=0;
5232 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5233 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5234 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5235 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5236 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5237 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5238 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5239 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5240 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5241 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5242 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5243 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5244 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5245 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5246 0           data_datap += __offsp[0];
5247 0           mask_datap += __offsp[1];
5248 0           clusterids_datap += __offsp[2];
5249 0           cdata_datap += __offsp[3];
5250 0           cmask_datap += __offsp[4];
5251 0 0         for( __tind2 = 0 ;
5252             __tind2 < __tdims1 ;
5253 0           __tind2++
5254 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5255 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5256 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5257 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5258 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5259             )
5260             {
5261 0 0         for( __tind1 = 0 ;
5262             __tind1 < __tdims0 ;
5263 0           __tind1++
5264 0           ,data_datap += __tinc0_0
5265 0           ,mask_datap += __tinc0_1
5266 0           ,clusterids_datap += __tinc0_2
5267 0           ,cdata_datap += __tinc0_3
5268 0           ,cmask_datap += __tinc0_4
5269             )
5270             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5271 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5272 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5273 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5274 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5275              
5276 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5277 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5278            
5279             PDL_COMMENT("THREADLOOPEND")
5280             }
5281             }
5282 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5283 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5284 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5285 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5286 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5287 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5288              
5289             /*-- cleanup --*/
5290 0 0         if (datapp) free(datapp);
5291 0 0         if (maskpp) free(maskpp);
5292 0 0         if (cdatapp) free(cdatapp);
5293 0 0         if (cmaskpp) free(cmaskpp);
5294              
5295 0           } } break; case PDL_S: {
5296 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5297 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5298              
5299 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5300 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5301              
5302 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5303 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5304              
5305 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5306 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5307              
5308 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5309 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5310              
5311 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5312 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5313 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5314 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5315 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5316 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5317 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5318 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5319 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5320              
5321              
5322 0           int transpose = 0;
5323 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5324 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5325 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5326 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5327              
5328            
5329             PDL_COMMENT("THREADLOOPBEGIN")
5330 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5331 0           do { register PDL_Indx __tind1=0,__tind2=0;
5332 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5333 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5334 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5335 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5336 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5337 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5338 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5339 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5340 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5341 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5342 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5343 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5344 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5345 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5346 0           data_datap += __offsp[0];
5347 0           mask_datap += __offsp[1];
5348 0           clusterids_datap += __offsp[2];
5349 0           cdata_datap += __offsp[3];
5350 0           cmask_datap += __offsp[4];
5351 0 0         for( __tind2 = 0 ;
5352             __tind2 < __tdims1 ;
5353 0           __tind2++
5354 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5355 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5356 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5357 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5358 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5359             )
5360             {
5361 0 0         for( __tind1 = 0 ;
5362             __tind1 < __tdims0 ;
5363 0           __tind1++
5364 0           ,data_datap += __tinc0_0
5365 0           ,mask_datap += __tinc0_1
5366 0           ,clusterids_datap += __tinc0_2
5367 0           ,cdata_datap += __tinc0_3
5368 0           ,cmask_datap += __tinc0_4
5369             )
5370             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5371 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5372 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5373 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5374 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5375              
5376 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5377 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5378            
5379             PDL_COMMENT("THREADLOOPEND")
5380             }
5381             }
5382 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5383 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5384 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5385 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5386 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5387 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5388              
5389             /*-- cleanup --*/
5390 0 0         if (datapp) free(datapp);
5391 0 0         if (maskpp) free(maskpp);
5392 0 0         if (cdatapp) free(cdatapp);
5393 0 0         if (cmaskpp) free(cmaskpp);
5394              
5395 0           } } break; case PDL_US: {
5396 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5397 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5398              
5399 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5400 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5401              
5402 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5403 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5404              
5405 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5406 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5407              
5408 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5409 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5410              
5411 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5412 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5413 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5414 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5415 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5416 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5417 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5418 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5419 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5420              
5421              
5422 0           int transpose = 0;
5423 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5424 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5425 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5426 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5427              
5428            
5429             PDL_COMMENT("THREADLOOPBEGIN")
5430 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5431 0           do { register PDL_Indx __tind1=0,__tind2=0;
5432 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5433 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5434 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5435 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5436 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5437 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5438 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5439 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5440 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5441 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5442 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5443 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5444 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5445 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5446 0           data_datap += __offsp[0];
5447 0           mask_datap += __offsp[1];
5448 0           clusterids_datap += __offsp[2];
5449 0           cdata_datap += __offsp[3];
5450 0           cmask_datap += __offsp[4];
5451 0 0         for( __tind2 = 0 ;
5452             __tind2 < __tdims1 ;
5453 0           __tind2++
5454 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5455 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5456 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5457 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5458 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5459             )
5460             {
5461 0 0         for( __tind1 = 0 ;
5462             __tind1 < __tdims0 ;
5463 0           __tind1++
5464 0           ,data_datap += __tinc0_0
5465 0           ,mask_datap += __tinc0_1
5466 0           ,clusterids_datap += __tinc0_2
5467 0           ,cdata_datap += __tinc0_3
5468 0           ,cmask_datap += __tinc0_4
5469             )
5470             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5471 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5472 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5473 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5474 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5475              
5476 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5477 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5478            
5479             PDL_COMMENT("THREADLOOPEND")
5480             }
5481             }
5482 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5483 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5484 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5485 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5486 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5487 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5488              
5489             /*-- cleanup --*/
5490 0 0         if (datapp) free(datapp);
5491 0 0         if (maskpp) free(maskpp);
5492 0 0         if (cdatapp) free(cdatapp);
5493 0 0         if (cmaskpp) free(cmaskpp);
5494              
5495 0           } } break; case PDL_L: {
5496 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5497 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5498              
5499 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5500 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5501              
5502 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5503 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5504              
5505 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5506 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5507              
5508 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5509 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5510              
5511 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5512 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5513 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5514 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5515 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5516 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5517 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5518 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5519 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5520              
5521              
5522 0           int transpose = 0;
5523 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5524 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5525 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5526 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5527              
5528            
5529             PDL_COMMENT("THREADLOOPBEGIN")
5530 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5531 0           do { register PDL_Indx __tind1=0,__tind2=0;
5532 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5533 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5534 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5535 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5536 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5537 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5538 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5539 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5540 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5541 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5542 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5543 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5544 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5545 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5546 0           data_datap += __offsp[0];
5547 0           mask_datap += __offsp[1];
5548 0           clusterids_datap += __offsp[2];
5549 0           cdata_datap += __offsp[3];
5550 0           cmask_datap += __offsp[4];
5551 0 0         for( __tind2 = 0 ;
5552             __tind2 < __tdims1 ;
5553 0           __tind2++
5554 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5555 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5556 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5557 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5558 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5559             )
5560             {
5561 0 0         for( __tind1 = 0 ;
5562             __tind1 < __tdims0 ;
5563 0           __tind1++
5564 0           ,data_datap += __tinc0_0
5565 0           ,mask_datap += __tinc0_1
5566 0           ,clusterids_datap += __tinc0_2
5567 0           ,cdata_datap += __tinc0_3
5568 0           ,cmask_datap += __tinc0_4
5569             )
5570             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5571 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5572 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5573 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5574 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5575              
5576 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5577 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5578            
5579             PDL_COMMENT("THREADLOOPEND")
5580             }
5581             }
5582 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5583 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5584 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5585 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5586 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5587 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5588              
5589             /*-- cleanup --*/
5590 0 0         if (datapp) free(datapp);
5591 0 0         if (maskpp) free(maskpp);
5592 0 0         if (cdatapp) free(cdatapp);
5593 0 0         if (cmaskpp) free(cmaskpp);
5594              
5595 0           } } break; case PDL_IND: {
5596 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5597 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5598              
5599 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5600 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5601              
5602 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5603 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5604              
5605 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5606 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5607              
5608 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5609 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5610              
5611 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5612 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5613 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5614 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5615 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5616 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5617 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5618 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5619 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5620              
5621              
5622 0           int transpose = 0;
5623 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5624 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5625 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5626 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5627              
5628            
5629             PDL_COMMENT("THREADLOOPBEGIN")
5630 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5631 0           do { register PDL_Indx __tind1=0,__tind2=0;
5632 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5633 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5634 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5635 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5636 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5637 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5638 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5639 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5640 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5641 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5642 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5643 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5644 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5645 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5646 0           data_datap += __offsp[0];
5647 0           mask_datap += __offsp[1];
5648 0           clusterids_datap += __offsp[2];
5649 0           cdata_datap += __offsp[3];
5650 0           cmask_datap += __offsp[4];
5651 0 0         for( __tind2 = 0 ;
5652             __tind2 < __tdims1 ;
5653 0           __tind2++
5654 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5655 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5656 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5657 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5658 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5659             )
5660             {
5661 0 0         for( __tind1 = 0 ;
5662             __tind1 < __tdims0 ;
5663 0           __tind1++
5664 0           ,data_datap += __tinc0_0
5665 0           ,mask_datap += __tinc0_1
5666 0           ,clusterids_datap += __tinc0_2
5667 0           ,cdata_datap += __tinc0_3
5668 0           ,cmask_datap += __tinc0_4
5669             )
5670             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5671 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5672 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5673 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5674 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5675              
5676 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5677 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5678            
5679             PDL_COMMENT("THREADLOOPEND")
5680             }
5681             }
5682 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5683 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5684 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5685 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5686 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5687 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5688              
5689             /*-- cleanup --*/
5690 0 0         if (datapp) free(datapp);
5691 0 0         if (maskpp) free(maskpp);
5692 0 0         if (cdatapp) free(cdatapp);
5693 0 0         if (cmaskpp) free(cmaskpp);
5694              
5695 0           } } break; case PDL_LL: {
5696 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5697 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5698              
5699 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5700 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5701              
5702 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5703 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5704              
5705 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5706 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5707              
5708 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5709 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5710              
5711 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5712 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5713 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5714 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5715 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5716 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5717 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5718 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5719 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5720              
5721              
5722 0           int transpose = 0;
5723 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5724 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5725 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5726 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5727              
5728            
5729             PDL_COMMENT("THREADLOOPBEGIN")
5730 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5731 0           do { register PDL_Indx __tind1=0,__tind2=0;
5732 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5733 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5734 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5735 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5736 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5737 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5738 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5739 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5740 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5741 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5742 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5743 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5744 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5745 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5746 0           data_datap += __offsp[0];
5747 0           mask_datap += __offsp[1];
5748 0           clusterids_datap += __offsp[2];
5749 0           cdata_datap += __offsp[3];
5750 0           cmask_datap += __offsp[4];
5751 0 0         for( __tind2 = 0 ;
5752             __tind2 < __tdims1 ;
5753 0           __tind2++
5754 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5755 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5756 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5757 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5758 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5759             )
5760             {
5761 0 0         for( __tind1 = 0 ;
5762             __tind1 < __tdims0 ;
5763 0           __tind1++
5764 0           ,data_datap += __tinc0_0
5765 0           ,mask_datap += __tinc0_1
5766 0           ,clusterids_datap += __tinc0_2
5767 0           ,cdata_datap += __tinc0_3
5768 0           ,cmask_datap += __tinc0_4
5769             )
5770             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5771 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5772 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5773 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5774 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5775              
5776 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5777 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5778            
5779             PDL_COMMENT("THREADLOOPEND")
5780             }
5781             }
5782 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5783 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5784 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5785 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5786 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5787 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5788              
5789             /*-- cleanup --*/
5790 0 0         if (datapp) free(datapp);
5791 0 0         if (maskpp) free(maskpp);
5792 0 0         if (cdatapp) free(cdatapp);
5793 0 0         if (cmaskpp) free(cmaskpp);
5794              
5795 0           } } break; case PDL_F: {
5796 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5797 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5798              
5799 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5800 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5801              
5802 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5803 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5804              
5805 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5806 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5807              
5808 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5809 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5810              
5811 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5812 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5813 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5814 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5815 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5816 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5817 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5818 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5819 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5820              
5821              
5822 0           int transpose = 0;
5823 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5824 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5825 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5826 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5827              
5828            
5829             PDL_COMMENT("THREADLOOPBEGIN")
5830 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5831 0           do { register PDL_Indx __tind1=0,__tind2=0;
5832 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5833 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5834 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5835 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5836 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5837 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5838 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5839 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5840 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5841 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5842 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5843 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5844 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5845 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5846 0           data_datap += __offsp[0];
5847 0           mask_datap += __offsp[1];
5848 0           clusterids_datap += __offsp[2];
5849 0           cdata_datap += __offsp[3];
5850 0           cmask_datap += __offsp[4];
5851 0 0         for( __tind2 = 0 ;
5852             __tind2 < __tdims1 ;
5853 0           __tind2++
5854 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5855 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5856 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5857 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5858 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5859             )
5860             {
5861 0 0         for( __tind1 = 0 ;
5862             __tind1 < __tdims0 ;
5863 0           __tind1++
5864 0           ,data_datap += __tinc0_0
5865 0           ,mask_datap += __tinc0_1
5866 0           ,clusterids_datap += __tinc0_2
5867 0           ,cdata_datap += __tinc0_3
5868 0           ,cmask_datap += __tinc0_4
5869             )
5870             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5871 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5872 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5873 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5874 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5875              
5876 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5877 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5878            
5879             PDL_COMMENT("THREADLOOPEND")
5880             }
5881             }
5882 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5883 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5884 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5885 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5886 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5887 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5888              
5889             /*-- cleanup --*/
5890 0 0         if (datapp) free(datapp);
5891 0 0         if (maskpp) free(maskpp);
5892 0 0         if (cdatapp) free(cdatapp);
5893 0 0         if (cmaskpp) free(cmaskpp);
5894              
5895 0           } } break; case PDL_D: {
5896 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
5897 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
5898              
5899 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
5900 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
5901              
5902 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
5903 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
5904              
5905 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
5906 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
5907              
5908 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
5909 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
5910              
5911 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
5912 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
5913 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
5914 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
5915 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
5916 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
5917 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
5918 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
5919 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
5920              
5921              
5922 0           int transpose = 0;
5923 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
5924 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
5925 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
5926 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
5927              
5928            
5929             PDL_COMMENT("THREADLOOPBEGIN")
5930 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
5931 0           do { register PDL_Indx __tind1=0,__tind2=0;
5932 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
5933 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
5934 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
5935 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
5936 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
5937 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
5938 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
5939 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
5940 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
5941 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
5942 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
5943 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
5944 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
5945 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
5946 0           data_datap += __offsp[0];
5947 0           mask_datap += __offsp[1];
5948 0           clusterids_datap += __offsp[2];
5949 0           cdata_datap += __offsp[3];
5950 0           cmask_datap += __offsp[4];
5951 0 0         for( __tind2 = 0 ;
5952             __tind2 < __tdims1 ;
5953 0           __tind2++
5954 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
5955 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
5956 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
5957 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
5958 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
5959             )
5960             {
5961 0 0         for( __tind1 = 0 ;
5962             __tind1 < __tdims0 ;
5963 0           __tind1++
5964 0           ,data_datap += __tinc0_0
5965 0           ,mask_datap += __tinc0_1
5966 0           ,clusterids_datap += __tinc0_2
5967 0           ,cdata_datap += __tinc0_3
5968 0           ,cmask_datap += __tinc0_4
5969             )
5970             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
5971 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
5972 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
5973 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
5974 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
5975              
5976 0           getclustercentroids(__privtrans->__k_size, __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
5977 0           clusterids_datap, cdatapp, cmaskpp, transpose, *__privtrans->ctrMethodFlag);
5978            
5979             PDL_COMMENT("THREADLOOPEND")
5980             }
5981             }
5982 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
5983 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
5984 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
5985 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
5986 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
5987 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
5988              
5989             /*-- cleanup --*/
5990 0 0         if (datapp) free(datapp);
5991 0 0         if (maskpp) free(maskpp);
5992 0 0         if (cdatapp) free(cdatapp);
5993 0 0         if (cmaskpp) free(cmaskpp);
5994              
5995 0           } break;}
5996 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
5997             }
5998             }
5999             }
6000            
6001              
6002              
6003              
6004 0           void pdl_getclustercentroids_free(pdl_trans *__tr ) {
6005             int __dim;
6006 0           pdl_getclustercentroids_struct *__privtrans = (pdl_getclustercentroids_struct *) __tr;
6007            
6008             {
6009            
6010 0           PDL_TR_CLRMAGIC(__privtrans);
6011 0           free(__privtrans->ctrMethodFlag);;
6012 0 0         if(__privtrans->__ddone) {
6013 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
6014             ;;;;;;;;;;;;;
6015             }
6016            
6017             }
6018 0           }
6019            
6020              
6021              
6022              
6023             static char pdl_getclustercentroids_vtable_flags[] =
6024             { 0,0,0,0,0};
6025             pdl_transvtable pdl_getclustercentroids_vtable = {
6026             0,0, 3, 5, pdl_getclustercentroids_vtable_flags,
6027             pdl_getclustercentroids_redodims, pdl_getclustercentroids_readdata, NULL,
6028             pdl_getclustercentroids_free,NULL,NULL,pdl_getclustercentroids_copy,
6029             sizeof(pdl_getclustercentroids_struct),"pdl_getclustercentroids_vtable"
6030             };
6031              
6032             typedef struct pdl_getclustermedoids_struct {
6033             PDL_TRANS_START(4);
6034             pdl_thread __pdlthread;PDL_Indx __inc_distance_n0;PDL_Indx __inc_distance_n1;PDL_Indx __inc_clusterids_n;PDL_Indx __inc_centroids_k;PDL_Indx __inc_errors_k;PDL_Indx __n_size;PDL_Indx __k_size;
6035            
6036             char __ddone; PDL_COMMENT("Dims done")
6037             } pdl_getclustermedoids_struct;
6038              
6039 0           void pdl_getclustermedoids_redodims(pdl_trans *__tr ) {
6040             int __dim;
6041 0           pdl_getclustermedoids_struct *__privtrans = (pdl_getclustermedoids_struct *) __tr;
6042            
6043             {
6044             PDL_Indx __creating[4];
6045 0           __privtrans->__n_size = -1;
6046 0           __privtrans->__k_size = -1;
6047 0           __creating[0] = 0;
6048 0           __creating[1] = 0;
6049 0 0         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    0          
6050 0 0         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    0          
6051             {
6052             {PDL_COMMENT("Start generic loop")
6053              
6054 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
6055 0           } break; case PDL_B: {
6056 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6057 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6058              
6059 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6060 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6061              
6062 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6063 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6064              
6065 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6066 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6067              
6068 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6069 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6070 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6071 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6072 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6073              
6074             PDL_COMMENT("none")
6075 0           } } break; case PDL_S: {
6076 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6077 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6078              
6079 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6080 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6081              
6082 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6083 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6084              
6085 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6086 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6087              
6088 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6089 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6090 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6091 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6092 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6093              
6094             PDL_COMMENT("none")
6095 0           } } break; case PDL_US: {
6096 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6097 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6098              
6099 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6100 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6101              
6102 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6103 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6104              
6105 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6106 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6107              
6108 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6109 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6110 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6111 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6112 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6113              
6114             PDL_COMMENT("none")
6115 0           } } break; case PDL_L: {
6116 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6117 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6118              
6119 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6120 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6121              
6122 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6123 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6124              
6125 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6126 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6127              
6128 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6129 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6130 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6131 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6132 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6133              
6134             PDL_COMMENT("none")
6135 0           } } break; case PDL_IND: {
6136 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6137 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6138              
6139 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6140 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6141              
6142 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6143 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6144              
6145 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6146 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6147              
6148 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6149 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6150 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6151 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6152 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6153              
6154             PDL_COMMENT("none")
6155 0           } } break; case PDL_LL: {
6156 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6157 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6158              
6159 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6160 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6161              
6162 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6163 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6164              
6165 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6166 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6167              
6168 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6169 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6170 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6171 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6172 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6173              
6174             PDL_COMMENT("none")
6175 0           } } break; case PDL_F: {
6176 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6177 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6178              
6179 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6180 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6181              
6182 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6183 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6184              
6185 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6186 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6187              
6188 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6189 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6190 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6191 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6192 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6193              
6194             PDL_COMMENT("none")
6195 0           } } break; case PDL_D: {
6196 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6197 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6198              
6199 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6200 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6201              
6202 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6203 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6204              
6205 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6206 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6207              
6208 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6209 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6210 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6211 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6212 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6213              
6214             PDL_COMMENT("none")
6215 0           } break;}
6216 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
6217             }
6218             }
6219             {
6220             static char *__parnames[] = {"distance","clusterids","centroids","errors"};
6221             static PDL_Indx __realdims[] = {2,1,1,1};
6222             static char __funcname[] = "PDL::Cluster::getclustermedoids";
6223             static pdl_errorinfo __einfo = {
6224             __funcname, __parnames, 4
6225             };
6226            
6227 0           PDL->initthreadstruct(2,__privtrans->pdls,
6228             __realdims,__creating,4,
6229             &__einfo,&(__privtrans->__pdlthread),
6230 0           __privtrans->vtable->per_pdl_flags,
6231             0 );
6232             }
6233 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
6234 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
6235 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
6236             }
6237 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
6238 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
6239 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
6240 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
6241 0           PDL->pdl_barf("Error in getclustermedoids:" "Wrong dims\n");
6242             }
6243             }
6244 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
6245 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
6246 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
6247 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
6248 0           PDL->pdl_barf("Error in getclustermedoids:" "Wrong dims\n");
6249             }
6250             }
6251 0           PDL->make_physical(((__privtrans->pdls[0])));
6252 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
6253 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
6254             }
6255 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
6256 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
6257 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
6258 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
6259 0           PDL->pdl_barf("Error in getclustermedoids:" "Wrong dims\n");
6260             }
6261             }
6262 0           PDL->make_physical(((__privtrans->pdls[1])));
6263 0 0         if(!__creating[2]) {
6264 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
6265 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
6266             }
6267 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
6268 0           __privtrans->__k_size = ((__privtrans->pdls[2]))->dims[0];
6269 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
6270 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
6271 0           PDL->pdl_barf("Error in getclustermedoids:" "Wrong dims\n");
6272             }
6273             }
6274 0           PDL->make_physical(((__privtrans->pdls[2])));
6275             } else {
6276 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
6277 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,0);
6278 0 0         }if(!__creating[3]) {
6279 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
6280 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
6281             }
6282 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
6283 0           __privtrans->__k_size = ((__privtrans->pdls[3]))->dims[0];
6284 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
6285 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
6286 0           PDL->pdl_barf("Error in getclustermedoids:" "Wrong dims\n");
6287             }
6288             }
6289 0           PDL->make_physical(((__privtrans->pdls[3])));
6290             } else {
6291 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
6292 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
6293             }
6294             { PDL_COMMENT("convenience block")
6295 0           void *hdrp = NULL;
6296 0           char propagate_hdrcpy = 0;
6297 0           SV *hdr_copy = NULL;
6298 0 0         if(!hdrp &&
    0          
6299 0 0         __privtrans->pdls[0]->hdrsv &&
6300 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
6301             ) {
6302 0           hdrp = __privtrans->pdls[0]->hdrsv;
6303 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
6304             }
6305 0 0         if(!hdrp &&
    0          
6306 0 0         __privtrans->pdls[1]->hdrsv &&
6307 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
6308             ) {
6309 0           hdrp = __privtrans->pdls[1]->hdrsv;
6310 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
6311             }
6312 0 0         if(!hdrp &&
    0          
6313 0 0         !__creating[2] &&
6314 0 0         __privtrans->pdls[2]->hdrsv &&
6315 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
6316             ) {
6317 0           hdrp = __privtrans->pdls[2]->hdrsv;
6318 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
6319             }
6320 0 0         if(!hdrp &&
    0          
6321 0 0         !__creating[3] &&
6322 0 0         __privtrans->pdls[3]->hdrsv &&
6323 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
6324             ) {
6325 0           hdrp = __privtrans->pdls[3]->hdrsv;
6326 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
6327             }
6328 0 0         if (hdrp) {
6329 0 0         if(hdrp == &PL_sv_undef)
6330 0           hdr_copy = &PL_sv_undef;
6331             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
6332             int count;
6333             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
6334 0           dSP;
6335 0           ENTER ;
6336 0           SAVETMPS ;
6337 0 0         PUSHMARK(SP) ;
6338 0 0         XPUSHs( hdrp );
6339 0           PUTBACK ;
6340 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
6341 0           SPAGAIN ;
6342 0 0         if(count != 1)
6343 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
6344              
6345 0           hdr_copy = (SV *)POPs;
6346              
6347 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
6348 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
6349             }
6350              
6351 0 0         FREETMPS ;
6352 0           LEAVE ;
6353              
6354              
6355             } PDL_COMMENT("end of callback block")
6356              
6357 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
6358 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
6359 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
6360 0 0         if( hdr_copy != &PL_sv_undef )
6361 0           (void)SvREFCNT_inc(hdr_copy);
6362 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
6363             }
6364 0 0         if(propagate_hdrcpy)
6365 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
6366 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
6367 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
6368 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
6369 0 0         if( hdr_copy != &PL_sv_undef )
6370 0           (void)SvREFCNT_inc(hdr_copy);
6371 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
6372             }
6373 0 0         if(propagate_hdrcpy)
6374 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
6375              
6376 0 0         if(hdr_copy != &PL_sv_undef)
6377 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
6378             } PDL_COMMENT("end of if(hdrp) block")
6379             } PDL_COMMENT("end of conv. block")
6380 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
6381 0           __privtrans->__inc_distance_n0 = 0; else
6382 0 0         __privtrans->__inc_distance_n0 = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
6383 0           __privtrans->__inc_distance_n1 = 0; else
6384 0 0         __privtrans->__inc_distance_n1 = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
6385 0           __privtrans->__inc_clusterids_n = 0; else
6386 0 0         __privtrans->__inc_clusterids_n = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
6387 0           __privtrans->__inc_centroids_k = 0; else
6388 0 0         __privtrans->__inc_centroids_k = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
6389 0           __privtrans->__inc_errors_k = 0; else
6390 0           __privtrans->__inc_errors_k = __privtrans->pdls[3]->dimincs[0]; __privtrans->__ddone = 1;
6391             }
6392 0           }
6393            
6394              
6395 0           pdl_trans * pdl_getclustermedoids_copy(pdl_trans *__tr ) {
6396             int __dim;
6397 0           pdl_getclustermedoids_struct *__privtrans = (pdl_getclustermedoids_struct *) __tr;
6398            
6399             {
6400 0           pdl_getclustermedoids_struct *__copy = malloc(sizeof(pdl_getclustermedoids_struct));
6401 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
6402 0           __copy->has_badvalue = __privtrans->has_badvalue;
6403 0           __copy->badvalue = __privtrans->badvalue;
6404 0           __copy->flags = __privtrans->flags;
6405 0           __copy->vtable = __privtrans->vtable;
6406 0           __copy->__datatype = __privtrans->__datatype;
6407 0           __copy->freeproc = NULL;
6408 0           __copy->__ddone = __privtrans->__ddone;
6409             {int i;
6410 0 0         for(i=0; i<__copy->vtable->npdls; i++)
6411 0           __copy->pdls[i] = __privtrans->pdls[i];
6412             }
6413            
6414 0 0         if(__copy->__ddone) {
6415 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_distance_n0=__copy->__inc_distance_n0;__privtrans->__inc_distance_n1=__copy->__inc_distance_n1;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__privtrans->__inc_centroids_k=__copy->__inc_centroids_k;__privtrans->__inc_errors_k=__copy->__inc_errors_k;__copy->__n_size=__privtrans->__n_size;__copy->__k_size=__privtrans->__k_size;
6416             }
6417 0           return (pdl_trans*)__copy;
6418             }
6419             }
6420            
6421              
6422 0           void pdl_getclustermedoids_readdata(pdl_trans *__tr ) {
6423             int __dim;
6424 0           pdl_getclustermedoids_struct *__privtrans = (pdl_getclustermedoids_struct *) __tr;
6425            
6426             {
6427             {PDL_COMMENT("Start generic loop")
6428              
6429 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
6430 0           } break; case PDL_B: {
6431 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6432 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6433              
6434 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6435 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6436              
6437 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6438 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6439              
6440 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6441 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6442              
6443 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6444 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6445 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6446 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6447 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6448              
6449              
6450 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6451            
6452             PDL_COMMENT("THREADLOOPBEGIN")
6453 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6454 0           do { register PDL_Indx __tind1=0,__tind2=0;
6455 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6456 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6457 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6458 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6459 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6460 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6461 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6462 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6463 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6464 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6465 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6466 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6467 0           distance_datap += __offsp[0];
6468 0           clusterids_datap += __offsp[1];
6469 0           centroids_datap += __offsp[2];
6470 0           errors_datap += __offsp[3];
6471 0 0         for( __tind2 = 0 ;
6472             __tind2 < __tdims1 ;
6473 0           __tind2++
6474 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6475 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6476 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6477 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6478             )
6479             {
6480 0 0         for( __tind1 = 0 ;
6481             __tind1 < __tdims0 ;
6482 0           __tind1++
6483 0           ,distance_datap += __tinc0_0
6484 0           ,clusterids_datap += __tinc0_1
6485 0           ,centroids_datap += __tinc0_2
6486 0           ,errors_datap += __tinc0_3
6487             )
6488             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6489 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6490 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6491             clusterids_datap, centroids_datap, errors_datap);
6492            
6493             PDL_COMMENT("THREADLOOPEND")
6494             }
6495             }
6496 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6497 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6498 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6499 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6500 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6501             /*-- cleanup --*/
6502 0 0         if (distpp) free(distpp);
6503              
6504 0           } } break; case PDL_S: {
6505 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6506 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6507              
6508 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6509 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6510              
6511 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6512 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6513              
6514 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6515 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6516              
6517 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6518 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6519 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6520 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6521 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6522              
6523              
6524 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6525            
6526             PDL_COMMENT("THREADLOOPBEGIN")
6527 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6528 0           do { register PDL_Indx __tind1=0,__tind2=0;
6529 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6530 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6531 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6532 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6533 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6534 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6535 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6536 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6537 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6538 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6539 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6540 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6541 0           distance_datap += __offsp[0];
6542 0           clusterids_datap += __offsp[1];
6543 0           centroids_datap += __offsp[2];
6544 0           errors_datap += __offsp[3];
6545 0 0         for( __tind2 = 0 ;
6546             __tind2 < __tdims1 ;
6547 0           __tind2++
6548 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6549 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6550 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6551 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6552             )
6553             {
6554 0 0         for( __tind1 = 0 ;
6555             __tind1 < __tdims0 ;
6556 0           __tind1++
6557 0           ,distance_datap += __tinc0_0
6558 0           ,clusterids_datap += __tinc0_1
6559 0           ,centroids_datap += __tinc0_2
6560 0           ,errors_datap += __tinc0_3
6561             )
6562             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6563 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6564 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6565             clusterids_datap, centroids_datap, errors_datap);
6566            
6567             PDL_COMMENT("THREADLOOPEND")
6568             }
6569             }
6570 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6571 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6572 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6573 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6574 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6575             /*-- cleanup --*/
6576 0 0         if (distpp) free(distpp);
6577              
6578 0           } } break; case PDL_US: {
6579 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6580 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6581              
6582 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6583 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6584              
6585 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6586 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6587              
6588 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6589 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6590              
6591 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6592 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6593 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6594 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6595 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6596              
6597              
6598 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6599            
6600             PDL_COMMENT("THREADLOOPBEGIN")
6601 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6602 0           do { register PDL_Indx __tind1=0,__tind2=0;
6603 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6604 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6605 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6606 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6607 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6608 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6609 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6610 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6611 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6612 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6613 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6614 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6615 0           distance_datap += __offsp[0];
6616 0           clusterids_datap += __offsp[1];
6617 0           centroids_datap += __offsp[2];
6618 0           errors_datap += __offsp[3];
6619 0 0         for( __tind2 = 0 ;
6620             __tind2 < __tdims1 ;
6621 0           __tind2++
6622 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6623 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6624 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6625 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6626             )
6627             {
6628 0 0         for( __tind1 = 0 ;
6629             __tind1 < __tdims0 ;
6630 0           __tind1++
6631 0           ,distance_datap += __tinc0_0
6632 0           ,clusterids_datap += __tinc0_1
6633 0           ,centroids_datap += __tinc0_2
6634 0           ,errors_datap += __tinc0_3
6635             )
6636             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6637 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6638 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6639             clusterids_datap, centroids_datap, errors_datap);
6640            
6641             PDL_COMMENT("THREADLOOPEND")
6642             }
6643             }
6644 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6645 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6646 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6647 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6648 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6649             /*-- cleanup --*/
6650 0 0         if (distpp) free(distpp);
6651              
6652 0           } } break; case PDL_L: {
6653 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6654 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6655              
6656 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6657 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6658              
6659 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6660 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6661              
6662 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6663 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6664              
6665 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6666 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6667 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6668 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6669 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6670              
6671              
6672 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6673            
6674             PDL_COMMENT("THREADLOOPBEGIN")
6675 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6676 0           do { register PDL_Indx __tind1=0,__tind2=0;
6677 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6678 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6679 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6680 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6681 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6682 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6683 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6684 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6685 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6686 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6687 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6688 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6689 0           distance_datap += __offsp[0];
6690 0           clusterids_datap += __offsp[1];
6691 0           centroids_datap += __offsp[2];
6692 0           errors_datap += __offsp[3];
6693 0 0         for( __tind2 = 0 ;
6694             __tind2 < __tdims1 ;
6695 0           __tind2++
6696 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6697 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6698 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6699 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6700             )
6701             {
6702 0 0         for( __tind1 = 0 ;
6703             __tind1 < __tdims0 ;
6704 0           __tind1++
6705 0           ,distance_datap += __tinc0_0
6706 0           ,clusterids_datap += __tinc0_1
6707 0           ,centroids_datap += __tinc0_2
6708 0           ,errors_datap += __tinc0_3
6709             )
6710             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6711 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6712 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6713             clusterids_datap, centroids_datap, errors_datap);
6714            
6715             PDL_COMMENT("THREADLOOPEND")
6716             }
6717             }
6718 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6719 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6720 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6721 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6722 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6723             /*-- cleanup --*/
6724 0 0         if (distpp) free(distpp);
6725              
6726 0           } } break; case PDL_IND: {
6727 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6728 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6729              
6730 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6731 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6732              
6733 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6734 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6735              
6736 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6737 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6738              
6739 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6740 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6741 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6742 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6743 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6744              
6745              
6746 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6747            
6748             PDL_COMMENT("THREADLOOPBEGIN")
6749 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6750 0           do { register PDL_Indx __tind1=0,__tind2=0;
6751 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6752 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6753 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6754 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6755 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6756 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6757 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6758 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6759 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6760 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6761 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6762 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6763 0           distance_datap += __offsp[0];
6764 0           clusterids_datap += __offsp[1];
6765 0           centroids_datap += __offsp[2];
6766 0           errors_datap += __offsp[3];
6767 0 0         for( __tind2 = 0 ;
6768             __tind2 < __tdims1 ;
6769 0           __tind2++
6770 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6771 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6772 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6773 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6774             )
6775             {
6776 0 0         for( __tind1 = 0 ;
6777             __tind1 < __tdims0 ;
6778 0           __tind1++
6779 0           ,distance_datap += __tinc0_0
6780 0           ,clusterids_datap += __tinc0_1
6781 0           ,centroids_datap += __tinc0_2
6782 0           ,errors_datap += __tinc0_3
6783             )
6784             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6785 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6786 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6787             clusterids_datap, centroids_datap, errors_datap);
6788            
6789             PDL_COMMENT("THREADLOOPEND")
6790             }
6791             }
6792 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6793 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6794 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6795 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6796 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6797             /*-- cleanup --*/
6798 0 0         if (distpp) free(distpp);
6799              
6800 0           } } break; case PDL_LL: {
6801 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6802 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6803              
6804 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6805 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6806              
6807 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6808 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6809              
6810 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6811 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6812              
6813 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6814 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6815 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6816 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6817 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6818              
6819              
6820 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6821            
6822             PDL_COMMENT("THREADLOOPBEGIN")
6823 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6824 0           do { register PDL_Indx __tind1=0,__tind2=0;
6825 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6826 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6827 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6828 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6829 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6830 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6831 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6832 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6833 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6834 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6835 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6836 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6837 0           distance_datap += __offsp[0];
6838 0           clusterids_datap += __offsp[1];
6839 0           centroids_datap += __offsp[2];
6840 0           errors_datap += __offsp[3];
6841 0 0         for( __tind2 = 0 ;
6842             __tind2 < __tdims1 ;
6843 0           __tind2++
6844 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6845 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6846 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6847 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6848             )
6849             {
6850 0 0         for( __tind1 = 0 ;
6851             __tind1 < __tdims0 ;
6852 0           __tind1++
6853 0           ,distance_datap += __tinc0_0
6854 0           ,clusterids_datap += __tinc0_1
6855 0           ,centroids_datap += __tinc0_2
6856 0           ,errors_datap += __tinc0_3
6857             )
6858             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6859 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6860 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6861             clusterids_datap, centroids_datap, errors_datap);
6862            
6863             PDL_COMMENT("THREADLOOPEND")
6864             }
6865             }
6866 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6867 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6868 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6869 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6870 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6871             /*-- cleanup --*/
6872 0 0         if (distpp) free(distpp);
6873              
6874 0           } } break; case PDL_F: {
6875 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6876 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6877              
6878 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6879 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6880              
6881 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6882 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6883              
6884 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6885 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6886              
6887 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6888 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6889 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6890 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6891 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6892              
6893              
6894 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6895            
6896             PDL_COMMENT("THREADLOOPBEGIN")
6897 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6898 0           do { register PDL_Indx __tind1=0,__tind2=0;
6899 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6900 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6901 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6902 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6903 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6904 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6905 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6906 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6907 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6908 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6909 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6910 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6911 0           distance_datap += __offsp[0];
6912 0           clusterids_datap += __offsp[1];
6913 0           centroids_datap += __offsp[2];
6914 0           errors_datap += __offsp[3];
6915 0 0         for( __tind2 = 0 ;
6916             __tind2 < __tdims1 ;
6917 0           __tind2++
6918 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6919 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6920 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6921 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6922             )
6923             {
6924 0 0         for( __tind1 = 0 ;
6925             __tind1 < __tdims0 ;
6926 0           __tind1++
6927 0           ,distance_datap += __tinc0_0
6928 0           ,clusterids_datap += __tinc0_1
6929 0           ,centroids_datap += __tinc0_2
6930 0           ,errors_datap += __tinc0_3
6931             )
6932             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
6933 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
6934 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
6935             clusterids_datap, centroids_datap, errors_datap);
6936            
6937             PDL_COMMENT("THREADLOOPEND")
6938             }
6939             }
6940 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
6941 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
6942 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
6943 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
6944 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
6945             /*-- cleanup --*/
6946 0 0         if (distpp) free(distpp);
6947              
6948 0           } } break; case PDL_D: {
6949 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
6950 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
6951              
6952 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
6953 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
6954              
6955 0 0         PDL_Long * centroids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
6956 0           PDL_Long * centroids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
6957              
6958 0 0         PDL_Double * errors_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
6959 0           PDL_Double * errors_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
6960              
6961 0           {register PDL_Indx __inc_errors_k = __privtrans->__inc_errors_k;
6962 0           register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
6963 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
6964 0           register PDL_Indx __inc_centroids_k = __privtrans->__inc_centroids_k;
6965 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
6966              
6967              
6968 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
6969            
6970             PDL_COMMENT("THREADLOOPBEGIN")
6971 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
6972 0           do { register PDL_Indx __tind1=0,__tind2=0;
6973 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
6974 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
6975 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
6976 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
6977 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
6978 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
6979 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
6980 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
6981 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
6982 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
6983 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
6984 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
6985 0           distance_datap += __offsp[0];
6986 0           clusterids_datap += __offsp[1];
6987 0           centroids_datap += __offsp[2];
6988 0           errors_datap += __offsp[3];
6989 0 0         for( __tind2 = 0 ;
6990             __tind2 < __tdims1 ;
6991 0           __tind2++
6992 0           ,distance_datap += __tinc1_0 - __tinc0_0 * __tdims0
6993 0           ,clusterids_datap += __tinc1_1 - __tinc0_1 * __tdims0
6994 0           ,centroids_datap += __tinc1_2 - __tinc0_2 * __tdims0
6995 0           ,errors_datap += __tinc1_3 - __tinc0_3 * __tdims0
6996             )
6997             {
6998 0 0         for( __tind1 = 0 ;
6999             __tind1 < __tdims0 ;
7000 0           __tind1++
7001 0           ,distance_datap += __tinc0_0
7002 0           ,clusterids_datap += __tinc0_1
7003 0           ,centroids_datap += __tinc0_2
7004 0           ,errors_datap += __tinc0_3
7005             )
7006             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
7007 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
7008 0           getclustermedoids(__privtrans->__k_size, __privtrans->__n_size, distpp,
7009             clusterids_datap, centroids_datap, errors_datap);
7010            
7011             PDL_COMMENT("THREADLOOPEND")
7012             }
7013             }
7014 0           distance_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7015 0           clusterids_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7016 0           centroids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7017 0           errors_datap -= __tinc1_3 * __tdims1 + __offsp[3];
7018 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
7019             /*-- cleanup --*/
7020 0 0         if (distpp) free(distpp);
7021              
7022 0           } break;}
7023 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7024             }
7025             }
7026             }
7027            
7028              
7029              
7030              
7031 0           void pdl_getclustermedoids_free(pdl_trans *__tr ) {
7032             int __dim;
7033 0           pdl_getclustermedoids_struct *__privtrans = (pdl_getclustermedoids_struct *) __tr;
7034            
7035             {
7036            
7037 0           PDL_TR_CLRMAGIC(__privtrans);
7038            
7039 0 0         if(__privtrans->__ddone) {
7040 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
7041             ;;;;;;;;
7042             }
7043            
7044             }
7045 0           }
7046            
7047              
7048              
7049              
7050             static char pdl_getclustermedoids_vtable_flags[] =
7051             { 0,0,0,0};
7052             pdl_transvtable pdl_getclustermedoids_vtable = {
7053             0,0, 2, 4, pdl_getclustermedoids_vtable_flags,
7054             pdl_getclustermedoids_redodims, pdl_getclustermedoids_readdata, NULL,
7055             pdl_getclustermedoids_free,NULL,NULL,pdl_getclustermedoids_copy,
7056             sizeof(pdl_getclustermedoids_struct),"pdl_getclustermedoids_vtable"
7057             };
7058              
7059             typedef struct pdl_kcluster_struct {
7060             PDL_TRANS_START(8);
7061             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_clusterids_n;PDL_Indx __n_size;PDL_Indx __d_size;
7062             char *distFlag;char *ctrMethodFlag;
7063             char __ddone; PDL_COMMENT("Dims done")
7064             } pdl_kcluster_struct;
7065              
7066 3           void pdl_kcluster_redodims(pdl_trans *__tr ) {
7067             int __dim;
7068 3           pdl_kcluster_struct *__privtrans = (pdl_kcluster_struct *) __tr;
7069            
7070             {
7071             PDL_Indx __creating[8];
7072 3           __privtrans->__n_size = -1;
7073 3           __privtrans->__d_size = -1;
7074 3           __creating[0] = 0;
7075 3           __creating[1] = 0;
7076 3           __creating[2] = 0;
7077 3           __creating[3] = 0;
7078 3           __creating[4] = 0;
7079 3 50         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    100          
7080 3 50         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    50          
7081 3 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    50          
7082             {
7083             {PDL_COMMENT("Start generic loop")
7084              
7085 3           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7086 0           } break; case PDL_B: {
7087 3 50         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7088 3           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7089              
7090 3 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7091 3           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7092              
7093 3 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7094 3           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7095              
7096 3 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7097 3           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7098              
7099 3 50         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7100 3           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7101              
7102 3 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7103 3           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7104              
7105 3 50         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7106 3           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7107              
7108 3 50         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7109 3           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7110              
7111 3           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7112 3           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7113 3           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7114 3           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7115 3           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7116 3           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7117              
7118             PDL_COMMENT("none")
7119 3           } } break; case PDL_S: {
7120 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7121 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7122              
7123 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7124 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7125              
7126 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7127 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7128              
7129 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7130 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7131              
7132 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7133 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7134              
7135 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7136 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7137              
7138 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7139 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7140              
7141 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7142 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7143              
7144 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7145 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7146 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7147 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7148 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7149 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7150              
7151             PDL_COMMENT("none")
7152 0           } } break; case PDL_US: {
7153 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7154 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7155              
7156 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7157 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7158              
7159 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7160 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7161              
7162 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7163 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7164              
7165 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7166 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7167              
7168 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7169 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7170              
7171 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7172 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7173              
7174 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7175 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7176              
7177 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7178 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7179 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7180 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7181 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7182 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7183              
7184             PDL_COMMENT("none")
7185 0           } } break; case PDL_L: {
7186 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7187 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7188              
7189 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7190 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7191              
7192 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7193 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7194              
7195 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7196 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7197              
7198 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7199 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7200              
7201 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7202 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7203              
7204 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7205 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7206              
7207 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7208 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7209              
7210 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7211 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7212 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7213 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7214 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7215 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7216              
7217             PDL_COMMENT("none")
7218 0           } } break; case PDL_IND: {
7219 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7220 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7221              
7222 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7223 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7224              
7225 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7226 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7227              
7228 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7229 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7230              
7231 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7232 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7233              
7234 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7235 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7236              
7237 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7238 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7239              
7240 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7241 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7242              
7243 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7244 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7245 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7246 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7247 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7248 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7249              
7250             PDL_COMMENT("none")
7251 0           } } break; case PDL_LL: {
7252 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7253 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7254              
7255 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7256 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7257              
7258 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7259 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7260              
7261 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7262 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7263              
7264 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7265 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7266              
7267 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7268 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7269              
7270 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7271 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7272              
7273 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7274 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7275              
7276 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7277 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7278 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7279 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7280 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7281 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7282              
7283             PDL_COMMENT("none")
7284 0           } } break; case PDL_F: {
7285 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7286 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7287              
7288 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7289 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7290              
7291 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7292 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7293              
7294 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7295 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7296              
7297 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7298 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7299              
7300 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7301 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7302              
7303 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7304 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7305              
7306 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7307 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7308              
7309 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7310 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7311 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7312 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7313 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7314 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7315              
7316             PDL_COMMENT("none")
7317 0           } } break; case PDL_D: {
7318 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7319 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7320              
7321 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7322 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7323              
7324 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7325 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7326              
7327 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7328 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7329              
7330 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7331 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7332              
7333 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7334 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7335              
7336 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7337 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7338              
7339 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7340 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7341              
7342 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7343 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7344 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7345 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7346 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7347 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7348              
7349             PDL_COMMENT("none")
7350 0           } break;}
7351 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
7352             }
7353             }
7354             {
7355             static char *__parnames[] = {"nclusters","data","mask","weight","npass","clusterids","error","nfound"};
7356             static PDL_Indx __realdims[] = {0,2,2,1,0,1,0,0};
7357             static char __funcname[] = "PDL::Cluster::kcluster";
7358             static pdl_errorinfo __einfo = {
7359             __funcname, __parnames, 8
7360             };
7361            
7362 3           PDL->initthreadstruct(2,__privtrans->pdls,
7363             __realdims,__creating,8,
7364             &__einfo,&(__privtrans->__pdlthread),
7365 3           __privtrans->vtable->per_pdl_flags,
7366             0 );
7367             }
7368 3 50         if(((__privtrans->pdls[1]))->ndims < 2) {
7369 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
7370 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7371             }
7372 3 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
7373 3           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
7374 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
7375 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
7376 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7377             }
7378             }
7379 3 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
7380 3           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
7381 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
7382 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
7383 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7384             }
7385             }
7386 3           PDL->make_physical(((__privtrans->pdls[1])));
7387 3 50         if(((__privtrans->pdls[2]))->ndims < 2) {
7388 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
7389 0 0         if (((__privtrans->pdls[2]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7390             }
7391 3 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
7392 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
7393 3 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
7394 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
7395 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7396             }
7397             }
7398 3 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
7399 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[1];
7400 3 50         } else if(((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[1]) {
    50          
7401 0 0         if(((__privtrans->pdls[2]))->dims[1] != 1) {
7402 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7403             }
7404             }
7405 3           PDL->make_physical(((__privtrans->pdls[2])));
7406 3 50         if(((__privtrans->pdls[3]))->ndims < 1) {
7407 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
7408             }
7409 3 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
7410 0           __privtrans->__d_size = ((__privtrans->pdls[3]))->dims[0];
7411 3 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[3]))->dims[0]) {
    50          
7412 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
7413 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7414             }
7415             }
7416 3           PDL->make_physical(((__privtrans->pdls[3])));
7417 3 100         if(!__creating[5]) {
7418 1 50         if(((__privtrans->pdls[5]))->ndims < 1) {
7419 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
7420             }
7421 1 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n_size == 1)) {
    50          
    50          
7422 0           __privtrans->__n_size = ((__privtrans->pdls[5]))->dims[0];
7423 1 50         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[5]))->dims[0]) {
    50          
7424 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
7425 0           PDL->pdl_barf("Error in kcluster:" "Wrong dims\n");
7426             }
7427             }
7428 1           PDL->make_physical(((__privtrans->pdls[5])));
7429             } else {
7430 2           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
7431 2           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
7432 3 50         }if(!__creating[6]) {
7433 0           PDL->make_physical(((__privtrans->pdls[6])));
7434             } else {
7435             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
7436 3           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,0);
7437 3 50         }if(!__creating[7]) {
7438 0           PDL->make_physical(((__privtrans->pdls[7])));
7439             } else {
7440             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
7441 3           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
7442             }
7443             { PDL_COMMENT("convenience block")
7444 3           void *hdrp = NULL;
7445 3           char propagate_hdrcpy = 0;
7446 3           SV *hdr_copy = NULL;
7447 3 50         if(!hdrp &&
    50          
7448 0 0         __privtrans->pdls[0]->hdrsv &&
7449 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
7450             ) {
7451 0           hdrp = __privtrans->pdls[0]->hdrsv;
7452 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
7453             }
7454 3 50         if(!hdrp &&
    50          
7455 0 0         __privtrans->pdls[1]->hdrsv &&
7456 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
7457             ) {
7458 0           hdrp = __privtrans->pdls[1]->hdrsv;
7459 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
7460             }
7461 3 50         if(!hdrp &&
    50          
7462 0 0         __privtrans->pdls[2]->hdrsv &&
7463 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
7464             ) {
7465 0           hdrp = __privtrans->pdls[2]->hdrsv;
7466 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
7467             }
7468 3 50         if(!hdrp &&
    50          
7469 0 0         __privtrans->pdls[3]->hdrsv &&
7470 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
7471             ) {
7472 0           hdrp = __privtrans->pdls[3]->hdrsv;
7473 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
7474             }
7475 3 50         if(!hdrp &&
    50          
7476 0 0         __privtrans->pdls[4]->hdrsv &&
7477 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
7478             ) {
7479 0           hdrp = __privtrans->pdls[4]->hdrsv;
7480 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
7481             }
7482 3 50         if(!hdrp &&
    100          
7483 1 50         !__creating[5] &&
7484 0 0         __privtrans->pdls[5]->hdrsv &&
7485 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
7486             ) {
7487 0           hdrp = __privtrans->pdls[5]->hdrsv;
7488 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
7489             }
7490 3 50         if(!hdrp &&
    50          
7491 0 0         !__creating[6] &&
7492 0 0         __privtrans->pdls[6]->hdrsv &&
7493 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
7494             ) {
7495 0           hdrp = __privtrans->pdls[6]->hdrsv;
7496 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
7497             }
7498 3 50         if(!hdrp &&
    50          
7499 0 0         !__creating[7] &&
7500 0 0         __privtrans->pdls[7]->hdrsv &&
7501 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
7502             ) {
7503 0           hdrp = __privtrans->pdls[7]->hdrsv;
7504 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
7505             }
7506 3 50         if (hdrp) {
7507 0 0         if(hdrp == &PL_sv_undef)
7508 0           hdr_copy = &PL_sv_undef;
7509             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
7510             int count;
7511             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
7512 0           dSP;
7513 0           ENTER ;
7514 0           SAVETMPS ;
7515 0 0         PUSHMARK(SP) ;
7516 0 0         XPUSHs( hdrp );
7517 0           PUTBACK ;
7518 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
7519 0           SPAGAIN ;
7520 0 0         if(count != 1)
7521 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
7522              
7523 0           hdr_copy = (SV *)POPs;
7524              
7525 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
7526 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
7527             }
7528              
7529 0 0         FREETMPS ;
7530 0           LEAVE ;
7531              
7532              
7533             } PDL_COMMENT("end of callback block")
7534              
7535 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
7536 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
7537 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
7538 0 0         if( hdr_copy != &PL_sv_undef )
7539 0           (void)SvREFCNT_inc(hdr_copy);
7540 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
7541             }
7542 0 0         if(propagate_hdrcpy)
7543 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
7544 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
7545 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
7546 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
7547 0 0         if( hdr_copy != &PL_sv_undef )
7548 0           (void)SvREFCNT_inc(hdr_copy);
7549 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
7550             }
7551 0 0         if(propagate_hdrcpy)
7552 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
7553 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
7554 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
7555 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
7556 0 0         if( hdr_copy != &PL_sv_undef )
7557 0           (void)SvREFCNT_inc(hdr_copy);
7558 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
7559             }
7560 0 0         if(propagate_hdrcpy)
7561 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
7562              
7563 0 0         if(hdr_copy != &PL_sv_undef)
7564 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
7565             } PDL_COMMENT("end of if(hdrp) block")
7566             } PDL_COMMENT("end of conv. block")
7567 3 50         if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
7568 0           __privtrans->__inc_data_d = 0; else
7569 3 50         __privtrans->__inc_data_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
7570 0           __privtrans->__inc_data_n = 0; else
7571 3 50         __privtrans->__inc_data_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
7572 0           __privtrans->__inc_mask_d = 0; else
7573 3 50         __privtrans->__inc_mask_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 1 || __privtrans->pdls[2]->dims[1] <= 1)
    50          
7574 0           __privtrans->__inc_mask_n = 0; else
7575 3 50         __privtrans->__inc_mask_n = __privtrans->pdls[2]->dimincs[1];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
7576 0           __privtrans->__inc_weight_d = 0; else
7577 3 50         __privtrans->__inc_weight_d = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    50          
7578 0           __privtrans->__inc_clusterids_n = 0; else
7579 3           __privtrans->__inc_clusterids_n = __privtrans->pdls[5]->dimincs[0]; __privtrans->__ddone = 1;
7580             }
7581 3           }
7582            
7583              
7584 0           pdl_trans * pdl_kcluster_copy(pdl_trans *__tr ) {
7585             int __dim;
7586 0           pdl_kcluster_struct *__privtrans = (pdl_kcluster_struct *) __tr;
7587            
7588             {
7589 0           pdl_kcluster_struct *__copy = malloc(sizeof(pdl_kcluster_struct));
7590 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
7591 0           __copy->has_badvalue = __privtrans->has_badvalue;
7592 0           __copy->badvalue = __privtrans->badvalue;
7593 0           __copy->flags = __privtrans->flags;
7594 0           __copy->vtable = __privtrans->vtable;
7595 0           __copy->__datatype = __privtrans->__datatype;
7596 0           __copy->freeproc = NULL;
7597 0           __copy->__ddone = __privtrans->__ddone;
7598             {int i;
7599 0 0         for(i=0; i<__copy->vtable->npdls; i++)
7600 0           __copy->pdls[i] = __privtrans->pdls[i];
7601             }
7602 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->ctrMethodFlag) = malloc(strlen(__privtrans->ctrMethodFlag)+1); strcpy(__copy->ctrMethodFlag,__privtrans->ctrMethodFlag);;
7603 0 0         if(__copy->__ddone) {
7604 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;
7605             }
7606 0           return (pdl_trans*)__copy;
7607             }
7608             }
7609            
7610              
7611 3           void pdl_kcluster_readdata(pdl_trans *__tr ) {
7612             int __dim;
7613 3           pdl_kcluster_struct *__privtrans = (pdl_kcluster_struct *) __tr;
7614            
7615             {
7616             {PDL_COMMENT("Start generic loop")
7617              
7618 3           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
7619 0           } break; case PDL_B: {
7620 3 50         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7621 3           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7622              
7623 3 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7624 3           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7625              
7626 3 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7627 3           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7628              
7629 3 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7630 3           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7631              
7632 3 50         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7633 3           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7634              
7635 3 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7636 3           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7637              
7638 3 50         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7639 3           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7640              
7641 3 50         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7642 3           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7643              
7644 3           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7645 3           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7646 3           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7647 3           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7648 3           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7649 3           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7650              
7651              
7652 3           int transpose = 0;
7653 3           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
7654 3           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
7655            
7656             PDL_COMMENT("THREADLOOPBEGIN")
7657 3 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7658 3           do { register PDL_Indx __tind1=0,__tind2=0;
7659 3           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7660 3           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7661 3           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7662 3           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7663 3           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7664 3           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7665 3           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7666 3           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
7667 3           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
7668 3           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
7669 3           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
7670 3           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
7671 3           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7672 3           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7673 3           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7674 3           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
7675 3           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
7676 3           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
7677 3           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
7678 3           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
7679 3           nclusters_datap += __offsp[0];
7680 3           data_datap += __offsp[1];
7681 3           mask_datap += __offsp[2];
7682 3           weight_datap += __offsp[3];
7683 3           npass_datap += __offsp[4];
7684 3           clusterids_datap += __offsp[5];
7685 3           error_datap += __offsp[6];
7686 3           nfound_datap += __offsp[7];
7687 6 100         for( __tind2 = 0 ;
7688             __tind2 < __tdims1 ;
7689 3           __tind2++
7690 3           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
7691 3           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
7692 3           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
7693 3           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
7694 3           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
7695 3           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
7696 3           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
7697 3           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
7698             )
7699             {
7700 6 100         for( __tind1 = 0 ;
7701             __tind1 < __tdims0 ;
7702 3           __tind1++
7703 3           ,nclusters_datap += __tinc0_0
7704 3           ,data_datap += __tinc0_1
7705 3           ,mask_datap += __tinc0_2
7706 3           ,weight_datap += __tinc0_3
7707 3           ,npass_datap += __tinc0_4
7708 3           ,clusterids_datap += __tinc0_5
7709 3           ,error_datap += __tinc0_6
7710 3           ,nfound_datap += __tinc0_7
7711             )
7712             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
7713 3           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
7714 3           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
7715 3           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
7716 6           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
7717             clusterids_datap, error_datap, nfound_datap);
7718            
7719             PDL_COMMENT("THREADLOOPEND")
7720             }
7721             }
7722 3           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7723 3           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7724 3           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7725 3           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
7726 3           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
7727 3           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
7728 3           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
7729 3           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
7730 3 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
7731             /*-- cleanup --*/
7732 3 50         if (datapp) free(datapp);
7733 3 50         if (maskpp) free(maskpp);
7734              
7735 3           } } break; case PDL_S: {
7736 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7737 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7738              
7739 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7740 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7741              
7742 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7743 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7744              
7745 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7746 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7747              
7748 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7749 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7750              
7751 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7752 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7753              
7754 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7755 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7756              
7757 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7758 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7759              
7760 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7761 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7762 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7763 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7764 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7765 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7766              
7767              
7768 0           int transpose = 0;
7769 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
7770 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
7771            
7772             PDL_COMMENT("THREADLOOPBEGIN")
7773 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7774 0           do { register PDL_Indx __tind1=0,__tind2=0;
7775 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7776 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7777 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7778 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7779 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7780 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7781 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7782 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
7783 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
7784 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
7785 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
7786 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
7787 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7788 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7789 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7790 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
7791 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
7792 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
7793 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
7794 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
7795 0           nclusters_datap += __offsp[0];
7796 0           data_datap += __offsp[1];
7797 0           mask_datap += __offsp[2];
7798 0           weight_datap += __offsp[3];
7799 0           npass_datap += __offsp[4];
7800 0           clusterids_datap += __offsp[5];
7801 0           error_datap += __offsp[6];
7802 0           nfound_datap += __offsp[7];
7803 0 0         for( __tind2 = 0 ;
7804             __tind2 < __tdims1 ;
7805 0           __tind2++
7806 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
7807 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
7808 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
7809 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
7810 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
7811 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
7812 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
7813 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
7814             )
7815             {
7816 0 0         for( __tind1 = 0 ;
7817             __tind1 < __tdims0 ;
7818 0           __tind1++
7819 0           ,nclusters_datap += __tinc0_0
7820 0           ,data_datap += __tinc0_1
7821 0           ,mask_datap += __tinc0_2
7822 0           ,weight_datap += __tinc0_3
7823 0           ,npass_datap += __tinc0_4
7824 0           ,clusterids_datap += __tinc0_5
7825 0           ,error_datap += __tinc0_6
7826 0           ,nfound_datap += __tinc0_7
7827             )
7828             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
7829 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
7830 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
7831 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
7832 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
7833             clusterids_datap, error_datap, nfound_datap);
7834            
7835             PDL_COMMENT("THREADLOOPEND")
7836             }
7837             }
7838 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7839 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7840 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7841 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
7842 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
7843 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
7844 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
7845 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
7846 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
7847             /*-- cleanup --*/
7848 0 0         if (datapp) free(datapp);
7849 0 0         if (maskpp) free(maskpp);
7850              
7851 0           } } break; case PDL_US: {
7852 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7853 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7854              
7855 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7856 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7857              
7858 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7859 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7860              
7861 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7862 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7863              
7864 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7865 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7866              
7867 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7868 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7869              
7870 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7871 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7872              
7873 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7874 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7875              
7876 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7877 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7878 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7879 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7880 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7881 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7882              
7883              
7884 0           int transpose = 0;
7885 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
7886 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
7887            
7888             PDL_COMMENT("THREADLOOPBEGIN")
7889 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
7890 0           do { register PDL_Indx __tind1=0,__tind2=0;
7891 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
7892 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
7893 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
7894 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
7895 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
7896 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
7897 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
7898 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
7899 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
7900 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
7901 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
7902 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
7903 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
7904 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
7905 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
7906 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
7907 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
7908 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
7909 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
7910 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
7911 0           nclusters_datap += __offsp[0];
7912 0           data_datap += __offsp[1];
7913 0           mask_datap += __offsp[2];
7914 0           weight_datap += __offsp[3];
7915 0           npass_datap += __offsp[4];
7916 0           clusterids_datap += __offsp[5];
7917 0           error_datap += __offsp[6];
7918 0           nfound_datap += __offsp[7];
7919 0 0         for( __tind2 = 0 ;
7920             __tind2 < __tdims1 ;
7921 0           __tind2++
7922 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
7923 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
7924 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
7925 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
7926 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
7927 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
7928 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
7929 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
7930             )
7931             {
7932 0 0         for( __tind1 = 0 ;
7933             __tind1 < __tdims0 ;
7934 0           __tind1++
7935 0           ,nclusters_datap += __tinc0_0
7936 0           ,data_datap += __tinc0_1
7937 0           ,mask_datap += __tinc0_2
7938 0           ,weight_datap += __tinc0_3
7939 0           ,npass_datap += __tinc0_4
7940 0           ,clusterids_datap += __tinc0_5
7941 0           ,error_datap += __tinc0_6
7942 0           ,nfound_datap += __tinc0_7
7943             )
7944             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
7945 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
7946 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
7947 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
7948 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
7949             clusterids_datap, error_datap, nfound_datap);
7950            
7951             PDL_COMMENT("THREADLOOPEND")
7952             }
7953             }
7954 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
7955 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
7956 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
7957 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
7958 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
7959 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
7960 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
7961 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
7962 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
7963             /*-- cleanup --*/
7964 0 0         if (datapp) free(datapp);
7965 0 0         if (maskpp) free(maskpp);
7966              
7967 0           } } break; case PDL_L: {
7968 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
7969 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
7970              
7971 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
7972 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
7973              
7974 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
7975 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
7976              
7977 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
7978 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
7979              
7980 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
7981 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
7982              
7983 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
7984 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
7985              
7986 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
7987 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
7988              
7989 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
7990 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
7991              
7992 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
7993 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
7994 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
7995 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
7996 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
7997 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
7998              
7999              
8000 0           int transpose = 0;
8001 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
8002 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
8003            
8004             PDL_COMMENT("THREADLOOPBEGIN")
8005 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
8006 0           do { register PDL_Indx __tind1=0,__tind2=0;
8007 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
8008 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
8009 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
8010 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
8011 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
8012 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
8013 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
8014 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
8015 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
8016 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
8017 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
8018 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
8019 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
8020 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
8021 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
8022 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
8023 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
8024 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
8025 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
8026 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
8027 0           nclusters_datap += __offsp[0];
8028 0           data_datap += __offsp[1];
8029 0           mask_datap += __offsp[2];
8030 0           weight_datap += __offsp[3];
8031 0           npass_datap += __offsp[4];
8032 0           clusterids_datap += __offsp[5];
8033 0           error_datap += __offsp[6];
8034 0           nfound_datap += __offsp[7];
8035 0 0         for( __tind2 = 0 ;
8036             __tind2 < __tdims1 ;
8037 0           __tind2++
8038 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
8039 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
8040 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
8041 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
8042 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
8043 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
8044 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
8045 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
8046             )
8047             {
8048 0 0         for( __tind1 = 0 ;
8049             __tind1 < __tdims0 ;
8050 0           __tind1++
8051 0           ,nclusters_datap += __tinc0_0
8052 0           ,data_datap += __tinc0_1
8053 0           ,mask_datap += __tinc0_2
8054 0           ,weight_datap += __tinc0_3
8055 0           ,npass_datap += __tinc0_4
8056 0           ,clusterids_datap += __tinc0_5
8057 0           ,error_datap += __tinc0_6
8058 0           ,nfound_datap += __tinc0_7
8059             )
8060             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
8061 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
8062 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
8063 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
8064 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
8065             clusterids_datap, error_datap, nfound_datap);
8066            
8067             PDL_COMMENT("THREADLOOPEND")
8068             }
8069             }
8070 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
8071 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
8072 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
8073 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
8074 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
8075 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
8076 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
8077 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
8078 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
8079             /*-- cleanup --*/
8080 0 0         if (datapp) free(datapp);
8081 0 0         if (maskpp) free(maskpp);
8082              
8083 0           } } break; case PDL_IND: {
8084 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8085 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8086              
8087 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8088 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8089              
8090 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8091 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8092              
8093 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8094 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
8095              
8096 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8097 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
8098              
8099 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8100 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8101              
8102 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
8103 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
8104              
8105 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
8106 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
8107              
8108 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
8109 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8110 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
8111 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
8112 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
8113 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
8114              
8115              
8116 0           int transpose = 0;
8117 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
8118 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
8119            
8120             PDL_COMMENT("THREADLOOPBEGIN")
8121 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
8122 0           do { register PDL_Indx __tind1=0,__tind2=0;
8123 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
8124 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
8125 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
8126 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
8127 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
8128 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
8129 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
8130 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
8131 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
8132 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
8133 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
8134 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
8135 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
8136 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
8137 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
8138 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
8139 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
8140 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
8141 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
8142 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
8143 0           nclusters_datap += __offsp[0];
8144 0           data_datap += __offsp[1];
8145 0           mask_datap += __offsp[2];
8146 0           weight_datap += __offsp[3];
8147 0           npass_datap += __offsp[4];
8148 0           clusterids_datap += __offsp[5];
8149 0           error_datap += __offsp[6];
8150 0           nfound_datap += __offsp[7];
8151 0 0         for( __tind2 = 0 ;
8152             __tind2 < __tdims1 ;
8153 0           __tind2++
8154 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
8155 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
8156 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
8157 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
8158 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
8159 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
8160 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
8161 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
8162             )
8163             {
8164 0 0         for( __tind1 = 0 ;
8165             __tind1 < __tdims0 ;
8166 0           __tind1++
8167 0           ,nclusters_datap += __tinc0_0
8168 0           ,data_datap += __tinc0_1
8169 0           ,mask_datap += __tinc0_2
8170 0           ,weight_datap += __tinc0_3
8171 0           ,npass_datap += __tinc0_4
8172 0           ,clusterids_datap += __tinc0_5
8173 0           ,error_datap += __tinc0_6
8174 0           ,nfound_datap += __tinc0_7
8175             )
8176             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
8177 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
8178 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
8179 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
8180 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
8181             clusterids_datap, error_datap, nfound_datap);
8182            
8183             PDL_COMMENT("THREADLOOPEND")
8184             }
8185             }
8186 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
8187 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
8188 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
8189 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
8190 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
8191 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
8192 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
8193 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
8194 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
8195             /*-- cleanup --*/
8196 0 0         if (datapp) free(datapp);
8197 0 0         if (maskpp) free(maskpp);
8198              
8199 0           } } break; case PDL_LL: {
8200 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8201 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8202              
8203 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8204 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8205              
8206 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8207 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8208              
8209 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8210 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
8211              
8212 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8213 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
8214              
8215 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8216 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8217              
8218 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
8219 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
8220              
8221 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
8222 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
8223              
8224 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
8225 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8226 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
8227 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
8228 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
8229 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
8230              
8231              
8232 0           int transpose = 0;
8233 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
8234 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
8235            
8236             PDL_COMMENT("THREADLOOPBEGIN")
8237 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
8238 0           do { register PDL_Indx __tind1=0,__tind2=0;
8239 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
8240 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
8241 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
8242 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
8243 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
8244 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
8245 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
8246 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
8247 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
8248 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
8249 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
8250 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
8251 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
8252 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
8253 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
8254 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
8255 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
8256 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
8257 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
8258 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
8259 0           nclusters_datap += __offsp[0];
8260 0           data_datap += __offsp[1];
8261 0           mask_datap += __offsp[2];
8262 0           weight_datap += __offsp[3];
8263 0           npass_datap += __offsp[4];
8264 0           clusterids_datap += __offsp[5];
8265 0           error_datap += __offsp[6];
8266 0           nfound_datap += __offsp[7];
8267 0 0         for( __tind2 = 0 ;
8268             __tind2 < __tdims1 ;
8269 0           __tind2++
8270 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
8271 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
8272 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
8273 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
8274 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
8275 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
8276 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
8277 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
8278             )
8279             {
8280 0 0         for( __tind1 = 0 ;
8281             __tind1 < __tdims0 ;
8282 0           __tind1++
8283 0           ,nclusters_datap += __tinc0_0
8284 0           ,data_datap += __tinc0_1
8285 0           ,mask_datap += __tinc0_2
8286 0           ,weight_datap += __tinc0_3
8287 0           ,npass_datap += __tinc0_4
8288 0           ,clusterids_datap += __tinc0_5
8289 0           ,error_datap += __tinc0_6
8290 0           ,nfound_datap += __tinc0_7
8291             )
8292             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
8293 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
8294 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
8295 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
8296 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
8297             clusterids_datap, error_datap, nfound_datap);
8298            
8299             PDL_COMMENT("THREADLOOPEND")
8300             }
8301             }
8302 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
8303 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
8304 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
8305 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
8306 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
8307 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
8308 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
8309 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
8310 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
8311             /*-- cleanup --*/
8312 0 0         if (datapp) free(datapp);
8313 0 0         if (maskpp) free(maskpp);
8314              
8315 0           } } break; case PDL_F: {
8316 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8317 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8318              
8319 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8320 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8321              
8322 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8323 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8324              
8325 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8326 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
8327              
8328 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8329 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
8330              
8331 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8332 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8333              
8334 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
8335 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
8336              
8337 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
8338 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
8339              
8340 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
8341 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8342 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
8343 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
8344 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
8345 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
8346              
8347              
8348 0           int transpose = 0;
8349 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
8350 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
8351            
8352             PDL_COMMENT("THREADLOOPBEGIN")
8353 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
8354 0           do { register PDL_Indx __tind1=0,__tind2=0;
8355 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
8356 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
8357 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
8358 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
8359 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
8360 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
8361 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
8362 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
8363 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
8364 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
8365 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
8366 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
8367 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
8368 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
8369 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
8370 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
8371 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
8372 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
8373 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
8374 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
8375 0           nclusters_datap += __offsp[0];
8376 0           data_datap += __offsp[1];
8377 0           mask_datap += __offsp[2];
8378 0           weight_datap += __offsp[3];
8379 0           npass_datap += __offsp[4];
8380 0           clusterids_datap += __offsp[5];
8381 0           error_datap += __offsp[6];
8382 0           nfound_datap += __offsp[7];
8383 0 0         for( __tind2 = 0 ;
8384             __tind2 < __tdims1 ;
8385 0           __tind2++
8386 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
8387 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
8388 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
8389 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
8390 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
8391 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
8392 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
8393 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
8394             )
8395             {
8396 0 0         for( __tind1 = 0 ;
8397             __tind1 < __tdims0 ;
8398 0           __tind1++
8399 0           ,nclusters_datap += __tinc0_0
8400 0           ,data_datap += __tinc0_1
8401 0           ,mask_datap += __tinc0_2
8402 0           ,weight_datap += __tinc0_3
8403 0           ,npass_datap += __tinc0_4
8404 0           ,clusterids_datap += __tinc0_5
8405 0           ,error_datap += __tinc0_6
8406 0           ,nfound_datap += __tinc0_7
8407             )
8408             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
8409 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
8410 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
8411 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
8412 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
8413             clusterids_datap, error_datap, nfound_datap);
8414            
8415             PDL_COMMENT("THREADLOOPEND")
8416             }
8417             }
8418 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
8419 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
8420 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
8421 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
8422 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
8423 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
8424 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
8425 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
8426 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
8427             /*-- cleanup --*/
8428 0 0         if (datapp) free(datapp);
8429 0 0         if (maskpp) free(maskpp);
8430              
8431 0           } } break; case PDL_D: {
8432 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8433 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8434              
8435 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8436 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8437              
8438 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8439 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8440              
8441 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8442 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
8443              
8444 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8445 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
8446              
8447 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8448 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8449              
8450 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
8451 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
8452              
8453 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
8454 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
8455              
8456 0           {register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
8457 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8458 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
8459 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
8460 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
8461 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
8462              
8463              
8464 0           int transpose = 0;
8465 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
8466 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
8467            
8468             PDL_COMMENT("THREADLOOPBEGIN")
8469 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
8470 0           do { register PDL_Indx __tind1=0,__tind2=0;
8471 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
8472 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
8473 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
8474 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
8475 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
8476 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
8477 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
8478 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
8479 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
8480 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
8481 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
8482 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
8483 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
8484 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
8485 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
8486 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
8487 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
8488 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
8489 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
8490 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
8491 0           nclusters_datap += __offsp[0];
8492 0           data_datap += __offsp[1];
8493 0           mask_datap += __offsp[2];
8494 0           weight_datap += __offsp[3];
8495 0           npass_datap += __offsp[4];
8496 0           clusterids_datap += __offsp[5];
8497 0           error_datap += __offsp[6];
8498 0           nfound_datap += __offsp[7];
8499 0 0         for( __tind2 = 0 ;
8500             __tind2 < __tdims1 ;
8501 0           __tind2++
8502 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
8503 0           ,data_datap += __tinc1_1 - __tinc0_1 * __tdims0
8504 0           ,mask_datap += __tinc1_2 - __tinc0_2 * __tdims0
8505 0           ,weight_datap += __tinc1_3 - __tinc0_3 * __tdims0
8506 0           ,npass_datap += __tinc1_4 - __tinc0_4 * __tdims0
8507 0           ,clusterids_datap += __tinc1_5 - __tinc0_5 * __tdims0
8508 0           ,error_datap += __tinc1_6 - __tinc0_6 * __tdims0
8509 0           ,nfound_datap += __tinc1_7 - __tinc0_7 * __tdims0
8510             )
8511             {
8512 0 0         for( __tind1 = 0 ;
8513             __tind1 < __tdims0 ;
8514 0           __tind1++
8515 0           ,nclusters_datap += __tinc0_0
8516 0           ,data_datap += __tinc0_1
8517 0           ,mask_datap += __tinc0_2
8518 0           ,weight_datap += __tinc0_3
8519 0           ,npass_datap += __tinc0_4
8520 0           ,clusterids_datap += __tinc0_5
8521 0           ,error_datap += __tinc0_6
8522 0           ,nfound_datap += __tinc0_7
8523             )
8524             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
8525 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
8526 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
8527 0           kcluster((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
8528 0           weight_datap, transpose, (npass_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->ctrMethodFlag, *__privtrans->distFlag,
8529             clusterids_datap, error_datap, nfound_datap);
8530            
8531             PDL_COMMENT("THREADLOOPEND")
8532             }
8533             }
8534 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
8535 0           data_datap -= __tinc1_1 * __tdims1 + __offsp[1];
8536 0           mask_datap -= __tinc1_2 * __tdims1 + __offsp[2];
8537 0           weight_datap -= __tinc1_3 * __tdims1 + __offsp[3];
8538 0           npass_datap -= __tinc1_4 * __tdims1 + __offsp[4];
8539 0           clusterids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
8540 0           error_datap -= __tinc1_6 * __tdims1 + __offsp[6];
8541 0           nfound_datap -= __tinc1_7 * __tdims1 + __offsp[7];
8542 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
8543             /*-- cleanup --*/
8544 0 0         if (datapp) free(datapp);
8545 0 0         if (maskpp) free(maskpp);
8546              
8547 0           } break;}
8548 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
8549             }
8550             }
8551             }
8552            
8553              
8554              
8555              
8556 3           void pdl_kcluster_free(pdl_trans *__tr ) {
8557             int __dim;
8558 3           pdl_kcluster_struct *__privtrans = (pdl_kcluster_struct *) __tr;
8559            
8560             {
8561            
8562 3           PDL_TR_CLRMAGIC(__privtrans);
8563 3           free(__privtrans->distFlag);;free(__privtrans->ctrMethodFlag);;
8564 3 50         if(__privtrans->__ddone) {
8565 3           PDL->freethreadloop(&(__privtrans->__pdlthread));
8566             ;;;;;;;;;
8567             }
8568            
8569             }
8570 3           }
8571            
8572              
8573              
8574              
8575             static char pdl_kcluster_vtable_flags[] =
8576             { PDL_TPDL_VAFFINE_OK,0,0,0,PDL_TPDL_VAFFINE_OK,0,0,0};
8577             pdl_transvtable pdl_kcluster_vtable = {
8578             0,0, 5, 8, pdl_kcluster_vtable_flags,
8579             pdl_kcluster_redodims, pdl_kcluster_readdata, NULL,
8580             pdl_kcluster_free,NULL,NULL,pdl_kcluster_copy,
8581             sizeof(pdl_kcluster_struct),"pdl_kcluster_vtable"
8582             };
8583              
8584             typedef struct pdl_kmedoids_struct {
8585             PDL_TRANS_START(6);
8586             pdl_thread __pdlthread;PDL_Indx __inc_distance_n0;PDL_Indx __inc_distance_n1;PDL_Indx __inc_clusterids_n;PDL_Indx __n_size;
8587            
8588             char __ddone; PDL_COMMENT("Dims done")
8589             } pdl_kmedoids_struct;
8590              
8591 2           void pdl_kmedoids_redodims(pdl_trans *__tr ) {
8592             int __dim;
8593 2           pdl_kmedoids_struct *__privtrans = (pdl_kmedoids_struct *) __tr;
8594            
8595             {
8596             PDL_Indx __creating[6];
8597 2           __privtrans->__n_size = -1;
8598 2           __creating[0] = 0;
8599 2           __creating[1] = 0;
8600 2           __creating[2] = 0;
8601 2 50         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    0          
8602 2 50         __creating[4] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[4]);
    0          
8603 2 50         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    50          
8604             {
8605             {PDL_COMMENT("Start generic loop")
8606              
8607 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
8608 0           } break; case PDL_B: {
8609 2 50         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8610 2           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8611              
8612 2 50         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    50          
8613 2           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8614              
8615 2 50         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8616 2           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8617              
8618 2 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8619 2           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8620              
8621 2 50         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8622 2           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8623              
8624 2 50         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8625 2           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8626              
8627 2           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8628 2           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8629 2           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8630              
8631             PDL_COMMENT("none")
8632 2           } } break; case PDL_S: {
8633 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8634 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8635              
8636 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8637 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8638              
8639 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8640 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8641              
8642 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8643 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8644              
8645 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8646 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8647              
8648 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8649 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8650              
8651 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8652 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8653 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8654              
8655             PDL_COMMENT("none")
8656 0           } } break; case PDL_US: {
8657 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8658 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8659              
8660 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8661 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8662              
8663 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8664 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8665              
8666 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8667 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8668              
8669 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8670 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8671              
8672 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8673 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8674              
8675 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8676 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8677 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8678              
8679             PDL_COMMENT("none")
8680 0           } } break; case PDL_L: {
8681 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8682 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8683              
8684 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8685 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8686              
8687 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8688 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8689              
8690 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8691 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8692              
8693 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8694 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8695              
8696 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8697 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8698              
8699 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8700 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8701 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8702              
8703             PDL_COMMENT("none")
8704 0           } } break; case PDL_IND: {
8705 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8706 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8707              
8708 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8709 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8710              
8711 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8712 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8713              
8714 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8715 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8716              
8717 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8718 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8719              
8720 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8721 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8722              
8723 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8724 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8725 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8726              
8727             PDL_COMMENT("none")
8728 0           } } break; case PDL_LL: {
8729 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8730 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8731              
8732 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8733 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8734              
8735 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8736 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8737              
8738 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8739 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8740              
8741 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8742 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8743              
8744 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8745 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8746              
8747 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8748 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8749 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8750              
8751             PDL_COMMENT("none")
8752 0           } } break; case PDL_F: {
8753 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8754 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8755              
8756 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8757 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8758              
8759 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8760 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8761              
8762 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8763 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8764              
8765 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8766 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8767              
8768 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8769 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8770              
8771 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8772 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8773 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8774              
8775             PDL_COMMENT("none")
8776 0           } } break; case PDL_D: {
8777 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
8778 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
8779              
8780 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
8781 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
8782              
8783 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
8784 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
8785              
8786 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
8787 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
8788              
8789 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
8790 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
8791              
8792 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
8793 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
8794              
8795 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
8796 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
8797 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
8798              
8799             PDL_COMMENT("none")
8800 0           } break;}
8801 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
8802             }
8803             }
8804             {
8805             static char *__parnames[] = {"nclusters","distance","npass","clusterids","error","nfound"};
8806             static PDL_Indx __realdims[] = {0,2,0,1,0,0};
8807             static char __funcname[] = "PDL::Cluster::kmedoids";
8808             static pdl_errorinfo __einfo = {
8809             __funcname, __parnames, 6
8810             };
8811            
8812 2           PDL->initthreadstruct(2,__privtrans->pdls,
8813             __realdims,__creating,6,
8814             &__einfo,&(__privtrans->__pdlthread),
8815 2           __privtrans->vtable->per_pdl_flags,
8816             0 );
8817             }
8818 2 50         if(((__privtrans->pdls[1]))->ndims < 2) {
8819 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
8820 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
8821             }
8822 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
8823 2           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
8824 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
8825 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
8826 0           PDL->pdl_barf("Error in kmedoids:" "Wrong dims\n");
8827             }
8828             }
8829 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
8830 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
8831 2 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
8832 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
8833 0           PDL->pdl_barf("Error in kmedoids:" "Wrong dims\n");
8834             }
8835             }
8836 2           PDL->make_physical(((__privtrans->pdls[1])));
8837 2 50         if(!__creating[3]) {
8838 2 50         if(((__privtrans->pdls[3]))->ndims < 1) {
8839 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
8840             }
8841 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size == 1)) {
    50          
    50          
8842 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[0];
8843 2 50         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[0]) {
    50          
8844 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
8845 0           PDL->pdl_barf("Error in kmedoids:" "Wrong dims\n");
8846             }
8847             }
8848 2           PDL->make_physical(((__privtrans->pdls[3])));
8849             } else {
8850 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
8851 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
8852 2 50         }if(!__creating[4]) {
8853 2           PDL->make_physical(((__privtrans->pdls[4])));
8854             } else {
8855             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
8856 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,4,dims,0);
8857 2 50         }if(!__creating[5]) {
8858 2           PDL->make_physical(((__privtrans->pdls[5])));
8859             } else {
8860             PDL_Indx dims[1]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")
8861 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
8862             }
8863             { PDL_COMMENT("convenience block")
8864 2           void *hdrp = NULL;
8865 2           char propagate_hdrcpy = 0;
8866 2           SV *hdr_copy = NULL;
8867 2 50         if(!hdrp &&
    50          
8868 0 0         __privtrans->pdls[0]->hdrsv &&
8869 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
8870             ) {
8871 0           hdrp = __privtrans->pdls[0]->hdrsv;
8872 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
8873             }
8874 2 50         if(!hdrp &&
    50          
8875 0 0         __privtrans->pdls[1]->hdrsv &&
8876 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
8877             ) {
8878 0           hdrp = __privtrans->pdls[1]->hdrsv;
8879 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
8880             }
8881 2 50         if(!hdrp &&
    50          
8882 0 0         __privtrans->pdls[2]->hdrsv &&
8883 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
8884             ) {
8885 0           hdrp = __privtrans->pdls[2]->hdrsv;
8886 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
8887             }
8888 2 50         if(!hdrp &&
    50          
8889 2 50         !__creating[3] &&
8890 0 0         __privtrans->pdls[3]->hdrsv &&
8891 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
8892             ) {
8893 0           hdrp = __privtrans->pdls[3]->hdrsv;
8894 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
8895             }
8896 2 50         if(!hdrp &&
    50          
8897 2 50         !__creating[4] &&
8898 0 0         __privtrans->pdls[4]->hdrsv &&
8899 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
8900             ) {
8901 0           hdrp = __privtrans->pdls[4]->hdrsv;
8902 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
8903             }
8904 2 50         if(!hdrp &&
    50          
8905 2 50         !__creating[5] &&
8906 0 0         __privtrans->pdls[5]->hdrsv &&
8907 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
8908             ) {
8909 0           hdrp = __privtrans->pdls[5]->hdrsv;
8910 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
8911             }
8912 2 50         if (hdrp) {
8913 0 0         if(hdrp == &PL_sv_undef)
8914 0           hdr_copy = &PL_sv_undef;
8915             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
8916             int count;
8917             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
8918 0           dSP;
8919 0           ENTER ;
8920 0           SAVETMPS ;
8921 0 0         PUSHMARK(SP) ;
8922 0 0         XPUSHs( hdrp );
8923 0           PUTBACK ;
8924 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
8925 0           SPAGAIN ;
8926 0 0         if(count != 1)
8927 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
8928              
8929 0           hdr_copy = (SV *)POPs;
8930              
8931 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
8932 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
8933             }
8934              
8935 0 0         FREETMPS ;
8936 0           LEAVE ;
8937              
8938              
8939             } PDL_COMMENT("end of callback block")
8940              
8941 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
8942 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
8943 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
8944 0 0         if( hdr_copy != &PL_sv_undef )
8945 0           (void)SvREFCNT_inc(hdr_copy);
8946 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
8947             }
8948 0 0         if(propagate_hdrcpy)
8949 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
8950 0 0         if ( __privtrans->pdls[4]->hdrsv != hdrp ){
8951 0 0         if( __privtrans->pdls[4]->hdrsv && __privtrans->pdls[4]->hdrsv != &PL_sv_undef)
    0          
8952 0           (void)SvREFCNT_dec( __privtrans->pdls[4]->hdrsv );
8953 0 0         if( hdr_copy != &PL_sv_undef )
8954 0           (void)SvREFCNT_inc(hdr_copy);
8955 0           __privtrans->pdls[4]->hdrsv = hdr_copy;
8956             }
8957 0 0         if(propagate_hdrcpy)
8958 0           __privtrans->pdls[4]->state |= PDL_HDRCPY;
8959 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
8960 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
8961 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
8962 0 0         if( hdr_copy != &PL_sv_undef )
8963 0           (void)SvREFCNT_inc(hdr_copy);
8964 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
8965             }
8966 0 0         if(propagate_hdrcpy)
8967 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
8968              
8969 0 0         if(hdr_copy != &PL_sv_undef)
8970 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
8971             } PDL_COMMENT("end of if(hdrp) block")
8972             } PDL_COMMENT("end of conv. block")
8973 2 50         if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
8974 0           __privtrans->__inc_distance_n0 = 0; else
8975 2 50         __privtrans->__inc_distance_n0 = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
8976 0           __privtrans->__inc_distance_n1 = 0; else
8977 2 50         __privtrans->__inc_distance_n1 = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
8978 0           __privtrans->__inc_clusterids_n = 0; else
8979 2           __privtrans->__inc_clusterids_n = __privtrans->pdls[3]->dimincs[0]; __privtrans->__ddone = 1;
8980             }
8981 2           }
8982            
8983              
8984 0           pdl_trans * pdl_kmedoids_copy(pdl_trans *__tr ) {
8985             int __dim;
8986 0           pdl_kmedoids_struct *__privtrans = (pdl_kmedoids_struct *) __tr;
8987            
8988             {
8989 0           pdl_kmedoids_struct *__copy = malloc(sizeof(pdl_kmedoids_struct));
8990 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
8991 0           __copy->has_badvalue = __privtrans->has_badvalue;
8992 0           __copy->badvalue = __privtrans->badvalue;
8993 0           __copy->flags = __privtrans->flags;
8994 0           __copy->vtable = __privtrans->vtable;
8995 0           __copy->__datatype = __privtrans->__datatype;
8996 0           __copy->freeproc = NULL;
8997 0           __copy->__ddone = __privtrans->__ddone;
8998             {int i;
8999 0 0         for(i=0; i<__copy->vtable->npdls; i++)
9000 0           __copy->pdls[i] = __privtrans->pdls[i];
9001             }
9002            
9003 0 0         if(__copy->__ddone) {
9004 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_distance_n0=__copy->__inc_distance_n0;__privtrans->__inc_distance_n1=__copy->__inc_distance_n1;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__copy->__n_size=__privtrans->__n_size;
9005             }
9006 0           return (pdl_trans*)__copy;
9007             }
9008             }
9009            
9010              
9011 2           void pdl_kmedoids_readdata(pdl_trans *__tr ) {
9012             int __dim;
9013 2           pdl_kmedoids_struct *__privtrans = (pdl_kmedoids_struct *) __tr;
9014            
9015             {
9016             {PDL_COMMENT("Start generic loop")
9017              
9018 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
9019 0           } break; case PDL_B: {
9020 2 50         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9021 2           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9022              
9023 2 50         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    50          
9024 2           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9025              
9026 2 50         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9027 2           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9028              
9029 2 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9030 2           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9031              
9032 2 50         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9033 2           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9034              
9035 2 50         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9036 2           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9037              
9038 2           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9039 2           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9040 2           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9041              
9042              
9043 2           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9044            
9045             PDL_COMMENT("THREADLOOPBEGIN")
9046 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9047 2           do { register PDL_Indx __tind1=0,__tind2=0;
9048 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9049 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9050 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9051 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9052 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9053 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9054 2           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9055 2           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9056 2           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9057 2           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9058 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9059 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9060 2           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9061 2           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9062 2           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9063 2           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9064 2           nclusters_datap += __offsp[0];
9065 2           distance_datap += __offsp[1];
9066 2           npass_datap += __offsp[2];
9067 2           clusterids_datap += __offsp[3];
9068 2           error_datap += __offsp[4];
9069 2           nfound_datap += __offsp[5];
9070 4 100         for( __tind2 = 0 ;
9071             __tind2 < __tdims1 ;
9072 2           __tind2++
9073 2           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9074 2           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9075 2           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9076 2           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9077 2           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9078 2           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9079             )
9080             {
9081 4 100         for( __tind1 = 0 ;
9082             __tind1 < __tdims0 ;
9083 2           __tind1++
9084 2           ,nclusters_datap += __tinc0_0
9085 2           ,distance_datap += __tinc0_1
9086 2           ,npass_datap += __tinc0_2
9087 2           ,clusterids_datap += __tinc0_3
9088 2           ,error_datap += __tinc0_4
9089 2           ,nfound_datap += __tinc0_5
9090             )
9091             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9092 2           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9093 2           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9094             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9095            
9096             PDL_COMMENT("THREADLOOPEND")
9097             }
9098             }
9099 2           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9100 2           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9101 2           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9102 2           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9103 2           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9104 2           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9105 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9106             /*-- cleanup --*/
9107 2 50         if (distpp) free(distpp);
9108              
9109 2           } } break; case PDL_S: {
9110 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9111 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9112              
9113 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9114 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9115              
9116 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9117 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9118              
9119 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9120 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9121              
9122 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9123 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9124              
9125 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9126 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9127              
9128 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9129 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9130 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9131              
9132              
9133 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9134            
9135             PDL_COMMENT("THREADLOOPBEGIN")
9136 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9137 0           do { register PDL_Indx __tind1=0,__tind2=0;
9138 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9139 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9140 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9141 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9142 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9143 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9144 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9145 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9146 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9147 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9148 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9149 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9150 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9151 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9152 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9153 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9154 0           nclusters_datap += __offsp[0];
9155 0           distance_datap += __offsp[1];
9156 0           npass_datap += __offsp[2];
9157 0           clusterids_datap += __offsp[3];
9158 0           error_datap += __offsp[4];
9159 0           nfound_datap += __offsp[5];
9160 0 0         for( __tind2 = 0 ;
9161             __tind2 < __tdims1 ;
9162 0           __tind2++
9163 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9164 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9165 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9166 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9167 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9168 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9169             )
9170             {
9171 0 0         for( __tind1 = 0 ;
9172             __tind1 < __tdims0 ;
9173 0           __tind1++
9174 0           ,nclusters_datap += __tinc0_0
9175 0           ,distance_datap += __tinc0_1
9176 0           ,npass_datap += __tinc0_2
9177 0           ,clusterids_datap += __tinc0_3
9178 0           ,error_datap += __tinc0_4
9179 0           ,nfound_datap += __tinc0_5
9180             )
9181             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9182 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9183 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9184             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9185            
9186             PDL_COMMENT("THREADLOOPEND")
9187             }
9188             }
9189 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9190 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9191 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9192 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9193 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9194 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9195 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9196             /*-- cleanup --*/
9197 0 0         if (distpp) free(distpp);
9198              
9199 0           } } break; case PDL_US: {
9200 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9201 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9202              
9203 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9204 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9205              
9206 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9207 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9208              
9209 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9210 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9211              
9212 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9213 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9214              
9215 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9216 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9217              
9218 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9219 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9220 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9221              
9222              
9223 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9224            
9225             PDL_COMMENT("THREADLOOPBEGIN")
9226 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9227 0           do { register PDL_Indx __tind1=0,__tind2=0;
9228 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9229 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9230 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9231 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9232 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9233 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9234 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9235 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9236 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9237 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9238 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9239 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9240 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9241 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9242 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9243 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9244 0           nclusters_datap += __offsp[0];
9245 0           distance_datap += __offsp[1];
9246 0           npass_datap += __offsp[2];
9247 0           clusterids_datap += __offsp[3];
9248 0           error_datap += __offsp[4];
9249 0           nfound_datap += __offsp[5];
9250 0 0         for( __tind2 = 0 ;
9251             __tind2 < __tdims1 ;
9252 0           __tind2++
9253 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9254 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9255 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9256 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9257 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9258 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9259             )
9260             {
9261 0 0         for( __tind1 = 0 ;
9262             __tind1 < __tdims0 ;
9263 0           __tind1++
9264 0           ,nclusters_datap += __tinc0_0
9265 0           ,distance_datap += __tinc0_1
9266 0           ,npass_datap += __tinc0_2
9267 0           ,clusterids_datap += __tinc0_3
9268 0           ,error_datap += __tinc0_4
9269 0           ,nfound_datap += __tinc0_5
9270             )
9271             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9272 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9273 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9274             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9275            
9276             PDL_COMMENT("THREADLOOPEND")
9277             }
9278             }
9279 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9280 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9281 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9282 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9283 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9284 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9285 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9286             /*-- cleanup --*/
9287 0 0         if (distpp) free(distpp);
9288              
9289 0           } } break; case PDL_L: {
9290 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9291 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9292              
9293 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9294 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9295              
9296 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9297 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9298              
9299 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9300 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9301              
9302 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9303 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9304              
9305 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9306 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9307              
9308 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9309 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9310 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9311              
9312              
9313 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9314            
9315             PDL_COMMENT("THREADLOOPBEGIN")
9316 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9317 0           do { register PDL_Indx __tind1=0,__tind2=0;
9318 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9319 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9320 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9321 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9322 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9323 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9324 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9325 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9326 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9327 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9328 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9329 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9330 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9331 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9332 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9333 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9334 0           nclusters_datap += __offsp[0];
9335 0           distance_datap += __offsp[1];
9336 0           npass_datap += __offsp[2];
9337 0           clusterids_datap += __offsp[3];
9338 0           error_datap += __offsp[4];
9339 0           nfound_datap += __offsp[5];
9340 0 0         for( __tind2 = 0 ;
9341             __tind2 < __tdims1 ;
9342 0           __tind2++
9343 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9344 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9345 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9346 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9347 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9348 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9349             )
9350             {
9351 0 0         for( __tind1 = 0 ;
9352             __tind1 < __tdims0 ;
9353 0           __tind1++
9354 0           ,nclusters_datap += __tinc0_0
9355 0           ,distance_datap += __tinc0_1
9356 0           ,npass_datap += __tinc0_2
9357 0           ,clusterids_datap += __tinc0_3
9358 0           ,error_datap += __tinc0_4
9359 0           ,nfound_datap += __tinc0_5
9360             )
9361             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9362 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9363 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9364             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9365            
9366             PDL_COMMENT("THREADLOOPEND")
9367             }
9368             }
9369 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9370 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9371 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9372 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9373 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9374 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9375 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9376             /*-- cleanup --*/
9377 0 0         if (distpp) free(distpp);
9378              
9379 0           } } break; case PDL_IND: {
9380 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9381 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9382              
9383 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9384 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9385              
9386 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9387 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9388              
9389 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9390 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9391              
9392 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9393 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9394              
9395 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9396 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9397              
9398 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9399 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9400 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9401              
9402              
9403 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9404            
9405             PDL_COMMENT("THREADLOOPBEGIN")
9406 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9407 0           do { register PDL_Indx __tind1=0,__tind2=0;
9408 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9409 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9410 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9411 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9412 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9413 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9414 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9415 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9416 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9417 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9418 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9419 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9420 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9421 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9422 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9423 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9424 0           nclusters_datap += __offsp[0];
9425 0           distance_datap += __offsp[1];
9426 0           npass_datap += __offsp[2];
9427 0           clusterids_datap += __offsp[3];
9428 0           error_datap += __offsp[4];
9429 0           nfound_datap += __offsp[5];
9430 0 0         for( __tind2 = 0 ;
9431             __tind2 < __tdims1 ;
9432 0           __tind2++
9433 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9434 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9435 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9436 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9437 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9438 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9439             )
9440             {
9441 0 0         for( __tind1 = 0 ;
9442             __tind1 < __tdims0 ;
9443 0           __tind1++
9444 0           ,nclusters_datap += __tinc0_0
9445 0           ,distance_datap += __tinc0_1
9446 0           ,npass_datap += __tinc0_2
9447 0           ,clusterids_datap += __tinc0_3
9448 0           ,error_datap += __tinc0_4
9449 0           ,nfound_datap += __tinc0_5
9450             )
9451             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9452 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9453 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9454             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9455            
9456             PDL_COMMENT("THREADLOOPEND")
9457             }
9458             }
9459 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9460 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9461 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9462 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9463 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9464 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9465 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9466             /*-- cleanup --*/
9467 0 0         if (distpp) free(distpp);
9468              
9469 0           } } break; case PDL_LL: {
9470 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9471 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9472              
9473 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9474 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9475              
9476 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9477 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9478              
9479 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9480 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9481              
9482 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9483 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9484              
9485 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9486 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9487              
9488 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9489 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9490 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9491              
9492              
9493 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9494            
9495             PDL_COMMENT("THREADLOOPBEGIN")
9496 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9497 0           do { register PDL_Indx __tind1=0,__tind2=0;
9498 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9499 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9500 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9501 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9502 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9503 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9504 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9505 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9506 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9507 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9508 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9509 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9510 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9511 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9512 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9513 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9514 0           nclusters_datap += __offsp[0];
9515 0           distance_datap += __offsp[1];
9516 0           npass_datap += __offsp[2];
9517 0           clusterids_datap += __offsp[3];
9518 0           error_datap += __offsp[4];
9519 0           nfound_datap += __offsp[5];
9520 0 0         for( __tind2 = 0 ;
9521             __tind2 < __tdims1 ;
9522 0           __tind2++
9523 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9524 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9525 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9526 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9527 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9528 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9529             )
9530             {
9531 0 0         for( __tind1 = 0 ;
9532             __tind1 < __tdims0 ;
9533 0           __tind1++
9534 0           ,nclusters_datap += __tinc0_0
9535 0           ,distance_datap += __tinc0_1
9536 0           ,npass_datap += __tinc0_2
9537 0           ,clusterids_datap += __tinc0_3
9538 0           ,error_datap += __tinc0_4
9539 0           ,nfound_datap += __tinc0_5
9540             )
9541             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9542 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9543 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9544             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9545            
9546             PDL_COMMENT("THREADLOOPEND")
9547             }
9548             }
9549 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9550 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9551 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9552 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9553 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9554 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9555 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9556             /*-- cleanup --*/
9557 0 0         if (distpp) free(distpp);
9558              
9559 0           } } break; case PDL_F: {
9560 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9561 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9562              
9563 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9564 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9565              
9566 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9567 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9568              
9569 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9570 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9571              
9572 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9573 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9574              
9575 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9576 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9577              
9578 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9579 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9580 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9581              
9582              
9583 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9584            
9585             PDL_COMMENT("THREADLOOPBEGIN")
9586 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9587 0           do { register PDL_Indx __tind1=0,__tind2=0;
9588 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9589 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9590 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9591 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9592 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9593 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9594 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9595 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9596 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9597 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9598 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9599 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9600 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9601 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9602 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9603 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9604 0           nclusters_datap += __offsp[0];
9605 0           distance_datap += __offsp[1];
9606 0           npass_datap += __offsp[2];
9607 0           clusterids_datap += __offsp[3];
9608 0           error_datap += __offsp[4];
9609 0           nfound_datap += __offsp[5];
9610 0 0         for( __tind2 = 0 ;
9611             __tind2 < __tdims1 ;
9612 0           __tind2++
9613 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9614 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9615 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9616 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9617 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9618 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9619             )
9620             {
9621 0 0         for( __tind1 = 0 ;
9622             __tind1 < __tdims0 ;
9623 0           __tind1++
9624 0           ,nclusters_datap += __tinc0_0
9625 0           ,distance_datap += __tinc0_1
9626 0           ,npass_datap += __tinc0_2
9627 0           ,clusterids_datap += __tinc0_3
9628 0           ,error_datap += __tinc0_4
9629 0           ,nfound_datap += __tinc0_5
9630             )
9631             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9632 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9633 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9634             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9635            
9636             PDL_COMMENT("THREADLOOPEND")
9637             }
9638             }
9639 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9640 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9641 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9642 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9643 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9644 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9645 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9646             /*-- cleanup --*/
9647 0 0         if (distpp) free(distpp);
9648              
9649 0           } } break; case PDL_D: {
9650 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9651 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
9652              
9653 0 0         PDL_Double * distance_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9654 0           PDL_Double * distance_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
9655              
9656 0 0         PDL_Long * npass_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9657 0           PDL_Long * npass_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
9658              
9659 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9660 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9661              
9662 0 0         PDL_Double * error_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9663 0           PDL_Double * error_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9664              
9665 0 0         PDL_Long * nfound_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
9666 0           PDL_Long * nfound_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
9667              
9668 0           {register PDL_Indx __inc_distance_n0 = __privtrans->__inc_distance_n0;
9669 0           register PDL_Indx __inc_distance_n1 = __privtrans->__inc_distance_n1;
9670 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
9671              
9672              
9673 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
9674            
9675             PDL_COMMENT("THREADLOOPBEGIN")
9676 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
9677 0           do { register PDL_Indx __tind1=0,__tind2=0;
9678 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
9679 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
9680 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
9681 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
9682 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
9683 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
9684 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
9685 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
9686 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
9687 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
9688 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
9689 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
9690 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
9691 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
9692 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
9693 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
9694 0           nclusters_datap += __offsp[0];
9695 0           distance_datap += __offsp[1];
9696 0           npass_datap += __offsp[2];
9697 0           clusterids_datap += __offsp[3];
9698 0           error_datap += __offsp[4];
9699 0           nfound_datap += __offsp[5];
9700 0 0         for( __tind2 = 0 ;
9701             __tind2 < __tdims1 ;
9702 0           __tind2++
9703 0           ,nclusters_datap += __tinc1_0 - __tinc0_0 * __tdims0
9704 0           ,distance_datap += __tinc1_1 - __tinc0_1 * __tdims0
9705 0           ,npass_datap += __tinc1_2 - __tinc0_2 * __tdims0
9706 0           ,clusterids_datap += __tinc1_3 - __tinc0_3 * __tdims0
9707 0           ,error_datap += __tinc1_4 - __tinc0_4 * __tdims0
9708 0           ,nfound_datap += __tinc1_5 - __tinc0_5 * __tdims0
9709             )
9710             {
9711 0 0         for( __tind1 = 0 ;
9712             __tind1 < __tdims0 ;
9713 0           __tind1++
9714 0           ,nclusters_datap += __tinc0_0
9715 0           ,distance_datap += __tinc0_1
9716 0           ,npass_datap += __tinc0_2
9717 0           ,clusterids_datap += __tinc0_3
9718 0           ,error_datap += __tinc0_4
9719 0           ,nfound_datap += __tinc0_5
9720             )
9721             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
9722 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distance_datap, distpp);
9723 0           kmedoids((nclusters_datap)[0] PDL_COMMENT("ACCESS()") , __privtrans->__n_size, distpp,
9724             (npass_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap, error_datap, nfound_datap);
9725            
9726             PDL_COMMENT("THREADLOOPEND")
9727             }
9728             }
9729 0           nclusters_datap -= __tinc1_0 * __tdims1 + __offsp[0];
9730 0           distance_datap -= __tinc1_1 * __tdims1 + __offsp[1];
9731 0           npass_datap -= __tinc1_2 * __tdims1 + __offsp[2];
9732 0           clusterids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
9733 0           error_datap -= __tinc1_4 * __tdims1 + __offsp[4];
9734 0           nfound_datap -= __tinc1_5 * __tdims1 + __offsp[5];
9735 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
9736             /*-- cleanup --*/
9737 0 0         if (distpp) free(distpp);
9738              
9739 0           } break;}
9740 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
9741             }
9742             }
9743             }
9744            
9745              
9746              
9747              
9748 2           void pdl_kmedoids_free(pdl_trans *__tr ) {
9749             int __dim;
9750 2           pdl_kmedoids_struct *__privtrans = (pdl_kmedoids_struct *) __tr;
9751            
9752             {
9753            
9754 2           PDL_TR_CLRMAGIC(__privtrans);
9755            
9756 2 50         if(__privtrans->__ddone) {
9757 2           PDL->freethreadloop(&(__privtrans->__pdlthread));
9758             ;;;;;
9759             }
9760            
9761             }
9762 2           }
9763            
9764              
9765              
9766              
9767             static char pdl_kmedoids_vtable_flags[] =
9768             { PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK,0,0,0};
9769             pdl_transvtable pdl_kmedoids_vtable = {
9770             0,0, 3, 6, pdl_kmedoids_vtable_flags,
9771             pdl_kmedoids_redodims, pdl_kmedoids_readdata, NULL,
9772             pdl_kmedoids_free,NULL,NULL,pdl_kmedoids_copy,
9773             sizeof(pdl_kmedoids_struct),"pdl_kmedoids_vtable"
9774             };
9775              
9776             typedef struct pdl_treecluster_struct {
9777             PDL_TRANS_START(5);
9778             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_tree_2;PDL_Indx __inc_tree_n;PDL_Indx __inc_lnkdist_n;PDL_Indx __d_size;PDL_Indx __2_size;PDL_Indx __n_size;
9779             char *distFlag;char *methodFlag;
9780             char __ddone; PDL_COMMENT("Dims done")
9781             } pdl_treecluster_struct;
9782              
9783 8           void pdl_treecluster_redodims(pdl_trans *__tr ) {
9784             int __dim;
9785 8           pdl_treecluster_struct *__privtrans = (pdl_treecluster_struct *) __tr;
9786            
9787             {
9788             PDL_Indx __creating[5];
9789 8           __privtrans->__d_size = -1;
9790 8           __privtrans->__2_size = -1;
9791 8           __privtrans->__n_size = -1;
9792 8           __creating[0] = 0;
9793 8           __creating[1] = 0;
9794 8           __creating[2] = 0;
9795 8 50         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    0          
9796 8 50         __creating[4] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[4]);
    0          
9797             {
9798             {PDL_COMMENT("Start generic loop")
9799              
9800 8           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
9801 0           } break; case PDL_B: {
9802 8 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9803 8           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9804              
9805 8 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9806 8           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9807              
9808 8 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9809 8           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9810              
9811 8 50         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9812 8           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9813              
9814 8 50         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9815 8           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9816              
9817 8           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9818 8           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9819 8           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9820 8           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9821 8           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9822 8           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9823 8           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9824 8           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9825              
9826             PDL_COMMENT("none")
9827 8           } } break; case PDL_S: {
9828 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9829 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9830              
9831 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9832 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9833              
9834 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9835 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9836              
9837 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9838 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9839              
9840 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9841 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9842              
9843 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9844 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9845 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9846 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9847 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9848 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9849 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9850 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9851              
9852             PDL_COMMENT("none")
9853 0           } } break; case PDL_US: {
9854 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9855 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9856              
9857 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9858 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9859              
9860 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9861 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9862              
9863 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9864 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9865              
9866 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9867 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9868              
9869 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9870 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9871 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9872 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9873 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9874 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9875 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9876 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9877              
9878             PDL_COMMENT("none")
9879 0           } } break; case PDL_L: {
9880 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9881 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9882              
9883 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9884 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9885              
9886 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9887 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9888              
9889 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9890 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9891              
9892 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9893 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9894              
9895 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9896 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9897 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9898 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9899 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9900 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9901 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9902 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9903              
9904             PDL_COMMENT("none")
9905 0           } } break; case PDL_IND: {
9906 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9907 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9908              
9909 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9910 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9911              
9912 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9913 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9914              
9915 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9916 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9917              
9918 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9919 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9920              
9921 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9922 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9923 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9924 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9925 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9926 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9927 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9928 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9929              
9930             PDL_COMMENT("none")
9931 0           } } break; case PDL_LL: {
9932 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9933 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9934              
9935 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9936 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9937              
9938 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9939 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9940              
9941 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9942 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9943              
9944 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9945 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9946              
9947 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9948 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9949 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9950 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9951 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9952 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9953 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9954 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9955              
9956             PDL_COMMENT("none")
9957 0           } } break; case PDL_F: {
9958 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9959 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9960              
9961 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9962 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9963              
9964 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9965 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9966              
9967 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9968 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9969              
9970 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9971 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9972              
9973 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
9974 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
9975 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
9976 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
9977 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
9978 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
9979 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
9980 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
9981              
9982             PDL_COMMENT("none")
9983 0           } } break; case PDL_D: {
9984 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
9985 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
9986              
9987 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
9988 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
9989              
9990 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
9991 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
9992              
9993 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
9994 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
9995              
9996 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
9997 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
9998              
9999 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10000 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10001 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10002 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10003 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10004 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10005 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10006 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10007              
10008             PDL_COMMENT("none")
10009 0           } break;}
10010 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
10011             }
10012             }
10013             {
10014             static char *__parnames[] = {"data","mask","weight","tree","lnkdist"};
10015             static PDL_Indx __realdims[] = {2,2,1,2,1};
10016             static char __funcname[] = "PDL::Cluster::treecluster";
10017             static pdl_errorinfo __einfo = {
10018             __funcname, __parnames, 5
10019             };
10020            
10021 8           PDL->initthreadstruct(2,__privtrans->pdls,
10022             __realdims,__creating,5,
10023             &__einfo,&(__privtrans->__pdlthread),
10024 8           __privtrans->vtable->per_pdl_flags,
10025             0 );
10026             }
10027 8 50         if(((__privtrans->pdls[0]))->ndims < 2) {
10028 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
10029 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
10030             }
10031 8 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
10032 8           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
10033 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
10034 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
10035 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10036             }
10037             }
10038 8 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
10039 8           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
10040 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
10041 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
10042 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10043             }
10044             }
10045 8           PDL->make_physical(((__privtrans->pdls[0])));
10046 8 50         if(((__privtrans->pdls[1]))->ndims < 2) {
10047 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
10048 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
10049             }
10050 8 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
10051 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
10052 8 50         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    50          
10053 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
10054 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10055             }
10056             }
10057 8 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
10058 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
10059 8 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
10060 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
10061 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10062             }
10063             }
10064 8           PDL->make_physical(((__privtrans->pdls[1])));
10065 8 50         if(((__privtrans->pdls[2]))->ndims < 1) {
10066 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
10067             }
10068 8 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
10069 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
10070 8 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
10071 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
10072 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10073             }
10074             }
10075 8           PDL->make_physical(((__privtrans->pdls[2])));
10076 8 50         if(!__creating[3]) {
10077 8 50         if(((__privtrans->pdls[3]))->ndims < 2) {
10078 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__2_size <= 1) __privtrans->__2_size = 1;
    0          
10079 0 0         if (((__privtrans->pdls[3]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
10080             }
10081 8 50         if(__privtrans->__2_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__2_size == 1)) {
    0          
    0          
10082 8           __privtrans->__2_size = ((__privtrans->pdls[3]))->dims[0];
10083 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__2_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
10084 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
10085 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10086             }
10087             }
10088 8 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
10089 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[1];
10090 8 50         } else if(((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[1]) {
    50          
10091 0 0         if(((__privtrans->pdls[3]))->dims[1] != 1) {
10092 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10093             }
10094             }
10095 8           PDL->make_physical(((__privtrans->pdls[3])));
10096             } else {
10097 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__2_size;dims[1] = __privtrans->__n_size;
10098 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
10099 8 50         }if(!__creating[4]) {
10100 8 50         if(((__privtrans->pdls[4]))->ndims < 1) {
10101 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
10102             }
10103 8 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__n_size == 1)) {
    50          
    50          
10104 0           __privtrans->__n_size = ((__privtrans->pdls[4]))->dims[0];
10105 8 50         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[4]))->dims[0]) {
    50          
10106 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
10107 0           PDL->pdl_barf("Error in treecluster:" "Wrong dims\n");
10108             }
10109             }
10110 8           PDL->make_physical(((__privtrans->pdls[4])));
10111             } else {
10112 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
10113 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,4,dims,0);
10114             }
10115             { PDL_COMMENT("convenience block")
10116 8           void *hdrp = NULL;
10117 8           char propagate_hdrcpy = 0;
10118 8           SV *hdr_copy = NULL;
10119 8 50         if(!hdrp &&
    50          
10120 0 0         __privtrans->pdls[0]->hdrsv &&
10121 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
10122             ) {
10123 0           hdrp = __privtrans->pdls[0]->hdrsv;
10124 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
10125             }
10126 8 50         if(!hdrp &&
    50          
10127 0 0         __privtrans->pdls[1]->hdrsv &&
10128 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
10129             ) {
10130 0           hdrp = __privtrans->pdls[1]->hdrsv;
10131 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
10132             }
10133 8 50         if(!hdrp &&
    50          
10134 0 0         __privtrans->pdls[2]->hdrsv &&
10135 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
10136             ) {
10137 0           hdrp = __privtrans->pdls[2]->hdrsv;
10138 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
10139             }
10140 8 50         if(!hdrp &&
    50          
10141 8 50         !__creating[3] &&
10142 0 0         __privtrans->pdls[3]->hdrsv &&
10143 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
10144             ) {
10145 0           hdrp = __privtrans->pdls[3]->hdrsv;
10146 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
10147             }
10148 8 50         if(!hdrp &&
    50          
10149 8 50         !__creating[4] &&
10150 0 0         __privtrans->pdls[4]->hdrsv &&
10151 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
10152             ) {
10153 0           hdrp = __privtrans->pdls[4]->hdrsv;
10154 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
10155             }
10156 8 50         if (hdrp) {
10157 0 0         if(hdrp == &PL_sv_undef)
10158 0           hdr_copy = &PL_sv_undef;
10159             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
10160             int count;
10161             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
10162 0           dSP;
10163 0           ENTER ;
10164 0           SAVETMPS ;
10165 0 0         PUSHMARK(SP) ;
10166 0 0         XPUSHs( hdrp );
10167 0           PUTBACK ;
10168 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
10169 0           SPAGAIN ;
10170 0 0         if(count != 1)
10171 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
10172              
10173 0           hdr_copy = (SV *)POPs;
10174              
10175 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
10176 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
10177             }
10178              
10179 0 0         FREETMPS ;
10180 0           LEAVE ;
10181              
10182              
10183             } PDL_COMMENT("end of callback block")
10184              
10185 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
10186 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
10187 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
10188 0 0         if( hdr_copy != &PL_sv_undef )
10189 0           (void)SvREFCNT_inc(hdr_copy);
10190 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
10191             }
10192 0 0         if(propagate_hdrcpy)
10193 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
10194 0 0         if ( __privtrans->pdls[4]->hdrsv != hdrp ){
10195 0 0         if( __privtrans->pdls[4]->hdrsv && __privtrans->pdls[4]->hdrsv != &PL_sv_undef)
    0          
10196 0           (void)SvREFCNT_dec( __privtrans->pdls[4]->hdrsv );
10197 0 0         if( hdr_copy != &PL_sv_undef )
10198 0           (void)SvREFCNT_inc(hdr_copy);
10199 0           __privtrans->pdls[4]->hdrsv = hdr_copy;
10200             }
10201 0 0         if(propagate_hdrcpy)
10202 0           __privtrans->pdls[4]->state |= PDL_HDRCPY;
10203              
10204 0 0         if(hdr_copy != &PL_sv_undef)
10205 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
10206             } PDL_COMMENT("end of if(hdrp) block")
10207             } PDL_COMMENT("end of conv. block")
10208 8 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
10209 0           __privtrans->__inc_data_d = 0; else
10210 8 50         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    50          
10211 0           __privtrans->__inc_data_n = 0; else
10212 8 50         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
10213 0           __privtrans->__inc_mask_d = 0; else
10214 8 50         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
10215 0           __privtrans->__inc_mask_n = 0; else
10216 8 50         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
10217 0           __privtrans->__inc_weight_d = 0; else
10218 8 50         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
10219 0           __privtrans->__inc_tree_2 = 0; else
10220 8 50         __privtrans->__inc_tree_2 = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 1 || __privtrans->pdls[3]->dims[1] <= 1)
    50          
10221 0           __privtrans->__inc_tree_n = 0; else
10222 8 50         __privtrans->__inc_tree_n = __privtrans->pdls[3]->dimincs[1];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
10223 0           __privtrans->__inc_lnkdist_n = 0; else
10224 8           __privtrans->__inc_lnkdist_n = __privtrans->pdls[4]->dimincs[0]; __privtrans->__ddone = 1;
10225             }
10226 8           }
10227            
10228              
10229 0           pdl_trans * pdl_treecluster_copy(pdl_trans *__tr ) {
10230             int __dim;
10231 0           pdl_treecluster_struct *__privtrans = (pdl_treecluster_struct *) __tr;
10232            
10233             {
10234 0           pdl_treecluster_struct *__copy = malloc(sizeof(pdl_treecluster_struct));
10235 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
10236 0           __copy->has_badvalue = __privtrans->has_badvalue;
10237 0           __copy->badvalue = __privtrans->badvalue;
10238 0           __copy->flags = __privtrans->flags;
10239 0           __copy->vtable = __privtrans->vtable;
10240 0           __copy->__datatype = __privtrans->__datatype;
10241 0           __copy->freeproc = NULL;
10242 0           __copy->__ddone = __privtrans->__ddone;
10243             {int i;
10244 0 0         for(i=0; i<__copy->vtable->npdls; i++)
10245 0           __copy->pdls[i] = __privtrans->pdls[i];
10246             }
10247 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
10248 0 0         if(__copy->__ddone) {
10249 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_tree_2=__copy->__inc_tree_2;__privtrans->__inc_tree_n=__copy->__inc_tree_n;__privtrans->__inc_lnkdist_n=__copy->__inc_lnkdist_n;__copy->__d_size=__privtrans->__d_size;__copy->__2_size=__privtrans->__2_size;__copy->__n_size=__privtrans->__n_size;
10250             }
10251 0           return (pdl_trans*)__copy;
10252             }
10253             }
10254            
10255              
10256 8           void pdl_treecluster_readdata(pdl_trans *__tr ) {
10257             int __dim;
10258 8           pdl_treecluster_struct *__privtrans = (pdl_treecluster_struct *) __tr;
10259            
10260             {
10261             {PDL_COMMENT("Start generic loop")
10262              
10263 8           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
10264 0           } break; case PDL_B: {
10265 8 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10266 8           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10267              
10268 8 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10269 8           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10270              
10271 8 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10272 8           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10273              
10274 8 50         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10275 8           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10276              
10277 8 50         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10278 8           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10279              
10280 8           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10281 8           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10282 8           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10283 8           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10284 8           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10285 8           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10286 8           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10287 8           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10288              
10289              
10290 8           int transpose = 0;
10291 8           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10292 8           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10293 8           double **distpp = NULL;
10294 8           Node *nod = NULL;
10295 8           int nmax = __privtrans->__n_size-1;
10296            
10297             PDL_COMMENT("THREADLOOPBEGIN")
10298 8 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10299 8           do { register PDL_Indx __tind1=0,__tind2=0;
10300 8           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10301 8           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10302 8           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10303 8           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10304 8           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10305 8           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10306 8           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10307 8           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10308 8           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10309 8           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10310 8           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10311 8           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10312 8           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10313 8           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10314 8           data_datap += __offsp[0];
10315 8           mask_datap += __offsp[1];
10316 8           weight_datap += __offsp[2];
10317 8           tree_datap += __offsp[3];
10318 8           lnkdist_datap += __offsp[4];
10319 16 100         for( __tind2 = 0 ;
10320             __tind2 < __tdims1 ;
10321 8           __tind2++
10322 8           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10323 8           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10324 8           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10325 8           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10326 8           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10327             )
10328             {
10329 16 100         for( __tind1 = 0 ;
10330             __tind1 < __tdims0 ;
10331 8           __tind1++
10332 8           ,data_datap += __tinc0_0
10333 8           ,mask_datap += __tinc0_1
10334 8           ,weight_datap += __tinc0_2
10335 8           ,tree_datap += __tinc0_3
10336 8           ,lnkdist_datap += __tinc0_4
10337             )
10338             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10339 8           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10340 8           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10341 8           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10342 16           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10343             NULL);
10344              
10345 8           node2p(nmax, nod, tree_datap, lnkdist_datap);
10346 8 50         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    50          
10347 8 50         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    50          
10348 8 50         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10349            
10350             PDL_COMMENT("THREADLOOPEND")
10351             }
10352             }
10353 8           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10354 8           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10355 8           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10356 8           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10357 8           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10358 8 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10359             /*-- cleanup --*/
10360 8 50         if (datapp) free(datapp);
10361 8 50         if (maskpp) free(maskpp);
10362 8 50         if (nod) free(nod);
10363              
10364 8           } } break; case PDL_S: {
10365 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10366 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10367              
10368 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10369 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10370              
10371 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10372 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10373              
10374 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10375 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10376              
10377 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10378 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10379              
10380 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10381 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10382 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10383 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10384 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10385 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10386 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10387 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10388              
10389              
10390 0           int transpose = 0;
10391 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10392 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10393 0           double **distpp = NULL;
10394 0           Node *nod = NULL;
10395 0           int nmax = __privtrans->__n_size-1;
10396            
10397             PDL_COMMENT("THREADLOOPBEGIN")
10398 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10399 0           do { register PDL_Indx __tind1=0,__tind2=0;
10400 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10401 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10402 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10403 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10404 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10405 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10406 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10407 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10408 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10409 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10410 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10411 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10412 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10413 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10414 0           data_datap += __offsp[0];
10415 0           mask_datap += __offsp[1];
10416 0           weight_datap += __offsp[2];
10417 0           tree_datap += __offsp[3];
10418 0           lnkdist_datap += __offsp[4];
10419 0 0         for( __tind2 = 0 ;
10420             __tind2 < __tdims1 ;
10421 0           __tind2++
10422 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10423 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10424 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10425 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10426 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10427             )
10428             {
10429 0 0         for( __tind1 = 0 ;
10430             __tind1 < __tdims0 ;
10431 0           __tind1++
10432 0           ,data_datap += __tinc0_0
10433 0           ,mask_datap += __tinc0_1
10434 0           ,weight_datap += __tinc0_2
10435 0           ,tree_datap += __tinc0_3
10436 0           ,lnkdist_datap += __tinc0_4
10437             )
10438             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10439 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10440 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10441 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10442 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10443             NULL);
10444              
10445 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10446 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10447 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10448 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10449            
10450             PDL_COMMENT("THREADLOOPEND")
10451             }
10452             }
10453 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10454 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10455 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10456 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10457 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10458 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10459             /*-- cleanup --*/
10460 0 0         if (datapp) free(datapp);
10461 0 0         if (maskpp) free(maskpp);
10462 0 0         if (nod) free(nod);
10463              
10464 0           } } break; case PDL_US: {
10465 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10466 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10467              
10468 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10469 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10470              
10471 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10472 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10473              
10474 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10475 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10476              
10477 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10478 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10479              
10480 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10481 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10482 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10483 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10484 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10485 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10486 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10487 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10488              
10489              
10490 0           int transpose = 0;
10491 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10492 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10493 0           double **distpp = NULL;
10494 0           Node *nod = NULL;
10495 0           int nmax = __privtrans->__n_size-1;
10496            
10497             PDL_COMMENT("THREADLOOPBEGIN")
10498 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10499 0           do { register PDL_Indx __tind1=0,__tind2=0;
10500 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10501 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10502 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10503 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10504 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10505 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10506 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10507 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10508 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10509 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10510 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10511 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10512 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10513 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10514 0           data_datap += __offsp[0];
10515 0           mask_datap += __offsp[1];
10516 0           weight_datap += __offsp[2];
10517 0           tree_datap += __offsp[3];
10518 0           lnkdist_datap += __offsp[4];
10519 0 0         for( __tind2 = 0 ;
10520             __tind2 < __tdims1 ;
10521 0           __tind2++
10522 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10523 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10524 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10525 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10526 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10527             )
10528             {
10529 0 0         for( __tind1 = 0 ;
10530             __tind1 < __tdims0 ;
10531 0           __tind1++
10532 0           ,data_datap += __tinc0_0
10533 0           ,mask_datap += __tinc0_1
10534 0           ,weight_datap += __tinc0_2
10535 0           ,tree_datap += __tinc0_3
10536 0           ,lnkdist_datap += __tinc0_4
10537             )
10538             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10539 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10540 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10541 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10542 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10543             NULL);
10544              
10545 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10546 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10547 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10548 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10549            
10550             PDL_COMMENT("THREADLOOPEND")
10551             }
10552             }
10553 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10554 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10555 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10556 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10557 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10558 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10559             /*-- cleanup --*/
10560 0 0         if (datapp) free(datapp);
10561 0 0         if (maskpp) free(maskpp);
10562 0 0         if (nod) free(nod);
10563              
10564 0           } } break; case PDL_L: {
10565 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10566 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10567              
10568 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10569 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10570              
10571 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10572 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10573              
10574 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10575 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10576              
10577 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10578 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10579              
10580 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10581 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10582 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10583 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10584 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10585 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10586 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10587 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10588              
10589              
10590 0           int transpose = 0;
10591 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10592 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10593 0           double **distpp = NULL;
10594 0           Node *nod = NULL;
10595 0           int nmax = __privtrans->__n_size-1;
10596            
10597             PDL_COMMENT("THREADLOOPBEGIN")
10598 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10599 0           do { register PDL_Indx __tind1=0,__tind2=0;
10600 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10601 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10602 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10603 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10604 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10605 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10606 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10607 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10608 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10609 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10610 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10611 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10612 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10613 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10614 0           data_datap += __offsp[0];
10615 0           mask_datap += __offsp[1];
10616 0           weight_datap += __offsp[2];
10617 0           tree_datap += __offsp[3];
10618 0           lnkdist_datap += __offsp[4];
10619 0 0         for( __tind2 = 0 ;
10620             __tind2 < __tdims1 ;
10621 0           __tind2++
10622 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10623 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10624 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10625 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10626 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10627             )
10628             {
10629 0 0         for( __tind1 = 0 ;
10630             __tind1 < __tdims0 ;
10631 0           __tind1++
10632 0           ,data_datap += __tinc0_0
10633 0           ,mask_datap += __tinc0_1
10634 0           ,weight_datap += __tinc0_2
10635 0           ,tree_datap += __tinc0_3
10636 0           ,lnkdist_datap += __tinc0_4
10637             )
10638             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10639 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10640 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10641 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10642 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10643             NULL);
10644              
10645 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10646 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10647 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10648 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10649            
10650             PDL_COMMENT("THREADLOOPEND")
10651             }
10652             }
10653 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10654 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10655 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10656 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10657 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10658 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10659             /*-- cleanup --*/
10660 0 0         if (datapp) free(datapp);
10661 0 0         if (maskpp) free(maskpp);
10662 0 0         if (nod) free(nod);
10663              
10664 0           } } break; case PDL_IND: {
10665 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10666 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10667              
10668 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10669 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10670              
10671 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10672 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10673              
10674 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10675 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10676              
10677 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10678 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10679              
10680 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10681 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10682 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10683 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10684 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10685 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10686 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10687 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10688              
10689              
10690 0           int transpose = 0;
10691 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10692 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10693 0           double **distpp = NULL;
10694 0           Node *nod = NULL;
10695 0           int nmax = __privtrans->__n_size-1;
10696            
10697             PDL_COMMENT("THREADLOOPBEGIN")
10698 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10699 0           do { register PDL_Indx __tind1=0,__tind2=0;
10700 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10701 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10702 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10703 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10704 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10705 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10706 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10707 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10708 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10709 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10710 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10711 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10712 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10713 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10714 0           data_datap += __offsp[0];
10715 0           mask_datap += __offsp[1];
10716 0           weight_datap += __offsp[2];
10717 0           tree_datap += __offsp[3];
10718 0           lnkdist_datap += __offsp[4];
10719 0 0         for( __tind2 = 0 ;
10720             __tind2 < __tdims1 ;
10721 0           __tind2++
10722 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10723 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10724 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10725 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10726 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10727             )
10728             {
10729 0 0         for( __tind1 = 0 ;
10730             __tind1 < __tdims0 ;
10731 0           __tind1++
10732 0           ,data_datap += __tinc0_0
10733 0           ,mask_datap += __tinc0_1
10734 0           ,weight_datap += __tinc0_2
10735 0           ,tree_datap += __tinc0_3
10736 0           ,lnkdist_datap += __tinc0_4
10737             )
10738             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10739 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10740 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10741 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10742 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10743             NULL);
10744              
10745 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10746 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10747 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10748 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10749            
10750             PDL_COMMENT("THREADLOOPEND")
10751             }
10752             }
10753 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10754 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10755 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10756 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10757 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10758 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10759             /*-- cleanup --*/
10760 0 0         if (datapp) free(datapp);
10761 0 0         if (maskpp) free(maskpp);
10762 0 0         if (nod) free(nod);
10763              
10764 0           } } break; case PDL_LL: {
10765 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10766 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10767              
10768 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10769 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10770              
10771 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10772 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10773              
10774 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10775 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10776              
10777 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10778 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10779              
10780 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10781 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10782 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10783 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10784 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10785 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10786 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10787 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10788              
10789              
10790 0           int transpose = 0;
10791 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10792 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10793 0           double **distpp = NULL;
10794 0           Node *nod = NULL;
10795 0           int nmax = __privtrans->__n_size-1;
10796            
10797             PDL_COMMENT("THREADLOOPBEGIN")
10798 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10799 0           do { register PDL_Indx __tind1=0,__tind2=0;
10800 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10801 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10802 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10803 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10804 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10805 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10806 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10807 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10808 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10809 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10810 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10811 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10812 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10813 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10814 0           data_datap += __offsp[0];
10815 0           mask_datap += __offsp[1];
10816 0           weight_datap += __offsp[2];
10817 0           tree_datap += __offsp[3];
10818 0           lnkdist_datap += __offsp[4];
10819 0 0         for( __tind2 = 0 ;
10820             __tind2 < __tdims1 ;
10821 0           __tind2++
10822 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10823 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10824 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10825 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10826 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10827             )
10828             {
10829 0 0         for( __tind1 = 0 ;
10830             __tind1 < __tdims0 ;
10831 0           __tind1++
10832 0           ,data_datap += __tinc0_0
10833 0           ,mask_datap += __tinc0_1
10834 0           ,weight_datap += __tinc0_2
10835 0           ,tree_datap += __tinc0_3
10836 0           ,lnkdist_datap += __tinc0_4
10837             )
10838             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10839 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10840 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10841 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10842 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10843             NULL);
10844              
10845 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10846 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10847 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10848 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10849            
10850             PDL_COMMENT("THREADLOOPEND")
10851             }
10852             }
10853 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10854 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10855 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10856 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10857 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10858 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10859             /*-- cleanup --*/
10860 0 0         if (datapp) free(datapp);
10861 0 0         if (maskpp) free(maskpp);
10862 0 0         if (nod) free(nod);
10863              
10864 0           } } break; case PDL_F: {
10865 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10866 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10867              
10868 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10869 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10870              
10871 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10872 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10873              
10874 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10875 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10876              
10877 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10878 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10879              
10880 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10881 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10882 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10883 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10884 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10885 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10886 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10887 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10888              
10889              
10890 0           int transpose = 0;
10891 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10892 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10893 0           double **distpp = NULL;
10894 0           Node *nod = NULL;
10895 0           int nmax = __privtrans->__n_size-1;
10896            
10897             PDL_COMMENT("THREADLOOPBEGIN")
10898 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10899 0           do { register PDL_Indx __tind1=0,__tind2=0;
10900 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
10901 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
10902 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
10903 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
10904 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
10905 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
10906 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
10907 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
10908 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
10909 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
10910 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
10911 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
10912 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
10913 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
10914 0           data_datap += __offsp[0];
10915 0           mask_datap += __offsp[1];
10916 0           weight_datap += __offsp[2];
10917 0           tree_datap += __offsp[3];
10918 0           lnkdist_datap += __offsp[4];
10919 0 0         for( __tind2 = 0 ;
10920             __tind2 < __tdims1 ;
10921 0           __tind2++
10922 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
10923 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
10924 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
10925 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
10926 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
10927             )
10928             {
10929 0 0         for( __tind1 = 0 ;
10930             __tind1 < __tdims0 ;
10931 0           __tind1++
10932 0           ,data_datap += __tinc0_0
10933 0           ,mask_datap += __tinc0_1
10934 0           ,weight_datap += __tinc0_2
10935 0           ,tree_datap += __tinc0_3
10936 0           ,lnkdist_datap += __tinc0_4
10937             )
10938             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
10939 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
10940 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
10941 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
10942 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
10943             NULL);
10944              
10945 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
10946 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10947 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
10948 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
10949            
10950             PDL_COMMENT("THREADLOOPEND")
10951             }
10952             }
10953 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
10954 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
10955 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
10956 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
10957 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
10958 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
10959             /*-- cleanup --*/
10960 0 0         if (datapp) free(datapp);
10961 0 0         if (maskpp) free(maskpp);
10962 0 0         if (nod) free(nod);
10963              
10964 0           } } break; case PDL_D: {
10965 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
10966 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
10967              
10968 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
10969 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
10970              
10971 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
10972 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
10973              
10974 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
10975 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
10976              
10977 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
10978 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
10979              
10980 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
10981 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
10982 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
10983 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
10984 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
10985 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
10986 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
10987 0           register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
10988              
10989              
10990 0           int transpose = 0;
10991 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
10992 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
10993 0           double **distpp = NULL;
10994 0           Node *nod = NULL;
10995 0           int nmax = __privtrans->__n_size-1;
10996            
10997             PDL_COMMENT("THREADLOOPBEGIN")
10998 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
10999 0           do { register PDL_Indx __tind1=0,__tind2=0;
11000 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
11001 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
11002 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
11003 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
11004 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
11005 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
11006 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
11007 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
11008 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
11009 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
11010 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
11011 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
11012 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
11013 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
11014 0           data_datap += __offsp[0];
11015 0           mask_datap += __offsp[1];
11016 0           weight_datap += __offsp[2];
11017 0           tree_datap += __offsp[3];
11018 0           lnkdist_datap += __offsp[4];
11019 0 0         for( __tind2 = 0 ;
11020             __tind2 < __tdims1 ;
11021 0           __tind2++
11022 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
11023 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
11024 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
11025 0           ,tree_datap += __tinc1_3 - __tinc0_3 * __tdims0
11026 0           ,lnkdist_datap += __tinc1_4 - __tinc0_4 * __tdims0
11027             )
11028             {
11029 0 0         for( __tind1 = 0 ;
11030             __tind1 < __tdims0 ;
11031 0           __tind1++
11032 0           ,data_datap += __tinc0_0
11033 0           ,mask_datap += __tinc0_1
11034 0           ,weight_datap += __tinc0_2
11035 0           ,tree_datap += __tinc0_3
11036 0           ,lnkdist_datap += __tinc0_4
11037             )
11038             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
11039 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
11040 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
11041 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
11042 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
11043             NULL);
11044              
11045 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
11046 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11047 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11048 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
11049            
11050             PDL_COMMENT("THREADLOOPEND")
11051             }
11052             }
11053 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
11054 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
11055 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
11056 0           tree_datap -= __tinc1_3 * __tdims1 + __offsp[3];
11057 0           lnkdist_datap -= __tinc1_4 * __tdims1 + __offsp[4];
11058 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
11059             /*-- cleanup --*/
11060 0 0         if (datapp) free(datapp);
11061 0 0         if (maskpp) free(maskpp);
11062 0 0         if (nod) free(nod);
11063              
11064 0           } break;}
11065 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
11066             }
11067             }
11068             }
11069            
11070              
11071              
11072              
11073 8           void pdl_treecluster_free(pdl_trans *__tr ) {
11074             int __dim;
11075 8           pdl_treecluster_struct *__privtrans = (pdl_treecluster_struct *) __tr;
11076            
11077             {
11078            
11079 8           PDL_TR_CLRMAGIC(__privtrans);
11080 8           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
11081 8 50         if(__privtrans->__ddone) {
11082 8           PDL->freethreadloop(&(__privtrans->__pdlthread));
11083             ;;;;;;;;;;;;
11084             }
11085            
11086             }
11087 8           }
11088            
11089              
11090              
11091              
11092             static char pdl_treecluster_vtable_flags[] =
11093             { 0,0,0,0,0};
11094             pdl_transvtable pdl_treecluster_vtable = {
11095             0,0, 3, 5, pdl_treecluster_vtable_flags,
11096             pdl_treecluster_redodims, pdl_treecluster_readdata, NULL,
11097             pdl_treecluster_free,NULL,NULL,pdl_treecluster_copy,
11098             sizeof(pdl_treecluster_struct),"pdl_treecluster_vtable"
11099             };
11100              
11101             typedef struct pdl_treeclusterd_struct {
11102             PDL_TRANS_START(6);
11103             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_distances_n0;PDL_Indx __inc_distances_n1;PDL_Indx __inc_tree_2;PDL_Indx __inc_tree_n;PDL_Indx __inc_lnkdist_n;PDL_Indx __n_size;PDL_Indx __d_size;PDL_Indx __2_size;
11104             char *distFlag;char *methodFlag;
11105             char __ddone; PDL_COMMENT("Dims done")
11106             } pdl_treeclusterd_struct;
11107              
11108 0           void pdl_treeclusterd_redodims(pdl_trans *__tr ) {
11109             int __dim;
11110 0           pdl_treeclusterd_struct *__privtrans = (pdl_treeclusterd_struct *) __tr;
11111            
11112             {
11113             PDL_Indx __creating[6];
11114 0           __privtrans->__n_size = -1;
11115 0           __privtrans->__d_size = -1;
11116 0           __privtrans->__2_size = -1;
11117 0           __creating[0] = 0;
11118 0           __creating[1] = 0;
11119 0           __creating[2] = 0;
11120 0           __creating[3] = 0;
11121 0 0         __creating[4] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[4]);
    0          
11122 0 0         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    0          
11123             {
11124             {PDL_COMMENT("Start generic loop")
11125              
11126 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
11127 0           } break; case PDL_B: {
11128 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11129 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11130              
11131 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11132 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11133              
11134 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11135 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11136              
11137 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11138 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11139              
11140 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11141 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11142              
11143 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11144 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11145              
11146 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11147 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11148 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11149 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11150 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11151 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11152 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11153 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11154 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11155 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11156              
11157             PDL_COMMENT("none")
11158 0           } } break; case PDL_S: {
11159 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11160 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11161              
11162 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11163 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11164              
11165 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11166 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11167              
11168 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11169 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11170              
11171 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11172 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11173              
11174 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11175 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11176              
11177 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11178 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11179 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11180 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11181 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11182 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11183 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11184 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11185 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11186 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11187              
11188             PDL_COMMENT("none")
11189 0           } } break; case PDL_US: {
11190 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11191 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11192              
11193 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11194 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11195              
11196 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11197 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11198              
11199 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11200 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11201              
11202 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11203 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11204              
11205 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11206 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11207              
11208 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11209 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11210 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11211 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11212 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11213 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11214 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11215 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11216 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11217 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11218              
11219             PDL_COMMENT("none")
11220 0           } } break; case PDL_L: {
11221 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11222 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11223              
11224 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11225 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11226              
11227 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11228 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11229              
11230 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11231 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11232              
11233 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11234 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11235              
11236 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11237 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11238              
11239 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11240 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11241 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11242 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11243 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11244 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11245 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11246 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11247 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11248 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11249              
11250             PDL_COMMENT("none")
11251 0           } } break; case PDL_IND: {
11252 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11253 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11254              
11255 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11256 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11257              
11258 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11259 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11260              
11261 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11262 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11263              
11264 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11265 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11266              
11267 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11268 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11269              
11270 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11271 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11272 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11273 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11274 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11275 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11276 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11277 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11278 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11279 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11280              
11281             PDL_COMMENT("none")
11282 0           } } break; case PDL_LL: {
11283 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11284 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11285              
11286 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11287 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11288              
11289 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11290 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11291              
11292 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11293 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11294              
11295 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11296 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11297              
11298 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11299 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11300              
11301 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11302 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11303 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11304 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11305 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11306 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11307 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11308 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11309 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11310 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11311              
11312             PDL_COMMENT("none")
11313 0           } } break; case PDL_F: {
11314 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11315 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11316              
11317 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11318 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11319              
11320 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11321 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11322              
11323 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11324 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11325              
11326 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11327 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11328              
11329 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11330 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11331              
11332 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11333 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11334 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11335 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11336 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11337 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11338 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11339 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11340 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11341 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11342              
11343             PDL_COMMENT("none")
11344 0           } } break; case PDL_D: {
11345 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11346 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11347              
11348 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11349 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11350              
11351 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11352 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11353              
11354 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11355 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11356              
11357 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11358 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11359              
11360 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11361 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11362              
11363 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11364 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11365 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11366 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11367 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11368 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11369 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11370 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11371 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11372 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11373              
11374             PDL_COMMENT("none")
11375 0           } break;}
11376 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
11377             }
11378             }
11379             {
11380             static char *__parnames[] = {"data","mask","weight","distances","tree","lnkdist"};
11381             static PDL_Indx __realdims[] = {2,2,1,2,2,1};
11382             static char __funcname[] = "PDL::Cluster::treeclusterd";
11383             static pdl_errorinfo __einfo = {
11384             __funcname, __parnames, 6
11385             };
11386            
11387 0           PDL->initthreadstruct(2,__privtrans->pdls,
11388             __realdims,__creating,6,
11389             &__einfo,&(__privtrans->__pdlthread),
11390 0           __privtrans->vtable->per_pdl_flags,
11391             0 );
11392             }
11393 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
11394 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
11395 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11396             }
11397 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
11398 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
11399 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
11400 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
11401 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11402             }
11403             }
11404 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
11405 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
11406 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
11407 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
11408 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11409             }
11410             }
11411 0           PDL->make_physical(((__privtrans->pdls[0])));
11412 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
11413 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
11414 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11415             }
11416 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
11417 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
11418 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
11419 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
11420 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11421             }
11422             }
11423 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
11424 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
11425 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
11426 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
11427 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11428             }
11429             }
11430 0           PDL->make_physical(((__privtrans->pdls[1])));
11431 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
11432 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
11433             }
11434 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
11435 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
11436 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
11437 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
11438 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11439             }
11440             }
11441 0           PDL->make_physical(((__privtrans->pdls[2])));
11442 0 0         if(((__privtrans->pdls[3]))->ndims < 2) {
11443 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11444 0 0         if (((__privtrans->pdls[3]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11445             }
11446 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
11447 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[0];
11448 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
11449 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
11450 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11451             }
11452             }
11453 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
11454 0           __privtrans->__n_size = ((__privtrans->pdls[3]))->dims[1];
11455 0 0         } else if(((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[3]))->dims[1]) {
    0          
11456 0 0         if(((__privtrans->pdls[3]))->dims[1] != 1) {
11457 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11458             }
11459             }
11460 0           PDL->make_physical(((__privtrans->pdls[3])));
11461 0 0         if(!__creating[4]) {
11462 0 0         if(((__privtrans->pdls[4]))->ndims < 2) {
11463 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__2_size <= 1) __privtrans->__2_size = 1;
    0          
11464 0 0         if (((__privtrans->pdls[4]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11465             }
11466 0 0         if(__privtrans->__2_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__2_size == 1)) {
    0          
    0          
11467 0           __privtrans->__2_size = ((__privtrans->pdls[4]))->dims[0];
11468 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__2_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
11469 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
11470 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11471             }
11472             }
11473 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
11474 0           __privtrans->__n_size = ((__privtrans->pdls[4]))->dims[1];
11475 0 0         } else if(((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[4]))->dims[1]) {
    0          
11476 0 0         if(((__privtrans->pdls[4]))->dims[1] != 1) {
11477 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11478             }
11479             }
11480 0           PDL->make_physical(((__privtrans->pdls[4])));
11481             } else {
11482 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__2_size;dims[1] = __privtrans->__n_size;
11483 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,4,dims,0);
11484 0 0         }if(!__creating[5]) {
11485 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
11486 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
11487             }
11488 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
11489 0           __privtrans->__n_size = ((__privtrans->pdls[5]))->dims[0];
11490 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
11491 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
11492 0           PDL->pdl_barf("Error in treeclusterd:" "Wrong dims\n");
11493             }
11494             }
11495 0           PDL->make_physical(((__privtrans->pdls[5])));
11496             } else {
11497 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
11498 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
11499             }
11500             { PDL_COMMENT("convenience block")
11501 0           void *hdrp = NULL;
11502 0           char propagate_hdrcpy = 0;
11503 0           SV *hdr_copy = NULL;
11504 0 0         if(!hdrp &&
    0          
11505 0 0         __privtrans->pdls[0]->hdrsv &&
11506 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
11507             ) {
11508 0           hdrp = __privtrans->pdls[0]->hdrsv;
11509 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
11510             }
11511 0 0         if(!hdrp &&
    0          
11512 0 0         __privtrans->pdls[1]->hdrsv &&
11513 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
11514             ) {
11515 0           hdrp = __privtrans->pdls[1]->hdrsv;
11516 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
11517             }
11518 0 0         if(!hdrp &&
    0          
11519 0 0         __privtrans->pdls[2]->hdrsv &&
11520 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
11521             ) {
11522 0           hdrp = __privtrans->pdls[2]->hdrsv;
11523 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
11524             }
11525 0 0         if(!hdrp &&
    0          
11526 0 0         __privtrans->pdls[3]->hdrsv &&
11527 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
11528             ) {
11529 0           hdrp = __privtrans->pdls[3]->hdrsv;
11530 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
11531             }
11532 0 0         if(!hdrp &&
    0          
11533 0 0         !__creating[4] &&
11534 0 0         __privtrans->pdls[4]->hdrsv &&
11535 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
11536             ) {
11537 0           hdrp = __privtrans->pdls[4]->hdrsv;
11538 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
11539             }
11540 0 0         if(!hdrp &&
    0          
11541 0 0         !__creating[5] &&
11542 0 0         __privtrans->pdls[5]->hdrsv &&
11543 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
11544             ) {
11545 0           hdrp = __privtrans->pdls[5]->hdrsv;
11546 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
11547             }
11548 0 0         if (hdrp) {
11549 0 0         if(hdrp == &PL_sv_undef)
11550 0           hdr_copy = &PL_sv_undef;
11551             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
11552             int count;
11553             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
11554 0           dSP;
11555 0           ENTER ;
11556 0           SAVETMPS ;
11557 0 0         PUSHMARK(SP) ;
11558 0 0         XPUSHs( hdrp );
11559 0           PUTBACK ;
11560 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
11561 0           SPAGAIN ;
11562 0 0         if(count != 1)
11563 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
11564              
11565 0           hdr_copy = (SV *)POPs;
11566              
11567 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
11568 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
11569             }
11570              
11571 0 0         FREETMPS ;
11572 0           LEAVE ;
11573              
11574              
11575             } PDL_COMMENT("end of callback block")
11576              
11577 0 0         if ( __privtrans->pdls[4]->hdrsv != hdrp ){
11578 0 0         if( __privtrans->pdls[4]->hdrsv && __privtrans->pdls[4]->hdrsv != &PL_sv_undef)
    0          
11579 0           (void)SvREFCNT_dec( __privtrans->pdls[4]->hdrsv );
11580 0 0         if( hdr_copy != &PL_sv_undef )
11581 0           (void)SvREFCNT_inc(hdr_copy);
11582 0           __privtrans->pdls[4]->hdrsv = hdr_copy;
11583             }
11584 0 0         if(propagate_hdrcpy)
11585 0           __privtrans->pdls[4]->state |= PDL_HDRCPY;
11586 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
11587 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
11588 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
11589 0 0         if( hdr_copy != &PL_sv_undef )
11590 0           (void)SvREFCNT_inc(hdr_copy);
11591 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
11592             }
11593 0 0         if(propagate_hdrcpy)
11594 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
11595              
11596 0 0         if(hdr_copy != &PL_sv_undef)
11597 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
11598             } PDL_COMMENT("end of if(hdrp) block")
11599             } PDL_COMMENT("end of conv. block")
11600 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
11601 0           __privtrans->__inc_data_d = 0; else
11602 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
11603 0           __privtrans->__inc_data_n = 0; else
11604 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
11605 0           __privtrans->__inc_mask_d = 0; else
11606 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
11607 0           __privtrans->__inc_mask_n = 0; else
11608 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
11609 0           __privtrans->__inc_weight_d = 0; else
11610 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
11611 0           __privtrans->__inc_distances_n0 = 0; else
11612 0 0         __privtrans->__inc_distances_n0 = __privtrans->pdls[3]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 1 || __privtrans->pdls[3]->dims[1] <= 1)
    0          
11613 0           __privtrans->__inc_distances_n1 = 0; else
11614 0 0         __privtrans->__inc_distances_n1 = __privtrans->pdls[3]->dimincs[1];if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
11615 0           __privtrans->__inc_tree_2 = 0; else
11616 0 0         __privtrans->__inc_tree_2 = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 1 || __privtrans->pdls[4]->dims[1] <= 1)
    0          
11617 0           __privtrans->__inc_tree_n = 0; else
11618 0 0         __privtrans->__inc_tree_n = __privtrans->pdls[4]->dimincs[1];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
11619 0           __privtrans->__inc_lnkdist_n = 0; else
11620 0           __privtrans->__inc_lnkdist_n = __privtrans->pdls[5]->dimincs[0]; __privtrans->__ddone = 1;
11621             }
11622 0           }
11623            
11624              
11625 0           pdl_trans * pdl_treeclusterd_copy(pdl_trans *__tr ) {
11626             int __dim;
11627 0           pdl_treeclusterd_struct *__privtrans = (pdl_treeclusterd_struct *) __tr;
11628            
11629             {
11630 0           pdl_treeclusterd_struct *__copy = malloc(sizeof(pdl_treeclusterd_struct));
11631 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
11632 0           __copy->has_badvalue = __privtrans->has_badvalue;
11633 0           __copy->badvalue = __privtrans->badvalue;
11634 0           __copy->flags = __privtrans->flags;
11635 0           __copy->vtable = __privtrans->vtable;
11636 0           __copy->__datatype = __privtrans->__datatype;
11637 0           __copy->freeproc = NULL;
11638 0           __copy->__ddone = __privtrans->__ddone;
11639             {int i;
11640 0 0         for(i=0; i<__copy->vtable->npdls; i++)
11641 0           __copy->pdls[i] = __privtrans->pdls[i];
11642             }
11643 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
11644 0 0         if(__copy->__ddone) {
11645 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_distances_n0=__copy->__inc_distances_n0;__privtrans->__inc_distances_n1=__copy->__inc_distances_n1;__privtrans->__inc_tree_2=__copy->__inc_tree_2;__privtrans->__inc_tree_n=__copy->__inc_tree_n;__privtrans->__inc_lnkdist_n=__copy->__inc_lnkdist_n;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;__copy->__2_size=__privtrans->__2_size;
11646             }
11647 0           return (pdl_trans*)__copy;
11648             }
11649             }
11650            
11651              
11652 0           void pdl_treeclusterd_readdata(pdl_trans *__tr ) {
11653             int __dim;
11654 0           pdl_treeclusterd_struct *__privtrans = (pdl_treeclusterd_struct *) __tr;
11655            
11656             {
11657             {PDL_COMMENT("Start generic loop")
11658              
11659 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
11660 0           } break; case PDL_B: {
11661 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11662 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11663              
11664 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11665 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11666              
11667 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11668 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11669              
11670 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11671 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11672              
11673 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11674 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11675              
11676 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11677 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11678              
11679 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11680 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11681 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11682 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11683 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11684 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11685 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11686 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11687 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11688 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11689              
11690              
11691 0           int transpose = 0;
11692 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
11693 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
11694 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
11695 0           Node *nod = NULL;
11696 0           int nmax = __privtrans->__n_size-1;
11697            
11698             PDL_COMMENT("THREADLOOPBEGIN")
11699 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
11700 0           do { register PDL_Indx __tind1=0,__tind2=0;
11701 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
11702 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
11703 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
11704 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
11705 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
11706 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
11707 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
11708 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
11709 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
11710 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
11711 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
11712 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
11713 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
11714 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
11715 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
11716 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
11717 0           data_datap += __offsp[0];
11718 0           mask_datap += __offsp[1];
11719 0           weight_datap += __offsp[2];
11720 0           distances_datap += __offsp[3];
11721 0           tree_datap += __offsp[4];
11722 0           lnkdist_datap += __offsp[5];
11723 0 0         for( __tind2 = 0 ;
11724             __tind2 < __tdims1 ;
11725 0           __tind2++
11726 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
11727 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
11728 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
11729 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
11730 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
11731 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
11732             )
11733             {
11734 0 0         for( __tind1 = 0 ;
11735             __tind1 < __tdims0 ;
11736 0           __tind1++
11737 0           ,data_datap += __tinc0_0
11738 0           ,mask_datap += __tinc0_1
11739 0           ,weight_datap += __tinc0_2
11740 0           ,distances_datap += __tinc0_3
11741 0           ,tree_datap += __tinc0_4
11742 0           ,lnkdist_datap += __tinc0_5
11743             )
11744             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
11745 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
11746 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
11747 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
11748 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
11749 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
11750             distpp);
11751              
11752 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
11753 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11754 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11755 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
11756            
11757             PDL_COMMENT("THREADLOOPEND")
11758             }
11759             }
11760 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
11761 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
11762 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
11763 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
11764 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
11765 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
11766 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
11767             /*-- cleanup --*/
11768 0 0         if (datapp) free(datapp);
11769 0 0         if (maskpp) free(maskpp);
11770 0 0         if (distpp) free(distpp);
11771 0 0         if (nod) free(nod);
11772              
11773 0           } } break; case PDL_S: {
11774 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11775 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11776              
11777 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11778 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11779              
11780 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11781 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11782              
11783 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11784 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11785              
11786 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11787 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11788              
11789 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11790 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11791              
11792 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11793 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11794 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11795 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11796 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11797 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11798 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11799 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11800 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11801 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11802              
11803              
11804 0           int transpose = 0;
11805 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
11806 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
11807 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
11808 0           Node *nod = NULL;
11809 0           int nmax = __privtrans->__n_size-1;
11810            
11811             PDL_COMMENT("THREADLOOPBEGIN")
11812 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
11813 0           do { register PDL_Indx __tind1=0,__tind2=0;
11814 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
11815 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
11816 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
11817 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
11818 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
11819 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
11820 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
11821 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
11822 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
11823 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
11824 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
11825 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
11826 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
11827 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
11828 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
11829 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
11830 0           data_datap += __offsp[0];
11831 0           mask_datap += __offsp[1];
11832 0           weight_datap += __offsp[2];
11833 0           distances_datap += __offsp[3];
11834 0           tree_datap += __offsp[4];
11835 0           lnkdist_datap += __offsp[5];
11836 0 0         for( __tind2 = 0 ;
11837             __tind2 < __tdims1 ;
11838 0           __tind2++
11839 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
11840 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
11841 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
11842 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
11843 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
11844 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
11845             )
11846             {
11847 0 0         for( __tind1 = 0 ;
11848             __tind1 < __tdims0 ;
11849 0           __tind1++
11850 0           ,data_datap += __tinc0_0
11851 0           ,mask_datap += __tinc0_1
11852 0           ,weight_datap += __tinc0_2
11853 0           ,distances_datap += __tinc0_3
11854 0           ,tree_datap += __tinc0_4
11855 0           ,lnkdist_datap += __tinc0_5
11856             )
11857             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
11858 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
11859 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
11860 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
11861 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
11862 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
11863             distpp);
11864              
11865 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
11866 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11867 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11868 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
11869            
11870             PDL_COMMENT("THREADLOOPEND")
11871             }
11872             }
11873 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
11874 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
11875 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
11876 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
11877 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
11878 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
11879 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
11880             /*-- cleanup --*/
11881 0 0         if (datapp) free(datapp);
11882 0 0         if (maskpp) free(maskpp);
11883 0 0         if (distpp) free(distpp);
11884 0 0         if (nod) free(nod);
11885              
11886 0           } } break; case PDL_US: {
11887 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
11888 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
11889              
11890 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
11891 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
11892              
11893 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
11894 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
11895              
11896 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
11897 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
11898              
11899 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
11900 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
11901              
11902 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
11903 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
11904              
11905 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
11906 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
11907 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
11908 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
11909 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
11910 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
11911 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
11912 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
11913 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
11914 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
11915              
11916              
11917 0           int transpose = 0;
11918 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
11919 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
11920 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
11921 0           Node *nod = NULL;
11922 0           int nmax = __privtrans->__n_size-1;
11923            
11924             PDL_COMMENT("THREADLOOPBEGIN")
11925 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
11926 0           do { register PDL_Indx __tind1=0,__tind2=0;
11927 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
11928 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
11929 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
11930 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
11931 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
11932 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
11933 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
11934 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
11935 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
11936 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
11937 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
11938 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
11939 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
11940 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
11941 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
11942 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
11943 0           data_datap += __offsp[0];
11944 0           mask_datap += __offsp[1];
11945 0           weight_datap += __offsp[2];
11946 0           distances_datap += __offsp[3];
11947 0           tree_datap += __offsp[4];
11948 0           lnkdist_datap += __offsp[5];
11949 0 0         for( __tind2 = 0 ;
11950             __tind2 < __tdims1 ;
11951 0           __tind2++
11952 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
11953 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
11954 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
11955 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
11956 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
11957 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
11958             )
11959             {
11960 0 0         for( __tind1 = 0 ;
11961             __tind1 < __tdims0 ;
11962 0           __tind1++
11963 0           ,data_datap += __tinc0_0
11964 0           ,mask_datap += __tinc0_1
11965 0           ,weight_datap += __tinc0_2
11966 0           ,distances_datap += __tinc0_3
11967 0           ,tree_datap += __tinc0_4
11968 0           ,lnkdist_datap += __tinc0_5
11969             )
11970             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
11971 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
11972 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
11973 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
11974 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
11975 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
11976             distpp);
11977              
11978 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
11979 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11980 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
11981 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
11982            
11983             PDL_COMMENT("THREADLOOPEND")
11984             }
11985             }
11986 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
11987 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
11988 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
11989 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
11990 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
11991 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
11992 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
11993             /*-- cleanup --*/
11994 0 0         if (datapp) free(datapp);
11995 0 0         if (maskpp) free(maskpp);
11996 0 0         if (distpp) free(distpp);
11997 0 0         if (nod) free(nod);
11998              
11999 0           } } break; case PDL_L: {
12000 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12001 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
12002              
12003 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12004 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12005              
12006 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12007 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
12008              
12009 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
12010 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
12011              
12012 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
12013 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
12014              
12015 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
12016 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
12017              
12018 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
12019 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
12020 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
12021 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
12022 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
12023 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
12024 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
12025 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
12026 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12027 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12028              
12029              
12030 0           int transpose = 0;
12031 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
12032 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
12033 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
12034 0           Node *nod = NULL;
12035 0           int nmax = __privtrans->__n_size-1;
12036            
12037             PDL_COMMENT("THREADLOOPBEGIN")
12038 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12039 0           do { register PDL_Indx __tind1=0,__tind2=0;
12040 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12041 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12042 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12043 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12044 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12045 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12046 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12047 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
12048 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
12049 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
12050 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12051 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12052 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12053 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
12054 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
12055 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
12056 0           data_datap += __offsp[0];
12057 0           mask_datap += __offsp[1];
12058 0           weight_datap += __offsp[2];
12059 0           distances_datap += __offsp[3];
12060 0           tree_datap += __offsp[4];
12061 0           lnkdist_datap += __offsp[5];
12062 0 0         for( __tind2 = 0 ;
12063             __tind2 < __tdims1 ;
12064 0           __tind2++
12065 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
12066 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
12067 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
12068 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
12069 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
12070 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
12071             )
12072             {
12073 0 0         for( __tind1 = 0 ;
12074             __tind1 < __tdims0 ;
12075 0           __tind1++
12076 0           ,data_datap += __tinc0_0
12077 0           ,mask_datap += __tinc0_1
12078 0           ,weight_datap += __tinc0_2
12079 0           ,distances_datap += __tinc0_3
12080 0           ,tree_datap += __tinc0_4
12081 0           ,lnkdist_datap += __tinc0_5
12082             )
12083             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
12084 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
12085 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
12086 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
12087 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
12088 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
12089             distpp);
12090              
12091 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
12092 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12093 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12094 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
12095            
12096             PDL_COMMENT("THREADLOOPEND")
12097             }
12098             }
12099 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12100 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12101 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12102 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
12103 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
12104 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
12105 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
12106             /*-- cleanup --*/
12107 0 0         if (datapp) free(datapp);
12108 0 0         if (maskpp) free(maskpp);
12109 0 0         if (distpp) free(distpp);
12110 0 0         if (nod) free(nod);
12111              
12112 0           } } break; case PDL_IND: {
12113 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12114 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
12115              
12116 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12117 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12118              
12119 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12120 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
12121              
12122 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
12123 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
12124              
12125 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
12126 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
12127              
12128 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
12129 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
12130              
12131 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
12132 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
12133 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
12134 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
12135 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
12136 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
12137 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
12138 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
12139 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12140 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12141              
12142              
12143 0           int transpose = 0;
12144 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
12145 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
12146 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
12147 0           Node *nod = NULL;
12148 0           int nmax = __privtrans->__n_size-1;
12149            
12150             PDL_COMMENT("THREADLOOPBEGIN")
12151 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12152 0           do { register PDL_Indx __tind1=0,__tind2=0;
12153 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12154 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12155 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12156 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12157 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12158 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12159 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12160 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
12161 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
12162 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
12163 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12164 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12165 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12166 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
12167 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
12168 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
12169 0           data_datap += __offsp[0];
12170 0           mask_datap += __offsp[1];
12171 0           weight_datap += __offsp[2];
12172 0           distances_datap += __offsp[3];
12173 0           tree_datap += __offsp[4];
12174 0           lnkdist_datap += __offsp[5];
12175 0 0         for( __tind2 = 0 ;
12176             __tind2 < __tdims1 ;
12177 0           __tind2++
12178 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
12179 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
12180 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
12181 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
12182 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
12183 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
12184             )
12185             {
12186 0 0         for( __tind1 = 0 ;
12187             __tind1 < __tdims0 ;
12188 0           __tind1++
12189 0           ,data_datap += __tinc0_0
12190 0           ,mask_datap += __tinc0_1
12191 0           ,weight_datap += __tinc0_2
12192 0           ,distances_datap += __tinc0_3
12193 0           ,tree_datap += __tinc0_4
12194 0           ,lnkdist_datap += __tinc0_5
12195             )
12196             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
12197 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
12198 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
12199 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
12200 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
12201 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
12202             distpp);
12203              
12204 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
12205 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12206 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12207 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
12208            
12209             PDL_COMMENT("THREADLOOPEND")
12210             }
12211             }
12212 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12213 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12214 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12215 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
12216 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
12217 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
12218 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
12219             /*-- cleanup --*/
12220 0 0         if (datapp) free(datapp);
12221 0 0         if (maskpp) free(maskpp);
12222 0 0         if (distpp) free(distpp);
12223 0 0         if (nod) free(nod);
12224              
12225 0           } } break; case PDL_LL: {
12226 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12227 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
12228              
12229 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12230 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12231              
12232 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12233 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
12234              
12235 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
12236 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
12237              
12238 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
12239 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
12240              
12241 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
12242 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
12243              
12244 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
12245 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
12246 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
12247 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
12248 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
12249 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
12250 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
12251 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
12252 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12253 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12254              
12255              
12256 0           int transpose = 0;
12257 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
12258 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
12259 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
12260 0           Node *nod = NULL;
12261 0           int nmax = __privtrans->__n_size-1;
12262            
12263             PDL_COMMENT("THREADLOOPBEGIN")
12264 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12265 0           do { register PDL_Indx __tind1=0,__tind2=0;
12266 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12267 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12268 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12269 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12270 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12271 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12272 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12273 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
12274 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
12275 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
12276 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12277 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12278 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12279 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
12280 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
12281 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
12282 0           data_datap += __offsp[0];
12283 0           mask_datap += __offsp[1];
12284 0           weight_datap += __offsp[2];
12285 0           distances_datap += __offsp[3];
12286 0           tree_datap += __offsp[4];
12287 0           lnkdist_datap += __offsp[5];
12288 0 0         for( __tind2 = 0 ;
12289             __tind2 < __tdims1 ;
12290 0           __tind2++
12291 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
12292 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
12293 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
12294 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
12295 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
12296 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
12297             )
12298             {
12299 0 0         for( __tind1 = 0 ;
12300             __tind1 < __tdims0 ;
12301 0           __tind1++
12302 0           ,data_datap += __tinc0_0
12303 0           ,mask_datap += __tinc0_1
12304 0           ,weight_datap += __tinc0_2
12305 0           ,distances_datap += __tinc0_3
12306 0           ,tree_datap += __tinc0_4
12307 0           ,lnkdist_datap += __tinc0_5
12308             )
12309             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
12310 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
12311 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
12312 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
12313 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
12314 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
12315             distpp);
12316              
12317 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
12318 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12319 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12320 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
12321            
12322             PDL_COMMENT("THREADLOOPEND")
12323             }
12324             }
12325 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12326 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12327 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12328 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
12329 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
12330 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
12331 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
12332             /*-- cleanup --*/
12333 0 0         if (datapp) free(datapp);
12334 0 0         if (maskpp) free(maskpp);
12335 0 0         if (distpp) free(distpp);
12336 0 0         if (nod) free(nod);
12337              
12338 0           } } break; case PDL_F: {
12339 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12340 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
12341              
12342 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12343 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12344              
12345 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12346 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
12347              
12348 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
12349 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
12350              
12351 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
12352 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
12353              
12354 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
12355 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
12356              
12357 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
12358 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
12359 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
12360 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
12361 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
12362 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
12363 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
12364 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
12365 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12366 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12367              
12368              
12369 0           int transpose = 0;
12370 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
12371 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
12372 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
12373 0           Node *nod = NULL;
12374 0           int nmax = __privtrans->__n_size-1;
12375            
12376             PDL_COMMENT("THREADLOOPBEGIN")
12377 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12378 0           do { register PDL_Indx __tind1=0,__tind2=0;
12379 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12380 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12381 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12382 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12383 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12384 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12385 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12386 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
12387 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
12388 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
12389 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12390 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12391 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12392 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
12393 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
12394 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
12395 0           data_datap += __offsp[0];
12396 0           mask_datap += __offsp[1];
12397 0           weight_datap += __offsp[2];
12398 0           distances_datap += __offsp[3];
12399 0           tree_datap += __offsp[4];
12400 0           lnkdist_datap += __offsp[5];
12401 0 0         for( __tind2 = 0 ;
12402             __tind2 < __tdims1 ;
12403 0           __tind2++
12404 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
12405 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
12406 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
12407 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
12408 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
12409 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
12410             )
12411             {
12412 0 0         for( __tind1 = 0 ;
12413             __tind1 < __tdims0 ;
12414 0           __tind1++
12415 0           ,data_datap += __tinc0_0
12416 0           ,mask_datap += __tinc0_1
12417 0           ,weight_datap += __tinc0_2
12418 0           ,distances_datap += __tinc0_3
12419 0           ,tree_datap += __tinc0_4
12420 0           ,lnkdist_datap += __tinc0_5
12421             )
12422             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
12423 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
12424 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
12425 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
12426 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
12427 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
12428             distpp);
12429              
12430 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
12431 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12432 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12433 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
12434            
12435             PDL_COMMENT("THREADLOOPEND")
12436             }
12437             }
12438 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12439 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12440 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12441 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
12442 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
12443 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
12444 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
12445             /*-- cleanup --*/
12446 0 0         if (datapp) free(datapp);
12447 0 0         if (maskpp) free(maskpp);
12448 0 0         if (distpp) free(distpp);
12449 0 0         if (nod) free(nod);
12450              
12451 0           } } break; case PDL_D: {
12452 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12453 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
12454              
12455 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12456 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12457              
12458 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12459 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
12460              
12461 0 0         PDL_Double * distances_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
12462 0           PDL_Double * distances_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
12463              
12464 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
12465 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
12466              
12467 0 0         PDL_Double * lnkdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
12468 0           PDL_Double * lnkdist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
12469              
12470 0           {register PDL_Indx __inc_lnkdist_n = __privtrans->__inc_lnkdist_n;
12471 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
12472 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
12473 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
12474 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
12475 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
12476 0           register PDL_Indx __inc_distances_n0 = __privtrans->__inc_distances_n0;
12477 0           register PDL_Indx __inc_distances_n1 = __privtrans->__inc_distances_n1;
12478 0           register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12479 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12480              
12481              
12482 0           int transpose = 0;
12483 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
12484 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
12485 0           double **distpp = (double **)pp_alloc(__privtrans->__n_size);
12486 0           Node *nod = NULL;
12487 0           int nmax = __privtrans->__n_size-1;
12488            
12489             PDL_COMMENT("THREADLOOPBEGIN")
12490 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12491 0           do { register PDL_Indx __tind1=0,__tind2=0;
12492 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12493 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12494 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12495 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12496 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12497 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12498 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12499 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
12500 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
12501 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
12502 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12503 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12504 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12505 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
12506 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
12507 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
12508 0           data_datap += __offsp[0];
12509 0           mask_datap += __offsp[1];
12510 0           weight_datap += __offsp[2];
12511 0           distances_datap += __offsp[3];
12512 0           tree_datap += __offsp[4];
12513 0           lnkdist_datap += __offsp[5];
12514 0 0         for( __tind2 = 0 ;
12515             __tind2 < __tdims1 ;
12516 0           __tind2++
12517 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
12518 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
12519 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
12520 0           ,distances_datap += __tinc1_3 - __tinc0_3 * __tdims0
12521 0           ,tree_datap += __tinc1_4 - __tinc0_4 * __tdims0
12522 0           ,lnkdist_datap += __tinc1_5 - __tinc0_5 * __tdims0
12523             )
12524             {
12525 0 0         for( __tind1 = 0 ;
12526             __tind1 < __tdims0 ;
12527 0           __tind1++
12528 0           ,data_datap += __tinc0_0
12529 0           ,mask_datap += __tinc0_1
12530 0           ,weight_datap += __tinc0_2
12531 0           ,distances_datap += __tinc0_3
12532 0           ,tree_datap += __tinc0_4
12533 0           ,lnkdist_datap += __tinc0_5
12534             )
12535             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
12536 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
12537 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
12538 0           p2pp_dbl_ragged(__privtrans->__n_size, __privtrans->__n_size, distances_datap, distpp);
12539 0           nod = treecluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
12540 0           weight_datap, transpose, *__privtrans->distFlag, *__privtrans->methodFlag,
12541             distpp);
12542              
12543 0           node2p(nmax, nod, tree_datap, lnkdist_datap);
12544 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 0))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12545 0 0         (tree_datap)[0+(__inc_tree_2*PP_INDTERM(__privtrans->__2_size, 1))+(__inc_tree_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
    0          
12546 0 0         (lnkdist_datap)[0+(__inc_lnkdist_n*PP_INDTERM(__privtrans->__n_size, nmax))] PDL_COMMENT("ACCESS()") = 0;
12547            
12548             PDL_COMMENT("THREADLOOPEND")
12549             }
12550             }
12551 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12552 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12553 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12554 0           distances_datap -= __tinc1_3 * __tdims1 + __offsp[3];
12555 0           tree_datap -= __tinc1_4 * __tdims1 + __offsp[4];
12556 0           lnkdist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
12557 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
12558             /*-- cleanup --*/
12559 0 0         if (datapp) free(datapp);
12560 0 0         if (maskpp) free(maskpp);
12561 0 0         if (distpp) free(distpp);
12562 0 0         if (nod) free(nod);
12563              
12564 0           } break;}
12565 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
12566             }
12567             }
12568             }
12569            
12570              
12571              
12572              
12573 0           void pdl_treeclusterd_free(pdl_trans *__tr ) {
12574             int __dim;
12575 0           pdl_treeclusterd_struct *__privtrans = (pdl_treeclusterd_struct *) __tr;
12576            
12577             {
12578            
12579 0           PDL_TR_CLRMAGIC(__privtrans);
12580 0           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
12581 0 0         if(__privtrans->__ddone) {
12582 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
12583             ;;;;;;;;;;;;;;
12584             }
12585            
12586             }
12587 0           }
12588            
12589              
12590              
12591              
12592             static char pdl_treeclusterd_vtable_flags[] =
12593             { 0,0,0,0,0,0};
12594             pdl_transvtable pdl_treeclusterd_vtable = {
12595             0,0, 4, 6, pdl_treeclusterd_vtable_flags,
12596             pdl_treeclusterd_redodims, pdl_treeclusterd_readdata, NULL,
12597             pdl_treeclusterd_free,NULL,NULL,pdl_treeclusterd_copy,
12598             sizeof(pdl_treeclusterd_struct),"pdl_treeclusterd_vtable"
12599             };
12600              
12601             typedef struct pdl_cuttree_struct {
12602             PDL_TRANS_START(3);
12603             pdl_thread __pdlthread;PDL_Indx __inc_tree_2;PDL_Indx __inc_tree_n;PDL_Indx __inc_clusterids_n;PDL_Indx __n_size;PDL_Indx __2_size;
12604            
12605             char __ddone; PDL_COMMENT("Dims done")
12606             } pdl_cuttree_struct;
12607              
12608 0           void pdl_cuttree_redodims(pdl_trans *__tr ) {
12609             int __dim;
12610 0           pdl_cuttree_struct *__privtrans = (pdl_cuttree_struct *) __tr;
12611            
12612             {
12613             PDL_Indx __creating[3];
12614 0           __privtrans->__n_size = -1;
12615 0           __privtrans->__2_size = -1;
12616 0           __creating[0] = 0;
12617 0           __creating[1] = 0;
12618 0 0         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    0          
12619             {
12620             {PDL_COMMENT("Start generic loop")
12621              
12622 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
12623 0           } break; case PDL_B: {
12624 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12625 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12626              
12627 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12628 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12629              
12630 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12631 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12632              
12633 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12634 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12635 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12636              
12637             PDL_COMMENT("none")
12638 0           } } break; case PDL_S: {
12639 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12640 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12641              
12642 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12643 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12644              
12645 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12646 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12647              
12648 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12649 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12650 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12651              
12652             PDL_COMMENT("none")
12653 0           } } break; case PDL_US: {
12654 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12655 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12656              
12657 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12658 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12659              
12660 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12661 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12662              
12663 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12664 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12665 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12666              
12667             PDL_COMMENT("none")
12668 0           } } break; case PDL_L: {
12669 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12670 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12671              
12672 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12673 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12674              
12675 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12676 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12677              
12678 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12679 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12680 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12681              
12682             PDL_COMMENT("none")
12683 0           } } break; case PDL_IND: {
12684 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12685 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12686              
12687 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12688 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12689              
12690 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12691 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12692              
12693 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12694 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12695 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12696              
12697             PDL_COMMENT("none")
12698 0           } } break; case PDL_LL: {
12699 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12700 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12701              
12702 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12703 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12704              
12705 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12706 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12707              
12708 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12709 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12710 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12711              
12712             PDL_COMMENT("none")
12713 0           } } break; case PDL_F: {
12714 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12715 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12716              
12717 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12718 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12719              
12720 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12721 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12722              
12723 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12724 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12725 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12726              
12727             PDL_COMMENT("none")
12728 0           } } break; case PDL_D: {
12729 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12730 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12731              
12732 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12733 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12734              
12735 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12736 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12737              
12738 0           {register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12739 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12740 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12741              
12742             PDL_COMMENT("none")
12743 0           } break;}
12744 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
12745             }
12746             }
12747             {
12748             static char *__parnames[] = {"tree","nclusters","clusterids"};
12749             static PDL_Indx __realdims[] = {2,0,1};
12750             static char __funcname[] = "PDL::Cluster::cuttree";
12751             static pdl_errorinfo __einfo = {
12752             __funcname, __parnames, 3
12753             };
12754            
12755 0           PDL->initthreadstruct(2,__privtrans->pdls,
12756             __realdims,__creating,3,
12757             &__einfo,&(__privtrans->__pdlthread),
12758 0           __privtrans->vtable->per_pdl_flags,
12759             0 );
12760             }
12761 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
12762 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__2_size <= 1) __privtrans->__2_size = 1;
    0          
12763 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
12764             }
12765 0 0         if(__privtrans->__2_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__2_size == 1)) {
    0          
    0          
12766 0           __privtrans->__2_size = ((__privtrans->pdls[0]))->dims[0];
12767 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__2_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
12768 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
12769 0           PDL->pdl_barf("Error in cuttree:" "Wrong dims\n");
12770             }
12771             }
12772 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
12773 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
12774 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
12775 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
12776 0           PDL->pdl_barf("Error in cuttree:" "Wrong dims\n");
12777             }
12778             }
12779 0           PDL->make_physical(((__privtrans->pdls[0])));
12780 0 0         if(!__creating[2]) {
12781 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
12782 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
12783             }
12784 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
12785 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[0];
12786 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
12787 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
12788 0           PDL->pdl_barf("Error in cuttree:" "Wrong dims\n");
12789             }
12790             }
12791 0           PDL->make_physical(((__privtrans->pdls[2])));
12792             } else {
12793 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
12794 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,0);
12795             }
12796             { PDL_COMMENT("convenience block")
12797 0           void *hdrp = NULL;
12798 0           char propagate_hdrcpy = 0;
12799 0           SV *hdr_copy = NULL;
12800 0 0         if(!hdrp &&
    0          
12801 0 0         __privtrans->pdls[0]->hdrsv &&
12802 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
12803             ) {
12804 0           hdrp = __privtrans->pdls[0]->hdrsv;
12805 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
12806             }
12807 0 0         if(!hdrp &&
    0          
12808 0 0         __privtrans->pdls[1]->hdrsv &&
12809 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
12810             ) {
12811 0           hdrp = __privtrans->pdls[1]->hdrsv;
12812 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
12813             }
12814 0 0         if(!hdrp &&
    0          
12815 0 0         !__creating[2] &&
12816 0 0         __privtrans->pdls[2]->hdrsv &&
12817 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
12818             ) {
12819 0           hdrp = __privtrans->pdls[2]->hdrsv;
12820 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
12821             }
12822 0 0         if (hdrp) {
12823 0 0         if(hdrp == &PL_sv_undef)
12824 0           hdr_copy = &PL_sv_undef;
12825             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
12826             int count;
12827             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
12828 0           dSP;
12829 0           ENTER ;
12830 0           SAVETMPS ;
12831 0 0         PUSHMARK(SP) ;
12832 0 0         XPUSHs( hdrp );
12833 0           PUTBACK ;
12834 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
12835 0           SPAGAIN ;
12836 0 0         if(count != 1)
12837 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
12838              
12839 0           hdr_copy = (SV *)POPs;
12840              
12841 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
12842 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
12843             }
12844              
12845 0 0         FREETMPS ;
12846 0           LEAVE ;
12847              
12848              
12849             } PDL_COMMENT("end of callback block")
12850              
12851 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
12852 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
12853 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
12854 0 0         if( hdr_copy != &PL_sv_undef )
12855 0           (void)SvREFCNT_inc(hdr_copy);
12856 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
12857             }
12858 0 0         if(propagate_hdrcpy)
12859 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
12860              
12861 0 0         if(hdr_copy != &PL_sv_undef)
12862 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
12863             } PDL_COMMENT("end of if(hdrp) block")
12864             } PDL_COMMENT("end of conv. block")
12865 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
12866 0           __privtrans->__inc_tree_2 = 0; else
12867 0 0         __privtrans->__inc_tree_2 = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
12868 0           __privtrans->__inc_tree_n = 0; else
12869 0 0         __privtrans->__inc_tree_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
12870 0           __privtrans->__inc_clusterids_n = 0; else
12871 0           __privtrans->__inc_clusterids_n = __privtrans->pdls[2]->dimincs[0]; __privtrans->__ddone = 1;
12872             }
12873 0           }
12874            
12875              
12876 0           pdl_trans * pdl_cuttree_copy(pdl_trans *__tr ) {
12877             int __dim;
12878 0           pdl_cuttree_struct *__privtrans = (pdl_cuttree_struct *) __tr;
12879            
12880             {
12881 0           pdl_cuttree_struct *__copy = malloc(sizeof(pdl_cuttree_struct));
12882 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
12883 0           __copy->has_badvalue = __privtrans->has_badvalue;
12884 0           __copy->badvalue = __privtrans->badvalue;
12885 0           __copy->flags = __privtrans->flags;
12886 0           __copy->vtable = __privtrans->vtable;
12887 0           __copy->__datatype = __privtrans->__datatype;
12888 0           __copy->freeproc = NULL;
12889 0           __copy->__ddone = __privtrans->__ddone;
12890             {int i;
12891 0 0         for(i=0; i<__copy->vtable->npdls; i++)
12892 0           __copy->pdls[i] = __privtrans->pdls[i];
12893             }
12894            
12895 0 0         if(__copy->__ddone) {
12896 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_tree_2=__copy->__inc_tree_2;__privtrans->__inc_tree_n=__copy->__inc_tree_n;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__copy->__n_size=__privtrans->__n_size;__copy->__2_size=__privtrans->__2_size;
12897             }
12898 0           return (pdl_trans*)__copy;
12899             }
12900             }
12901            
12902              
12903 0           void pdl_cuttree_readdata(pdl_trans *__tr ) {
12904             int __dim;
12905 0           pdl_cuttree_struct *__privtrans = (pdl_cuttree_struct *) __tr;
12906            
12907             {
12908             {PDL_COMMENT("Start generic loop")
12909              
12910 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
12911 0           } break; case PDL_B: {
12912 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12913 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12914              
12915 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12916 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12917              
12918 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12919 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12920              
12921              
12922             PDL_COMMENT("THREADLOOPBEGIN")
12923 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12924 0           do { register PDL_Indx __tind1=0,__tind2=0;
12925 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12926 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12927 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12928 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12929 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12930 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12931 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12932 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12933 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12934 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12935 0           tree_datap += __offsp[0];
12936 0           nclusters_datap += __offsp[1];
12937 0           clusterids_datap += __offsp[2];
12938 0 0         for( __tind2 = 0 ;
12939             __tind2 < __tdims1 ;
12940 0           __tind2++
12941 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
12942 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
12943 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
12944             )
12945             {
12946 0 0         for( __tind1 = 0 ;
12947             __tind1 < __tdims0 ;
12948 0           __tind1++
12949 0           ,tree_datap += __tinc0_0
12950 0           ,nclusters_datap += __tinc0_1
12951 0           ,clusterids_datap += __tinc0_2
12952             )
12953 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
12954 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
12955 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
12956              
12957              
12958 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
12959 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
12960 0 0         if (nod) free(nod);
12961              
12962             }
12963             PDL_COMMENT("THREADLOOPEND")
12964             }
12965             }
12966 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
12967 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
12968 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
12969 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_S: {
12970 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
12971 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
12972              
12973 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
12974 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
12975              
12976 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
12977 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
12978              
12979              
12980             PDL_COMMENT("THREADLOOPBEGIN")
12981 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
12982 0           do { register PDL_Indx __tind1=0,__tind2=0;
12983 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
12984 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
12985 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
12986 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
12987 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
12988 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
12989 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
12990 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
12991 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
12992 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
12993 0           tree_datap += __offsp[0];
12994 0           nclusters_datap += __offsp[1];
12995 0           clusterids_datap += __offsp[2];
12996 0 0         for( __tind2 = 0 ;
12997             __tind2 < __tdims1 ;
12998 0           __tind2++
12999 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13000 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13001 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13002             )
13003             {
13004 0 0         for( __tind1 = 0 ;
13005             __tind1 < __tdims0 ;
13006 0           __tind1++
13007 0           ,tree_datap += __tinc0_0
13008 0           ,nclusters_datap += __tinc0_1
13009 0           ,clusterids_datap += __tinc0_2
13010             )
13011 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13012 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13013 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13014              
13015              
13016 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13017 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13018 0 0         if (nod) free(nod);
13019              
13020             }
13021             PDL_COMMENT("THREADLOOPEND")
13022             }
13023             }
13024 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13025 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13026 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13027 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_US: {
13028 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13029 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13030              
13031 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13032 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13033              
13034 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13035 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13036              
13037              
13038             PDL_COMMENT("THREADLOOPBEGIN")
13039 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13040 0           do { register PDL_Indx __tind1=0,__tind2=0;
13041 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13042 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13043 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13044 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13045 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13046 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13047 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13048 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13049 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13050 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13051 0           tree_datap += __offsp[0];
13052 0           nclusters_datap += __offsp[1];
13053 0           clusterids_datap += __offsp[2];
13054 0 0         for( __tind2 = 0 ;
13055             __tind2 < __tdims1 ;
13056 0           __tind2++
13057 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13058 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13059 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13060             )
13061             {
13062 0 0         for( __tind1 = 0 ;
13063             __tind1 < __tdims0 ;
13064 0           __tind1++
13065 0           ,tree_datap += __tinc0_0
13066 0           ,nclusters_datap += __tinc0_1
13067 0           ,clusterids_datap += __tinc0_2
13068             )
13069 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13070 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13071 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13072              
13073              
13074 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13075 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13076 0 0         if (nod) free(nod);
13077              
13078             }
13079             PDL_COMMENT("THREADLOOPEND")
13080             }
13081             }
13082 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13083 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13084 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13085 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_L: {
13086 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13087 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13088              
13089 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13090 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13091              
13092 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13093 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13094              
13095              
13096             PDL_COMMENT("THREADLOOPBEGIN")
13097 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13098 0           do { register PDL_Indx __tind1=0,__tind2=0;
13099 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13100 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13101 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13102 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13103 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13104 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13105 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13106 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13107 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13108 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13109 0           tree_datap += __offsp[0];
13110 0           nclusters_datap += __offsp[1];
13111 0           clusterids_datap += __offsp[2];
13112 0 0         for( __tind2 = 0 ;
13113             __tind2 < __tdims1 ;
13114 0           __tind2++
13115 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13116 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13117 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13118             )
13119             {
13120 0 0         for( __tind1 = 0 ;
13121             __tind1 < __tdims0 ;
13122 0           __tind1++
13123 0           ,tree_datap += __tinc0_0
13124 0           ,nclusters_datap += __tinc0_1
13125 0           ,clusterids_datap += __tinc0_2
13126             )
13127 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13128 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13129 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13130              
13131              
13132 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13133 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13134 0 0         if (nod) free(nod);
13135              
13136             }
13137             PDL_COMMENT("THREADLOOPEND")
13138             }
13139             }
13140 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13141 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13142 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13143 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_IND: {
13144 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13145 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13146              
13147 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13148 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13149              
13150 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13151 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13152              
13153              
13154             PDL_COMMENT("THREADLOOPBEGIN")
13155 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13156 0           do { register PDL_Indx __tind1=0,__tind2=0;
13157 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13158 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13159 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13160 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13161 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13162 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13163 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13164 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13165 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13166 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13167 0           tree_datap += __offsp[0];
13168 0           nclusters_datap += __offsp[1];
13169 0           clusterids_datap += __offsp[2];
13170 0 0         for( __tind2 = 0 ;
13171             __tind2 < __tdims1 ;
13172 0           __tind2++
13173 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13174 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13175 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13176             )
13177             {
13178 0 0         for( __tind1 = 0 ;
13179             __tind1 < __tdims0 ;
13180 0           __tind1++
13181 0           ,tree_datap += __tinc0_0
13182 0           ,nclusters_datap += __tinc0_1
13183 0           ,clusterids_datap += __tinc0_2
13184             )
13185 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13186 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13187 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13188              
13189              
13190 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13191 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13192 0 0         if (nod) free(nod);
13193              
13194             }
13195             PDL_COMMENT("THREADLOOPEND")
13196             }
13197             }
13198 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13199 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13200 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13201 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_LL: {
13202 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13203 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13204              
13205 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13206 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13207              
13208 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13209 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13210              
13211              
13212             PDL_COMMENT("THREADLOOPBEGIN")
13213 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13214 0           do { register PDL_Indx __tind1=0,__tind2=0;
13215 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13216 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13217 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13218 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13219 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13220 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13221 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13222 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13223 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13224 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13225 0           tree_datap += __offsp[0];
13226 0           nclusters_datap += __offsp[1];
13227 0           clusterids_datap += __offsp[2];
13228 0 0         for( __tind2 = 0 ;
13229             __tind2 < __tdims1 ;
13230 0           __tind2++
13231 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13232 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13233 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13234             )
13235             {
13236 0 0         for( __tind1 = 0 ;
13237             __tind1 < __tdims0 ;
13238 0           __tind1++
13239 0           ,tree_datap += __tinc0_0
13240 0           ,nclusters_datap += __tinc0_1
13241 0           ,clusterids_datap += __tinc0_2
13242             )
13243 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13244 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13245 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13246              
13247              
13248 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13249 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13250 0 0         if (nod) free(nod);
13251              
13252             }
13253             PDL_COMMENT("THREADLOOPEND")
13254             }
13255             }
13256 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13257 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13258 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13259 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_F: {
13260 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13261 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13262              
13263 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13264 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13265              
13266 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13267 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13268              
13269              
13270             PDL_COMMENT("THREADLOOPBEGIN")
13271 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13272 0           do { register PDL_Indx __tind1=0,__tind2=0;
13273 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13274 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13275 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13276 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13277 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13278 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13279 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13280 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13281 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13282 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13283 0           tree_datap += __offsp[0];
13284 0           nclusters_datap += __offsp[1];
13285 0           clusterids_datap += __offsp[2];
13286 0 0         for( __tind2 = 0 ;
13287             __tind2 < __tdims1 ;
13288 0           __tind2++
13289 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13290 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13291 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13292             )
13293             {
13294 0 0         for( __tind1 = 0 ;
13295             __tind1 < __tdims0 ;
13296 0           __tind1++
13297 0           ,tree_datap += __tinc0_0
13298 0           ,nclusters_datap += __tinc0_1
13299 0           ,clusterids_datap += __tinc0_2
13300             )
13301 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13302 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13303 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13304              
13305              
13306 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13307 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13308 0 0         if (nod) free(nod);
13309              
13310             }
13311             PDL_COMMENT("THREADLOOPEND")
13312             }
13313             }
13314 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13315 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13316 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13317 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
13318 0 0         PDL_Long * tree_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13319 0           PDL_Long * tree_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
13320              
13321 0 0         PDL_Long * nclusters_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13322 0           PDL_Long * nclusters_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13323              
13324 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13325 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
13326              
13327              
13328             PDL_COMMENT("THREADLOOPBEGIN")
13329 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
13330 0           do { register PDL_Indx __tind1=0,__tind2=0;
13331 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
13332 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
13333 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
13334 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
13335 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
13336 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
13337 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
13338 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
13339 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
13340 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
13341 0           tree_datap += __offsp[0];
13342 0           nclusters_datap += __offsp[1];
13343 0           clusterids_datap += __offsp[2];
13344 0 0         for( __tind2 = 0 ;
13345             __tind2 < __tdims1 ;
13346 0           __tind2++
13347 0           ,tree_datap += __tinc1_0 - __tinc0_0 * __tdims0
13348 0           ,nclusters_datap += __tinc1_1 - __tinc0_1 * __tdims0
13349 0           ,clusterids_datap += __tinc1_2 - __tinc0_2 * __tdims0
13350             )
13351             {
13352 0 0         for( __tind1 = 0 ;
13353             __tind1 < __tdims0 ;
13354 0           __tind1++
13355 0           ,tree_datap += __tinc0_0
13356 0           ,nclusters_datap += __tinc0_1
13357 0           ,clusterids_datap += __tinc0_2
13358             )
13359 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_tree_2 = __privtrans->__inc_tree_2;
13360 0           register PDL_Indx __inc_tree_n = __privtrans->__inc_tree_n;
13361 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13362              
13363              
13364 0           Node *nod = p2node(__privtrans->__n_size-1,tree_datap,NULL);
13365 0           cuttree(__privtrans->__n_size, nod, (nclusters_datap)[0] PDL_COMMENT("ACCESS()") , clusterids_datap);
13366 0 0         if (nod) free(nod);
13367              
13368             }
13369             PDL_COMMENT("THREADLOOPEND")
13370             }
13371             }
13372 0           tree_datap -= __tinc1_0 * __tdims1 + __offsp[0];
13373 0           nclusters_datap -= __tinc1_1 * __tdims1 + __offsp[1];
13374 0           clusterids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
13375 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
13376 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
13377             }
13378             }
13379             }
13380            
13381              
13382              
13383              
13384 0           void pdl_cuttree_free(pdl_trans *__tr ) {
13385             int __dim;
13386 0           pdl_cuttree_struct *__privtrans = (pdl_cuttree_struct *) __tr;
13387            
13388             {
13389            
13390 0           PDL_TR_CLRMAGIC(__privtrans);
13391            
13392 0 0         if(__privtrans->__ddone) {
13393 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
13394             ;;;;;;
13395             }
13396            
13397             }
13398 0           }
13399            
13400              
13401              
13402              
13403             static char pdl_cuttree_vtable_flags[] =
13404             { 0,PDL_TPDL_VAFFINE_OK,0};
13405             pdl_transvtable pdl_cuttree_vtable = {
13406             0,0, 2, 3, pdl_cuttree_vtable_flags,
13407             pdl_cuttree_redodims, pdl_cuttree_readdata, NULL,
13408             pdl_cuttree_free,NULL,NULL,pdl_cuttree_copy,
13409             sizeof(pdl_cuttree_struct),"pdl_cuttree_vtable"
13410             };
13411              
13412             typedef struct pdl_somcluster_struct {
13413             PDL_TRANS_START(8);
13414             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_clusterids_2;PDL_Indx __inc_clusterids_n;PDL_Indx __n_size;PDL_Indx __2_size;PDL_Indx __d_size;
13415             char *distFlag;
13416             char __ddone; PDL_COMMENT("Dims done")
13417             } pdl_somcluster_struct;
13418              
13419 2           void pdl_somcluster_redodims(pdl_trans *__tr ) {
13420             int __dim;
13421 2           pdl_somcluster_struct *__privtrans = (pdl_somcluster_struct *) __tr;
13422            
13423             {
13424             PDL_Indx __creating[8];
13425 2           __privtrans->__n_size = -1;
13426 2           __privtrans->__2_size = -1;
13427 2           __privtrans->__d_size = -1;
13428 2           __creating[0] = 0;
13429 2           __creating[1] = 0;
13430 2           __creating[2] = 0;
13431 2           __creating[3] = 0;
13432 2           __creating[4] = 0;
13433 2           __creating[5] = 0;
13434 2           __creating[6] = 0;
13435 2 50         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
13436             {
13437             {PDL_COMMENT("Start generic loop")
13438              
13439 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
13440 0           } break; case PDL_B: {
13441 2 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13442 2           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13443              
13444 2 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13445 2           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13446              
13447 2 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13448 2           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13449              
13450 2 50         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13451 2           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13452              
13453 2 50         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13454 2           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13455              
13456 2 50         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13457 2           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13458              
13459 2 50         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13460 2           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13461              
13462 2 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13463 2           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13464              
13465 2           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13466 2           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13467 2           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13468 2           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13469 2           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13470 2           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13471 2           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13472              
13473             PDL_COMMENT("none")
13474 2           } } break; case PDL_S: {
13475 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13476 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13477              
13478 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13479 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13480              
13481 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13482 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13483              
13484 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13485 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13486              
13487 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13488 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13489              
13490 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13491 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13492              
13493 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13494 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13495              
13496 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13497 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13498              
13499 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13500 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13501 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13502 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13503 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13504 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13505 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13506              
13507             PDL_COMMENT("none")
13508 0           } } break; case PDL_US: {
13509 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13510 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13511              
13512 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13513 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13514              
13515 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13516 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13517              
13518 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13519 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13520              
13521 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13522 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13523              
13524 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13525 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13526              
13527 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13528 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13529              
13530 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13531 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13532              
13533 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13534 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13535 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13536 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13537 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13538 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13539 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13540              
13541             PDL_COMMENT("none")
13542 0           } } break; case PDL_L: {
13543 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13544 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13545              
13546 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13547 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13548              
13549 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13550 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13551              
13552 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13553 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13554              
13555 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13556 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13557              
13558 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13559 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13560              
13561 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13562 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13563              
13564 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13565 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13566              
13567 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13568 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13569 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13570 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13571 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13572 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13573 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13574              
13575             PDL_COMMENT("none")
13576 0           } } break; case PDL_IND: {
13577 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13578 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13579              
13580 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13581 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13582              
13583 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13584 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13585              
13586 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13587 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13588              
13589 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13590 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13591              
13592 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13593 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13594              
13595 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13596 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13597              
13598 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13599 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13600              
13601 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13602 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13603 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13604 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13605 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13606 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13607 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13608              
13609             PDL_COMMENT("none")
13610 0           } } break; case PDL_LL: {
13611 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13612 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13613              
13614 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13615 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13616              
13617 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13618 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13619              
13620 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13621 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13622              
13623 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13624 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13625              
13626 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13627 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13628              
13629 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13630 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13631              
13632 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13633 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13634              
13635 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13636 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13637 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13638 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13639 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13640 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13641 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13642              
13643             PDL_COMMENT("none")
13644 0           } } break; case PDL_F: {
13645 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13646 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13647              
13648 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13649 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13650              
13651 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13652 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13653              
13654 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13655 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13656              
13657 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13658 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13659              
13660 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13661 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13662              
13663 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13664 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13665              
13666 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13667 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13668              
13669 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13670 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13671 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13672 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13673 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13674 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13675 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13676              
13677             PDL_COMMENT("none")
13678 0           } } break; case PDL_D: {
13679 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13680 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13681              
13682 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13683 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13684              
13685 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13686 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13687              
13688 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13689 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13690              
13691 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13692 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13693              
13694 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13695 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13696              
13697 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13698 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13699              
13700 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13701 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13702              
13703 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13704 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13705 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13706 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13707 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13708 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13709 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13710              
13711             PDL_COMMENT("none")
13712 0           } break;}
13713 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
13714             }
13715             }
13716             {
13717             static char *__parnames[] = {"data","mask","weight","nxnodes","nynodes","inittau","niter","clusterids"};
13718             static PDL_Indx __realdims[] = {2,2,1,0,0,0,0,2};
13719             static char __funcname[] = "PDL::Cluster::somcluster";
13720             static pdl_errorinfo __einfo = {
13721             __funcname, __parnames, 8
13722             };
13723            
13724 2           PDL->initthreadstruct(2,__privtrans->pdls,
13725             __realdims,__creating,8,
13726             &__einfo,&(__privtrans->__pdlthread),
13727 2           __privtrans->vtable->per_pdl_flags,
13728             0 );
13729             }
13730 2 50         if(((__privtrans->pdls[0]))->ndims < 2) {
13731 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
13732 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
13733             }
13734 2 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
13735 2           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
13736 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
13737 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
13738 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13739             }
13740             }
13741 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
13742 2           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
13743 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
13744 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
13745 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13746             }
13747             }
13748 2           PDL->make_physical(((__privtrans->pdls[0])));
13749 2 50         if(((__privtrans->pdls[1]))->ndims < 2) {
13750 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
13751 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
13752             }
13753 2 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
13754 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
13755 2 50         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    50          
13756 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
13757 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13758             }
13759             }
13760 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
13761 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
13762 2 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
13763 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
13764 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13765             }
13766             }
13767 2           PDL->make_physical(((__privtrans->pdls[1])));
13768 2 50         if(((__privtrans->pdls[2]))->ndims < 1) {
13769 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
13770             }
13771 2 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
13772 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
13773 2 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
13774 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
13775 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13776             }
13777             }
13778 2           PDL->make_physical(((__privtrans->pdls[2])));
13779 2 50         if(!__creating[7]) {
13780 2 50         if(((__privtrans->pdls[7]))->ndims < 2) {
13781 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__2_size <= 1) __privtrans->__2_size = 1;
    0          
13782 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
13783             }
13784 2 50         if(__privtrans->__2_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__2_size == 1)) {
    0          
    0          
13785 2           __privtrans->__2_size = ((__privtrans->pdls[7]))->dims[0];
13786 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__2_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
13787 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
13788 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13789             }
13790             }
13791 2 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
13792 0           __privtrans->__n_size = ((__privtrans->pdls[7]))->dims[1];
13793 2 50         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[7]))->dims[1]) {
    50          
13794 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
13795 0           PDL->pdl_barf("Error in somcluster:" "Wrong dims\n");
13796             }
13797             }
13798 2           PDL->make_physical(((__privtrans->pdls[7])));
13799             } else {
13800 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__2_size;dims[1] = __privtrans->__n_size;
13801 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
13802             }
13803             { PDL_COMMENT("convenience block")
13804 2           void *hdrp = NULL;
13805 2           char propagate_hdrcpy = 0;
13806 2           SV *hdr_copy = NULL;
13807 2 50         if(!hdrp &&
    50          
13808 0 0         __privtrans->pdls[0]->hdrsv &&
13809 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
13810             ) {
13811 0           hdrp = __privtrans->pdls[0]->hdrsv;
13812 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
13813             }
13814 2 50         if(!hdrp &&
    50          
13815 0 0         __privtrans->pdls[1]->hdrsv &&
13816 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
13817             ) {
13818 0           hdrp = __privtrans->pdls[1]->hdrsv;
13819 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
13820             }
13821 2 50         if(!hdrp &&
    50          
13822 0 0         __privtrans->pdls[2]->hdrsv &&
13823 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
13824             ) {
13825 0           hdrp = __privtrans->pdls[2]->hdrsv;
13826 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
13827             }
13828 2 50         if(!hdrp &&
    50          
13829 0 0         __privtrans->pdls[3]->hdrsv &&
13830 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
13831             ) {
13832 0           hdrp = __privtrans->pdls[3]->hdrsv;
13833 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
13834             }
13835 2 50         if(!hdrp &&
    50          
13836 0 0         __privtrans->pdls[4]->hdrsv &&
13837 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
13838             ) {
13839 0           hdrp = __privtrans->pdls[4]->hdrsv;
13840 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
13841             }
13842 2 50         if(!hdrp &&
    50          
13843 0 0         __privtrans->pdls[5]->hdrsv &&
13844 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
13845             ) {
13846 0           hdrp = __privtrans->pdls[5]->hdrsv;
13847 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
13848             }
13849 2 50         if(!hdrp &&
    50          
13850 0 0         __privtrans->pdls[6]->hdrsv &&
13851 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
13852             ) {
13853 0           hdrp = __privtrans->pdls[6]->hdrsv;
13854 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
13855             }
13856 2 50         if(!hdrp &&
    50          
13857 2 50         !__creating[7] &&
13858 0 0         __privtrans->pdls[7]->hdrsv &&
13859 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
13860             ) {
13861 0           hdrp = __privtrans->pdls[7]->hdrsv;
13862 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
13863             }
13864 2 50         if (hdrp) {
13865 0 0         if(hdrp == &PL_sv_undef)
13866 0           hdr_copy = &PL_sv_undef;
13867             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
13868             int count;
13869             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
13870 0           dSP;
13871 0           ENTER ;
13872 0           SAVETMPS ;
13873 0 0         PUSHMARK(SP) ;
13874 0 0         XPUSHs( hdrp );
13875 0           PUTBACK ;
13876 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
13877 0           SPAGAIN ;
13878 0 0         if(count != 1)
13879 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
13880              
13881 0           hdr_copy = (SV *)POPs;
13882              
13883 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
13884 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
13885             }
13886              
13887 0 0         FREETMPS ;
13888 0           LEAVE ;
13889              
13890              
13891             } PDL_COMMENT("end of callback block")
13892              
13893 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
13894 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
13895 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
13896 0 0         if( hdr_copy != &PL_sv_undef )
13897 0           (void)SvREFCNT_inc(hdr_copy);
13898 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
13899             }
13900 0 0         if(propagate_hdrcpy)
13901 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
13902              
13903 0 0         if(hdr_copy != &PL_sv_undef)
13904 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
13905             } PDL_COMMENT("end of if(hdrp) block")
13906             } PDL_COMMENT("end of conv. block")
13907 2 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
13908 0           __privtrans->__inc_data_d = 0; else
13909 2 50         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    50          
13910 0           __privtrans->__inc_data_n = 0; else
13911 2 50         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
13912 0           __privtrans->__inc_mask_d = 0; else
13913 2 50         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
13914 0           __privtrans->__inc_mask_n = 0; else
13915 2 50         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
13916 0           __privtrans->__inc_weight_d = 0; else
13917 2 50         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    50          
13918 0           __privtrans->__inc_clusterids_2 = 0; else
13919 2 50         __privtrans->__inc_clusterids_2 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    50          
13920 0           __privtrans->__inc_clusterids_n = 0; else
13921 2           __privtrans->__inc_clusterids_n = __privtrans->pdls[7]->dimincs[1]; __privtrans->__ddone = 1;
13922             }
13923 2           }
13924            
13925              
13926 0           pdl_trans * pdl_somcluster_copy(pdl_trans *__tr ) {
13927             int __dim;
13928 0           pdl_somcluster_struct *__privtrans = (pdl_somcluster_struct *) __tr;
13929            
13930             {
13931 0           pdl_somcluster_struct *__copy = malloc(sizeof(pdl_somcluster_struct));
13932 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
13933 0           __copy->has_badvalue = __privtrans->has_badvalue;
13934 0           __copy->badvalue = __privtrans->badvalue;
13935 0           __copy->flags = __privtrans->flags;
13936 0           __copy->vtable = __privtrans->vtable;
13937 0           __copy->__datatype = __privtrans->__datatype;
13938 0           __copy->freeproc = NULL;
13939 0           __copy->__ddone = __privtrans->__ddone;
13940             {int i;
13941 0 0         for(i=0; i<__copy->vtable->npdls; i++)
13942 0           __copy->pdls[i] = __privtrans->pdls[i];
13943             }
13944 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;
13945 0 0         if(__copy->__ddone) {
13946 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_clusterids_2=__copy->__inc_clusterids_2;__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__copy->__n_size=__privtrans->__n_size;__copy->__2_size=__privtrans->__2_size;__copy->__d_size=__privtrans->__d_size;
13947             }
13948 0           return (pdl_trans*)__copy;
13949             }
13950             }
13951            
13952              
13953 2           void pdl_somcluster_readdata(pdl_trans *__tr ) {
13954             int __dim;
13955 2           pdl_somcluster_struct *__privtrans = (pdl_somcluster_struct *) __tr;
13956            
13957             {
13958             {PDL_COMMENT("Start generic loop")
13959              
13960 2           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
13961 0           } break; case PDL_B: {
13962 2 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
13963 2           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
13964              
13965 2 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
13966 2           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
13967              
13968 2 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
13969 2           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
13970              
13971 2 50         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
13972 2           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
13973              
13974 2 50         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
13975 2           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
13976              
13977 2 50         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
13978 2           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
13979              
13980 2 50         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
13981 2           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
13982              
13983 2 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
13984 2           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
13985              
13986 2           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
13987 2           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
13988 2           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
13989 2           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
13990 2           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
13991 2           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
13992 2           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
13993              
13994              
13995 2           int transpose = 0;
13996 2           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
13997 2           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
13998            
13999             PDL_COMMENT("THREADLOOPBEGIN")
14000 2 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14001 2           do { register PDL_Indx __tind1=0,__tind2=0;
14002 2           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14003 2           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14004 2           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14005 2           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14006 2           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14007 2           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14008 2           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14009 2           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14010 2           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14011 2           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14012 2           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14013 2           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14014 2           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14015 2           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14016 2           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14017 2           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14018 2           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14019 2           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14020 2           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14021 2           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14022 2           data_datap += __offsp[0];
14023 2           mask_datap += __offsp[1];
14024 2           weight_datap += __offsp[2];
14025 2           nxnodes_datap += __offsp[3];
14026 2           nynodes_datap += __offsp[4];
14027 2           inittau_datap += __offsp[5];
14028 2           niter_datap += __offsp[6];
14029 2           clusterids_datap += __offsp[7];
14030 4 100         for( __tind2 = 0 ;
14031             __tind2 < __tdims1 ;
14032 2           __tind2++
14033 2           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14034 2           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14035 2           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14036 2           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14037 2           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14038 2           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14039 2           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14040 2           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14041             )
14042             {
14043 4 100         for( __tind1 = 0 ;
14044             __tind1 < __tdims0 ;
14045 2           __tind1++
14046 2           ,data_datap += __tinc0_0
14047 2           ,mask_datap += __tinc0_1
14048 2           ,weight_datap += __tinc0_2
14049 2           ,nxnodes_datap += __tinc0_3
14050 2           ,nynodes_datap += __tinc0_4
14051 2           ,inittau_datap += __tinc0_5
14052 2           ,niter_datap += __tinc0_6
14053 2           ,clusterids_datap += __tinc0_7
14054             )
14055             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14056 2           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14057 2           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14058 2           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14059             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14060 2           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14061             (int (*)[2])(clusterids_datap));
14062            
14063             PDL_COMMENT("THREADLOOPEND")
14064             }
14065             }
14066 2           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14067 2           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14068 2           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14069 2           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14070 2           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14071 2           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14072 2           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14073 2           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14074 2 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14075             /*-- cleanup --*/
14076 2 50         if (datapp) free(datapp);
14077 2 50         if (maskpp) free(maskpp);
14078              
14079 2           } } break; case PDL_S: {
14080 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14081 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14082              
14083 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14084 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14085              
14086 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14087 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14088              
14089 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14090 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14091              
14092 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14093 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14094              
14095 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14096 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14097              
14098 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14099 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14100              
14101 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14102 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14103              
14104 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14105 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14106 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14107 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14108 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14109 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14110 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14111              
14112              
14113 0           int transpose = 0;
14114 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14115 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14116            
14117             PDL_COMMENT("THREADLOOPBEGIN")
14118 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14119 0           do { register PDL_Indx __tind1=0,__tind2=0;
14120 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14121 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14122 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14123 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14124 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14125 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14126 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14127 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14128 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14129 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14130 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14131 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14132 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14133 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14134 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14135 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14136 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14137 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14138 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14139 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14140 0           data_datap += __offsp[0];
14141 0           mask_datap += __offsp[1];
14142 0           weight_datap += __offsp[2];
14143 0           nxnodes_datap += __offsp[3];
14144 0           nynodes_datap += __offsp[4];
14145 0           inittau_datap += __offsp[5];
14146 0           niter_datap += __offsp[6];
14147 0           clusterids_datap += __offsp[7];
14148 0 0         for( __tind2 = 0 ;
14149             __tind2 < __tdims1 ;
14150 0           __tind2++
14151 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14152 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14153 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14154 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14155 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14156 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14157 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14158 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14159             )
14160             {
14161 0 0         for( __tind1 = 0 ;
14162             __tind1 < __tdims0 ;
14163 0           __tind1++
14164 0           ,data_datap += __tinc0_0
14165 0           ,mask_datap += __tinc0_1
14166 0           ,weight_datap += __tinc0_2
14167 0           ,nxnodes_datap += __tinc0_3
14168 0           ,nynodes_datap += __tinc0_4
14169 0           ,inittau_datap += __tinc0_5
14170 0           ,niter_datap += __tinc0_6
14171 0           ,clusterids_datap += __tinc0_7
14172             )
14173             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14174 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14175 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14176 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14177             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14178 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14179             (int (*)[2])(clusterids_datap));
14180            
14181             PDL_COMMENT("THREADLOOPEND")
14182             }
14183             }
14184 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14185 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14186 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14187 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14188 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14189 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14190 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14191 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14192 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14193             /*-- cleanup --*/
14194 0 0         if (datapp) free(datapp);
14195 0 0         if (maskpp) free(maskpp);
14196              
14197 0           } } break; case PDL_US: {
14198 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14199 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14200              
14201 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14202 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14203              
14204 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14205 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14206              
14207 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14208 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14209              
14210 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14211 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14212              
14213 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14214 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14215              
14216 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14217 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14218              
14219 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14220 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14221              
14222 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14223 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14224 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14225 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14226 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14227 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14228 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14229              
14230              
14231 0           int transpose = 0;
14232 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14233 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14234            
14235             PDL_COMMENT("THREADLOOPBEGIN")
14236 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14237 0           do { register PDL_Indx __tind1=0,__tind2=0;
14238 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14239 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14240 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14241 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14242 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14243 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14244 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14245 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14246 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14247 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14248 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14249 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14250 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14251 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14252 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14253 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14254 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14255 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14256 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14257 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14258 0           data_datap += __offsp[0];
14259 0           mask_datap += __offsp[1];
14260 0           weight_datap += __offsp[2];
14261 0           nxnodes_datap += __offsp[3];
14262 0           nynodes_datap += __offsp[4];
14263 0           inittau_datap += __offsp[5];
14264 0           niter_datap += __offsp[6];
14265 0           clusterids_datap += __offsp[7];
14266 0 0         for( __tind2 = 0 ;
14267             __tind2 < __tdims1 ;
14268 0           __tind2++
14269 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14270 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14271 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14272 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14273 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14274 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14275 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14276 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14277             )
14278             {
14279 0 0         for( __tind1 = 0 ;
14280             __tind1 < __tdims0 ;
14281 0           __tind1++
14282 0           ,data_datap += __tinc0_0
14283 0           ,mask_datap += __tinc0_1
14284 0           ,weight_datap += __tinc0_2
14285 0           ,nxnodes_datap += __tinc0_3
14286 0           ,nynodes_datap += __tinc0_4
14287 0           ,inittau_datap += __tinc0_5
14288 0           ,niter_datap += __tinc0_6
14289 0           ,clusterids_datap += __tinc0_7
14290             )
14291             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14292 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14293 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14294 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14295             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14296 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14297             (int (*)[2])(clusterids_datap));
14298            
14299             PDL_COMMENT("THREADLOOPEND")
14300             }
14301             }
14302 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14303 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14304 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14305 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14306 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14307 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14308 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14309 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14310 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14311             /*-- cleanup --*/
14312 0 0         if (datapp) free(datapp);
14313 0 0         if (maskpp) free(maskpp);
14314              
14315 0           } } break; case PDL_L: {
14316 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14317 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14318              
14319 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14320 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14321              
14322 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14323 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14324              
14325 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14326 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14327              
14328 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14329 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14330              
14331 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14332 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14333              
14334 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14335 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14336              
14337 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14338 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14339              
14340 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14341 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14342 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14343 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14344 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14345 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14346 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14347              
14348              
14349 0           int transpose = 0;
14350 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14351 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14352            
14353             PDL_COMMENT("THREADLOOPBEGIN")
14354 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14355 0           do { register PDL_Indx __tind1=0,__tind2=0;
14356 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14357 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14358 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14359 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14360 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14361 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14362 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14363 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14364 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14365 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14366 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14367 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14368 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14369 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14370 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14371 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14372 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14373 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14374 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14375 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14376 0           data_datap += __offsp[0];
14377 0           mask_datap += __offsp[1];
14378 0           weight_datap += __offsp[2];
14379 0           nxnodes_datap += __offsp[3];
14380 0           nynodes_datap += __offsp[4];
14381 0           inittau_datap += __offsp[5];
14382 0           niter_datap += __offsp[6];
14383 0           clusterids_datap += __offsp[7];
14384 0 0         for( __tind2 = 0 ;
14385             __tind2 < __tdims1 ;
14386 0           __tind2++
14387 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14388 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14389 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14390 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14391 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14392 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14393 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14394 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14395             )
14396             {
14397 0 0         for( __tind1 = 0 ;
14398             __tind1 < __tdims0 ;
14399 0           __tind1++
14400 0           ,data_datap += __tinc0_0
14401 0           ,mask_datap += __tinc0_1
14402 0           ,weight_datap += __tinc0_2
14403 0           ,nxnodes_datap += __tinc0_3
14404 0           ,nynodes_datap += __tinc0_4
14405 0           ,inittau_datap += __tinc0_5
14406 0           ,niter_datap += __tinc0_6
14407 0           ,clusterids_datap += __tinc0_7
14408             )
14409             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14410 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14411 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14412 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14413             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14414 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14415             (int (*)[2])(clusterids_datap));
14416            
14417             PDL_COMMENT("THREADLOOPEND")
14418             }
14419             }
14420 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14421 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14422 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14423 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14424 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14425 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14426 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14427 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14428 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14429             /*-- cleanup --*/
14430 0 0         if (datapp) free(datapp);
14431 0 0         if (maskpp) free(maskpp);
14432              
14433 0           } } break; case PDL_IND: {
14434 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14435 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14436              
14437 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14438 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14439              
14440 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14441 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14442              
14443 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14444 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14445              
14446 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14447 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14448              
14449 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14450 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14451              
14452 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14453 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14454              
14455 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14456 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14457              
14458 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14459 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14460 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14461 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14462 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14463 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14464 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14465              
14466              
14467 0           int transpose = 0;
14468 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14469 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14470            
14471             PDL_COMMENT("THREADLOOPBEGIN")
14472 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14473 0           do { register PDL_Indx __tind1=0,__tind2=0;
14474 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14475 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14476 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14477 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14478 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14479 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14480 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14481 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14482 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14483 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14484 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14485 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14486 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14487 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14488 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14489 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14490 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14491 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14492 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14493 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14494 0           data_datap += __offsp[0];
14495 0           mask_datap += __offsp[1];
14496 0           weight_datap += __offsp[2];
14497 0           nxnodes_datap += __offsp[3];
14498 0           nynodes_datap += __offsp[4];
14499 0           inittau_datap += __offsp[5];
14500 0           niter_datap += __offsp[6];
14501 0           clusterids_datap += __offsp[7];
14502 0 0         for( __tind2 = 0 ;
14503             __tind2 < __tdims1 ;
14504 0           __tind2++
14505 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14506 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14507 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14508 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14509 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14510 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14511 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14512 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14513             )
14514             {
14515 0 0         for( __tind1 = 0 ;
14516             __tind1 < __tdims0 ;
14517 0           __tind1++
14518 0           ,data_datap += __tinc0_0
14519 0           ,mask_datap += __tinc0_1
14520 0           ,weight_datap += __tinc0_2
14521 0           ,nxnodes_datap += __tinc0_3
14522 0           ,nynodes_datap += __tinc0_4
14523 0           ,inittau_datap += __tinc0_5
14524 0           ,niter_datap += __tinc0_6
14525 0           ,clusterids_datap += __tinc0_7
14526             )
14527             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14528 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14529 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14530 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14531             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14532 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14533             (int (*)[2])(clusterids_datap));
14534            
14535             PDL_COMMENT("THREADLOOPEND")
14536             }
14537             }
14538 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14539 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14540 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14541 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14542 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14543 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14544 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14545 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14546 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14547             /*-- cleanup --*/
14548 0 0         if (datapp) free(datapp);
14549 0 0         if (maskpp) free(maskpp);
14550              
14551 0           } } break; case PDL_LL: {
14552 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14553 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14554              
14555 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14556 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14557              
14558 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14559 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14560              
14561 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14562 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14563              
14564 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14565 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14566              
14567 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14568 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14569              
14570 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14571 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14572              
14573 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14574 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14575              
14576 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14577 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14578 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14579 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14580 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14581 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14582 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14583              
14584              
14585 0           int transpose = 0;
14586 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14587 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14588            
14589             PDL_COMMENT("THREADLOOPBEGIN")
14590 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14591 0           do { register PDL_Indx __tind1=0,__tind2=0;
14592 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14593 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14594 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14595 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14596 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14597 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14598 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14599 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14600 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14601 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14602 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14603 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14604 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14605 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14606 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14607 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14608 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14609 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14610 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14611 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14612 0           data_datap += __offsp[0];
14613 0           mask_datap += __offsp[1];
14614 0           weight_datap += __offsp[2];
14615 0           nxnodes_datap += __offsp[3];
14616 0           nynodes_datap += __offsp[4];
14617 0           inittau_datap += __offsp[5];
14618 0           niter_datap += __offsp[6];
14619 0           clusterids_datap += __offsp[7];
14620 0 0         for( __tind2 = 0 ;
14621             __tind2 < __tdims1 ;
14622 0           __tind2++
14623 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14624 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14625 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14626 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14627 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14628 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14629 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14630 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14631             )
14632             {
14633 0 0         for( __tind1 = 0 ;
14634             __tind1 < __tdims0 ;
14635 0           __tind1++
14636 0           ,data_datap += __tinc0_0
14637 0           ,mask_datap += __tinc0_1
14638 0           ,weight_datap += __tinc0_2
14639 0           ,nxnodes_datap += __tinc0_3
14640 0           ,nynodes_datap += __tinc0_4
14641 0           ,inittau_datap += __tinc0_5
14642 0           ,niter_datap += __tinc0_6
14643 0           ,clusterids_datap += __tinc0_7
14644             )
14645             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14646 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14647 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14648 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14649             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14650 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14651             (int (*)[2])(clusterids_datap));
14652            
14653             PDL_COMMENT("THREADLOOPEND")
14654             }
14655             }
14656 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14657 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14658 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14659 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14660 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14661 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14662 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14663 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14664 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14665             /*-- cleanup --*/
14666 0 0         if (datapp) free(datapp);
14667 0 0         if (maskpp) free(maskpp);
14668              
14669 0           } } break; case PDL_F: {
14670 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14671 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14672              
14673 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14674 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14675              
14676 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14677 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14678              
14679 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14680 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14681              
14682 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14683 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14684              
14685 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14686 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14687              
14688 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14689 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14690              
14691 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14692 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14693              
14694 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14695 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14696 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14697 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14698 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14699 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14700 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14701              
14702              
14703 0           int transpose = 0;
14704 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14705 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14706            
14707             PDL_COMMENT("THREADLOOPBEGIN")
14708 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14709 0           do { register PDL_Indx __tind1=0,__tind2=0;
14710 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14711 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14712 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14713 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14714 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14715 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14716 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14717 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14718 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14719 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14720 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14721 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14722 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14723 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14724 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14725 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14726 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14727 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14728 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14729 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14730 0           data_datap += __offsp[0];
14731 0           mask_datap += __offsp[1];
14732 0           weight_datap += __offsp[2];
14733 0           nxnodes_datap += __offsp[3];
14734 0           nynodes_datap += __offsp[4];
14735 0           inittau_datap += __offsp[5];
14736 0           niter_datap += __offsp[6];
14737 0           clusterids_datap += __offsp[7];
14738 0 0         for( __tind2 = 0 ;
14739             __tind2 < __tdims1 ;
14740 0           __tind2++
14741 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14742 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14743 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14744 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14745 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14746 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14747 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14748 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14749             )
14750             {
14751 0 0         for( __tind1 = 0 ;
14752             __tind1 < __tdims0 ;
14753 0           __tind1++
14754 0           ,data_datap += __tinc0_0
14755 0           ,mask_datap += __tinc0_1
14756 0           ,weight_datap += __tinc0_2
14757 0           ,nxnodes_datap += __tinc0_3
14758 0           ,nynodes_datap += __tinc0_4
14759 0           ,inittau_datap += __tinc0_5
14760 0           ,niter_datap += __tinc0_6
14761 0           ,clusterids_datap += __tinc0_7
14762             )
14763             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14764 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14765 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14766 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14767             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14768 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14769             (int (*)[2])(clusterids_datap));
14770            
14771             PDL_COMMENT("THREADLOOPEND")
14772             }
14773             }
14774 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14775 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14776 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14777 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14778 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14779 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14780 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14781 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14782 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14783             /*-- cleanup --*/
14784 0 0         if (datapp) free(datapp);
14785 0 0         if (maskpp) free(maskpp);
14786              
14787 0           } } break; case PDL_D: {
14788 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14789 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14790              
14791 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14792 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
14793              
14794 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14795 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14796              
14797 0 0         PDL_Long * nxnodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
14798 0           PDL_Long * nxnodes_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
14799              
14800 0 0         PDL_Long * nynodes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
14801 0           PDL_Long * nynodes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
14802              
14803 0 0         PDL_Double * inittau_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
14804 0           PDL_Double * inittau_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
14805              
14806 0 0         PDL_Long * niter_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
14807 0           PDL_Long * niter_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
14808              
14809 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
14810 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
14811              
14812 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
14813 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
14814 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
14815 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
14816 0           register PDL_Indx __inc_clusterids_2 = __privtrans->__inc_clusterids_2;
14817 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
14818 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
14819              
14820              
14821 0           int transpose = 0;
14822 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
14823 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
14824            
14825             PDL_COMMENT("THREADLOOPBEGIN")
14826 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
14827 0           do { register PDL_Indx __tind1=0,__tind2=0;
14828 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
14829 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
14830 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
14831 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
14832 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
14833 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
14834 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
14835 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
14836 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
14837 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
14838 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
14839 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
14840 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
14841 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
14842 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
14843 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
14844 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
14845 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
14846 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
14847 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
14848 0           data_datap += __offsp[0];
14849 0           mask_datap += __offsp[1];
14850 0           weight_datap += __offsp[2];
14851 0           nxnodes_datap += __offsp[3];
14852 0           nynodes_datap += __offsp[4];
14853 0           inittau_datap += __offsp[5];
14854 0           niter_datap += __offsp[6];
14855 0           clusterids_datap += __offsp[7];
14856 0 0         for( __tind2 = 0 ;
14857             __tind2 < __tdims1 ;
14858 0           __tind2++
14859 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
14860 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
14861 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
14862 0           ,nxnodes_datap += __tinc1_3 - __tinc0_3 * __tdims0
14863 0           ,nynodes_datap += __tinc1_4 - __tinc0_4 * __tdims0
14864 0           ,inittau_datap += __tinc1_5 - __tinc0_5 * __tdims0
14865 0           ,niter_datap += __tinc1_6 - __tinc0_6 * __tdims0
14866 0           ,clusterids_datap += __tinc1_7 - __tinc0_7 * __tdims0
14867             )
14868             {
14869 0 0         for( __tind1 = 0 ;
14870             __tind1 < __tdims0 ;
14871 0           __tind1++
14872 0           ,data_datap += __tinc0_0
14873 0           ,mask_datap += __tinc0_1
14874 0           ,weight_datap += __tinc0_2
14875 0           ,nxnodes_datap += __tinc0_3
14876 0           ,nynodes_datap += __tinc0_4
14877 0           ,inittau_datap += __tinc0_5
14878 0           ,niter_datap += __tinc0_6
14879 0           ,clusterids_datap += __tinc0_7
14880             )
14881             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
14882 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
14883 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
14884 0           somcluster(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp,
14885             weight_datap, transpose, (nxnodes_datap)[0] PDL_COMMENT("ACCESS()") , (nynodes_datap)[0] PDL_COMMENT("ACCESS()") ,
14886 0           (inittau_datap)[0] PDL_COMMENT("ACCESS()") , (niter_datap)[0] PDL_COMMENT("ACCESS()") , *__privtrans->distFlag, NULL,
14887             (int (*)[2])(clusterids_datap));
14888            
14889             PDL_COMMENT("THREADLOOPEND")
14890             }
14891             }
14892 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
14893 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
14894 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
14895 0           nxnodes_datap -= __tinc1_3 * __tdims1 + __offsp[3];
14896 0           nynodes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
14897 0           inittau_datap -= __tinc1_5 * __tdims1 + __offsp[5];
14898 0           niter_datap -= __tinc1_6 * __tdims1 + __offsp[6];
14899 0           clusterids_datap -= __tinc1_7 * __tdims1 + __offsp[7];
14900 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
14901             /*-- cleanup --*/
14902 0 0         if (datapp) free(datapp);
14903 0 0         if (maskpp) free(maskpp);
14904              
14905 0           } break;}
14906 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
14907             }
14908             }
14909             }
14910            
14911              
14912              
14913              
14914 2           void pdl_somcluster_free(pdl_trans *__tr ) {
14915             int __dim;
14916 2           pdl_somcluster_struct *__privtrans = (pdl_somcluster_struct *) __tr;
14917            
14918             {
14919            
14920 2           PDL_TR_CLRMAGIC(__privtrans);
14921 2           free(__privtrans->distFlag);;
14922 2 50         if(__privtrans->__ddone) {
14923 2           PDL->freethreadloop(&(__privtrans->__pdlthread));
14924             ;;;;;;;;;;;
14925             }
14926            
14927             }
14928 2           }
14929            
14930              
14931              
14932              
14933             static char pdl_somcluster_vtable_flags[] =
14934             { 0,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,0};
14935             pdl_transvtable pdl_somcluster_vtable = {
14936             0,0, 7, 8, pdl_somcluster_vtable_flags,
14937             pdl_somcluster_redodims, pdl_somcluster_readdata, NULL,
14938             pdl_somcluster_free,NULL,NULL,pdl_somcluster_copy,
14939             sizeof(pdl_somcluster_struct),"pdl_somcluster_vtable"
14940             };
14941              
14942             typedef struct pdl_pca_struct {
14943             PDL_TRANS_START(3);
14944             pdl_thread __pdlthread;PDL_Indx __inc_U_d;PDL_Indx __inc_U_n;PDL_Indx __inc_S_d;PDL_Indx __inc_V_d0;PDL_Indx __inc_V_d1;PDL_Indx __n_size;PDL_Indx __d_size;
14945            
14946             char __ddone; PDL_COMMENT("Dims done")
14947             } pdl_pca_struct;
14948              
14949 0           void pdl_pca_redodims(pdl_trans *__tr ) {
14950             int __dim;
14951 0           pdl_pca_struct *__privtrans = (pdl_pca_struct *) __tr;
14952            
14953             {
14954             PDL_Indx __creating[3];
14955 0           __privtrans->__n_size = -1;
14956 0           __privtrans->__d_size = -1;
14957 0 0         __creating[0] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[0]);
    0          
14958 0 0         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
14959 0 0         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    0          
14960             {
14961             {PDL_COMMENT("Start generic loop")
14962              
14963 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
14964 0           } break; case PDL_B: {
14965 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14966 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14967              
14968 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14969 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
14970              
14971 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14972 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14973              
14974 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
14975 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
14976 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
14977 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
14978 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
14979              
14980             PDL_COMMENT("none")
14981 0           } } break; case PDL_S: {
14982 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
14983 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
14984              
14985 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
14986 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
14987              
14988 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
14989 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
14990              
14991 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
14992 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
14993 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
14994 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
14995 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
14996              
14997             PDL_COMMENT("none")
14998 0           } } break; case PDL_US: {
14999 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15000 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15001              
15002 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15003 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15004              
15005 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15006 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15007              
15008 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15009 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15010 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15011 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15012 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15013              
15014             PDL_COMMENT("none")
15015 0           } } break; case PDL_L: {
15016 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15017 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15018              
15019 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15020 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15021              
15022 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15023 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15024              
15025 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15026 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15027 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15028 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15029 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15030              
15031             PDL_COMMENT("none")
15032 0           } } break; case PDL_IND: {
15033 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15034 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15035              
15036 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15037 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15038              
15039 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15040 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15041              
15042 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15043 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15044 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15045 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15046 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15047              
15048             PDL_COMMENT("none")
15049 0           } } break; case PDL_LL: {
15050 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15051 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15052              
15053 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15054 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15055              
15056 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15057 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15058              
15059 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15060 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15061 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15062 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15063 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15064              
15065             PDL_COMMENT("none")
15066 0           } } break; case PDL_F: {
15067 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15068 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15069              
15070 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15071 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15072              
15073 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15074 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15075              
15076 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15077 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15078 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15079 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15080 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15081              
15082             PDL_COMMENT("none")
15083 0           } } break; case PDL_D: {
15084 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15085 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15086              
15087 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15088 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15089              
15090 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15091 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15092              
15093 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15094 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15095 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15096 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15097 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15098              
15099             PDL_COMMENT("none")
15100 0           } break;}
15101 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
15102             }
15103             }
15104             {
15105             static char *__parnames[] = {"U","S","V"};
15106             static PDL_Indx __realdims[] = {2,1,2};
15107             static char __funcname[] = "PDL::Cluster::pca";
15108             static pdl_errorinfo __einfo = {
15109             __funcname, __parnames, 3
15110             };
15111            
15112 0           PDL->initthreadstruct(2,__privtrans->pdls,
15113             __realdims,__creating,3,
15114             &__einfo,&(__privtrans->__pdlthread),
15115 0           __privtrans->vtable->per_pdl_flags,
15116             0 );
15117             }
15118 0 0         if(!__creating[0]) {
15119 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
15120 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
15121 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
15122             }
15123 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
15124 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
15125 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
15126 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
15127 0           PDL->pdl_barf("Error in pca:" "Wrong dims\n");
15128             }
15129             }
15130 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
15131 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
15132 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
15133 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
15134 0           PDL->pdl_barf("Error in pca:" "Wrong dims\n");
15135             }
15136             }
15137 0           PDL->make_physical(((__privtrans->pdls[0])));
15138             } else {
15139 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__n_size;
15140 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,0,dims,0);
15141 0 0         }if(!__creating[1]) {
15142 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
15143 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
15144             }
15145 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
15146 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
15147 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
15148 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
15149 0           PDL->pdl_barf("Error in pca:" "Wrong dims\n");
15150             }
15151             }
15152 0           PDL->make_physical(((__privtrans->pdls[1])));
15153             } else {
15154 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;
15155 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
15156 0 0         }if(!__creating[2]) {
15157 0 0         if(((__privtrans->pdls[2]))->ndims < 2) {
15158 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
15159 0 0         if (((__privtrans->pdls[2]))->ndims < 2 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
15160             }
15161 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
15162 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
15163 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
15164 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
15165 0           PDL->pdl_barf("Error in pca:" "Wrong dims\n");
15166             }
15167             }
15168 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__d_size == 1)) {
    0          
    0          
15169 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[1];
15170 0 0         } else if(((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[1]) {
    0          
15171 0 0         if(((__privtrans->pdls[2]))->dims[1] != 1) {
15172 0           PDL->pdl_barf("Error in pca:" "Wrong dims\n");
15173             }
15174             }
15175 0           PDL->make_physical(((__privtrans->pdls[2])));
15176             } else {
15177 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__d_size;
15178 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,0);
15179             }
15180             { PDL_COMMENT("convenience block")
15181 0           void *hdrp = NULL;
15182 0           char propagate_hdrcpy = 0;
15183 0           SV *hdr_copy = NULL;
15184 0 0         if(!hdrp &&
    0          
15185 0 0         !__creating[0] &&
15186 0 0         __privtrans->pdls[0]->hdrsv &&
15187 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
15188             ) {
15189 0           hdrp = __privtrans->pdls[0]->hdrsv;
15190 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
15191             }
15192 0 0         if(!hdrp &&
    0          
15193 0 0         !__creating[1] &&
15194 0 0         __privtrans->pdls[1]->hdrsv &&
15195 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
15196             ) {
15197 0           hdrp = __privtrans->pdls[1]->hdrsv;
15198 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
15199             }
15200 0 0         if(!hdrp &&
    0          
15201 0 0         !__creating[2] &&
15202 0 0         __privtrans->pdls[2]->hdrsv &&
15203 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
15204             ) {
15205 0           hdrp = __privtrans->pdls[2]->hdrsv;
15206 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
15207             }
15208 0 0         if (hdrp) {
15209 0 0         if(hdrp == &PL_sv_undef)
15210 0           hdr_copy = &PL_sv_undef;
15211             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
15212             int count;
15213             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
15214 0           dSP;
15215 0           ENTER ;
15216 0           SAVETMPS ;
15217 0 0         PUSHMARK(SP) ;
15218 0 0         XPUSHs( hdrp );
15219 0           PUTBACK ;
15220 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
15221 0           SPAGAIN ;
15222 0 0         if(count != 1)
15223 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
15224              
15225 0           hdr_copy = (SV *)POPs;
15226              
15227 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
15228 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
15229             }
15230              
15231 0 0         FREETMPS ;
15232 0           LEAVE ;
15233              
15234              
15235             } PDL_COMMENT("end of callback block")
15236              
15237 0 0         if ( __privtrans->pdls[0]->hdrsv != hdrp ){
15238 0 0         if( __privtrans->pdls[0]->hdrsv && __privtrans->pdls[0]->hdrsv != &PL_sv_undef)
    0          
15239 0           (void)SvREFCNT_dec( __privtrans->pdls[0]->hdrsv );
15240 0 0         if( hdr_copy != &PL_sv_undef )
15241 0           (void)SvREFCNT_inc(hdr_copy);
15242 0           __privtrans->pdls[0]->hdrsv = hdr_copy;
15243             }
15244 0 0         if(propagate_hdrcpy)
15245 0           __privtrans->pdls[0]->state |= PDL_HDRCPY;
15246 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
15247 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
15248 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
15249 0 0         if( hdr_copy != &PL_sv_undef )
15250 0           (void)SvREFCNT_inc(hdr_copy);
15251 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
15252             }
15253 0 0         if(propagate_hdrcpy)
15254 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
15255 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
15256 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
15257 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
15258 0 0         if( hdr_copy != &PL_sv_undef )
15259 0           (void)SvREFCNT_inc(hdr_copy);
15260 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
15261             }
15262 0 0         if(propagate_hdrcpy)
15263 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
15264              
15265 0 0         if(hdr_copy != &PL_sv_undef)
15266 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
15267             } PDL_COMMENT("end of if(hdrp) block")
15268             } PDL_COMMENT("end of conv. block")
15269 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
15270 0           __privtrans->__inc_U_d = 0; else
15271 0 0         __privtrans->__inc_U_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
15272 0           __privtrans->__inc_U_n = 0; else
15273 0 0         __privtrans->__inc_U_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
15274 0           __privtrans->__inc_S_d = 0; else
15275 0 0         __privtrans->__inc_S_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
15276 0           __privtrans->__inc_V_d0 = 0; else
15277 0 0         __privtrans->__inc_V_d0 = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[2]->ndims <= 1 || __privtrans->pdls[2]->dims[1] <= 1)
    0          
15278 0           __privtrans->__inc_V_d1 = 0; else
15279 0           __privtrans->__inc_V_d1 = __privtrans->pdls[2]->dimincs[1]; __privtrans->__ddone = 1;
15280             }
15281 0           }
15282            
15283              
15284 0           pdl_trans * pdl_pca_copy(pdl_trans *__tr ) {
15285             int __dim;
15286 0           pdl_pca_struct *__privtrans = (pdl_pca_struct *) __tr;
15287            
15288             {
15289 0           pdl_pca_struct *__copy = malloc(sizeof(pdl_pca_struct));
15290 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
15291 0           __copy->has_badvalue = __privtrans->has_badvalue;
15292 0           __copy->badvalue = __privtrans->badvalue;
15293 0           __copy->flags = __privtrans->flags;
15294 0           __copy->vtable = __privtrans->vtable;
15295 0           __copy->__datatype = __privtrans->__datatype;
15296 0           __copy->freeproc = NULL;
15297 0           __copy->__ddone = __privtrans->__ddone;
15298             {int i;
15299 0 0         for(i=0; i<__copy->vtable->npdls; i++)
15300 0           __copy->pdls[i] = __privtrans->pdls[i];
15301             }
15302            
15303 0 0         if(__copy->__ddone) {
15304 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_U_d=__copy->__inc_U_d;__privtrans->__inc_U_n=__copy->__inc_U_n;__privtrans->__inc_S_d=__copy->__inc_S_d;__privtrans->__inc_V_d0=__copy->__inc_V_d0;__privtrans->__inc_V_d1=__copy->__inc_V_d1;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;
15305             }
15306 0           return (pdl_trans*)__copy;
15307             }
15308             }
15309            
15310              
15311 0           void pdl_pca_readdata(pdl_trans *__tr ) {
15312             int __dim;
15313 0           pdl_pca_struct *__privtrans = (pdl_pca_struct *) __tr;
15314            
15315             {
15316             {PDL_COMMENT("Start generic loop")
15317              
15318 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
15319 0           } break; case PDL_B: {
15320 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15321 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15322              
15323 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15324 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15325              
15326 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15327 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15328              
15329 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15330 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15331 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15332 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15333 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15334              
15335              
15336 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15337 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15338 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15339 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15340             }
15341            
15342             PDL_COMMENT("THREADLOOPBEGIN")
15343 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15344 0           do { register PDL_Indx __tind1=0,__tind2=0;
15345 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15346 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15347 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15348 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15349 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15350 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15351 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15352 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15353 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15354 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15355 0           U_datap += __offsp[0];
15356 0           S_datap += __offsp[1];
15357 0           V_datap += __offsp[2];
15358 0 0         for( __tind2 = 0 ;
15359             __tind2 < __tdims1 ;
15360 0           __tind2++
15361 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15362 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15363 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15364             )
15365             {
15366 0 0         for( __tind1 = 0 ;
15367             __tind1 < __tdims0 ;
15368 0           __tind1++
15369 0           ,U_datap += __tinc0_0
15370 0           ,S_datap += __tinc0_1
15371 0           ,V_datap += __tinc0_2
15372             )
15373             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15374 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15375 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15376 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15377            
15378             PDL_COMMENT("THREADLOOPEND")
15379             }
15380             }
15381 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15382 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15383 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15384 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15385             /*-- cleanup --*/
15386 0 0         if (Upp) free(Upp);
15387 0 0         if (Vpp) free(Vpp);
15388              
15389 0           } } break; case PDL_S: {
15390 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15391 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15392              
15393 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15394 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15395              
15396 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15397 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15398              
15399 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15400 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15401 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15402 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15403 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15404              
15405              
15406 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15407 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15408 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15409 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15410             }
15411            
15412             PDL_COMMENT("THREADLOOPBEGIN")
15413 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15414 0           do { register PDL_Indx __tind1=0,__tind2=0;
15415 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15416 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15417 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15418 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15419 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15420 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15421 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15422 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15423 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15424 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15425 0           U_datap += __offsp[0];
15426 0           S_datap += __offsp[1];
15427 0           V_datap += __offsp[2];
15428 0 0         for( __tind2 = 0 ;
15429             __tind2 < __tdims1 ;
15430 0           __tind2++
15431 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15432 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15433 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15434             )
15435             {
15436 0 0         for( __tind1 = 0 ;
15437             __tind1 < __tdims0 ;
15438 0           __tind1++
15439 0           ,U_datap += __tinc0_0
15440 0           ,S_datap += __tinc0_1
15441 0           ,V_datap += __tinc0_2
15442             )
15443             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15444 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15445 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15446 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15447            
15448             PDL_COMMENT("THREADLOOPEND")
15449             }
15450             }
15451 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15452 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15453 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15454 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15455             /*-- cleanup --*/
15456 0 0         if (Upp) free(Upp);
15457 0 0         if (Vpp) free(Vpp);
15458              
15459 0           } } break; case PDL_US: {
15460 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15461 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15462              
15463 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15464 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15465              
15466 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15467 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15468              
15469 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15470 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15471 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15472 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15473 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15474              
15475              
15476 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15477 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15478 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15479 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15480             }
15481            
15482             PDL_COMMENT("THREADLOOPBEGIN")
15483 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15484 0           do { register PDL_Indx __tind1=0,__tind2=0;
15485 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15486 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15487 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15488 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15489 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15490 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15491 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15492 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15493 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15494 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15495 0           U_datap += __offsp[0];
15496 0           S_datap += __offsp[1];
15497 0           V_datap += __offsp[2];
15498 0 0         for( __tind2 = 0 ;
15499             __tind2 < __tdims1 ;
15500 0           __tind2++
15501 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15502 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15503 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15504             )
15505             {
15506 0 0         for( __tind1 = 0 ;
15507             __tind1 < __tdims0 ;
15508 0           __tind1++
15509 0           ,U_datap += __tinc0_0
15510 0           ,S_datap += __tinc0_1
15511 0           ,V_datap += __tinc0_2
15512             )
15513             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15514 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15515 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15516 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15517            
15518             PDL_COMMENT("THREADLOOPEND")
15519             }
15520             }
15521 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15522 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15523 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15524 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15525             /*-- cleanup --*/
15526 0 0         if (Upp) free(Upp);
15527 0 0         if (Vpp) free(Vpp);
15528              
15529 0           } } break; case PDL_L: {
15530 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15531 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15532              
15533 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15534 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15535              
15536 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15537 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15538              
15539 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15540 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15541 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15542 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15543 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15544              
15545              
15546 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15547 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15548 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15549 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15550             }
15551            
15552             PDL_COMMENT("THREADLOOPBEGIN")
15553 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15554 0           do { register PDL_Indx __tind1=0,__tind2=0;
15555 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15556 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15557 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15558 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15559 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15560 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15561 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15562 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15563 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15564 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15565 0           U_datap += __offsp[0];
15566 0           S_datap += __offsp[1];
15567 0           V_datap += __offsp[2];
15568 0 0         for( __tind2 = 0 ;
15569             __tind2 < __tdims1 ;
15570 0           __tind2++
15571 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15572 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15573 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15574             )
15575             {
15576 0 0         for( __tind1 = 0 ;
15577             __tind1 < __tdims0 ;
15578 0           __tind1++
15579 0           ,U_datap += __tinc0_0
15580 0           ,S_datap += __tinc0_1
15581 0           ,V_datap += __tinc0_2
15582             )
15583             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15584 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15585 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15586 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15587            
15588             PDL_COMMENT("THREADLOOPEND")
15589             }
15590             }
15591 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15592 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15593 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15594 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15595             /*-- cleanup --*/
15596 0 0         if (Upp) free(Upp);
15597 0 0         if (Vpp) free(Vpp);
15598              
15599 0           } } break; case PDL_IND: {
15600 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15601 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15602              
15603 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15604 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15605              
15606 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15607 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15608              
15609 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15610 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15611 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15612 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15613 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15614              
15615              
15616 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15617 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15618 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15619 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15620             }
15621            
15622             PDL_COMMENT("THREADLOOPBEGIN")
15623 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15624 0           do { register PDL_Indx __tind1=0,__tind2=0;
15625 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15626 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15627 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15628 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15629 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15630 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15631 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15632 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15633 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15634 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15635 0           U_datap += __offsp[0];
15636 0           S_datap += __offsp[1];
15637 0           V_datap += __offsp[2];
15638 0 0         for( __tind2 = 0 ;
15639             __tind2 < __tdims1 ;
15640 0           __tind2++
15641 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15642 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15643 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15644             )
15645             {
15646 0 0         for( __tind1 = 0 ;
15647             __tind1 < __tdims0 ;
15648 0           __tind1++
15649 0           ,U_datap += __tinc0_0
15650 0           ,S_datap += __tinc0_1
15651 0           ,V_datap += __tinc0_2
15652             )
15653             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15654 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15655 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15656 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15657            
15658             PDL_COMMENT("THREADLOOPEND")
15659             }
15660             }
15661 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15662 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15663 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15664 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15665             /*-- cleanup --*/
15666 0 0         if (Upp) free(Upp);
15667 0 0         if (Vpp) free(Vpp);
15668              
15669 0           } } break; case PDL_LL: {
15670 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15671 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15672              
15673 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15674 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15675              
15676 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15677 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15678              
15679 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15680 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15681 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15682 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15683 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15684              
15685              
15686 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15687 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15688 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15689 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15690             }
15691            
15692             PDL_COMMENT("THREADLOOPBEGIN")
15693 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15694 0           do { register PDL_Indx __tind1=0,__tind2=0;
15695 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15696 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15697 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15698 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15699 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15700 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15701 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15702 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15703 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15704 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15705 0           U_datap += __offsp[0];
15706 0           S_datap += __offsp[1];
15707 0           V_datap += __offsp[2];
15708 0 0         for( __tind2 = 0 ;
15709             __tind2 < __tdims1 ;
15710 0           __tind2++
15711 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15712 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15713 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15714             )
15715             {
15716 0 0         for( __tind1 = 0 ;
15717             __tind1 < __tdims0 ;
15718 0           __tind1++
15719 0           ,U_datap += __tinc0_0
15720 0           ,S_datap += __tinc0_1
15721 0           ,V_datap += __tinc0_2
15722             )
15723             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15724 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15725 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15726 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15727            
15728             PDL_COMMENT("THREADLOOPEND")
15729             }
15730             }
15731 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15732 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15733 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15734 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15735             /*-- cleanup --*/
15736 0 0         if (Upp) free(Upp);
15737 0 0         if (Vpp) free(Vpp);
15738              
15739 0           } } break; case PDL_F: {
15740 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15741 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15742              
15743 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15744 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15745              
15746 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15747 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15748              
15749 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15750 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15751 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15752 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15753 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15754              
15755              
15756 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15757 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15758 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15759 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15760             }
15761            
15762             PDL_COMMENT("THREADLOOPBEGIN")
15763 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15764 0           do { register PDL_Indx __tind1=0,__tind2=0;
15765 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15766 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15767 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15768 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15769 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15770 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15771 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15772 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15773 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15774 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15775 0           U_datap += __offsp[0];
15776 0           S_datap += __offsp[1];
15777 0           V_datap += __offsp[2];
15778 0 0         for( __tind2 = 0 ;
15779             __tind2 < __tdims1 ;
15780 0           __tind2++
15781 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15782 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15783 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15784             )
15785             {
15786 0 0         for( __tind1 = 0 ;
15787             __tind1 < __tdims0 ;
15788 0           __tind1++
15789 0           ,U_datap += __tinc0_0
15790 0           ,S_datap += __tinc0_1
15791 0           ,V_datap += __tinc0_2
15792             )
15793             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15794 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15795 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15796 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15797            
15798             PDL_COMMENT("THREADLOOPEND")
15799             }
15800             }
15801 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15802 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15803 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15804 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15805             /*-- cleanup --*/
15806 0 0         if (Upp) free(Upp);
15807 0 0         if (Vpp) free(Vpp);
15808              
15809 0           } } break; case PDL_D: {
15810 0 0         PDL_Double * U_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15811 0           PDL_Double * U_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15812              
15813 0 0         PDL_Double * S_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15814 0           PDL_Double * S_physdatap = ((PDL_Double *)((__privtrans->pdls[1])->data));
15815              
15816 0 0         PDL_Double * V_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15817 0           PDL_Double * V_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15818              
15819 0           {register PDL_Indx __inc_S_d = __privtrans->__inc_S_d;
15820 0           register PDL_Indx __inc_U_d = __privtrans->__inc_U_d;
15821 0           register PDL_Indx __inc_U_n = __privtrans->__inc_U_n;
15822 0           register PDL_Indx __inc_V_d0 = __privtrans->__inc_V_d0;
15823 0           register PDL_Indx __inc_V_d1 = __privtrans->__inc_V_d1;
15824              
15825              
15826 0           double **Upp = (double **)pp_alloc(__privtrans->__n_size);
15827 0           double **Vpp = (double **)pp_alloc(__privtrans->__d_size);
15828 0 0         if (__privtrans->__n_size < __privtrans->__d_size) {
15829 0           barf("svd(): Number of rows (=%d) must be >= number of columns (=%d)!\n", __privtrans->__n_size, __privtrans->__d_size);
15830             }
15831            
15832             PDL_COMMENT("THREADLOOPBEGIN")
15833 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
15834 0           do { register PDL_Indx __tind1=0,__tind2=0;
15835 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
15836 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
15837 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
15838 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
15839 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
15840 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
15841 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
15842 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
15843 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
15844 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
15845 0           U_datap += __offsp[0];
15846 0           S_datap += __offsp[1];
15847 0           V_datap += __offsp[2];
15848 0 0         for( __tind2 = 0 ;
15849             __tind2 < __tdims1 ;
15850 0           __tind2++
15851 0           ,U_datap += __tinc1_0 - __tinc0_0 * __tdims0
15852 0           ,S_datap += __tinc1_1 - __tinc0_1 * __tdims0
15853 0           ,V_datap += __tinc1_2 - __tinc0_2 * __tdims0
15854             )
15855             {
15856 0 0         for( __tind1 = 0 ;
15857             __tind1 < __tdims0 ;
15858 0           __tind1++
15859 0           ,U_datap += __tinc0_0
15860 0           ,S_datap += __tinc0_1
15861 0           ,V_datap += __tinc0_2
15862             )
15863             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
15864 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, U_datap, Upp);
15865 0           p2pp_dbl(__privtrans->__d_size, __privtrans->__d_size, V_datap, Vpp);
15866 0           pca(__privtrans->__n_size, __privtrans->__d_size, Upp, Vpp, S_datap);
15867            
15868             PDL_COMMENT("THREADLOOPEND")
15869             }
15870             }
15871 0           U_datap -= __tinc1_0 * __tdims1 + __offsp[0];
15872 0           S_datap -= __tinc1_1 * __tdims1 + __offsp[1];
15873 0           V_datap -= __tinc1_2 * __tdims1 + __offsp[2];
15874 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
15875             /*-- cleanup --*/
15876 0 0         if (Upp) free(Upp);
15877 0 0         if (Vpp) free(Vpp);
15878              
15879 0           } break;}
15880 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
15881             }
15882             }
15883             }
15884            
15885              
15886              
15887              
15888 0           void pdl_pca_free(pdl_trans *__tr ) {
15889             int __dim;
15890 0           pdl_pca_struct *__privtrans = (pdl_pca_struct *) __tr;
15891            
15892             {
15893            
15894 0           PDL_TR_CLRMAGIC(__privtrans);
15895            
15896 0 0         if(__privtrans->__ddone) {
15897 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
15898             ;;;;;;;;
15899             }
15900            
15901             }
15902 0           }
15903            
15904              
15905              
15906              
15907             static char pdl_pca_vtable_flags[] =
15908             { 0,0,0};
15909             pdl_transvtable pdl_pca_vtable = {
15910             0,0, 0, 3, pdl_pca_vtable_flags,
15911             pdl_pca_redodims, pdl_pca_readdata, NULL,
15912             pdl_pca_free,NULL,NULL,pdl_pca_copy,
15913             sizeof(pdl_pca_struct),"pdl_pca_vtable"
15914             };
15915              
15916             typedef struct pdl_rowdistances_struct {
15917             PDL_TRANS_START(6);
15918             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_rowids1_ncmps;PDL_Indx __inc_rowids2_ncmps;PDL_Indx __inc_dist_ncmps;PDL_Indx __n_size;PDL_Indx __ncmps_size;PDL_Indx __d_size;
15919             char *distFlag;
15920             char __ddone; PDL_COMMENT("Dims done")
15921             } pdl_rowdistances_struct;
15922              
15923 0           void pdl_rowdistances_redodims(pdl_trans *__tr ) {
15924             int __dim;
15925 0           pdl_rowdistances_struct *__privtrans = (pdl_rowdistances_struct *) __tr;
15926            
15927             {
15928             PDL_Indx __creating[6];
15929 0           __privtrans->__n_size = -1;
15930 0           __privtrans->__ncmps_size = -1;
15931 0           __privtrans->__d_size = -1;
15932 0           __creating[0] = 0;
15933 0           __creating[1] = 0;
15934 0           __creating[2] = 0;
15935 0           __creating[3] = 0;
15936 0           __creating[4] = 0;
15937 0 0         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    0          
15938             {
15939             {PDL_COMMENT("Start generic loop")
15940              
15941 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
15942 0           } break; case PDL_B: {
15943 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15944 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15945              
15946 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15947 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
15948              
15949 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15950 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15951              
15952 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
15953 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
15954              
15955 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
15956 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
15957              
15958 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
15959 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
15960              
15961 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
15962 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
15963 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
15964 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
15965 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
15966 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
15967 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
15968 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
15969              
15970             PDL_COMMENT("none")
15971 0           } } break; case PDL_S: {
15972 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
15973 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
15974              
15975 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
15976 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
15977              
15978 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
15979 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
15980              
15981 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
15982 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
15983              
15984 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
15985 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
15986              
15987 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
15988 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
15989              
15990 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
15991 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
15992 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
15993 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
15994 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
15995 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
15996 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
15997 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
15998              
15999             PDL_COMMENT("none")
16000 0           } } break; case PDL_US: {
16001 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16002 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16003              
16004 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16005 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16006              
16007 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16008 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16009              
16010 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16011 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16012              
16013 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16014 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16015              
16016 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16017 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16018              
16019 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16020 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16021 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16022 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16023 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16024 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16025 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16026 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16027              
16028             PDL_COMMENT("none")
16029 0           } } break; case PDL_L: {
16030 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16031 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16032              
16033 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16034 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16035              
16036 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16037 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16038              
16039 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16040 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16041              
16042 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16043 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16044              
16045 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16046 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16047              
16048 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16049 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16050 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16051 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16052 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16053 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16054 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16055 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16056              
16057             PDL_COMMENT("none")
16058 0           } } break; case PDL_IND: {
16059 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16060 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16061              
16062 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16063 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16064              
16065 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16066 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16067              
16068 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16069 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16070              
16071 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16072 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16073              
16074 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16075 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16076              
16077 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16078 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16079 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16080 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16081 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16082 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16083 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16084 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16085              
16086             PDL_COMMENT("none")
16087 0           } } break; case PDL_LL: {
16088 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16089 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16090              
16091 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16092 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16093              
16094 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16095 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16096              
16097 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16098 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16099              
16100 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16101 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16102              
16103 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16104 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16105              
16106 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16107 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16108 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16109 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16110 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16111 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16112 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16113 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16114              
16115             PDL_COMMENT("none")
16116 0           } } break; case PDL_F: {
16117 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16118 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16119              
16120 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16121 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16122              
16123 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16124 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16125              
16126 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16127 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16128              
16129 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16130 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16131              
16132 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16133 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16134              
16135 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16136 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16137 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16138 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16139 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16140 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16141 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16142 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16143              
16144             PDL_COMMENT("none")
16145 0           } } break; case PDL_D: {
16146 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16147 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16148              
16149 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16150 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16151              
16152 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16153 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16154              
16155 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16156 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16157              
16158 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16159 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16160              
16161 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16162 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16163              
16164 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16165 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16166 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16167 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16168 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16169 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16170 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16171 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16172              
16173             PDL_COMMENT("none")
16174 0           } break;}
16175 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
16176             }
16177             }
16178             {
16179             static char *__parnames[] = {"data","mask","weight","rowids1","rowids2","dist"};
16180             static PDL_Indx __realdims[] = {2,2,1,1,1,1};
16181             static char __funcname[] = "PDL::Cluster::rowdistances";
16182             static pdl_errorinfo __einfo = {
16183             __funcname, __parnames, 6
16184             };
16185            
16186 0           PDL->initthreadstruct(2,__privtrans->pdls,
16187             __realdims,__creating,6,
16188             &__einfo,&(__privtrans->__pdlthread),
16189 0           __privtrans->vtable->per_pdl_flags,
16190             0 );
16191             }
16192 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
16193 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
16194 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
16195             }
16196 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
16197 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
16198 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
16199 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
16200 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16201             }
16202             }
16203 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
16204 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
16205 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
16206 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
16207 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16208             }
16209             }
16210 0           PDL->make_physical(((__privtrans->pdls[0])));
16211 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
16212 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
16213 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
16214             }
16215 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
16216 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
16217 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
16218 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
16219 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16220             }
16221             }
16222 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
16223 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
16224 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
16225 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
16226 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16227             }
16228             }
16229 0           PDL->make_physical(((__privtrans->pdls[1])));
16230 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
16231 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
16232             }
16233 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
16234 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
16235 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
16236 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
16237 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16238             }
16239             }
16240 0           PDL->make_physical(((__privtrans->pdls[2])));
16241 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
16242 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
16243             }
16244 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
16245 0           __privtrans->__ncmps_size = ((__privtrans->pdls[3]))->dims[0];
16246 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
16247 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
16248 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16249             }
16250             }
16251 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
16252 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
16253             }
16254 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
16255 0           __privtrans->__ncmps_size = ((__privtrans->pdls[4]))->dims[0];
16256 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
16257 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
16258 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16259             }
16260             }
16261 0 0         if(!__creating[5]) {
16262 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
16263 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
16264             }
16265 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
16266 0           __privtrans->__ncmps_size = ((__privtrans->pdls[5]))->dims[0];
16267 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
16268 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
16269 0           PDL->pdl_barf("Error in rowdistances:" "Wrong dims\n");
16270             }
16271             }
16272             } else {
16273 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__ncmps_size;
16274 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
16275             }
16276             { PDL_COMMENT("convenience block")
16277 0           void *hdrp = NULL;
16278 0           char propagate_hdrcpy = 0;
16279 0           SV *hdr_copy = NULL;
16280 0 0         if(!hdrp &&
    0          
16281 0 0         __privtrans->pdls[0]->hdrsv &&
16282 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
16283             ) {
16284 0           hdrp = __privtrans->pdls[0]->hdrsv;
16285 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
16286             }
16287 0 0         if(!hdrp &&
    0          
16288 0 0         __privtrans->pdls[1]->hdrsv &&
16289 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
16290             ) {
16291 0           hdrp = __privtrans->pdls[1]->hdrsv;
16292 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
16293             }
16294 0 0         if(!hdrp &&
    0          
16295 0 0         __privtrans->pdls[2]->hdrsv &&
16296 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
16297             ) {
16298 0           hdrp = __privtrans->pdls[2]->hdrsv;
16299 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
16300             }
16301 0 0         if(!hdrp &&
    0          
16302 0 0         __privtrans->pdls[3]->hdrsv &&
16303 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
16304             ) {
16305 0           hdrp = __privtrans->pdls[3]->hdrsv;
16306 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
16307             }
16308 0 0         if(!hdrp &&
    0          
16309 0 0         __privtrans->pdls[4]->hdrsv &&
16310 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
16311             ) {
16312 0           hdrp = __privtrans->pdls[4]->hdrsv;
16313 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
16314             }
16315 0 0         if(!hdrp &&
    0          
16316 0 0         !__creating[5] &&
16317 0 0         __privtrans->pdls[5]->hdrsv &&
16318 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
16319             ) {
16320 0           hdrp = __privtrans->pdls[5]->hdrsv;
16321 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
16322             }
16323 0 0         if (hdrp) {
16324 0 0         if(hdrp == &PL_sv_undef)
16325 0           hdr_copy = &PL_sv_undef;
16326             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
16327             int count;
16328             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
16329 0           dSP;
16330 0           ENTER ;
16331 0           SAVETMPS ;
16332 0 0         PUSHMARK(SP) ;
16333 0 0         XPUSHs( hdrp );
16334 0           PUTBACK ;
16335 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
16336 0           SPAGAIN ;
16337 0 0         if(count != 1)
16338 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
16339              
16340 0           hdr_copy = (SV *)POPs;
16341              
16342 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
16343 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
16344             }
16345              
16346 0 0         FREETMPS ;
16347 0           LEAVE ;
16348              
16349              
16350             } PDL_COMMENT("end of callback block")
16351              
16352 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
16353 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
16354 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
16355 0 0         if( hdr_copy != &PL_sv_undef )
16356 0           (void)SvREFCNT_inc(hdr_copy);
16357 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
16358             }
16359 0 0         if(propagate_hdrcpy)
16360 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
16361              
16362 0 0         if(hdr_copy != &PL_sv_undef)
16363 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
16364             } PDL_COMMENT("end of if(hdrp) block")
16365             } PDL_COMMENT("end of conv. block")
16366 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
16367 0           __privtrans->__inc_data_d = 0; else
16368 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
16369 0           __privtrans->__inc_data_n = 0; else
16370 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
16371 0           __privtrans->__inc_mask_d = 0; else
16372 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
16373 0           __privtrans->__inc_mask_n = 0; else
16374 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
16375 0           __privtrans->__inc_weight_d = 0; else
16376 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
16377 0           __privtrans->__inc_rowids1_ncmps = 0; else
16378 0 0         __privtrans->__inc_rowids1_ncmps = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
16379 0           __privtrans->__inc_rowids2_ncmps = 0; else
16380 0 0         __privtrans->__inc_rowids2_ncmps = PDL_REPRINC(__privtrans->pdls[4],0);if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
    0          
16381 0           __privtrans->__inc_dist_ncmps = 0; else
16382 0 0         __privtrans->__inc_dist_ncmps = PDL_REPRINC(__privtrans->pdls[5],0); __privtrans->__ddone = 1;
16383             }
16384 0           }
16385            
16386              
16387 0           pdl_trans * pdl_rowdistances_copy(pdl_trans *__tr ) {
16388             int __dim;
16389 0           pdl_rowdistances_struct *__privtrans = (pdl_rowdistances_struct *) __tr;
16390            
16391             {
16392 0           pdl_rowdistances_struct *__copy = malloc(sizeof(pdl_rowdistances_struct));
16393 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
16394 0           __copy->has_badvalue = __privtrans->has_badvalue;
16395 0           __copy->badvalue = __privtrans->badvalue;
16396 0           __copy->flags = __privtrans->flags;
16397 0           __copy->vtable = __privtrans->vtable;
16398 0           __copy->__datatype = __privtrans->__datatype;
16399 0           __copy->freeproc = NULL;
16400 0           __copy->__ddone = __privtrans->__ddone;
16401             {int i;
16402 0 0         for(i=0; i<__copy->vtable->npdls; i++)
16403 0           __copy->pdls[i] = __privtrans->pdls[i];
16404             }
16405 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;
16406 0 0         if(__copy->__ddone) {
16407 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_rowids1_ncmps=__copy->__inc_rowids1_ncmps;__privtrans->__inc_rowids2_ncmps=__copy->__inc_rowids2_ncmps;__privtrans->__inc_dist_ncmps=__copy->__inc_dist_ncmps;__copy->__n_size=__privtrans->__n_size;__copy->__ncmps_size=__privtrans->__ncmps_size;__copy->__d_size=__privtrans->__d_size;
16408             }
16409 0           return (pdl_trans*)__copy;
16410             }
16411             }
16412            
16413              
16414 0           void pdl_rowdistances_readdata(pdl_trans *__tr ) {
16415             int __dim;
16416 0           pdl_rowdistances_struct *__privtrans = (pdl_rowdistances_struct *) __tr;
16417            
16418             {
16419 0           {register PDL_Indx __ncmps_size = __privtrans->__ncmps_size;
16420             PDL_COMMENT("Start generic loop")
16421              
16422 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
16423 0           } break; case PDL_B: {
16424 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16425 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16426              
16427 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16428 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16429              
16430 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16431 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16432              
16433 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16434 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16435              
16436 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16437 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16438              
16439 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16440 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16441              
16442 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16443 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16444 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16445 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16446 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16447 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16448 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16449 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16450              
16451              
16452 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16453 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16454             int rowid1, rowid2;
16455 0           char methodChar = 'x'; /*-- doesnt matter --*/
16456 0           int transpose=0;
16457            
16458             PDL_COMMENT("THREADLOOPBEGIN")
16459 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
16460 0           do { register PDL_Indx __tind1=0,__tind2=0;
16461 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
16462 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
16463 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
16464 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
16465 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
16466 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
16467 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
16468 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
16469 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
16470 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
16471 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
16472 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
16473 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
16474 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
16475 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
16476 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
16477 0           data_datap += __offsp[0];
16478 0           mask_datap += __offsp[1];
16479 0           weight_datap += __offsp[2];
16480 0           rowids1_datap += __offsp[3];
16481 0           rowids2_datap += __offsp[4];
16482 0           dist_datap += __offsp[5];
16483 0 0         for( __tind2 = 0 ;
16484             __tind2 < __tdims1 ;
16485 0           __tind2++
16486 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
16487 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
16488 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
16489 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
16490 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
16491 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
16492             )
16493             {
16494 0 0         for( __tind1 = 0 ;
16495             __tind1 < __tdims0 ;
16496 0           __tind1++
16497 0           ,data_datap += __tinc0_0
16498 0           ,mask_datap += __tinc0_1
16499 0           ,weight_datap += __tinc0_2
16500 0           ,rowids1_datap += __tinc0_3
16501 0           ,rowids2_datap += __tinc0_4
16502 0           ,dist_datap += __tinc0_5
16503             )
16504             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
16505 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
16506 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
16507             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
16508 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
16509 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16510 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16511 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
16512             1, 1,
16513             &rowid1, &rowid2,
16514 0           *__privtrans->distFlag, methodChar, transpose);
16515             }} PDL_COMMENT("Close ncmps")
16516            
16517             PDL_COMMENT("THREADLOOPEND")
16518             }
16519             }
16520 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
16521 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
16522 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
16523 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
16524 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
16525 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
16526 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
16527             /*-- cleanup --*/
16528 0 0         if (datapp) free(datapp);
16529 0 0         if (maskpp) free(maskpp);
16530              
16531 0           } } break; case PDL_S: {
16532 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16533 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16534              
16535 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16536 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16537              
16538 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16539 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16540              
16541 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16542 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16543              
16544 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16545 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16546              
16547 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16548 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16549              
16550 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16551 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16552 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16553 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16554 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16555 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16556 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16557 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16558              
16559              
16560 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16561 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16562             int rowid1, rowid2;
16563 0           char methodChar = 'x'; /*-- doesnt matter --*/
16564 0           int transpose=0;
16565            
16566             PDL_COMMENT("THREADLOOPBEGIN")
16567 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
16568 0           do { register PDL_Indx __tind1=0,__tind2=0;
16569 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
16570 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
16571 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
16572 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
16573 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
16574 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
16575 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
16576 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
16577 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
16578 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
16579 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
16580 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
16581 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
16582 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
16583 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
16584 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
16585 0           data_datap += __offsp[0];
16586 0           mask_datap += __offsp[1];
16587 0           weight_datap += __offsp[2];
16588 0           rowids1_datap += __offsp[3];
16589 0           rowids2_datap += __offsp[4];
16590 0           dist_datap += __offsp[5];
16591 0 0         for( __tind2 = 0 ;
16592             __tind2 < __tdims1 ;
16593 0           __tind2++
16594 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
16595 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
16596 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
16597 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
16598 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
16599 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
16600             )
16601             {
16602 0 0         for( __tind1 = 0 ;
16603             __tind1 < __tdims0 ;
16604 0           __tind1++
16605 0           ,data_datap += __tinc0_0
16606 0           ,mask_datap += __tinc0_1
16607 0           ,weight_datap += __tinc0_2
16608 0           ,rowids1_datap += __tinc0_3
16609 0           ,rowids2_datap += __tinc0_4
16610 0           ,dist_datap += __tinc0_5
16611             )
16612             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
16613 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
16614 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
16615             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
16616 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
16617 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16618 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16619 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
16620             1, 1,
16621             &rowid1, &rowid2,
16622 0           *__privtrans->distFlag, methodChar, transpose);
16623             }} PDL_COMMENT("Close ncmps")
16624            
16625             PDL_COMMENT("THREADLOOPEND")
16626             }
16627             }
16628 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
16629 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
16630 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
16631 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
16632 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
16633 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
16634 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
16635             /*-- cleanup --*/
16636 0 0         if (datapp) free(datapp);
16637 0 0         if (maskpp) free(maskpp);
16638              
16639 0           } } break; case PDL_US: {
16640 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16641 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16642              
16643 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16644 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16645              
16646 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16647 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16648              
16649 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16650 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16651              
16652 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16653 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16654              
16655 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16656 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16657              
16658 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16659 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16660 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16661 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16662 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16663 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16664 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16665 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16666              
16667              
16668 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16669 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16670             int rowid1, rowid2;
16671 0           char methodChar = 'x'; /*-- doesnt matter --*/
16672 0           int transpose=0;
16673            
16674             PDL_COMMENT("THREADLOOPBEGIN")
16675 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
16676 0           do { register PDL_Indx __tind1=0,__tind2=0;
16677 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
16678 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
16679 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
16680 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
16681 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
16682 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
16683 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
16684 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
16685 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
16686 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
16687 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
16688 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
16689 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
16690 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
16691 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
16692 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
16693 0           data_datap += __offsp[0];
16694 0           mask_datap += __offsp[1];
16695 0           weight_datap += __offsp[2];
16696 0           rowids1_datap += __offsp[3];
16697 0           rowids2_datap += __offsp[4];
16698 0           dist_datap += __offsp[5];
16699 0 0         for( __tind2 = 0 ;
16700             __tind2 < __tdims1 ;
16701 0           __tind2++
16702 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
16703 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
16704 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
16705 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
16706 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
16707 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
16708             )
16709             {
16710 0 0         for( __tind1 = 0 ;
16711             __tind1 < __tdims0 ;
16712 0           __tind1++
16713 0           ,data_datap += __tinc0_0
16714 0           ,mask_datap += __tinc0_1
16715 0           ,weight_datap += __tinc0_2
16716 0           ,rowids1_datap += __tinc0_3
16717 0           ,rowids2_datap += __tinc0_4
16718 0           ,dist_datap += __tinc0_5
16719             )
16720             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
16721 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
16722 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
16723             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
16724 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
16725 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16726 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16727 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
16728             1, 1,
16729             &rowid1, &rowid2,
16730 0           *__privtrans->distFlag, methodChar, transpose);
16731             }} PDL_COMMENT("Close ncmps")
16732            
16733             PDL_COMMENT("THREADLOOPEND")
16734             }
16735             }
16736 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
16737 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
16738 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
16739 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
16740 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
16741 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
16742 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
16743             /*-- cleanup --*/
16744 0 0         if (datapp) free(datapp);
16745 0 0         if (maskpp) free(maskpp);
16746              
16747 0           } } break; case PDL_L: {
16748 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16749 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16750              
16751 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16752 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16753              
16754 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16755 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16756              
16757 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16758 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16759              
16760 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16761 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16762              
16763 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16764 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16765              
16766 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16767 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16768 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16769 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16770 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16771 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16772 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16773 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16774              
16775              
16776 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16777 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16778             int rowid1, rowid2;
16779 0           char methodChar = 'x'; /*-- doesnt matter --*/
16780 0           int transpose=0;
16781            
16782             PDL_COMMENT("THREADLOOPBEGIN")
16783 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
16784 0           do { register PDL_Indx __tind1=0,__tind2=0;
16785 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
16786 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
16787 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
16788 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
16789 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
16790 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
16791 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
16792 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
16793 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
16794 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
16795 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
16796 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
16797 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
16798 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
16799 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
16800 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
16801 0           data_datap += __offsp[0];
16802 0           mask_datap += __offsp[1];
16803 0           weight_datap += __offsp[2];
16804 0           rowids1_datap += __offsp[3];
16805 0           rowids2_datap += __offsp[4];
16806 0           dist_datap += __offsp[5];
16807 0 0         for( __tind2 = 0 ;
16808             __tind2 < __tdims1 ;
16809 0           __tind2++
16810 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
16811 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
16812 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
16813 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
16814 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
16815 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
16816             )
16817             {
16818 0 0         for( __tind1 = 0 ;
16819             __tind1 < __tdims0 ;
16820 0           __tind1++
16821 0           ,data_datap += __tinc0_0
16822 0           ,mask_datap += __tinc0_1
16823 0           ,weight_datap += __tinc0_2
16824 0           ,rowids1_datap += __tinc0_3
16825 0           ,rowids2_datap += __tinc0_4
16826 0           ,dist_datap += __tinc0_5
16827             )
16828             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
16829 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
16830 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
16831             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
16832 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
16833 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16834 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16835 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
16836             1, 1,
16837             &rowid1, &rowid2,
16838 0           *__privtrans->distFlag, methodChar, transpose);
16839             }} PDL_COMMENT("Close ncmps")
16840            
16841             PDL_COMMENT("THREADLOOPEND")
16842             }
16843             }
16844 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
16845 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
16846 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
16847 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
16848 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
16849 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
16850 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
16851             /*-- cleanup --*/
16852 0 0         if (datapp) free(datapp);
16853 0 0         if (maskpp) free(maskpp);
16854              
16855 0           } } break; case PDL_IND: {
16856 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16857 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16858              
16859 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16860 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16861              
16862 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16863 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16864              
16865 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16866 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16867              
16868 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16869 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16870              
16871 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16872 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16873              
16874 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16875 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16876 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16877 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16878 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16879 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16880 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16881 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16882              
16883              
16884 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16885 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16886             int rowid1, rowid2;
16887 0           char methodChar = 'x'; /*-- doesnt matter --*/
16888 0           int transpose=0;
16889            
16890             PDL_COMMENT("THREADLOOPBEGIN")
16891 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
16892 0           do { register PDL_Indx __tind1=0,__tind2=0;
16893 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
16894 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
16895 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
16896 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
16897 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
16898 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
16899 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
16900 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
16901 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
16902 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
16903 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
16904 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
16905 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
16906 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
16907 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
16908 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
16909 0           data_datap += __offsp[0];
16910 0           mask_datap += __offsp[1];
16911 0           weight_datap += __offsp[2];
16912 0           rowids1_datap += __offsp[3];
16913 0           rowids2_datap += __offsp[4];
16914 0           dist_datap += __offsp[5];
16915 0 0         for( __tind2 = 0 ;
16916             __tind2 < __tdims1 ;
16917 0           __tind2++
16918 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
16919 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
16920 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
16921 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
16922 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
16923 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
16924             )
16925             {
16926 0 0         for( __tind1 = 0 ;
16927             __tind1 < __tdims0 ;
16928 0           __tind1++
16929 0           ,data_datap += __tinc0_0
16930 0           ,mask_datap += __tinc0_1
16931 0           ,weight_datap += __tinc0_2
16932 0           ,rowids1_datap += __tinc0_3
16933 0           ,rowids2_datap += __tinc0_4
16934 0           ,dist_datap += __tinc0_5
16935             )
16936             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
16937 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
16938 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
16939             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
16940 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
16941 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16942 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
16943 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
16944             1, 1,
16945             &rowid1, &rowid2,
16946 0           *__privtrans->distFlag, methodChar, transpose);
16947             }} PDL_COMMENT("Close ncmps")
16948            
16949             PDL_COMMENT("THREADLOOPEND")
16950             }
16951             }
16952 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
16953 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
16954 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
16955 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
16956 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
16957 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
16958 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
16959             /*-- cleanup --*/
16960 0 0         if (datapp) free(datapp);
16961 0 0         if (maskpp) free(maskpp);
16962              
16963 0           } } break; case PDL_LL: {
16964 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
16965 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
16966              
16967 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
16968 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
16969              
16970 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
16971 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
16972              
16973 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
16974 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
16975              
16976 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
16977 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
16978              
16979 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
16980 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
16981              
16982 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
16983 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
16984 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
16985 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
16986 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
16987 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
16988 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
16989 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
16990              
16991              
16992 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
16993 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
16994             int rowid1, rowid2;
16995 0           char methodChar = 'x'; /*-- doesnt matter --*/
16996 0           int transpose=0;
16997            
16998             PDL_COMMENT("THREADLOOPBEGIN")
16999 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
17000 0           do { register PDL_Indx __tind1=0,__tind2=0;
17001 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
17002 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
17003 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
17004 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
17005 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
17006 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
17007 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
17008 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
17009 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
17010 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
17011 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
17012 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
17013 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
17014 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
17015 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
17016 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
17017 0           data_datap += __offsp[0];
17018 0           mask_datap += __offsp[1];
17019 0           weight_datap += __offsp[2];
17020 0           rowids1_datap += __offsp[3];
17021 0           rowids2_datap += __offsp[4];
17022 0           dist_datap += __offsp[5];
17023 0 0         for( __tind2 = 0 ;
17024             __tind2 < __tdims1 ;
17025 0           __tind2++
17026 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
17027 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
17028 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
17029 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
17030 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
17031 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
17032             )
17033             {
17034 0 0         for( __tind1 = 0 ;
17035             __tind1 < __tdims0 ;
17036 0           __tind1++
17037 0           ,data_datap += __tinc0_0
17038 0           ,mask_datap += __tinc0_1
17039 0           ,weight_datap += __tinc0_2
17040 0           ,rowids1_datap += __tinc0_3
17041 0           ,rowids2_datap += __tinc0_4
17042 0           ,dist_datap += __tinc0_5
17043             )
17044             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
17045 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
17046 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
17047             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
17048 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
17049 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17050 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17051 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
17052             1, 1,
17053             &rowid1, &rowid2,
17054 0           *__privtrans->distFlag, methodChar, transpose);
17055             }} PDL_COMMENT("Close ncmps")
17056            
17057             PDL_COMMENT("THREADLOOPEND")
17058             }
17059             }
17060 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
17061 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
17062 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
17063 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
17064 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
17065 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
17066 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
17067             /*-- cleanup --*/
17068 0 0         if (datapp) free(datapp);
17069 0 0         if (maskpp) free(maskpp);
17070              
17071 0           } } break; case PDL_F: {
17072 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17073 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17074              
17075 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17076 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17077              
17078 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17079 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17080              
17081 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17082 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17083              
17084 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17085 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17086              
17087 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17088 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17089              
17090 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17091 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17092 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17093 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
17094 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
17095 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17096 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17097 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
17098              
17099              
17100 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
17101 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
17102             int rowid1, rowid2;
17103 0           char methodChar = 'x'; /*-- doesnt matter --*/
17104 0           int transpose=0;
17105            
17106             PDL_COMMENT("THREADLOOPBEGIN")
17107 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
17108 0           do { register PDL_Indx __tind1=0,__tind2=0;
17109 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
17110 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
17111 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
17112 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
17113 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
17114 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
17115 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
17116 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
17117 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
17118 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
17119 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
17120 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
17121 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
17122 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
17123 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
17124 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
17125 0           data_datap += __offsp[0];
17126 0           mask_datap += __offsp[1];
17127 0           weight_datap += __offsp[2];
17128 0           rowids1_datap += __offsp[3];
17129 0           rowids2_datap += __offsp[4];
17130 0           dist_datap += __offsp[5];
17131 0 0         for( __tind2 = 0 ;
17132             __tind2 < __tdims1 ;
17133 0           __tind2++
17134 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
17135 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
17136 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
17137 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
17138 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
17139 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
17140             )
17141             {
17142 0 0         for( __tind1 = 0 ;
17143             __tind1 < __tdims0 ;
17144 0           __tind1++
17145 0           ,data_datap += __tinc0_0
17146 0           ,mask_datap += __tinc0_1
17147 0           ,weight_datap += __tinc0_2
17148 0           ,rowids1_datap += __tinc0_3
17149 0           ,rowids2_datap += __tinc0_4
17150 0           ,dist_datap += __tinc0_5
17151             )
17152             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
17153 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
17154 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
17155             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
17156 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
17157 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17158 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17159 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
17160             1, 1,
17161             &rowid1, &rowid2,
17162 0           *__privtrans->distFlag, methodChar, transpose);
17163             }} PDL_COMMENT("Close ncmps")
17164            
17165             PDL_COMMENT("THREADLOOPEND")
17166             }
17167             }
17168 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
17169 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
17170 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
17171 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
17172 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
17173 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
17174 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
17175             /*-- cleanup --*/
17176 0 0         if (datapp) free(datapp);
17177 0 0         if (maskpp) free(maskpp);
17178              
17179 0           } } break; case PDL_D: {
17180 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17181 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17182              
17183 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17184 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17185              
17186 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17187 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17188              
17189 0 0         PDL_Long * rowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17190 0           PDL_Long * rowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17191              
17192 0 0         PDL_Long * rowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17193 0           PDL_Long * rowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17194              
17195 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17196 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17197              
17198 0           {register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17199 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17200 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17201 0           register PDL_Indx __inc_rowids2_ncmps = __privtrans->__inc_rowids2_ncmps;
17202 0           register PDL_Indx __inc_rowids1_ncmps = __privtrans->__inc_rowids1_ncmps;
17203 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17204 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17205 0           register PDL_Indx __inc_dist_ncmps = __privtrans->__inc_dist_ncmps;
17206              
17207              
17208 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
17209 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
17210             int rowid1, rowid2;
17211 0           char methodChar = 'x'; /*-- doesnt matter --*/
17212 0           int transpose=0;
17213            
17214             PDL_COMMENT("THREADLOOPBEGIN")
17215 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
17216 0           do { register PDL_Indx __tind1=0,__tind2=0;
17217 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
17218 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
17219 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
17220 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
17221 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
17222 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
17223 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
17224 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
17225 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
17226 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
17227 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
17228 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
17229 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
17230 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
17231 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
17232 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
17233 0           data_datap += __offsp[0];
17234 0           mask_datap += __offsp[1];
17235 0           weight_datap += __offsp[2];
17236 0           rowids1_datap += __offsp[3];
17237 0           rowids2_datap += __offsp[4];
17238 0           dist_datap += __offsp[5];
17239 0 0         for( __tind2 = 0 ;
17240             __tind2 < __tdims1 ;
17241 0           __tind2++
17242 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
17243 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
17244 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
17245 0           ,rowids1_datap += __tinc1_3 - __tinc0_3 * __tdims0
17246 0           ,rowids2_datap += __tinc1_4 - __tinc0_4 * __tdims0
17247 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
17248             )
17249             {
17250 0 0         for( __tind1 = 0 ;
17251             __tind1 < __tdims0 ;
17252 0           __tind1++
17253 0           ,data_datap += __tinc0_0
17254 0           ,mask_datap += __tinc0_1
17255 0           ,weight_datap += __tinc0_2
17256 0           ,rowids1_datap += __tinc0_3
17257 0           ,rowids2_datap += __tinc0_4
17258 0           ,dist_datap += __tinc0_5
17259             )
17260             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
17261 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
17262 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
17263             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
17264 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
17265 0 0         rowid1 = (rowids1_datap)[0+(__inc_rowids1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17266 0 0         rowid2 = (rowids2_datap)[0+(__inc_rowids2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
17267 0 0         (dist_datap)[0+(__inc_dist_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
17268             1, 1,
17269             &rowid1, &rowid2,
17270 0           *__privtrans->distFlag, methodChar, transpose);
17271             }} PDL_COMMENT("Close ncmps")
17272            
17273             PDL_COMMENT("THREADLOOPEND")
17274             }
17275             }
17276 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
17277 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
17278 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
17279 0           rowids1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
17280 0           rowids2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
17281 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
17282 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
17283             /*-- cleanup --*/
17284 0 0         if (datapp) free(datapp);
17285 0 0         if (maskpp) free(maskpp);
17286              
17287 0           } break;}
17288 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
17289             }
17290             }
17291             }
17292            
17293              
17294              
17295              
17296 0           void pdl_rowdistances_free(pdl_trans *__tr ) {
17297             int __dim;
17298 0           pdl_rowdistances_struct *__privtrans = (pdl_rowdistances_struct *) __tr;
17299            
17300             {
17301            
17302 0           PDL_TR_CLRMAGIC(__privtrans);
17303 0           free(__privtrans->distFlag);;
17304 0 0         if(__privtrans->__ddone) {
17305 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
17306             ;;;;;;;;;;;;
17307             }
17308            
17309             }
17310 0           }
17311            
17312              
17313              
17314              
17315             static char pdl_rowdistances_vtable_flags[] =
17316             { 0,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
17317             pdl_transvtable pdl_rowdistances_vtable = {
17318             0,0, 5, 6, pdl_rowdistances_vtable_flags,
17319             pdl_rowdistances_redodims, pdl_rowdistances_readdata, NULL,
17320             pdl_rowdistances_free,NULL,NULL,pdl_rowdistances_copy,
17321             sizeof(pdl_rowdistances_struct),"pdl_rowdistances_vtable"
17322             };
17323              
17324             typedef struct pdl_clusterdistances_struct {
17325             PDL_TRANS_START(6);
17326             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_rowids_nr;PDL_Indx __inc_index2_n2;PDL_Indx __inc_dist_nr;PDL_Indx __n2_size;PDL_Indx __d_size;PDL_Indx __nr_size;PDL_Indx __n_size;
17327             char *distFlag;char *methodFlag;
17328             char __ddone; PDL_COMMENT("Dims done")
17329             } pdl_clusterdistances_struct;
17330              
17331 0           void pdl_clusterdistances_redodims(pdl_trans *__tr ) {
17332             int __dim;
17333 0           pdl_clusterdistances_struct *__privtrans = (pdl_clusterdistances_struct *) __tr;
17334            
17335             {
17336             PDL_Indx __creating[6];
17337 0           __privtrans->__n2_size = -1;
17338 0           __privtrans->__d_size = -1;
17339 0           __privtrans->__nr_size = -1;
17340 0           __privtrans->__n_size = -1;
17341 0           __creating[0] = 0;
17342 0           __creating[1] = 0;
17343 0           __creating[2] = 0;
17344 0           __creating[3] = 0;
17345 0           __creating[4] = 0;
17346 0 0         __creating[5] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[5]);
    0          
17347             {
17348             {PDL_COMMENT("Start generic loop")
17349              
17350 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
17351 0           } break; case PDL_B: {
17352 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17353 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17354              
17355 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17356 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17357              
17358 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17359 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17360              
17361 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17362 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17363              
17364 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17365 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17366              
17367 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17368 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17369              
17370 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17371 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17372 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17373 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17374 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17375 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17376 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17377 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17378              
17379             PDL_COMMENT("none")
17380 0           } } break; case PDL_S: {
17381 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17382 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17383              
17384 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17385 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17386              
17387 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17388 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17389              
17390 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17391 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17392              
17393 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17394 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17395              
17396 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17397 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17398              
17399 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17400 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17401 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17402 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17403 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17404 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17405 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17406 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17407              
17408             PDL_COMMENT("none")
17409 0           } } break; case PDL_US: {
17410 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17411 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17412              
17413 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17414 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17415              
17416 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17417 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17418              
17419 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17420 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17421              
17422 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17423 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17424              
17425 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17426 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17427              
17428 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17429 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17430 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17431 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17432 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17433 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17434 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17435 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17436              
17437             PDL_COMMENT("none")
17438 0           } } break; case PDL_L: {
17439 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17440 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17441              
17442 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17443 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17444              
17445 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17446 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17447              
17448 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17449 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17450              
17451 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17452 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17453              
17454 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17455 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17456              
17457 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17458 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17459 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17460 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17461 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17462 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17463 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17464 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17465              
17466             PDL_COMMENT("none")
17467 0           } } break; case PDL_IND: {
17468 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17469 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17470              
17471 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17472 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17473              
17474 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17475 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17476              
17477 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17478 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17479              
17480 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17481 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17482              
17483 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17484 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17485              
17486 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17487 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17488 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17489 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17490 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17491 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17492 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17493 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17494              
17495             PDL_COMMENT("none")
17496 0           } } break; case PDL_LL: {
17497 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17498 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17499              
17500 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17501 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17502              
17503 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17504 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17505              
17506 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17507 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17508              
17509 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17510 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17511              
17512 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17513 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17514              
17515 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17516 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17517 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17518 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17519 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17520 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17521 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17522 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17523              
17524             PDL_COMMENT("none")
17525 0           } } break; case PDL_F: {
17526 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17527 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17528              
17529 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17530 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17531              
17532 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17533 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17534              
17535 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17536 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17537              
17538 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17539 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17540              
17541 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17542 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17543              
17544 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17545 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17546 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17547 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17548 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17549 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17550 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17551 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17552              
17553             PDL_COMMENT("none")
17554 0           } } break; case PDL_D: {
17555 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17556 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17557              
17558 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17559 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17560              
17561 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17562 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17563              
17564 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17565 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17566              
17567 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17568 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17569              
17570 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17571 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17572              
17573 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17574 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17575 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17576 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17577 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17578 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17579 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17580 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17581              
17582             PDL_COMMENT("none")
17583 0           } break;}
17584 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
17585             }
17586             }
17587             {
17588             static char *__parnames[] = {"data","mask","weight","rowids","index2","dist"};
17589             static PDL_Indx __realdims[] = {2,2,1,1,1,1};
17590             static char __funcname[] = "PDL::Cluster::clusterdistances";
17591             static pdl_errorinfo __einfo = {
17592             __funcname, __parnames, 6
17593             };
17594            
17595 0           PDL->initthreadstruct(2,__privtrans->pdls,
17596             __realdims,__creating,6,
17597             &__einfo,&(__privtrans->__pdlthread),
17598 0           __privtrans->vtable->per_pdl_flags,
17599             0 );
17600             }
17601 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
17602 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
17603 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
17604             }
17605 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
17606 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
17607 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
17608 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
17609 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17610             }
17611             }
17612 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
17613 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
17614 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
17615 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
17616 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17617             }
17618             }
17619 0           PDL->make_physical(((__privtrans->pdls[0])));
17620 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
17621 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
17622 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
17623             }
17624 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
17625 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
17626 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
17627 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
17628 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17629             }
17630             }
17631 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
17632 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
17633 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
17634 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
17635 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17636             }
17637             }
17638 0           PDL->make_physical(((__privtrans->pdls[1])));
17639 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
17640 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
17641             }
17642 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
17643 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
17644 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
17645 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
17646 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17647             }
17648             }
17649 0           PDL->make_physical(((__privtrans->pdls[2])));
17650 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
17651 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
17652             }
17653 0 0         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
17654 0           __privtrans->__nr_size = ((__privtrans->pdls[3]))->dims[0];
17655 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
17656 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
17657 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17658             }
17659             }
17660 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
17661 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__n2_size <= 1) __privtrans->__n2_size = 1;
    0          
17662             }
17663 0 0         if(__privtrans->__n2_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__n2_size == 1)) {
    0          
    0          
17664 0           __privtrans->__n2_size = ((__privtrans->pdls[4]))->dims[0];
17665 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__n2_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
17666 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
17667 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17668             }
17669             }
17670 0           PDL->make_physical(((__privtrans->pdls[4])));
17671 0 0         if(!__creating[5]) {
17672 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
17673 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
17674             }
17675 0 0         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
17676 0           __privtrans->__nr_size = ((__privtrans->pdls[5]))->dims[0];
17677 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
17678 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
17679 0           PDL->pdl_barf("Error in clusterdistances:" "Wrong dims\n");
17680             }
17681             }
17682             } else {
17683 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__nr_size;
17684 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,5,dims,0);
17685             }
17686             { PDL_COMMENT("convenience block")
17687 0           void *hdrp = NULL;
17688 0           char propagate_hdrcpy = 0;
17689 0           SV *hdr_copy = NULL;
17690 0 0         if(!hdrp &&
    0          
17691 0 0         __privtrans->pdls[0]->hdrsv &&
17692 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
17693             ) {
17694 0           hdrp = __privtrans->pdls[0]->hdrsv;
17695 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
17696             }
17697 0 0         if(!hdrp &&
    0          
17698 0 0         __privtrans->pdls[1]->hdrsv &&
17699 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
17700             ) {
17701 0           hdrp = __privtrans->pdls[1]->hdrsv;
17702 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
17703             }
17704 0 0         if(!hdrp &&
    0          
17705 0 0         __privtrans->pdls[2]->hdrsv &&
17706 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
17707             ) {
17708 0           hdrp = __privtrans->pdls[2]->hdrsv;
17709 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
17710             }
17711 0 0         if(!hdrp &&
    0          
17712 0 0         __privtrans->pdls[3]->hdrsv &&
17713 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
17714             ) {
17715 0           hdrp = __privtrans->pdls[3]->hdrsv;
17716 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
17717             }
17718 0 0         if(!hdrp &&
    0          
17719 0 0         __privtrans->pdls[4]->hdrsv &&
17720 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
17721             ) {
17722 0           hdrp = __privtrans->pdls[4]->hdrsv;
17723 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
17724             }
17725 0 0         if(!hdrp &&
    0          
17726 0 0         !__creating[5] &&
17727 0 0         __privtrans->pdls[5]->hdrsv &&
17728 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
17729             ) {
17730 0           hdrp = __privtrans->pdls[5]->hdrsv;
17731 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
17732             }
17733 0 0         if (hdrp) {
17734 0 0         if(hdrp == &PL_sv_undef)
17735 0           hdr_copy = &PL_sv_undef;
17736             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
17737             int count;
17738             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
17739 0           dSP;
17740 0           ENTER ;
17741 0           SAVETMPS ;
17742 0 0         PUSHMARK(SP) ;
17743 0 0         XPUSHs( hdrp );
17744 0           PUTBACK ;
17745 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
17746 0           SPAGAIN ;
17747 0 0         if(count != 1)
17748 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
17749              
17750 0           hdr_copy = (SV *)POPs;
17751              
17752 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
17753 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
17754             }
17755              
17756 0 0         FREETMPS ;
17757 0           LEAVE ;
17758              
17759              
17760             } PDL_COMMENT("end of callback block")
17761              
17762 0 0         if ( __privtrans->pdls[5]->hdrsv != hdrp ){
17763 0 0         if( __privtrans->pdls[5]->hdrsv && __privtrans->pdls[5]->hdrsv != &PL_sv_undef)
    0          
17764 0           (void)SvREFCNT_dec( __privtrans->pdls[5]->hdrsv );
17765 0 0         if( hdr_copy != &PL_sv_undef )
17766 0           (void)SvREFCNT_inc(hdr_copy);
17767 0           __privtrans->pdls[5]->hdrsv = hdr_copy;
17768             }
17769 0 0         if(propagate_hdrcpy)
17770 0           __privtrans->pdls[5]->state |= PDL_HDRCPY;
17771              
17772 0 0         if(hdr_copy != &PL_sv_undef)
17773 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
17774             } PDL_COMMENT("end of if(hdrp) block")
17775             } PDL_COMMENT("end of conv. block")
17776 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
17777 0           __privtrans->__inc_data_d = 0; else
17778 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
17779 0           __privtrans->__inc_data_n = 0; else
17780 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
17781 0           __privtrans->__inc_mask_d = 0; else
17782 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
17783 0           __privtrans->__inc_mask_n = 0; else
17784 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
17785 0           __privtrans->__inc_weight_d = 0; else
17786 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
17787 0           __privtrans->__inc_rowids_nr = 0; else
17788 0 0         __privtrans->__inc_rowids_nr = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
17789 0           __privtrans->__inc_index2_n2 = 0; else
17790 0 0         __privtrans->__inc_index2_n2 = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
17791 0           __privtrans->__inc_dist_nr = 0; else
17792 0 0         __privtrans->__inc_dist_nr = PDL_REPRINC(__privtrans->pdls[5],0); __privtrans->__ddone = 1;
17793             }
17794 0           }
17795            
17796              
17797 0           pdl_trans * pdl_clusterdistances_copy(pdl_trans *__tr ) {
17798             int __dim;
17799 0           pdl_clusterdistances_struct *__privtrans = (pdl_clusterdistances_struct *) __tr;
17800            
17801             {
17802 0           pdl_clusterdistances_struct *__copy = malloc(sizeof(pdl_clusterdistances_struct));
17803 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
17804 0           __copy->has_badvalue = __privtrans->has_badvalue;
17805 0           __copy->badvalue = __privtrans->badvalue;
17806 0           __copy->flags = __privtrans->flags;
17807 0           __copy->vtable = __privtrans->vtable;
17808 0           __copy->__datatype = __privtrans->__datatype;
17809 0           __copy->freeproc = NULL;
17810 0           __copy->__ddone = __privtrans->__ddone;
17811             {int i;
17812 0 0         for(i=0; i<__copy->vtable->npdls; i++)
17813 0           __copy->pdls[i] = __privtrans->pdls[i];
17814             }
17815 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
17816 0 0         if(__copy->__ddone) {
17817 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_rowids_nr=__copy->__inc_rowids_nr;__privtrans->__inc_index2_n2=__copy->__inc_index2_n2;__privtrans->__inc_dist_nr=__copy->__inc_dist_nr;__copy->__n2_size=__privtrans->__n2_size;__copy->__d_size=__privtrans->__d_size;__copy->__nr_size=__privtrans->__nr_size;__copy->__n_size=__privtrans->__n_size;
17818             }
17819 0           return (pdl_trans*)__copy;
17820             }
17821             }
17822            
17823              
17824 0           void pdl_clusterdistances_readdata(pdl_trans *__tr ) {
17825             int __dim;
17826 0           pdl_clusterdistances_struct *__privtrans = (pdl_clusterdistances_struct *) __tr;
17827            
17828             {
17829 0           {register PDL_Indx __nr_size = __privtrans->__nr_size;
17830             PDL_COMMENT("Start generic loop")
17831              
17832 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
17833 0           } break; case PDL_B: {
17834 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17835 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17836              
17837 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17838 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17839              
17840 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17841 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17842              
17843 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17844 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17845              
17846 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17847 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17848              
17849 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17850 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17851              
17852 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17853 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17854 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17855 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17856 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17857 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17858 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17859 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17860              
17861              
17862 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
17863 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
17864 0           int transpose=0;
17865            
17866             PDL_COMMENT("THREADLOOPBEGIN")
17867 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
17868 0           do { register PDL_Indx __tind1=0,__tind2=0;
17869 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
17870 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
17871 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
17872 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
17873 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
17874 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
17875 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
17876 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
17877 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
17878 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
17879 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
17880 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
17881 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
17882 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
17883 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
17884 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
17885 0           data_datap += __offsp[0];
17886 0           mask_datap += __offsp[1];
17887 0           weight_datap += __offsp[2];
17888 0           rowids_datap += __offsp[3];
17889 0           index2_datap += __offsp[4];
17890 0           dist_datap += __offsp[5];
17891 0 0         for( __tind2 = 0 ;
17892             __tind2 < __tdims1 ;
17893 0           __tind2++
17894 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
17895 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
17896 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
17897 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
17898 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
17899 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
17900             )
17901             {
17902 0 0         for( __tind1 = 0 ;
17903             __tind1 < __tdims0 ;
17904 0           __tind1++
17905 0           ,data_datap += __tinc0_0
17906 0           ,mask_datap += __tinc0_1
17907 0           ,weight_datap += __tinc0_2
17908 0           ,rowids_datap += __tinc0_3
17909 0           ,index2_datap += __tinc0_4
17910 0           ,dist_datap += __tinc0_5
17911             )
17912             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
17913 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
17914 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
17915             {PDL_COMMENT("Open nr") register PDL_Indx nr;
17916 0 0         for(nr=0; nr<(__nr_size); nr++) {
17917 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
17918 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
17919 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
17920             }} PDL_COMMENT("Close nr")
17921            
17922             PDL_COMMENT("THREADLOOPEND")
17923             }
17924             }
17925 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
17926 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
17927 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
17928 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
17929 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
17930 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
17931 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
17932             /*-- cleanup --*/
17933 0 0         if (datapp) free(datapp);
17934 0 0         if (maskpp) free(maskpp);
17935              
17936 0           } } break; case PDL_S: {
17937 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
17938 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
17939              
17940 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
17941 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
17942              
17943 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
17944 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
17945              
17946 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
17947 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
17948              
17949 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
17950 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
17951              
17952 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
17953 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
17954              
17955 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
17956 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
17957 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
17958 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
17959 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
17960 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
17961 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
17962 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
17963              
17964              
17965 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
17966 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
17967 0           int transpose=0;
17968            
17969             PDL_COMMENT("THREADLOOPBEGIN")
17970 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
17971 0           do { register PDL_Indx __tind1=0,__tind2=0;
17972 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
17973 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
17974 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
17975 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
17976 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
17977 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
17978 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
17979 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
17980 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
17981 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
17982 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
17983 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
17984 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
17985 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
17986 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
17987 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
17988 0           data_datap += __offsp[0];
17989 0           mask_datap += __offsp[1];
17990 0           weight_datap += __offsp[2];
17991 0           rowids_datap += __offsp[3];
17992 0           index2_datap += __offsp[4];
17993 0           dist_datap += __offsp[5];
17994 0 0         for( __tind2 = 0 ;
17995             __tind2 < __tdims1 ;
17996 0           __tind2++
17997 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
17998 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
17999 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18000 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18001 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18002 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18003             )
18004             {
18005 0 0         for( __tind1 = 0 ;
18006             __tind1 < __tdims0 ;
18007 0           __tind1++
18008 0           ,data_datap += __tinc0_0
18009 0           ,mask_datap += __tinc0_1
18010 0           ,weight_datap += __tinc0_2
18011 0           ,rowids_datap += __tinc0_3
18012 0           ,index2_datap += __tinc0_4
18013 0           ,dist_datap += __tinc0_5
18014             )
18015             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18016 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18017 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18018             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18019 0 0         for(nr=0; nr<(__nr_size); nr++) {
18020 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18021 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18022 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18023             }} PDL_COMMENT("Close nr")
18024            
18025             PDL_COMMENT("THREADLOOPEND")
18026             }
18027             }
18028 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18029 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18030 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18031 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18032 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18033 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18034 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18035             /*-- cleanup --*/
18036 0 0         if (datapp) free(datapp);
18037 0 0         if (maskpp) free(maskpp);
18038              
18039 0           } } break; case PDL_US: {
18040 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18041 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18042              
18043 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18044 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18045              
18046 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18047 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18048              
18049 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18050 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18051              
18052 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18053 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18054              
18055 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18056 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18057              
18058 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18059 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18060 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18061 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18062 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18063 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18064 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18065 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18066              
18067              
18068 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18069 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18070 0           int transpose=0;
18071            
18072             PDL_COMMENT("THREADLOOPBEGIN")
18073 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18074 0           do { register PDL_Indx __tind1=0,__tind2=0;
18075 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18076 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18077 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18078 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18079 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18080 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18081 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18082 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18083 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18084 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18085 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18086 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18087 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18088 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18089 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18090 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18091 0           data_datap += __offsp[0];
18092 0           mask_datap += __offsp[1];
18093 0           weight_datap += __offsp[2];
18094 0           rowids_datap += __offsp[3];
18095 0           index2_datap += __offsp[4];
18096 0           dist_datap += __offsp[5];
18097 0 0         for( __tind2 = 0 ;
18098             __tind2 < __tdims1 ;
18099 0           __tind2++
18100 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18101 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18102 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18103 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18104 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18105 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18106             )
18107             {
18108 0 0         for( __tind1 = 0 ;
18109             __tind1 < __tdims0 ;
18110 0           __tind1++
18111 0           ,data_datap += __tinc0_0
18112 0           ,mask_datap += __tinc0_1
18113 0           ,weight_datap += __tinc0_2
18114 0           ,rowids_datap += __tinc0_3
18115 0           ,index2_datap += __tinc0_4
18116 0           ,dist_datap += __tinc0_5
18117             )
18118             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18119 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18120 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18121             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18122 0 0         for(nr=0; nr<(__nr_size); nr++) {
18123 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18124 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18125 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18126             }} PDL_COMMENT("Close nr")
18127            
18128             PDL_COMMENT("THREADLOOPEND")
18129             }
18130             }
18131 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18132 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18133 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18134 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18135 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18136 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18137 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18138             /*-- cleanup --*/
18139 0 0         if (datapp) free(datapp);
18140 0 0         if (maskpp) free(maskpp);
18141              
18142 0           } } break; case PDL_L: {
18143 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18144 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18145              
18146 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18147 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18148              
18149 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18150 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18151              
18152 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18153 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18154              
18155 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18156 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18157              
18158 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18159 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18160              
18161 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18162 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18163 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18164 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18165 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18166 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18167 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18168 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18169              
18170              
18171 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18172 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18173 0           int transpose=0;
18174            
18175             PDL_COMMENT("THREADLOOPBEGIN")
18176 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18177 0           do { register PDL_Indx __tind1=0,__tind2=0;
18178 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18179 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18180 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18181 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18182 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18183 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18184 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18185 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18186 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18187 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18188 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18189 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18190 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18191 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18192 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18193 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18194 0           data_datap += __offsp[0];
18195 0           mask_datap += __offsp[1];
18196 0           weight_datap += __offsp[2];
18197 0           rowids_datap += __offsp[3];
18198 0           index2_datap += __offsp[4];
18199 0           dist_datap += __offsp[5];
18200 0 0         for( __tind2 = 0 ;
18201             __tind2 < __tdims1 ;
18202 0           __tind2++
18203 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18204 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18205 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18206 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18207 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18208 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18209             )
18210             {
18211 0 0         for( __tind1 = 0 ;
18212             __tind1 < __tdims0 ;
18213 0           __tind1++
18214 0           ,data_datap += __tinc0_0
18215 0           ,mask_datap += __tinc0_1
18216 0           ,weight_datap += __tinc0_2
18217 0           ,rowids_datap += __tinc0_3
18218 0           ,index2_datap += __tinc0_4
18219 0           ,dist_datap += __tinc0_5
18220             )
18221             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18222 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18223 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18224             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18225 0 0         for(nr=0; nr<(__nr_size); nr++) {
18226 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18227 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18228 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18229             }} PDL_COMMENT("Close nr")
18230            
18231             PDL_COMMENT("THREADLOOPEND")
18232             }
18233             }
18234 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18235 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18236 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18237 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18238 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18239 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18240 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18241             /*-- cleanup --*/
18242 0 0         if (datapp) free(datapp);
18243 0 0         if (maskpp) free(maskpp);
18244              
18245 0           } } break; case PDL_IND: {
18246 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18247 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18248              
18249 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18250 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18251              
18252 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18253 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18254              
18255 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18256 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18257              
18258 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18259 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18260              
18261 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18262 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18263              
18264 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18265 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18266 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18267 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18268 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18269 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18270 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18271 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18272              
18273              
18274 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18275 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18276 0           int transpose=0;
18277            
18278             PDL_COMMENT("THREADLOOPBEGIN")
18279 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18280 0           do { register PDL_Indx __tind1=0,__tind2=0;
18281 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18282 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18283 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18284 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18285 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18286 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18287 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18288 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18289 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18290 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18291 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18292 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18293 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18294 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18295 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18296 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18297 0           data_datap += __offsp[0];
18298 0           mask_datap += __offsp[1];
18299 0           weight_datap += __offsp[2];
18300 0           rowids_datap += __offsp[3];
18301 0           index2_datap += __offsp[4];
18302 0           dist_datap += __offsp[5];
18303 0 0         for( __tind2 = 0 ;
18304             __tind2 < __tdims1 ;
18305 0           __tind2++
18306 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18307 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18308 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18309 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18310 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18311 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18312             )
18313             {
18314 0 0         for( __tind1 = 0 ;
18315             __tind1 < __tdims0 ;
18316 0           __tind1++
18317 0           ,data_datap += __tinc0_0
18318 0           ,mask_datap += __tinc0_1
18319 0           ,weight_datap += __tinc0_2
18320 0           ,rowids_datap += __tinc0_3
18321 0           ,index2_datap += __tinc0_4
18322 0           ,dist_datap += __tinc0_5
18323             )
18324             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18325 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18326 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18327             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18328 0 0         for(nr=0; nr<(__nr_size); nr++) {
18329 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18330 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18331 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18332             }} PDL_COMMENT("Close nr")
18333            
18334             PDL_COMMENT("THREADLOOPEND")
18335             }
18336             }
18337 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18338 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18339 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18340 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18341 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18342 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18343 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18344             /*-- cleanup --*/
18345 0 0         if (datapp) free(datapp);
18346 0 0         if (maskpp) free(maskpp);
18347              
18348 0           } } break; case PDL_LL: {
18349 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18350 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18351              
18352 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18353 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18354              
18355 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18356 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18357              
18358 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18359 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18360              
18361 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18362 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18363              
18364 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18365 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18366              
18367 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18368 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18369 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18370 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18371 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18372 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18373 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18374 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18375              
18376              
18377 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18378 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18379 0           int transpose=0;
18380            
18381             PDL_COMMENT("THREADLOOPBEGIN")
18382 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18383 0           do { register PDL_Indx __tind1=0,__tind2=0;
18384 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18385 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18386 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18387 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18388 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18389 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18390 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18391 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18392 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18393 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18394 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18395 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18396 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18397 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18398 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18399 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18400 0           data_datap += __offsp[0];
18401 0           mask_datap += __offsp[1];
18402 0           weight_datap += __offsp[2];
18403 0           rowids_datap += __offsp[3];
18404 0           index2_datap += __offsp[4];
18405 0           dist_datap += __offsp[5];
18406 0 0         for( __tind2 = 0 ;
18407             __tind2 < __tdims1 ;
18408 0           __tind2++
18409 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18410 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18411 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18412 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18413 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18414 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18415             )
18416             {
18417 0 0         for( __tind1 = 0 ;
18418             __tind1 < __tdims0 ;
18419 0           __tind1++
18420 0           ,data_datap += __tinc0_0
18421 0           ,mask_datap += __tinc0_1
18422 0           ,weight_datap += __tinc0_2
18423 0           ,rowids_datap += __tinc0_3
18424 0           ,index2_datap += __tinc0_4
18425 0           ,dist_datap += __tinc0_5
18426             )
18427             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18428 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18429 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18430             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18431 0 0         for(nr=0; nr<(__nr_size); nr++) {
18432 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18433 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18434 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18435             }} PDL_COMMENT("Close nr")
18436            
18437             PDL_COMMENT("THREADLOOPEND")
18438             }
18439             }
18440 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18441 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18442 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18443 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18444 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18445 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18446 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18447             /*-- cleanup --*/
18448 0 0         if (datapp) free(datapp);
18449 0 0         if (maskpp) free(maskpp);
18450              
18451 0           } } break; case PDL_F: {
18452 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18453 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18454              
18455 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18456 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18457              
18458 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18459 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18460              
18461 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18462 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18463              
18464 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18465 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18466              
18467 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18468 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18469              
18470 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18471 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18472 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18473 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18474 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18475 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18476 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18477 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18478              
18479              
18480 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18481 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18482 0           int transpose=0;
18483            
18484             PDL_COMMENT("THREADLOOPBEGIN")
18485 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18486 0           do { register PDL_Indx __tind1=0,__tind2=0;
18487 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18488 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18489 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18490 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18491 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18492 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18493 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18494 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18495 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18496 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18497 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18498 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18499 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18500 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18501 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18502 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18503 0           data_datap += __offsp[0];
18504 0           mask_datap += __offsp[1];
18505 0           weight_datap += __offsp[2];
18506 0           rowids_datap += __offsp[3];
18507 0           index2_datap += __offsp[4];
18508 0           dist_datap += __offsp[5];
18509 0 0         for( __tind2 = 0 ;
18510             __tind2 < __tdims1 ;
18511 0           __tind2++
18512 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18513 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18514 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18515 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18516 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18517 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18518             )
18519             {
18520 0 0         for( __tind1 = 0 ;
18521             __tind1 < __tdims0 ;
18522 0           __tind1++
18523 0           ,data_datap += __tinc0_0
18524 0           ,mask_datap += __tinc0_1
18525 0           ,weight_datap += __tinc0_2
18526 0           ,rowids_datap += __tinc0_3
18527 0           ,index2_datap += __tinc0_4
18528 0           ,dist_datap += __tinc0_5
18529             )
18530             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18531 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18532 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18533             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18534 0 0         for(nr=0; nr<(__nr_size); nr++) {
18535 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18536 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18537 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18538             }} PDL_COMMENT("Close nr")
18539            
18540             PDL_COMMENT("THREADLOOPEND")
18541             }
18542             }
18543 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18544 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18545 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18546 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18547 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18548 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18549 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18550             /*-- cleanup --*/
18551 0 0         if (datapp) free(datapp);
18552 0 0         if (maskpp) free(maskpp);
18553              
18554 0           } } break; case PDL_D: {
18555 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18556 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
18557              
18558 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18559 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18560              
18561 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
18562 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
18563              
18564 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
18565 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
18566              
18567 0 0         PDL_Long * index2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
18568 0           PDL_Long * index2_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
18569              
18570 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
18571 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[5])->data));
18572              
18573 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
18574 0           register PDL_Indx __inc_index2_n2 = __privtrans->__inc_index2_n2;
18575 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
18576 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
18577 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
18578 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
18579 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
18580 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
18581              
18582              
18583 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
18584 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
18585 0           int transpose=0;
18586            
18587             PDL_COMMENT("THREADLOOPBEGIN")
18588 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
18589 0           do { register PDL_Indx __tind1=0,__tind2=0;
18590 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
18591 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
18592 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
18593 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
18594 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
18595 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
18596 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
18597 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
18598 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
18599 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
18600 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
18601 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
18602 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
18603 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
18604 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
18605 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
18606 0           data_datap += __offsp[0];
18607 0           mask_datap += __offsp[1];
18608 0           weight_datap += __offsp[2];
18609 0           rowids_datap += __offsp[3];
18610 0           index2_datap += __offsp[4];
18611 0           dist_datap += __offsp[5];
18612 0 0         for( __tind2 = 0 ;
18613             __tind2 < __tdims1 ;
18614 0           __tind2++
18615 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
18616 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
18617 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
18618 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
18619 0           ,index2_datap += __tinc1_4 - __tinc0_4 * __tdims0
18620 0           ,dist_datap += __tinc1_5 - __tinc0_5 * __tdims0
18621             )
18622             {
18623 0 0         for( __tind1 = 0 ;
18624             __tind1 < __tdims0 ;
18625 0           __tind1++
18626 0           ,data_datap += __tinc0_0
18627 0           ,mask_datap += __tinc0_1
18628 0           ,weight_datap += __tinc0_2
18629 0           ,rowids_datap += __tinc0_3
18630 0           ,index2_datap += __tinc0_4
18631 0           ,dist_datap += __tinc0_5
18632             )
18633             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
18634 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
18635 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
18636             {PDL_COMMENT("Open nr") register PDL_Indx nr;
18637 0 0         for(nr=0; nr<(__nr_size); nr++) {
18638 0 0         (dist_datap)[0+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
18639 0 0         1, __privtrans->__n2_size, &((rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ), index2_datap,
18640 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
18641             }} PDL_COMMENT("Close nr")
18642            
18643             PDL_COMMENT("THREADLOOPEND")
18644             }
18645             }
18646 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
18647 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
18648 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
18649 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
18650 0           index2_datap -= __tinc1_4 * __tdims1 + __offsp[4];
18651 0           dist_datap -= __tinc1_5 * __tdims1 + __offsp[5];
18652 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
18653             /*-- cleanup --*/
18654 0 0         if (datapp) free(datapp);
18655 0 0         if (maskpp) free(maskpp);
18656              
18657 0           } break;}
18658 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
18659             }
18660             }
18661             }
18662            
18663              
18664              
18665              
18666 0           void pdl_clusterdistances_free(pdl_trans *__tr ) {
18667             int __dim;
18668 0           pdl_clusterdistances_struct *__privtrans = (pdl_clusterdistances_struct *) __tr;
18669            
18670             {
18671            
18672 0           PDL_TR_CLRMAGIC(__privtrans);
18673 0           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
18674 0 0         if(__privtrans->__ddone) {
18675 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
18676             ;;;;;;;;;;;;;
18677             }
18678            
18679             }
18680 0           }
18681            
18682              
18683              
18684              
18685             static char pdl_clusterdistances_vtable_flags[] =
18686             { 0,0,0,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK};
18687             pdl_transvtable pdl_clusterdistances_vtable = {
18688             0,0, 5, 6, pdl_clusterdistances_vtable_flags,
18689             pdl_clusterdistances_redodims, pdl_clusterdistances_readdata, NULL,
18690             pdl_clusterdistances_free,NULL,NULL,pdl_clusterdistances_copy,
18691             sizeof(pdl_clusterdistances_struct),"pdl_clusterdistances_vtable"
18692             };
18693              
18694             typedef struct pdl_clustersizes_struct {
18695             PDL_TRANS_START(2);
18696             pdl_thread __pdlthread;PDL_Indx __inc_clusterids_n;PDL_Indx __inc_clustersizes_k;PDL_Indx __n_size;PDL_Indx __k_size;
18697            
18698             char __ddone; PDL_COMMENT("Dims done")
18699             } pdl_clustersizes_struct;
18700              
18701 1           void pdl_clustersizes_redodims(pdl_trans *__tr ) {
18702             int __dim;
18703 1           pdl_clustersizes_struct *__privtrans = (pdl_clustersizes_struct *) __tr;
18704            
18705             {
18706             PDL_Indx __creating[2];
18707 1           __privtrans->__n_size = -1;
18708 1           __privtrans->__k_size = -1;
18709 1           __creating[0] = 0;
18710 1 50         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
18711             {
18712             {PDL_COMMENT("Start generic loop")
18713              
18714 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
18715 0           } break; case PDL_B: {
18716 1 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18717 1           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18718 1           PDL_Long clusterids_badval = 0;
18719 1           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18720 1           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18721              
18722 1 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18723 1           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18724 1           PDL_Long clustersizes_badval = 0;
18725 1           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18726 1           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18727              
18728 1           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18729 1           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18730              
18731             PDL_COMMENT("none")
18732 1           } } break; case PDL_S: {
18733 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18734 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18735 0           PDL_Long clusterids_badval = 0;
18736 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18737 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18738              
18739 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18740 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18741 0           PDL_Long clustersizes_badval = 0;
18742 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18743 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18744              
18745 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18746 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18747              
18748             PDL_COMMENT("none")
18749 0           } } break; case PDL_US: {
18750 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18751 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18752 0           PDL_Long clusterids_badval = 0;
18753 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18754 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18755              
18756 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18757 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18758 0           PDL_Long clustersizes_badval = 0;
18759 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18760 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18761              
18762 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18763 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18764              
18765             PDL_COMMENT("none")
18766 0           } } break; case PDL_L: {
18767 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18768 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18769 0           PDL_Long clusterids_badval = 0;
18770 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18771 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18772              
18773 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18774 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18775 0           PDL_Long clustersizes_badval = 0;
18776 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18777 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18778              
18779 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18780 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18781              
18782             PDL_COMMENT("none")
18783 0           } } break; case PDL_IND: {
18784 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18785 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18786 0           PDL_Long clusterids_badval = 0;
18787 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18788 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18789              
18790 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18791 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18792 0           PDL_Long clustersizes_badval = 0;
18793 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18794 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18795              
18796 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18797 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18798              
18799             PDL_COMMENT("none")
18800 0           } } break; case PDL_LL: {
18801 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18802 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18803 0           PDL_Long clusterids_badval = 0;
18804 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18805 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18806              
18807 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18808 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18809 0           PDL_Long clustersizes_badval = 0;
18810 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18811 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18812              
18813 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18814 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18815              
18816             PDL_COMMENT("none")
18817 0           } } break; case PDL_F: {
18818 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18819 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18820 0           PDL_Long clusterids_badval = 0;
18821 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18822 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18823              
18824 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18825 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18826 0           PDL_Long clustersizes_badval = 0;
18827 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18828 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18829              
18830 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18831 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18832              
18833             PDL_COMMENT("none")
18834 0           } } break; case PDL_D: {
18835 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
18836 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
18837 0           PDL_Long clusterids_badval = 0;
18838 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
18839 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
18840              
18841 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
18842 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
18843 0           PDL_Long clustersizes_badval = 0;
18844 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
18845 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
18846              
18847 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
18848 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
18849              
18850             PDL_COMMENT("none")
18851 0           } break;}
18852 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
18853             }
18854             }
18855             {
18856             static char *__parnames[] = {"clusterids","clustersizes"};
18857             static PDL_Indx __realdims[] = {1,1};
18858             static char __funcname[] = "PDL::Cluster::clustersizes";
18859             static pdl_errorinfo __einfo = {
18860             __funcname, __parnames, 2
18861             };
18862            
18863 1           PDL->initthreadstruct(2,__privtrans->pdls,
18864             __realdims,__creating,2,
18865             &__einfo,&(__privtrans->__pdlthread),
18866 1           __privtrans->vtable->per_pdl_flags,
18867             0 );
18868             }
18869 1 50         if(((__privtrans->pdls[0]))->ndims < 1) {
18870 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
18871             }
18872 1 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
18873 1           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
18874 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
18875 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
18876 0           PDL->pdl_barf("Error in clustersizes:" "Wrong dims\n");
18877             }
18878             }
18879 1 50         if(!__creating[1]) {
18880 1 50         if(((__privtrans->pdls[1]))->ndims < 1) {
18881 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
18882             }
18883 1 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
18884 1           __privtrans->__k_size = ((__privtrans->pdls[1]))->dims[0];
18885 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
18886 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
18887 1           PDL->pdl_barf("Error in clustersizes:" "Wrong dims\n");
18888             }
18889             }
18890             } else {
18891 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
18892 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
18893             }
18894             { PDL_COMMENT("convenience block")
18895 1           void *hdrp = NULL;
18896 1           char propagate_hdrcpy = 0;
18897 1           SV *hdr_copy = NULL;
18898 1 50         if(!hdrp &&
    50          
18899 0 0         __privtrans->pdls[0]->hdrsv &&
18900 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
18901             ) {
18902 0           hdrp = __privtrans->pdls[0]->hdrsv;
18903 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
18904             }
18905 1 50         if(!hdrp &&
    50          
18906 1 50         !__creating[1] &&
18907 0 0         __privtrans->pdls[1]->hdrsv &&
18908 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
18909             ) {
18910 0           hdrp = __privtrans->pdls[1]->hdrsv;
18911 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
18912             }
18913 1 50         if (hdrp) {
18914 0 0         if(hdrp == &PL_sv_undef)
18915 0           hdr_copy = &PL_sv_undef;
18916             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
18917             int count;
18918             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
18919 0           dSP;
18920 0           ENTER ;
18921 0           SAVETMPS ;
18922 0 0         PUSHMARK(SP) ;
18923 0 0         XPUSHs( hdrp );
18924 0           PUTBACK ;
18925 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
18926 0           SPAGAIN ;
18927 0 0         if(count != 1)
18928 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
18929              
18930 0           hdr_copy = (SV *)POPs;
18931              
18932 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
18933 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
18934             }
18935              
18936 0 0         FREETMPS ;
18937 0           LEAVE ;
18938              
18939              
18940             } PDL_COMMENT("end of callback block")
18941              
18942 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
18943 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
18944 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
18945 0 0         if( hdr_copy != &PL_sv_undef )
18946 0           (void)SvREFCNT_inc(hdr_copy);
18947 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
18948             }
18949 0 0         if(propagate_hdrcpy)
18950 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
18951              
18952 0 0         if(hdr_copy != &PL_sv_undef)
18953 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
18954             } PDL_COMMENT("end of if(hdrp) block")
18955             } PDL_COMMENT("end of conv. block")
18956 1 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
18957 0           __privtrans->__inc_clusterids_n = 0; else
18958 1 50         __privtrans->__inc_clusterids_n = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
18959 0           __privtrans->__inc_clustersizes_k = 0; else
18960 1 50         __privtrans->__inc_clustersizes_k = PDL_REPRINC(__privtrans->pdls[1],0); __privtrans->__ddone = 1;
18961             }
18962 1           }
18963            
18964              
18965 0           pdl_trans * pdl_clustersizes_copy(pdl_trans *__tr ) {
18966             int __dim;
18967 0           pdl_clustersizes_struct *__privtrans = (pdl_clustersizes_struct *) __tr;
18968            
18969             {
18970 0           pdl_clustersizes_struct *__copy = malloc(sizeof(pdl_clustersizes_struct));
18971 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
18972 0           __copy->has_badvalue = __privtrans->has_badvalue;
18973 0           __copy->badvalue = __privtrans->badvalue;
18974 0           __copy->flags = __privtrans->flags;
18975 0           __copy->vtable = __privtrans->vtable;
18976 0           __copy->__datatype = __privtrans->__datatype;
18977 0           __copy->freeproc = NULL;
18978 0           __copy->__ddone = __privtrans->__ddone;
18979             {int i;
18980 0 0         for(i=0; i<__copy->vtable->npdls; i++)
18981 0           __copy->pdls[i] = __privtrans->pdls[i];
18982             }
18983            
18984 0 0         if(__copy->__ddone) {
18985 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__privtrans->__inc_clustersizes_k=__copy->__inc_clustersizes_k;__copy->__n_size=__privtrans->__n_size;__copy->__k_size=__privtrans->__k_size;
18986             }
18987 0           return (pdl_trans*)__copy;
18988             }
18989             }
18990            
18991              
18992 1           void pdl_clustersizes_readdata(pdl_trans *__tr ) {
18993             int __dim;
18994 1           pdl_clustersizes_struct *__privtrans = (pdl_clustersizes_struct *) __tr;
18995            
18996             {
18997 1           {register PDL_Indx __k_size = __privtrans->__k_size;
18998 1           register PDL_Indx __n_size = __privtrans->__n_size;
18999             PDL_COMMENT("Start generic loop")
19000              
19001 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
19002 0           } break; case PDL_B: {
19003 1 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19004 1           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19005 1           PDL_Long clusterids_badval = 0;
19006 1           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19007 1           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19008              
19009 1 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19010 1           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19011 1           PDL_Long clustersizes_badval = 0;
19012 1           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19013 1           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19014              
19015              
19016             PDL_COMMENT("THREADLOOPBEGIN")
19017 1 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19018 1           do { register PDL_Indx __tind1=0,__tind2=0;
19019 1           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19020 1           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19021 1           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19022 1           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19023 1           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19024 1           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19025 1           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19026 1           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19027 1           clusterids_datap += __offsp[0];
19028 1           clustersizes_datap += __offsp[1];
19029 2 100         for( __tind2 = 0 ;
19030             __tind2 < __tdims1 ;
19031 1           __tind2++
19032 1           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19033 1           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19034             )
19035             {
19036 2 100         for( __tind1 = 0 ;
19037             __tind1 < __tdims0 ;
19038 1           __tind1++
19039 1           ,clusterids_datap += __tinc0_0
19040 1           ,clustersizes_datap += __tinc0_1
19041             )
19042 1           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19043 1           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19044              
19045              
19046             int cid, csize;
19047             {PDL_COMMENT("Open k") register PDL_Indx k;
19048 3 50         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    100          
19049             {PDL_COMMENT("Open n") register PDL_Indx n;
19050 5 100         for(n=0; n<(__n_size); n++) {
19051 4 50         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19052 4 50         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    50          
    50          
19053 4 50         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19054             }} PDL_COMMENT("Close n")
19055              
19056             }
19057             PDL_COMMENT("THREADLOOPEND")
19058             }
19059             }
19060 1           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19061 1           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19062 1 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_S: {
19063 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19064 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19065 0           PDL_Long clusterids_badval = 0;
19066 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19067 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19068              
19069 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19070 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19071 0           PDL_Long clustersizes_badval = 0;
19072 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19073 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19074              
19075              
19076             PDL_COMMENT("THREADLOOPBEGIN")
19077 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19078 0           do { register PDL_Indx __tind1=0,__tind2=0;
19079 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19080 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19081 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19082 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19083 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19084 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19085 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19086 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19087 0           clusterids_datap += __offsp[0];
19088 0           clustersizes_datap += __offsp[1];
19089 0 0         for( __tind2 = 0 ;
19090             __tind2 < __tdims1 ;
19091 0           __tind2++
19092 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19093 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19094             )
19095             {
19096 0 0         for( __tind1 = 0 ;
19097             __tind1 < __tdims0 ;
19098 0           __tind1++
19099 0           ,clusterids_datap += __tinc0_0
19100 0           ,clustersizes_datap += __tinc0_1
19101             )
19102 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19103 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19104              
19105              
19106             int cid, csize;
19107             {PDL_COMMENT("Open k") register PDL_Indx k;
19108 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19109             {PDL_COMMENT("Open n") register PDL_Indx n;
19110 0 0         for(n=0; n<(__n_size); n++) {
19111 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19112 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19113 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19114             }} PDL_COMMENT("Close n")
19115              
19116             }
19117             PDL_COMMENT("THREADLOOPEND")
19118             }
19119             }
19120 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19121 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19122 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_US: {
19123 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19124 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19125 0           PDL_Long clusterids_badval = 0;
19126 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19127 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19128              
19129 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19130 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19131 0           PDL_Long clustersizes_badval = 0;
19132 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19133 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19134              
19135              
19136             PDL_COMMENT("THREADLOOPBEGIN")
19137 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19138 0           do { register PDL_Indx __tind1=0,__tind2=0;
19139 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19140 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19141 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19142 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19143 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19144 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19145 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19146 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19147 0           clusterids_datap += __offsp[0];
19148 0           clustersizes_datap += __offsp[1];
19149 0 0         for( __tind2 = 0 ;
19150             __tind2 < __tdims1 ;
19151 0           __tind2++
19152 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19153 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19154             )
19155             {
19156 0 0         for( __tind1 = 0 ;
19157             __tind1 < __tdims0 ;
19158 0           __tind1++
19159 0           ,clusterids_datap += __tinc0_0
19160 0           ,clustersizes_datap += __tinc0_1
19161             )
19162 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19163 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19164              
19165              
19166             int cid, csize;
19167             {PDL_COMMENT("Open k") register PDL_Indx k;
19168 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19169             {PDL_COMMENT("Open n") register PDL_Indx n;
19170 0 0         for(n=0; n<(__n_size); n++) {
19171 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19172 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19173 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19174             }} PDL_COMMENT("Close n")
19175              
19176             }
19177             PDL_COMMENT("THREADLOOPEND")
19178             }
19179             }
19180 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19181 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19182 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_L: {
19183 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19184 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19185 0           PDL_Long clusterids_badval = 0;
19186 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19187 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19188              
19189 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19190 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19191 0           PDL_Long clustersizes_badval = 0;
19192 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19193 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19194              
19195              
19196             PDL_COMMENT("THREADLOOPBEGIN")
19197 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19198 0           do { register PDL_Indx __tind1=0,__tind2=0;
19199 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19200 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19201 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19202 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19203 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19204 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19205 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19206 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19207 0           clusterids_datap += __offsp[0];
19208 0           clustersizes_datap += __offsp[1];
19209 0 0         for( __tind2 = 0 ;
19210             __tind2 < __tdims1 ;
19211 0           __tind2++
19212 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19213 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19214             )
19215             {
19216 0 0         for( __tind1 = 0 ;
19217             __tind1 < __tdims0 ;
19218 0           __tind1++
19219 0           ,clusterids_datap += __tinc0_0
19220 0           ,clustersizes_datap += __tinc0_1
19221             )
19222 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19223 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19224              
19225              
19226             int cid, csize;
19227             {PDL_COMMENT("Open k") register PDL_Indx k;
19228 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19229             {PDL_COMMENT("Open n") register PDL_Indx n;
19230 0 0         for(n=0; n<(__n_size); n++) {
19231 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19232 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19233 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19234             }} PDL_COMMENT("Close n")
19235              
19236             }
19237             PDL_COMMENT("THREADLOOPEND")
19238             }
19239             }
19240 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19241 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19242 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_IND: {
19243 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19244 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19245 0           PDL_Long clusterids_badval = 0;
19246 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19247 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19248              
19249 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19250 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19251 0           PDL_Long clustersizes_badval = 0;
19252 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19253 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19254              
19255              
19256             PDL_COMMENT("THREADLOOPBEGIN")
19257 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19258 0           do { register PDL_Indx __tind1=0,__tind2=0;
19259 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19260 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19261 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19262 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19263 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19264 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19265 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19266 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19267 0           clusterids_datap += __offsp[0];
19268 0           clustersizes_datap += __offsp[1];
19269 0 0         for( __tind2 = 0 ;
19270             __tind2 < __tdims1 ;
19271 0           __tind2++
19272 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19273 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19274             )
19275             {
19276 0 0         for( __tind1 = 0 ;
19277             __tind1 < __tdims0 ;
19278 0           __tind1++
19279 0           ,clusterids_datap += __tinc0_0
19280 0           ,clustersizes_datap += __tinc0_1
19281             )
19282 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19283 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19284              
19285              
19286             int cid, csize;
19287             {PDL_COMMENT("Open k") register PDL_Indx k;
19288 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19289             {PDL_COMMENT("Open n") register PDL_Indx n;
19290 0 0         for(n=0; n<(__n_size); n++) {
19291 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19292 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19293 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19294             }} PDL_COMMENT("Close n")
19295              
19296             }
19297             PDL_COMMENT("THREADLOOPEND")
19298             }
19299             }
19300 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19301 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19302 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_LL: {
19303 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19304 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19305 0           PDL_Long clusterids_badval = 0;
19306 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19307 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19308              
19309 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19310 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19311 0           PDL_Long clustersizes_badval = 0;
19312 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19313 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19314              
19315              
19316             PDL_COMMENT("THREADLOOPBEGIN")
19317 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19318 0           do { register PDL_Indx __tind1=0,__tind2=0;
19319 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19320 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19321 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19322 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19323 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19324 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19325 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19326 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19327 0           clusterids_datap += __offsp[0];
19328 0           clustersizes_datap += __offsp[1];
19329 0 0         for( __tind2 = 0 ;
19330             __tind2 < __tdims1 ;
19331 0           __tind2++
19332 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19333 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19334             )
19335             {
19336 0 0         for( __tind1 = 0 ;
19337             __tind1 < __tdims0 ;
19338 0           __tind1++
19339 0           ,clusterids_datap += __tinc0_0
19340 0           ,clustersizes_datap += __tinc0_1
19341             )
19342 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19343 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19344              
19345              
19346             int cid, csize;
19347             {PDL_COMMENT("Open k") register PDL_Indx k;
19348 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19349             {PDL_COMMENT("Open n") register PDL_Indx n;
19350 0 0         for(n=0; n<(__n_size); n++) {
19351 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19352 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19353 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19354             }} PDL_COMMENT("Close n")
19355              
19356             }
19357             PDL_COMMENT("THREADLOOPEND")
19358             }
19359             }
19360 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19361 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19362 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_F: {
19363 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19364 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19365 0           PDL_Long clusterids_badval = 0;
19366 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19367 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19368              
19369 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19370 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19371 0           PDL_Long clustersizes_badval = 0;
19372 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19373 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19374              
19375              
19376             PDL_COMMENT("THREADLOOPBEGIN")
19377 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19378 0           do { register PDL_Indx __tind1=0,__tind2=0;
19379 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19380 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19381 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19382 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19383 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19384 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19385 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19386 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19387 0           clusterids_datap += __offsp[0];
19388 0           clustersizes_datap += __offsp[1];
19389 0 0         for( __tind2 = 0 ;
19390             __tind2 < __tdims1 ;
19391 0           __tind2++
19392 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19393 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19394             )
19395             {
19396 0 0         for( __tind1 = 0 ;
19397             __tind1 < __tdims0 ;
19398 0           __tind1++
19399 0           ,clusterids_datap += __tinc0_0
19400 0           ,clustersizes_datap += __tinc0_1
19401             )
19402 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19403 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19404              
19405              
19406             int cid, csize;
19407             {PDL_COMMENT("Open k") register PDL_Indx k;
19408 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19409             {PDL_COMMENT("Open n") register PDL_Indx n;
19410 0 0         for(n=0; n<(__n_size); n++) {
19411 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19412 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19413 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19414             }} PDL_COMMENT("Close n")
19415              
19416             }
19417             PDL_COMMENT("THREADLOOPEND")
19418             }
19419             }
19420 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19421 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19422 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
19423 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19424 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19425 0           PDL_Long clusterids_badval = 0;
19426 0           PDL_Anyval clusterids_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[0]));
19427 0           ANYVAL_TO_CTYPE(clusterids_badval, PDL_Long, clusterids_anyval_badval);
19428              
19429 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19430 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19431 0           PDL_Long clustersizes_badval = 0;
19432 0           PDL_Anyval clustersizes_anyval_badval = PDL->get_pdl_badvalue((__privtrans->pdls[1]));
19433 0           ANYVAL_TO_CTYPE(clustersizes_badval, PDL_Long, clustersizes_anyval_badval);
19434              
19435              
19436             PDL_COMMENT("THREADLOOPBEGIN")
19437 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19438 0           do { register PDL_Indx __tind1=0,__tind2=0;
19439 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19440 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19441 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19442 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19443 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19444 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19445 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19446 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19447 0           clusterids_datap += __offsp[0];
19448 0           clustersizes_datap += __offsp[1];
19449 0 0         for( __tind2 = 0 ;
19450             __tind2 < __tdims1 ;
19451 0           __tind2++
19452 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19453 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19454             )
19455             {
19456 0 0         for( __tind1 = 0 ;
19457             __tind1 < __tdims0 ;
19458 0           __tind1++
19459 0           ,clusterids_datap += __tinc0_0
19460 0           ,clustersizes_datap += __tinc0_1
19461             )
19462 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19463 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19464              
19465              
19466             int cid, csize;
19467             {PDL_COMMENT("Open k") register PDL_Indx k;
19468 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19469             {PDL_COMMENT("Open n") register PDL_Indx n;
19470 0 0         for(n=0; n<(__n_size); n++) {
19471 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19472 0 0         if (cid < 0 || cid >= __privtrans->__k_size || cid == clusterids_badval) continue; /*-- sanity check --*/
    0          
    0          
19473 0 0         (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19474             }} PDL_COMMENT("Close n")
19475              
19476             }
19477             PDL_COMMENT("THREADLOOPEND")
19478             }
19479             }
19480 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19481 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19482 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
19483 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
19484             }
19485             }
19486             }
19487            
19488              
19489              
19490              
19491 1           void pdl_clustersizes_free(pdl_trans *__tr ) {
19492             int __dim;
19493 1           pdl_clustersizes_struct *__privtrans = (pdl_clustersizes_struct *) __tr;
19494            
19495             {
19496            
19497 1           PDL_TR_CLRMAGIC(__privtrans);
19498            
19499 1 50         if(__privtrans->__ddone) {
19500 1           PDL->freethreadloop(&(__privtrans->__pdlthread));
19501             ;;;;;
19502             }
19503            
19504             }
19505 1           }
19506            
19507              
19508              
19509              
19510             static char pdl_clustersizes_vtable_flags[] =
19511             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
19512             pdl_transvtable pdl_clustersizes_vtable = {
19513             0,0, 1, 2, pdl_clustersizes_vtable_flags,
19514             pdl_clustersizes_redodims, pdl_clustersizes_readdata, NULL,
19515             pdl_clustersizes_free,NULL,NULL,pdl_clustersizes_copy,
19516             sizeof(pdl_clustersizes_struct),"pdl_clustersizes_vtable"
19517             };
19518              
19519             typedef struct pdl_clusterelements_struct {
19520             PDL_TRANS_START(3);
19521             pdl_thread __pdlthread;PDL_Indx __inc_clusterids_n;PDL_Indx __inc_clustersizes_k;PDL_Indx __inc_eltids_mcsize;PDL_Indx __inc_eltids_k;PDL_Indx __k_size;PDL_Indx __n_size;PDL_Indx __mcsize_size;
19522            
19523             char __ddone; PDL_COMMENT("Dims done")
19524             } pdl_clusterelements_struct;
19525              
19526 1           void pdl_clusterelements_redodims(pdl_trans *__tr ) {
19527             int __dim;
19528 1           pdl_clusterelements_struct *__privtrans = (pdl_clusterelements_struct *) __tr;
19529            
19530             {
19531             PDL_Indx __creating[3];
19532 1           __privtrans->__k_size = -1;
19533 1           __privtrans->__n_size = -1;
19534 1           __privtrans->__mcsize_size = -1;
19535 1           __creating[0] = 0;
19536 1 50         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
19537 1 50         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    50          
19538             {
19539             {PDL_COMMENT("Start generic loop")
19540              
19541 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
19542 0           } break; case PDL_B: {
19543 1 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19544 1           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19545              
19546 1 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19547 1           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19548              
19549 1 50         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19550 1           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19551              
19552 1           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19553 1           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19554 1           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19555 1           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19556              
19557             PDL_COMMENT("none")
19558 1           } } break; case PDL_S: {
19559 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19560 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19561              
19562 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19563 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19564              
19565 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19566 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19567              
19568 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19569 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19570 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19571 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19572              
19573             PDL_COMMENT("none")
19574 0           } } break; case PDL_US: {
19575 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19576 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19577              
19578 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19579 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19580              
19581 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19582 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19583              
19584 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19585 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19586 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19587 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19588              
19589             PDL_COMMENT("none")
19590 0           } } break; case PDL_L: {
19591 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19592 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19593              
19594 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19595 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19596              
19597 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19598 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19599              
19600 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19601 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19602 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19603 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19604              
19605             PDL_COMMENT("none")
19606 0           } } break; case PDL_IND: {
19607 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19608 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19609              
19610 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19611 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19612              
19613 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19614 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19615              
19616 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19617 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19618 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19619 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19620              
19621             PDL_COMMENT("none")
19622 0           } } break; case PDL_LL: {
19623 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19624 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19625              
19626 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19627 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19628              
19629 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19630 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19631              
19632 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19633 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19634 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19635 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19636              
19637             PDL_COMMENT("none")
19638 0           } } break; case PDL_F: {
19639 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19640 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19641              
19642 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19643 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19644              
19645 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19646 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19647              
19648 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19649 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19650 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19651 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19652              
19653             PDL_COMMENT("none")
19654 0           } } break; case PDL_D: {
19655 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19656 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19657              
19658 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19659 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19660              
19661 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19662 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19663              
19664 0           {register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19665 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19666 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19667 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19668              
19669             PDL_COMMENT("none")
19670 0           } break;}
19671 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
19672             }
19673             }
19674             {
19675             static char *__parnames[] = {"clusterids","clustersizes","eltids"};
19676             static PDL_Indx __realdims[] = {1,1,2};
19677             static char __funcname[] = "PDL::Cluster::clusterelements";
19678             static pdl_errorinfo __einfo = {
19679             __funcname, __parnames, 3
19680             };
19681            
19682 1           PDL->initthreadstruct(2,__privtrans->pdls,
19683             __realdims,__creating,3,
19684             &__einfo,&(__privtrans->__pdlthread),
19685 1           __privtrans->vtable->per_pdl_flags,
19686             0 );
19687             }
19688 1 50         if(((__privtrans->pdls[0]))->ndims < 1) {
19689 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
19690             }
19691 1 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
19692 1           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
19693 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
19694 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
19695 0           PDL->pdl_barf("Error in clusterelements:" "Wrong dims\n");
19696             }
19697             }
19698 1 50         if(!__creating[1]) {
19699 1 50         if(((__privtrans->pdls[1]))->ndims < 1) {
19700 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
19701             }
19702 1 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
19703 1           __privtrans->__k_size = ((__privtrans->pdls[1]))->dims[0];
19704 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
19705 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
19706 1           PDL->pdl_barf("Error in clusterelements:" "Wrong dims\n");
19707             }
19708             }
19709             } else {
19710 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
19711 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
19712 1 50         }if(!__creating[2]) {
19713 1 50         if(((__privtrans->pdls[2]))->ndims < 2) {
19714 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__mcsize_size <= 1) __privtrans->__mcsize_size = 1;
    0          
19715 0 0         if (((__privtrans->pdls[2]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
19716             }
19717 1 50         if(__privtrans->__mcsize_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__mcsize_size == 1)) {
    0          
    0          
19718 1           __privtrans->__mcsize_size = ((__privtrans->pdls[2]))->dims[0];
19719 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__mcsize_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
19720 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
19721 0           PDL->pdl_barf("Error in clusterelements:" "Wrong dims\n");
19722             }
19723             }
19724 1 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__k_size == 1)) {
    50          
    50          
19725 0           __privtrans->__k_size = ((__privtrans->pdls[2]))->dims[1];
19726 1 50         } else if(((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[2]))->dims[1]) {
    50          
19727 0 0         if(((__privtrans->pdls[2]))->dims[1] != 1) {
19728 1           PDL->pdl_barf("Error in clusterelements:" "Wrong dims\n");
19729             }
19730             }
19731             } else {
19732 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__mcsize_size;dims[1] = __privtrans->__k_size;
19733 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,0);
19734             }
19735             { PDL_COMMENT("convenience block")
19736 1           void *hdrp = NULL;
19737 1           char propagate_hdrcpy = 0;
19738 1           SV *hdr_copy = NULL;
19739 1 50         if(!hdrp &&
    50          
19740 0 0         __privtrans->pdls[0]->hdrsv &&
19741 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
19742             ) {
19743 0           hdrp = __privtrans->pdls[0]->hdrsv;
19744 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
19745             }
19746 1 50         if(!hdrp &&
    50          
19747 1 50         !__creating[1] &&
19748 0 0         __privtrans->pdls[1]->hdrsv &&
19749 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
19750             ) {
19751 0           hdrp = __privtrans->pdls[1]->hdrsv;
19752 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
19753             }
19754 1 50         if(!hdrp &&
    50          
19755 1 50         !__creating[2] &&
19756 0 0         __privtrans->pdls[2]->hdrsv &&
19757 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
19758             ) {
19759 0           hdrp = __privtrans->pdls[2]->hdrsv;
19760 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
19761             }
19762 1 50         if (hdrp) {
19763 0 0         if(hdrp == &PL_sv_undef)
19764 0           hdr_copy = &PL_sv_undef;
19765             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
19766             int count;
19767             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
19768 0           dSP;
19769 0           ENTER ;
19770 0           SAVETMPS ;
19771 0 0         PUSHMARK(SP) ;
19772 0 0         XPUSHs( hdrp );
19773 0           PUTBACK ;
19774 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
19775 0           SPAGAIN ;
19776 0 0         if(count != 1)
19777 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
19778              
19779 0           hdr_copy = (SV *)POPs;
19780              
19781 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
19782 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
19783             }
19784              
19785 0 0         FREETMPS ;
19786 0           LEAVE ;
19787              
19788              
19789             } PDL_COMMENT("end of callback block")
19790              
19791 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
19792 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
19793 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
19794 0 0         if( hdr_copy != &PL_sv_undef )
19795 0           (void)SvREFCNT_inc(hdr_copy);
19796 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
19797             }
19798 0 0         if(propagate_hdrcpy)
19799 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
19800 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
19801 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
19802 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
19803 0 0         if( hdr_copy != &PL_sv_undef )
19804 0           (void)SvREFCNT_inc(hdr_copy);
19805 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
19806             }
19807 0 0         if(propagate_hdrcpy)
19808 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
19809              
19810 0 0         if(hdr_copy != &PL_sv_undef)
19811 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
19812             } PDL_COMMENT("end of if(hdrp) block")
19813             } PDL_COMMENT("end of conv. block")
19814 1 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
19815 0           __privtrans->__inc_clusterids_n = 0; else
19816 1 50         __privtrans->__inc_clusterids_n = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
    50          
19817 0           __privtrans->__inc_clustersizes_k = 0; else
19818 1 50         __privtrans->__inc_clustersizes_k = PDL_REPRINC(__privtrans->pdls[1],0);if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
    50          
19819 0           __privtrans->__inc_eltids_mcsize = 0; else
19820 1 50         __privtrans->__inc_eltids_mcsize = PDL_REPRINC(__privtrans->pdls[2],0);if(__privtrans->pdls[2]->ndims <= 1 || __privtrans->pdls[2]->dims[1] <= 1)
    50          
    50          
19821 0           __privtrans->__inc_eltids_k = 0; else
19822 1 50         __privtrans->__inc_eltids_k = PDL_REPRINC(__privtrans->pdls[2],1); __privtrans->__ddone = 1;
19823             }
19824 1           }
19825            
19826              
19827 0           pdl_trans * pdl_clusterelements_copy(pdl_trans *__tr ) {
19828             int __dim;
19829 0           pdl_clusterelements_struct *__privtrans = (pdl_clusterelements_struct *) __tr;
19830            
19831             {
19832 0           pdl_clusterelements_struct *__copy = malloc(sizeof(pdl_clusterelements_struct));
19833 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
19834 0           __copy->has_badvalue = __privtrans->has_badvalue;
19835 0           __copy->badvalue = __privtrans->badvalue;
19836 0           __copy->flags = __privtrans->flags;
19837 0           __copy->vtable = __privtrans->vtable;
19838 0           __copy->__datatype = __privtrans->__datatype;
19839 0           __copy->freeproc = NULL;
19840 0           __copy->__ddone = __privtrans->__ddone;
19841             {int i;
19842 0 0         for(i=0; i<__copy->vtable->npdls; i++)
19843 0           __copy->pdls[i] = __privtrans->pdls[i];
19844             }
19845            
19846 0 0         if(__copy->__ddone) {
19847 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__privtrans->__inc_clustersizes_k=__copy->__inc_clustersizes_k;__privtrans->__inc_eltids_mcsize=__copy->__inc_eltids_mcsize;__privtrans->__inc_eltids_k=__copy->__inc_eltids_k;__copy->__k_size=__privtrans->__k_size;__copy->__n_size=__privtrans->__n_size;__copy->__mcsize_size=__privtrans->__mcsize_size;
19848             }
19849 0           return (pdl_trans*)__copy;
19850             }
19851             }
19852            
19853              
19854 1           void pdl_clusterelements_readdata(pdl_trans *__tr ) {
19855             int __dim;
19856 1           pdl_clusterelements_struct *__privtrans = (pdl_clusterelements_struct *) __tr;
19857            
19858             {
19859 1           {register PDL_Indx __k_size = __privtrans->__k_size;
19860 1           register PDL_Indx __n_size = __privtrans->__n_size;
19861             PDL_COMMENT("Start generic loop")
19862              
19863 1           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
19864 0           } break; case PDL_B: {
19865 1 50         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19866 1           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19867              
19868 1 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19869 1           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19870              
19871 1 50         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19872 1           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19873              
19874              
19875             PDL_COMMENT("THREADLOOPBEGIN")
19876 1 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19877 1           do { register PDL_Indx __tind1=0,__tind2=0;
19878 1           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19879 1           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19880 1           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19881 1           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19882 1           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19883 1           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19884 1           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
19885 1           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19886 1           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19887 1           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
19888 1           clusterids_datap += __offsp[0];
19889 1           clustersizes_datap += __offsp[1];
19890 1           eltids_datap += __offsp[2];
19891 2 100         for( __tind2 = 0 ;
19892             __tind2 < __tdims1 ;
19893 1           __tind2++
19894 1           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19895 1           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19896 1           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
19897             )
19898             {
19899 2 100         for( __tind1 = 0 ;
19900             __tind1 < __tdims0 ;
19901 1           __tind1++
19902 1           ,clusterids_datap += __tinc0_0
19903 1           ,clustersizes_datap += __tinc0_1
19904 1           ,eltids_datap += __tinc0_2
19905             )
19906 1           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19907 1           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19908 1           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19909 1           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19910              
19911              
19912             int cid, csize;
19913             {PDL_COMMENT("Open k") register PDL_Indx k;
19914 3 50         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    100          
19915             {PDL_COMMENT("Open n") register PDL_Indx n;
19916 5 100         for(n=0; n<(__n_size); n++) {
19917 4 50         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19918 4 50         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19919 4 50         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    50          
19920             }} PDL_COMMENT("Close n")
19921              
19922             }
19923             PDL_COMMENT("THREADLOOPEND")
19924             }
19925             }
19926 1           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19927 1           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19928 1           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
19929 1 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_S: {
19930 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19931 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19932              
19933 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19934 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
19935              
19936 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
19937 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
19938              
19939              
19940             PDL_COMMENT("THREADLOOPBEGIN")
19941 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
19942 0           do { register PDL_Indx __tind1=0,__tind2=0;
19943 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
19944 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
19945 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
19946 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
19947 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
19948 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
19949 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
19950 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
19951 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
19952 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
19953 0           clusterids_datap += __offsp[0];
19954 0           clustersizes_datap += __offsp[1];
19955 0           eltids_datap += __offsp[2];
19956 0 0         for( __tind2 = 0 ;
19957             __tind2 < __tdims1 ;
19958 0           __tind2++
19959 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
19960 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
19961 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
19962             )
19963             {
19964 0 0         for( __tind1 = 0 ;
19965             __tind1 < __tdims0 ;
19966 0           __tind1++
19967 0           ,clusterids_datap += __tinc0_0
19968 0           ,clustersizes_datap += __tinc0_1
19969 0           ,eltids_datap += __tinc0_2
19970             )
19971 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
19972 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
19973 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
19974 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
19975              
19976              
19977             int cid, csize;
19978             {PDL_COMMENT("Open k") register PDL_Indx k;
19979 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
19980             {PDL_COMMENT("Open n") register PDL_Indx n;
19981 0 0         for(n=0; n<(__n_size); n++) {
19982 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
19983 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
19984 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
19985             }} PDL_COMMENT("Close n")
19986              
19987             }
19988             PDL_COMMENT("THREADLOOPEND")
19989             }
19990             }
19991 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
19992 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
19993 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
19994 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_US: {
19995 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
19996 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
19997              
19998 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
19999 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20000              
20001 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20002 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20003              
20004              
20005             PDL_COMMENT("THREADLOOPBEGIN")
20006 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20007 0           do { register PDL_Indx __tind1=0,__tind2=0;
20008 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20009 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20010 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20011 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20012 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20013 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20014 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20015 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20016 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20017 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20018 0           clusterids_datap += __offsp[0];
20019 0           clustersizes_datap += __offsp[1];
20020 0           eltids_datap += __offsp[2];
20021 0 0         for( __tind2 = 0 ;
20022             __tind2 < __tdims1 ;
20023 0           __tind2++
20024 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20025 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20026 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20027             )
20028             {
20029 0 0         for( __tind1 = 0 ;
20030             __tind1 < __tdims0 ;
20031 0           __tind1++
20032 0           ,clusterids_datap += __tinc0_0
20033 0           ,clustersizes_datap += __tinc0_1
20034 0           ,eltids_datap += __tinc0_2
20035             )
20036 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20037 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20038 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20039 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20040              
20041              
20042             int cid, csize;
20043             {PDL_COMMENT("Open k") register PDL_Indx k;
20044 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20045             {PDL_COMMENT("Open n") register PDL_Indx n;
20046 0 0         for(n=0; n<(__n_size); n++) {
20047 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20048 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20049 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20050             }} PDL_COMMENT("Close n")
20051              
20052             }
20053             PDL_COMMENT("THREADLOOPEND")
20054             }
20055             }
20056 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20057 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20058 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20059 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_L: {
20060 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20061 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20062              
20063 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20064 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20065              
20066 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20067 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20068              
20069              
20070             PDL_COMMENT("THREADLOOPBEGIN")
20071 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20072 0           do { register PDL_Indx __tind1=0,__tind2=0;
20073 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20074 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20075 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20076 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20077 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20078 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20079 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20080 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20081 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20082 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20083 0           clusterids_datap += __offsp[0];
20084 0           clustersizes_datap += __offsp[1];
20085 0           eltids_datap += __offsp[2];
20086 0 0         for( __tind2 = 0 ;
20087             __tind2 < __tdims1 ;
20088 0           __tind2++
20089 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20090 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20091 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20092             )
20093             {
20094 0 0         for( __tind1 = 0 ;
20095             __tind1 < __tdims0 ;
20096 0           __tind1++
20097 0           ,clusterids_datap += __tinc0_0
20098 0           ,clustersizes_datap += __tinc0_1
20099 0           ,eltids_datap += __tinc0_2
20100             )
20101 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20102 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20103 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20104 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20105              
20106              
20107             int cid, csize;
20108             {PDL_COMMENT("Open k") register PDL_Indx k;
20109 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20110             {PDL_COMMENT("Open n") register PDL_Indx n;
20111 0 0         for(n=0; n<(__n_size); n++) {
20112 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20113 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20114 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20115             }} PDL_COMMENT("Close n")
20116              
20117             }
20118             PDL_COMMENT("THREADLOOPEND")
20119             }
20120             }
20121 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20122 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20123 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20124 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_IND: {
20125 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20126 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20127              
20128 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20129 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20130              
20131 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20132 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20133              
20134              
20135             PDL_COMMENT("THREADLOOPBEGIN")
20136 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20137 0           do { register PDL_Indx __tind1=0,__tind2=0;
20138 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20139 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20140 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20141 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20142 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20143 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20144 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20145 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20146 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20147 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20148 0           clusterids_datap += __offsp[0];
20149 0           clustersizes_datap += __offsp[1];
20150 0           eltids_datap += __offsp[2];
20151 0 0         for( __tind2 = 0 ;
20152             __tind2 < __tdims1 ;
20153 0           __tind2++
20154 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20155 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20156 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20157             )
20158             {
20159 0 0         for( __tind1 = 0 ;
20160             __tind1 < __tdims0 ;
20161 0           __tind1++
20162 0           ,clusterids_datap += __tinc0_0
20163 0           ,clustersizes_datap += __tinc0_1
20164 0           ,eltids_datap += __tinc0_2
20165             )
20166 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20167 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20168 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20169 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20170              
20171              
20172             int cid, csize;
20173             {PDL_COMMENT("Open k") register PDL_Indx k;
20174 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20175             {PDL_COMMENT("Open n") register PDL_Indx n;
20176 0 0         for(n=0; n<(__n_size); n++) {
20177 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20178 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20179 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20180             }} PDL_COMMENT("Close n")
20181              
20182             }
20183             PDL_COMMENT("THREADLOOPEND")
20184             }
20185             }
20186 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20187 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20188 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20189 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_LL: {
20190 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20191 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20192              
20193 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20194 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20195              
20196 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20197 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20198              
20199              
20200             PDL_COMMENT("THREADLOOPBEGIN")
20201 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20202 0           do { register PDL_Indx __tind1=0,__tind2=0;
20203 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20204 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20205 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20206 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20207 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20208 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20209 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20210 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20211 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20212 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20213 0           clusterids_datap += __offsp[0];
20214 0           clustersizes_datap += __offsp[1];
20215 0           eltids_datap += __offsp[2];
20216 0 0         for( __tind2 = 0 ;
20217             __tind2 < __tdims1 ;
20218 0           __tind2++
20219 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20220 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20221 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20222             )
20223             {
20224 0 0         for( __tind1 = 0 ;
20225             __tind1 < __tdims0 ;
20226 0           __tind1++
20227 0           ,clusterids_datap += __tinc0_0
20228 0           ,clustersizes_datap += __tinc0_1
20229 0           ,eltids_datap += __tinc0_2
20230             )
20231 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20232 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20233 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20234 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20235              
20236              
20237             int cid, csize;
20238             {PDL_COMMENT("Open k") register PDL_Indx k;
20239 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20240             {PDL_COMMENT("Open n") register PDL_Indx n;
20241 0 0         for(n=0; n<(__n_size); n++) {
20242 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20243 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20244 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20245             }} PDL_COMMENT("Close n")
20246              
20247             }
20248             PDL_COMMENT("THREADLOOPEND")
20249             }
20250             }
20251 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20252 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20253 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20254 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_F: {
20255 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20256 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20257              
20258 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20259 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20260              
20261 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20262 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20263              
20264              
20265             PDL_COMMENT("THREADLOOPBEGIN")
20266 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20267 0           do { register PDL_Indx __tind1=0,__tind2=0;
20268 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20269 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20270 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20271 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20272 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20273 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20274 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20275 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20276 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20277 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20278 0           clusterids_datap += __offsp[0];
20279 0           clustersizes_datap += __offsp[1];
20280 0           eltids_datap += __offsp[2];
20281 0 0         for( __tind2 = 0 ;
20282             __tind2 < __tdims1 ;
20283 0           __tind2++
20284 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20285 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20286 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20287             )
20288             {
20289 0 0         for( __tind1 = 0 ;
20290             __tind1 < __tdims0 ;
20291 0           __tind1++
20292 0           ,clusterids_datap += __tinc0_0
20293 0           ,clustersizes_datap += __tinc0_1
20294 0           ,eltids_datap += __tinc0_2
20295             )
20296 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20297 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20298 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20299 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20300              
20301              
20302             int cid, csize;
20303             {PDL_COMMENT("Open k") register PDL_Indx k;
20304 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20305             {PDL_COMMENT("Open n") register PDL_Indx n;
20306 0 0         for(n=0; n<(__n_size); n++) {
20307 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20308 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20309 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20310             }} PDL_COMMENT("Close n")
20311              
20312             }
20313             PDL_COMMENT("THREADLOOPEND")
20314             }
20315             }
20316 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20317 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20318 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20319 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
20320 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20321 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20322              
20323 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20324 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
20325              
20326 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
20327 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
20328              
20329              
20330             PDL_COMMENT("THREADLOOPBEGIN")
20331 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20332 0           do { register PDL_Indx __tind1=0,__tind2=0;
20333 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20334 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20335 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20336 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20337 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20338 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20339 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
20340 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20341 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20342 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
20343 0           clusterids_datap += __offsp[0];
20344 0           clustersizes_datap += __offsp[1];
20345 0           eltids_datap += __offsp[2];
20346 0 0         for( __tind2 = 0 ;
20347             __tind2 < __tdims1 ;
20348 0           __tind2++
20349 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20350 0           ,clustersizes_datap += __tinc1_1 - __tinc0_1 * __tdims0
20351 0           ,eltids_datap += __tinc1_2 - __tinc0_2 * __tdims0
20352             )
20353             {
20354 0 0         for( __tind1 = 0 ;
20355             __tind1 < __tdims0 ;
20356 0           __tind1++
20357 0           ,clusterids_datap += __tinc0_0
20358 0           ,clustersizes_datap += __tinc0_1
20359 0           ,eltids_datap += __tinc0_2
20360             )
20361 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
20362 0           register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20363 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
20364 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
20365              
20366              
20367             int cid, csize;
20368             {PDL_COMMENT("Open k") register PDL_Indx k;
20369 0 0         for(k=0; k<(__k_size); k++) { (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
20370             {PDL_COMMENT("Open n") register PDL_Indx n;
20371 0 0         for(n=0; n<(__n_size); n++) {
20372 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20373 0 0         csize = (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") ++;
20374 0 0         (eltids_datap)[0+(__inc_eltids_mcsize*PP_INDTERM(__privtrans->__mcsize_size, csize))+(__inc_eltids_k*PP_INDTERM(__privtrans->__k_size, cid))] PDL_COMMENT("ACCESS()") = n;
    0          
20375             }} PDL_COMMENT("Close n")
20376              
20377             }
20378             PDL_COMMENT("THREADLOOPEND")
20379             }
20380             }
20381 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20382 0           clustersizes_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20383 0           eltids_datap -= __tinc1_2 * __tdims1 + __offsp[2];
20384 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
20385 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
20386             }
20387             }
20388             }
20389            
20390              
20391              
20392              
20393 1           void pdl_clusterelements_free(pdl_trans *__tr ) {
20394             int __dim;
20395 1           pdl_clusterelements_struct *__privtrans = (pdl_clusterelements_struct *) __tr;
20396            
20397             {
20398            
20399 1           PDL_TR_CLRMAGIC(__privtrans);
20400            
20401 1 50         if(__privtrans->__ddone) {
20402 1           PDL->freethreadloop(&(__privtrans->__pdlthread));
20403             ;;;;;;;;
20404             }
20405            
20406             }
20407 1           }
20408            
20409              
20410              
20411              
20412             static char pdl_clusterelements_vtable_flags[] =
20413             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
20414             pdl_transvtable pdl_clusterelements_vtable = {
20415             0,0, 1, 3, pdl_clusterelements_vtable_flags,
20416             pdl_clusterelements_redodims, pdl_clusterelements_readdata, NULL,
20417             pdl_clusterelements_free,NULL,NULL,pdl_clusterelements_copy,
20418             sizeof(pdl_clusterelements_struct),"pdl_clusterelements_vtable"
20419             };
20420              
20421             typedef struct pdl_clusterelementmask_struct {
20422             PDL_TRANS_START(2);
20423             pdl_thread __pdlthread;PDL_Indx __inc_clusterids_n;PDL_Indx __inc_eltmask_k;PDL_Indx __inc_eltmask_n;PDL_Indx __k_size;PDL_Indx __n_size;
20424            
20425             char __ddone; PDL_COMMENT("Dims done")
20426             } pdl_clusterelementmask_struct;
20427              
20428 0           void pdl_clusterelementmask_redodims(pdl_trans *__tr ) {
20429             int __dim;
20430 0           pdl_clusterelementmask_struct *__privtrans = (pdl_clusterelementmask_struct *) __tr;
20431            
20432             {
20433             PDL_Indx __creating[2];
20434 0           __privtrans->__k_size = -1;
20435 0           __privtrans->__n_size = -1;
20436 0           __creating[0] = 0;
20437 0 0         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
20438             {
20439             {PDL_COMMENT("Start generic loop")
20440              
20441 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
20442 0           } break; case PDL_B: {
20443 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20444 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20445              
20446 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20447 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20448              
20449 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20450 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20451 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20452              
20453             PDL_COMMENT("none")
20454 0           } } break; case PDL_S: {
20455 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20456 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20457              
20458 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20459 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20460              
20461 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20462 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20463 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20464              
20465             PDL_COMMENT("none")
20466 0           } } break; case PDL_US: {
20467 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20468 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20469              
20470 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20471 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20472              
20473 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20474 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20475 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20476              
20477             PDL_COMMENT("none")
20478 0           } } break; case PDL_L: {
20479 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20480 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20481              
20482 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20483 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20484              
20485 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20486 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20487 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20488              
20489             PDL_COMMENT("none")
20490 0           } } break; case PDL_IND: {
20491 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20492 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20493              
20494 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20495 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20496              
20497 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20498 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20499 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20500              
20501             PDL_COMMENT("none")
20502 0           } } break; case PDL_LL: {
20503 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20504 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20505              
20506 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20507 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20508              
20509 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20510 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20511 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20512              
20513             PDL_COMMENT("none")
20514 0           } } break; case PDL_F: {
20515 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20516 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20517              
20518 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20519 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20520              
20521 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20522 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20523 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20524              
20525             PDL_COMMENT("none")
20526 0           } } break; case PDL_D: {
20527 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20528 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20529              
20530 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20531 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20532              
20533 0           {register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20534 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20535 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20536              
20537             PDL_COMMENT("none")
20538 0           } break;}
20539 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
20540             }
20541             }
20542             {
20543             static char *__parnames[] = {"clusterids","eltmask"};
20544             static PDL_Indx __realdims[] = {1,2};
20545             static char __funcname[] = "PDL::Cluster::clusterelementmask";
20546             static pdl_errorinfo __einfo = {
20547             __funcname, __parnames, 2
20548             };
20549            
20550 0           PDL->initthreadstruct(2,__privtrans->pdls,
20551             __realdims,__creating,2,
20552             &__einfo,&(__privtrans->__pdlthread),
20553 0           __privtrans->vtable->per_pdl_flags,
20554             0 );
20555             }
20556 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
20557 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
20558             }
20559 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
20560 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
20561 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
20562 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
20563 0           PDL->pdl_barf("Error in clusterelementmask:" "Wrong dims\n");
20564             }
20565             }
20566 0 0         if(!__creating[1]) {
20567 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
20568 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
20569 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
20570             }
20571 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
20572 0           __privtrans->__k_size = ((__privtrans->pdls[1]))->dims[0];
20573 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
20574 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
20575 0           PDL->pdl_barf("Error in clusterelementmask:" "Wrong dims\n");
20576             }
20577             }
20578 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
20579 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
20580 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
20581 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
20582 0           PDL->pdl_barf("Error in clusterelementmask:" "Wrong dims\n");
20583             }
20584             }
20585             } else {
20586 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;dims[1] = __privtrans->__n_size;
20587 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
20588             }
20589             { PDL_COMMENT("convenience block")
20590 0           void *hdrp = NULL;
20591 0           char propagate_hdrcpy = 0;
20592 0           SV *hdr_copy = NULL;
20593 0 0         if(!hdrp &&
    0          
20594 0 0         __privtrans->pdls[0]->hdrsv &&
20595 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
20596             ) {
20597 0           hdrp = __privtrans->pdls[0]->hdrsv;
20598 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
20599             }
20600 0 0         if(!hdrp &&
    0          
20601 0 0         !__creating[1] &&
20602 0 0         __privtrans->pdls[1]->hdrsv &&
20603 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
20604             ) {
20605 0           hdrp = __privtrans->pdls[1]->hdrsv;
20606 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
20607             }
20608 0 0         if (hdrp) {
20609 0 0         if(hdrp == &PL_sv_undef)
20610 0           hdr_copy = &PL_sv_undef;
20611             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
20612             int count;
20613             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
20614 0           dSP;
20615 0           ENTER ;
20616 0           SAVETMPS ;
20617 0 0         PUSHMARK(SP) ;
20618 0 0         XPUSHs( hdrp );
20619 0           PUTBACK ;
20620 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
20621 0           SPAGAIN ;
20622 0 0         if(count != 1)
20623 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
20624              
20625 0           hdr_copy = (SV *)POPs;
20626              
20627 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
20628 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
20629             }
20630              
20631 0 0         FREETMPS ;
20632 0           LEAVE ;
20633              
20634              
20635             } PDL_COMMENT("end of callback block")
20636              
20637 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
20638 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
20639 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
20640 0 0         if( hdr_copy != &PL_sv_undef )
20641 0           (void)SvREFCNT_inc(hdr_copy);
20642 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
20643             }
20644 0 0         if(propagate_hdrcpy)
20645 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
20646              
20647 0 0         if(hdr_copy != &PL_sv_undef)
20648 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
20649             } PDL_COMMENT("end of if(hdrp) block")
20650             } PDL_COMMENT("end of conv. block")
20651 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
20652 0           __privtrans->__inc_clusterids_n = 0; else
20653 0 0         __privtrans->__inc_clusterids_n = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
20654 0           __privtrans->__inc_eltmask_k = 0; else
20655 0 0         __privtrans->__inc_eltmask_k = PDL_REPRINC(__privtrans->pdls[1],0);if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
    0          
20656 0           __privtrans->__inc_eltmask_n = 0; else
20657 0 0         __privtrans->__inc_eltmask_n = PDL_REPRINC(__privtrans->pdls[1],1); __privtrans->__ddone = 1;
20658             }
20659 0           }
20660            
20661              
20662 0           pdl_trans * pdl_clusterelementmask_copy(pdl_trans *__tr ) {
20663             int __dim;
20664 0           pdl_clusterelementmask_struct *__privtrans = (pdl_clusterelementmask_struct *) __tr;
20665            
20666             {
20667 0           pdl_clusterelementmask_struct *__copy = malloc(sizeof(pdl_clusterelementmask_struct));
20668 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
20669 0           __copy->has_badvalue = __privtrans->has_badvalue;
20670 0           __copy->badvalue = __privtrans->badvalue;
20671 0           __copy->flags = __privtrans->flags;
20672 0           __copy->vtable = __privtrans->vtable;
20673 0           __copy->__datatype = __privtrans->__datatype;
20674 0           __copy->freeproc = NULL;
20675 0           __copy->__ddone = __privtrans->__ddone;
20676             {int i;
20677 0 0         for(i=0; i<__copy->vtable->npdls; i++)
20678 0           __copy->pdls[i] = __privtrans->pdls[i];
20679             }
20680            
20681 0 0         if(__copy->__ddone) {
20682 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_clusterids_n=__copy->__inc_clusterids_n;__privtrans->__inc_eltmask_k=__copy->__inc_eltmask_k;__privtrans->__inc_eltmask_n=__copy->__inc_eltmask_n;__copy->__k_size=__privtrans->__k_size;__copy->__n_size=__privtrans->__n_size;
20683             }
20684 0           return (pdl_trans*)__copy;
20685             }
20686             }
20687            
20688              
20689 0           void pdl_clusterelementmask_readdata(pdl_trans *__tr ) {
20690             int __dim;
20691 0           pdl_clusterelementmask_struct *__privtrans = (pdl_clusterelementmask_struct *) __tr;
20692            
20693             {
20694 0           {register PDL_Indx __n_size = __privtrans->__n_size;
20695             PDL_COMMENT("Start generic loop")
20696              
20697 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
20698 0           } break; case PDL_B: {
20699 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20700 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20701              
20702 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20703 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20704              
20705              
20706             PDL_COMMENT("THREADLOOPBEGIN")
20707 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20708 0           do { register PDL_Indx __tind1=0,__tind2=0;
20709 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20710 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20711 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20712 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20713 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20714 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20715 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20716 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20717 0           clusterids_datap += __offsp[0];
20718 0           eltmask_datap += __offsp[1];
20719 0 0         for( __tind2 = 0 ;
20720             __tind2 < __tdims1 ;
20721 0           __tind2++
20722 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20723 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20724             )
20725             {
20726 0 0         for( __tind1 = 0 ;
20727             __tind1 < __tdims0 ;
20728 0           __tind1++
20729 0           ,clusterids_datap += __tinc0_0
20730 0           ,eltmask_datap += __tinc0_1
20731             )
20732 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20733 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20734 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20735              
20736              
20737             int cid, csize;
20738             {PDL_COMMENT("Open n") register PDL_Indx n;
20739 0 0         for(n=0; n<(__n_size); n++) {
20740 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20741 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
20742             }} PDL_COMMENT("Close n")
20743              
20744             }
20745             PDL_COMMENT("THREADLOOPEND")
20746             }
20747             }
20748 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20749 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20750 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_S: {
20751 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20752 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20753              
20754 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20755 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20756              
20757              
20758             PDL_COMMENT("THREADLOOPBEGIN")
20759 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20760 0           do { register PDL_Indx __tind1=0,__tind2=0;
20761 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20762 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20763 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20764 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20765 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20766 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20767 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20768 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20769 0           clusterids_datap += __offsp[0];
20770 0           eltmask_datap += __offsp[1];
20771 0 0         for( __tind2 = 0 ;
20772             __tind2 < __tdims1 ;
20773 0           __tind2++
20774 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20775 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20776             )
20777             {
20778 0 0         for( __tind1 = 0 ;
20779             __tind1 < __tdims0 ;
20780 0           __tind1++
20781 0           ,clusterids_datap += __tinc0_0
20782 0           ,eltmask_datap += __tinc0_1
20783             )
20784 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20785 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20786 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20787              
20788              
20789             int cid, csize;
20790             {PDL_COMMENT("Open n") register PDL_Indx n;
20791 0 0         for(n=0; n<(__n_size); n++) {
20792 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20793 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
20794             }} PDL_COMMENT("Close n")
20795              
20796             }
20797             PDL_COMMENT("THREADLOOPEND")
20798             }
20799             }
20800 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20801 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20802 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_US: {
20803 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20804 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20805              
20806 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20807 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20808              
20809              
20810             PDL_COMMENT("THREADLOOPBEGIN")
20811 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20812 0           do { register PDL_Indx __tind1=0,__tind2=0;
20813 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20814 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20815 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20816 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20817 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20818 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20819 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20820 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20821 0           clusterids_datap += __offsp[0];
20822 0           eltmask_datap += __offsp[1];
20823 0 0         for( __tind2 = 0 ;
20824             __tind2 < __tdims1 ;
20825 0           __tind2++
20826 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20827 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20828             )
20829             {
20830 0 0         for( __tind1 = 0 ;
20831             __tind1 < __tdims0 ;
20832 0           __tind1++
20833 0           ,clusterids_datap += __tinc0_0
20834 0           ,eltmask_datap += __tinc0_1
20835             )
20836 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20837 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20838 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20839              
20840              
20841             int cid, csize;
20842             {PDL_COMMENT("Open n") register PDL_Indx n;
20843 0 0         for(n=0; n<(__n_size); n++) {
20844 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20845 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
20846             }} PDL_COMMENT("Close n")
20847              
20848             }
20849             PDL_COMMENT("THREADLOOPEND")
20850             }
20851             }
20852 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20853 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20854 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_L: {
20855 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20856 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20857              
20858 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20859 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20860              
20861              
20862             PDL_COMMENT("THREADLOOPBEGIN")
20863 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20864 0           do { register PDL_Indx __tind1=0,__tind2=0;
20865 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20866 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20867 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20868 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20869 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20870 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20871 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20872 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20873 0           clusterids_datap += __offsp[0];
20874 0           eltmask_datap += __offsp[1];
20875 0 0         for( __tind2 = 0 ;
20876             __tind2 < __tdims1 ;
20877 0           __tind2++
20878 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20879 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20880             )
20881             {
20882 0 0         for( __tind1 = 0 ;
20883             __tind1 < __tdims0 ;
20884 0           __tind1++
20885 0           ,clusterids_datap += __tinc0_0
20886 0           ,eltmask_datap += __tinc0_1
20887             )
20888 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20889 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20890 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20891              
20892              
20893             int cid, csize;
20894             {PDL_COMMENT("Open n") register PDL_Indx n;
20895 0 0         for(n=0; n<(__n_size); n++) {
20896 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20897 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
20898             }} PDL_COMMENT("Close n")
20899              
20900             }
20901             PDL_COMMENT("THREADLOOPEND")
20902             }
20903             }
20904 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20905 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20906 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_IND: {
20907 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20908 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20909              
20910 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20911 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20912              
20913              
20914             PDL_COMMENT("THREADLOOPBEGIN")
20915 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20916 0           do { register PDL_Indx __tind1=0,__tind2=0;
20917 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20918 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20919 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20920 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20921 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20922 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20923 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20924 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20925 0           clusterids_datap += __offsp[0];
20926 0           eltmask_datap += __offsp[1];
20927 0 0         for( __tind2 = 0 ;
20928             __tind2 < __tdims1 ;
20929 0           __tind2++
20930 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20931 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20932             )
20933             {
20934 0 0         for( __tind1 = 0 ;
20935             __tind1 < __tdims0 ;
20936 0           __tind1++
20937 0           ,clusterids_datap += __tinc0_0
20938 0           ,eltmask_datap += __tinc0_1
20939             )
20940 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20941 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20942 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20943              
20944              
20945             int cid, csize;
20946             {PDL_COMMENT("Open n") register PDL_Indx n;
20947 0 0         for(n=0; n<(__n_size); n++) {
20948 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
20949 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
20950             }} PDL_COMMENT("Close n")
20951              
20952             }
20953             PDL_COMMENT("THREADLOOPEND")
20954             }
20955             }
20956 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
20957 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
20958 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_LL: {
20959 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
20960 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
20961              
20962 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
20963 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
20964              
20965              
20966             PDL_COMMENT("THREADLOOPBEGIN")
20967 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
20968 0           do { register PDL_Indx __tind1=0,__tind2=0;
20969 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
20970 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
20971 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
20972 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
20973 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
20974 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
20975 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
20976 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
20977 0           clusterids_datap += __offsp[0];
20978 0           eltmask_datap += __offsp[1];
20979 0 0         for( __tind2 = 0 ;
20980             __tind2 < __tdims1 ;
20981 0           __tind2++
20982 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
20983 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
20984             )
20985             {
20986 0 0         for( __tind1 = 0 ;
20987             __tind1 < __tdims0 ;
20988 0           __tind1++
20989 0           ,clusterids_datap += __tinc0_0
20990 0           ,eltmask_datap += __tinc0_1
20991             )
20992 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
20993 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
20994 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
20995              
20996              
20997             int cid, csize;
20998             {PDL_COMMENT("Open n") register PDL_Indx n;
20999 0 0         for(n=0; n<(__n_size); n++) {
21000 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
21001 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
21002             }} PDL_COMMENT("Close n")
21003              
21004             }
21005             PDL_COMMENT("THREADLOOPEND")
21006             }
21007             }
21008 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
21009 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
21010 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_F: {
21011 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21012 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
21013              
21014 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21015 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
21016              
21017              
21018             PDL_COMMENT("THREADLOOPBEGIN")
21019 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
21020 0           do { register PDL_Indx __tind1=0,__tind2=0;
21021 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
21022 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
21023 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
21024 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
21025 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
21026 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
21027 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
21028 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
21029 0           clusterids_datap += __offsp[0];
21030 0           eltmask_datap += __offsp[1];
21031 0 0         for( __tind2 = 0 ;
21032             __tind2 < __tdims1 ;
21033 0           __tind2++
21034 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
21035 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
21036             )
21037             {
21038 0 0         for( __tind1 = 0 ;
21039             __tind1 < __tdims0 ;
21040 0           __tind1++
21041 0           ,clusterids_datap += __tinc0_0
21042 0           ,eltmask_datap += __tinc0_1
21043             )
21044 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
21045 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
21046 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
21047              
21048              
21049             int cid, csize;
21050             {PDL_COMMENT("Open n") register PDL_Indx n;
21051 0 0         for(n=0; n<(__n_size); n++) {
21052 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
21053 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
21054             }} PDL_COMMENT("Close n")
21055              
21056             }
21057             PDL_COMMENT("THREADLOOPEND")
21058             }
21059             }
21060 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
21061 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
21062 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
21063 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21064 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
21065              
21066 0 0         PDL_Byte * eltmask_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21067 0           PDL_Byte * eltmask_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
21068              
21069              
21070             PDL_COMMENT("THREADLOOPBEGIN")
21071 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
21072 0           do { register PDL_Indx __tind1=0,__tind2=0;
21073 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
21074 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
21075 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
21076 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
21077 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
21078 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
21079 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
21080 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
21081 0           clusterids_datap += __offsp[0];
21082 0           eltmask_datap += __offsp[1];
21083 0 0         for( __tind2 = 0 ;
21084             __tind2 < __tdims1 ;
21085 0           __tind2++
21086 0           ,clusterids_datap += __tinc1_0 - __tinc0_0 * __tdims0
21087 0           ,eltmask_datap += __tinc1_1 - __tinc0_1 * __tdims0
21088             )
21089             {
21090 0 0         for( __tind1 = 0 ;
21091             __tind1 < __tdims0 ;
21092 0           __tind1++
21093 0           ,clusterids_datap += __tinc0_0
21094 0           ,eltmask_datap += __tinc0_1
21095             )
21096 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_clusterids_n = __privtrans->__inc_clusterids_n;
21097 0           register PDL_Indx __inc_eltmask_k = __privtrans->__inc_eltmask_k;
21098 0           register PDL_Indx __inc_eltmask_n = __privtrans->__inc_eltmask_n;
21099              
21100              
21101             int cid, csize;
21102             {PDL_COMMENT("Open n") register PDL_Indx n;
21103 0 0         for(n=0; n<(__n_size); n++) {
21104 0 0         cid = (clusterids_datap)[0+(__inc_clusterids_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
21105 0 0         (eltmask_datap)[0+(__inc_eltmask_k*PP_INDTERM(__privtrans->__k_size, cid))+(__inc_eltmask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 1;
    0          
21106             }} PDL_COMMENT("Close n")
21107              
21108             }
21109             PDL_COMMENT("THREADLOOPEND")
21110             }
21111             }
21112 0           clusterids_datap -= __tinc1_0 * __tdims1 + __offsp[0];
21113 0           eltmask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
21114 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
21115 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
21116             }
21117             }
21118             }
21119            
21120              
21121              
21122              
21123 0           void pdl_clusterelementmask_free(pdl_trans *__tr ) {
21124             int __dim;
21125 0           pdl_clusterelementmask_struct *__privtrans = (pdl_clusterelementmask_struct *) __tr;
21126            
21127             {
21128            
21129 0           PDL_TR_CLRMAGIC(__privtrans);
21130            
21131 0 0         if(__privtrans->__ddone) {
21132 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
21133             ;;;;;;
21134             }
21135            
21136             }
21137 0           }
21138            
21139              
21140              
21141              
21142             static char pdl_clusterelementmask_vtable_flags[] =
21143             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
21144             pdl_transvtable pdl_clusterelementmask_vtable = {
21145             0,0, 1, 2, pdl_clusterelementmask_vtable_flags,
21146             pdl_clusterelementmask_redodims, pdl_clusterelementmask_readdata, NULL,
21147             pdl_clusterelementmask_free,NULL,NULL,pdl_clusterelementmask_copy,
21148             sizeof(pdl_clusterelementmask_struct),"pdl_clusterelementmask_vtable"
21149             };
21150              
21151             typedef struct pdl_clusterdistancematrix_struct {
21152             PDL_TRANS_START(7);
21153             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_rowids_nr;PDL_Indx __inc_clustersizes_k;PDL_Indx __inc_eltids_mcsize;PDL_Indx __inc_eltids_k;PDL_Indx __inc_dist_k;PDL_Indx __inc_dist_nr;PDL_Indx __nr_size;PDL_Indx __n_size;PDL_Indx __k_size;PDL_Indx __mcsize_size;PDL_Indx __d_size;
21154             char *distFlag;char *methodFlag;
21155             char __ddone; PDL_COMMENT("Dims done")
21156             } pdl_clusterdistancematrix_struct;
21157              
21158 5           void pdl_clusterdistancematrix_redodims(pdl_trans *__tr ) {
21159             int __dim;
21160 5           pdl_clusterdistancematrix_struct *__privtrans = (pdl_clusterdistancematrix_struct *) __tr;
21161            
21162             {
21163             PDL_Indx __creating[7];
21164 5           __privtrans->__nr_size = -1;
21165 5           __privtrans->__n_size = -1;
21166 5           __privtrans->__k_size = -1;
21167 5           __privtrans->__mcsize_size = -1;
21168 5           __privtrans->__d_size = -1;
21169 5           __creating[0] = 0;
21170 5           __creating[1] = 0;
21171 5           __creating[2] = 0;
21172 5           __creating[3] = 0;
21173 5           __creating[4] = 0;
21174 5           __creating[5] = 0;
21175 5 50         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
21176             {
21177             {PDL_COMMENT("Start generic loop")
21178              
21179 5           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
21180 0           } break; case PDL_B: {
21181 5 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21182 5           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21183              
21184 5 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21185 5           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21186              
21187 5 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21188 5           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21189              
21190 5 50         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21191 5           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21192              
21193 5 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21194 5           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21195              
21196 5 50         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21197 5           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21198              
21199 5 50         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21200 5           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21201              
21202 5           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21203 5           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21204 5           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21205 5           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21206 5           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21207 5           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21208 5           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21209 5           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21210 5           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21211 5           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21212 5           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21213              
21214             PDL_COMMENT("none")
21215 5           } } break; case PDL_S: {
21216 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21217 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21218              
21219 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21220 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21221              
21222 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21223 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21224              
21225 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21226 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21227              
21228 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21229 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21230              
21231 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21232 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21233              
21234 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21235 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21236              
21237 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21238 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21239 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21240 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21241 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21242 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21243 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21244 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21245 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21246 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21247 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21248              
21249             PDL_COMMENT("none")
21250 0           } } break; case PDL_US: {
21251 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21252 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21253              
21254 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21255 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21256              
21257 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21258 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21259              
21260 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21261 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21262              
21263 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21264 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21265              
21266 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21267 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21268              
21269 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21270 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21271              
21272 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21273 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21274 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21275 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21276 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21277 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21278 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21279 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21280 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21281 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21282 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21283              
21284             PDL_COMMENT("none")
21285 0           } } break; case PDL_L: {
21286 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21287 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21288              
21289 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21290 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21291              
21292 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21293 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21294              
21295 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21296 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21297              
21298 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21299 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21300              
21301 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21302 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21303              
21304 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21305 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21306              
21307 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21308 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21309 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21310 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21311 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21312 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21313 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21314 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21315 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21316 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21317 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21318              
21319             PDL_COMMENT("none")
21320 0           } } break; case PDL_IND: {
21321 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21322 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21323              
21324 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21325 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21326              
21327 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21328 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21329              
21330 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21331 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21332              
21333 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21334 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21335              
21336 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21337 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21338              
21339 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21340 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21341              
21342 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21343 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21344 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21345 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21346 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21347 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21348 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21349 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21350 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21351 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21352 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21353              
21354             PDL_COMMENT("none")
21355 0           } } break; case PDL_LL: {
21356 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21357 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21358              
21359 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21360 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21361              
21362 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21363 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21364              
21365 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21366 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21367              
21368 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21369 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21370              
21371 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21372 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21373              
21374 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21375 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21376              
21377 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21378 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21379 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21380 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21381 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21382 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21383 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21384 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21385 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21386 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21387 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21388              
21389             PDL_COMMENT("none")
21390 0           } } break; case PDL_F: {
21391 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21392 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21393              
21394 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21395 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21396              
21397 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21398 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21399              
21400 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21401 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21402              
21403 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21404 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21405              
21406 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21407 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21408              
21409 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21410 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21411              
21412 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21413 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21414 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21415 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21416 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21417 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21418 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21419 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21420 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21421 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21422 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21423              
21424             PDL_COMMENT("none")
21425 0           } } break; case PDL_D: {
21426 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21427 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21428              
21429 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21430 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21431              
21432 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21433 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21434              
21435 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21436 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21437              
21438 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21439 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21440              
21441 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21442 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21443              
21444 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21445 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21446              
21447 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21448 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21449 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21450 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21451 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21452 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21453 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21454 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21455 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21456 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21457 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21458              
21459             PDL_COMMENT("none")
21460 0           } break;}
21461 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
21462             }
21463             }
21464             {
21465             static char *__parnames[] = {"data","mask","weight","rowids","clustersizes","eltids","dist"};
21466             static PDL_Indx __realdims[] = {2,2,1,1,1,2,2};
21467             static char __funcname[] = "PDL::Cluster::clusterdistancematrix";
21468             static pdl_errorinfo __einfo = {
21469             __funcname, __parnames, 7
21470             };
21471            
21472 5           PDL->initthreadstruct(2,__privtrans->pdls,
21473             __realdims,__creating,7,
21474             &__einfo,&(__privtrans->__pdlthread),
21475 5           __privtrans->vtable->per_pdl_flags,
21476             0 );
21477             }
21478 5 50         if(((__privtrans->pdls[0]))->ndims < 2) {
21479 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
21480 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
21481             }
21482 5 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
21483 5           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
21484 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
21485 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
21486 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21487             }
21488             }
21489 5 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
21490 5           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
21491 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
21492 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
21493 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21494             }
21495             }
21496 5           PDL->make_physical(((__privtrans->pdls[0])));
21497 5 50         if(((__privtrans->pdls[1]))->ndims < 2) {
21498 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
21499 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
21500             }
21501 5 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
21502 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
21503 5 50         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    50          
21504 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
21505 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21506             }
21507             }
21508 5 50         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    50          
    50          
21509 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
21510 5 50         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    50          
21511 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
21512 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21513             }
21514             }
21515 5           PDL->make_physical(((__privtrans->pdls[1])));
21516 5 50         if(((__privtrans->pdls[2]))->ndims < 1) {
21517 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
21518             }
21519 5 50         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    50          
    50          
21520 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
21521 5 50         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    50          
21522 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
21523 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21524             }
21525             }
21526 5           PDL->make_physical(((__privtrans->pdls[2])));
21527 5 50         if(((__privtrans->pdls[3]))->ndims < 1) {
21528 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
21529             }
21530 5 50         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
21531 5           __privtrans->__nr_size = ((__privtrans->pdls[3]))->dims[0];
21532 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
21533 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
21534 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21535             }
21536             }
21537 5 50         if(((__privtrans->pdls[4]))->ndims < 1) {
21538 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
21539             }
21540 5 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
21541 5           __privtrans->__k_size = ((__privtrans->pdls[4]))->dims[0];
21542 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
21543 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
21544 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21545             }
21546             }
21547 5 50         if(((__privtrans->pdls[5]))->ndims < 2) {
21548 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__mcsize_size <= 1) __privtrans->__mcsize_size = 1;
    0          
21549 0 0         if (((__privtrans->pdls[5]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
21550             }
21551 5 50         if(__privtrans->__mcsize_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__mcsize_size == 1)) {
    0          
    0          
21552 5           __privtrans->__mcsize_size = ((__privtrans->pdls[5]))->dims[0];
21553 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__mcsize_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
21554 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
21555 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21556             }
21557             }
21558 5 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[5]))->ndims > 1 && __privtrans->__k_size == 1)) {
    50          
    50          
21559 0           __privtrans->__k_size = ((__privtrans->pdls[5]))->dims[1];
21560 5 50         } else if(((__privtrans->pdls[5]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[5]))->dims[1]) {
    50          
21561 0 0         if(((__privtrans->pdls[5]))->dims[1] != 1) {
21562 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21563             }
21564             }
21565 5           PDL->make_physical(((__privtrans->pdls[5])));
21566 5 50         if(!__creating[6]) {
21567 5 50         if(((__privtrans->pdls[6]))->ndims < 2) {
21568 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
21569 0 0         if (((__privtrans->pdls[6]))->ndims < 2 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
21570             }
21571 5 50         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__k_size == 1)) {
    50          
    50          
21572 0           __privtrans->__k_size = ((__privtrans->pdls[6]))->dims[0];
21573 5 50         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[6]))->dims[0]) {
    50          
21574 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
21575 0           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21576             }
21577             }
21578 5 50         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__nr_size == 1)) {
    50          
    50          
21579 0           __privtrans->__nr_size = ((__privtrans->pdls[6]))->dims[1];
21580 5 50         } else if(((__privtrans->pdls[6]))->ndims > 1 && __privtrans->__nr_size != ((__privtrans->pdls[6]))->dims[1]) {
    50          
21581 0 0         if(((__privtrans->pdls[6]))->dims[1] != 1) {
21582 5           PDL->pdl_barf("Error in clusterdistancematrix:" "Wrong dims\n");
21583             }
21584             }
21585             } else {
21586 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;dims[1] = __privtrans->__nr_size;
21587 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,0);
21588             }
21589             { PDL_COMMENT("convenience block")
21590 5           void *hdrp = NULL;
21591 5           char propagate_hdrcpy = 0;
21592 5           SV *hdr_copy = NULL;
21593 5 50         if(!hdrp &&
    50          
21594 0 0         __privtrans->pdls[0]->hdrsv &&
21595 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
21596             ) {
21597 0           hdrp = __privtrans->pdls[0]->hdrsv;
21598 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
21599             }
21600 5 50         if(!hdrp &&
    50          
21601 0 0         __privtrans->pdls[1]->hdrsv &&
21602 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
21603             ) {
21604 0           hdrp = __privtrans->pdls[1]->hdrsv;
21605 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
21606             }
21607 5 50         if(!hdrp &&
    50          
21608 0 0         __privtrans->pdls[2]->hdrsv &&
21609 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
21610             ) {
21611 0           hdrp = __privtrans->pdls[2]->hdrsv;
21612 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
21613             }
21614 5 50         if(!hdrp &&
    50          
21615 0 0         __privtrans->pdls[3]->hdrsv &&
21616 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
21617             ) {
21618 0           hdrp = __privtrans->pdls[3]->hdrsv;
21619 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
21620             }
21621 5 50         if(!hdrp &&
    50          
21622 0 0         __privtrans->pdls[4]->hdrsv &&
21623 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
21624             ) {
21625 0           hdrp = __privtrans->pdls[4]->hdrsv;
21626 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
21627             }
21628 5 50         if(!hdrp &&
    50          
21629 0 0         __privtrans->pdls[5]->hdrsv &&
21630 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
21631             ) {
21632 0           hdrp = __privtrans->pdls[5]->hdrsv;
21633 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
21634             }
21635 5 50         if(!hdrp &&
    50          
21636 5 50         !__creating[6] &&
21637 0 0         __privtrans->pdls[6]->hdrsv &&
21638 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
21639             ) {
21640 0           hdrp = __privtrans->pdls[6]->hdrsv;
21641 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
21642             }
21643 5 50         if (hdrp) {
21644 0 0         if(hdrp == &PL_sv_undef)
21645 0           hdr_copy = &PL_sv_undef;
21646             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
21647             int count;
21648             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
21649 0           dSP;
21650 0           ENTER ;
21651 0           SAVETMPS ;
21652 0 0         PUSHMARK(SP) ;
21653 0 0         XPUSHs( hdrp );
21654 0           PUTBACK ;
21655 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
21656 0           SPAGAIN ;
21657 0 0         if(count != 1)
21658 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
21659              
21660 0           hdr_copy = (SV *)POPs;
21661              
21662 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
21663 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
21664             }
21665              
21666 0 0         FREETMPS ;
21667 0           LEAVE ;
21668              
21669              
21670             } PDL_COMMENT("end of callback block")
21671              
21672 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
21673 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
21674 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
21675 0 0         if( hdr_copy != &PL_sv_undef )
21676 0           (void)SvREFCNT_inc(hdr_copy);
21677 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
21678             }
21679 0 0         if(propagate_hdrcpy)
21680 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
21681              
21682 0 0         if(hdr_copy != &PL_sv_undef)
21683 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
21684             } PDL_COMMENT("end of if(hdrp) block")
21685             } PDL_COMMENT("end of conv. block")
21686 5 50         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    50          
21687 0           __privtrans->__inc_data_d = 0; else
21688 5 50         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    50          
21689 0           __privtrans->__inc_data_n = 0; else
21690 5 50         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    50          
21691 0           __privtrans->__inc_mask_d = 0; else
21692 5 50         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    50          
21693 0           __privtrans->__inc_mask_n = 0; else
21694 5 50         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    50          
21695 0           __privtrans->__inc_weight_d = 0; else
21696 5 50         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    50          
21697 0           __privtrans->__inc_rowids_nr = 0; else
21698 5 50         __privtrans->__inc_rowids_nr = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    50          
    50          
21699 0           __privtrans->__inc_clustersizes_k = 0; else
21700 5 50         __privtrans->__inc_clustersizes_k = PDL_REPRINC(__privtrans->pdls[4],0);if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    50          
    50          
21701 0           __privtrans->__inc_eltids_mcsize = 0; else
21702 5 50         __privtrans->__inc_eltids_mcsize = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 1 || __privtrans->pdls[5]->dims[1] <= 1)
    50          
21703 0           __privtrans->__inc_eltids_k = 0; else
21704 5 50         __privtrans->__inc_eltids_k = __privtrans->pdls[5]->dimincs[1];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    50          
21705 0           __privtrans->__inc_dist_k = 0; else
21706 5 50         __privtrans->__inc_dist_k = PDL_REPRINC(__privtrans->pdls[6],0);if(__privtrans->pdls[6]->ndims <= 1 || __privtrans->pdls[6]->dims[1] <= 1)
    50          
    50          
21707 0           __privtrans->__inc_dist_nr = 0; else
21708 5 50         __privtrans->__inc_dist_nr = PDL_REPRINC(__privtrans->pdls[6],1); __privtrans->__ddone = 1;
21709             }
21710 5           }
21711            
21712              
21713 0           pdl_trans * pdl_clusterdistancematrix_copy(pdl_trans *__tr ) {
21714             int __dim;
21715 0           pdl_clusterdistancematrix_struct *__privtrans = (pdl_clusterdistancematrix_struct *) __tr;
21716            
21717             {
21718 0           pdl_clusterdistancematrix_struct *__copy = malloc(sizeof(pdl_clusterdistancematrix_struct));
21719 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
21720 0           __copy->has_badvalue = __privtrans->has_badvalue;
21721 0           __copy->badvalue = __privtrans->badvalue;
21722 0           __copy->flags = __privtrans->flags;
21723 0           __copy->vtable = __privtrans->vtable;
21724 0           __copy->__datatype = __privtrans->__datatype;
21725 0           __copy->freeproc = NULL;
21726 0           __copy->__ddone = __privtrans->__ddone;
21727             {int i;
21728 0 0         for(i=0; i<__copy->vtable->npdls; i++)
21729 0           __copy->pdls[i] = __privtrans->pdls[i];
21730             }
21731 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
21732 0 0         if(__copy->__ddone) {
21733 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_rowids_nr=__copy->__inc_rowids_nr;__privtrans->__inc_clustersizes_k=__copy->__inc_clustersizes_k;__privtrans->__inc_eltids_mcsize=__copy->__inc_eltids_mcsize;__privtrans->__inc_eltids_k=__copy->__inc_eltids_k;__privtrans->__inc_dist_k=__copy->__inc_dist_k;__privtrans->__inc_dist_nr=__copy->__inc_dist_nr;__copy->__nr_size=__privtrans->__nr_size;__copy->__n_size=__privtrans->__n_size;__copy->__k_size=__privtrans->__k_size;__copy->__mcsize_size=__privtrans->__mcsize_size;__copy->__d_size=__privtrans->__d_size;
21734             }
21735 0           return (pdl_trans*)__copy;
21736             }
21737             }
21738            
21739              
21740 5           void pdl_clusterdistancematrix_readdata(pdl_trans *__tr ) {
21741             int __dim;
21742 5           pdl_clusterdistancematrix_struct *__privtrans = (pdl_clusterdistancematrix_struct *) __tr;
21743            
21744             {
21745 5           {register PDL_Indx __k_size = __privtrans->__k_size;
21746 5           register PDL_Indx __nr_size = __privtrans->__nr_size;
21747             PDL_COMMENT("Start generic loop")
21748              
21749 5           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
21750 0           } break; case PDL_B: {
21751 5 50         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21752 5           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21753              
21754 5 50         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21755 5           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21756              
21757 5 50         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21758 5           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21759              
21760 5 50         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21761 5           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21762              
21763 5 50         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21764 5           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21765              
21766 5 50         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21767 5           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21768              
21769 5 50         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21770 5           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21771              
21772 5           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21773 5           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21774 5           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21775 5           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21776 5           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21777 5           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21778 5           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21779 5           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21780 5           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21781 5           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21782 5           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21783              
21784              
21785 5           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
21786 5           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
21787 5           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
21788 5           int transpose=0;
21789             int rowid;
21790            
21791             PDL_COMMENT("THREADLOOPBEGIN")
21792 5 50         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
21793 5           do { register PDL_Indx __tind1=0,__tind2=0;
21794 5           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
21795 5           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
21796 5           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
21797 5           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
21798 5           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
21799 5           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
21800 5           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
21801 5           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
21802 5           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
21803 5           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
21804 5           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
21805 5           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
21806 5           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
21807 5           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
21808 5           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
21809 5           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
21810 5           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
21811 5           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
21812 5           data_datap += __offsp[0];
21813 5           mask_datap += __offsp[1];
21814 5           weight_datap += __offsp[2];
21815 5           rowids_datap += __offsp[3];
21816 5           clustersizes_datap += __offsp[4];
21817 5           eltids_datap += __offsp[5];
21818 5           dist_datap += __offsp[6];
21819 10 100         for( __tind2 = 0 ;
21820             __tind2 < __tdims1 ;
21821 5           __tind2++
21822 5           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
21823 5           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
21824 5           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
21825 5           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
21826 5           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
21827 5           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
21828 5           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
21829             )
21830             {
21831 10 100         for( __tind1 = 0 ;
21832             __tind1 < __tdims0 ;
21833 5           __tind1++
21834 5           ,data_datap += __tinc0_0
21835 5           ,mask_datap += __tinc0_1
21836 5           ,weight_datap += __tinc0_2
21837 5           ,rowids_datap += __tinc0_3
21838 5           ,clustersizes_datap += __tinc0_4
21839 5           ,eltids_datap += __tinc0_5
21840 5           ,dist_datap += __tinc0_6
21841             )
21842             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
21843 5           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
21844 5           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
21845 5           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
21846             {PDL_COMMENT("Open nr") register PDL_Indx nr;
21847 25 100         for(nr=0; nr<(__nr_size); nr++) {
21848 20 50         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
21849             {PDL_COMMENT("Open k") register PDL_Indx k;
21850 60 100         for(k=0; k<(__k_size); k++) {
21851 80 50         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    50          
21852 40 50         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
21853 40           &rowid, eltidspp[k],
21854 80           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
21855             }} PDL_COMMENT("Close k")
21856             }} PDL_COMMENT("Close nr")
21857            
21858             PDL_COMMENT("THREADLOOPEND")
21859             }
21860             }
21861 5           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
21862 5           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
21863 5           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
21864 5           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
21865 5           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
21866 5           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
21867 5           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
21868 5 50         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
21869             /*-- cleanup --*/
21870 5 50         if (datapp) free(datapp);
21871 5 50         if (maskpp) free(maskpp);
21872 5 50         if (eltidspp) free(eltidspp);
21873              
21874 5           } } break; case PDL_S: {
21875 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
21876 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
21877              
21878 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
21879 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
21880              
21881 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
21882 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
21883              
21884 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
21885 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
21886              
21887 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
21888 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
21889              
21890 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
21891 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
21892              
21893 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
21894 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
21895              
21896 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
21897 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
21898 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
21899 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
21900 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
21901 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
21902 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
21903 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
21904 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
21905 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
21906 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
21907              
21908              
21909 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
21910 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
21911 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
21912 0           int transpose=0;
21913             int rowid;
21914            
21915             PDL_COMMENT("THREADLOOPBEGIN")
21916 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
21917 0           do { register PDL_Indx __tind1=0,__tind2=0;
21918 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
21919 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
21920 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
21921 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
21922 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
21923 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
21924 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
21925 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
21926 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
21927 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
21928 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
21929 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
21930 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
21931 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
21932 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
21933 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
21934 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
21935 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
21936 0           data_datap += __offsp[0];
21937 0           mask_datap += __offsp[1];
21938 0           weight_datap += __offsp[2];
21939 0           rowids_datap += __offsp[3];
21940 0           clustersizes_datap += __offsp[4];
21941 0           eltids_datap += __offsp[5];
21942 0           dist_datap += __offsp[6];
21943 0 0         for( __tind2 = 0 ;
21944             __tind2 < __tdims1 ;
21945 0           __tind2++
21946 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
21947 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
21948 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
21949 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
21950 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
21951 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
21952 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
21953             )
21954             {
21955 0 0         for( __tind1 = 0 ;
21956             __tind1 < __tdims0 ;
21957 0           __tind1++
21958 0           ,data_datap += __tinc0_0
21959 0           ,mask_datap += __tinc0_1
21960 0           ,weight_datap += __tinc0_2
21961 0           ,rowids_datap += __tinc0_3
21962 0           ,clustersizes_datap += __tinc0_4
21963 0           ,eltids_datap += __tinc0_5
21964 0           ,dist_datap += __tinc0_6
21965             )
21966             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
21967 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
21968 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
21969 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
21970             {PDL_COMMENT("Open nr") register PDL_Indx nr;
21971 0 0         for(nr=0; nr<(__nr_size); nr++) {
21972 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
21973             {PDL_COMMENT("Open k") register PDL_Indx k;
21974 0 0         for(k=0; k<(__k_size); k++) {
21975 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
21976 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
21977 0           &rowid, eltidspp[k],
21978 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
21979             }} PDL_COMMENT("Close k")
21980             }} PDL_COMMENT("Close nr")
21981            
21982             PDL_COMMENT("THREADLOOPEND")
21983             }
21984             }
21985 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
21986 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
21987 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
21988 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
21989 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
21990 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
21991 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
21992 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
21993             /*-- cleanup --*/
21994 0 0         if (datapp) free(datapp);
21995 0 0         if (maskpp) free(maskpp);
21996 0 0         if (eltidspp) free(eltidspp);
21997              
21998 0           } } break; case PDL_US: {
21999 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22000 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22001              
22002 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22003 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22004              
22005 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22006 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22007              
22008 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22009 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22010              
22011 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22012 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22013              
22014 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22015 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22016              
22017 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22018 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22019              
22020 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22021 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22022 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22023 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22024 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22025 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22026 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22027 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22028 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22029 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22030 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22031              
22032              
22033 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22034 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22035 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22036 0           int transpose=0;
22037             int rowid;
22038            
22039             PDL_COMMENT("THREADLOOPBEGIN")
22040 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22041 0           do { register PDL_Indx __tind1=0,__tind2=0;
22042 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22043 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22044 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22045 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22046 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22047 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22048 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22049 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22050 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22051 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22052 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22053 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22054 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22055 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22056 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22057 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22058 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22059 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22060 0           data_datap += __offsp[0];
22061 0           mask_datap += __offsp[1];
22062 0           weight_datap += __offsp[2];
22063 0           rowids_datap += __offsp[3];
22064 0           clustersizes_datap += __offsp[4];
22065 0           eltids_datap += __offsp[5];
22066 0           dist_datap += __offsp[6];
22067 0 0         for( __tind2 = 0 ;
22068             __tind2 < __tdims1 ;
22069 0           __tind2++
22070 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22071 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22072 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22073 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22074 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22075 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22076 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22077             )
22078             {
22079 0 0         for( __tind1 = 0 ;
22080             __tind1 < __tdims0 ;
22081 0           __tind1++
22082 0           ,data_datap += __tinc0_0
22083 0           ,mask_datap += __tinc0_1
22084 0           ,weight_datap += __tinc0_2
22085 0           ,rowids_datap += __tinc0_3
22086 0           ,clustersizes_datap += __tinc0_4
22087 0           ,eltids_datap += __tinc0_5
22088 0           ,dist_datap += __tinc0_6
22089             )
22090             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22091 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22092 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22093 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22094             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22095 0 0         for(nr=0; nr<(__nr_size); nr++) {
22096 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22097             {PDL_COMMENT("Open k") register PDL_Indx k;
22098 0 0         for(k=0; k<(__k_size); k++) {
22099 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22100 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22101 0           &rowid, eltidspp[k],
22102 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22103             }} PDL_COMMENT("Close k")
22104             }} PDL_COMMENT("Close nr")
22105            
22106             PDL_COMMENT("THREADLOOPEND")
22107             }
22108             }
22109 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22110 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22111 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22112 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22113 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22114 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22115 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22116 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22117             /*-- cleanup --*/
22118 0 0         if (datapp) free(datapp);
22119 0 0         if (maskpp) free(maskpp);
22120 0 0         if (eltidspp) free(eltidspp);
22121              
22122 0           } } break; case PDL_L: {
22123 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22124 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22125              
22126 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22127 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22128              
22129 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22130 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22131              
22132 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22133 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22134              
22135 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22136 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22137              
22138 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22139 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22140              
22141 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22142 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22143              
22144 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22145 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22146 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22147 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22148 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22149 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22150 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22151 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22152 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22153 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22154 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22155              
22156              
22157 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22158 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22159 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22160 0           int transpose=0;
22161             int rowid;
22162            
22163             PDL_COMMENT("THREADLOOPBEGIN")
22164 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22165 0           do { register PDL_Indx __tind1=0,__tind2=0;
22166 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22167 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22168 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22169 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22170 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22171 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22172 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22173 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22174 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22175 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22176 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22177 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22178 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22179 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22180 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22181 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22182 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22183 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22184 0           data_datap += __offsp[0];
22185 0           mask_datap += __offsp[1];
22186 0           weight_datap += __offsp[2];
22187 0           rowids_datap += __offsp[3];
22188 0           clustersizes_datap += __offsp[4];
22189 0           eltids_datap += __offsp[5];
22190 0           dist_datap += __offsp[6];
22191 0 0         for( __tind2 = 0 ;
22192             __tind2 < __tdims1 ;
22193 0           __tind2++
22194 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22195 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22196 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22197 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22198 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22199 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22200 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22201             )
22202             {
22203 0 0         for( __tind1 = 0 ;
22204             __tind1 < __tdims0 ;
22205 0           __tind1++
22206 0           ,data_datap += __tinc0_0
22207 0           ,mask_datap += __tinc0_1
22208 0           ,weight_datap += __tinc0_2
22209 0           ,rowids_datap += __tinc0_3
22210 0           ,clustersizes_datap += __tinc0_4
22211 0           ,eltids_datap += __tinc0_5
22212 0           ,dist_datap += __tinc0_6
22213             )
22214             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22215 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22216 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22217 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22218             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22219 0 0         for(nr=0; nr<(__nr_size); nr++) {
22220 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22221             {PDL_COMMENT("Open k") register PDL_Indx k;
22222 0 0         for(k=0; k<(__k_size); k++) {
22223 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22224 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22225 0           &rowid, eltidspp[k],
22226 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22227             }} PDL_COMMENT("Close k")
22228             }} PDL_COMMENT("Close nr")
22229            
22230             PDL_COMMENT("THREADLOOPEND")
22231             }
22232             }
22233 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22234 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22235 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22236 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22237 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22238 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22239 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22240 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22241             /*-- cleanup --*/
22242 0 0         if (datapp) free(datapp);
22243 0 0         if (maskpp) free(maskpp);
22244 0 0         if (eltidspp) free(eltidspp);
22245              
22246 0           } } break; case PDL_IND: {
22247 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22248 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22249              
22250 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22251 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22252              
22253 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22254 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22255              
22256 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22257 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22258              
22259 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22260 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22261              
22262 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22263 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22264              
22265 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22266 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22267              
22268 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22269 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22270 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22271 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22272 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22273 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22274 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22275 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22276 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22277 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22278 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22279              
22280              
22281 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22282 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22283 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22284 0           int transpose=0;
22285             int rowid;
22286            
22287             PDL_COMMENT("THREADLOOPBEGIN")
22288 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22289 0           do { register PDL_Indx __tind1=0,__tind2=0;
22290 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22291 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22292 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22293 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22294 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22295 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22296 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22297 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22298 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22299 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22300 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22301 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22302 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22303 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22304 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22305 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22306 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22307 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22308 0           data_datap += __offsp[0];
22309 0           mask_datap += __offsp[1];
22310 0           weight_datap += __offsp[2];
22311 0           rowids_datap += __offsp[3];
22312 0           clustersizes_datap += __offsp[4];
22313 0           eltids_datap += __offsp[5];
22314 0           dist_datap += __offsp[6];
22315 0 0         for( __tind2 = 0 ;
22316             __tind2 < __tdims1 ;
22317 0           __tind2++
22318 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22319 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22320 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22321 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22322 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22323 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22324 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22325             )
22326             {
22327 0 0         for( __tind1 = 0 ;
22328             __tind1 < __tdims0 ;
22329 0           __tind1++
22330 0           ,data_datap += __tinc0_0
22331 0           ,mask_datap += __tinc0_1
22332 0           ,weight_datap += __tinc0_2
22333 0           ,rowids_datap += __tinc0_3
22334 0           ,clustersizes_datap += __tinc0_4
22335 0           ,eltids_datap += __tinc0_5
22336 0           ,dist_datap += __tinc0_6
22337             )
22338             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22339 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22340 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22341 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22342             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22343 0 0         for(nr=0; nr<(__nr_size); nr++) {
22344 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22345             {PDL_COMMENT("Open k") register PDL_Indx k;
22346 0 0         for(k=0; k<(__k_size); k++) {
22347 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22348 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22349 0           &rowid, eltidspp[k],
22350 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22351             }} PDL_COMMENT("Close k")
22352             }} PDL_COMMENT("Close nr")
22353            
22354             PDL_COMMENT("THREADLOOPEND")
22355             }
22356             }
22357 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22358 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22359 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22360 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22361 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22362 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22363 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22364 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22365             /*-- cleanup --*/
22366 0 0         if (datapp) free(datapp);
22367 0 0         if (maskpp) free(maskpp);
22368 0 0         if (eltidspp) free(eltidspp);
22369              
22370 0           } } break; case PDL_LL: {
22371 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22372 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22373              
22374 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22375 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22376              
22377 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22378 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22379              
22380 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22381 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22382              
22383 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22384 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22385              
22386 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22387 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22388              
22389 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22390 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22391              
22392 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22393 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22394 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22395 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22396 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22397 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22398 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22399 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22400 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22401 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22402 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22403              
22404              
22405 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22406 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22407 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22408 0           int transpose=0;
22409             int rowid;
22410            
22411             PDL_COMMENT("THREADLOOPBEGIN")
22412 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22413 0           do { register PDL_Indx __tind1=0,__tind2=0;
22414 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22415 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22416 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22417 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22418 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22419 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22420 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22421 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22422 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22423 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22424 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22425 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22426 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22427 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22428 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22429 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22430 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22431 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22432 0           data_datap += __offsp[0];
22433 0           mask_datap += __offsp[1];
22434 0           weight_datap += __offsp[2];
22435 0           rowids_datap += __offsp[3];
22436 0           clustersizes_datap += __offsp[4];
22437 0           eltids_datap += __offsp[5];
22438 0           dist_datap += __offsp[6];
22439 0 0         for( __tind2 = 0 ;
22440             __tind2 < __tdims1 ;
22441 0           __tind2++
22442 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22443 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22444 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22445 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22446 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22447 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22448 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22449             )
22450             {
22451 0 0         for( __tind1 = 0 ;
22452             __tind1 < __tdims0 ;
22453 0           __tind1++
22454 0           ,data_datap += __tinc0_0
22455 0           ,mask_datap += __tinc0_1
22456 0           ,weight_datap += __tinc0_2
22457 0           ,rowids_datap += __tinc0_3
22458 0           ,clustersizes_datap += __tinc0_4
22459 0           ,eltids_datap += __tinc0_5
22460 0           ,dist_datap += __tinc0_6
22461             )
22462             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22463 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22464 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22465 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22466             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22467 0 0         for(nr=0; nr<(__nr_size); nr++) {
22468 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22469             {PDL_COMMENT("Open k") register PDL_Indx k;
22470 0 0         for(k=0; k<(__k_size); k++) {
22471 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22472 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22473 0           &rowid, eltidspp[k],
22474 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22475             }} PDL_COMMENT("Close k")
22476             }} PDL_COMMENT("Close nr")
22477            
22478             PDL_COMMENT("THREADLOOPEND")
22479             }
22480             }
22481 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22482 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22483 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22484 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22485 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22486 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22487 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22488 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22489             /*-- cleanup --*/
22490 0 0         if (datapp) free(datapp);
22491 0 0         if (maskpp) free(maskpp);
22492 0 0         if (eltidspp) free(eltidspp);
22493              
22494 0           } } break; case PDL_F: {
22495 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22496 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22497              
22498 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22499 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22500              
22501 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22502 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22503              
22504 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22505 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22506              
22507 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22508 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22509              
22510 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22511 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22512              
22513 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22514 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22515              
22516 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22517 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22518 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22519 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22520 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22521 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22522 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22523 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22524 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22525 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22526 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22527              
22528              
22529 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22530 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22531 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22532 0           int transpose=0;
22533             int rowid;
22534            
22535             PDL_COMMENT("THREADLOOPBEGIN")
22536 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22537 0           do { register PDL_Indx __tind1=0,__tind2=0;
22538 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22539 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22540 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22541 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22542 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22543 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22544 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22545 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22546 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22547 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22548 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22549 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22550 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22551 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22552 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22553 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22554 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22555 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22556 0           data_datap += __offsp[0];
22557 0           mask_datap += __offsp[1];
22558 0           weight_datap += __offsp[2];
22559 0           rowids_datap += __offsp[3];
22560 0           clustersizes_datap += __offsp[4];
22561 0           eltids_datap += __offsp[5];
22562 0           dist_datap += __offsp[6];
22563 0 0         for( __tind2 = 0 ;
22564             __tind2 < __tdims1 ;
22565 0           __tind2++
22566 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22567 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22568 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22569 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22570 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22571 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22572 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22573             )
22574             {
22575 0 0         for( __tind1 = 0 ;
22576             __tind1 < __tdims0 ;
22577 0           __tind1++
22578 0           ,data_datap += __tinc0_0
22579 0           ,mask_datap += __tinc0_1
22580 0           ,weight_datap += __tinc0_2
22581 0           ,rowids_datap += __tinc0_3
22582 0           ,clustersizes_datap += __tinc0_4
22583 0           ,eltids_datap += __tinc0_5
22584 0           ,dist_datap += __tinc0_6
22585             )
22586             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22587 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22588 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22589 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22590             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22591 0 0         for(nr=0; nr<(__nr_size); nr++) {
22592 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22593             {PDL_COMMENT("Open k") register PDL_Indx k;
22594 0 0         for(k=0; k<(__k_size); k++) {
22595 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22596 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22597 0           &rowid, eltidspp[k],
22598 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22599             }} PDL_COMMENT("Close k")
22600             }} PDL_COMMENT("Close nr")
22601            
22602             PDL_COMMENT("THREADLOOPEND")
22603             }
22604             }
22605 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22606 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22607 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22608 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22609 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22610 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22611 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22612 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22613             /*-- cleanup --*/
22614 0 0         if (datapp) free(datapp);
22615 0 0         if (maskpp) free(maskpp);
22616 0 0         if (eltidspp) free(eltidspp);
22617              
22618 0           } } break; case PDL_D: {
22619 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22620 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22621              
22622 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22623 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22624              
22625 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22626 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22627              
22628 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22629 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22630              
22631 0 0         PDL_Long * clustersizes_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22632 0           PDL_Long * clustersizes_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22633              
22634 0 0         PDL_Long * eltids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22635 0           PDL_Long * eltids_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22636              
22637 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22638 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[6])->data));
22639              
22640 0           {register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
22641 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22642 0           register PDL_Indx __inc_dist_k = __privtrans->__inc_dist_k;
22643 0           register PDL_Indx __inc_dist_nr = __privtrans->__inc_dist_nr;
22644 0           register PDL_Indx __inc_clustersizes_k = __privtrans->__inc_clustersizes_k;
22645 0           register PDL_Indx __inc_eltids_mcsize = __privtrans->__inc_eltids_mcsize;
22646 0           register PDL_Indx __inc_eltids_k = __privtrans->__inc_eltids_k;
22647 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22648 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22649 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22650 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22651              
22652              
22653 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
22654 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
22655 0           int **eltidspp = (int **)pp_alloc(__privtrans->__k_size);
22656 0           int transpose=0;
22657             int rowid;
22658            
22659             PDL_COMMENT("THREADLOOPBEGIN")
22660 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
22661 0           do { register PDL_Indx __tind1=0,__tind2=0;
22662 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
22663 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
22664 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
22665 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
22666 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
22667 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
22668 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
22669 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
22670 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
22671 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
22672 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
22673 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
22674 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
22675 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
22676 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
22677 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
22678 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
22679 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
22680 0           data_datap += __offsp[0];
22681 0           mask_datap += __offsp[1];
22682 0           weight_datap += __offsp[2];
22683 0           rowids_datap += __offsp[3];
22684 0           clustersizes_datap += __offsp[4];
22685 0           eltids_datap += __offsp[5];
22686 0           dist_datap += __offsp[6];
22687 0 0         for( __tind2 = 0 ;
22688             __tind2 < __tdims1 ;
22689 0           __tind2++
22690 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
22691 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
22692 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
22693 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
22694 0           ,clustersizes_datap += __tinc1_4 - __tinc0_4 * __tdims0
22695 0           ,eltids_datap += __tinc1_5 - __tinc0_5 * __tdims0
22696 0           ,dist_datap += __tinc1_6 - __tinc0_6 * __tdims0
22697             )
22698             {
22699 0 0         for( __tind1 = 0 ;
22700             __tind1 < __tdims0 ;
22701 0           __tind1++
22702 0           ,data_datap += __tinc0_0
22703 0           ,mask_datap += __tinc0_1
22704 0           ,weight_datap += __tinc0_2
22705 0           ,rowids_datap += __tinc0_3
22706 0           ,clustersizes_datap += __tinc0_4
22707 0           ,eltids_datap += __tinc0_5
22708 0           ,dist_datap += __tinc0_6
22709             )
22710             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
22711 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
22712 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
22713 0           p2pp_int(__privtrans->__k_size, __privtrans->__mcsize_size, eltids_datap, eltidspp);
22714             {PDL_COMMENT("Open nr") register PDL_Indx nr;
22715 0 0         for(nr=0; nr<(__nr_size); nr++) {
22716 0 0         rowid = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
22717             {PDL_COMMENT("Open k") register PDL_Indx k;
22718 0 0         for(k=0; k<(__k_size); k++) {
22719 0 0         (dist_datap)[0+(__inc_dist_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_dist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
22720 0 0         1, (clustersizes_datap)[0+(__inc_clustersizes_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ,
22721 0           &rowid, eltidspp[k],
22722 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
22723             }} PDL_COMMENT("Close k")
22724             }} PDL_COMMENT("Close nr")
22725            
22726             PDL_COMMENT("THREADLOOPEND")
22727             }
22728             }
22729 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
22730 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
22731 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
22732 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
22733 0           clustersizes_datap -= __tinc1_4 * __tdims1 + __offsp[4];
22734 0           eltids_datap -= __tinc1_5 * __tdims1 + __offsp[5];
22735 0           dist_datap -= __tinc1_6 * __tdims1 + __offsp[6];
22736 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
22737             /*-- cleanup --*/
22738 0 0         if (datapp) free(datapp);
22739 0 0         if (maskpp) free(maskpp);
22740 0 0         if (eltidspp) free(eltidspp);
22741              
22742 0           } break;}
22743 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
22744             }
22745             }
22746             }
22747            
22748              
22749              
22750              
22751 5           void pdl_clusterdistancematrix_free(pdl_trans *__tr ) {
22752             int __dim;
22753 5           pdl_clusterdistancematrix_struct *__privtrans = (pdl_clusterdistancematrix_struct *) __tr;
22754            
22755             {
22756            
22757 5           PDL_TR_CLRMAGIC(__privtrans);
22758 5           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
22759 5 50         if(__privtrans->__ddone) {
22760 5           PDL->freethreadloop(&(__privtrans->__pdlthread));
22761             ;;;;;;;;;;;;;;;;;
22762             }
22763            
22764             }
22765 5           }
22766            
22767              
22768              
22769              
22770             static char pdl_clusterdistancematrix_vtable_flags[] =
22771             { 0,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK};
22772             pdl_transvtable pdl_clusterdistancematrix_vtable = {
22773             0,0, 6, 7, pdl_clusterdistancematrix_vtable_flags,
22774             pdl_clusterdistancematrix_redodims, pdl_clusterdistancematrix_readdata, NULL,
22775             pdl_clusterdistancematrix_free,NULL,NULL,pdl_clusterdistancematrix_copy,
22776             sizeof(pdl_clusterdistancematrix_struct),"pdl_clusterdistancematrix_vtable"
22777             };
22778              
22779             typedef struct pdl_clusterdistancematrixenc_struct {
22780             PDL_TRANS_START(8);
22781             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_clens1_k1;PDL_Indx __inc_crowids1_nc1;PDL_Indx __inc_clens2_k2;PDL_Indx __inc_crowids2_nc2;PDL_Indx __inc_dist_k1;PDL_Indx __inc_dist_k2;PDL_Indx __n_size;PDL_Indx __k1_size;PDL_Indx __k2_size;PDL_Indx __d_size;PDL_Indx __nc1_size;PDL_Indx __nc2_size;
22782             char *distFlag;char *methodFlag;
22783             char __ddone; PDL_COMMENT("Dims done")
22784             } pdl_clusterdistancematrixenc_struct;
22785              
22786 0           void pdl_clusterdistancematrixenc_redodims(pdl_trans *__tr ) {
22787             int __dim;
22788 0           pdl_clusterdistancematrixenc_struct *__privtrans = (pdl_clusterdistancematrixenc_struct *) __tr;
22789            
22790             {
22791             PDL_Indx __creating[8];
22792 0           __privtrans->__n_size = -1;
22793 0           __privtrans->__k1_size = -1;
22794 0           __privtrans->__k2_size = -1;
22795 0           __privtrans->__d_size = -1;
22796 0           __privtrans->__nc1_size = -1;
22797 0           __privtrans->__nc2_size = -1;
22798 0           __creating[0] = 0;
22799 0           __creating[1] = 0;
22800 0           __creating[2] = 0;
22801 0           __creating[3] = 0;
22802 0           __creating[4] = 0;
22803 0           __creating[5] = 0;
22804 0           __creating[6] = 0;
22805 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
22806             {
22807             {PDL_COMMENT("Start generic loop")
22808              
22809 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
22810 0           } break; case PDL_B: {
22811 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22812 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22813              
22814 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22815 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22816              
22817 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22818 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22819              
22820 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22821 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22822              
22823 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22824 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22825              
22826 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22827 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22828              
22829 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22830 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
22831              
22832 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
22833 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
22834              
22835 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
22836 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
22837 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
22838 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22839 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22840 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22841 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22842 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22843 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
22844 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
22845 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
22846              
22847             PDL_COMMENT("none")
22848 0           } } break; case PDL_S: {
22849 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22850 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22851              
22852 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22853 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22854              
22855 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22856 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22857              
22858 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22859 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22860              
22861 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22862 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22863              
22864 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22865 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22866              
22867 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22868 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
22869              
22870 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
22871 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
22872              
22873 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
22874 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
22875 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
22876 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22877 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22878 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22879 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22880 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22881 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
22882 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
22883 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
22884              
22885             PDL_COMMENT("none")
22886 0           } } break; case PDL_US: {
22887 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22888 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22889              
22890 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22891 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22892              
22893 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22894 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22895              
22896 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22897 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22898              
22899 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22900 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22901              
22902 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22903 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22904              
22905 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22906 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
22907              
22908 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
22909 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
22910              
22911 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
22912 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
22913 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
22914 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22915 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22916 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22917 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22918 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22919 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
22920 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
22921 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
22922              
22923             PDL_COMMENT("none")
22924 0           } } break; case PDL_L: {
22925 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22926 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22927              
22928 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22929 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22930              
22931 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22932 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22933              
22934 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22935 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22936              
22937 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22938 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22939              
22940 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22941 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22942              
22943 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22944 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
22945              
22946 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
22947 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
22948              
22949 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
22950 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
22951 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
22952 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22953 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22954 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22955 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22956 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22957 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
22958 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
22959 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
22960              
22961             PDL_COMMENT("none")
22962 0           } } break; case PDL_IND: {
22963 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
22964 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
22965              
22966 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
22967 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
22968              
22969 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
22970 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
22971              
22972 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
22973 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
22974              
22975 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
22976 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
22977              
22978 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
22979 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
22980              
22981 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
22982 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
22983              
22984 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
22985 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
22986              
22987 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
22988 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
22989 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
22990 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
22991 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
22992 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
22993 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
22994 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
22995 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
22996 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
22997 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
22998              
22999             PDL_COMMENT("none")
23000 0           } } break; case PDL_LL: {
23001 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23002 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23003              
23004 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23005 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23006              
23007 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23008 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23009              
23010 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23011 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23012              
23013 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23014 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23015              
23016 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23017 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23018              
23019 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23020 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23021              
23022 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23023 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23024              
23025 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23026 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23027 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23028 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23029 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23030 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23031 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23032 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23033 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23034 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23035 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23036              
23037             PDL_COMMENT("none")
23038 0           } } break; case PDL_F: {
23039 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23040 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23041              
23042 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23043 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23044              
23045 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23046 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23047              
23048 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23049 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23050              
23051 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23052 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23053              
23054 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23055 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23056              
23057 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23058 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23059              
23060 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23061 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23062              
23063 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23064 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23065 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23066 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23067 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23068 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23069 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23070 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23071 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23072 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23073 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23074              
23075             PDL_COMMENT("none")
23076 0           } } break; case PDL_D: {
23077 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23078 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23079              
23080 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23081 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23082              
23083 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23084 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23085              
23086 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23087 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23088              
23089 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23090 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23091              
23092 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23093 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23094              
23095 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23096 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23097              
23098 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23099 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23100              
23101 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23102 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23103 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23104 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23105 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23106 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23107 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23108 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23109 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23110 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23111 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23112              
23113             PDL_COMMENT("none")
23114 0           } break;}
23115 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
23116             }
23117             }
23118             {
23119             static char *__parnames[] = {"data","mask","weight","clens1","crowids1","clens2","crowids2","dist"};
23120             static PDL_Indx __realdims[] = {2,2,1,1,1,1,1,2};
23121             static char __funcname[] = "PDL::Cluster::clusterdistancematrixenc";
23122             static pdl_errorinfo __einfo = {
23123             __funcname, __parnames, 8
23124             };
23125            
23126 0           PDL->initthreadstruct(2,__privtrans->pdls,
23127             __realdims,__creating,8,
23128             &__einfo,&(__privtrans->__pdlthread),
23129 0           __privtrans->vtable->per_pdl_flags,
23130             0 );
23131             }
23132 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
23133 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
23134 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
23135             }
23136 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
23137 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
23138 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
23139 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
23140 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23141             }
23142             }
23143 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
23144 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
23145 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
23146 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
23147 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23148             }
23149             }
23150 0           PDL->make_physical(((__privtrans->pdls[0])));
23151 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
23152 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
23153 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
23154             }
23155 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
23156 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
23157 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
23158 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
23159 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23160             }
23161             }
23162 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
23163 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
23164 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
23165 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
23166 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23167             }
23168             }
23169 0           PDL->make_physical(((__privtrans->pdls[1])));
23170 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
23171 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
23172             }
23173 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
23174 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
23175 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
23176 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
23177 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23178             }
23179             }
23180 0           PDL->make_physical(((__privtrans->pdls[2])));
23181 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
23182 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__k1_size <= 1) __privtrans->__k1_size = 1;
    0          
23183             }
23184 0 0         if(__privtrans->__k1_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k1_size == 1)) {
    0          
    0          
23185 0           __privtrans->__k1_size = ((__privtrans->pdls[3]))->dims[0];
23186 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k1_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
23187 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
23188 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23189             }
23190             }
23191 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
23192 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__nc1_size <= 1) __privtrans->__nc1_size = 1;
    0          
23193             }
23194 0 0         if(__privtrans->__nc1_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nc1_size == 1)) {
    0          
    0          
23195 0           __privtrans->__nc1_size = ((__privtrans->pdls[4]))->dims[0];
23196 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nc1_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
23197 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
23198 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23199             }
23200             }
23201 0           PDL->make_physical(((__privtrans->pdls[4])));
23202 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
23203 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__k2_size <= 1) __privtrans->__k2_size = 1;
    0          
23204             }
23205 0 0         if(__privtrans->__k2_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__k2_size == 1)) {
    0          
    0          
23206 0           __privtrans->__k2_size = ((__privtrans->pdls[5]))->dims[0];
23207 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__k2_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
23208 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
23209 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23210             }
23211             }
23212 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
23213 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__nc2_size <= 1) __privtrans->__nc2_size = 1;
    0          
23214             }
23215 0 0         if(__privtrans->__nc2_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nc2_size == 1)) {
    0          
    0          
23216 0           __privtrans->__nc2_size = ((__privtrans->pdls[6]))->dims[0];
23217 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nc2_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
23218 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
23219 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23220             }
23221             }
23222 0           PDL->make_physical(((__privtrans->pdls[6])));
23223 0 0         if(!__creating[7]) {
23224 0 0         if(((__privtrans->pdls[7]))->ndims < 2) {
23225 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__k1_size <= 1) __privtrans->__k1_size = 1;
    0          
23226 0 0         if (((__privtrans->pdls[7]))->ndims < 2 && __privtrans->__k2_size <= 1) __privtrans->__k2_size = 1;
    0          
23227             }
23228 0 0         if(__privtrans->__k1_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__k1_size == 1)) {
    0          
    0          
23229 0           __privtrans->__k1_size = ((__privtrans->pdls[7]))->dims[0];
23230 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__k1_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
23231 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
23232 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23233             }
23234             }
23235 0 0         if(__privtrans->__k2_size == -1 || (((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__k2_size == 1)) {
    0          
    0          
23236 0           __privtrans->__k2_size = ((__privtrans->pdls[7]))->dims[1];
23237 0 0         } else if(((__privtrans->pdls[7]))->ndims > 1 && __privtrans->__k2_size != ((__privtrans->pdls[7]))->dims[1]) {
    0          
23238 0 0         if(((__privtrans->pdls[7]))->dims[1] != 1) {
23239 0           PDL->pdl_barf("Error in clusterdistancematrixenc:" "Wrong dims\n");
23240             }
23241             }
23242             } else {
23243 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k1_size;dims[1] = __privtrans->__k2_size;
23244 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
23245             }
23246             { PDL_COMMENT("convenience block")
23247 0           void *hdrp = NULL;
23248 0           char propagate_hdrcpy = 0;
23249 0           SV *hdr_copy = NULL;
23250 0 0         if(!hdrp &&
    0          
23251 0 0         __privtrans->pdls[0]->hdrsv &&
23252 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
23253             ) {
23254 0           hdrp = __privtrans->pdls[0]->hdrsv;
23255 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
23256             }
23257 0 0         if(!hdrp &&
    0          
23258 0 0         __privtrans->pdls[1]->hdrsv &&
23259 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
23260             ) {
23261 0           hdrp = __privtrans->pdls[1]->hdrsv;
23262 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
23263             }
23264 0 0         if(!hdrp &&
    0          
23265 0 0         __privtrans->pdls[2]->hdrsv &&
23266 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
23267             ) {
23268 0           hdrp = __privtrans->pdls[2]->hdrsv;
23269 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
23270             }
23271 0 0         if(!hdrp &&
    0          
23272 0 0         __privtrans->pdls[3]->hdrsv &&
23273 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
23274             ) {
23275 0           hdrp = __privtrans->pdls[3]->hdrsv;
23276 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
23277             }
23278 0 0         if(!hdrp &&
    0          
23279 0 0         __privtrans->pdls[4]->hdrsv &&
23280 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
23281             ) {
23282 0           hdrp = __privtrans->pdls[4]->hdrsv;
23283 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
23284             }
23285 0 0         if(!hdrp &&
    0          
23286 0 0         __privtrans->pdls[5]->hdrsv &&
23287 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
23288             ) {
23289 0           hdrp = __privtrans->pdls[5]->hdrsv;
23290 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
23291             }
23292 0 0         if(!hdrp &&
    0          
23293 0 0         __privtrans->pdls[6]->hdrsv &&
23294 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
23295             ) {
23296 0           hdrp = __privtrans->pdls[6]->hdrsv;
23297 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
23298             }
23299 0 0         if(!hdrp &&
    0          
23300 0 0         !__creating[7] &&
23301 0 0         __privtrans->pdls[7]->hdrsv &&
23302 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
23303             ) {
23304 0           hdrp = __privtrans->pdls[7]->hdrsv;
23305 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
23306             }
23307 0 0         if (hdrp) {
23308 0 0         if(hdrp == &PL_sv_undef)
23309 0           hdr_copy = &PL_sv_undef;
23310             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
23311             int count;
23312             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
23313 0           dSP;
23314 0           ENTER ;
23315 0           SAVETMPS ;
23316 0 0         PUSHMARK(SP) ;
23317 0 0         XPUSHs( hdrp );
23318 0           PUTBACK ;
23319 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
23320 0           SPAGAIN ;
23321 0 0         if(count != 1)
23322 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
23323              
23324 0           hdr_copy = (SV *)POPs;
23325              
23326 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
23327 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
23328             }
23329              
23330 0 0         FREETMPS ;
23331 0           LEAVE ;
23332              
23333              
23334             } PDL_COMMENT("end of callback block")
23335              
23336 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
23337 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
23338 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
23339 0 0         if( hdr_copy != &PL_sv_undef )
23340 0           (void)SvREFCNT_inc(hdr_copy);
23341 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
23342             }
23343 0 0         if(propagate_hdrcpy)
23344 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
23345              
23346 0 0         if(hdr_copy != &PL_sv_undef)
23347 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
23348             } PDL_COMMENT("end of if(hdrp) block")
23349             } PDL_COMMENT("end of conv. block")
23350 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
23351 0           __privtrans->__inc_data_d = 0; else
23352 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
23353 0           __privtrans->__inc_data_n = 0; else
23354 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
23355 0           __privtrans->__inc_mask_d = 0; else
23356 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
23357 0           __privtrans->__inc_mask_n = 0; else
23358 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
23359 0           __privtrans->__inc_weight_d = 0; else
23360 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
23361 0           __privtrans->__inc_clens1_k1 = 0; else
23362 0 0         __privtrans->__inc_clens1_k1 = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
23363 0           __privtrans->__inc_crowids1_nc1 = 0; else
23364 0 0         __privtrans->__inc_crowids1_nc1 = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
23365 0           __privtrans->__inc_clens2_k2 = 0; else
23366 0 0         __privtrans->__inc_clens2_k2 = PDL_REPRINC(__privtrans->pdls[5],0);if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
    0          
23367 0           __privtrans->__inc_crowids2_nc2 = 0; else
23368 0 0         __privtrans->__inc_crowids2_nc2 = __privtrans->pdls[6]->dimincs[0];if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
23369 0           __privtrans->__inc_dist_k1 = 0; else
23370 0 0         __privtrans->__inc_dist_k1 = PDL_REPRINC(__privtrans->pdls[7],0);if(__privtrans->pdls[7]->ndims <= 1 || __privtrans->pdls[7]->dims[1] <= 1)
    0          
    0          
23371 0           __privtrans->__inc_dist_k2 = 0; else
23372 0 0         __privtrans->__inc_dist_k2 = PDL_REPRINC(__privtrans->pdls[7],1); __privtrans->__ddone = 1;
23373             }
23374 0           }
23375            
23376              
23377 0           pdl_trans * pdl_clusterdistancematrixenc_copy(pdl_trans *__tr ) {
23378             int __dim;
23379 0           pdl_clusterdistancematrixenc_struct *__privtrans = (pdl_clusterdistancematrixenc_struct *) __tr;
23380            
23381             {
23382 0           pdl_clusterdistancematrixenc_struct *__copy = malloc(sizeof(pdl_clusterdistancematrixenc_struct));
23383 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
23384 0           __copy->has_badvalue = __privtrans->has_badvalue;
23385 0           __copy->badvalue = __privtrans->badvalue;
23386 0           __copy->flags = __privtrans->flags;
23387 0           __copy->vtable = __privtrans->vtable;
23388 0           __copy->__datatype = __privtrans->__datatype;
23389 0           __copy->freeproc = NULL;
23390 0           __copy->__ddone = __privtrans->__ddone;
23391             {int i;
23392 0 0         for(i=0; i<__copy->vtable->npdls; i++)
23393 0           __copy->pdls[i] = __privtrans->pdls[i];
23394             }
23395 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
23396 0 0         if(__copy->__ddone) {
23397 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_clens1_k1=__copy->__inc_clens1_k1;__privtrans->__inc_crowids1_nc1=__copy->__inc_crowids1_nc1;__privtrans->__inc_clens2_k2=__copy->__inc_clens2_k2;__privtrans->__inc_crowids2_nc2=__copy->__inc_crowids2_nc2;__privtrans->__inc_dist_k1=__copy->__inc_dist_k1;__privtrans->__inc_dist_k2=__copy->__inc_dist_k2;__copy->__n_size=__privtrans->__n_size;__copy->__k1_size=__privtrans->__k1_size;__copy->__k2_size=__privtrans->__k2_size;__copy->__d_size=__privtrans->__d_size;__copy->__nc1_size=__privtrans->__nc1_size;__copy->__nc2_size=__privtrans->__nc2_size;
23398             }
23399 0           return (pdl_trans*)__copy;
23400             }
23401             }
23402            
23403              
23404 0           void pdl_clusterdistancematrixenc_readdata(pdl_trans *__tr ) {
23405             int __dim;
23406 0           pdl_clusterdistancematrixenc_struct *__privtrans = (pdl_clusterdistancematrixenc_struct *) __tr;
23407            
23408             {
23409 0           {register PDL_Indx __k1_size = __privtrans->__k1_size;
23410 0           register PDL_Indx __k2_size = __privtrans->__k2_size;
23411             PDL_COMMENT("Start generic loop")
23412              
23413 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
23414 0           } break; case PDL_B: {
23415 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23416 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23417              
23418 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23419 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23420              
23421 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23422 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23423              
23424 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23425 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23426              
23427 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23428 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23429              
23430 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23431 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23432              
23433 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23434 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23435              
23436 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23437 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23438              
23439 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23440 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23441 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23442 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23443 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23444 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23445 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23446 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23447 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23448 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23449 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23450              
23451              
23452 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
23453 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
23454 0           int transpose=0;
23455             int *crowids1p, *crowids2p;
23456            
23457             PDL_COMMENT("THREADLOOPBEGIN")
23458 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
23459 0           do { register PDL_Indx __tind1=0,__tind2=0;
23460 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
23461 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
23462 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
23463 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
23464 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
23465 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
23466 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
23467 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
23468 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
23469 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
23470 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
23471 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
23472 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
23473 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
23474 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
23475 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
23476 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
23477 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
23478 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
23479 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
23480 0           data_datap += __offsp[0];
23481 0           mask_datap += __offsp[1];
23482 0           weight_datap += __offsp[2];
23483 0           clens1_datap += __offsp[3];
23484 0           crowids1_datap += __offsp[4];
23485 0           clens2_datap += __offsp[5];
23486 0           crowids2_datap += __offsp[6];
23487 0           dist_datap += __offsp[7];
23488 0 0         for( __tind2 = 0 ;
23489             __tind2 < __tdims1 ;
23490 0           __tind2++
23491 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
23492 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
23493 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
23494 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
23495 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
23496 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
23497 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
23498 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
23499             )
23500             {
23501 0 0         for( __tind1 = 0 ;
23502             __tind1 < __tdims0 ;
23503 0           __tind1++
23504 0           ,data_datap += __tinc0_0
23505 0           ,mask_datap += __tinc0_1
23506 0           ,weight_datap += __tinc0_2
23507 0           ,clens1_datap += __tinc0_3
23508 0           ,crowids1_datap += __tinc0_4
23509 0           ,clens2_datap += __tinc0_5
23510 0           ,crowids2_datap += __tinc0_6
23511 0           ,dist_datap += __tinc0_7
23512             )
23513             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
23514 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
23515 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
23516 0           crowids1p = crowids1_datap;
23517             {PDL_COMMENT("Open k1") register PDL_Indx k1;
23518 0 0         for(k1=0; k1<(__k1_size); k1++) {
23519 0           crowids2p = crowids2_datap;
23520             {PDL_COMMENT("Open k2") register PDL_Indx k2;
23521 0 0         for(k2=0; k2<(__k2_size); k2++) {
23522 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
23523 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
23524             crowids1p, crowids2p,
23525 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
23526 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
23527             }} PDL_COMMENT("Close k2")
23528 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
23529             }} PDL_COMMENT("Close k1")
23530            
23531             PDL_COMMENT("THREADLOOPEND")
23532             }
23533             }
23534 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
23535 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
23536 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
23537 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
23538 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
23539 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
23540 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
23541 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
23542 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
23543             /*-- cleanup --*/
23544 0 0         if (datapp) free(datapp);
23545 0 0         if (maskpp) free(maskpp);
23546              
23547 0           } } break; case PDL_S: {
23548 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23549 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23550              
23551 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23552 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23553              
23554 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23555 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23556              
23557 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23558 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23559              
23560 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23561 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23562              
23563 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23564 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23565              
23566 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23567 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23568              
23569 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23570 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23571              
23572 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23573 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23574 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23575 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23576 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23577 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23578 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23579 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23580 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23581 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23582 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23583              
23584              
23585 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
23586 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
23587 0           int transpose=0;
23588             int *crowids1p, *crowids2p;
23589            
23590             PDL_COMMENT("THREADLOOPBEGIN")
23591 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
23592 0           do { register PDL_Indx __tind1=0,__tind2=0;
23593 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
23594 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
23595 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
23596 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
23597 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
23598 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
23599 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
23600 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
23601 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
23602 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
23603 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
23604 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
23605 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
23606 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
23607 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
23608 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
23609 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
23610 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
23611 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
23612 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
23613 0           data_datap += __offsp[0];
23614 0           mask_datap += __offsp[1];
23615 0           weight_datap += __offsp[2];
23616 0           clens1_datap += __offsp[3];
23617 0           crowids1_datap += __offsp[4];
23618 0           clens2_datap += __offsp[5];
23619 0           crowids2_datap += __offsp[6];
23620 0           dist_datap += __offsp[7];
23621 0 0         for( __tind2 = 0 ;
23622             __tind2 < __tdims1 ;
23623 0           __tind2++
23624 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
23625 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
23626 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
23627 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
23628 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
23629 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
23630 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
23631 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
23632             )
23633             {
23634 0 0         for( __tind1 = 0 ;
23635             __tind1 < __tdims0 ;
23636 0           __tind1++
23637 0           ,data_datap += __tinc0_0
23638 0           ,mask_datap += __tinc0_1
23639 0           ,weight_datap += __tinc0_2
23640 0           ,clens1_datap += __tinc0_3
23641 0           ,crowids1_datap += __tinc0_4
23642 0           ,clens2_datap += __tinc0_5
23643 0           ,crowids2_datap += __tinc0_6
23644 0           ,dist_datap += __tinc0_7
23645             )
23646             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
23647 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
23648 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
23649 0           crowids1p = crowids1_datap;
23650             {PDL_COMMENT("Open k1") register PDL_Indx k1;
23651 0 0         for(k1=0; k1<(__k1_size); k1++) {
23652 0           crowids2p = crowids2_datap;
23653             {PDL_COMMENT("Open k2") register PDL_Indx k2;
23654 0 0         for(k2=0; k2<(__k2_size); k2++) {
23655 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
23656 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
23657             crowids1p, crowids2p,
23658 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
23659 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
23660             }} PDL_COMMENT("Close k2")
23661 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
23662             }} PDL_COMMENT("Close k1")
23663            
23664             PDL_COMMENT("THREADLOOPEND")
23665             }
23666             }
23667 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
23668 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
23669 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
23670 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
23671 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
23672 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
23673 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
23674 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
23675 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
23676             /*-- cleanup --*/
23677 0 0         if (datapp) free(datapp);
23678 0 0         if (maskpp) free(maskpp);
23679              
23680 0           } } break; case PDL_US: {
23681 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23682 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23683              
23684 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23685 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23686              
23687 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23688 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23689              
23690 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23691 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23692              
23693 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23694 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23695              
23696 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23697 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23698              
23699 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23700 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23701              
23702 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23703 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23704              
23705 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23706 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23707 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23708 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23709 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23710 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23711 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23712 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23713 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23714 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23715 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23716              
23717              
23718 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
23719 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
23720 0           int transpose=0;
23721             int *crowids1p, *crowids2p;
23722            
23723             PDL_COMMENT("THREADLOOPBEGIN")
23724 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
23725 0           do { register PDL_Indx __tind1=0,__tind2=0;
23726 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
23727 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
23728 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
23729 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
23730 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
23731 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
23732 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
23733 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
23734 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
23735 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
23736 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
23737 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
23738 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
23739 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
23740 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
23741 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
23742 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
23743 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
23744 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
23745 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
23746 0           data_datap += __offsp[0];
23747 0           mask_datap += __offsp[1];
23748 0           weight_datap += __offsp[2];
23749 0           clens1_datap += __offsp[3];
23750 0           crowids1_datap += __offsp[4];
23751 0           clens2_datap += __offsp[5];
23752 0           crowids2_datap += __offsp[6];
23753 0           dist_datap += __offsp[7];
23754 0 0         for( __tind2 = 0 ;
23755             __tind2 < __tdims1 ;
23756 0           __tind2++
23757 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
23758 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
23759 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
23760 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
23761 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
23762 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
23763 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
23764 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
23765             )
23766             {
23767 0 0         for( __tind1 = 0 ;
23768             __tind1 < __tdims0 ;
23769 0           __tind1++
23770 0           ,data_datap += __tinc0_0
23771 0           ,mask_datap += __tinc0_1
23772 0           ,weight_datap += __tinc0_2
23773 0           ,clens1_datap += __tinc0_3
23774 0           ,crowids1_datap += __tinc0_4
23775 0           ,clens2_datap += __tinc0_5
23776 0           ,crowids2_datap += __tinc0_6
23777 0           ,dist_datap += __tinc0_7
23778             )
23779             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
23780 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
23781 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
23782 0           crowids1p = crowids1_datap;
23783             {PDL_COMMENT("Open k1") register PDL_Indx k1;
23784 0 0         for(k1=0; k1<(__k1_size); k1++) {
23785 0           crowids2p = crowids2_datap;
23786             {PDL_COMMENT("Open k2") register PDL_Indx k2;
23787 0 0         for(k2=0; k2<(__k2_size); k2++) {
23788 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
23789 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
23790             crowids1p, crowids2p,
23791 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
23792 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
23793             }} PDL_COMMENT("Close k2")
23794 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
23795             }} PDL_COMMENT("Close k1")
23796            
23797             PDL_COMMENT("THREADLOOPEND")
23798             }
23799             }
23800 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
23801 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
23802 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
23803 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
23804 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
23805 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
23806 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
23807 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
23808 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
23809             /*-- cleanup --*/
23810 0 0         if (datapp) free(datapp);
23811 0 0         if (maskpp) free(maskpp);
23812              
23813 0           } } break; case PDL_L: {
23814 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23815 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23816              
23817 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23818 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23819              
23820 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23821 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23822              
23823 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23824 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23825              
23826 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23827 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23828              
23829 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23830 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23831              
23832 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23833 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23834              
23835 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23836 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23837              
23838 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23839 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23840 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23841 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23842 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23843 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23844 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23845 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23846 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23847 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23848 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23849              
23850              
23851 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
23852 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
23853 0           int transpose=0;
23854             int *crowids1p, *crowids2p;
23855            
23856             PDL_COMMENT("THREADLOOPBEGIN")
23857 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
23858 0           do { register PDL_Indx __tind1=0,__tind2=0;
23859 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
23860 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
23861 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
23862 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
23863 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
23864 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
23865 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
23866 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
23867 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
23868 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
23869 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
23870 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
23871 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
23872 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
23873 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
23874 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
23875 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
23876 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
23877 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
23878 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
23879 0           data_datap += __offsp[0];
23880 0           mask_datap += __offsp[1];
23881 0           weight_datap += __offsp[2];
23882 0           clens1_datap += __offsp[3];
23883 0           crowids1_datap += __offsp[4];
23884 0           clens2_datap += __offsp[5];
23885 0           crowids2_datap += __offsp[6];
23886 0           dist_datap += __offsp[7];
23887 0 0         for( __tind2 = 0 ;
23888             __tind2 < __tdims1 ;
23889 0           __tind2++
23890 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
23891 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
23892 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
23893 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
23894 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
23895 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
23896 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
23897 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
23898             )
23899             {
23900 0 0         for( __tind1 = 0 ;
23901             __tind1 < __tdims0 ;
23902 0           __tind1++
23903 0           ,data_datap += __tinc0_0
23904 0           ,mask_datap += __tinc0_1
23905 0           ,weight_datap += __tinc0_2
23906 0           ,clens1_datap += __tinc0_3
23907 0           ,crowids1_datap += __tinc0_4
23908 0           ,clens2_datap += __tinc0_5
23909 0           ,crowids2_datap += __tinc0_6
23910 0           ,dist_datap += __tinc0_7
23911             )
23912             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
23913 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
23914 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
23915 0           crowids1p = crowids1_datap;
23916             {PDL_COMMENT("Open k1") register PDL_Indx k1;
23917 0 0         for(k1=0; k1<(__k1_size); k1++) {
23918 0           crowids2p = crowids2_datap;
23919             {PDL_COMMENT("Open k2") register PDL_Indx k2;
23920 0 0         for(k2=0; k2<(__k2_size); k2++) {
23921 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
23922 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
23923             crowids1p, crowids2p,
23924 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
23925 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
23926             }} PDL_COMMENT("Close k2")
23927 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
23928             }} PDL_COMMENT("Close k1")
23929            
23930             PDL_COMMENT("THREADLOOPEND")
23931             }
23932             }
23933 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
23934 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
23935 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
23936 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
23937 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
23938 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
23939 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
23940 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
23941 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
23942             /*-- cleanup --*/
23943 0 0         if (datapp) free(datapp);
23944 0 0         if (maskpp) free(maskpp);
23945              
23946 0           } } break; case PDL_IND: {
23947 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
23948 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
23949              
23950 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
23951 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
23952              
23953 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
23954 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
23955              
23956 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
23957 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
23958              
23959 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
23960 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
23961              
23962 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
23963 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
23964              
23965 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
23966 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
23967              
23968 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
23969 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
23970              
23971 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
23972 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
23973 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
23974 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
23975 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
23976 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
23977 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
23978 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
23979 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
23980 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
23981 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
23982              
23983              
23984 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
23985 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
23986 0           int transpose=0;
23987             int *crowids1p, *crowids2p;
23988            
23989             PDL_COMMENT("THREADLOOPBEGIN")
23990 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
23991 0           do { register PDL_Indx __tind1=0,__tind2=0;
23992 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
23993 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
23994 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
23995 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
23996 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
23997 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
23998 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
23999 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
24000 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
24001 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
24002 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
24003 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
24004 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
24005 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
24006 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
24007 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
24008 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
24009 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
24010 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
24011 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
24012 0           data_datap += __offsp[0];
24013 0           mask_datap += __offsp[1];
24014 0           weight_datap += __offsp[2];
24015 0           clens1_datap += __offsp[3];
24016 0           crowids1_datap += __offsp[4];
24017 0           clens2_datap += __offsp[5];
24018 0           crowids2_datap += __offsp[6];
24019 0           dist_datap += __offsp[7];
24020 0 0         for( __tind2 = 0 ;
24021             __tind2 < __tdims1 ;
24022 0           __tind2++
24023 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
24024 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
24025 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
24026 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
24027 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
24028 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
24029 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
24030 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
24031             )
24032             {
24033 0 0         for( __tind1 = 0 ;
24034             __tind1 < __tdims0 ;
24035 0           __tind1++
24036 0           ,data_datap += __tinc0_0
24037 0           ,mask_datap += __tinc0_1
24038 0           ,weight_datap += __tinc0_2
24039 0           ,clens1_datap += __tinc0_3
24040 0           ,crowids1_datap += __tinc0_4
24041 0           ,clens2_datap += __tinc0_5
24042 0           ,crowids2_datap += __tinc0_6
24043 0           ,dist_datap += __tinc0_7
24044             )
24045             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
24046 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
24047 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
24048 0           crowids1p = crowids1_datap;
24049             {PDL_COMMENT("Open k1") register PDL_Indx k1;
24050 0 0         for(k1=0; k1<(__k1_size); k1++) {
24051 0           crowids2p = crowids2_datap;
24052             {PDL_COMMENT("Open k2") register PDL_Indx k2;
24053 0 0         for(k2=0; k2<(__k2_size); k2++) {
24054 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
24055 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
24056             crowids1p, crowids2p,
24057 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
24058 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
24059             }} PDL_COMMENT("Close k2")
24060 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
24061             }} PDL_COMMENT("Close k1")
24062            
24063             PDL_COMMENT("THREADLOOPEND")
24064             }
24065             }
24066 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
24067 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
24068 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
24069 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
24070 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
24071 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
24072 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
24073 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
24074 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
24075             /*-- cleanup --*/
24076 0 0         if (datapp) free(datapp);
24077 0 0         if (maskpp) free(maskpp);
24078              
24079 0           } } break; case PDL_LL: {
24080 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24081 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24082              
24083 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24084 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24085              
24086 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24087 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24088              
24089 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24090 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24091              
24092 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24093 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24094              
24095 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24096 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24097              
24098 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24099 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24100              
24101 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24102 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
24103              
24104 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
24105 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
24106 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
24107 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24108 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24109 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24110 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24111 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24112 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24113 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
24114 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24115              
24116              
24117 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
24118 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
24119 0           int transpose=0;
24120             int *crowids1p, *crowids2p;
24121            
24122             PDL_COMMENT("THREADLOOPBEGIN")
24123 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
24124 0           do { register PDL_Indx __tind1=0,__tind2=0;
24125 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
24126 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
24127 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
24128 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
24129 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
24130 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
24131 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
24132 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
24133 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
24134 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
24135 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
24136 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
24137 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
24138 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
24139 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
24140 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
24141 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
24142 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
24143 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
24144 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
24145 0           data_datap += __offsp[0];
24146 0           mask_datap += __offsp[1];
24147 0           weight_datap += __offsp[2];
24148 0           clens1_datap += __offsp[3];
24149 0           crowids1_datap += __offsp[4];
24150 0           clens2_datap += __offsp[5];
24151 0           crowids2_datap += __offsp[6];
24152 0           dist_datap += __offsp[7];
24153 0 0         for( __tind2 = 0 ;
24154             __tind2 < __tdims1 ;
24155 0           __tind2++
24156 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
24157 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
24158 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
24159 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
24160 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
24161 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
24162 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
24163 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
24164             )
24165             {
24166 0 0         for( __tind1 = 0 ;
24167             __tind1 < __tdims0 ;
24168 0           __tind1++
24169 0           ,data_datap += __tinc0_0
24170 0           ,mask_datap += __tinc0_1
24171 0           ,weight_datap += __tinc0_2
24172 0           ,clens1_datap += __tinc0_3
24173 0           ,crowids1_datap += __tinc0_4
24174 0           ,clens2_datap += __tinc0_5
24175 0           ,crowids2_datap += __tinc0_6
24176 0           ,dist_datap += __tinc0_7
24177             )
24178             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
24179 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
24180 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
24181 0           crowids1p = crowids1_datap;
24182             {PDL_COMMENT("Open k1") register PDL_Indx k1;
24183 0 0         for(k1=0; k1<(__k1_size); k1++) {
24184 0           crowids2p = crowids2_datap;
24185             {PDL_COMMENT("Open k2") register PDL_Indx k2;
24186 0 0         for(k2=0; k2<(__k2_size); k2++) {
24187 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
24188 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
24189             crowids1p, crowids2p,
24190 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
24191 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
24192             }} PDL_COMMENT("Close k2")
24193 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
24194             }} PDL_COMMENT("Close k1")
24195            
24196             PDL_COMMENT("THREADLOOPEND")
24197             }
24198             }
24199 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
24200 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
24201 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
24202 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
24203 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
24204 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
24205 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
24206 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
24207 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
24208             /*-- cleanup --*/
24209 0 0         if (datapp) free(datapp);
24210 0 0         if (maskpp) free(maskpp);
24211              
24212 0           } } break; case PDL_F: {
24213 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24214 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24215              
24216 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24217 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24218              
24219 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24220 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24221              
24222 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24223 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24224              
24225 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24226 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24227              
24228 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24229 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24230              
24231 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24232 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24233              
24234 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24235 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
24236              
24237 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
24238 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
24239 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
24240 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24241 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24242 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24243 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24244 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24245 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24246 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
24247 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24248              
24249              
24250 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
24251 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
24252 0           int transpose=0;
24253             int *crowids1p, *crowids2p;
24254            
24255             PDL_COMMENT("THREADLOOPBEGIN")
24256 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
24257 0           do { register PDL_Indx __tind1=0,__tind2=0;
24258 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
24259 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
24260 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
24261 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
24262 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
24263 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
24264 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
24265 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
24266 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
24267 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
24268 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
24269 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
24270 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
24271 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
24272 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
24273 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
24274 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
24275 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
24276 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
24277 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
24278 0           data_datap += __offsp[0];
24279 0           mask_datap += __offsp[1];
24280 0           weight_datap += __offsp[2];
24281 0           clens1_datap += __offsp[3];
24282 0           crowids1_datap += __offsp[4];
24283 0           clens2_datap += __offsp[5];
24284 0           crowids2_datap += __offsp[6];
24285 0           dist_datap += __offsp[7];
24286 0 0         for( __tind2 = 0 ;
24287             __tind2 < __tdims1 ;
24288 0           __tind2++
24289 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
24290 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
24291 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
24292 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
24293 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
24294 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
24295 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
24296 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
24297             )
24298             {
24299 0 0         for( __tind1 = 0 ;
24300             __tind1 < __tdims0 ;
24301 0           __tind1++
24302 0           ,data_datap += __tinc0_0
24303 0           ,mask_datap += __tinc0_1
24304 0           ,weight_datap += __tinc0_2
24305 0           ,clens1_datap += __tinc0_3
24306 0           ,crowids1_datap += __tinc0_4
24307 0           ,clens2_datap += __tinc0_5
24308 0           ,crowids2_datap += __tinc0_6
24309 0           ,dist_datap += __tinc0_7
24310             )
24311             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
24312 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
24313 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
24314 0           crowids1p = crowids1_datap;
24315             {PDL_COMMENT("Open k1") register PDL_Indx k1;
24316 0 0         for(k1=0; k1<(__k1_size); k1++) {
24317 0           crowids2p = crowids2_datap;
24318             {PDL_COMMENT("Open k2") register PDL_Indx k2;
24319 0 0         for(k2=0; k2<(__k2_size); k2++) {
24320 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
24321 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
24322             crowids1p, crowids2p,
24323 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
24324 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
24325             }} PDL_COMMENT("Close k2")
24326 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
24327             }} PDL_COMMENT("Close k1")
24328            
24329             PDL_COMMENT("THREADLOOPEND")
24330             }
24331             }
24332 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
24333 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
24334 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
24335 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
24336 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
24337 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
24338 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
24339 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
24340 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
24341             /*-- cleanup --*/
24342 0 0         if (datapp) free(datapp);
24343 0 0         if (maskpp) free(maskpp);
24344              
24345 0           } } break; case PDL_D: {
24346 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24347 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24348              
24349 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24350 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24351              
24352 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24353 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24354              
24355 0 0         PDL_Long * clens1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24356 0           PDL_Long * clens1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24357              
24358 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24359 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24360              
24361 0 0         PDL_Long * clens2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24362 0           PDL_Long * clens2_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24363              
24364 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24365 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24366              
24367 0 0         PDL_Double * dist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24368 0           PDL_Double * dist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
24369              
24370 0           {register PDL_Indx __inc_dist_k1 = __privtrans->__inc_dist_k1;
24371 0           register PDL_Indx __inc_dist_k2 = __privtrans->__inc_dist_k2;
24372 0           register PDL_Indx __inc_clens1_k1 = __privtrans->__inc_clens1_k1;
24373 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24374 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24375 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24376 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24377 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24378 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24379 0           register PDL_Indx __inc_clens2_k2 = __privtrans->__inc_clens2_k2;
24380 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24381              
24382              
24383 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
24384 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
24385 0           int transpose=0;
24386             int *crowids1p, *crowids2p;
24387            
24388             PDL_COMMENT("THREADLOOPBEGIN")
24389 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
24390 0           do { register PDL_Indx __tind1=0,__tind2=0;
24391 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
24392 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
24393 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
24394 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
24395 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
24396 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
24397 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
24398 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
24399 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
24400 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
24401 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
24402 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
24403 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
24404 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
24405 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
24406 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
24407 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
24408 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
24409 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
24410 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
24411 0           data_datap += __offsp[0];
24412 0           mask_datap += __offsp[1];
24413 0           weight_datap += __offsp[2];
24414 0           clens1_datap += __offsp[3];
24415 0           crowids1_datap += __offsp[4];
24416 0           clens2_datap += __offsp[5];
24417 0           crowids2_datap += __offsp[6];
24418 0           dist_datap += __offsp[7];
24419 0 0         for( __tind2 = 0 ;
24420             __tind2 < __tdims1 ;
24421 0           __tind2++
24422 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
24423 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
24424 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
24425 0           ,clens1_datap += __tinc1_3 - __tinc0_3 * __tdims0
24426 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
24427 0           ,clens2_datap += __tinc1_5 - __tinc0_5 * __tdims0
24428 0           ,crowids2_datap += __tinc1_6 - __tinc0_6 * __tdims0
24429 0           ,dist_datap += __tinc1_7 - __tinc0_7 * __tdims0
24430             )
24431             {
24432 0 0         for( __tind1 = 0 ;
24433             __tind1 < __tdims0 ;
24434 0           __tind1++
24435 0           ,data_datap += __tinc0_0
24436 0           ,mask_datap += __tinc0_1
24437 0           ,weight_datap += __tinc0_2
24438 0           ,clens1_datap += __tinc0_3
24439 0           ,crowids1_datap += __tinc0_4
24440 0           ,clens2_datap += __tinc0_5
24441 0           ,crowids2_datap += __tinc0_6
24442 0           ,dist_datap += __tinc0_7
24443             )
24444             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
24445 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
24446 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
24447 0           crowids1p = crowids1_datap;
24448             {PDL_COMMENT("Open k1") register PDL_Indx k1;
24449 0 0         for(k1=0; k1<(__k1_size); k1++) {
24450 0           crowids2p = crowids2_datap;
24451             {PDL_COMMENT("Open k2") register PDL_Indx k2;
24452 0 0         for(k2=0; k2<(__k2_size); k2++) {
24453 0 0         (dist_datap)[0+(__inc_dist_k1*PP_INDTERM(__privtrans->__k1_size, k1))+(__inc_dist_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
    0          
24454 0 0         (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") , (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ,
    0          
24455             crowids1p, crowids2p,
24456 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
24457 0 0         crowids2p += (clens2_datap)[0+(__inc_clens2_k2*PP_INDTERM(__privtrans->__k2_size, k2))] PDL_COMMENT("ACCESS()") ;
24458             }} PDL_COMMENT("Close k2")
24459 0 0         crowids1p += (clens1_datap)[0+(__inc_clens1_k1*PP_INDTERM(__privtrans->__k1_size, k1))] PDL_COMMENT("ACCESS()") ;
24460             }} PDL_COMMENT("Close k1")
24461            
24462             PDL_COMMENT("THREADLOOPEND")
24463             }
24464             }
24465 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
24466 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
24467 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
24468 0           clens1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
24469 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
24470 0           clens2_datap -= __tinc1_5 * __tdims1 + __offsp[5];
24471 0           crowids2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
24472 0           dist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
24473 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
24474             /*-- cleanup --*/
24475 0 0         if (datapp) free(datapp);
24476 0 0         if (maskpp) free(maskpp);
24477              
24478 0           } break;}
24479 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
24480             }
24481             }
24482             }
24483            
24484              
24485              
24486              
24487 0           void pdl_clusterdistancematrixenc_free(pdl_trans *__tr ) {
24488             int __dim;
24489 0           pdl_clusterdistancematrixenc_struct *__privtrans = (pdl_clusterdistancematrixenc_struct *) __tr;
24490            
24491             {
24492            
24493 0           PDL_TR_CLRMAGIC(__privtrans);
24494 0           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
24495 0 0         if(__privtrans->__ddone) {
24496 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
24497             ;;;;;;;;;;;;;;;;;;
24498             }
24499            
24500             }
24501 0           }
24502            
24503              
24504              
24505              
24506             static char pdl_clusterdistancematrixenc_vtable_flags[] =
24507             { 0,0,0,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK};
24508             pdl_transvtable pdl_clusterdistancematrixenc_vtable = {
24509             0,0, 7, 8, pdl_clusterdistancematrixenc_vtable_flags,
24510             pdl_clusterdistancematrixenc_redodims, pdl_clusterdistancematrixenc_readdata, NULL,
24511             pdl_clusterdistancematrixenc_free,NULL,NULL,pdl_clusterdistancematrixenc_copy,
24512             sizeof(pdl_clusterdistancematrixenc_struct),"pdl_clusterdistancematrixenc_vtable"
24513             };
24514              
24515             typedef struct pdl_clusterdistancesenc_struct {
24516             PDL_TRANS_START(10);
24517             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_coffsets1_k1;PDL_Indx __inc_crowids1_nc1;PDL_Indx __inc_cwhich1_ncmps;PDL_Indx __inc_coffsets2_k2;PDL_Indx __inc_crowids2_nc2;PDL_Indx __inc_cwhich2_ncmps;PDL_Indx __inc_dists_ncmps;PDL_Indx __d_size;PDL_Indx __nc1_size;PDL_Indx __n_size;PDL_Indx __nc2_size;PDL_Indx __k1_size;PDL_Indx __k2_size;PDL_Indx __ncmps_size;
24518             char *distFlag;char *methodFlag;
24519             char __ddone; PDL_COMMENT("Dims done")
24520             } pdl_clusterdistancesenc_struct;
24521              
24522 0           void pdl_clusterdistancesenc_redodims(pdl_trans *__tr ) {
24523             int __dim;
24524 0           pdl_clusterdistancesenc_struct *__privtrans = (pdl_clusterdistancesenc_struct *) __tr;
24525            
24526             {
24527             PDL_Indx __creating[10];
24528 0           __privtrans->__d_size = -1;
24529 0           __privtrans->__nc1_size = -1;
24530 0           __privtrans->__n_size = -1;
24531 0           __privtrans->__nc2_size = -1;
24532 0           __privtrans->__k1_size = -1;
24533 0           __privtrans->__k2_size = -1;
24534 0           __privtrans->__ncmps_size = -1;
24535 0           __creating[0] = 0;
24536 0           __creating[1] = 0;
24537 0           __creating[2] = 0;
24538 0           __creating[3] = 0;
24539 0           __creating[4] = 0;
24540 0           __creating[5] = 0;
24541 0           __creating[6] = 0;
24542 0           __creating[7] = 0;
24543 0           __creating[8] = 0;
24544 0 0         __creating[9] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[9]);
    0          
24545             {
24546             {PDL_COMMENT("Start generic loop")
24547              
24548 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
24549 0           } break; case PDL_B: {
24550 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24551 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24552              
24553 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24554 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24555              
24556 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24557 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24558              
24559 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24560 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24561              
24562 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24563 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24564              
24565 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24566 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24567              
24568 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24569 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24570              
24571 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24572 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24573              
24574 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24575 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24576              
24577 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24578 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24579              
24580 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24581 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24582 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24583 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24584 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24585 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24586 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24587 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24588 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24589 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24590 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24591 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24592              
24593             PDL_COMMENT("none")
24594 0           } } break; case PDL_S: {
24595 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24596 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24597              
24598 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24599 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24600              
24601 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24602 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24603              
24604 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24605 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24606              
24607 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24608 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24609              
24610 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24611 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24612              
24613 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24614 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24615              
24616 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24617 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24618              
24619 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24620 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24621              
24622 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24623 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24624              
24625 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24626 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24627 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24628 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24629 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24630 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24631 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24632 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24633 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24634 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24635 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24636 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24637              
24638             PDL_COMMENT("none")
24639 0           } } break; case PDL_US: {
24640 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24641 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24642              
24643 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24644 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24645              
24646 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24647 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24648              
24649 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24650 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24651              
24652 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24653 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24654              
24655 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24656 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24657              
24658 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24659 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24660              
24661 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24662 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24663              
24664 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24665 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24666              
24667 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24668 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24669              
24670 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24671 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24672 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24673 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24674 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24675 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24676 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24677 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24678 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24679 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24680 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24681 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24682              
24683             PDL_COMMENT("none")
24684 0           } } break; case PDL_L: {
24685 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24686 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24687              
24688 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24689 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24690              
24691 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24692 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24693              
24694 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24695 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24696              
24697 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24698 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24699              
24700 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24701 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24702              
24703 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24704 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24705              
24706 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24707 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24708              
24709 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24710 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24711              
24712 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24713 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24714              
24715 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24716 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24717 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24718 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24719 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24720 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24721 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24722 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24723 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24724 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24725 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24726 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24727              
24728             PDL_COMMENT("none")
24729 0           } } break; case PDL_IND: {
24730 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24731 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24732              
24733 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24734 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24735              
24736 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24737 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24738              
24739 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24740 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24741              
24742 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24743 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24744              
24745 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24746 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24747              
24748 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24749 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24750              
24751 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24752 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24753              
24754 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24755 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24756              
24757 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24758 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24759              
24760 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24761 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24762 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24763 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24764 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24765 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24766 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24767 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24768 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24769 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24770 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24771 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24772              
24773             PDL_COMMENT("none")
24774 0           } } break; case PDL_LL: {
24775 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24776 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24777              
24778 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24779 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24780              
24781 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24782 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24783              
24784 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24785 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24786              
24787 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24788 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24789              
24790 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24791 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24792              
24793 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24794 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24795              
24796 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24797 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24798              
24799 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24800 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24801              
24802 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24803 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24804              
24805 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24806 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24807 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24808 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24809 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24810 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24811 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24812 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24813 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24814 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24815 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24816 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24817              
24818             PDL_COMMENT("none")
24819 0           } } break; case PDL_F: {
24820 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24821 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24822              
24823 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24824 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24825              
24826 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24827 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24828              
24829 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24830 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24831              
24832 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24833 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24834              
24835 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24836 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24837              
24838 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24839 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24840              
24841 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24842 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24843              
24844 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24845 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24846              
24847 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24848 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24849              
24850 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24851 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24852 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24853 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24854 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24855 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24856 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24857 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24858 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24859 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24860 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24861 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24862              
24863             PDL_COMMENT("none")
24864 0           } } break; case PDL_D: {
24865 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
24866 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
24867              
24868 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
24869 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
24870              
24871 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
24872 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
24873              
24874 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
24875 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
24876              
24877 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
24878 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
24879              
24880 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
24881 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
24882              
24883 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
24884 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
24885              
24886 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
24887 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
24888              
24889 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
24890 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
24891              
24892 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
24893 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
24894              
24895 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
24896 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
24897 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
24898 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
24899 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
24900 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
24901 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
24902 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
24903 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
24904 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
24905 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
24906 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
24907              
24908             PDL_COMMENT("none")
24909 0           } break;}
24910 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
24911             }
24912             }
24913             {
24914             static char *__parnames[] = {"data","mask","weight","coffsets1","crowids1","cwhich1","coffsets2","crowids2","cwhich2","dists"};
24915             static PDL_Indx __realdims[] = {2,2,1,1,1,1,1,1,1,1};
24916             static char __funcname[] = "PDL::Cluster::clusterdistancesenc";
24917             static pdl_errorinfo __einfo = {
24918             __funcname, __parnames, 10
24919             };
24920            
24921 0           PDL->initthreadstruct(2,__privtrans->pdls,
24922             __realdims,__creating,10,
24923             &__einfo,&(__privtrans->__pdlthread),
24924 0           __privtrans->vtable->per_pdl_flags,
24925             0 );
24926             }
24927 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
24928 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
24929 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
24930             }
24931 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
24932 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
24933 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
24934 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
24935 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24936             }
24937             }
24938 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
24939 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
24940 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
24941 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
24942 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24943             }
24944             }
24945 0           PDL->make_physical(((__privtrans->pdls[0])));
24946 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
24947 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
24948 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
24949             }
24950 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
24951 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
24952 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
24953 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
24954 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24955             }
24956             }
24957 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
24958 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
24959 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
24960 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
24961 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24962             }
24963             }
24964 0           PDL->make_physical(((__privtrans->pdls[1])));
24965 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
24966 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
24967             }
24968 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
24969 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
24970 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
24971 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
24972 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24973             }
24974             }
24975 0           PDL->make_physical(((__privtrans->pdls[2])));
24976 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
24977 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__k1_size <= 1) __privtrans->__k1_size = 1;
    0          
24978             }
24979 0 0         if(__privtrans->__k1_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k1_size == 1)) {
    0          
    0          
24980 0           __privtrans->__k1_size = ((__privtrans->pdls[3]))->dims[0];
24981 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__k1_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
24982 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
24983 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24984             }
24985             }
24986 0 0         if(((__privtrans->pdls[4]))->ndims < 1) {
24987 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__nc1_size <= 1) __privtrans->__nc1_size = 1;
    0          
24988             }
24989 0 0         if(__privtrans->__nc1_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nc1_size == 1)) {
    0          
    0          
24990 0           __privtrans->__nc1_size = ((__privtrans->pdls[4]))->dims[0];
24991 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__nc1_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
24992 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
24993 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
24994             }
24995             }
24996 0           PDL->make_physical(((__privtrans->pdls[4])));
24997 0 0         if(((__privtrans->pdls[5]))->ndims < 1) {
24998 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
24999             }
25000 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
25001 0           __privtrans->__ncmps_size = ((__privtrans->pdls[5]))->dims[0];
25002 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
25003 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
25004 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
25005             }
25006             }
25007 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
25008 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__k2_size <= 1) __privtrans->__k2_size = 1;
    0          
25009             }
25010 0 0         if(__privtrans->__k2_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__k2_size == 1)) {
    0          
    0          
25011 0           __privtrans->__k2_size = ((__privtrans->pdls[6]))->dims[0];
25012 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__k2_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
25013 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
25014 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
25015             }
25016             }
25017 0 0         if(((__privtrans->pdls[7]))->ndims < 1) {
25018 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__nc2_size <= 1) __privtrans->__nc2_size = 1;
    0          
25019             }
25020 0 0         if(__privtrans->__nc2_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__nc2_size == 1)) {
    0          
    0          
25021 0           __privtrans->__nc2_size = ((__privtrans->pdls[7]))->dims[0];
25022 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__nc2_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
25023 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
25024 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
25025             }
25026             }
25027 0           PDL->make_physical(((__privtrans->pdls[7])));
25028 0 0         if(((__privtrans->pdls[8]))->ndims < 1) {
25029 0 0         if (((__privtrans->pdls[8]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
25030             }
25031 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
25032 0           __privtrans->__ncmps_size = ((__privtrans->pdls[8]))->dims[0];
25033 0 0         } else if(((__privtrans->pdls[8]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[8]))->dims[0]) {
    0          
25034 0 0         if(((__privtrans->pdls[8]))->dims[0] != 1) {
25035 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
25036             }
25037             }
25038 0 0         if(!__creating[9]) {
25039 0 0         if(((__privtrans->pdls[9]))->ndims < 1) {
25040 0 0         if (((__privtrans->pdls[9]))->ndims < 1 && __privtrans->__ncmps_size <= 1) __privtrans->__ncmps_size = 1;
    0          
25041             }
25042 0 0         if(__privtrans->__ncmps_size == -1 || (((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__ncmps_size == 1)) {
    0          
    0          
25043 0           __privtrans->__ncmps_size = ((__privtrans->pdls[9]))->dims[0];
25044 0 0         } else if(((__privtrans->pdls[9]))->ndims > 0 && __privtrans->__ncmps_size != ((__privtrans->pdls[9]))->dims[0]) {
    0          
25045 0 0         if(((__privtrans->pdls[9]))->dims[0] != 1) {
25046 0           PDL->pdl_barf("Error in clusterdistancesenc:" "Wrong dims\n");
25047             }
25048             }
25049             } else {
25050 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__ncmps_size;
25051 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,9,dims,0);
25052             }
25053             { PDL_COMMENT("convenience block")
25054 0           void *hdrp = NULL;
25055 0           char propagate_hdrcpy = 0;
25056 0           SV *hdr_copy = NULL;
25057 0 0         if(!hdrp &&
    0          
25058 0 0         __privtrans->pdls[0]->hdrsv &&
25059 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
25060             ) {
25061 0           hdrp = __privtrans->pdls[0]->hdrsv;
25062 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
25063             }
25064 0 0         if(!hdrp &&
    0          
25065 0 0         __privtrans->pdls[1]->hdrsv &&
25066 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
25067             ) {
25068 0           hdrp = __privtrans->pdls[1]->hdrsv;
25069 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
25070             }
25071 0 0         if(!hdrp &&
    0          
25072 0 0         __privtrans->pdls[2]->hdrsv &&
25073 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
25074             ) {
25075 0           hdrp = __privtrans->pdls[2]->hdrsv;
25076 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
25077             }
25078 0 0         if(!hdrp &&
    0          
25079 0 0         __privtrans->pdls[3]->hdrsv &&
25080 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
25081             ) {
25082 0           hdrp = __privtrans->pdls[3]->hdrsv;
25083 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
25084             }
25085 0 0         if(!hdrp &&
    0          
25086 0 0         __privtrans->pdls[4]->hdrsv &&
25087 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
25088             ) {
25089 0           hdrp = __privtrans->pdls[4]->hdrsv;
25090 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
25091             }
25092 0 0         if(!hdrp &&
    0          
25093 0 0         __privtrans->pdls[5]->hdrsv &&
25094 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
25095             ) {
25096 0           hdrp = __privtrans->pdls[5]->hdrsv;
25097 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
25098             }
25099 0 0         if(!hdrp &&
    0          
25100 0 0         __privtrans->pdls[6]->hdrsv &&
25101 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
25102             ) {
25103 0           hdrp = __privtrans->pdls[6]->hdrsv;
25104 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
25105             }
25106 0 0         if(!hdrp &&
    0          
25107 0 0         __privtrans->pdls[7]->hdrsv &&
25108 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
25109             ) {
25110 0           hdrp = __privtrans->pdls[7]->hdrsv;
25111 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
25112             }
25113 0 0         if(!hdrp &&
    0          
25114 0 0         __privtrans->pdls[8]->hdrsv &&
25115 0           (__privtrans->pdls[8]->state & PDL_HDRCPY)
25116             ) {
25117 0           hdrp = __privtrans->pdls[8]->hdrsv;
25118 0           propagate_hdrcpy = ((__privtrans->pdls[8]->state & PDL_HDRCPY) != 0);
25119             }
25120 0 0         if(!hdrp &&
    0          
25121 0 0         !__creating[9] &&
25122 0 0         __privtrans->pdls[9]->hdrsv &&
25123 0           (__privtrans->pdls[9]->state & PDL_HDRCPY)
25124             ) {
25125 0           hdrp = __privtrans->pdls[9]->hdrsv;
25126 0           propagate_hdrcpy = ((__privtrans->pdls[9]->state & PDL_HDRCPY) != 0);
25127             }
25128 0 0         if (hdrp) {
25129 0 0         if(hdrp == &PL_sv_undef)
25130 0           hdr_copy = &PL_sv_undef;
25131             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
25132             int count;
25133             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
25134 0           dSP;
25135 0           ENTER ;
25136 0           SAVETMPS ;
25137 0 0         PUSHMARK(SP) ;
25138 0 0         XPUSHs( hdrp );
25139 0           PUTBACK ;
25140 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
25141 0           SPAGAIN ;
25142 0 0         if(count != 1)
25143 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
25144              
25145 0           hdr_copy = (SV *)POPs;
25146              
25147 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
25148 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
25149             }
25150              
25151 0 0         FREETMPS ;
25152 0           LEAVE ;
25153              
25154              
25155             } PDL_COMMENT("end of callback block")
25156              
25157 0 0         if ( __privtrans->pdls[9]->hdrsv != hdrp ){
25158 0 0         if( __privtrans->pdls[9]->hdrsv && __privtrans->pdls[9]->hdrsv != &PL_sv_undef)
    0          
25159 0           (void)SvREFCNT_dec( __privtrans->pdls[9]->hdrsv );
25160 0 0         if( hdr_copy != &PL_sv_undef )
25161 0           (void)SvREFCNT_inc(hdr_copy);
25162 0           __privtrans->pdls[9]->hdrsv = hdr_copy;
25163             }
25164 0 0         if(propagate_hdrcpy)
25165 0           __privtrans->pdls[9]->state |= PDL_HDRCPY;
25166              
25167 0 0         if(hdr_copy != &PL_sv_undef)
25168 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
25169             } PDL_COMMENT("end of if(hdrp) block")
25170             } PDL_COMMENT("end of conv. block")
25171 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
25172 0           __privtrans->__inc_data_d = 0; else
25173 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
25174 0           __privtrans->__inc_data_n = 0; else
25175 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
25176 0           __privtrans->__inc_mask_d = 0; else
25177 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
25178 0           __privtrans->__inc_mask_n = 0; else
25179 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
25180 0           __privtrans->__inc_weight_d = 0; else
25181 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
25182 0           __privtrans->__inc_coffsets1_k1 = 0; else
25183 0 0         __privtrans->__inc_coffsets1_k1 = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
25184 0           __privtrans->__inc_crowids1_nc1 = 0; else
25185 0 0         __privtrans->__inc_crowids1_nc1 = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
25186 0           __privtrans->__inc_cwhich1_ncmps = 0; else
25187 0 0         __privtrans->__inc_cwhich1_ncmps = PDL_REPRINC(__privtrans->pdls[5],0);if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
    0          
25188 0           __privtrans->__inc_coffsets2_k2 = 0; else
25189 0 0         __privtrans->__inc_coffsets2_k2 = PDL_REPRINC(__privtrans->pdls[6],0);if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
    0          
25190 0           __privtrans->__inc_crowids2_nc2 = 0; else
25191 0 0         __privtrans->__inc_crowids2_nc2 = __privtrans->pdls[7]->dimincs[0];if(__privtrans->pdls[8]->ndims <= 0 || __privtrans->pdls[8]->dims[0] <= 1)
    0          
25192 0           __privtrans->__inc_cwhich2_ncmps = 0; else
25193 0 0         __privtrans->__inc_cwhich2_ncmps = PDL_REPRINC(__privtrans->pdls[8],0);if(__privtrans->pdls[9]->ndims <= 0 || __privtrans->pdls[9]->dims[0] <= 1)
    0          
    0          
25194 0           __privtrans->__inc_dists_ncmps = 0; else
25195 0 0         __privtrans->__inc_dists_ncmps = PDL_REPRINC(__privtrans->pdls[9],0); __privtrans->__ddone = 1;
25196             }
25197 0           }
25198            
25199              
25200 0           pdl_trans * pdl_clusterdistancesenc_copy(pdl_trans *__tr ) {
25201             int __dim;
25202 0           pdl_clusterdistancesenc_struct *__privtrans = (pdl_clusterdistancesenc_struct *) __tr;
25203            
25204             {
25205 0           pdl_clusterdistancesenc_struct *__copy = malloc(sizeof(pdl_clusterdistancesenc_struct));
25206 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
25207 0           __copy->has_badvalue = __privtrans->has_badvalue;
25208 0           __copy->badvalue = __privtrans->badvalue;
25209 0           __copy->flags = __privtrans->flags;
25210 0           __copy->vtable = __privtrans->vtable;
25211 0           __copy->__datatype = __privtrans->__datatype;
25212 0           __copy->freeproc = NULL;
25213 0           __copy->__ddone = __privtrans->__ddone;
25214             {int i;
25215 0 0         for(i=0; i<__copy->vtable->npdls; i++)
25216 0           __copy->pdls[i] = __privtrans->pdls[i];
25217             }
25218 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
25219 0 0         if(__copy->__ddone) {
25220 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_coffsets1_k1=__copy->__inc_coffsets1_k1;__privtrans->__inc_crowids1_nc1=__copy->__inc_crowids1_nc1;__privtrans->__inc_cwhich1_ncmps=__copy->__inc_cwhich1_ncmps;__privtrans->__inc_coffsets2_k2=__copy->__inc_coffsets2_k2;__privtrans->__inc_crowids2_nc2=__copy->__inc_crowids2_nc2;__privtrans->__inc_cwhich2_ncmps=__copy->__inc_cwhich2_ncmps;__privtrans->__inc_dists_ncmps=__copy->__inc_dists_ncmps;__copy->__d_size=__privtrans->__d_size;__copy->__nc1_size=__privtrans->__nc1_size;__copy->__n_size=__privtrans->__n_size;__copy->__nc2_size=__privtrans->__nc2_size;__copy->__k1_size=__privtrans->__k1_size;__copy->__k2_size=__privtrans->__k2_size;__copy->__ncmps_size=__privtrans->__ncmps_size;
25221             }
25222 0           return (pdl_trans*)__copy;
25223             }
25224             }
25225            
25226              
25227 0           void pdl_clusterdistancesenc_readdata(pdl_trans *__tr ) {
25228             int __dim;
25229 0           pdl_clusterdistancesenc_struct *__privtrans = (pdl_clusterdistancesenc_struct *) __tr;
25230            
25231             {
25232 0           {register PDL_Indx __ncmps_size = __privtrans->__ncmps_size;
25233             PDL_COMMENT("Start generic loop")
25234              
25235 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
25236 0           } break; case PDL_B: {
25237 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
25238 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
25239              
25240 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
25241 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
25242              
25243 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
25244 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
25245              
25246 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
25247 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
25248              
25249 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
25250 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
25251              
25252 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
25253 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
25254              
25255 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
25256 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
25257              
25258 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
25259 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
25260              
25261 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
25262 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
25263              
25264 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
25265 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
25266              
25267 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
25268 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
25269 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
25270 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
25271 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
25272 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
25273 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
25274 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
25275 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
25276 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
25277 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
25278 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
25279              
25280              
25281 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
25282 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
25283 0           int transpose=0;
25284            
25285             PDL_COMMENT("THREADLOOPBEGIN")
25286 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
25287 0           do { register PDL_Indx __tind1=0,__tind2=0;
25288 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
25289 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
25290 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
25291 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
25292 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
25293 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
25294 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
25295 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
25296 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
25297 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
25298 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
25299 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
25300 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
25301 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
25302 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
25303 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
25304 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
25305 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
25306 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
25307 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
25308 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
25309 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
25310 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
25311 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
25312 0           data_datap += __offsp[0];
25313 0           mask_datap += __offsp[1];
25314 0           weight_datap += __offsp[2];
25315 0           coffsets1_datap += __offsp[3];
25316 0           crowids1_datap += __offsp[4];
25317 0           cwhich1_datap += __offsp[5];
25318 0           coffsets2_datap += __offsp[6];
25319 0           crowids2_datap += __offsp[7];
25320 0           cwhich2_datap += __offsp[8];
25321 0           dists_datap += __offsp[9];
25322 0 0         for( __tind2 = 0 ;
25323             __tind2 < __tdims1 ;
25324 0           __tind2++
25325 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
25326 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
25327 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
25328 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
25329 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
25330 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
25331 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
25332 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
25333 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
25334 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
25335             )
25336             {
25337 0 0         for( __tind1 = 0 ;
25338             __tind1 < __tdims0 ;
25339 0           __tind1++
25340 0           ,data_datap += __tinc0_0
25341 0           ,mask_datap += __tinc0_1
25342 0           ,weight_datap += __tinc0_2
25343 0           ,coffsets1_datap += __tinc0_3
25344 0           ,crowids1_datap += __tinc0_4
25345 0           ,cwhich1_datap += __tinc0_5
25346 0           ,coffsets2_datap += __tinc0_6
25347 0           ,crowids2_datap += __tinc0_7
25348 0           ,cwhich2_datap += __tinc0_8
25349 0           ,dists_datap += __tinc0_9
25350             )
25351             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
25352 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
25353 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
25354             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
25355 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
25356 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25357 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25358 0           int succ_c1=c1+1;
25359 0           int succ_c2=c2+1;
25360 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
25361 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
25362 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
25363 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
25364 0           int *crowids1p = crowids1_datap + beg1;
25365 0           int *crowids2p = crowids2_datap + beg2;
25366              
25367 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
25368             len1, len2,
25369             crowids1p, crowids2p,
25370 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
25371             }} PDL_COMMENT("Close ncmps")
25372            
25373             PDL_COMMENT("THREADLOOPEND")
25374             }
25375             }
25376 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
25377 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
25378 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
25379 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
25380 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
25381 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
25382 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
25383 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
25384 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
25385 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
25386 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
25387             /*-- cleanup --*/
25388 0 0         if (datapp) free(datapp);
25389 0 0         if (maskpp) free(maskpp);
25390              
25391 0           } } break; case PDL_S: {
25392 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
25393 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
25394              
25395 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
25396 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
25397              
25398 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
25399 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
25400              
25401 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
25402 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
25403              
25404 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
25405 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
25406              
25407 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
25408 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
25409              
25410 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
25411 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
25412              
25413 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
25414 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
25415              
25416 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
25417 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
25418              
25419 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
25420 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
25421              
25422 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
25423 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
25424 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
25425 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
25426 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
25427 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
25428 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
25429 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
25430 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
25431 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
25432 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
25433 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
25434              
25435              
25436 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
25437 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
25438 0           int transpose=0;
25439            
25440             PDL_COMMENT("THREADLOOPBEGIN")
25441 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
25442 0           do { register PDL_Indx __tind1=0,__tind2=0;
25443 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
25444 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
25445 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
25446 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
25447 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
25448 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
25449 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
25450 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
25451 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
25452 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
25453 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
25454 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
25455 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
25456 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
25457 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
25458 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
25459 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
25460 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
25461 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
25462 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
25463 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
25464 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
25465 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
25466 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
25467 0           data_datap += __offsp[0];
25468 0           mask_datap += __offsp[1];
25469 0           weight_datap += __offsp[2];
25470 0           coffsets1_datap += __offsp[3];
25471 0           crowids1_datap += __offsp[4];
25472 0           cwhich1_datap += __offsp[5];
25473 0           coffsets2_datap += __offsp[6];
25474 0           crowids2_datap += __offsp[7];
25475 0           cwhich2_datap += __offsp[8];
25476 0           dists_datap += __offsp[9];
25477 0 0         for( __tind2 = 0 ;
25478             __tind2 < __tdims1 ;
25479 0           __tind2++
25480 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
25481 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
25482 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
25483 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
25484 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
25485 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
25486 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
25487 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
25488 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
25489 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
25490             )
25491             {
25492 0 0         for( __tind1 = 0 ;
25493             __tind1 < __tdims0 ;
25494 0           __tind1++
25495 0           ,data_datap += __tinc0_0
25496 0           ,mask_datap += __tinc0_1
25497 0           ,weight_datap += __tinc0_2
25498 0           ,coffsets1_datap += __tinc0_3
25499 0           ,crowids1_datap += __tinc0_4
25500 0           ,cwhich1_datap += __tinc0_5
25501 0           ,coffsets2_datap += __tinc0_6
25502 0           ,crowids2_datap += __tinc0_7
25503 0           ,cwhich2_datap += __tinc0_8
25504 0           ,dists_datap += __tinc0_9
25505             )
25506             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
25507 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
25508 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
25509             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
25510 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
25511 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25512 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25513 0           int succ_c1=c1+1;
25514 0           int succ_c2=c2+1;
25515 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
25516 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
25517 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
25518 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
25519 0           int *crowids1p = crowids1_datap + beg1;
25520 0           int *crowids2p = crowids2_datap + beg2;
25521              
25522 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
25523             len1, len2,
25524             crowids1p, crowids2p,
25525 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
25526             }} PDL_COMMENT("Close ncmps")
25527            
25528             PDL_COMMENT("THREADLOOPEND")
25529             }
25530             }
25531 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
25532 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
25533 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
25534 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
25535 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
25536 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
25537 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
25538 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
25539 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
25540 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
25541 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
25542             /*-- cleanup --*/
25543 0 0         if (datapp) free(datapp);
25544 0 0         if (maskpp) free(maskpp);
25545              
25546 0           } } break; case PDL_US: {
25547 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
25548 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
25549              
25550 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
25551 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
25552              
25553 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
25554 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
25555              
25556 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
25557 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
25558              
25559 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
25560 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
25561              
25562 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
25563 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
25564              
25565 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
25566 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
25567              
25568 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
25569 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
25570              
25571 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
25572 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
25573              
25574 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
25575 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
25576              
25577 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
25578 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
25579 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
25580 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
25581 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
25582 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
25583 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
25584 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
25585 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
25586 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
25587 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
25588 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
25589              
25590              
25591 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
25592 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
25593 0           int transpose=0;
25594            
25595             PDL_COMMENT("THREADLOOPBEGIN")
25596 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
25597 0           do { register PDL_Indx __tind1=0,__tind2=0;
25598 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
25599 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
25600 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
25601 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
25602 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
25603 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
25604 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
25605 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
25606 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
25607 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
25608 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
25609 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
25610 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
25611 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
25612 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
25613 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
25614 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
25615 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
25616 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
25617 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
25618 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
25619 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
25620 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
25621 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
25622 0           data_datap += __offsp[0];
25623 0           mask_datap += __offsp[1];
25624 0           weight_datap += __offsp[2];
25625 0           coffsets1_datap += __offsp[3];
25626 0           crowids1_datap += __offsp[4];
25627 0           cwhich1_datap += __offsp[5];
25628 0           coffsets2_datap += __offsp[6];
25629 0           crowids2_datap += __offsp[7];
25630 0           cwhich2_datap += __offsp[8];
25631 0           dists_datap += __offsp[9];
25632 0 0         for( __tind2 = 0 ;
25633             __tind2 < __tdims1 ;
25634 0           __tind2++
25635 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
25636 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
25637 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
25638 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
25639 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
25640 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
25641 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
25642 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
25643 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
25644 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
25645             )
25646             {
25647 0 0         for( __tind1 = 0 ;
25648             __tind1 < __tdims0 ;
25649 0           __tind1++
25650 0           ,data_datap += __tinc0_0
25651 0           ,mask_datap += __tinc0_1
25652 0           ,weight_datap += __tinc0_2
25653 0           ,coffsets1_datap += __tinc0_3
25654 0           ,crowids1_datap += __tinc0_4
25655 0           ,cwhich1_datap += __tinc0_5
25656 0           ,coffsets2_datap += __tinc0_6
25657 0           ,crowids2_datap += __tinc0_7
25658 0           ,cwhich2_datap += __tinc0_8
25659 0           ,dists_datap += __tinc0_9
25660             )
25661             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
25662 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
25663 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
25664             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
25665 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
25666 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25667 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25668 0           int succ_c1=c1+1;
25669 0           int succ_c2=c2+1;
25670 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
25671 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
25672 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
25673 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
25674 0           int *crowids1p = crowids1_datap + beg1;
25675 0           int *crowids2p = crowids2_datap + beg2;
25676              
25677 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
25678             len1, len2,
25679             crowids1p, crowids2p,
25680 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
25681             }} PDL_COMMENT("Close ncmps")
25682            
25683             PDL_COMMENT("THREADLOOPEND")
25684             }
25685             }
25686 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
25687 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
25688 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
25689 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
25690 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
25691 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
25692 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
25693 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
25694 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
25695 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
25696 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
25697             /*-- cleanup --*/
25698 0 0         if (datapp) free(datapp);
25699 0 0         if (maskpp) free(maskpp);
25700              
25701 0           } } break; case PDL_L: {
25702 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
25703 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
25704              
25705 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
25706 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
25707              
25708 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
25709 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
25710              
25711 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
25712 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
25713              
25714 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
25715 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
25716              
25717 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
25718 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
25719              
25720 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
25721 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
25722              
25723 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
25724 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
25725              
25726 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
25727 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
25728              
25729 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
25730 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
25731              
25732 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
25733 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
25734 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
25735 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
25736 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
25737 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
25738 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
25739 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
25740 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
25741 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
25742 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
25743 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
25744              
25745              
25746 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
25747 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
25748 0           int transpose=0;
25749            
25750             PDL_COMMENT("THREADLOOPBEGIN")
25751 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
25752 0           do { register PDL_Indx __tind1=0,__tind2=0;
25753 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
25754 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
25755 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
25756 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
25757 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
25758 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
25759 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
25760 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
25761 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
25762 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
25763 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
25764 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
25765 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
25766 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
25767 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
25768 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
25769 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
25770 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
25771 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
25772 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
25773 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
25774 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
25775 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
25776 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
25777 0           data_datap += __offsp[0];
25778 0           mask_datap += __offsp[1];
25779 0           weight_datap += __offsp[2];
25780 0           coffsets1_datap += __offsp[3];
25781 0           crowids1_datap += __offsp[4];
25782 0           cwhich1_datap += __offsp[5];
25783 0           coffsets2_datap += __offsp[6];
25784 0           crowids2_datap += __offsp[7];
25785 0           cwhich2_datap += __offsp[8];
25786 0           dists_datap += __offsp[9];
25787 0 0         for( __tind2 = 0 ;
25788             __tind2 < __tdims1 ;
25789 0           __tind2++
25790 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
25791 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
25792 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
25793 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
25794 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
25795 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
25796 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
25797 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
25798 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
25799 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
25800             )
25801             {
25802 0 0         for( __tind1 = 0 ;
25803             __tind1 < __tdims0 ;
25804 0           __tind1++
25805 0           ,data_datap += __tinc0_0
25806 0           ,mask_datap += __tinc0_1
25807 0           ,weight_datap += __tinc0_2
25808 0           ,coffsets1_datap += __tinc0_3
25809 0           ,crowids1_datap += __tinc0_4
25810 0           ,cwhich1_datap += __tinc0_5
25811 0           ,coffsets2_datap += __tinc0_6
25812 0           ,crowids2_datap += __tinc0_7
25813 0           ,cwhich2_datap += __tinc0_8
25814 0           ,dists_datap += __tinc0_9
25815             )
25816             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
25817 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
25818 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
25819             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
25820 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
25821 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25822 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25823 0           int succ_c1=c1+1;
25824 0           int succ_c2=c2+1;
25825 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
25826 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
25827 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
25828 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
25829 0           int *crowids1p = crowids1_datap + beg1;
25830 0           int *crowids2p = crowids2_datap + beg2;
25831              
25832 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
25833             len1, len2,
25834             crowids1p, crowids2p,
25835 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
25836             }} PDL_COMMENT("Close ncmps")
25837            
25838             PDL_COMMENT("THREADLOOPEND")
25839             }
25840             }
25841 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
25842 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
25843 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
25844 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
25845 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
25846 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
25847 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
25848 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
25849 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
25850 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
25851 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
25852             /*-- cleanup --*/
25853 0 0         if (datapp) free(datapp);
25854 0 0         if (maskpp) free(maskpp);
25855              
25856 0           } } break; case PDL_IND: {
25857 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
25858 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
25859              
25860 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
25861 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
25862              
25863 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
25864 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
25865              
25866 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
25867 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
25868              
25869 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
25870 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
25871              
25872 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
25873 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
25874              
25875 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
25876 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
25877              
25878 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
25879 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
25880              
25881 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
25882 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
25883              
25884 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
25885 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
25886              
25887 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
25888 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
25889 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
25890 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
25891 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
25892 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
25893 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
25894 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
25895 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
25896 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
25897 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
25898 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
25899              
25900              
25901 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
25902 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
25903 0           int transpose=0;
25904            
25905             PDL_COMMENT("THREADLOOPBEGIN")
25906 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
25907 0           do { register PDL_Indx __tind1=0,__tind2=0;
25908 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
25909 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
25910 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
25911 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
25912 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
25913 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
25914 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
25915 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
25916 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
25917 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
25918 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
25919 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
25920 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
25921 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
25922 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
25923 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
25924 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
25925 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
25926 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
25927 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
25928 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
25929 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
25930 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
25931 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
25932 0           data_datap += __offsp[0];
25933 0           mask_datap += __offsp[1];
25934 0           weight_datap += __offsp[2];
25935 0           coffsets1_datap += __offsp[3];
25936 0           crowids1_datap += __offsp[4];
25937 0           cwhich1_datap += __offsp[5];
25938 0           coffsets2_datap += __offsp[6];
25939 0           crowids2_datap += __offsp[7];
25940 0           cwhich2_datap += __offsp[8];
25941 0           dists_datap += __offsp[9];
25942 0 0         for( __tind2 = 0 ;
25943             __tind2 < __tdims1 ;
25944 0           __tind2++
25945 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
25946 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
25947 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
25948 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
25949 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
25950 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
25951 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
25952 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
25953 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
25954 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
25955             )
25956             {
25957 0 0         for( __tind1 = 0 ;
25958             __tind1 < __tdims0 ;
25959 0           __tind1++
25960 0           ,data_datap += __tinc0_0
25961 0           ,mask_datap += __tinc0_1
25962 0           ,weight_datap += __tinc0_2
25963 0           ,coffsets1_datap += __tinc0_3
25964 0           ,crowids1_datap += __tinc0_4
25965 0           ,cwhich1_datap += __tinc0_5
25966 0           ,coffsets2_datap += __tinc0_6
25967 0           ,crowids2_datap += __tinc0_7
25968 0           ,cwhich2_datap += __tinc0_8
25969 0           ,dists_datap += __tinc0_9
25970             )
25971             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
25972 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
25973 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
25974             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
25975 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
25976 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25977 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
25978 0           int succ_c1=c1+1;
25979 0           int succ_c2=c2+1;
25980 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
25981 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
25982 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
25983 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
25984 0           int *crowids1p = crowids1_datap + beg1;
25985 0           int *crowids2p = crowids2_datap + beg2;
25986              
25987 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
25988             len1, len2,
25989             crowids1p, crowids2p,
25990 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
25991             }} PDL_COMMENT("Close ncmps")
25992            
25993             PDL_COMMENT("THREADLOOPEND")
25994             }
25995             }
25996 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
25997 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
25998 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
25999 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
26000 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
26001 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
26002 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
26003 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
26004 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
26005 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
26006 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
26007             /*-- cleanup --*/
26008 0 0         if (datapp) free(datapp);
26009 0 0         if (maskpp) free(maskpp);
26010              
26011 0           } } break; case PDL_LL: {
26012 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26013 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26014              
26015 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26016 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26017              
26018 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26019 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26020              
26021 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26022 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
26023              
26024 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26025 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26026              
26027 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
26028 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
26029              
26030 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
26031 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
26032              
26033 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
26034 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
26035              
26036 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
26037 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
26038              
26039 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
26040 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
26041              
26042 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26043 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26044 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
26045 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
26046 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26047 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26048 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
26049 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
26050 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
26051 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
26052 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
26053 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
26054              
26055              
26056 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
26057 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
26058 0           int transpose=0;
26059            
26060             PDL_COMMENT("THREADLOOPBEGIN")
26061 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
26062 0           do { register PDL_Indx __tind1=0,__tind2=0;
26063 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
26064 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
26065 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
26066 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
26067 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
26068 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
26069 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
26070 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
26071 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
26072 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
26073 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
26074 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
26075 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
26076 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
26077 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
26078 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
26079 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
26080 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
26081 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
26082 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
26083 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
26084 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
26085 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
26086 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
26087 0           data_datap += __offsp[0];
26088 0           mask_datap += __offsp[1];
26089 0           weight_datap += __offsp[2];
26090 0           coffsets1_datap += __offsp[3];
26091 0           crowids1_datap += __offsp[4];
26092 0           cwhich1_datap += __offsp[5];
26093 0           coffsets2_datap += __offsp[6];
26094 0           crowids2_datap += __offsp[7];
26095 0           cwhich2_datap += __offsp[8];
26096 0           dists_datap += __offsp[9];
26097 0 0         for( __tind2 = 0 ;
26098             __tind2 < __tdims1 ;
26099 0           __tind2++
26100 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
26101 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
26102 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
26103 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
26104 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
26105 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
26106 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
26107 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
26108 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
26109 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
26110             )
26111             {
26112 0 0         for( __tind1 = 0 ;
26113             __tind1 < __tdims0 ;
26114 0           __tind1++
26115 0           ,data_datap += __tinc0_0
26116 0           ,mask_datap += __tinc0_1
26117 0           ,weight_datap += __tinc0_2
26118 0           ,coffsets1_datap += __tinc0_3
26119 0           ,crowids1_datap += __tinc0_4
26120 0           ,cwhich1_datap += __tinc0_5
26121 0           ,coffsets2_datap += __tinc0_6
26122 0           ,crowids2_datap += __tinc0_7
26123 0           ,cwhich2_datap += __tinc0_8
26124 0           ,dists_datap += __tinc0_9
26125             )
26126             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
26127 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
26128 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
26129             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
26130 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
26131 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26132 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26133 0           int succ_c1=c1+1;
26134 0           int succ_c2=c2+1;
26135 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
26136 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
26137 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
26138 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
26139 0           int *crowids1p = crowids1_datap + beg1;
26140 0           int *crowids2p = crowids2_datap + beg2;
26141              
26142 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
26143             len1, len2,
26144             crowids1p, crowids2p,
26145 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
26146             }} PDL_COMMENT("Close ncmps")
26147            
26148             PDL_COMMENT("THREADLOOPEND")
26149             }
26150             }
26151 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
26152 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
26153 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
26154 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
26155 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
26156 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
26157 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
26158 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
26159 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
26160 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
26161 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
26162             /*-- cleanup --*/
26163 0 0         if (datapp) free(datapp);
26164 0 0         if (maskpp) free(maskpp);
26165              
26166 0           } } break; case PDL_F: {
26167 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26168 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26169              
26170 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26171 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26172              
26173 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26174 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26175              
26176 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26177 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
26178              
26179 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26180 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26181              
26182 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
26183 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
26184              
26185 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
26186 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
26187              
26188 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
26189 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
26190              
26191 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
26192 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
26193              
26194 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
26195 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
26196              
26197 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26198 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26199 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
26200 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
26201 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26202 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26203 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
26204 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
26205 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
26206 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
26207 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
26208 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
26209              
26210              
26211 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
26212 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
26213 0           int transpose=0;
26214            
26215             PDL_COMMENT("THREADLOOPBEGIN")
26216 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
26217 0           do { register PDL_Indx __tind1=0,__tind2=0;
26218 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
26219 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
26220 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
26221 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
26222 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
26223 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
26224 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
26225 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
26226 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
26227 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
26228 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
26229 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
26230 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
26231 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
26232 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
26233 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
26234 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
26235 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
26236 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
26237 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
26238 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
26239 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
26240 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
26241 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
26242 0           data_datap += __offsp[0];
26243 0           mask_datap += __offsp[1];
26244 0           weight_datap += __offsp[2];
26245 0           coffsets1_datap += __offsp[3];
26246 0           crowids1_datap += __offsp[4];
26247 0           cwhich1_datap += __offsp[5];
26248 0           coffsets2_datap += __offsp[6];
26249 0           crowids2_datap += __offsp[7];
26250 0           cwhich2_datap += __offsp[8];
26251 0           dists_datap += __offsp[9];
26252 0 0         for( __tind2 = 0 ;
26253             __tind2 < __tdims1 ;
26254 0           __tind2++
26255 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
26256 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
26257 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
26258 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
26259 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
26260 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
26261 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
26262 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
26263 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
26264 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
26265             )
26266             {
26267 0 0         for( __tind1 = 0 ;
26268             __tind1 < __tdims0 ;
26269 0           __tind1++
26270 0           ,data_datap += __tinc0_0
26271 0           ,mask_datap += __tinc0_1
26272 0           ,weight_datap += __tinc0_2
26273 0           ,coffsets1_datap += __tinc0_3
26274 0           ,crowids1_datap += __tinc0_4
26275 0           ,cwhich1_datap += __tinc0_5
26276 0           ,coffsets2_datap += __tinc0_6
26277 0           ,crowids2_datap += __tinc0_7
26278 0           ,cwhich2_datap += __tinc0_8
26279 0           ,dists_datap += __tinc0_9
26280             )
26281             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
26282 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
26283 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
26284             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
26285 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
26286 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26287 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26288 0           int succ_c1=c1+1;
26289 0           int succ_c2=c2+1;
26290 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
26291 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
26292 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
26293 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
26294 0           int *crowids1p = crowids1_datap + beg1;
26295 0           int *crowids2p = crowids2_datap + beg2;
26296              
26297 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
26298             len1, len2,
26299             crowids1p, crowids2p,
26300 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
26301             }} PDL_COMMENT("Close ncmps")
26302            
26303             PDL_COMMENT("THREADLOOPEND")
26304             }
26305             }
26306 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
26307 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
26308 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
26309 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
26310 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
26311 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
26312 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
26313 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
26314 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
26315 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
26316 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
26317             /*-- cleanup --*/
26318 0 0         if (datapp) free(datapp);
26319 0 0         if (maskpp) free(maskpp);
26320              
26321 0           } } break; case PDL_D: {
26322 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26323 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26324              
26325 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26326 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26327              
26328 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26329 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26330              
26331 0 0         PDL_Long * coffsets1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26332 0           PDL_Long * coffsets1_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
26333              
26334 0 0         PDL_Long * crowids1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26335 0           PDL_Long * crowids1_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26336              
26337 0 0         PDL_Long * cwhich1_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
26338 0           PDL_Long * cwhich1_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
26339              
26340 0 0         PDL_Long * coffsets2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
26341 0           PDL_Long * coffsets2_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
26342              
26343 0 0         PDL_Long * crowids2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
26344 0           PDL_Long * crowids2_physdatap = ((PDL_Long *)((__privtrans->pdls[7])->data));
26345              
26346 0 0         PDL_Long * cwhich2_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[8]),(__privtrans->vtable->per_pdl_flags[8]))));
    0          
26347 0           PDL_Long * cwhich2_physdatap = ((PDL_Long *)((__privtrans->pdls[8])->data));
26348              
26349 0 0         PDL_Double * dists_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[9]),(__privtrans->vtable->per_pdl_flags[9]))));
    0          
26350 0           PDL_Double * dists_physdatap = ((PDL_Double *)((__privtrans->pdls[9])->data));
26351              
26352 0           {register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26353 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26354 0           register PDL_Indx __inc_cwhich2_ncmps = __privtrans->__inc_cwhich2_ncmps;
26355 0           register PDL_Indx __inc_coffsets2_k2 = __privtrans->__inc_coffsets2_k2;
26356 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26357 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26358 0           register PDL_Indx __inc_dists_ncmps = __privtrans->__inc_dists_ncmps;
26359 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
26360 0           register PDL_Indx __inc_crowids2_nc2 = __privtrans->__inc_crowids2_nc2;
26361 0           register PDL_Indx __inc_coffsets1_k1 = __privtrans->__inc_coffsets1_k1;
26362 0           register PDL_Indx __inc_crowids1_nc1 = __privtrans->__inc_crowids1_nc1;
26363 0           register PDL_Indx __inc_cwhich1_ncmps = __privtrans->__inc_cwhich1_ncmps;
26364              
26365              
26366 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
26367 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
26368 0           int transpose=0;
26369            
26370             PDL_COMMENT("THREADLOOPBEGIN")
26371 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
26372 0           do { register PDL_Indx __tind1=0,__tind2=0;
26373 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
26374 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
26375 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
26376 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
26377 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
26378 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
26379 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
26380 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
26381 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
26382 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
26383 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
26384 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
26385 0           register PDL_Indx __tinc0_8 = __privtrans->__pdlthread.incs[8];
26386 0           register PDL_Indx __tinc0_9 = __privtrans->__pdlthread.incs[9];
26387 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
26388 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
26389 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
26390 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
26391 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
26392 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
26393 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
26394 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
26395 0           register PDL_Indx __tinc1_8 = __privtrans->__pdlthread.incs[__tnpdls+8];
26396 0           register PDL_Indx __tinc1_9 = __privtrans->__pdlthread.incs[__tnpdls+9];
26397 0           data_datap += __offsp[0];
26398 0           mask_datap += __offsp[1];
26399 0           weight_datap += __offsp[2];
26400 0           coffsets1_datap += __offsp[3];
26401 0           crowids1_datap += __offsp[4];
26402 0           cwhich1_datap += __offsp[5];
26403 0           coffsets2_datap += __offsp[6];
26404 0           crowids2_datap += __offsp[7];
26405 0           cwhich2_datap += __offsp[8];
26406 0           dists_datap += __offsp[9];
26407 0 0         for( __tind2 = 0 ;
26408             __tind2 < __tdims1 ;
26409 0           __tind2++
26410 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
26411 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
26412 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
26413 0           ,coffsets1_datap += __tinc1_3 - __tinc0_3 * __tdims0
26414 0           ,crowids1_datap += __tinc1_4 - __tinc0_4 * __tdims0
26415 0           ,cwhich1_datap += __tinc1_5 - __tinc0_5 * __tdims0
26416 0           ,coffsets2_datap += __tinc1_6 - __tinc0_6 * __tdims0
26417 0           ,crowids2_datap += __tinc1_7 - __tinc0_7 * __tdims0
26418 0           ,cwhich2_datap += __tinc1_8 - __tinc0_8 * __tdims0
26419 0           ,dists_datap += __tinc1_9 - __tinc0_9 * __tdims0
26420             )
26421             {
26422 0 0         for( __tind1 = 0 ;
26423             __tind1 < __tdims0 ;
26424 0           __tind1++
26425 0           ,data_datap += __tinc0_0
26426 0           ,mask_datap += __tinc0_1
26427 0           ,weight_datap += __tinc0_2
26428 0           ,coffsets1_datap += __tinc0_3
26429 0           ,crowids1_datap += __tinc0_4
26430 0           ,cwhich1_datap += __tinc0_5
26431 0           ,coffsets2_datap += __tinc0_6
26432 0           ,crowids2_datap += __tinc0_7
26433 0           ,cwhich2_datap += __tinc0_8
26434 0           ,dists_datap += __tinc0_9
26435             )
26436             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
26437 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
26438 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
26439             {PDL_COMMENT("Open ncmps") register PDL_Indx ncmps;
26440 0 0         for(ncmps=0; ncmps<(__ncmps_size); ncmps++) {
26441 0 0         int c1 = (cwhich1_datap)[0+(__inc_cwhich1_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26442 0 0         int c2 = (cwhich2_datap)[0+(__inc_cwhich2_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") ;
26443 0           int succ_c1=c1+1;
26444 0           int succ_c2=c2+1;
26445 0 0         int beg1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, c1))] PDL_COMMENT("ACCESS()") ;
26446 0 0         int beg2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, c2))] PDL_COMMENT("ACCESS()") ;
26447 0 0         int len1 = (coffsets1_datap)[0+(__inc_coffsets1_k1*PP_INDTERM(__privtrans->__k1_size, succ_c1))] PDL_COMMENT("ACCESS()") - beg1;
26448 0 0         int len2 = (coffsets2_datap)[0+(__inc_coffsets2_k2*PP_INDTERM(__privtrans->__k2_size, succ_c2))] PDL_COMMENT("ACCESS()") - beg2;
26449 0           int *crowids1p = crowids1_datap + beg1;
26450 0           int *crowids2p = crowids2_datap + beg2;
26451              
26452 0 0         (dists_datap)[0+(__inc_dists_ncmps*PP_INDTERM(__privtrans->__ncmps_size, ncmps))] PDL_COMMENT("ACCESS()") = clusterdistance(__privtrans->__n_size, __privtrans->__d_size, datapp, maskpp, weight_datap,
26453             len1, len2,
26454             crowids1p, crowids2p,
26455 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
26456             }} PDL_COMMENT("Close ncmps")
26457            
26458             PDL_COMMENT("THREADLOOPEND")
26459             }
26460             }
26461 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
26462 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
26463 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
26464 0           coffsets1_datap -= __tinc1_3 * __tdims1 + __offsp[3];
26465 0           crowids1_datap -= __tinc1_4 * __tdims1 + __offsp[4];
26466 0           cwhich1_datap -= __tinc1_5 * __tdims1 + __offsp[5];
26467 0           coffsets2_datap -= __tinc1_6 * __tdims1 + __offsp[6];
26468 0           crowids2_datap -= __tinc1_7 * __tdims1 + __offsp[7];
26469 0           cwhich2_datap -= __tinc1_8 * __tdims1 + __offsp[8];
26470 0           dists_datap -= __tinc1_9 * __tdims1 + __offsp[9];
26471 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
26472             /*-- cleanup --*/
26473 0 0         if (datapp) free(datapp);
26474 0 0         if (maskpp) free(maskpp);
26475              
26476 0           } break;}
26477 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
26478             }
26479             }
26480             }
26481            
26482              
26483              
26484              
26485 0           void pdl_clusterdistancesenc_free(pdl_trans *__tr ) {
26486             int __dim;
26487 0           pdl_clusterdistancesenc_struct *__privtrans = (pdl_clusterdistancesenc_struct *) __tr;
26488            
26489             {
26490            
26491 0           PDL_TR_CLRMAGIC(__privtrans);
26492 0           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
26493 0 0         if(__privtrans->__ddone) {
26494 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
26495             ;;;;;;;;;;;;;;;;;;;;
26496             }
26497            
26498             }
26499 0           }
26500            
26501              
26502              
26503              
26504             static char pdl_clusterdistancesenc_vtable_flags[] =
26505             { 0,0,0,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
26506             pdl_transvtable pdl_clusterdistancesenc_vtable = {
26507             0,0, 9, 10, pdl_clusterdistancesenc_vtable_flags,
26508             pdl_clusterdistancesenc_redodims, pdl_clusterdistancesenc_readdata, NULL,
26509             pdl_clusterdistancesenc_free,NULL,NULL,pdl_clusterdistancesenc_copy,
26510             sizeof(pdl_clusterdistancesenc_struct),"pdl_clusterdistancesenc_vtable"
26511             };
26512              
26513             typedef struct pdl_getclusterwsum_struct {
26514             PDL_TRANS_START(5);
26515             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_clusterwts_k;PDL_Indx __inc_clusterwts_n;PDL_Indx __inc_cdata_d;PDL_Indx __inc_cdata_k;PDL_Indx __inc_cmask_d;PDL_Indx __inc_cmask_k;PDL_Indx __n_size;PDL_Indx __d_size;PDL_Indx __k_size;
26516            
26517             char __ddone; PDL_COMMENT("Dims done")
26518             } pdl_getclusterwsum_struct;
26519              
26520 0           void pdl_getclusterwsum_redodims(pdl_trans *__tr ) {
26521             int __dim;
26522 0           pdl_getclusterwsum_struct *__privtrans = (pdl_getclusterwsum_struct *) __tr;
26523            
26524             {
26525             PDL_Indx __creating[5];
26526 0           __privtrans->__n_size = -1;
26527 0           __privtrans->__d_size = -1;
26528 0           __privtrans->__k_size = -1;
26529 0           __creating[0] = 0;
26530 0           __creating[1] = 0;
26531 0           __creating[2] = 0;
26532 0 0         __creating[3] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[3]);
    0          
26533 0 0         __creating[4] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[4]);
    0          
26534             {
26535             {PDL_COMMENT("Start generic loop")
26536              
26537 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
26538 0           } break; case PDL_B: {
26539 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26540 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26541              
26542 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26543 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26544              
26545 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26546 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26547              
26548 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26549 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26550              
26551 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26552 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26553              
26554 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26555 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26556 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26557 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26558 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26559 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26560 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26561 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26562 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26563 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26564              
26565             PDL_COMMENT("none")
26566 0           } } break; case PDL_S: {
26567 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26568 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26569              
26570 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26571 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26572              
26573 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26574 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26575              
26576 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26577 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26578              
26579 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26580 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26581              
26582 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26583 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26584 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26585 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26586 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26587 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26588 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26589 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26590 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26591 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26592              
26593             PDL_COMMENT("none")
26594 0           } } break; case PDL_US: {
26595 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26596 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26597              
26598 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26599 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26600              
26601 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26602 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26603              
26604 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26605 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26606              
26607 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26608 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26609              
26610 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26611 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26612 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26613 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26614 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26615 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26616 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26617 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26618 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26619 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26620              
26621             PDL_COMMENT("none")
26622 0           } } break; case PDL_L: {
26623 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26624 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26625              
26626 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26627 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26628              
26629 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26630 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26631              
26632 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26633 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26634              
26635 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26636 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26637              
26638 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26639 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26640 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26641 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26642 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26643 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26644 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26645 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26646 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26647 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26648              
26649             PDL_COMMENT("none")
26650 0           } } break; case PDL_IND: {
26651 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26652 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26653              
26654 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26655 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26656              
26657 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26658 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26659              
26660 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26661 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26662              
26663 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26664 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26665              
26666 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26667 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26668 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26669 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26670 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26671 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26672 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26673 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26674 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26675 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26676              
26677             PDL_COMMENT("none")
26678 0           } } break; case PDL_LL: {
26679 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26680 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26681              
26682 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26683 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26684              
26685 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26686 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26687              
26688 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26689 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26690              
26691 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26692 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26693              
26694 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26695 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26696 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26697 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26698 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26699 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26700 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26701 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26702 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26703 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26704              
26705             PDL_COMMENT("none")
26706 0           } } break; case PDL_F: {
26707 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26708 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26709              
26710 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26711 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26712              
26713 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26714 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26715              
26716 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26717 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26718              
26719 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26720 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26721              
26722 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26723 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26724 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26725 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26726 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26727 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26728 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26729 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26730 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26731 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26732              
26733             PDL_COMMENT("none")
26734 0           } } break; case PDL_D: {
26735 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
26736 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
26737              
26738 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
26739 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
26740              
26741 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
26742 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
26743              
26744 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
26745 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
26746              
26747 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
26748 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
26749              
26750 0           {register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
26751 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
26752 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
26753 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
26754 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
26755 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
26756 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
26757 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
26758 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
26759 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
26760              
26761             PDL_COMMENT("none")
26762 0           } break;}
26763 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
26764             }
26765             }
26766             {
26767             static char *__parnames[] = {"data","mask","clusterwts","cdata","cmask"};
26768             static PDL_Indx __realdims[] = {2,2,2,2,2};
26769             static char __funcname[] = "PDL::Cluster::getclusterwsum";
26770             static pdl_errorinfo __einfo = {
26771             __funcname, __parnames, 5
26772             };
26773            
26774 0           PDL->initthreadstruct(2,__privtrans->pdls,
26775             __realdims,__creating,5,
26776             &__einfo,&(__privtrans->__pdlthread),
26777 0           __privtrans->vtable->per_pdl_flags,
26778             0 );
26779             }
26780 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
26781 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
26782 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
26783             }
26784 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
26785 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
26786 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
26787 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
26788 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26789             }
26790             }
26791 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
26792 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
26793 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
26794 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
26795 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26796             }
26797             }
26798 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
26799 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
26800 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
26801             }
26802 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
26803 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
26804 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
26805 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
26806 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26807             }
26808             }
26809 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
26810 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
26811 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
26812 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
26813 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26814             }
26815             }
26816 0 0         if(((__privtrans->pdls[2]))->ndims < 2) {
26817 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
26818 0 0         if (((__privtrans->pdls[2]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
26819             }
26820 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
26821 0           __privtrans->__k_size = ((__privtrans->pdls[2]))->dims[0];
26822 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
26823 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
26824 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26825             }
26826             }
26827 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
26828 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[1];
26829 0 0         } else if(((__privtrans->pdls[2]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[1]) {
    0          
26830 0 0         if(((__privtrans->pdls[2]))->dims[1] != 1) {
26831 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26832             }
26833             }
26834 0 0         if(!__creating[3]) {
26835 0 0         if(((__privtrans->pdls[3]))->ndims < 2) {
26836 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
26837 0 0         if (((__privtrans->pdls[3]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
26838             }
26839 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
26840 0           __privtrans->__d_size = ((__privtrans->pdls[3]))->dims[0];
26841 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
26842 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
26843 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26844             }
26845             }
26846 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
26847 0           __privtrans->__k_size = ((__privtrans->pdls[3]))->dims[1];
26848 0 0         } else if(((__privtrans->pdls[3]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[3]))->dims[1]) {
    0          
26849 0 0         if(((__privtrans->pdls[3]))->dims[1] != 1) {
26850 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26851             }
26852             }
26853             } else {
26854 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__k_size;
26855 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,3,dims,0);
26856 0 0         }if(!__creating[4]) {
26857 0 0         if(((__privtrans->pdls[4]))->ndims < 2) {
26858 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
26859 0 0         if (((__privtrans->pdls[4]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
26860             }
26861 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
26862 0           __privtrans->__d_size = ((__privtrans->pdls[4]))->dims[0];
26863 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
26864 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
26865 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26866             }
26867             }
26868 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
26869 0           __privtrans->__k_size = ((__privtrans->pdls[4]))->dims[1];
26870 0 0         } else if(((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[4]))->dims[1]) {
    0          
26871 0 0         if(((__privtrans->pdls[4]))->dims[1] != 1) {
26872 0           PDL->pdl_barf("Error in getclusterwsum:" "Wrong dims\n");
26873             }
26874             }
26875             } else {
26876 0           PDL_Indx dims[3]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__d_size;dims[1] = __privtrans->__k_size;
26877 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,4,dims,0);
26878             }
26879             { PDL_COMMENT("convenience block")
26880 0           void *hdrp = NULL;
26881 0           char propagate_hdrcpy = 0;
26882 0           SV *hdr_copy = NULL;
26883 0 0         if(!hdrp &&
    0          
26884 0 0         __privtrans->pdls[0]->hdrsv &&
26885 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
26886             ) {
26887 0           hdrp = __privtrans->pdls[0]->hdrsv;
26888 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
26889             }
26890 0 0         if(!hdrp &&
    0          
26891 0 0         __privtrans->pdls[1]->hdrsv &&
26892 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
26893             ) {
26894 0           hdrp = __privtrans->pdls[1]->hdrsv;
26895 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
26896             }
26897 0 0         if(!hdrp &&
    0          
26898 0 0         __privtrans->pdls[2]->hdrsv &&
26899 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
26900             ) {
26901 0           hdrp = __privtrans->pdls[2]->hdrsv;
26902 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
26903             }
26904 0 0         if(!hdrp &&
    0          
26905 0 0         !__creating[3] &&
26906 0 0         __privtrans->pdls[3]->hdrsv &&
26907 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
26908             ) {
26909 0           hdrp = __privtrans->pdls[3]->hdrsv;
26910 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
26911             }
26912 0 0         if(!hdrp &&
    0          
26913 0 0         !__creating[4] &&
26914 0 0         __privtrans->pdls[4]->hdrsv &&
26915 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
26916             ) {
26917 0           hdrp = __privtrans->pdls[4]->hdrsv;
26918 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
26919             }
26920 0 0         if (hdrp) {
26921 0 0         if(hdrp == &PL_sv_undef)
26922 0           hdr_copy = &PL_sv_undef;
26923             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
26924             int count;
26925             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
26926 0           dSP;
26927 0           ENTER ;
26928 0           SAVETMPS ;
26929 0 0         PUSHMARK(SP) ;
26930 0 0         XPUSHs( hdrp );
26931 0           PUTBACK ;
26932 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
26933 0           SPAGAIN ;
26934 0 0         if(count != 1)
26935 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
26936              
26937 0           hdr_copy = (SV *)POPs;
26938              
26939 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
26940 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
26941             }
26942              
26943 0 0         FREETMPS ;
26944 0           LEAVE ;
26945              
26946              
26947             } PDL_COMMENT("end of callback block")
26948              
26949 0 0         if ( __privtrans->pdls[3]->hdrsv != hdrp ){
26950 0 0         if( __privtrans->pdls[3]->hdrsv && __privtrans->pdls[3]->hdrsv != &PL_sv_undef)
    0          
26951 0           (void)SvREFCNT_dec( __privtrans->pdls[3]->hdrsv );
26952 0 0         if( hdr_copy != &PL_sv_undef )
26953 0           (void)SvREFCNT_inc(hdr_copy);
26954 0           __privtrans->pdls[3]->hdrsv = hdr_copy;
26955             }
26956 0 0         if(propagate_hdrcpy)
26957 0           __privtrans->pdls[3]->state |= PDL_HDRCPY;
26958 0 0         if ( __privtrans->pdls[4]->hdrsv != hdrp ){
26959 0 0         if( __privtrans->pdls[4]->hdrsv && __privtrans->pdls[4]->hdrsv != &PL_sv_undef)
    0          
26960 0           (void)SvREFCNT_dec( __privtrans->pdls[4]->hdrsv );
26961 0 0         if( hdr_copy != &PL_sv_undef )
26962 0           (void)SvREFCNT_inc(hdr_copy);
26963 0           __privtrans->pdls[4]->hdrsv = hdr_copy;
26964             }
26965 0 0         if(propagate_hdrcpy)
26966 0           __privtrans->pdls[4]->state |= PDL_HDRCPY;
26967              
26968 0 0         if(hdr_copy != &PL_sv_undef)
26969 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
26970             } PDL_COMMENT("end of if(hdrp) block")
26971             } PDL_COMMENT("end of conv. block")
26972 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
26973 0           __privtrans->__inc_data_d = 0; else
26974 0 0         __privtrans->__inc_data_d = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
    0          
26975 0           __privtrans->__inc_data_n = 0; else
26976 0 0         __privtrans->__inc_data_n = PDL_REPRINC(__privtrans->pdls[0],1);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
26977 0           __privtrans->__inc_mask_d = 0; else
26978 0 0         __privtrans->__inc_mask_d = PDL_REPRINC(__privtrans->pdls[1],0);if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
    0          
26979 0           __privtrans->__inc_mask_n = 0; else
26980 0 0         __privtrans->__inc_mask_n = PDL_REPRINC(__privtrans->pdls[1],1);if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
    0          
26981 0           __privtrans->__inc_clusterwts_k = 0; else
26982 0 0         __privtrans->__inc_clusterwts_k = PDL_REPRINC(__privtrans->pdls[2],0);if(__privtrans->pdls[2]->ndims <= 1 || __privtrans->pdls[2]->dims[1] <= 1)
    0          
    0          
26983 0           __privtrans->__inc_clusterwts_n = 0; else
26984 0 0         __privtrans->__inc_clusterwts_n = PDL_REPRINC(__privtrans->pdls[2],1);if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
    0          
26985 0           __privtrans->__inc_cdata_d = 0; else
26986 0 0         __privtrans->__inc_cdata_d = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[3]->ndims <= 1 || __privtrans->pdls[3]->dims[1] <= 1)
    0          
    0          
26987 0           __privtrans->__inc_cdata_k = 0; else
26988 0 0         __privtrans->__inc_cdata_k = PDL_REPRINC(__privtrans->pdls[3],1);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
26989 0           __privtrans->__inc_cmask_d = 0; else
26990 0 0         __privtrans->__inc_cmask_d = PDL_REPRINC(__privtrans->pdls[4],0);if(__privtrans->pdls[4]->ndims <= 1 || __privtrans->pdls[4]->dims[1] <= 1)
    0          
    0          
26991 0           __privtrans->__inc_cmask_k = 0; else
26992 0 0         __privtrans->__inc_cmask_k = PDL_REPRINC(__privtrans->pdls[4],1); __privtrans->__ddone = 1;
26993             }
26994 0           }
26995            
26996              
26997 0           pdl_trans * pdl_getclusterwsum_copy(pdl_trans *__tr ) {
26998             int __dim;
26999 0           pdl_getclusterwsum_struct *__privtrans = (pdl_getclusterwsum_struct *) __tr;
27000            
27001             {
27002 0           pdl_getclusterwsum_struct *__copy = malloc(sizeof(pdl_getclusterwsum_struct));
27003 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
27004 0           __copy->has_badvalue = __privtrans->has_badvalue;
27005 0           __copy->badvalue = __privtrans->badvalue;
27006 0           __copy->flags = __privtrans->flags;
27007 0           __copy->vtable = __privtrans->vtable;
27008 0           __copy->__datatype = __privtrans->__datatype;
27009 0           __copy->freeproc = NULL;
27010 0           __copy->__ddone = __privtrans->__ddone;
27011             {int i;
27012 0 0         for(i=0; i<__copy->vtable->npdls; i++)
27013 0           __copy->pdls[i] = __privtrans->pdls[i];
27014             }
27015            
27016 0 0         if(__copy->__ddone) {
27017 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_clusterwts_k=__copy->__inc_clusterwts_k;__privtrans->__inc_clusterwts_n=__copy->__inc_clusterwts_n;__privtrans->__inc_cdata_d=__copy->__inc_cdata_d;__privtrans->__inc_cdata_k=__copy->__inc_cdata_k;__privtrans->__inc_cmask_d=__copy->__inc_cmask_d;__privtrans->__inc_cmask_k=__copy->__inc_cmask_k;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;__copy->__k_size=__privtrans->__k_size;
27018             }
27019 0           return (pdl_trans*)__copy;
27020             }
27021             }
27022            
27023              
27024 0           void pdl_getclusterwsum_readdata(pdl_trans *__tr ) {
27025             int __dim;
27026 0           pdl_getclusterwsum_struct *__privtrans = (pdl_getclusterwsum_struct *) __tr;
27027            
27028             {
27029 0           {register PDL_Indx __d_size = __privtrans->__d_size;
27030 0           register PDL_Indx __k_size = __privtrans->__k_size;
27031 0           register PDL_Indx __n_size = __privtrans->__n_size;
27032             PDL_COMMENT("Start generic loop")
27033              
27034 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
27035 0           } break; case PDL_B: {
27036 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27037 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27038              
27039 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27040 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27041              
27042 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27043 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27044              
27045 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27046 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27047              
27048 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27049 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27050              
27051              
27052             PDL_COMMENT("THREADLOOPBEGIN")
27053 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27054 0           do { register PDL_Indx __tind1=0,__tind2=0;
27055 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27056 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27057 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27058 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27059 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27060 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27061 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27062 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27063 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27064 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27065 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27066 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27067 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27068 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27069 0           data_datap += __offsp[0];
27070 0           mask_datap += __offsp[1];
27071 0           clusterwts_datap += __offsp[2];
27072 0           cdata_datap += __offsp[3];
27073 0           cmask_datap += __offsp[4];
27074 0 0         for( __tind2 = 0 ;
27075             __tind2 < __tdims1 ;
27076 0           __tind2++
27077 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27078 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27079 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27080 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27081 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27082             )
27083             {
27084 0 0         for( __tind1 = 0 ;
27085             __tind1 < __tdims0 ;
27086 0           __tind1++
27087 0           ,data_datap += __tinc0_0
27088 0           ,mask_datap += __tinc0_1
27089 0           ,clusterwts_datap += __tinc0_2
27090 0           ,cdata_datap += __tinc0_3
27091 0           ,cmask_datap += __tinc0_4
27092             )
27093 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27094 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27095 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27096 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27097 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27098 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27099 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27100 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27101 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27102 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27103              
27104              
27105             int rid, rwt, cmaskdk;
27106             {PDL_COMMENT("Open d") register PDL_Indx d;
27107 0 0         for(d=0; d<(__d_size); d++) {
27108             {PDL_COMMENT("Open k") register PDL_Indx k;
27109 0 0         for(k=0; k<(__k_size); k++) {
27110 0           cmaskdk = 0;
27111             {PDL_COMMENT("Open n") register PDL_Indx n;
27112 0 0         for(n=0; n<(__n_size); n++) {
27113 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27114 0           cmaskdk = 1;
27115 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27116             }
27117             }} PDL_COMMENT("Close n")
27118 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27119             }} PDL_COMMENT("Close k")
27120             }} PDL_COMMENT("Close d")
27121              
27122             }
27123             PDL_COMMENT("THREADLOOPEND")
27124             }
27125             }
27126 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27127 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27128 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27129 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27130 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27131 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_S: {
27132 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27133 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27134              
27135 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27136 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27137              
27138 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27139 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27140              
27141 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27142 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27143              
27144 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27145 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27146              
27147              
27148             PDL_COMMENT("THREADLOOPBEGIN")
27149 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27150 0           do { register PDL_Indx __tind1=0,__tind2=0;
27151 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27152 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27153 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27154 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27155 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27156 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27157 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27158 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27159 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27160 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27161 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27162 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27163 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27164 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27165 0           data_datap += __offsp[0];
27166 0           mask_datap += __offsp[1];
27167 0           clusterwts_datap += __offsp[2];
27168 0           cdata_datap += __offsp[3];
27169 0           cmask_datap += __offsp[4];
27170 0 0         for( __tind2 = 0 ;
27171             __tind2 < __tdims1 ;
27172 0           __tind2++
27173 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27174 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27175 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27176 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27177 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27178             )
27179             {
27180 0 0         for( __tind1 = 0 ;
27181             __tind1 < __tdims0 ;
27182 0           __tind1++
27183 0           ,data_datap += __tinc0_0
27184 0           ,mask_datap += __tinc0_1
27185 0           ,clusterwts_datap += __tinc0_2
27186 0           ,cdata_datap += __tinc0_3
27187 0           ,cmask_datap += __tinc0_4
27188             )
27189 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27190 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27191 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27192 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27193 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27194 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27195 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27196 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27197 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27198 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27199              
27200              
27201             int rid, rwt, cmaskdk;
27202             {PDL_COMMENT("Open d") register PDL_Indx d;
27203 0 0         for(d=0; d<(__d_size); d++) {
27204             {PDL_COMMENT("Open k") register PDL_Indx k;
27205 0 0         for(k=0; k<(__k_size); k++) {
27206 0           cmaskdk = 0;
27207             {PDL_COMMENT("Open n") register PDL_Indx n;
27208 0 0         for(n=0; n<(__n_size); n++) {
27209 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27210 0           cmaskdk = 1;
27211 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27212             }
27213             }} PDL_COMMENT("Close n")
27214 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27215             }} PDL_COMMENT("Close k")
27216             }} PDL_COMMENT("Close d")
27217              
27218             }
27219             PDL_COMMENT("THREADLOOPEND")
27220             }
27221             }
27222 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27223 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27224 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27225 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27226 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27227 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_US: {
27228 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27229 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27230              
27231 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27232 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27233              
27234 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27235 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27236              
27237 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27238 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27239              
27240 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27241 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27242              
27243              
27244             PDL_COMMENT("THREADLOOPBEGIN")
27245 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27246 0           do { register PDL_Indx __tind1=0,__tind2=0;
27247 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27248 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27249 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27250 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27251 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27252 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27253 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27254 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27255 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27256 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27257 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27258 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27259 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27260 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27261 0           data_datap += __offsp[0];
27262 0           mask_datap += __offsp[1];
27263 0           clusterwts_datap += __offsp[2];
27264 0           cdata_datap += __offsp[3];
27265 0           cmask_datap += __offsp[4];
27266 0 0         for( __tind2 = 0 ;
27267             __tind2 < __tdims1 ;
27268 0           __tind2++
27269 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27270 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27271 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27272 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27273 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27274             )
27275             {
27276 0 0         for( __tind1 = 0 ;
27277             __tind1 < __tdims0 ;
27278 0           __tind1++
27279 0           ,data_datap += __tinc0_0
27280 0           ,mask_datap += __tinc0_1
27281 0           ,clusterwts_datap += __tinc0_2
27282 0           ,cdata_datap += __tinc0_3
27283 0           ,cmask_datap += __tinc0_4
27284             )
27285 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27286 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27287 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27288 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27289 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27290 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27291 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27292 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27293 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27294 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27295              
27296              
27297             int rid, rwt, cmaskdk;
27298             {PDL_COMMENT("Open d") register PDL_Indx d;
27299 0 0         for(d=0; d<(__d_size); d++) {
27300             {PDL_COMMENT("Open k") register PDL_Indx k;
27301 0 0         for(k=0; k<(__k_size); k++) {
27302 0           cmaskdk = 0;
27303             {PDL_COMMENT("Open n") register PDL_Indx n;
27304 0 0         for(n=0; n<(__n_size); n++) {
27305 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27306 0           cmaskdk = 1;
27307 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27308             }
27309             }} PDL_COMMENT("Close n")
27310 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27311             }} PDL_COMMENT("Close k")
27312             }} PDL_COMMENT("Close d")
27313              
27314             }
27315             PDL_COMMENT("THREADLOOPEND")
27316             }
27317             }
27318 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27319 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27320 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27321 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27322 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27323 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_L: {
27324 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27325 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27326              
27327 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27328 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27329              
27330 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27331 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27332              
27333 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27334 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27335              
27336 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27337 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27338              
27339              
27340             PDL_COMMENT("THREADLOOPBEGIN")
27341 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27342 0           do { register PDL_Indx __tind1=0,__tind2=0;
27343 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27344 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27345 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27346 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27347 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27348 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27349 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27350 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27351 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27352 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27353 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27354 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27355 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27356 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27357 0           data_datap += __offsp[0];
27358 0           mask_datap += __offsp[1];
27359 0           clusterwts_datap += __offsp[2];
27360 0           cdata_datap += __offsp[3];
27361 0           cmask_datap += __offsp[4];
27362 0 0         for( __tind2 = 0 ;
27363             __tind2 < __tdims1 ;
27364 0           __tind2++
27365 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27366 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27367 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27368 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27369 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27370             )
27371             {
27372 0 0         for( __tind1 = 0 ;
27373             __tind1 < __tdims0 ;
27374 0           __tind1++
27375 0           ,data_datap += __tinc0_0
27376 0           ,mask_datap += __tinc0_1
27377 0           ,clusterwts_datap += __tinc0_2
27378 0           ,cdata_datap += __tinc0_3
27379 0           ,cmask_datap += __tinc0_4
27380             )
27381 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27382 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27383 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27384 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27385 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27386 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27387 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27388 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27389 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27390 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27391              
27392              
27393             int rid, rwt, cmaskdk;
27394             {PDL_COMMENT("Open d") register PDL_Indx d;
27395 0 0         for(d=0; d<(__d_size); d++) {
27396             {PDL_COMMENT("Open k") register PDL_Indx k;
27397 0 0         for(k=0; k<(__k_size); k++) {
27398 0           cmaskdk = 0;
27399             {PDL_COMMENT("Open n") register PDL_Indx n;
27400 0 0         for(n=0; n<(__n_size); n++) {
27401 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27402 0           cmaskdk = 1;
27403 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27404             }
27405             }} PDL_COMMENT("Close n")
27406 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27407             }} PDL_COMMENT("Close k")
27408             }} PDL_COMMENT("Close d")
27409              
27410             }
27411             PDL_COMMENT("THREADLOOPEND")
27412             }
27413             }
27414 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27415 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27416 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27417 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27418 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27419 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_IND: {
27420 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27421 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27422              
27423 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27424 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27425              
27426 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27427 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27428              
27429 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27430 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27431              
27432 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27433 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27434              
27435              
27436             PDL_COMMENT("THREADLOOPBEGIN")
27437 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27438 0           do { register PDL_Indx __tind1=0,__tind2=0;
27439 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27440 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27441 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27442 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27443 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27444 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27445 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27446 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27447 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27448 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27449 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27450 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27451 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27452 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27453 0           data_datap += __offsp[0];
27454 0           mask_datap += __offsp[1];
27455 0           clusterwts_datap += __offsp[2];
27456 0           cdata_datap += __offsp[3];
27457 0           cmask_datap += __offsp[4];
27458 0 0         for( __tind2 = 0 ;
27459             __tind2 < __tdims1 ;
27460 0           __tind2++
27461 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27462 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27463 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27464 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27465 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27466             )
27467             {
27468 0 0         for( __tind1 = 0 ;
27469             __tind1 < __tdims0 ;
27470 0           __tind1++
27471 0           ,data_datap += __tinc0_0
27472 0           ,mask_datap += __tinc0_1
27473 0           ,clusterwts_datap += __tinc0_2
27474 0           ,cdata_datap += __tinc0_3
27475 0           ,cmask_datap += __tinc0_4
27476             )
27477 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27478 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27479 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27480 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27481 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27482 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27483 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27484 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27485 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27486 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27487              
27488              
27489             int rid, rwt, cmaskdk;
27490             {PDL_COMMENT("Open d") register PDL_Indx d;
27491 0 0         for(d=0; d<(__d_size); d++) {
27492             {PDL_COMMENT("Open k") register PDL_Indx k;
27493 0 0         for(k=0; k<(__k_size); k++) {
27494 0           cmaskdk = 0;
27495             {PDL_COMMENT("Open n") register PDL_Indx n;
27496 0 0         for(n=0; n<(__n_size); n++) {
27497 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27498 0           cmaskdk = 1;
27499 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27500             }
27501             }} PDL_COMMENT("Close n")
27502 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27503             }} PDL_COMMENT("Close k")
27504             }} PDL_COMMENT("Close d")
27505              
27506             }
27507             PDL_COMMENT("THREADLOOPEND")
27508             }
27509             }
27510 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27511 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27512 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27513 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27514 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27515 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_LL: {
27516 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27517 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27518              
27519 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27520 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27521              
27522 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27523 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27524              
27525 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27526 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27527              
27528 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27529 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27530              
27531              
27532             PDL_COMMENT("THREADLOOPBEGIN")
27533 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27534 0           do { register PDL_Indx __tind1=0,__tind2=0;
27535 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27536 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27537 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27538 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27539 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27540 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27541 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27542 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27543 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27544 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27545 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27546 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27547 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27548 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27549 0           data_datap += __offsp[0];
27550 0           mask_datap += __offsp[1];
27551 0           clusterwts_datap += __offsp[2];
27552 0           cdata_datap += __offsp[3];
27553 0           cmask_datap += __offsp[4];
27554 0 0         for( __tind2 = 0 ;
27555             __tind2 < __tdims1 ;
27556 0           __tind2++
27557 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27558 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27559 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27560 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27561 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27562             )
27563             {
27564 0 0         for( __tind1 = 0 ;
27565             __tind1 < __tdims0 ;
27566 0           __tind1++
27567 0           ,data_datap += __tinc0_0
27568 0           ,mask_datap += __tinc0_1
27569 0           ,clusterwts_datap += __tinc0_2
27570 0           ,cdata_datap += __tinc0_3
27571 0           ,cmask_datap += __tinc0_4
27572             )
27573 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27574 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27575 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27576 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27577 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27578 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27579 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27580 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27581 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27582 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27583              
27584              
27585             int rid, rwt, cmaskdk;
27586             {PDL_COMMENT("Open d") register PDL_Indx d;
27587 0 0         for(d=0; d<(__d_size); d++) {
27588             {PDL_COMMENT("Open k") register PDL_Indx k;
27589 0 0         for(k=0; k<(__k_size); k++) {
27590 0           cmaskdk = 0;
27591             {PDL_COMMENT("Open n") register PDL_Indx n;
27592 0 0         for(n=0; n<(__n_size); n++) {
27593 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27594 0           cmaskdk = 1;
27595 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27596             }
27597             }} PDL_COMMENT("Close n")
27598 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27599             }} PDL_COMMENT("Close k")
27600             }} PDL_COMMENT("Close d")
27601              
27602             }
27603             PDL_COMMENT("THREADLOOPEND")
27604             }
27605             }
27606 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27607 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27608 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27609 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27610 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27611 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_F: {
27612 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27613 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27614              
27615 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27616 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27617              
27618 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27619 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27620              
27621 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27622 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27623              
27624 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27625 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27626              
27627              
27628             PDL_COMMENT("THREADLOOPBEGIN")
27629 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27630 0           do { register PDL_Indx __tind1=0,__tind2=0;
27631 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27632 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27633 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27634 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27635 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27636 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27637 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27638 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27639 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27640 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27641 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27642 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27643 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27644 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27645 0           data_datap += __offsp[0];
27646 0           mask_datap += __offsp[1];
27647 0           clusterwts_datap += __offsp[2];
27648 0           cdata_datap += __offsp[3];
27649 0           cmask_datap += __offsp[4];
27650 0 0         for( __tind2 = 0 ;
27651             __tind2 < __tdims1 ;
27652 0           __tind2++
27653 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27654 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27655 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27656 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27657 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27658             )
27659             {
27660 0 0         for( __tind1 = 0 ;
27661             __tind1 < __tdims0 ;
27662 0           __tind1++
27663 0           ,data_datap += __tinc0_0
27664 0           ,mask_datap += __tinc0_1
27665 0           ,clusterwts_datap += __tinc0_2
27666 0           ,cdata_datap += __tinc0_3
27667 0           ,cmask_datap += __tinc0_4
27668             )
27669 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27670 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27671 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27672 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27673 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27674 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27675 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27676 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27677 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27678 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27679              
27680              
27681             int rid, rwt, cmaskdk;
27682             {PDL_COMMENT("Open d") register PDL_Indx d;
27683 0 0         for(d=0; d<(__d_size); d++) {
27684             {PDL_COMMENT("Open k") register PDL_Indx k;
27685 0 0         for(k=0; k<(__k_size); k++) {
27686 0           cmaskdk = 0;
27687             {PDL_COMMENT("Open n") register PDL_Indx n;
27688 0 0         for(n=0; n<(__n_size); n++) {
27689 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27690 0           cmaskdk = 1;
27691 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27692             }
27693             }} PDL_COMMENT("Close n")
27694 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27695             }} PDL_COMMENT("Close k")
27696             }} PDL_COMMENT("Close d")
27697              
27698             }
27699             PDL_COMMENT("THREADLOOPEND")
27700             }
27701             }
27702 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27703 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27704 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27705 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27706 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27707 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); } break; case PDL_D: {
27708 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27709 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27710              
27711 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27712 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27713              
27714 0 0         PDL_Double * clusterwts_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27715 0           PDL_Double * clusterwts_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27716              
27717 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27718 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[3])->data));
27719              
27720 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27721 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[4])->data));
27722              
27723              
27724             PDL_COMMENT("THREADLOOPBEGIN")
27725 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
27726 0           do { register PDL_Indx __tind1=0,__tind2=0;
27727 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
27728 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
27729 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
27730 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
27731 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
27732 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
27733 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
27734 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
27735 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
27736 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
27737 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
27738 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
27739 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
27740 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
27741 0           data_datap += __offsp[0];
27742 0           mask_datap += __offsp[1];
27743 0           clusterwts_datap += __offsp[2];
27744 0           cdata_datap += __offsp[3];
27745 0           cmask_datap += __offsp[4];
27746 0 0         for( __tind2 = 0 ;
27747             __tind2 < __tdims1 ;
27748 0           __tind2++
27749 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
27750 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
27751 0           ,clusterwts_datap += __tinc1_2 - __tinc0_2 * __tdims0
27752 0           ,cdata_datap += __tinc1_3 - __tinc0_3 * __tdims0
27753 0           ,cmask_datap += __tinc1_4 - __tinc0_4 * __tdims0
27754             )
27755             {
27756 0 0         for( __tind1 = 0 ;
27757             __tind1 < __tdims0 ;
27758 0           __tind1++
27759 0           ,data_datap += __tinc0_0
27760 0           ,mask_datap += __tinc0_1
27761 0           ,clusterwts_datap += __tinc0_2
27762 0           ,cdata_datap += __tinc0_3
27763 0           ,cmask_datap += __tinc0_4
27764             )
27765 0           { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal."){register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27766 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27767 0           register PDL_Indx __inc_clusterwts_k = __privtrans->__inc_clusterwts_k;
27768 0           register PDL_Indx __inc_clusterwts_n = __privtrans->__inc_clusterwts_n;
27769 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27770 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27771 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27772 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27773 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27774 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27775              
27776              
27777             int rid, rwt, cmaskdk;
27778             {PDL_COMMENT("Open d") register PDL_Indx d;
27779 0 0         for(d=0; d<(__d_size); d++) {
27780             {PDL_COMMENT("Open k") register PDL_Indx k;
27781 0 0         for(k=0; k<(__k_size); k++) {
27782 0           cmaskdk = 0;
27783             {PDL_COMMENT("Open n") register PDL_Indx n;
27784 0 0         for(n=0; n<(__n_size); n++) {
27785 0 0         if ((mask_datap)[0+(__inc_mask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_mask_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ) {
    0          
    0          
27786 0           cmaskdk = 1;
27787 0 0         (cdata_datap)[0+(__inc_cdata_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cdata_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") += (clusterwts_datap)[0+(__inc_clusterwts_k*PP_INDTERM(__privtrans->__k_size, k))+(__inc_clusterwts_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") * (data_datap)[0+(__inc_data_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_data_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
    0          
    0          
    0          
    0          
    0          
27788             }
27789             }} PDL_COMMENT("Close n")
27790 0 0         (cmask_datap)[0+(__inc_cmask_d*PP_INDTERM(__privtrans->__d_size, d))+(__inc_cmask_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = cmaskdk;
    0          
27791             }} PDL_COMMENT("Close k")
27792             }} PDL_COMMENT("Close d")
27793              
27794             }
27795             PDL_COMMENT("THREADLOOPEND")
27796             }
27797             }
27798 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
27799 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
27800 0           clusterwts_datap -= __tinc1_2 * __tdims1 + __offsp[2];
27801 0           cdata_datap -= __tinc1_3 * __tdims1 + __offsp[3];
27802 0           cmask_datap -= __tinc1_4 * __tdims1 + __offsp[4];
27803 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2)); break;}
27804 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
27805             }
27806             }
27807             }
27808            
27809              
27810              
27811              
27812 0           void pdl_getclusterwsum_free(pdl_trans *__tr ) {
27813             int __dim;
27814 0           pdl_getclusterwsum_struct *__privtrans = (pdl_getclusterwsum_struct *) __tr;
27815            
27816             {
27817            
27818 0           PDL_TR_CLRMAGIC(__privtrans);
27819            
27820 0 0         if(__privtrans->__ddone) {
27821 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
27822             ;;;;;;;;;;;;;;
27823             }
27824            
27825             }
27826 0           }
27827            
27828              
27829              
27830              
27831             static char pdl_getclusterwsum_vtable_flags[] =
27832             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
27833             pdl_transvtable pdl_getclusterwsum_vtable = {
27834             0,0, 3, 5, pdl_getclusterwsum_vtable_flags,
27835             pdl_getclusterwsum_redodims, pdl_getclusterwsum_readdata, NULL,
27836             pdl_getclusterwsum_free,NULL,NULL,pdl_getclusterwsum_copy,
27837             sizeof(pdl_getclusterwsum_struct),"pdl_getclusterwsum_vtable"
27838             };
27839              
27840             typedef struct pdl_attachtonearest_struct {
27841             PDL_TRANS_START(8);
27842             pdl_thread __pdlthread;PDL_Indx __inc_data_d;PDL_Indx __inc_data_n;PDL_Indx __inc_mask_d;PDL_Indx __inc_mask_n;PDL_Indx __inc_weight_d;PDL_Indx __inc_rowids_nr;PDL_Indx __inc_cdata_d;PDL_Indx __inc_cdata_k;PDL_Indx __inc_cmask_d;PDL_Indx __inc_cmask_k;PDL_Indx __inc_clusterids_nr;PDL_Indx __inc_cdist_nr;PDL_Indx __nr_size;PDL_Indx __n_size;PDL_Indx __d_size;PDL_Indx __k_size;
27843             char *distFlag;char *methodFlag;
27844             char __ddone; PDL_COMMENT("Dims done")
27845             } pdl_attachtonearest_struct;
27846              
27847 0           void pdl_attachtonearest_redodims(pdl_trans *__tr ) {
27848             int __dim;
27849 0           pdl_attachtonearest_struct *__privtrans = (pdl_attachtonearest_struct *) __tr;
27850            
27851             {
27852             PDL_Indx __creating[8];
27853 0           __privtrans->__nr_size = -1;
27854 0           __privtrans->__n_size = -1;
27855 0           __privtrans->__d_size = -1;
27856 0           __privtrans->__k_size = -1;
27857 0           __creating[0] = 0;
27858 0           __creating[1] = 0;
27859 0           __creating[2] = 0;
27860 0           __creating[3] = 0;
27861 0           __creating[4] = 0;
27862 0           __creating[5] = 0;
27863 0 0         __creating[6] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[6]);
    0          
27864 0 0         __creating[7] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[7]);
    0          
27865             {
27866             {PDL_COMMENT("Start generic loop")
27867              
27868 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
27869 0           } break; case PDL_B: {
27870 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27871 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27872              
27873 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27874 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27875              
27876 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27877 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27878              
27879 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27880 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
27881              
27882 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27883 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
27884              
27885 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
27886 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
27887              
27888 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
27889 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
27890              
27891 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
27892 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
27893              
27894 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
27895 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27896 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27897 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
27898 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27899 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27900 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27901 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27902 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27903 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27904 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
27905 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
27906              
27907             PDL_COMMENT("none")
27908 0           } } break; case PDL_S: {
27909 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27910 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27911              
27912 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27913 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27914              
27915 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27916 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27917              
27918 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27919 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
27920              
27921 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27922 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
27923              
27924 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
27925 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
27926              
27927 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
27928 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
27929              
27930 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
27931 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
27932              
27933 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
27934 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27935 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27936 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
27937 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27938 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27939 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27940 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27941 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27942 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27943 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
27944 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
27945              
27946             PDL_COMMENT("none")
27947 0           } } break; case PDL_US: {
27948 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27949 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27950              
27951 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27952 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27953              
27954 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27955 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27956              
27957 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27958 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
27959              
27960 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
27961 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
27962              
27963 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
27964 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
27965              
27966 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
27967 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
27968              
27969 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
27970 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
27971              
27972 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
27973 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
27974 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
27975 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
27976 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
27977 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
27978 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
27979 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
27980 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
27981 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
27982 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
27983 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
27984              
27985             PDL_COMMENT("none")
27986 0           } } break; case PDL_L: {
27987 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
27988 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
27989              
27990 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
27991 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
27992              
27993 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
27994 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
27995              
27996 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
27997 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
27998              
27999 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28000 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28001              
28002 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28003 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28004              
28005 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28006 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28007              
28008 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28009 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28010              
28011 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28012 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28013 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28014 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28015 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28016 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28017 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28018 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28019 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28020 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28021 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28022 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28023              
28024             PDL_COMMENT("none")
28025 0           } } break; case PDL_IND: {
28026 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28027 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28028              
28029 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28030 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28031              
28032 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28033 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28034              
28035 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28036 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28037              
28038 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28039 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28040              
28041 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28042 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28043              
28044 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28045 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28046              
28047 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28048 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28049              
28050 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28051 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28052 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28053 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28054 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28055 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28056 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28057 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28058 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28059 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28060 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28061 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28062              
28063             PDL_COMMENT("none")
28064 0           } } break; case PDL_LL: {
28065 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28066 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28067              
28068 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28069 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28070              
28071 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28072 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28073              
28074 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28075 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28076              
28077 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28078 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28079              
28080 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28081 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28082              
28083 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28084 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28085              
28086 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28087 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28088              
28089 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28090 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28091 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28092 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28093 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28094 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28095 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28096 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28097 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28098 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28099 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28100 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28101              
28102             PDL_COMMENT("none")
28103 0           } } break; case PDL_F: {
28104 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28105 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28106              
28107 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28108 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28109              
28110 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28111 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28112              
28113 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28114 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28115              
28116 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28117 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28118              
28119 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28120 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28121              
28122 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28123 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28124              
28125 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28126 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28127              
28128 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28129 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28130 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28131 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28132 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28133 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28134 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28135 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28136 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28137 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28138 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28139 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28140              
28141             PDL_COMMENT("none")
28142 0           } } break; case PDL_D: {
28143 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28144 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28145              
28146 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28147 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28148              
28149 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28150 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28151              
28152 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28153 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28154              
28155 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28156 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28157              
28158 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28159 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28160              
28161 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28162 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28163              
28164 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28165 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28166              
28167 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28168 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28169 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28170 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28171 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28172 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28173 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28174 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28175 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28176 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28177 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28178 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28179              
28180             PDL_COMMENT("none")
28181 0           } break;}
28182 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
28183             }
28184             }
28185             {
28186             static char *__parnames[] = {"data","mask","weight","rowids","cdata","cmask","clusterids","cdist"};
28187             static PDL_Indx __realdims[] = {2,2,1,1,2,2,1,1};
28188             static char __funcname[] = "PDL::Cluster::attachtonearest";
28189             static pdl_errorinfo __einfo = {
28190             __funcname, __parnames, 8
28191             };
28192            
28193 0           PDL->initthreadstruct(2,__privtrans->pdls,
28194             __realdims,__creating,8,
28195             &__einfo,&(__privtrans->__pdlthread),
28196 0           __privtrans->vtable->per_pdl_flags,
28197             0 );
28198             }
28199 0 0         if(((__privtrans->pdls[0]))->ndims < 2) {
28200 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
28201 0 0         if (((__privtrans->pdls[0]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
28202             }
28203 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
28204 0           __privtrans->__d_size = ((__privtrans->pdls[0]))->dims[0];
28205 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
28206 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
28207 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28208             }
28209             }
28210 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
28211 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[1];
28212 0 0         } else if(((__privtrans->pdls[0]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[1]) {
    0          
28213 0 0         if(((__privtrans->pdls[0]))->dims[1] != 1) {
28214 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28215             }
28216             }
28217 0           PDL->make_physical(((__privtrans->pdls[0])));
28218 0 0         if(((__privtrans->pdls[1]))->ndims < 2) {
28219 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
28220 0 0         if (((__privtrans->pdls[1]))->ndims < 2 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
28221             }
28222 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
28223 0           __privtrans->__d_size = ((__privtrans->pdls[1]))->dims[0];
28224 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
28225 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
28226 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28227             }
28228             }
28229 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size == 1)) {
    0          
    0          
28230 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[1];
28231 0 0         } else if(((__privtrans->pdls[1]))->ndims > 1 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[1]) {
    0          
28232 0 0         if(((__privtrans->pdls[1]))->dims[1] != 1) {
28233 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28234             }
28235             }
28236 0           PDL->make_physical(((__privtrans->pdls[1])));
28237 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
28238 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
28239             }
28240 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
28241 0           __privtrans->__d_size = ((__privtrans->pdls[2]))->dims[0];
28242 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
28243 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
28244 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28245             }
28246             }
28247 0           PDL->make_physical(((__privtrans->pdls[2])));
28248 0 0         if(((__privtrans->pdls[3]))->ndims < 1) {
28249 0 0         if (((__privtrans->pdls[3]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
28250             }
28251 0 0         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
28252 0           __privtrans->__nr_size = ((__privtrans->pdls[3]))->dims[0];
28253 0 0         } else if(((__privtrans->pdls[3]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[3]))->dims[0]) {
    0          
28254 0 0         if(((__privtrans->pdls[3]))->dims[0] != 1) {
28255 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28256             }
28257             }
28258 0 0         if(((__privtrans->pdls[4]))->ndims < 2) {
28259 0 0         if (((__privtrans->pdls[4]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
28260 0 0         if (((__privtrans->pdls[4]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
28261             }
28262 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
28263 0           __privtrans->__d_size = ((__privtrans->pdls[4]))->dims[0];
28264 0 0         } else if(((__privtrans->pdls[4]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[4]))->dims[0]) {
    0          
28265 0 0         if(((__privtrans->pdls[4]))->dims[0] != 1) {
28266 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28267             }
28268             }
28269 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
28270 0           __privtrans->__k_size = ((__privtrans->pdls[4]))->dims[1];
28271 0 0         } else if(((__privtrans->pdls[4]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[4]))->dims[1]) {
    0          
28272 0 0         if(((__privtrans->pdls[4]))->dims[1] != 1) {
28273 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28274             }
28275             }
28276 0           PDL->make_physical(((__privtrans->pdls[4])));
28277 0 0         if(((__privtrans->pdls[5]))->ndims < 2) {
28278 0 0         if (((__privtrans->pdls[5]))->ndims < 1 && __privtrans->__d_size <= 1) __privtrans->__d_size = 1;
    0          
28279 0 0         if (((__privtrans->pdls[5]))->ndims < 2 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
28280             }
28281 0 0         if(__privtrans->__d_size == -1 || (((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__d_size == 1)) {
    0          
    0          
28282 0           __privtrans->__d_size = ((__privtrans->pdls[5]))->dims[0];
28283 0 0         } else if(((__privtrans->pdls[5]))->ndims > 0 && __privtrans->__d_size != ((__privtrans->pdls[5]))->dims[0]) {
    0          
28284 0 0         if(((__privtrans->pdls[5]))->dims[0] != 1) {
28285 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28286             }
28287             }
28288 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[5]))->ndims > 1 && __privtrans->__k_size == 1)) {
    0          
    0          
28289 0           __privtrans->__k_size = ((__privtrans->pdls[5]))->dims[1];
28290 0 0         } else if(((__privtrans->pdls[5]))->ndims > 1 && __privtrans->__k_size != ((__privtrans->pdls[5]))->dims[1]) {
    0          
28291 0 0         if(((__privtrans->pdls[5]))->dims[1] != 1) {
28292 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28293             }
28294             }
28295 0           PDL->make_physical(((__privtrans->pdls[5])));
28296 0 0         if(!__creating[6]) {
28297 0 0         if(((__privtrans->pdls[6]))->ndims < 1) {
28298 0 0         if (((__privtrans->pdls[6]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
28299             }
28300 0 0         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
28301 0           __privtrans->__nr_size = ((__privtrans->pdls[6]))->dims[0];
28302 0 0         } else if(((__privtrans->pdls[6]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[6]))->dims[0]) {
    0          
28303 0 0         if(((__privtrans->pdls[6]))->dims[0] != 1) {
28304 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28305             }
28306             }
28307             } else {
28308 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__nr_size;
28309 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,6,dims,0);
28310 0 0         }if(!__creating[7]) {
28311 0 0         if(((__privtrans->pdls[7]))->ndims < 1) {
28312 0 0         if (((__privtrans->pdls[7]))->ndims < 1 && __privtrans->__nr_size <= 1) __privtrans->__nr_size = 1;
    0          
28313             }
28314 0 0         if(__privtrans->__nr_size == -1 || (((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__nr_size == 1)) {
    0          
    0          
28315 0           __privtrans->__nr_size = ((__privtrans->pdls[7]))->dims[0];
28316 0 0         } else if(((__privtrans->pdls[7]))->ndims > 0 && __privtrans->__nr_size != ((__privtrans->pdls[7]))->dims[0]) {
    0          
28317 0 0         if(((__privtrans->pdls[7]))->dims[0] != 1) {
28318 0           PDL->pdl_barf("Error in attachtonearest:" "Wrong dims\n");
28319             }
28320             }
28321             } else {
28322 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__nr_size;
28323 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,7,dims,0);
28324             }
28325             { PDL_COMMENT("convenience block")
28326 0           void *hdrp = NULL;
28327 0           char propagate_hdrcpy = 0;
28328 0           SV *hdr_copy = NULL;
28329 0 0         if(!hdrp &&
    0          
28330 0 0         __privtrans->pdls[0]->hdrsv &&
28331 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
28332             ) {
28333 0           hdrp = __privtrans->pdls[0]->hdrsv;
28334 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
28335             }
28336 0 0         if(!hdrp &&
    0          
28337 0 0         __privtrans->pdls[1]->hdrsv &&
28338 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
28339             ) {
28340 0           hdrp = __privtrans->pdls[1]->hdrsv;
28341 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
28342             }
28343 0 0         if(!hdrp &&
    0          
28344 0 0         __privtrans->pdls[2]->hdrsv &&
28345 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
28346             ) {
28347 0           hdrp = __privtrans->pdls[2]->hdrsv;
28348 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
28349             }
28350 0 0         if(!hdrp &&
    0          
28351 0 0         __privtrans->pdls[3]->hdrsv &&
28352 0           (__privtrans->pdls[3]->state & PDL_HDRCPY)
28353             ) {
28354 0           hdrp = __privtrans->pdls[3]->hdrsv;
28355 0           propagate_hdrcpy = ((__privtrans->pdls[3]->state & PDL_HDRCPY) != 0);
28356             }
28357 0 0         if(!hdrp &&
    0          
28358 0 0         __privtrans->pdls[4]->hdrsv &&
28359 0           (__privtrans->pdls[4]->state & PDL_HDRCPY)
28360             ) {
28361 0           hdrp = __privtrans->pdls[4]->hdrsv;
28362 0           propagate_hdrcpy = ((__privtrans->pdls[4]->state & PDL_HDRCPY) != 0);
28363             }
28364 0 0         if(!hdrp &&
    0          
28365 0 0         __privtrans->pdls[5]->hdrsv &&
28366 0           (__privtrans->pdls[5]->state & PDL_HDRCPY)
28367             ) {
28368 0           hdrp = __privtrans->pdls[5]->hdrsv;
28369 0           propagate_hdrcpy = ((__privtrans->pdls[5]->state & PDL_HDRCPY) != 0);
28370             }
28371 0 0         if(!hdrp &&
    0          
28372 0 0         !__creating[6] &&
28373 0 0         __privtrans->pdls[6]->hdrsv &&
28374 0           (__privtrans->pdls[6]->state & PDL_HDRCPY)
28375             ) {
28376 0           hdrp = __privtrans->pdls[6]->hdrsv;
28377 0           propagate_hdrcpy = ((__privtrans->pdls[6]->state & PDL_HDRCPY) != 0);
28378             }
28379 0 0         if(!hdrp &&
    0          
28380 0 0         !__creating[7] &&
28381 0 0         __privtrans->pdls[7]->hdrsv &&
28382 0           (__privtrans->pdls[7]->state & PDL_HDRCPY)
28383             ) {
28384 0           hdrp = __privtrans->pdls[7]->hdrsv;
28385 0           propagate_hdrcpy = ((__privtrans->pdls[7]->state & PDL_HDRCPY) != 0);
28386             }
28387 0 0         if (hdrp) {
28388 0 0         if(hdrp == &PL_sv_undef)
28389 0           hdr_copy = &PL_sv_undef;
28390             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
28391             int count;
28392             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
28393 0           dSP;
28394 0           ENTER ;
28395 0           SAVETMPS ;
28396 0 0         PUSHMARK(SP) ;
28397 0 0         XPUSHs( hdrp );
28398 0           PUTBACK ;
28399 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
28400 0           SPAGAIN ;
28401 0 0         if(count != 1)
28402 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
28403              
28404 0           hdr_copy = (SV *)POPs;
28405              
28406 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
28407 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
28408             }
28409              
28410 0 0         FREETMPS ;
28411 0           LEAVE ;
28412              
28413              
28414             } PDL_COMMENT("end of callback block")
28415              
28416 0 0         if ( __privtrans->pdls[6]->hdrsv != hdrp ){
28417 0 0         if( __privtrans->pdls[6]->hdrsv && __privtrans->pdls[6]->hdrsv != &PL_sv_undef)
    0          
28418 0           (void)SvREFCNT_dec( __privtrans->pdls[6]->hdrsv );
28419 0 0         if( hdr_copy != &PL_sv_undef )
28420 0           (void)SvREFCNT_inc(hdr_copy);
28421 0           __privtrans->pdls[6]->hdrsv = hdr_copy;
28422             }
28423 0 0         if(propagate_hdrcpy)
28424 0           __privtrans->pdls[6]->state |= PDL_HDRCPY;
28425 0 0         if ( __privtrans->pdls[7]->hdrsv != hdrp ){
28426 0 0         if( __privtrans->pdls[7]->hdrsv && __privtrans->pdls[7]->hdrsv != &PL_sv_undef)
    0          
28427 0           (void)SvREFCNT_dec( __privtrans->pdls[7]->hdrsv );
28428 0 0         if( hdr_copy != &PL_sv_undef )
28429 0           (void)SvREFCNT_inc(hdr_copy);
28430 0           __privtrans->pdls[7]->hdrsv = hdr_copy;
28431             }
28432 0 0         if(propagate_hdrcpy)
28433 0           __privtrans->pdls[7]->state |= PDL_HDRCPY;
28434              
28435 0 0         if(hdr_copy != &PL_sv_undef)
28436 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
28437             } PDL_COMMENT("end of if(hdrp) block")
28438             } PDL_COMMENT("end of conv. block")
28439 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
28440 0           __privtrans->__inc_data_d = 0; else
28441 0 0         __privtrans->__inc_data_d = __privtrans->pdls[0]->dimincs[0];if(__privtrans->pdls[0]->ndims <= 1 || __privtrans->pdls[0]->dims[1] <= 1)
    0          
28442 0           __privtrans->__inc_data_n = 0; else
28443 0 0         __privtrans->__inc_data_n = __privtrans->pdls[0]->dimincs[1];if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
28444 0           __privtrans->__inc_mask_d = 0; else
28445 0 0         __privtrans->__inc_mask_d = __privtrans->pdls[1]->dimincs[0];if(__privtrans->pdls[1]->ndims <= 1 || __privtrans->pdls[1]->dims[1] <= 1)
    0          
28446 0           __privtrans->__inc_mask_n = 0; else
28447 0 0         __privtrans->__inc_mask_n = __privtrans->pdls[1]->dimincs[1];if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
28448 0           __privtrans->__inc_weight_d = 0; else
28449 0 0         __privtrans->__inc_weight_d = __privtrans->pdls[2]->dimincs[0];if(__privtrans->pdls[3]->ndims <= 0 || __privtrans->pdls[3]->dims[0] <= 1)
    0          
28450 0           __privtrans->__inc_rowids_nr = 0; else
28451 0 0         __privtrans->__inc_rowids_nr = PDL_REPRINC(__privtrans->pdls[3],0);if(__privtrans->pdls[4]->ndims <= 0 || __privtrans->pdls[4]->dims[0] <= 1)
    0          
    0          
28452 0           __privtrans->__inc_cdata_d = 0; else
28453 0 0         __privtrans->__inc_cdata_d = __privtrans->pdls[4]->dimincs[0];if(__privtrans->pdls[4]->ndims <= 1 || __privtrans->pdls[4]->dims[1] <= 1)
    0          
28454 0           __privtrans->__inc_cdata_k = 0; else
28455 0 0         __privtrans->__inc_cdata_k = __privtrans->pdls[4]->dimincs[1];if(__privtrans->pdls[5]->ndims <= 0 || __privtrans->pdls[5]->dims[0] <= 1)
    0          
28456 0           __privtrans->__inc_cmask_d = 0; else
28457 0 0         __privtrans->__inc_cmask_d = __privtrans->pdls[5]->dimincs[0];if(__privtrans->pdls[5]->ndims <= 1 || __privtrans->pdls[5]->dims[1] <= 1)
    0          
28458 0           __privtrans->__inc_cmask_k = 0; else
28459 0 0         __privtrans->__inc_cmask_k = __privtrans->pdls[5]->dimincs[1];if(__privtrans->pdls[6]->ndims <= 0 || __privtrans->pdls[6]->dims[0] <= 1)
    0          
28460 0           __privtrans->__inc_clusterids_nr = 0; else
28461 0 0         __privtrans->__inc_clusterids_nr = PDL_REPRINC(__privtrans->pdls[6],0);if(__privtrans->pdls[7]->ndims <= 0 || __privtrans->pdls[7]->dims[0] <= 1)
    0          
    0          
28462 0           __privtrans->__inc_cdist_nr = 0; else
28463 0 0         __privtrans->__inc_cdist_nr = PDL_REPRINC(__privtrans->pdls[7],0); __privtrans->__ddone = 1;
28464             }
28465 0           }
28466            
28467              
28468 0           pdl_trans * pdl_attachtonearest_copy(pdl_trans *__tr ) {
28469             int __dim;
28470 0           pdl_attachtonearest_struct *__privtrans = (pdl_attachtonearest_struct *) __tr;
28471            
28472             {
28473 0           pdl_attachtonearest_struct *__copy = malloc(sizeof(pdl_attachtonearest_struct));
28474 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
28475 0           __copy->has_badvalue = __privtrans->has_badvalue;
28476 0           __copy->badvalue = __privtrans->badvalue;
28477 0           __copy->flags = __privtrans->flags;
28478 0           __copy->vtable = __privtrans->vtable;
28479 0           __copy->__datatype = __privtrans->__datatype;
28480 0           __copy->freeproc = NULL;
28481 0           __copy->__ddone = __privtrans->__ddone;
28482             {int i;
28483 0 0         for(i=0; i<__copy->vtable->npdls; i++)
28484 0           __copy->pdls[i] = __privtrans->pdls[i];
28485             }
28486 0           (__copy->distFlag) = malloc(strlen(__privtrans->distFlag)+1); strcpy(__copy->distFlag,__privtrans->distFlag);;(__copy->methodFlag) = malloc(strlen(__privtrans->methodFlag)+1); strcpy(__copy->methodFlag,__privtrans->methodFlag);;
28487 0 0         if(__copy->__ddone) {
28488 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_data_d=__copy->__inc_data_d;__privtrans->__inc_data_n=__copy->__inc_data_n;__privtrans->__inc_mask_d=__copy->__inc_mask_d;__privtrans->__inc_mask_n=__copy->__inc_mask_n;__privtrans->__inc_weight_d=__copy->__inc_weight_d;__privtrans->__inc_rowids_nr=__copy->__inc_rowids_nr;__privtrans->__inc_cdata_d=__copy->__inc_cdata_d;__privtrans->__inc_cdata_k=__copy->__inc_cdata_k;__privtrans->__inc_cmask_d=__copy->__inc_cmask_d;__privtrans->__inc_cmask_k=__copy->__inc_cmask_k;__privtrans->__inc_clusterids_nr=__copy->__inc_clusterids_nr;__privtrans->__inc_cdist_nr=__copy->__inc_cdist_nr;__copy->__nr_size=__privtrans->__nr_size;__copy->__n_size=__privtrans->__n_size;__copy->__d_size=__privtrans->__d_size;__copy->__k_size=__privtrans->__k_size;
28489             }
28490 0           return (pdl_trans*)__copy;
28491             }
28492             }
28493            
28494              
28495 0           void pdl_attachtonearest_readdata(pdl_trans *__tr ) {
28496             int __dim;
28497 0           pdl_attachtonearest_struct *__privtrans = (pdl_attachtonearest_struct *) __tr;
28498            
28499             {
28500 0           {register PDL_Indx __nr_size = __privtrans->__nr_size;
28501             PDL_COMMENT("Start generic loop")
28502              
28503 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
28504 0           } break; case PDL_B: {
28505 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28506 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28507              
28508 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28509 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28510              
28511 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28512 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28513              
28514 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28515 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28516              
28517 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28518 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28519              
28520 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28521 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28522              
28523 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28524 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28525              
28526 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28527 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28528              
28529 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28530 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28531 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28532 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28533 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28534 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28535 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28536 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28537 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28538 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28539 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28540 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28541              
28542              
28543 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
28544 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
28545 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
28546 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
28547             double *tmpdatapp[2];
28548             int *tmpmaskpp[2];
28549 0           int transpose=0;
28550            
28551             PDL_COMMENT("THREADLOOPBEGIN")
28552 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
28553 0           do { register PDL_Indx __tind1=0,__tind2=0;
28554 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
28555 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
28556 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
28557 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
28558 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
28559 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
28560 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
28561 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
28562 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
28563 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
28564 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
28565 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
28566 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
28567 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
28568 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
28569 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
28570 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
28571 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
28572 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
28573 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
28574 0           data_datap += __offsp[0];
28575 0           mask_datap += __offsp[1];
28576 0           weight_datap += __offsp[2];
28577 0           rowids_datap += __offsp[3];
28578 0           cdata_datap += __offsp[4];
28579 0           cmask_datap += __offsp[5];
28580 0           clusterids_datap += __offsp[6];
28581 0           cdist_datap += __offsp[7];
28582 0 0         for( __tind2 = 0 ;
28583             __tind2 < __tdims1 ;
28584 0           __tind2++
28585 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
28586 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
28587 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
28588 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
28589 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
28590 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
28591 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
28592 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
28593             )
28594             {
28595 0 0         for( __tind1 = 0 ;
28596             __tind1 < __tdims0 ;
28597 0           __tind1++
28598 0           ,data_datap += __tinc0_0
28599 0           ,mask_datap += __tinc0_1
28600 0           ,weight_datap += __tinc0_2
28601 0           ,rowids_datap += __tinc0_3
28602 0           ,cdata_datap += __tinc0_4
28603 0           ,cmask_datap += __tinc0_5
28604 0           ,clusterids_datap += __tinc0_6
28605 0           ,cdist_datap += __tinc0_7
28606             )
28607             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
28608 0           int tmprowid = 0;
28609 0           int tmpctrid = 1;
28610             int ni;
28611             int ki, kbest;
28612             double dist, dbest;
28613 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
28614 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
28615 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
28616 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
28617             /*-- loop over all target rows --*/
28618             {PDL_COMMENT("Open nr") register PDL_Indx nr;
28619 0 0         for(nr=0; nr<(__nr_size); nr++) {
28620 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
28621 0           tmpdatapp[tmprowid] = datapp[ni];
28622 0           tmpmaskpp[tmprowid] = maskpp[ni];
28623             /*-- initialize --*/
28624 0           tmpdatapp[tmpctrid] = cdatapp[0];
28625 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
28626 0           kbest = 0;
28627 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28628             1, 1, &tmprowid, &tmpctrid,
28629 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28630             /*-- loop over all centroids --*/
28631 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
28632 0           tmpdatapp[tmpctrid] = cdatapp[ki];
28633 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
28634 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28635             1, 1, &tmprowid, &tmpctrid,
28636 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28637 0 0         if (dist < dbest) {
28638 0           kbest = ki;
28639 0           dbest = dist;
28640             }
28641             }
28642             /*-- save best data --*/
28643 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
28644 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
28645             }} PDL_COMMENT("Close nr")
28646            
28647             PDL_COMMENT("THREADLOOPEND")
28648             }
28649             }
28650 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
28651 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
28652 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
28653 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
28654 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
28655 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
28656 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
28657 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
28658 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
28659             /*-- cleanup --*/
28660 0 0         if (datapp) free(datapp);
28661 0 0         if (maskpp) free(maskpp);
28662 0 0         if (cdatapp) free(cdatapp);
28663 0 0         if (cmaskpp) free(cmaskpp);
28664              
28665 0           } } break; case PDL_S: {
28666 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28667 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28668              
28669 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28670 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28671              
28672 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28673 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28674              
28675 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28676 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28677              
28678 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28679 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28680              
28681 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28682 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28683              
28684 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28685 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28686              
28687 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28688 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28689              
28690 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28691 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28692 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28693 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28694 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28695 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28696 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28697 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28698 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28699 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28700 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28701 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28702              
28703              
28704 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
28705 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
28706 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
28707 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
28708             double *tmpdatapp[2];
28709             int *tmpmaskpp[2];
28710 0           int transpose=0;
28711            
28712             PDL_COMMENT("THREADLOOPBEGIN")
28713 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
28714 0           do { register PDL_Indx __tind1=0,__tind2=0;
28715 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
28716 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
28717 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
28718 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
28719 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
28720 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
28721 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
28722 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
28723 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
28724 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
28725 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
28726 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
28727 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
28728 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
28729 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
28730 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
28731 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
28732 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
28733 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
28734 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
28735 0           data_datap += __offsp[0];
28736 0           mask_datap += __offsp[1];
28737 0           weight_datap += __offsp[2];
28738 0           rowids_datap += __offsp[3];
28739 0           cdata_datap += __offsp[4];
28740 0           cmask_datap += __offsp[5];
28741 0           clusterids_datap += __offsp[6];
28742 0           cdist_datap += __offsp[7];
28743 0 0         for( __tind2 = 0 ;
28744             __tind2 < __tdims1 ;
28745 0           __tind2++
28746 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
28747 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
28748 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
28749 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
28750 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
28751 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
28752 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
28753 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
28754             )
28755             {
28756 0 0         for( __tind1 = 0 ;
28757             __tind1 < __tdims0 ;
28758 0           __tind1++
28759 0           ,data_datap += __tinc0_0
28760 0           ,mask_datap += __tinc0_1
28761 0           ,weight_datap += __tinc0_2
28762 0           ,rowids_datap += __tinc0_3
28763 0           ,cdata_datap += __tinc0_4
28764 0           ,cmask_datap += __tinc0_5
28765 0           ,clusterids_datap += __tinc0_6
28766 0           ,cdist_datap += __tinc0_7
28767             )
28768             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
28769 0           int tmprowid = 0;
28770 0           int tmpctrid = 1;
28771             int ni;
28772             int ki, kbest;
28773             double dist, dbest;
28774 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
28775 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
28776 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
28777 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
28778             /*-- loop over all target rows --*/
28779             {PDL_COMMENT("Open nr") register PDL_Indx nr;
28780 0 0         for(nr=0; nr<(__nr_size); nr++) {
28781 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
28782 0           tmpdatapp[tmprowid] = datapp[ni];
28783 0           tmpmaskpp[tmprowid] = maskpp[ni];
28784             /*-- initialize --*/
28785 0           tmpdatapp[tmpctrid] = cdatapp[0];
28786 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
28787 0           kbest = 0;
28788 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28789             1, 1, &tmprowid, &tmpctrid,
28790 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28791             /*-- loop over all centroids --*/
28792 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
28793 0           tmpdatapp[tmpctrid] = cdatapp[ki];
28794 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
28795 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28796             1, 1, &tmprowid, &tmpctrid,
28797 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28798 0 0         if (dist < dbest) {
28799 0           kbest = ki;
28800 0           dbest = dist;
28801             }
28802             }
28803             /*-- save best data --*/
28804 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
28805 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
28806             }} PDL_COMMENT("Close nr")
28807            
28808             PDL_COMMENT("THREADLOOPEND")
28809             }
28810             }
28811 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
28812 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
28813 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
28814 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
28815 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
28816 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
28817 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
28818 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
28819 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
28820             /*-- cleanup --*/
28821 0 0         if (datapp) free(datapp);
28822 0 0         if (maskpp) free(maskpp);
28823 0 0         if (cdatapp) free(cdatapp);
28824 0 0         if (cmaskpp) free(cmaskpp);
28825              
28826 0           } } break; case PDL_US: {
28827 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28828 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28829              
28830 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28831 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28832              
28833 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28834 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28835              
28836 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28837 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28838              
28839 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
28840 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
28841              
28842 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
28843 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
28844              
28845 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
28846 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
28847              
28848 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
28849 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
28850              
28851 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
28852 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
28853 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
28854 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
28855 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
28856 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
28857 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
28858 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
28859 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
28860 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
28861 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
28862 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
28863              
28864              
28865 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
28866 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
28867 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
28868 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
28869             double *tmpdatapp[2];
28870             int *tmpmaskpp[2];
28871 0           int transpose=0;
28872            
28873             PDL_COMMENT("THREADLOOPBEGIN")
28874 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
28875 0           do { register PDL_Indx __tind1=0,__tind2=0;
28876 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
28877 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
28878 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
28879 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
28880 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
28881 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
28882 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
28883 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
28884 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
28885 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
28886 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
28887 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
28888 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
28889 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
28890 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
28891 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
28892 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
28893 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
28894 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
28895 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
28896 0           data_datap += __offsp[0];
28897 0           mask_datap += __offsp[1];
28898 0           weight_datap += __offsp[2];
28899 0           rowids_datap += __offsp[3];
28900 0           cdata_datap += __offsp[4];
28901 0           cmask_datap += __offsp[5];
28902 0           clusterids_datap += __offsp[6];
28903 0           cdist_datap += __offsp[7];
28904 0 0         for( __tind2 = 0 ;
28905             __tind2 < __tdims1 ;
28906 0           __tind2++
28907 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
28908 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
28909 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
28910 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
28911 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
28912 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
28913 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
28914 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
28915             )
28916             {
28917 0 0         for( __tind1 = 0 ;
28918             __tind1 < __tdims0 ;
28919 0           __tind1++
28920 0           ,data_datap += __tinc0_0
28921 0           ,mask_datap += __tinc0_1
28922 0           ,weight_datap += __tinc0_2
28923 0           ,rowids_datap += __tinc0_3
28924 0           ,cdata_datap += __tinc0_4
28925 0           ,cmask_datap += __tinc0_5
28926 0           ,clusterids_datap += __tinc0_6
28927 0           ,cdist_datap += __tinc0_7
28928             )
28929             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
28930 0           int tmprowid = 0;
28931 0           int tmpctrid = 1;
28932             int ni;
28933             int ki, kbest;
28934             double dist, dbest;
28935 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
28936 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
28937 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
28938 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
28939             /*-- loop over all target rows --*/
28940             {PDL_COMMENT("Open nr") register PDL_Indx nr;
28941 0 0         for(nr=0; nr<(__nr_size); nr++) {
28942 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
28943 0           tmpdatapp[tmprowid] = datapp[ni];
28944 0           tmpmaskpp[tmprowid] = maskpp[ni];
28945             /*-- initialize --*/
28946 0           tmpdatapp[tmpctrid] = cdatapp[0];
28947 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
28948 0           kbest = 0;
28949 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28950             1, 1, &tmprowid, &tmpctrid,
28951 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28952             /*-- loop over all centroids --*/
28953 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
28954 0           tmpdatapp[tmpctrid] = cdatapp[ki];
28955 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
28956 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
28957             1, 1, &tmprowid, &tmpctrid,
28958 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
28959 0 0         if (dist < dbest) {
28960 0           kbest = ki;
28961 0           dbest = dist;
28962             }
28963             }
28964             /*-- save best data --*/
28965 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
28966 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
28967             }} PDL_COMMENT("Close nr")
28968            
28969             PDL_COMMENT("THREADLOOPEND")
28970             }
28971             }
28972 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
28973 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
28974 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
28975 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
28976 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
28977 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
28978 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
28979 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
28980 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
28981             /*-- cleanup --*/
28982 0 0         if (datapp) free(datapp);
28983 0 0         if (maskpp) free(maskpp);
28984 0 0         if (cdatapp) free(cdatapp);
28985 0 0         if (cmaskpp) free(cmaskpp);
28986              
28987 0           } } break; case PDL_L: {
28988 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
28989 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
28990              
28991 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
28992 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
28993              
28994 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
28995 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
28996              
28997 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
28998 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
28999              
29000 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
29001 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
29002              
29003 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
29004 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
29005              
29006 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
29007 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
29008              
29009 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
29010 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
29011              
29012 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
29013 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
29014 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
29015 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
29016 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
29017 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
29018 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
29019 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
29020 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
29021 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
29022 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
29023 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
29024              
29025              
29026 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
29027 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
29028 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
29029 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
29030             double *tmpdatapp[2];
29031             int *tmpmaskpp[2];
29032 0           int transpose=0;
29033            
29034             PDL_COMMENT("THREADLOOPBEGIN")
29035 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
29036 0           do { register PDL_Indx __tind1=0,__tind2=0;
29037 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
29038 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
29039 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
29040 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
29041 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
29042 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
29043 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
29044 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
29045 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
29046 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
29047 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
29048 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
29049 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
29050 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
29051 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
29052 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
29053 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
29054 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
29055 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
29056 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
29057 0           data_datap += __offsp[0];
29058 0           mask_datap += __offsp[1];
29059 0           weight_datap += __offsp[2];
29060 0           rowids_datap += __offsp[3];
29061 0           cdata_datap += __offsp[4];
29062 0           cmask_datap += __offsp[5];
29063 0           clusterids_datap += __offsp[6];
29064 0           cdist_datap += __offsp[7];
29065 0 0         for( __tind2 = 0 ;
29066             __tind2 < __tdims1 ;
29067 0           __tind2++
29068 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
29069 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
29070 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
29071 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
29072 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
29073 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
29074 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
29075 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
29076             )
29077             {
29078 0 0         for( __tind1 = 0 ;
29079             __tind1 < __tdims0 ;
29080 0           __tind1++
29081 0           ,data_datap += __tinc0_0
29082 0           ,mask_datap += __tinc0_1
29083 0           ,weight_datap += __tinc0_2
29084 0           ,rowids_datap += __tinc0_3
29085 0           ,cdata_datap += __tinc0_4
29086 0           ,cmask_datap += __tinc0_5
29087 0           ,clusterids_datap += __tinc0_6
29088 0           ,cdist_datap += __tinc0_7
29089             )
29090             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
29091 0           int tmprowid = 0;
29092 0           int tmpctrid = 1;
29093             int ni;
29094             int ki, kbest;
29095             double dist, dbest;
29096 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
29097 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
29098 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
29099 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
29100             /*-- loop over all target rows --*/
29101             {PDL_COMMENT("Open nr") register PDL_Indx nr;
29102 0 0         for(nr=0; nr<(__nr_size); nr++) {
29103 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
29104 0           tmpdatapp[tmprowid] = datapp[ni];
29105 0           tmpmaskpp[tmprowid] = maskpp[ni];
29106             /*-- initialize --*/
29107 0           tmpdatapp[tmpctrid] = cdatapp[0];
29108 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
29109 0           kbest = 0;
29110 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29111             1, 1, &tmprowid, &tmpctrid,
29112 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29113             /*-- loop over all centroids --*/
29114 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
29115 0           tmpdatapp[tmpctrid] = cdatapp[ki];
29116 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
29117 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29118             1, 1, &tmprowid, &tmpctrid,
29119 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29120 0 0         if (dist < dbest) {
29121 0           kbest = ki;
29122 0           dbest = dist;
29123             }
29124             }
29125             /*-- save best data --*/
29126 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
29127 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
29128             }} PDL_COMMENT("Close nr")
29129            
29130             PDL_COMMENT("THREADLOOPEND")
29131             }
29132             }
29133 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
29134 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
29135 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
29136 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
29137 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
29138 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
29139 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
29140 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
29141 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
29142             /*-- cleanup --*/
29143 0 0         if (datapp) free(datapp);
29144 0 0         if (maskpp) free(maskpp);
29145 0 0         if (cdatapp) free(cdatapp);
29146 0 0         if (cmaskpp) free(cmaskpp);
29147              
29148 0           } } break; case PDL_IND: {
29149 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29150 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
29151              
29152 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29153 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
29154              
29155 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29156 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
29157              
29158 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
29159 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
29160              
29161 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
29162 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
29163              
29164 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
29165 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
29166              
29167 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
29168 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
29169              
29170 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
29171 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
29172              
29173 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
29174 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
29175 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
29176 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
29177 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
29178 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
29179 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
29180 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
29181 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
29182 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
29183 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
29184 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
29185              
29186              
29187 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
29188 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
29189 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
29190 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
29191             double *tmpdatapp[2];
29192             int *tmpmaskpp[2];
29193 0           int transpose=0;
29194            
29195             PDL_COMMENT("THREADLOOPBEGIN")
29196 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
29197 0           do { register PDL_Indx __tind1=0,__tind2=0;
29198 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
29199 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
29200 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
29201 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
29202 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
29203 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
29204 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
29205 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
29206 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
29207 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
29208 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
29209 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
29210 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
29211 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
29212 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
29213 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
29214 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
29215 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
29216 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
29217 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
29218 0           data_datap += __offsp[0];
29219 0           mask_datap += __offsp[1];
29220 0           weight_datap += __offsp[2];
29221 0           rowids_datap += __offsp[3];
29222 0           cdata_datap += __offsp[4];
29223 0           cmask_datap += __offsp[5];
29224 0           clusterids_datap += __offsp[6];
29225 0           cdist_datap += __offsp[7];
29226 0 0         for( __tind2 = 0 ;
29227             __tind2 < __tdims1 ;
29228 0           __tind2++
29229 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
29230 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
29231 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
29232 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
29233 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
29234 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
29235 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
29236 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
29237             )
29238             {
29239 0 0         for( __tind1 = 0 ;
29240             __tind1 < __tdims0 ;
29241 0           __tind1++
29242 0           ,data_datap += __tinc0_0
29243 0           ,mask_datap += __tinc0_1
29244 0           ,weight_datap += __tinc0_2
29245 0           ,rowids_datap += __tinc0_3
29246 0           ,cdata_datap += __tinc0_4
29247 0           ,cmask_datap += __tinc0_5
29248 0           ,clusterids_datap += __tinc0_6
29249 0           ,cdist_datap += __tinc0_7
29250             )
29251             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
29252 0           int tmprowid = 0;
29253 0           int tmpctrid = 1;
29254             int ni;
29255             int ki, kbest;
29256             double dist, dbest;
29257 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
29258 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
29259 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
29260 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
29261             /*-- loop over all target rows --*/
29262             {PDL_COMMENT("Open nr") register PDL_Indx nr;
29263 0 0         for(nr=0; nr<(__nr_size); nr++) {
29264 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
29265 0           tmpdatapp[tmprowid] = datapp[ni];
29266 0           tmpmaskpp[tmprowid] = maskpp[ni];
29267             /*-- initialize --*/
29268 0           tmpdatapp[tmpctrid] = cdatapp[0];
29269 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
29270 0           kbest = 0;
29271 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29272             1, 1, &tmprowid, &tmpctrid,
29273 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29274             /*-- loop over all centroids --*/
29275 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
29276 0           tmpdatapp[tmpctrid] = cdatapp[ki];
29277 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
29278 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29279             1, 1, &tmprowid, &tmpctrid,
29280 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29281 0 0         if (dist < dbest) {
29282 0           kbest = ki;
29283 0           dbest = dist;
29284             }
29285             }
29286             /*-- save best data --*/
29287 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
29288 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
29289             }} PDL_COMMENT("Close nr")
29290            
29291             PDL_COMMENT("THREADLOOPEND")
29292             }
29293             }
29294 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
29295 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
29296 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
29297 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
29298 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
29299 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
29300 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
29301 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
29302 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
29303             /*-- cleanup --*/
29304 0 0         if (datapp) free(datapp);
29305 0 0         if (maskpp) free(maskpp);
29306 0 0         if (cdatapp) free(cdatapp);
29307 0 0         if (cmaskpp) free(cmaskpp);
29308              
29309 0           } } break; case PDL_LL: {
29310 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29311 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
29312              
29313 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29314 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
29315              
29316 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29317 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
29318              
29319 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
29320 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
29321              
29322 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
29323 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
29324              
29325 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
29326 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
29327              
29328 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
29329 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
29330              
29331 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
29332 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
29333              
29334 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
29335 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
29336 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
29337 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
29338 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
29339 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
29340 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
29341 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
29342 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
29343 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
29344 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
29345 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
29346              
29347              
29348 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
29349 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
29350 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
29351 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
29352             double *tmpdatapp[2];
29353             int *tmpmaskpp[2];
29354 0           int transpose=0;
29355            
29356             PDL_COMMENT("THREADLOOPBEGIN")
29357 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
29358 0           do { register PDL_Indx __tind1=0,__tind2=0;
29359 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
29360 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
29361 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
29362 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
29363 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
29364 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
29365 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
29366 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
29367 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
29368 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
29369 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
29370 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
29371 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
29372 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
29373 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
29374 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
29375 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
29376 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
29377 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
29378 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
29379 0           data_datap += __offsp[0];
29380 0           mask_datap += __offsp[1];
29381 0           weight_datap += __offsp[2];
29382 0           rowids_datap += __offsp[3];
29383 0           cdata_datap += __offsp[4];
29384 0           cmask_datap += __offsp[5];
29385 0           clusterids_datap += __offsp[6];
29386 0           cdist_datap += __offsp[7];
29387 0 0         for( __tind2 = 0 ;
29388             __tind2 < __tdims1 ;
29389 0           __tind2++
29390 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
29391 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
29392 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
29393 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
29394 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
29395 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
29396 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
29397 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
29398             )
29399             {
29400 0 0         for( __tind1 = 0 ;
29401             __tind1 < __tdims0 ;
29402 0           __tind1++
29403 0           ,data_datap += __tinc0_0
29404 0           ,mask_datap += __tinc0_1
29405 0           ,weight_datap += __tinc0_2
29406 0           ,rowids_datap += __tinc0_3
29407 0           ,cdata_datap += __tinc0_4
29408 0           ,cmask_datap += __tinc0_5
29409 0           ,clusterids_datap += __tinc0_6
29410 0           ,cdist_datap += __tinc0_7
29411             )
29412             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
29413 0           int tmprowid = 0;
29414 0           int tmpctrid = 1;
29415             int ni;
29416             int ki, kbest;
29417             double dist, dbest;
29418 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
29419 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
29420 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
29421 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
29422             /*-- loop over all target rows --*/
29423             {PDL_COMMENT("Open nr") register PDL_Indx nr;
29424 0 0         for(nr=0; nr<(__nr_size); nr++) {
29425 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
29426 0           tmpdatapp[tmprowid] = datapp[ni];
29427 0           tmpmaskpp[tmprowid] = maskpp[ni];
29428             /*-- initialize --*/
29429 0           tmpdatapp[tmpctrid] = cdatapp[0];
29430 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
29431 0           kbest = 0;
29432 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29433             1, 1, &tmprowid, &tmpctrid,
29434 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29435             /*-- loop over all centroids --*/
29436 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
29437 0           tmpdatapp[tmpctrid] = cdatapp[ki];
29438 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
29439 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29440             1, 1, &tmprowid, &tmpctrid,
29441 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29442 0 0         if (dist < dbest) {
29443 0           kbest = ki;
29444 0           dbest = dist;
29445             }
29446             }
29447             /*-- save best data --*/
29448 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
29449 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
29450             }} PDL_COMMENT("Close nr")
29451            
29452             PDL_COMMENT("THREADLOOPEND")
29453             }
29454             }
29455 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
29456 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
29457 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
29458 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
29459 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
29460 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
29461 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
29462 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
29463 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
29464             /*-- cleanup --*/
29465 0 0         if (datapp) free(datapp);
29466 0 0         if (maskpp) free(maskpp);
29467 0 0         if (cdatapp) free(cdatapp);
29468 0 0         if (cmaskpp) free(cmaskpp);
29469              
29470 0           } } break; case PDL_F: {
29471 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29472 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
29473              
29474 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29475 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
29476              
29477 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29478 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
29479              
29480 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
29481 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
29482              
29483 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
29484 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
29485              
29486 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
29487 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
29488              
29489 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
29490 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
29491              
29492 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
29493 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
29494              
29495 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
29496 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
29497 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
29498 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
29499 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
29500 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
29501 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
29502 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
29503 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
29504 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
29505 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
29506 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
29507              
29508              
29509 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
29510 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
29511 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
29512 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
29513             double *tmpdatapp[2];
29514             int *tmpmaskpp[2];
29515 0           int transpose=0;
29516            
29517             PDL_COMMENT("THREADLOOPBEGIN")
29518 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
29519 0           do { register PDL_Indx __tind1=0,__tind2=0;
29520 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
29521 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
29522 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
29523 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
29524 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
29525 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
29526 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
29527 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
29528 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
29529 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
29530 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
29531 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
29532 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
29533 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
29534 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
29535 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
29536 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
29537 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
29538 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
29539 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
29540 0           data_datap += __offsp[0];
29541 0           mask_datap += __offsp[1];
29542 0           weight_datap += __offsp[2];
29543 0           rowids_datap += __offsp[3];
29544 0           cdata_datap += __offsp[4];
29545 0           cmask_datap += __offsp[5];
29546 0           clusterids_datap += __offsp[6];
29547 0           cdist_datap += __offsp[7];
29548 0 0         for( __tind2 = 0 ;
29549             __tind2 < __tdims1 ;
29550 0           __tind2++
29551 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
29552 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
29553 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
29554 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
29555 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
29556 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
29557 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
29558 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
29559             )
29560             {
29561 0 0         for( __tind1 = 0 ;
29562             __tind1 < __tdims0 ;
29563 0           __tind1++
29564 0           ,data_datap += __tinc0_0
29565 0           ,mask_datap += __tinc0_1
29566 0           ,weight_datap += __tinc0_2
29567 0           ,rowids_datap += __tinc0_3
29568 0           ,cdata_datap += __tinc0_4
29569 0           ,cmask_datap += __tinc0_5
29570 0           ,clusterids_datap += __tinc0_6
29571 0           ,cdist_datap += __tinc0_7
29572             )
29573             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
29574 0           int tmprowid = 0;
29575 0           int tmpctrid = 1;
29576             int ni;
29577             int ki, kbest;
29578             double dist, dbest;
29579 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
29580 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
29581 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
29582 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
29583             /*-- loop over all target rows --*/
29584             {PDL_COMMENT("Open nr") register PDL_Indx nr;
29585 0 0         for(nr=0; nr<(__nr_size); nr++) {
29586 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
29587 0           tmpdatapp[tmprowid] = datapp[ni];
29588 0           tmpmaskpp[tmprowid] = maskpp[ni];
29589             /*-- initialize --*/
29590 0           tmpdatapp[tmpctrid] = cdatapp[0];
29591 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
29592 0           kbest = 0;
29593 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29594             1, 1, &tmprowid, &tmpctrid,
29595 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29596             /*-- loop over all centroids --*/
29597 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
29598 0           tmpdatapp[tmpctrid] = cdatapp[ki];
29599 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
29600 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29601             1, 1, &tmprowid, &tmpctrid,
29602 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29603 0 0         if (dist < dbest) {
29604 0           kbest = ki;
29605 0           dbest = dist;
29606             }
29607             }
29608             /*-- save best data --*/
29609 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
29610 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
29611             }} PDL_COMMENT("Close nr")
29612            
29613             PDL_COMMENT("THREADLOOPEND")
29614             }
29615             }
29616 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
29617 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
29618 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
29619 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
29620 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
29621 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
29622 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
29623 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
29624 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
29625             /*-- cleanup --*/
29626 0 0         if (datapp) free(datapp);
29627 0 0         if (maskpp) free(maskpp);
29628 0 0         if (cdatapp) free(cdatapp);
29629 0 0         if (cmaskpp) free(cmaskpp);
29630              
29631 0           } } break; case PDL_D: {
29632 0 0         PDL_Double * data_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29633 0           PDL_Double * data_physdatap = ((PDL_Double *)((__privtrans->pdls[0])->data));
29634              
29635 0 0         PDL_Long * mask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29636 0           PDL_Long * mask_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
29637              
29638 0 0         PDL_Double * weight_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29639 0           PDL_Double * weight_physdatap = ((PDL_Double *)((__privtrans->pdls[2])->data));
29640              
29641 0 0         PDL_Long * rowids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[3]),(__privtrans->vtable->per_pdl_flags[3]))));
    0          
29642 0           PDL_Long * rowids_physdatap = ((PDL_Long *)((__privtrans->pdls[3])->data));
29643              
29644 0 0         PDL_Double * cdata_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[4]),(__privtrans->vtable->per_pdl_flags[4]))));
    0          
29645 0           PDL_Double * cdata_physdatap = ((PDL_Double *)((__privtrans->pdls[4])->data));
29646              
29647 0 0         PDL_Long * cmask_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[5]),(__privtrans->vtable->per_pdl_flags[5]))));
    0          
29648 0           PDL_Long * cmask_physdatap = ((PDL_Long *)((__privtrans->pdls[5])->data));
29649              
29650 0 0         PDL_Long * clusterids_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[6]),(__privtrans->vtable->per_pdl_flags[6]))));
    0          
29651 0           PDL_Long * clusterids_physdatap = ((PDL_Long *)((__privtrans->pdls[6])->data));
29652              
29653 0 0         PDL_Double * cdist_datap = ((PDL_Double *)(PDL_REPRP_TRANS((__privtrans->pdls[7]),(__privtrans->vtable->per_pdl_flags[7]))));
    0          
29654 0           PDL_Double * cdist_physdatap = ((PDL_Double *)((__privtrans->pdls[7])->data));
29655              
29656 0           {register PDL_Indx __inc_clusterids_nr = __privtrans->__inc_clusterids_nr;
29657 0           register PDL_Indx __inc_cdata_d = __privtrans->__inc_cdata_d;
29658 0           register PDL_Indx __inc_cdata_k = __privtrans->__inc_cdata_k;
29659 0           register PDL_Indx __inc_cdist_nr = __privtrans->__inc_cdist_nr;
29660 0           register PDL_Indx __inc_mask_d = __privtrans->__inc_mask_d;
29661 0           register PDL_Indx __inc_mask_n = __privtrans->__inc_mask_n;
29662 0           register PDL_Indx __inc_cmask_d = __privtrans->__inc_cmask_d;
29663 0           register PDL_Indx __inc_cmask_k = __privtrans->__inc_cmask_k;
29664 0           register PDL_Indx __inc_data_d = __privtrans->__inc_data_d;
29665 0           register PDL_Indx __inc_data_n = __privtrans->__inc_data_n;
29666 0           register PDL_Indx __inc_weight_d = __privtrans->__inc_weight_d;
29667 0           register PDL_Indx __inc_rowids_nr = __privtrans->__inc_rowids_nr;
29668              
29669              
29670 0           double **datapp = (double **)pp_alloc(__privtrans->__n_size);
29671 0           int **maskpp = (int **)pp_alloc(__privtrans->__n_size);
29672 0           double **cdatapp = (double **)pp_alloc(__privtrans->__k_size);
29673 0           int **cmaskpp = (int **)pp_alloc(__privtrans->__k_size);
29674             double *tmpdatapp[2];
29675             int *tmpmaskpp[2];
29676 0           int transpose=0;
29677            
29678             PDL_COMMENT("THREADLOOPBEGIN")
29679 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
29680 0           do { register PDL_Indx __tind1=0,__tind2=0;
29681 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
29682 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
29683 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
29684 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
29685 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
29686 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
29687 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
29688 0           register PDL_Indx __tinc0_3 = __privtrans->__pdlthread.incs[3];
29689 0           register PDL_Indx __tinc0_4 = __privtrans->__pdlthread.incs[4];
29690 0           register PDL_Indx __tinc0_5 = __privtrans->__pdlthread.incs[5];
29691 0           register PDL_Indx __tinc0_6 = __privtrans->__pdlthread.incs[6];
29692 0           register PDL_Indx __tinc0_7 = __privtrans->__pdlthread.incs[7];
29693 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
29694 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
29695 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
29696 0           register PDL_Indx __tinc1_3 = __privtrans->__pdlthread.incs[__tnpdls+3];
29697 0           register PDL_Indx __tinc1_4 = __privtrans->__pdlthread.incs[__tnpdls+4];
29698 0           register PDL_Indx __tinc1_5 = __privtrans->__pdlthread.incs[__tnpdls+5];
29699 0           register PDL_Indx __tinc1_6 = __privtrans->__pdlthread.incs[__tnpdls+6];
29700 0           register PDL_Indx __tinc1_7 = __privtrans->__pdlthread.incs[__tnpdls+7];
29701 0           data_datap += __offsp[0];
29702 0           mask_datap += __offsp[1];
29703 0           weight_datap += __offsp[2];
29704 0           rowids_datap += __offsp[3];
29705 0           cdata_datap += __offsp[4];
29706 0           cmask_datap += __offsp[5];
29707 0           clusterids_datap += __offsp[6];
29708 0           cdist_datap += __offsp[7];
29709 0 0         for( __tind2 = 0 ;
29710             __tind2 < __tdims1 ;
29711 0           __tind2++
29712 0           ,data_datap += __tinc1_0 - __tinc0_0 * __tdims0
29713 0           ,mask_datap += __tinc1_1 - __tinc0_1 * __tdims0
29714 0           ,weight_datap += __tinc1_2 - __tinc0_2 * __tdims0
29715 0           ,rowids_datap += __tinc1_3 - __tinc0_3 * __tdims0
29716 0           ,cdata_datap += __tinc1_4 - __tinc0_4 * __tdims0
29717 0           ,cmask_datap += __tinc1_5 - __tinc0_5 * __tdims0
29718 0           ,clusterids_datap += __tinc1_6 - __tinc0_6 * __tdims0
29719 0           ,cdist_datap += __tinc1_7 - __tinc0_7 * __tdims0
29720             )
29721             {
29722 0 0         for( __tind1 = 0 ;
29723             __tind1 < __tdims0 ;
29724 0           __tind1++
29725 0           ,data_datap += __tinc0_0
29726 0           ,mask_datap += __tinc0_1
29727 0           ,weight_datap += __tinc0_2
29728 0           ,rowids_datap += __tinc0_3
29729 0           ,cdata_datap += __tinc0_4
29730 0           ,cmask_datap += __tinc0_5
29731 0           ,clusterids_datap += __tinc0_6
29732 0           ,cdist_datap += __tinc0_7
29733             )
29734             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
29735 0           int tmprowid = 0;
29736 0           int tmpctrid = 1;
29737             int ni;
29738             int ki, kbest;
29739             double dist, dbest;
29740 0           p2pp_dbl(__privtrans->__n_size, __privtrans->__d_size, data_datap, datapp);
29741 0           p2pp_int(__privtrans->__n_size, __privtrans->__d_size, mask_datap, maskpp);
29742 0           p2pp_dbl(__privtrans->__k_size, __privtrans->__d_size, cdata_datap, cdatapp);
29743 0           p2pp_int(__privtrans->__k_size, __privtrans->__d_size, cmask_datap, cmaskpp);
29744             /*-- loop over all target rows --*/
29745             {PDL_COMMENT("Open nr") register PDL_Indx nr;
29746 0 0         for(nr=0; nr<(__nr_size); nr++) {
29747 0 0         ni = (rowids_datap)[0+(__inc_rowids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") ;
29748 0           tmpdatapp[tmprowid] = datapp[ni];
29749 0           tmpmaskpp[tmprowid] = maskpp[ni];
29750             /*-- initialize --*/
29751 0           tmpdatapp[tmpctrid] = cdatapp[0];
29752 0           tmpmaskpp[tmpctrid] = cmaskpp[0];
29753 0           kbest = 0;
29754 0           dbest = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29755             1, 1, &tmprowid, &tmpctrid,
29756 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29757             /*-- loop over all centroids --*/
29758 0 0         for (ki=1; ki < __privtrans->__k_size; ki++) {
29759 0           tmpdatapp[tmpctrid] = cdatapp[ki];
29760 0           tmpmaskpp[tmpctrid] = cmaskpp[ki];
29761 0           dist = clusterdistance(2, __privtrans->__d_size, tmpdatapp, tmpmaskpp, weight_datap,
29762             1, 1, &tmprowid, &tmpctrid,
29763 0           *__privtrans->distFlag, *__privtrans->methodFlag, transpose);
29764 0 0         if (dist < dbest) {
29765 0           kbest = ki;
29766 0           dbest = dist;
29767             }
29768             }
29769             /*-- save best data --*/
29770 0 0         (clusterids_datap)[0+(__inc_clusterids_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = kbest;
29771 0 0         (cdist_datap)[0+(__inc_cdist_nr*PP_INDTERM(__privtrans->__nr_size, nr))] PDL_COMMENT("ACCESS()") = dbest;
29772             }} PDL_COMMENT("Close nr")
29773            
29774             PDL_COMMENT("THREADLOOPEND")
29775             }
29776             }
29777 0           data_datap -= __tinc1_0 * __tdims1 + __offsp[0];
29778 0           mask_datap -= __tinc1_1 * __tdims1 + __offsp[1];
29779 0           weight_datap -= __tinc1_2 * __tdims1 + __offsp[2];
29780 0           rowids_datap -= __tinc1_3 * __tdims1 + __offsp[3];
29781 0           cdata_datap -= __tinc1_4 * __tdims1 + __offsp[4];
29782 0           cmask_datap -= __tinc1_5 * __tdims1 + __offsp[5];
29783 0           clusterids_datap -= __tinc1_6 * __tdims1 + __offsp[6];
29784 0           cdist_datap -= __tinc1_7 * __tdims1 + __offsp[7];
29785 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
29786             /*-- cleanup --*/
29787 0 0         if (datapp) free(datapp);
29788 0 0         if (maskpp) free(maskpp);
29789 0 0         if (cdatapp) free(cdatapp);
29790 0 0         if (cmaskpp) free(cmaskpp);
29791              
29792 0           } break;}
29793 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
29794             }
29795             }
29796             }
29797            
29798              
29799              
29800              
29801 0           void pdl_attachtonearest_free(pdl_trans *__tr ) {
29802             int __dim;
29803 0           pdl_attachtonearest_struct *__privtrans = (pdl_attachtonearest_struct *) __tr;
29804            
29805             {
29806            
29807 0           PDL_TR_CLRMAGIC(__privtrans);
29808 0           free(__privtrans->distFlag);;free(__privtrans->methodFlag);;
29809 0 0         if(__privtrans->__ddone) {
29810 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
29811             ;;;;;;;;;;;;;;;;;
29812             }
29813            
29814             }
29815 0           }
29816            
29817              
29818              
29819              
29820             static char pdl_attachtonearest_vtable_flags[] =
29821             { 0,0,0,PDL_TPDL_VAFFINE_OK,0,0,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
29822             pdl_transvtable pdl_attachtonearest_vtable = {
29823             0,0, 6, 8, pdl_attachtonearest_vtable_flags,
29824             pdl_attachtonearest_redodims, pdl_attachtonearest_readdata, NULL,
29825             pdl_attachtonearest_free,NULL,NULL,pdl_attachtonearest_copy,
29826             sizeof(pdl_attachtonearest_struct),"pdl_attachtonearest_vtable"
29827             };
29828              
29829             typedef struct pdl_checkprototypes_struct {
29830             PDL_TRANS_START(3);
29831             pdl_thread __pdlthread;PDL_Indx __inc_protos_k;PDL_Indx __inc_cprotos_k;PDL_Indx __inc_otmp_n;PDL_Indx __n_size;PDL_Indx __k_size;
29832             int nsize;
29833             char __ddone; PDL_COMMENT("Dims done")
29834             } pdl_checkprototypes_struct;
29835              
29836 0           void pdl_checkprototypes_redodims(pdl_trans *__tr ) {
29837             int __dim;
29838 0           pdl_checkprototypes_struct *__privtrans = (pdl_checkprototypes_struct *) __tr;
29839            
29840             {
29841             PDL_Indx __creating[3];
29842 0           __privtrans->__n_size = __privtrans->nsize;
29843 0           __privtrans->__k_size = -1;
29844 0           __creating[0] = 0;
29845 0 0         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
29846 0 0         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    0          
29847             {
29848             {PDL_COMMENT("Start generic loop")
29849              
29850 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
29851 0           } break; case PDL_B: {
29852 0 0         PDL_Byte * protos_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29853 0           PDL_Byte * protos_physdatap = ((PDL_Byte *)((__privtrans->pdls[0])->data));
29854              
29855 0 0         PDL_Byte * cprotos_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29856 0           PDL_Byte * cprotos_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
29857              
29858 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29859 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
29860              
29861 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
29862 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
29863 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
29864              
29865             PDL_COMMENT("none")
29866 0           } } break; case PDL_S: {
29867 0 0         PDL_Short * protos_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29868 0           PDL_Short * protos_physdatap = ((PDL_Short *)((__privtrans->pdls[0])->data));
29869              
29870 0 0         PDL_Short * cprotos_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29871 0           PDL_Short * cprotos_physdatap = ((PDL_Short *)((__privtrans->pdls[1])->data));
29872              
29873 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29874 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
29875              
29876 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
29877 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
29878 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
29879              
29880             PDL_COMMENT("none")
29881 0           } } break; case PDL_US: {
29882 0 0         PDL_Ushort * protos_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29883 0           PDL_Ushort * protos_physdatap = ((PDL_Ushort *)((__privtrans->pdls[0])->data));
29884              
29885 0 0         PDL_Ushort * cprotos_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29886 0           PDL_Ushort * cprotos_physdatap = ((PDL_Ushort *)((__privtrans->pdls[1])->data));
29887              
29888 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29889 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
29890              
29891 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
29892 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
29893 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
29894              
29895             PDL_COMMENT("none")
29896 0           } } break; case PDL_L: {
29897 0 0         PDL_Long * protos_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
29898 0           PDL_Long * protos_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
29899              
29900 0 0         PDL_Long * cprotos_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
29901 0           PDL_Long * cprotos_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
29902              
29903 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
29904 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
29905              
29906 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
29907 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
29908 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
29909              
29910             PDL_COMMENT("none")
29911 0           } break;}
29912 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
29913             }
29914             }
29915             {
29916             static char *__parnames[] = {"protos","cprotos","otmp"};
29917             static PDL_Indx __realdims[] = {1,1,1};
29918             static char __funcname[] = "PDL::Cluster::checkprototypes";
29919             static pdl_errorinfo __einfo = {
29920             __funcname, __parnames, 3
29921             };
29922            
29923 0           PDL->initthreadstruct(2,__privtrans->pdls,
29924             __realdims,__creating,3,
29925             &__einfo,&(__privtrans->__pdlthread),
29926 0           __privtrans->vtable->per_pdl_flags,
29927             0 );
29928             }
29929 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
29930 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
29931             }
29932 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
29933 0           __privtrans->__k_size = ((__privtrans->pdls[0]))->dims[0];
29934 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
29935 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
29936 0           PDL->pdl_barf("Error in checkprototypes:" "Wrong dims\n");
29937             }
29938             }
29939 0 0         if(!__creating[1]) {
29940 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
29941 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
29942             }
29943 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
29944 0           __privtrans->__k_size = ((__privtrans->pdls[1]))->dims[0];
29945 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
29946 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
29947 0           PDL->pdl_barf("Error in checkprototypes:" "Wrong dims\n");
29948             }
29949             }
29950             } else {
29951 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
29952 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
29953 0 0         }if(!__creating[2]) {
29954 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
29955 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
29956             }
29957 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
29958 0           __privtrans->__n_size = ((__privtrans->pdls[2]))->dims[0];
29959 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
29960 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
29961 0           PDL->pdl_barf("Error in checkprototypes:" "Wrong dims\n");
29962             }
29963             }
29964             } else {
29965 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
29966 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,1);
29967             }
29968             { PDL_COMMENT("convenience block")
29969 0           void *hdrp = NULL;
29970 0           char propagate_hdrcpy = 0;
29971 0           SV *hdr_copy = NULL;
29972 0 0         if(!hdrp &&
    0          
29973 0 0         __privtrans->pdls[0]->hdrsv &&
29974 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
29975             ) {
29976 0           hdrp = __privtrans->pdls[0]->hdrsv;
29977 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
29978             }
29979 0 0         if(!hdrp &&
    0          
29980 0 0         !__creating[1] &&
29981 0 0         __privtrans->pdls[1]->hdrsv &&
29982 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
29983             ) {
29984 0           hdrp = __privtrans->pdls[1]->hdrsv;
29985 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
29986             }
29987 0 0         if(!hdrp &&
    0          
29988 0 0         !__creating[2] &&
29989 0 0         __privtrans->pdls[2]->hdrsv &&
29990 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
29991             ) {
29992 0           hdrp = __privtrans->pdls[2]->hdrsv;
29993 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
29994             }
29995 0 0         if (hdrp) {
29996 0 0         if(hdrp == &PL_sv_undef)
29997 0           hdr_copy = &PL_sv_undef;
29998             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
29999             int count;
30000             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
30001 0           dSP;
30002 0           ENTER ;
30003 0           SAVETMPS ;
30004 0 0         PUSHMARK(SP) ;
30005 0 0         XPUSHs( hdrp );
30006 0           PUTBACK ;
30007 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
30008 0           SPAGAIN ;
30009 0 0         if(count != 1)
30010 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
30011              
30012 0           hdr_copy = (SV *)POPs;
30013              
30014 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
30015 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
30016             }
30017              
30018 0 0         FREETMPS ;
30019 0           LEAVE ;
30020              
30021              
30022             } PDL_COMMENT("end of callback block")
30023              
30024 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
30025 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
30026 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
30027 0 0         if( hdr_copy != &PL_sv_undef )
30028 0           (void)SvREFCNT_inc(hdr_copy);
30029 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
30030             }
30031 0 0         if(propagate_hdrcpy)
30032 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
30033 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
30034 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
30035 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
30036 0 0         if( hdr_copy != &PL_sv_undef )
30037 0           (void)SvREFCNT_inc(hdr_copy);
30038 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
30039             }
30040 0 0         if(propagate_hdrcpy)
30041 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
30042              
30043 0 0         if(hdr_copy != &PL_sv_undef)
30044 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
30045             } PDL_COMMENT("end of if(hdrp) block")
30046             } PDL_COMMENT("end of conv. block")
30047 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
30048 0           __privtrans->__inc_protos_k = 0; else
30049 0 0         __privtrans->__inc_protos_k = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
30050 0           __privtrans->__inc_cprotos_k = 0; else
30051 0 0         __privtrans->__inc_cprotos_k = PDL_REPRINC(__privtrans->pdls[1],0);if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
    0          
30052 0           __privtrans->__inc_otmp_n = 0; else
30053 0 0         __privtrans->__inc_otmp_n = PDL_REPRINC(__privtrans->pdls[2],0); __privtrans->__ddone = 1;
30054             }
30055 0           }
30056            
30057              
30058 0           pdl_trans * pdl_checkprototypes_copy(pdl_trans *__tr ) {
30059             int __dim;
30060 0           pdl_checkprototypes_struct *__privtrans = (pdl_checkprototypes_struct *) __tr;
30061            
30062             {
30063 0           pdl_checkprototypes_struct *__copy = malloc(sizeof(pdl_checkprototypes_struct));
30064 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
30065 0           __copy->has_badvalue = __privtrans->has_badvalue;
30066 0           __copy->badvalue = __privtrans->badvalue;
30067 0           __copy->flags = __privtrans->flags;
30068 0           __copy->vtable = __privtrans->vtable;
30069 0           __copy->__datatype = __privtrans->__datatype;
30070 0           __copy->freeproc = NULL;
30071 0           __copy->__ddone = __privtrans->__ddone;
30072             {int i;
30073 0 0         for(i=0; i<__copy->vtable->npdls; i++)
30074 0           __copy->pdls[i] = __privtrans->pdls[i];
30075             }
30076 0           (__copy->nsize) = (__privtrans->nsize);;
30077 0 0         if(__copy->__ddone) {
30078 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_protos_k=__copy->__inc_protos_k;__privtrans->__inc_cprotos_k=__copy->__inc_cprotos_k;__privtrans->__inc_otmp_n=__copy->__inc_otmp_n;__copy->__n_size=__privtrans->__n_size;__copy->__k_size=__privtrans->__k_size;
30079             }
30080 0           return (pdl_trans*)__copy;
30081             }
30082             }
30083            
30084              
30085 0           void pdl_checkprototypes_readdata(pdl_trans *__tr ) {
30086             int __dim;
30087 0           pdl_checkprototypes_struct *__privtrans = (pdl_checkprototypes_struct *) __tr;
30088            
30089             {
30090 0           {register PDL_Indx __k_size = __privtrans->__k_size;
30091 0           register PDL_Indx __n_size = __privtrans->__n_size;
30092             PDL_COMMENT("Start generic loop")
30093              
30094 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
30095 0           } break; case PDL_B: {
30096 0 0         PDL_Byte * protos_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30097 0           PDL_Byte * protos_physdatap = ((PDL_Byte *)((__privtrans->pdls[0])->data));
30098              
30099 0 0         PDL_Byte * cprotos_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30100 0           PDL_Byte * cprotos_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
30101              
30102 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30103 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30104              
30105 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
30106 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
30107 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
30108              
30109              
30110             /*-- sanity check --*/
30111 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30112 0           barf("checkprototypes(): number of prototypes \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30113             __privtrans->__k_size, __privtrans->__n_size);
30114             }
30115            
30116             PDL_COMMENT("THREADLOOPBEGIN")
30117 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30118 0           do { register PDL_Indx __tind1=0,__tind2=0;
30119 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30120 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30121 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30122 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30123 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30124 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30125 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30126 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30127 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30128 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30129 0           protos_datap += __offsp[0];
30130 0           cprotos_datap += __offsp[1];
30131 0           otmp_datap += __offsp[2];
30132 0 0         for( __tind2 = 0 ;
30133             __tind2 < __tdims1 ;
30134 0           __tind2++
30135 0           ,protos_datap += __tinc1_0 - __tinc0_0 * __tdims0
30136 0           ,cprotos_datap += __tinc1_1 - __tinc0_1 * __tdims0
30137 0           ,otmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30138             )
30139             {
30140 0 0         for( __tind1 = 0 ;
30141             __tind1 < __tdims0 ;
30142 0           __tind1++
30143 0           ,protos_datap += __tinc0_0
30144 0           ,cprotos_datap += __tinc0_1
30145 0           ,otmp_datap += __tinc0_2
30146             )
30147             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30148             {PDL_COMMENT("Open n") register PDL_Indx n;
30149 0 0         for(n=0; n<(__n_size); n++) { (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close n")
    0          
30150             {PDL_COMMENT("Open k") register PDL_Indx k;
30151 0 0         for(k=0; k<(__k_size); k++) {
30152 0 0         int protoi = (protos_datap)[0+(__inc_protos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ;
30153 0 0         for (; (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") ; protoi = (protoi+1)%__privtrans->__n_size) { ; }
    0          
30154 0 0         (cprotos_datap)[0+(__inc_cprotos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = protoi;
30155 0 0         (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") = 1;
30156             }} PDL_COMMENT("Close k")
30157            
30158             PDL_COMMENT("THREADLOOPEND")
30159             }
30160             }
30161 0           protos_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30162 0           cprotos_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30163 0           otmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30164 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30165              
30166 0           } } break; case PDL_S: {
30167 0 0         PDL_Short * protos_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30168 0           PDL_Short * protos_physdatap = ((PDL_Short *)((__privtrans->pdls[0])->data));
30169              
30170 0 0         PDL_Short * cprotos_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30171 0           PDL_Short * cprotos_physdatap = ((PDL_Short *)((__privtrans->pdls[1])->data));
30172              
30173 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30174 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30175              
30176 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
30177 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
30178 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
30179              
30180              
30181             /*-- sanity check --*/
30182 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30183 0           barf("checkprototypes(): number of prototypes \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30184             __privtrans->__k_size, __privtrans->__n_size);
30185             }
30186            
30187             PDL_COMMENT("THREADLOOPBEGIN")
30188 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30189 0           do { register PDL_Indx __tind1=0,__tind2=0;
30190 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30191 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30192 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30193 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30194 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30195 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30196 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30197 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30198 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30199 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30200 0           protos_datap += __offsp[0];
30201 0           cprotos_datap += __offsp[1];
30202 0           otmp_datap += __offsp[2];
30203 0 0         for( __tind2 = 0 ;
30204             __tind2 < __tdims1 ;
30205 0           __tind2++
30206 0           ,protos_datap += __tinc1_0 - __tinc0_0 * __tdims0
30207 0           ,cprotos_datap += __tinc1_1 - __tinc0_1 * __tdims0
30208 0           ,otmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30209             )
30210             {
30211 0 0         for( __tind1 = 0 ;
30212             __tind1 < __tdims0 ;
30213 0           __tind1++
30214 0           ,protos_datap += __tinc0_0
30215 0           ,cprotos_datap += __tinc0_1
30216 0           ,otmp_datap += __tinc0_2
30217             )
30218             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30219             {PDL_COMMENT("Open n") register PDL_Indx n;
30220 0 0         for(n=0; n<(__n_size); n++) { (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close n")
    0          
30221             {PDL_COMMENT("Open k") register PDL_Indx k;
30222 0 0         for(k=0; k<(__k_size); k++) {
30223 0 0         int protoi = (protos_datap)[0+(__inc_protos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ;
30224 0 0         for (; (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") ; protoi = (protoi+1)%__privtrans->__n_size) { ; }
    0          
30225 0 0         (cprotos_datap)[0+(__inc_cprotos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = protoi;
30226 0 0         (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") = 1;
30227             }} PDL_COMMENT("Close k")
30228            
30229             PDL_COMMENT("THREADLOOPEND")
30230             }
30231             }
30232 0           protos_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30233 0           cprotos_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30234 0           otmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30235 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30236              
30237 0           } } break; case PDL_US: {
30238 0 0         PDL_Ushort * protos_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30239 0           PDL_Ushort * protos_physdatap = ((PDL_Ushort *)((__privtrans->pdls[0])->data));
30240              
30241 0 0         PDL_Ushort * cprotos_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30242 0           PDL_Ushort * cprotos_physdatap = ((PDL_Ushort *)((__privtrans->pdls[1])->data));
30243              
30244 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30245 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30246              
30247 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
30248 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
30249 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
30250              
30251              
30252             /*-- sanity check --*/
30253 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30254 0           barf("checkprototypes(): number of prototypes \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30255             __privtrans->__k_size, __privtrans->__n_size);
30256             }
30257            
30258             PDL_COMMENT("THREADLOOPBEGIN")
30259 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30260 0           do { register PDL_Indx __tind1=0,__tind2=0;
30261 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30262 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30263 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30264 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30265 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30266 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30267 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30268 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30269 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30270 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30271 0           protos_datap += __offsp[0];
30272 0           cprotos_datap += __offsp[1];
30273 0           otmp_datap += __offsp[2];
30274 0 0         for( __tind2 = 0 ;
30275             __tind2 < __tdims1 ;
30276 0           __tind2++
30277 0           ,protos_datap += __tinc1_0 - __tinc0_0 * __tdims0
30278 0           ,cprotos_datap += __tinc1_1 - __tinc0_1 * __tdims0
30279 0           ,otmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30280             )
30281             {
30282 0 0         for( __tind1 = 0 ;
30283             __tind1 < __tdims0 ;
30284 0           __tind1++
30285 0           ,protos_datap += __tinc0_0
30286 0           ,cprotos_datap += __tinc0_1
30287 0           ,otmp_datap += __tinc0_2
30288             )
30289             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30290             {PDL_COMMENT("Open n") register PDL_Indx n;
30291 0 0         for(n=0; n<(__n_size); n++) { (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close n")
    0          
30292             {PDL_COMMENT("Open k") register PDL_Indx k;
30293 0 0         for(k=0; k<(__k_size); k++) {
30294 0 0         int protoi = (protos_datap)[0+(__inc_protos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ;
30295 0 0         for (; (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") ; protoi = (protoi+1)%__privtrans->__n_size) { ; }
    0          
30296 0 0         (cprotos_datap)[0+(__inc_cprotos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = protoi;
30297 0 0         (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") = 1;
30298             }} PDL_COMMENT("Close k")
30299            
30300             PDL_COMMENT("THREADLOOPEND")
30301             }
30302             }
30303 0           protos_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30304 0           cprotos_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30305 0           otmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30306 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30307              
30308 0           } } break; case PDL_L: {
30309 0 0         PDL_Long * protos_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30310 0           PDL_Long * protos_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
30311              
30312 0 0         PDL_Long * cprotos_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30313 0           PDL_Long * cprotos_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
30314              
30315 0 0         PDL_Byte * otmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30316 0           PDL_Byte * otmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30317              
30318 0           {register PDL_Indx __inc_protos_k = __privtrans->__inc_protos_k;
30319 0           register PDL_Indx __inc_cprotos_k = __privtrans->__inc_cprotos_k;
30320 0           register PDL_Indx __inc_otmp_n = __privtrans->__inc_otmp_n;
30321              
30322              
30323             /*-- sanity check --*/
30324 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30325 0           barf("checkprototypes(): number of prototypes \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30326             __privtrans->__k_size, __privtrans->__n_size);
30327             }
30328            
30329             PDL_COMMENT("THREADLOOPBEGIN")
30330 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30331 0           do { register PDL_Indx __tind1=0,__tind2=0;
30332 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30333 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30334 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30335 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30336 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30337 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30338 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30339 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30340 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30341 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30342 0           protos_datap += __offsp[0];
30343 0           cprotos_datap += __offsp[1];
30344 0           otmp_datap += __offsp[2];
30345 0 0         for( __tind2 = 0 ;
30346             __tind2 < __tdims1 ;
30347 0           __tind2++
30348 0           ,protos_datap += __tinc1_0 - __tinc0_0 * __tdims0
30349 0           ,cprotos_datap += __tinc1_1 - __tinc0_1 * __tdims0
30350 0           ,otmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30351             )
30352             {
30353 0 0         for( __tind1 = 0 ;
30354             __tind1 < __tdims0 ;
30355 0           __tind1++
30356 0           ,protos_datap += __tinc0_0
30357 0           ,cprotos_datap += __tinc0_1
30358 0           ,otmp_datap += __tinc0_2
30359             )
30360             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30361             {PDL_COMMENT("Open n") register PDL_Indx n;
30362 0 0         for(n=0; n<(__n_size); n++) { (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close n")
    0          
30363             {PDL_COMMENT("Open k") register PDL_Indx k;
30364 0 0         for(k=0; k<(__k_size); k++) {
30365 0 0         int protoi = (protos_datap)[0+(__inc_protos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") ;
30366 0 0         for (; (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") ; protoi = (protoi+1)%__privtrans->__n_size) { ; }
    0          
30367 0 0         (cprotos_datap)[0+(__inc_cprotos_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = protoi;
30368 0 0         (otmp_datap)[0+(__inc_otmp_n*PP_INDTERM(__privtrans->__n_size, protoi))] PDL_COMMENT("ACCESS()") = 1;
30369             }} PDL_COMMENT("Close k")
30370            
30371             PDL_COMMENT("THREADLOOPEND")
30372             }
30373             }
30374 0           protos_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30375 0           cprotos_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30376 0           otmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30377 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30378              
30379 0           } break;}
30380 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
30381             }
30382             }
30383             }
30384            
30385              
30386              
30387              
30388 0           void pdl_checkprototypes_free(pdl_trans *__tr ) {
30389             int __dim;
30390 0           pdl_checkprototypes_struct *__privtrans = (pdl_checkprototypes_struct *) __tr;
30391            
30392             {
30393            
30394 0           PDL_TR_CLRMAGIC(__privtrans);
30395             ;
30396 0 0         if(__privtrans->__ddone) {
30397 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
30398             ;;;;;;
30399             }
30400            
30401             }
30402 0           }
30403            
30404              
30405              
30406              
30407             static char pdl_checkprototypes_vtable_flags[] =
30408             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
30409             pdl_transvtable pdl_checkprototypes_vtable = {
30410             0,0, 1, 3, pdl_checkprototypes_vtable_flags,
30411             pdl_checkprototypes_redodims, pdl_checkprototypes_readdata, NULL,
30412             pdl_checkprototypes_free,NULL,NULL,pdl_checkprototypes_copy,
30413             sizeof(pdl_checkprototypes_struct),"pdl_checkprototypes_vtable"
30414             };
30415              
30416             typedef struct pdl_checkpartitions_struct {
30417             PDL_TRANS_START(3);
30418             pdl_thread __pdlthread;PDL_Indx __inc_part_n;PDL_Indx __inc_cpart_n;PDL_Indx __inc_ptmp_k;PDL_Indx __k_size;PDL_Indx __n_size;
30419             int ksize;
30420             char __ddone; PDL_COMMENT("Dims done")
30421             } pdl_checkpartitions_struct;
30422              
30423 0           void pdl_checkpartitions_redodims(pdl_trans *__tr ) {
30424             int __dim;
30425 0           pdl_checkpartitions_struct *__privtrans = (pdl_checkpartitions_struct *) __tr;
30426            
30427             {
30428             PDL_Indx __creating[3];
30429 0           __privtrans->__k_size = __privtrans->ksize;
30430 0           __privtrans->__n_size = -1;
30431 0           __creating[0] = 0;
30432 0 0         __creating[1] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[1]);
    0          
30433 0 0         __creating[2] = PDL_CR_SETDIMSCOND(__privtrans,__privtrans->pdls[2]);
    0          
30434             {
30435             {PDL_COMMENT("Start generic loop")
30436              
30437 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
30438 0           } break; case PDL_B: {
30439 0 0         PDL_Byte * part_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30440 0           PDL_Byte * part_physdatap = ((PDL_Byte *)((__privtrans->pdls[0])->data));
30441              
30442 0 0         PDL_Byte * cpart_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30443 0           PDL_Byte * cpart_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
30444              
30445 0 0         PDL_Byte * ptmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30446 0           PDL_Byte * ptmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30447              
30448 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30449 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30450 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30451              
30452             PDL_COMMENT("none")
30453 0           } } break; case PDL_S: {
30454 0 0         PDL_Short * part_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30455 0           PDL_Short * part_physdatap = ((PDL_Short *)((__privtrans->pdls[0])->data));
30456              
30457 0 0         PDL_Short * cpart_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30458 0           PDL_Short * cpart_physdatap = ((PDL_Short *)((__privtrans->pdls[1])->data));
30459              
30460 0 0         PDL_Short * ptmp_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30461 0           PDL_Short * ptmp_physdatap = ((PDL_Short *)((__privtrans->pdls[2])->data));
30462              
30463 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30464 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30465 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30466              
30467             PDL_COMMENT("none")
30468 0           } } break; case PDL_US: {
30469 0 0         PDL_Ushort * part_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30470 0           PDL_Ushort * part_physdatap = ((PDL_Ushort *)((__privtrans->pdls[0])->data));
30471              
30472 0 0         PDL_Ushort * cpart_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30473 0           PDL_Ushort * cpart_physdatap = ((PDL_Ushort *)((__privtrans->pdls[1])->data));
30474              
30475 0 0         PDL_Ushort * ptmp_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30476 0           PDL_Ushort * ptmp_physdatap = ((PDL_Ushort *)((__privtrans->pdls[2])->data));
30477              
30478 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30479 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30480 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30481              
30482             PDL_COMMENT("none")
30483 0           } } break; case PDL_L: {
30484 0 0         PDL_Long * part_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30485 0           PDL_Long * part_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
30486              
30487 0 0         PDL_Long * cpart_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30488 0           PDL_Long * cpart_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
30489              
30490 0 0         PDL_Long * ptmp_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30491 0           PDL_Long * ptmp_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
30492              
30493 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30494 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30495 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30496              
30497             PDL_COMMENT("none")
30498 0           } break;}
30499 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
30500             }
30501             }
30502             {
30503             static char *__parnames[] = {"part","cpart","ptmp"};
30504             static PDL_Indx __realdims[] = {1,1,1};
30505             static char __funcname[] = "PDL::Cluster::checkpartitions";
30506             static pdl_errorinfo __einfo = {
30507             __funcname, __parnames, 3
30508             };
30509            
30510 0           PDL->initthreadstruct(2,__privtrans->pdls,
30511             __realdims,__creating,3,
30512             &__einfo,&(__privtrans->__pdlthread),
30513 0           __privtrans->vtable->per_pdl_flags,
30514             0 );
30515             }
30516 0 0         if(((__privtrans->pdls[0]))->ndims < 1) {
30517 0 0         if (((__privtrans->pdls[0]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
30518             }
30519 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
30520 0           __privtrans->__n_size = ((__privtrans->pdls[0]))->dims[0];
30521 0 0         } else if(((__privtrans->pdls[0]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[0]))->dims[0]) {
    0          
30522 0 0         if(((__privtrans->pdls[0]))->dims[0] != 1) {
30523 0           PDL->pdl_barf("Error in checkpartitions:" "Wrong dims\n");
30524             }
30525             }
30526 0 0         if(!__creating[1]) {
30527 0 0         if(((__privtrans->pdls[1]))->ndims < 1) {
30528 0 0         if (((__privtrans->pdls[1]))->ndims < 1 && __privtrans->__n_size <= 1) __privtrans->__n_size = 1;
    0          
30529             }
30530 0 0         if(__privtrans->__n_size == -1 || (((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size == 1)) {
    0          
    0          
30531 0           __privtrans->__n_size = ((__privtrans->pdls[1]))->dims[0];
30532 0 0         } else if(((__privtrans->pdls[1]))->ndims > 0 && __privtrans->__n_size != ((__privtrans->pdls[1]))->dims[0]) {
    0          
30533 0 0         if(((__privtrans->pdls[1]))->dims[0] != 1) {
30534 0           PDL->pdl_barf("Error in checkpartitions:" "Wrong dims\n");
30535             }
30536             }
30537             } else {
30538 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__n_size;
30539 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,1,dims,0);
30540 0 0         }if(!__creating[2]) {
30541 0 0         if(((__privtrans->pdls[2]))->ndims < 1) {
30542 0 0         if (((__privtrans->pdls[2]))->ndims < 1 && __privtrans->__k_size <= 1) __privtrans->__k_size = 1;
    0          
30543             }
30544 0 0         if(__privtrans->__k_size == -1 || (((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size == 1)) {
    0          
    0          
30545 0           __privtrans->__k_size = ((__privtrans->pdls[2]))->dims[0];
30546 0 0         } else if(((__privtrans->pdls[2]))->ndims > 0 && __privtrans->__k_size != ((__privtrans->pdls[2]))->dims[0]) {
    0          
30547 0 0         if(((__privtrans->pdls[2]))->dims[0] != 1) {
30548 0           PDL->pdl_barf("Error in checkpartitions:" "Wrong dims\n");
30549             }
30550             }
30551             } else {
30552 0           PDL_Indx dims[2]; PDL_COMMENT("Use ninds+1 to avoid smart (stupid) compilers")dims[0] = __privtrans->__k_size;
30553 0           PDL->thread_create_parameter(&__privtrans->__pdlthread,2,dims,1);
30554             }
30555             { PDL_COMMENT("convenience block")
30556 0           void *hdrp = NULL;
30557 0           char propagate_hdrcpy = 0;
30558 0           SV *hdr_copy = NULL;
30559 0 0         if(!hdrp &&
    0          
30560 0 0         __privtrans->pdls[0]->hdrsv &&
30561 0           (__privtrans->pdls[0]->state & PDL_HDRCPY)
30562             ) {
30563 0           hdrp = __privtrans->pdls[0]->hdrsv;
30564 0           propagate_hdrcpy = ((__privtrans->pdls[0]->state & PDL_HDRCPY) != 0);
30565             }
30566 0 0         if(!hdrp &&
    0          
30567 0 0         !__creating[1] &&
30568 0 0         __privtrans->pdls[1]->hdrsv &&
30569 0           (__privtrans->pdls[1]->state & PDL_HDRCPY)
30570             ) {
30571 0           hdrp = __privtrans->pdls[1]->hdrsv;
30572 0           propagate_hdrcpy = ((__privtrans->pdls[1]->state & PDL_HDRCPY) != 0);
30573             }
30574 0 0         if(!hdrp &&
    0          
30575 0 0         !__creating[2] &&
30576 0 0         __privtrans->pdls[2]->hdrsv &&
30577 0           (__privtrans->pdls[2]->state & PDL_HDRCPY)
30578             ) {
30579 0           hdrp = __privtrans->pdls[2]->hdrsv;
30580 0           propagate_hdrcpy = ((__privtrans->pdls[2]->state & PDL_HDRCPY) != 0);
30581             }
30582 0 0         if (hdrp) {
30583 0 0         if(hdrp == &PL_sv_undef)
30584 0           hdr_copy = &PL_sv_undef;
30585             else { PDL_COMMENT("Call the perl routine _hdr_copy...")
30586             int count;
30587             PDL_COMMENT("Call the perl routine PDL::_hdr_copy(hdrp)")
30588 0           dSP;
30589 0           ENTER ;
30590 0           SAVETMPS ;
30591 0 0         PUSHMARK(SP) ;
30592 0 0         XPUSHs( hdrp );
30593 0           PUTBACK ;
30594 0           count = call_pv("PDL::_hdr_copy",G_SCALAR);
30595 0           SPAGAIN ;
30596 0 0         if(count != 1)
30597 0           croak("PDL::_hdr_copy didn't return a single value - please report this bug (A).");
30598              
30599 0           hdr_copy = (SV *)POPs;
30600              
30601 0 0         if(hdr_copy && hdr_copy != &PL_sv_undef) {
    0          
30602 0           (void)SvREFCNT_inc(hdr_copy); PDL_COMMENT("Keep hdr_copy from vanishing during FREETMPS")
30603             }
30604              
30605 0 0         FREETMPS ;
30606 0           LEAVE ;
30607              
30608              
30609             } PDL_COMMENT("end of callback block")
30610              
30611 0 0         if ( __privtrans->pdls[1]->hdrsv != hdrp ){
30612 0 0         if( __privtrans->pdls[1]->hdrsv && __privtrans->pdls[1]->hdrsv != &PL_sv_undef)
    0          
30613 0           (void)SvREFCNT_dec( __privtrans->pdls[1]->hdrsv );
30614 0 0         if( hdr_copy != &PL_sv_undef )
30615 0           (void)SvREFCNT_inc(hdr_copy);
30616 0           __privtrans->pdls[1]->hdrsv = hdr_copy;
30617             }
30618 0 0         if(propagate_hdrcpy)
30619 0           __privtrans->pdls[1]->state |= PDL_HDRCPY;
30620 0 0         if ( __privtrans->pdls[2]->hdrsv != hdrp ){
30621 0 0         if( __privtrans->pdls[2]->hdrsv && __privtrans->pdls[2]->hdrsv != &PL_sv_undef)
    0          
30622 0           (void)SvREFCNT_dec( __privtrans->pdls[2]->hdrsv );
30623 0 0         if( hdr_copy != &PL_sv_undef )
30624 0           (void)SvREFCNT_inc(hdr_copy);
30625 0           __privtrans->pdls[2]->hdrsv = hdr_copy;
30626             }
30627 0 0         if(propagate_hdrcpy)
30628 0           __privtrans->pdls[2]->state |= PDL_HDRCPY;
30629              
30630 0 0         if(hdr_copy != &PL_sv_undef)
30631 0           SvREFCNT_dec(hdr_copy); PDL_COMMENT("make hdr_copy mortal again")
30632             } PDL_COMMENT("end of if(hdrp) block")
30633             } PDL_COMMENT("end of conv. block")
30634 0 0         if(__privtrans->pdls[0]->ndims <= 0 || __privtrans->pdls[0]->dims[0] <= 1)
    0          
30635 0           __privtrans->__inc_part_n = 0; else
30636 0 0         __privtrans->__inc_part_n = PDL_REPRINC(__privtrans->pdls[0],0);if(__privtrans->pdls[1]->ndims <= 0 || __privtrans->pdls[1]->dims[0] <= 1)
    0          
    0          
30637 0           __privtrans->__inc_cpart_n = 0; else
30638 0 0         __privtrans->__inc_cpart_n = PDL_REPRINC(__privtrans->pdls[1],0);if(__privtrans->pdls[2]->ndims <= 0 || __privtrans->pdls[2]->dims[0] <= 1)
    0          
    0          
30639 0           __privtrans->__inc_ptmp_k = 0; else
30640 0 0         __privtrans->__inc_ptmp_k = PDL_REPRINC(__privtrans->pdls[2],0); __privtrans->__ddone = 1;
30641             }
30642 0           }
30643            
30644              
30645 0           pdl_trans * pdl_checkpartitions_copy(pdl_trans *__tr ) {
30646             int __dim;
30647 0           pdl_checkpartitions_struct *__privtrans = (pdl_checkpartitions_struct *) __tr;
30648            
30649             {
30650 0           pdl_checkpartitions_struct *__copy = malloc(sizeof(pdl_checkpartitions_struct));
30651 0           PDL_THR_CLRMAGIC(&__copy->__pdlthread); PDL_TR_CLRMAGIC(__copy);
30652 0           __copy->has_badvalue = __privtrans->has_badvalue;
30653 0           __copy->badvalue = __privtrans->badvalue;
30654 0           __copy->flags = __privtrans->flags;
30655 0           __copy->vtable = __privtrans->vtable;
30656 0           __copy->__datatype = __privtrans->__datatype;
30657 0           __copy->freeproc = NULL;
30658 0           __copy->__ddone = __privtrans->__ddone;
30659             {int i;
30660 0 0         for(i=0; i<__copy->vtable->npdls; i++)
30661 0           __copy->pdls[i] = __privtrans->pdls[i];
30662             }
30663 0           (__copy->ksize) = (__privtrans->ksize);;
30664 0 0         if(__copy->__ddone) {
30665 0           PDL->thread_copy(&(__privtrans->__pdlthread),&(__copy->__pdlthread));__privtrans->__inc_part_n=__copy->__inc_part_n;__privtrans->__inc_cpart_n=__copy->__inc_cpart_n;__privtrans->__inc_ptmp_k=__copy->__inc_ptmp_k;__copy->__k_size=__privtrans->__k_size;__copy->__n_size=__privtrans->__n_size;
30666             }
30667 0           return (pdl_trans*)__copy;
30668             }
30669             }
30670            
30671              
30672 0           void pdl_checkpartitions_readdata(pdl_trans *__tr ) {
30673             int __dim;
30674 0           pdl_checkpartitions_struct *__privtrans = (pdl_checkpartitions_struct *) __tr;
30675            
30676             {
30677 0           {register PDL_Indx __k_size = __privtrans->__k_size;
30678 0           register PDL_Indx __n_size = __privtrans->__n_size;
30679             PDL_COMMENT("Start generic loop")
30680              
30681 0           switch(__privtrans->__datatype) { case -42: PDL_COMMENT("Warning eater") {(void)1;
30682 0           } break; case PDL_B: {
30683 0 0         PDL_Byte * part_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30684 0           PDL_Byte * part_physdatap = ((PDL_Byte *)((__privtrans->pdls[0])->data));
30685              
30686 0 0         PDL_Byte * cpart_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30687 0           PDL_Byte * cpart_physdatap = ((PDL_Byte *)((__privtrans->pdls[1])->data));
30688              
30689 0 0         PDL_Byte * ptmp_datap = ((PDL_Byte *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30690 0           PDL_Byte * ptmp_physdatap = ((PDL_Byte *)((__privtrans->pdls[2])->data));
30691              
30692 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30693 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30694 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30695              
30696              
30697             /*-- sanity check --*/
30698 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30699 0           barf("checkpartitions(): number of partitions \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30700             __privtrans->__k_size, __privtrans->__n_size);
30701             }
30702            
30703             PDL_COMMENT("THREADLOOPBEGIN")
30704 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30705 0           do { register PDL_Indx __tind1=0,__tind2=0;
30706 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30707 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30708 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30709 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30710 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30711 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30712 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30713 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30714 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30715 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30716 0           part_datap += __offsp[0];
30717 0           cpart_datap += __offsp[1];
30718 0           ptmp_datap += __offsp[2];
30719 0 0         for( __tind2 = 0 ;
30720             __tind2 < __tdims1 ;
30721 0           __tind2++
30722 0           ,part_datap += __tinc1_0 - __tinc0_0 * __tdims0
30723 0           ,cpart_datap += __tinc1_1 - __tinc0_1 * __tdims0
30724 0           ,ptmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30725             )
30726             {
30727 0 0         for( __tind1 = 0 ;
30728             __tind1 < __tdims0 ;
30729 0           __tind1++
30730 0           ,part_datap += __tinc0_0
30731 0           ,cpart_datap += __tinc0_1
30732 0           ,ptmp_datap += __tinc0_2
30733             )
30734             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30735             int ni, ki, kj;
30736             {PDL_COMMENT("Open k") register PDL_Indx k;
30737 0 0         for(k=0; k<(__k_size); k++) { (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
30738             {PDL_COMMENT("Open n") register PDL_Indx n;
30739 0 0         for(n=0; n<(__n_size); n++) {
30740 0 0         ki = (part_datap)[0+(__inc_part_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
30741 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = ki;
30742 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30743             }} PDL_COMMENT("Close n")
30744 0           ni = 0;
30745 0 0         for (ki=0; ki < __privtrans->__k_size; ki++) {
30746 0 0         if (!(ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") ) {
    0          
30747 0           for (; 1; ni = (ni+1)%__privtrans->__n_size) {
30748 0 0         kj = (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") ;
30749 0 0         if ((ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") > 1) break;
    0          
30750 0           }
30751 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") = ki;
30752 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30753 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") -= 1;
30754             }
30755             }
30756            
30757             PDL_COMMENT("THREADLOOPEND")
30758             }
30759             }
30760 0           part_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30761 0           cpart_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30762 0           ptmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30763 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30764              
30765 0           } } break; case PDL_S: {
30766 0 0         PDL_Short * part_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30767 0           PDL_Short * part_physdatap = ((PDL_Short *)((__privtrans->pdls[0])->data));
30768              
30769 0 0         PDL_Short * cpart_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30770 0           PDL_Short * cpart_physdatap = ((PDL_Short *)((__privtrans->pdls[1])->data));
30771              
30772 0 0         PDL_Short * ptmp_datap = ((PDL_Short *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30773 0           PDL_Short * ptmp_physdatap = ((PDL_Short *)((__privtrans->pdls[2])->data));
30774              
30775 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30776 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30777 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30778              
30779              
30780             /*-- sanity check --*/
30781 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30782 0           barf("checkpartitions(): number of partitions \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30783             __privtrans->__k_size, __privtrans->__n_size);
30784             }
30785            
30786             PDL_COMMENT("THREADLOOPBEGIN")
30787 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30788 0           do { register PDL_Indx __tind1=0,__tind2=0;
30789 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30790 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30791 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30792 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30793 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30794 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30795 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30796 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30797 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30798 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30799 0           part_datap += __offsp[0];
30800 0           cpart_datap += __offsp[1];
30801 0           ptmp_datap += __offsp[2];
30802 0 0         for( __tind2 = 0 ;
30803             __tind2 < __tdims1 ;
30804 0           __tind2++
30805 0           ,part_datap += __tinc1_0 - __tinc0_0 * __tdims0
30806 0           ,cpart_datap += __tinc1_1 - __tinc0_1 * __tdims0
30807 0           ,ptmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30808             )
30809             {
30810 0 0         for( __tind1 = 0 ;
30811             __tind1 < __tdims0 ;
30812 0           __tind1++
30813 0           ,part_datap += __tinc0_0
30814 0           ,cpart_datap += __tinc0_1
30815 0           ,ptmp_datap += __tinc0_2
30816             )
30817             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30818             int ni, ki, kj;
30819             {PDL_COMMENT("Open k") register PDL_Indx k;
30820 0 0         for(k=0; k<(__k_size); k++) { (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
30821             {PDL_COMMENT("Open n") register PDL_Indx n;
30822 0 0         for(n=0; n<(__n_size); n++) {
30823 0 0         ki = (part_datap)[0+(__inc_part_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
30824 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = ki;
30825 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30826             }} PDL_COMMENT("Close n")
30827 0           ni = 0;
30828 0 0         for (ki=0; ki < __privtrans->__k_size; ki++) {
30829 0 0         if (!(ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") ) {
    0          
30830 0           for (; 1; ni = (ni+1)%__privtrans->__n_size) {
30831 0 0         kj = (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") ;
30832 0 0         if ((ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") > 1) break;
    0          
30833 0           }
30834 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") = ki;
30835 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30836 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") -= 1;
30837             }
30838             }
30839            
30840             PDL_COMMENT("THREADLOOPEND")
30841             }
30842             }
30843 0           part_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30844 0           cpart_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30845 0           ptmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30846 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30847              
30848 0           } } break; case PDL_US: {
30849 0 0         PDL_Ushort * part_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30850 0           PDL_Ushort * part_physdatap = ((PDL_Ushort *)((__privtrans->pdls[0])->data));
30851              
30852 0 0         PDL_Ushort * cpart_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30853 0           PDL_Ushort * cpart_physdatap = ((PDL_Ushort *)((__privtrans->pdls[1])->data));
30854              
30855 0 0         PDL_Ushort * ptmp_datap = ((PDL_Ushort *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30856 0           PDL_Ushort * ptmp_physdatap = ((PDL_Ushort *)((__privtrans->pdls[2])->data));
30857              
30858 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30859 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30860 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30861              
30862              
30863             /*-- sanity check --*/
30864 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30865 0           barf("checkpartitions(): number of partitions \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30866             __privtrans->__k_size, __privtrans->__n_size);
30867             }
30868            
30869             PDL_COMMENT("THREADLOOPBEGIN")
30870 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30871 0           do { register PDL_Indx __tind1=0,__tind2=0;
30872 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30873 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30874 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30875 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30876 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30877 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30878 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30879 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30880 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30881 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30882 0           part_datap += __offsp[0];
30883 0           cpart_datap += __offsp[1];
30884 0           ptmp_datap += __offsp[2];
30885 0 0         for( __tind2 = 0 ;
30886             __tind2 < __tdims1 ;
30887 0           __tind2++
30888 0           ,part_datap += __tinc1_0 - __tinc0_0 * __tdims0
30889 0           ,cpart_datap += __tinc1_1 - __tinc0_1 * __tdims0
30890 0           ,ptmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30891             )
30892             {
30893 0 0         for( __tind1 = 0 ;
30894             __tind1 < __tdims0 ;
30895 0           __tind1++
30896 0           ,part_datap += __tinc0_0
30897 0           ,cpart_datap += __tinc0_1
30898 0           ,ptmp_datap += __tinc0_2
30899             )
30900             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30901             int ni, ki, kj;
30902             {PDL_COMMENT("Open k") register PDL_Indx k;
30903 0 0         for(k=0; k<(__k_size); k++) { (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
30904             {PDL_COMMENT("Open n") register PDL_Indx n;
30905 0 0         for(n=0; n<(__n_size); n++) {
30906 0 0         ki = (part_datap)[0+(__inc_part_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
30907 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = ki;
30908 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30909             }} PDL_COMMENT("Close n")
30910 0           ni = 0;
30911 0 0         for (ki=0; ki < __privtrans->__k_size; ki++) {
30912 0 0         if (!(ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") ) {
    0          
30913 0           for (; 1; ni = (ni+1)%__privtrans->__n_size) {
30914 0 0         kj = (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") ;
30915 0 0         if ((ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") > 1) break;
    0          
30916 0           }
30917 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") = ki;
30918 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30919 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") -= 1;
30920             }
30921             }
30922            
30923             PDL_COMMENT("THREADLOOPEND")
30924             }
30925             }
30926 0           part_datap -= __tinc1_0 * __tdims1 + __offsp[0];
30927 0           cpart_datap -= __tinc1_1 * __tdims1 + __offsp[1];
30928 0           ptmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
30929 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
30930              
30931 0           } } break; case PDL_L: {
30932 0 0         PDL_Long * part_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[0]),(__privtrans->vtable->per_pdl_flags[0]))));
    0          
30933 0           PDL_Long * part_physdatap = ((PDL_Long *)((__privtrans->pdls[0])->data));
30934              
30935 0 0         PDL_Long * cpart_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[1]),(__privtrans->vtable->per_pdl_flags[1]))));
    0          
30936 0           PDL_Long * cpart_physdatap = ((PDL_Long *)((__privtrans->pdls[1])->data));
30937              
30938 0 0         PDL_Long * ptmp_datap = ((PDL_Long *)(PDL_REPRP_TRANS((__privtrans->pdls[2]),(__privtrans->vtable->per_pdl_flags[2]))));
    0          
30939 0           PDL_Long * ptmp_physdatap = ((PDL_Long *)((__privtrans->pdls[2])->data));
30940              
30941 0           {register PDL_Indx __inc_cpart_n = __privtrans->__inc_cpart_n;
30942 0           register PDL_Indx __inc_part_n = __privtrans->__inc_part_n;
30943 0           register PDL_Indx __inc_ptmp_k = __privtrans->__inc_ptmp_k;
30944              
30945              
30946             /*-- sanity check --*/
30947 0 0         if (__privtrans->__k_size > __privtrans->__n_size) {
30948 0           barf("checkpartitions(): number of partitions \"k\" (=%d) must be <= number of objects \"n\" (=%d)!\n",
30949             __privtrans->__k_size, __privtrans->__n_size);
30950             }
30951            
30952             PDL_COMMENT("THREADLOOPBEGIN")
30953 0 0         if ( PDL->startthreadloop(&(__privtrans->__pdlthread),__privtrans->vtable->readdata, __tr) ) return;
30954 0           do { register PDL_Indx __tind1=0,__tind2=0;
30955 0           register PDL_Indx __tnpdls = __privtrans->__pdlthread.npdls;
30956 0           register PDL_Indx __tdims1 = __privtrans->__pdlthread.dims[1];
30957 0           register PDL_Indx __tdims0 = __privtrans->__pdlthread.dims[0];
30958 0           register PDL_Indx *__offsp = PDL->get_threadoffsp(&__privtrans->__pdlthread);
30959 0           register PDL_Indx __tinc0_0 = __privtrans->__pdlthread.incs[0];
30960 0           register PDL_Indx __tinc0_1 = __privtrans->__pdlthread.incs[1];
30961 0           register PDL_Indx __tinc0_2 = __privtrans->__pdlthread.incs[2];
30962 0           register PDL_Indx __tinc1_0 = __privtrans->__pdlthread.incs[__tnpdls+0];
30963 0           register PDL_Indx __tinc1_1 = __privtrans->__pdlthread.incs[__tnpdls+1];
30964 0           register PDL_Indx __tinc1_2 = __privtrans->__pdlthread.incs[__tnpdls+2];
30965 0           part_datap += __offsp[0];
30966 0           cpart_datap += __offsp[1];
30967 0           ptmp_datap += __offsp[2];
30968 0 0         for( __tind2 = 0 ;
30969             __tind2 < __tdims1 ;
30970 0           __tind2++
30971 0           ,part_datap += __tinc1_0 - __tinc0_0 * __tdims0
30972 0           ,cpart_datap += __tinc1_1 - __tinc0_1 * __tdims0
30973 0           ,ptmp_datap += __tinc1_2 - __tinc0_2 * __tdims0
30974             )
30975             {
30976 0 0         for( __tind1 = 0 ;
30977             __tind1 < __tdims0 ;
30978 0           __tind1++
30979 0           ,part_datap += __tinc0_0
30980 0           ,cpart_datap += __tinc0_1
30981 0           ,ptmp_datap += __tinc0_2
30982             )
30983             { PDL_COMMENT("This is the tightest threadloop. Make sure inside is optimal.")
30984             int ni, ki, kj;
30985             {PDL_COMMENT("Open k") register PDL_Indx k;
30986 0 0         for(k=0; k<(__k_size); k++) { (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, k))] PDL_COMMENT("ACCESS()") = 0; }} PDL_COMMENT("Close k")
    0          
30987             {PDL_COMMENT("Open n") register PDL_Indx n;
30988 0 0         for(n=0; n<(__n_size); n++) {
30989 0 0         ki = (part_datap)[0+(__inc_part_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") ;
30990 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, n))] PDL_COMMENT("ACCESS()") = ki;
30991 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
30992             }} PDL_COMMENT("Close n")
30993 0           ni = 0;
30994 0 0         for (ki=0; ki < __privtrans->__k_size; ki++) {
30995 0 0         if (!(ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") ) {
    0          
30996 0           for (; 1; ni = (ni+1)%__privtrans->__n_size) {
30997 0 0         kj = (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") ;
30998 0 0         if ((ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") > 1) break;
    0          
30999 0           }
31000 0 0         (cpart_datap)[0+(__inc_cpart_n*PP_INDTERM(__privtrans->__n_size, ni))] PDL_COMMENT("ACCESS()") = ki;
31001 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, ki))] PDL_COMMENT("ACCESS()") += 1;
31002 0 0         (ptmp_datap)[0+(__inc_ptmp_k*PP_INDTERM(__privtrans->__k_size, kj))] PDL_COMMENT("ACCESS()") -= 1;
31003             }
31004             }
31005            
31006             PDL_COMMENT("THREADLOOPEND")
31007             }
31008             }
31009 0           part_datap -= __tinc1_0 * __tdims1 + __offsp[0];
31010 0           cpart_datap -= __tinc1_1 * __tdims1 + __offsp[1];
31011 0           ptmp_datap -= __tinc1_2 * __tdims1 + __offsp[2];
31012 0 0         } while(PDL->iterthreadloop(&__privtrans->__pdlthread,2));
31013              
31014 0           } break;}
31015 0           default:barf("PP INTERNAL ERROR! PLEASE MAKE A BUG REPORT\n");}
31016             }
31017             }
31018             }
31019            
31020              
31021              
31022              
31023 0           void pdl_checkpartitions_free(pdl_trans *__tr ) {
31024             int __dim;
31025 0           pdl_checkpartitions_struct *__privtrans = (pdl_checkpartitions_struct *) __tr;
31026            
31027             {
31028            
31029 0           PDL_TR_CLRMAGIC(__privtrans);
31030             ;
31031 0 0         if(__privtrans->__ddone) {
31032 0           PDL->freethreadloop(&(__privtrans->__pdlthread));
31033             ;;;;;;
31034             }
31035            
31036             }
31037 0           }
31038            
31039              
31040              
31041              
31042             static char pdl_checkpartitions_vtable_flags[] =
31043             { PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK,PDL_TPDL_VAFFINE_OK};
31044             pdl_transvtable pdl_checkpartitions_vtable = {
31045             0,0, 1, 3, pdl_checkpartitions_vtable_flags,
31046             pdl_checkpartitions_redodims, pdl_checkpartitions_readdata, NULL,
31047             pdl_checkpartitions_free,NULL,NULL,pdl_checkpartitions_copy,
31048             sizeof(pdl_checkpartitions_struct),"pdl_checkpartitions_vtable"
31049             };
31050              
31051              
31052              
31053             MODULE = PDL::Cluster PACKAGE = PDL::Cluster
31054              
31055             PROTOTYPES: ENABLE
31056              
31057             int
31058             set_debugging(i)
31059             int i;
31060             CODE:
31061 0           RETVAL = __pdl_debugging;
31062 0           __pdl_debugging = i;
31063             OUTPUT:
31064             RETVAL
31065              
31066             int
31067             set_boundscheck(i)
31068             int i;
31069             CODE:
31070             if (! 1)
31071             warn("Bounds checking is disabled for PDL::Cluster");
31072 0           RETVAL = __pdl_boundscheck;
31073 0           __pdl_boundscheck = i;
31074             OUTPUT:
31075             RETVAL
31076              
31077              
31078             MODULE = PDL::Cluster PACKAGE = PDL
31079              
31080              
31081             MODULE = PDL::Cluster PACKAGE = PDL::Cluster
31082              
31083              
31084             char *
31085             library_version()
31086             CODE:
31087 0           RETVAL = CLUSTERVERSION;
31088             OUTPUT:
31089             RETVAL
31090              
31091              
31092             MODULE = PDL::Cluster PACKAGE = PDL
31093              
31094              
31095             void
31096             cmean(...)
31097             PREINIT:
31098 2           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31099             by pp_bless ? (CS) */
31100 2           HV *bless_stash = 0;
31101 2           SV *parent = 0;
31102             int nreturn;
31103             SV *b_SV;
31104             pdl *a;
31105             pdl *b;
31106             PPCODE:
31107             {
31108             PDL_COMMENT("Check if you can get a package name for this input value. ")
31109             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31110             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31111 2 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
31112 2           parent = ST(0);
31113 2 50         if (sv_isobject(parent)){
31114 2           bless_stash = SvSTASH(SvRV(ST(0)));
31115 2 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
31116             }
31117             }
31118 2 50         if (items == 2) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31119 0           nreturn = 0;
31120 0           a = PDL->SvPDLV(ST(0));
31121 0           b = PDL->SvPDLV(ST(1));
31122             }
31123 2 50         else if (items == 1) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31124 2           nreturn = 1;
31125 2           a = PDL->SvPDLV(ST(0));
31126 2 50         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31127 2           b_SV = sv_newmortal();
31128 2           b = PDL->null();
31129 2           PDL->SetSV_PDL(b_SV,b);
31130 2 50         if (bless_stash) b_SV = sv_bless(b_SV, bless_stash);
31131             } else {
31132 0 0         PUSHMARK(SP);
31133 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31134 0           PUTBACK;
31135 0           perl_call_method("initialize", G_SCALAR);
31136 0           SPAGAIN;
31137 0           b_SV = POPs;
31138 0           PUTBACK;
31139 2           b = PDL->SvPDLV(b_SV);
31140             }
31141             }
31142             else {
31143 0           croak ("Usage: PDL::cmean(a,b) (you may leave temporaries or output variables out of list)");
31144             }
31145             }
31146             {
31147             }
31148             { pdl_cmean_struct *__privtrans;
31149 2           int badflag_cache = 0;
31150 2           __privtrans = malloc(sizeof(*__privtrans));
31151 2           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31152 2           PDL_TR_SETMAGIC(__privtrans);
31153 2           __privtrans->flags = 0;
31154 2           __privtrans->__ddone = 0;
31155 2           __privtrans->vtable = &pdl_cmean_vtable;
31156 2           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31157 2           __privtrans->bvalflag = 0;
31158 2           badflag_cache = ((a->state & PDL_BADVAL) > 0);
31159 2 50         if (badflag_cache) __privtrans->bvalflag = 1;
31160 2 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_D) {}
31161 2           else __privtrans->__datatype = PDL_D;
31162 2 50         if(PDL_D != a->datatype) {
31163 0           a = PDL->get_convertedpdl(a,PDL_D);
31164 2 50         }if( (b->state & PDL_NOMYDIMS) && b->trans == NULL ) {
    50          
31165 2           b->datatype = PDL_D;
31166 0 0         } else if(PDL_D != b->datatype) {
31167 0           b = PDL->get_convertedpdl(b,PDL_D);
31168 2           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = a;
31169 2           __privtrans->pdls[1] = b;
31170 2           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31171 2 50         if (badflag_cache) {
31172 0           b->state |= PDL_BADVAL;
31173             }
31174 2 50         if (nreturn) {
31175 2 50         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31176 2           ST(0) = b_SV;
31177 2           XSRETURN(nreturn);
31178             } else {
31179 0           XSRETURN(0);
31180             }
31181             }
31182              
31183             void
31184             cmedian(...)
31185             PREINIT:
31186 2           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31187             by pp_bless ? (CS) */
31188 2           HV *bless_stash = 0;
31189 2           SV *parent = 0;
31190             int nreturn;
31191             SV *b_SV;
31192             pdl *a;
31193             pdl *b;
31194             PPCODE:
31195             {
31196             PDL_COMMENT("Check if you can get a package name for this input value. ")
31197             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31198             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31199 2 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
31200 2           parent = ST(0);
31201 2 50         if (sv_isobject(parent)){
31202 2           bless_stash = SvSTASH(SvRV(ST(0)));
31203 2 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
31204             }
31205             }
31206 2 50         if (items == 2) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31207 0           nreturn = 0;
31208 0           a = PDL->SvPDLV(ST(0));
31209 0           b = PDL->SvPDLV(ST(1));
31210             }
31211 2 50         else if (items == 1) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31212 2           nreturn = 1;
31213 2           a = PDL->SvPDLV(ST(0));
31214 2 50         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31215 2           b_SV = sv_newmortal();
31216 2           b = PDL->null();
31217 2           PDL->SetSV_PDL(b_SV,b);
31218 2 50         if (bless_stash) b_SV = sv_bless(b_SV, bless_stash);
31219             } else {
31220 0 0         PUSHMARK(SP);
31221 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31222 0           PUTBACK;
31223 0           perl_call_method("initialize", G_SCALAR);
31224 0           SPAGAIN;
31225 0           b_SV = POPs;
31226 0           PUTBACK;
31227 2           b = PDL->SvPDLV(b_SV);
31228             }
31229             }
31230             else {
31231 0           croak ("Usage: PDL::cmedian(a,b) (you may leave temporaries or output variables out of list)");
31232             }
31233             }
31234             {
31235             }
31236             { pdl_cmedian_struct *__privtrans;
31237 2           int badflag_cache = 0;
31238 2           __privtrans = malloc(sizeof(*__privtrans));
31239 2           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31240 2           PDL_TR_SETMAGIC(__privtrans);
31241 2           __privtrans->flags = 0;
31242 2           __privtrans->__ddone = 0;
31243 2           __privtrans->vtable = &pdl_cmedian_vtable;
31244 2           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31245 2           __privtrans->bvalflag = 0;
31246 2           badflag_cache = ((a->state & PDL_BADVAL) > 0);
31247 2 50         if (badflag_cache) __privtrans->bvalflag = 1;
31248 2 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_D) {}
31249 2           else __privtrans->__datatype = PDL_D;
31250 2 50         if(PDL_D != a->datatype) {
31251 0           a = PDL->get_convertedpdl(a,PDL_D);
31252 2 50         }if( (b->state & PDL_NOMYDIMS) && b->trans == NULL ) {
    50          
31253 2           b->datatype = PDL_D;
31254 0 0         } else if(PDL_D != b->datatype) {
31255 0           b = PDL->get_convertedpdl(b,PDL_D);
31256 2           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = a;
31257 2           __privtrans->pdls[1] = b;
31258 2           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31259 2 50         if (badflag_cache) {
31260 0           b->state |= PDL_BADVAL;
31261             }
31262 2 50         if (nreturn) {
31263 2 50         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31264 2           ST(0) = b_SV;
31265 2           XSRETURN(nreturn);
31266             } else {
31267 0           XSRETURN(0);
31268             }
31269             }
31270              
31271             void
31272             calculate_weights(...)
31273             PREINIT:
31274 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31275             by pp_bless ? (CS) */
31276 0           HV *bless_stash = 0;
31277 0           SV *parent = 0;
31278             int nreturn;
31279             SV *oweights_SV;
31280             pdl *data;
31281             pdl *mask;
31282             pdl *weight;
31283             pdl *cutoff;
31284             pdl *exponent;
31285             pdl *oweights;
31286             char *distFlag;
31287             PPCODE:
31288             {
31289             PDL_COMMENT("Check if you can get a package name for this input value. ")
31290             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31291             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31292 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
31293 0           parent = ST(0);
31294 0 0         if (sv_isobject(parent)){
31295 0           bless_stash = SvSTASH(SvRV(ST(0)));
31296 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
31297             }
31298             }
31299 0 0         if (items == 7) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31300 0           nreturn = 0;
31301 0           data = PDL->SvPDLV(ST(0));
31302 0           mask = PDL->SvPDLV(ST(1));
31303 0           weight = PDL->SvPDLV(ST(2));
31304 0           cutoff = PDL->SvPDLV(ST(3));
31305 0           exponent = PDL->SvPDLV(ST(4));
31306 0           oweights = PDL->SvPDLV(ST(5));
31307 0 0         distFlag = (char *)SvPV_nolen(ST(6))
31308             ;
31309             }
31310 0 0         else if (items == 6) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31311 0           nreturn = 1;
31312 0           data = PDL->SvPDLV(ST(0));
31313 0           mask = PDL->SvPDLV(ST(1));
31314 0           weight = PDL->SvPDLV(ST(2));
31315 0           cutoff = PDL->SvPDLV(ST(3));
31316 0           exponent = PDL->SvPDLV(ST(4));
31317 0 0         distFlag = (char *)SvPV_nolen(ST(5))
31318             ;
31319 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31320 0           oweights_SV = sv_newmortal();
31321 0           oweights = PDL->null();
31322 0           PDL->SetSV_PDL(oweights_SV,oweights);
31323 0 0         if (bless_stash) oweights_SV = sv_bless(oweights_SV, bless_stash);
31324             } else {
31325 0 0         PUSHMARK(SP);
31326 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31327 0           PUTBACK;
31328 0           perl_call_method("initialize", G_SCALAR);
31329 0           SPAGAIN;
31330 0           oweights_SV = POPs;
31331 0           PUTBACK;
31332 0           oweights = PDL->SvPDLV(oweights_SV);
31333             }
31334             }
31335             else {
31336 0           croak ("Usage: PDL::calculate_weights(data,mask,weight,cutoff,exponent,oweights,distFlag) (you may leave temporaries or output variables out of list)");
31337             }
31338             }
31339             {
31340             }
31341             { pdl_calculate_weights_struct *__privtrans;
31342 0           int badflag_cache = 0;
31343 0           __privtrans = malloc(sizeof(*__privtrans));
31344 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31345 0           PDL_TR_SETMAGIC(__privtrans);
31346 0           __privtrans->flags = 0;
31347 0           __privtrans->__ddone = 0;
31348 0           __privtrans->vtable = &pdl_calculate_weights_vtable;
31349 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31350 0           __privtrans->bvalflag = 0;
31351 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((cutoff->state & PDL_BADVAL) > 0) || ((exponent->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
31352 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
31353 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
31354 0 0         else if(__privtrans->__datatype == PDL_S) {}
31355 0 0         else if(__privtrans->__datatype == PDL_U) {}
31356 0 0         else if(__privtrans->__datatype == PDL_L) {}
31357 0 0         else if(__privtrans->__datatype == PDL_N) {}
31358 0 0         else if(__privtrans->__datatype == PDL_Q) {}
31359 0 0         else if(__privtrans->__datatype == PDL_F) {}
31360 0 0         else if(__privtrans->__datatype == PDL_D) {}
31361 0           else __privtrans->__datatype = PDL_D;
31362 0 0         if(PDL_D != data->datatype) {
31363 0           data = PDL->get_convertedpdl(data,PDL_D);
31364 0 0         }if(PDL_L != mask->datatype) {
31365 0           mask = PDL->get_convertedpdl(mask,PDL_L);
31366 0 0         }if(PDL_D != weight->datatype) {
31367 0           weight = PDL->get_convertedpdl(weight,PDL_D);
31368 0 0         }if(PDL_D != cutoff->datatype) {
31369 0           cutoff = PDL->get_convertedpdl(cutoff,PDL_D);
31370 0 0         }if(PDL_D != exponent->datatype) {
31371 0           exponent = PDL->get_convertedpdl(exponent,PDL_D);
31372 0 0         }if( (oweights->state & PDL_NOMYDIMS) && oweights->trans == NULL ) {
    0          
31373 0           oweights->datatype = PDL_D;
31374 0 0         } else if(PDL_D != oweights->datatype) {
31375 0           oweights = PDL->get_convertedpdl(oweights,PDL_D);
31376 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
31377 0           __privtrans->pdls[1] = mask;
31378 0           __privtrans->pdls[2] = weight;
31379 0           __privtrans->pdls[3] = cutoff;
31380 0           __privtrans->pdls[4] = exponent;
31381 0           __privtrans->pdls[5] = oweights;
31382 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31383 0 0         if (badflag_cache) {
31384 0           oweights->state |= PDL_BADVAL;
31385             }
31386 0 0         if (nreturn) {
31387 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31388 0           ST(0) = oweights_SV;
31389 0           XSRETURN(nreturn);
31390             } else {
31391 0           XSRETURN(0);
31392             }
31393             }
31394              
31395             void
31396             clusterdistance(...)
31397             PREINIT:
31398 6           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31399             by pp_bless ? (CS) */
31400 6           HV *bless_stash = 0;
31401 6           SV *parent = 0;
31402             int nreturn;
31403             SV *dist_SV;
31404             pdl *data;
31405             pdl *mask;
31406             pdl *weight;
31407             pdl *n1;
31408             pdl *n2;
31409             pdl *index1;
31410             pdl *index2;
31411             pdl *dist;
31412             char *distFlag;
31413             char *methodFlag;
31414             PPCODE:
31415             {
31416             PDL_COMMENT("Check if you can get a package name for this input value. ")
31417             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31418             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31419 6 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
31420 6           parent = ST(0);
31421 6 50         if (sv_isobject(parent)){
31422 6           bless_stash = SvSTASH(SvRV(ST(0)));
31423 6 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
31424             }
31425             }
31426 6 50         if (items == 10) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31427 6           nreturn = 0;
31428 6           data = PDL->SvPDLV(ST(0));
31429 6           mask = PDL->SvPDLV(ST(1));
31430 6           weight = PDL->SvPDLV(ST(2));
31431 6           n1 = PDL->SvPDLV(ST(3));
31432 6           n2 = PDL->SvPDLV(ST(4));
31433 6           index1 = PDL->SvPDLV(ST(5));
31434 6           index2 = PDL->SvPDLV(ST(6));
31435 6           dist = PDL->SvPDLV(ST(7));
31436 6 50         distFlag = (char *)SvPV_nolen(ST(8))
31437             ;
31438 6 50         methodFlag = (char *)SvPV_nolen(ST(9))
31439             ;
31440             }
31441 0 0         else if (items == 9) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31442 0           nreturn = 1;
31443 0           data = PDL->SvPDLV(ST(0));
31444 0           mask = PDL->SvPDLV(ST(1));
31445 0           weight = PDL->SvPDLV(ST(2));
31446 0           n1 = PDL->SvPDLV(ST(3));
31447 0           n2 = PDL->SvPDLV(ST(4));
31448 0           index1 = PDL->SvPDLV(ST(5));
31449 0           index2 = PDL->SvPDLV(ST(6));
31450 0 0         distFlag = (char *)SvPV_nolen(ST(7))
31451             ;
31452 0 0         methodFlag = (char *)SvPV_nolen(ST(8))
31453             ;
31454 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31455 0           dist_SV = sv_newmortal();
31456 0           dist = PDL->null();
31457 0           PDL->SetSV_PDL(dist_SV,dist);
31458 0 0         if (bless_stash) dist_SV = sv_bless(dist_SV, bless_stash);
31459             } else {
31460 0 0         PUSHMARK(SP);
31461 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31462 0           PUTBACK;
31463 0           perl_call_method("initialize", G_SCALAR);
31464 0           SPAGAIN;
31465 0           dist_SV = POPs;
31466 0           PUTBACK;
31467 0           dist = PDL->SvPDLV(dist_SV);
31468             }
31469             }
31470             else {
31471 0           croak ("Usage: PDL::clusterdistance(data,mask,weight,n1,n2,index1,index2,dist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
31472             }
31473             }
31474             {
31475             }
31476             { pdl_clusterdistance_struct *__privtrans;
31477 6           int badflag_cache = 0;
31478 6           __privtrans = malloc(sizeof(*__privtrans));
31479 6           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31480 6           PDL_TR_SETMAGIC(__privtrans);
31481 6           __privtrans->flags = 0;
31482 6           __privtrans->__ddone = 0;
31483 6           __privtrans->vtable = &pdl_clusterdistance_vtable;
31484 6           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31485 6           __privtrans->bvalflag = 0;
31486 6 50         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((n1->state & PDL_BADVAL) > 0) || ((n2->state & PDL_BADVAL) > 0) || ((index1->state & PDL_BADVAL) > 0) || ((index2->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
    50          
    50          
31487 6 50         if (badflag_cache) __privtrans->bvalflag = 1;
31488 6 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
31489 0 0         else if(__privtrans->__datatype == PDL_S) {}
31490 0 0         else if(__privtrans->__datatype == PDL_U) {}
31491 0 0         else if(__privtrans->__datatype == PDL_L) {}
31492 0 0         else if(__privtrans->__datatype == PDL_N) {}
31493 0 0         else if(__privtrans->__datatype == PDL_Q) {}
31494 0 0         else if(__privtrans->__datatype == PDL_F) {}
31495 0 0         else if(__privtrans->__datatype == PDL_D) {}
31496 0           else __privtrans->__datatype = PDL_D;
31497 6 50         if(PDL_D != data->datatype) {
31498 0           data = PDL->get_convertedpdl(data,PDL_D);
31499 6 50         }if(PDL_L != mask->datatype) {
31500 6           mask = PDL->get_convertedpdl(mask,PDL_L);
31501 6 50         }if(PDL_D != weight->datatype) {
31502 0           weight = PDL->get_convertedpdl(weight,PDL_D);
31503 6 50         }if(PDL_L != n1->datatype) {
31504 6           n1 = PDL->get_convertedpdl(n1,PDL_L);
31505 6 50         }if(PDL_L != n2->datatype) {
31506 6           n2 = PDL->get_convertedpdl(n2,PDL_L);
31507 6 50         }if(PDL_L != index1->datatype) {
31508 6           index1 = PDL->get_convertedpdl(index1,PDL_L);
31509 6 50         }if(PDL_L != index2->datatype) {
31510 6           index2 = PDL->get_convertedpdl(index2,PDL_L);
31511 6 50         }if( (dist->state & PDL_NOMYDIMS) && dist->trans == NULL ) {
    50          
31512 6           dist->datatype = PDL_D;
31513 0 0         } else if(PDL_D != dist->datatype) {
31514 0           dist = PDL->get_convertedpdl(dist,PDL_D);
31515 6           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
31516 6           __privtrans->pdls[1] = mask;
31517 6           __privtrans->pdls[2] = weight;
31518 6           __privtrans->pdls[3] = n1;
31519 6           __privtrans->pdls[4] = n2;
31520 6           __privtrans->pdls[5] = index1;
31521 6           __privtrans->pdls[6] = index2;
31522 6           __privtrans->pdls[7] = dist;
31523 6           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31524 6 50         if (badflag_cache) {
31525 0           dist->state |= PDL_BADVAL;
31526             }
31527 6 50         if (nreturn) {
31528 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31529 0           ST(0) = dist_SV;
31530 0           XSRETURN(nreturn);
31531             } else {
31532 6           XSRETURN(0);
31533             }
31534             }
31535              
31536             void
31537             distancematrix(...)
31538             PREINIT:
31539 1           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31540             by pp_bless ? (CS) */
31541 1           HV *bless_stash = 0;
31542 1           SV *parent = 0;
31543             int nreturn;
31544             SV *dists_SV;
31545             pdl *data;
31546             pdl *mask;
31547             pdl *weight;
31548             pdl *dists;
31549             char *distFlag;
31550             PPCODE:
31551             {
31552             PDL_COMMENT("Check if you can get a package name for this input value. ")
31553             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31554             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31555 1 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
31556 1           parent = ST(0);
31557 1 50         if (sv_isobject(parent)){
31558 1           bless_stash = SvSTASH(SvRV(ST(0)));
31559 1 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
31560             }
31561             }
31562 1 50         if (items == 5) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31563 1           nreturn = 0;
31564 1           data = PDL->SvPDLV(ST(0));
31565 1           mask = PDL->SvPDLV(ST(1));
31566 1           weight = PDL->SvPDLV(ST(2));
31567 1           dists = PDL->SvPDLV(ST(3));
31568 1 50         distFlag = (char *)SvPV_nolen(ST(4))
31569             ;
31570             }
31571 0 0         else if (items == 4) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31572 0           nreturn = 1;
31573 0           data = PDL->SvPDLV(ST(0));
31574 0           mask = PDL->SvPDLV(ST(1));
31575 0           weight = PDL->SvPDLV(ST(2));
31576 0 0         distFlag = (char *)SvPV_nolen(ST(3))
31577             ;
31578 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31579 0           dists_SV = sv_newmortal();
31580 0           dists = PDL->null();
31581 0           PDL->SetSV_PDL(dists_SV,dists);
31582 0 0         if (bless_stash) dists_SV = sv_bless(dists_SV, bless_stash);
31583             } else {
31584 0 0         PUSHMARK(SP);
31585 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31586 0           PUTBACK;
31587 0           perl_call_method("initialize", G_SCALAR);
31588 0           SPAGAIN;
31589 0           dists_SV = POPs;
31590 0           PUTBACK;
31591 0           dists = PDL->SvPDLV(dists_SV);
31592             }
31593             }
31594             else {
31595 0           croak ("Usage: PDL::distancematrix(data,mask,weight,dists,distFlag) (you may leave temporaries or output variables out of list)");
31596             }
31597             }
31598             {
31599             }
31600             { pdl_distancematrix_struct *__privtrans;
31601 1           int badflag_cache = 0;
31602 1           __privtrans = malloc(sizeof(*__privtrans));
31603 1           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31604 1           PDL_TR_SETMAGIC(__privtrans);
31605 1           __privtrans->flags = 0;
31606 1           __privtrans->__ddone = 0;
31607 1           __privtrans->vtable = &pdl_distancematrix_vtable;
31608 1           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31609 1           __privtrans->bvalflag = 0;
31610 1 50         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0);
    50          
    50          
31611 1 50         if (badflag_cache) __privtrans->bvalflag = 1;
31612 1 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
31613 0 0         else if(__privtrans->__datatype == PDL_S) {}
31614 0 0         else if(__privtrans->__datatype == PDL_U) {}
31615 0 0         else if(__privtrans->__datatype == PDL_L) {}
31616 0 0         else if(__privtrans->__datatype == PDL_N) {}
31617 0 0         else if(__privtrans->__datatype == PDL_Q) {}
31618 0 0         else if(__privtrans->__datatype == PDL_F) {}
31619 0 0         else if(__privtrans->__datatype == PDL_D) {}
31620 0           else __privtrans->__datatype = PDL_D;
31621 1 50         if(PDL_D != data->datatype) {
31622 0           data = PDL->get_convertedpdl(data,PDL_D);
31623 1 50         }if(PDL_L != mask->datatype) {
31624 1           mask = PDL->get_convertedpdl(mask,PDL_L);
31625 1 50         }if(PDL_D != weight->datatype) {
31626 0           weight = PDL->get_convertedpdl(weight,PDL_D);
31627 1 50         }if( (dists->state & PDL_NOMYDIMS) && dists->trans == NULL ) {
    50          
31628 1           dists->datatype = PDL_D;
31629 0 0         } else if(PDL_D != dists->datatype) {
31630 0           dists = PDL->get_convertedpdl(dists,PDL_D);
31631 1           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
31632 1           __privtrans->pdls[1] = mask;
31633 1           __privtrans->pdls[2] = weight;
31634 1           __privtrans->pdls[3] = dists;
31635 1           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31636 1 50         if (badflag_cache) {
31637 0           dists->state |= PDL_BADVAL;
31638             }
31639 1 50         if (nreturn) {
31640 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31641 0           ST(0) = dists_SV;
31642 0           XSRETURN(nreturn);
31643             } else {
31644 1           XSRETURN(0);
31645             }
31646             }
31647              
31648             void
31649             getclustercentroids(...)
31650             PREINIT:
31651 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31652             by pp_bless ? (CS) */
31653 0           HV *bless_stash = 0;
31654 0           SV *parent = 0;
31655             int nreturn;
31656             SV *cdata_SV;
31657             SV *cmask_SV;
31658             pdl *data;
31659             pdl *mask;
31660             pdl *clusterids;
31661             pdl *cdata;
31662             pdl *cmask;
31663             char *ctrMethodFlag;
31664             PPCODE:
31665             {
31666             PDL_COMMENT("Check if you can get a package name for this input value. ")
31667             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31668             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31669 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
31670 0           parent = ST(0);
31671 0 0         if (sv_isobject(parent)){
31672 0           bless_stash = SvSTASH(SvRV(ST(0)));
31673 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
31674             }
31675             }
31676 0 0         if (items == 6) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31677 0           nreturn = 0;
31678 0           data = PDL->SvPDLV(ST(0));
31679 0           mask = PDL->SvPDLV(ST(1));
31680 0           clusterids = PDL->SvPDLV(ST(2));
31681 0           cdata = PDL->SvPDLV(ST(3));
31682 0           cmask = PDL->SvPDLV(ST(4));
31683 0 0         ctrMethodFlag = (char *)SvPV_nolen(ST(5))
31684             ;
31685             }
31686 0 0         else if (items == 4) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31687 0           nreturn = 2;
31688 0           data = PDL->SvPDLV(ST(0));
31689 0           mask = PDL->SvPDLV(ST(1));
31690 0           clusterids = PDL->SvPDLV(ST(2));
31691 0 0         ctrMethodFlag = (char *)SvPV_nolen(ST(3))
31692             ;
31693 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31694 0           cdata_SV = sv_newmortal();
31695 0           cdata = PDL->null();
31696 0           PDL->SetSV_PDL(cdata_SV,cdata);
31697 0 0         if (bless_stash) cdata_SV = sv_bless(cdata_SV, bless_stash);
31698             } else {
31699 0 0         PUSHMARK(SP);
31700 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31701 0           PUTBACK;
31702 0           perl_call_method("initialize", G_SCALAR);
31703 0           SPAGAIN;
31704 0           cdata_SV = POPs;
31705 0           PUTBACK;
31706 0           cdata = PDL->SvPDLV(cdata_SV);
31707             }
31708 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31709 0           cmask_SV = sv_newmortal();
31710 0           cmask = PDL->null();
31711 0           PDL->SetSV_PDL(cmask_SV,cmask);
31712 0 0         if (bless_stash) cmask_SV = sv_bless(cmask_SV, bless_stash);
31713             } else {
31714 0 0         PUSHMARK(SP);
31715 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31716 0           PUTBACK;
31717 0           perl_call_method("initialize", G_SCALAR);
31718 0           SPAGAIN;
31719 0           cmask_SV = POPs;
31720 0           PUTBACK;
31721 0           cmask = PDL->SvPDLV(cmask_SV);
31722             }
31723             }
31724             else {
31725 0           croak ("Usage: PDL::getclustercentroids(data,mask,clusterids,cdata,cmask,ctrMethodFlag) (you may leave temporaries or output variables out of list)");
31726             }
31727             }
31728             {
31729             }
31730             { pdl_getclustercentroids_struct *__privtrans;
31731 0           int badflag_cache = 0;
31732 0           __privtrans = malloc(sizeof(*__privtrans));
31733 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31734 0           PDL_TR_SETMAGIC(__privtrans);
31735 0           __privtrans->flags = 0;
31736 0           __privtrans->__ddone = 0;
31737 0           __privtrans->vtable = &pdl_getclustercentroids_vtable;
31738 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31739 0           __privtrans->bvalflag = 0;
31740 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((clusterids->state & PDL_BADVAL) > 0);
    0          
    0          
31741 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
31742 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
31743 0 0         else if(__privtrans->__datatype == PDL_S) {}
31744 0 0         else if(__privtrans->__datatype == PDL_U) {}
31745 0 0         else if(__privtrans->__datatype == PDL_L) {}
31746 0 0         else if(__privtrans->__datatype == PDL_N) {}
31747 0 0         else if(__privtrans->__datatype == PDL_Q) {}
31748 0 0         else if(__privtrans->__datatype == PDL_F) {}
31749 0 0         else if(__privtrans->__datatype == PDL_D) {}
31750 0           else __privtrans->__datatype = PDL_D;
31751 0 0         if(PDL_D != data->datatype) {
31752 0           data = PDL->get_convertedpdl(data,PDL_D);
31753 0 0         }if(PDL_L != mask->datatype) {
31754 0           mask = PDL->get_convertedpdl(mask,PDL_L);
31755 0 0         }if(PDL_L != clusterids->datatype) {
31756 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
31757 0 0         }if( (cdata->state & PDL_NOMYDIMS) && cdata->trans == NULL ) {
    0          
31758 0           cdata->datatype = PDL_D;
31759 0 0         } else if(PDL_D != cdata->datatype) {
31760 0           cdata = PDL->get_convertedpdl(cdata,PDL_D);
31761 0 0         }if( (cmask->state & PDL_NOMYDIMS) && cmask->trans == NULL ) {
    0          
31762 0           cmask->datatype = PDL_L;
31763 0 0         } else if(PDL_L != cmask->datatype) {
31764 0           cmask = PDL->get_convertedpdl(cmask,PDL_L);
31765 0           }{(__privtrans->ctrMethodFlag) = malloc(strlen(ctrMethodFlag)+1); strcpy(__privtrans->ctrMethodFlag,ctrMethodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
31766 0           __privtrans->pdls[1] = mask;
31767 0           __privtrans->pdls[2] = clusterids;
31768 0           __privtrans->pdls[3] = cdata;
31769 0           __privtrans->pdls[4] = cmask;
31770 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31771 0 0         if (badflag_cache) {
31772 0           cdata->state |= PDL_BADVAL;
31773 0           cmask->state |= PDL_BADVAL;
31774             }
31775 0 0         if (nreturn) {
31776 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31777 0           ST(0) = cdata_SV;
31778 0           ST(1) = cmask_SV;
31779 0           XSRETURN(nreturn);
31780             } else {
31781 0           XSRETURN(0);
31782             }
31783             }
31784              
31785             void
31786             getclustermedoids(...)
31787             PREINIT:
31788 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31789             by pp_bless ? (CS) */
31790 0           HV *bless_stash = 0;
31791 0           SV *parent = 0;
31792             int nreturn;
31793             SV *centroids_SV;
31794             SV *errors_SV;
31795             pdl *distance;
31796             pdl *clusterids;
31797             pdl *centroids;
31798             pdl *errors;
31799             PPCODE:
31800             {
31801             PDL_COMMENT("Check if you can get a package name for this input value. ")
31802             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31803             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31804 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
31805 0           parent = ST(0);
31806 0 0         if (sv_isobject(parent)){
31807 0           bless_stash = SvSTASH(SvRV(ST(0)));
31808 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
31809             }
31810             }
31811 0 0         if (items == 4) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31812 0           nreturn = 0;
31813 0           distance = PDL->SvPDLV(ST(0));
31814 0           clusterids = PDL->SvPDLV(ST(1));
31815 0           centroids = PDL->SvPDLV(ST(2));
31816 0           errors = PDL->SvPDLV(ST(3));
31817             }
31818 0 0         else if (items == 2) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31819 0           nreturn = 2;
31820 0           distance = PDL->SvPDLV(ST(0));
31821 0           clusterids = PDL->SvPDLV(ST(1));
31822 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31823 0           centroids_SV = sv_newmortal();
31824 0           centroids = PDL->null();
31825 0           PDL->SetSV_PDL(centroids_SV,centroids);
31826 0 0         if (bless_stash) centroids_SV = sv_bless(centroids_SV, bless_stash);
31827             } else {
31828 0 0         PUSHMARK(SP);
31829 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31830 0           PUTBACK;
31831 0           perl_call_method("initialize", G_SCALAR);
31832 0           SPAGAIN;
31833 0           centroids_SV = POPs;
31834 0           PUTBACK;
31835 0           centroids = PDL->SvPDLV(centroids_SV);
31836             }
31837 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31838 0           errors_SV = sv_newmortal();
31839 0           errors = PDL->null();
31840 0           PDL->SetSV_PDL(errors_SV,errors);
31841 0 0         if (bless_stash) errors_SV = sv_bless(errors_SV, bless_stash);
31842             } else {
31843 0 0         PUSHMARK(SP);
31844 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31845 0           PUTBACK;
31846 0           perl_call_method("initialize", G_SCALAR);
31847 0           SPAGAIN;
31848 0           errors_SV = POPs;
31849 0           PUTBACK;
31850 0           errors = PDL->SvPDLV(errors_SV);
31851             }
31852             }
31853             else {
31854 0           croak ("Usage: PDL::getclustermedoids(distance,clusterids,centroids,errors) (you may leave temporaries or output variables out of list)");
31855             }
31856             }
31857             {
31858             }
31859             { pdl_getclustermedoids_struct *__privtrans;
31860 0           int badflag_cache = 0;
31861 0           __privtrans = malloc(sizeof(*__privtrans));
31862 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
31863 0           PDL_TR_SETMAGIC(__privtrans);
31864 0           __privtrans->flags = 0;
31865 0           __privtrans->__ddone = 0;
31866 0           __privtrans->vtable = &pdl_getclustermedoids_vtable;
31867 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
31868 0           __privtrans->bvalflag = 0;
31869 0 0         badflag_cache = ((distance->state & PDL_BADVAL) > 0) || ((clusterids->state & PDL_BADVAL) > 0);
    0          
31870 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
31871 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
31872 0 0         else if(__privtrans->__datatype == PDL_S) {}
31873 0 0         else if(__privtrans->__datatype == PDL_U) {}
31874 0 0         else if(__privtrans->__datatype == PDL_L) {}
31875 0 0         else if(__privtrans->__datatype == PDL_N) {}
31876 0 0         else if(__privtrans->__datatype == PDL_Q) {}
31877 0 0         else if(__privtrans->__datatype == PDL_F) {}
31878 0 0         else if(__privtrans->__datatype == PDL_D) {}
31879 0           else __privtrans->__datatype = PDL_D;
31880 0 0         if(PDL_D != distance->datatype) {
31881 0           distance = PDL->get_convertedpdl(distance,PDL_D);
31882 0 0         }if(PDL_L != clusterids->datatype) {
31883 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
31884 0 0         }if( (centroids->state & PDL_NOMYDIMS) && centroids->trans == NULL ) {
    0          
31885 0           centroids->datatype = PDL_L;
31886 0 0         } else if(PDL_L != centroids->datatype) {
31887 0           centroids = PDL->get_convertedpdl(centroids,PDL_L);
31888 0 0         }if( (errors->state & PDL_NOMYDIMS) && errors->trans == NULL ) {
    0          
31889 0           errors->datatype = PDL_D;
31890 0 0         } else if(PDL_D != errors->datatype) {
31891 0           errors = PDL->get_convertedpdl(errors,PDL_D);
31892 0           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = distance;
31893 0           __privtrans->pdls[1] = clusterids;
31894 0           __privtrans->pdls[2] = centroids;
31895 0           __privtrans->pdls[3] = errors;
31896 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
31897 0 0         if (badflag_cache) {
31898 0           centroids->state |= PDL_BADVAL;
31899 0           errors->state |= PDL_BADVAL;
31900             }
31901 0 0         if (nreturn) {
31902 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
31903 0           ST(0) = centroids_SV;
31904 0           ST(1) = errors_SV;
31905 0           XSRETURN(nreturn);
31906             } else {
31907 0           XSRETURN(0);
31908             }
31909             }
31910              
31911             void
31912             kcluster(...)
31913             PREINIT:
31914 3           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
31915             by pp_bless ? (CS) */
31916 3           HV *bless_stash = 0;
31917 3           SV *parent = 0;
31918             int nreturn;
31919             SV *clusterids_SV;
31920             SV *error_SV;
31921             SV *nfound_SV;
31922             pdl *nclusters;
31923             pdl *data;
31924             pdl *mask;
31925             pdl *weight;
31926             pdl *npass;
31927             pdl *clusterids;
31928             pdl *error;
31929             pdl *nfound;
31930             char *distFlag;
31931             char *ctrMethodFlag;
31932             PPCODE:
31933             {
31934             PDL_COMMENT("Check if you can get a package name for this input value. ")
31935             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
31936             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
31937 3 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
31938 0           parent = ST(0);
31939 0 0         if (sv_isobject(parent)){
31940 0           bless_stash = SvSTASH(SvRV(ST(0)));
31941 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
31942             }
31943             }
31944 3 50         if (items == 10) { PDL_COMMENT("all variables on stack, read in output and temp vars")
31945 3           nreturn = 0;
31946 3           nclusters = PDL->SvPDLV(ST(0));
31947 3           data = PDL->SvPDLV(ST(1));
31948 3           mask = PDL->SvPDLV(ST(2));
31949 3           weight = PDL->SvPDLV(ST(3));
31950 3           npass = PDL->SvPDLV(ST(4));
31951 3           clusterids = PDL->SvPDLV(ST(5));
31952 3           error = PDL->SvPDLV(ST(6));
31953 3           nfound = PDL->SvPDLV(ST(7));
31954 3 50         distFlag = (char *)SvPV_nolen(ST(8))
31955             ;
31956 3 50         ctrMethodFlag = (char *)SvPV_nolen(ST(9))
31957             ;
31958             }
31959 0 0         else if (items == 7) { PDL_COMMENT("only input variables on stack, create outputs and temps")
31960 0           nreturn = 3;
31961 0           nclusters = PDL->SvPDLV(ST(0));
31962 0           data = PDL->SvPDLV(ST(1));
31963 0           mask = PDL->SvPDLV(ST(2));
31964 0           weight = PDL->SvPDLV(ST(3));
31965 0           npass = PDL->SvPDLV(ST(4));
31966 0 0         distFlag = (char *)SvPV_nolen(ST(5))
31967             ;
31968 0 0         ctrMethodFlag = (char *)SvPV_nolen(ST(6))
31969             ;
31970 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31971 0           clusterids_SV = sv_newmortal();
31972 0           clusterids = PDL->null();
31973 0           PDL->SetSV_PDL(clusterids_SV,clusterids);
31974 0 0         if (bless_stash) clusterids_SV = sv_bless(clusterids_SV, bless_stash);
31975             } else {
31976 0 0         PUSHMARK(SP);
31977 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31978 0           PUTBACK;
31979 0           perl_call_method("initialize", G_SCALAR);
31980 0           SPAGAIN;
31981 0           clusterids_SV = POPs;
31982 0           PUTBACK;
31983 0           clusterids = PDL->SvPDLV(clusterids_SV);
31984             }
31985 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
31986 0           error_SV = sv_newmortal();
31987 0           error = PDL->null();
31988 0           PDL->SetSV_PDL(error_SV,error);
31989 0 0         if (bless_stash) error_SV = sv_bless(error_SV, bless_stash);
31990             } else {
31991 0 0         PUSHMARK(SP);
31992 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
31993 0           PUTBACK;
31994 0           perl_call_method("initialize", G_SCALAR);
31995 0           SPAGAIN;
31996 0           error_SV = POPs;
31997 0           PUTBACK;
31998 0           error = PDL->SvPDLV(error_SV);
31999             }
32000 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32001 0           nfound_SV = sv_newmortal();
32002 0           nfound = PDL->null();
32003 0           PDL->SetSV_PDL(nfound_SV,nfound);
32004 0 0         if (bless_stash) nfound_SV = sv_bless(nfound_SV, bless_stash);
32005             } else {
32006 0 0         PUSHMARK(SP);
32007 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32008 0           PUTBACK;
32009 0           perl_call_method("initialize", G_SCALAR);
32010 0           SPAGAIN;
32011 0           nfound_SV = POPs;
32012 0           PUTBACK;
32013 0           nfound = PDL->SvPDLV(nfound_SV);
32014             }
32015             }
32016             else {
32017 0           croak ("Usage: PDL::kcluster(nclusters,data,mask,weight,npass,clusterids,error,nfound,distFlag,ctrMethodFlag) (you may leave temporaries or output variables out of list)");
32018             }
32019             }
32020             {
32021             }
32022             { pdl_kcluster_struct *__privtrans;
32023 3           int badflag_cache = 0;
32024 3           __privtrans = malloc(sizeof(*__privtrans));
32025 3           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32026 3           PDL_TR_SETMAGIC(__privtrans);
32027 3           __privtrans->flags = 0;
32028 3           __privtrans->__ddone = 0;
32029 3           __privtrans->vtable = &pdl_kcluster_vtable;
32030 3           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32031 3           __privtrans->bvalflag = 0;
32032 3 50         badflag_cache = ((nclusters->state & PDL_BADVAL) > 0) || ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((npass->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
32033 3 50         if (badflag_cache) __privtrans->bvalflag = 1;
32034 3 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32035 0 0         else if(__privtrans->__datatype == PDL_S) {}
32036 0 0         else if(__privtrans->__datatype == PDL_U) {}
32037 0 0         else if(__privtrans->__datatype == PDL_L) {}
32038 0 0         else if(__privtrans->__datatype == PDL_N) {}
32039 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32040 0 0         else if(__privtrans->__datatype == PDL_F) {}
32041 0 0         else if(__privtrans->__datatype == PDL_D) {}
32042 0           else __privtrans->__datatype = PDL_D;
32043 3 50         if(PDL_L != nclusters->datatype) {
32044 3           nclusters = PDL->get_convertedpdl(nclusters,PDL_L);
32045 3 50         }if(PDL_D != data->datatype) {
32046 0           data = PDL->get_convertedpdl(data,PDL_D);
32047 3 50         }if(PDL_L != mask->datatype) {
32048 3           mask = PDL->get_convertedpdl(mask,PDL_L);
32049 3 50         }if(PDL_D != weight->datatype) {
32050 0           weight = PDL->get_convertedpdl(weight,PDL_D);
32051 3 50         }if(PDL_L != npass->datatype) {
32052 3           npass = PDL->get_convertedpdl(npass,PDL_L);
32053 3 100         }if( (clusterids->state & PDL_NOMYDIMS) && clusterids->trans == NULL ) {
    50          
32054 2           clusterids->datatype = PDL_L;
32055 1 50         } else if(PDL_L != clusterids->datatype) {
32056 1           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
32057 3 50         }if( (error->state & PDL_NOMYDIMS) && error->trans == NULL ) {
    50          
32058 3           error->datatype = PDL_D;
32059 0 0         } else if(PDL_D != error->datatype) {
32060 0           error = PDL->get_convertedpdl(error,PDL_D);
32061 3 50         }if( (nfound->state & PDL_NOMYDIMS) && nfound->trans == NULL ) {
    50          
32062 3           nfound->datatype = PDL_L;
32063 0 0         } else if(PDL_L != nfound->datatype) {
32064 0           nfound = PDL->get_convertedpdl(nfound,PDL_L);
32065 3           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->ctrMethodFlag) = malloc(strlen(ctrMethodFlag)+1); strcpy(__privtrans->ctrMethodFlag,ctrMethodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = nclusters;
32066 3           __privtrans->pdls[1] = data;
32067 3           __privtrans->pdls[2] = mask;
32068 3           __privtrans->pdls[3] = weight;
32069 3           __privtrans->pdls[4] = npass;
32070 3           __privtrans->pdls[5] = clusterids;
32071 3           __privtrans->pdls[6] = error;
32072 3           __privtrans->pdls[7] = nfound;
32073 3           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32074 3 50         if (badflag_cache) {
32075 0           clusterids->state |= PDL_BADVAL;
32076 0           error->state |= PDL_BADVAL;
32077 0           nfound->state |= PDL_BADVAL;
32078             }
32079 3 50         if (nreturn) {
32080 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32081 0           ST(0) = clusterids_SV;
32082 0           ST(1) = error_SV;
32083 0           ST(2) = nfound_SV;
32084 0           XSRETURN(nreturn);
32085             } else {
32086 3           XSRETURN(0);
32087             }
32088             }
32089              
32090             void
32091             kmedoids(...)
32092             PREINIT:
32093 2           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32094             by pp_bless ? (CS) */
32095 2           HV *bless_stash = 0;
32096 2           SV *parent = 0;
32097             int nreturn;
32098             SV *clusterids_SV;
32099             SV *error_SV;
32100             SV *nfound_SV;
32101             pdl *nclusters;
32102             pdl *distance;
32103             pdl *npass;
32104             pdl *clusterids;
32105             pdl *error;
32106             pdl *nfound;
32107             PPCODE:
32108             {
32109             PDL_COMMENT("Check if you can get a package name for this input value. ")
32110             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32111             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32112 2 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
32113 0           parent = ST(0);
32114 0 0         if (sv_isobject(parent)){
32115 0           bless_stash = SvSTASH(SvRV(ST(0)));
32116 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
32117             }
32118             }
32119 2 50         if (items == 6) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32120 2           nreturn = 0;
32121 2           nclusters = PDL->SvPDLV(ST(0));
32122 2           distance = PDL->SvPDLV(ST(1));
32123 2           npass = PDL->SvPDLV(ST(2));
32124 2           clusterids = PDL->SvPDLV(ST(3));
32125 2           error = PDL->SvPDLV(ST(4));
32126 2           nfound = PDL->SvPDLV(ST(5));
32127             }
32128 0 0         else if (items == 3) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32129 0           nreturn = 3;
32130 0           nclusters = PDL->SvPDLV(ST(0));
32131 0           distance = PDL->SvPDLV(ST(1));
32132 0           npass = PDL->SvPDLV(ST(2));
32133 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32134 0           clusterids_SV = sv_newmortal();
32135 0           clusterids = PDL->null();
32136 0           PDL->SetSV_PDL(clusterids_SV,clusterids);
32137 0 0         if (bless_stash) clusterids_SV = sv_bless(clusterids_SV, bless_stash);
32138             } else {
32139 0 0         PUSHMARK(SP);
32140 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32141 0           PUTBACK;
32142 0           perl_call_method("initialize", G_SCALAR);
32143 0           SPAGAIN;
32144 0           clusterids_SV = POPs;
32145 0           PUTBACK;
32146 0           clusterids = PDL->SvPDLV(clusterids_SV);
32147             }
32148 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32149 0           error_SV = sv_newmortal();
32150 0           error = PDL->null();
32151 0           PDL->SetSV_PDL(error_SV,error);
32152 0 0         if (bless_stash) error_SV = sv_bless(error_SV, bless_stash);
32153             } else {
32154 0 0         PUSHMARK(SP);
32155 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32156 0           PUTBACK;
32157 0           perl_call_method("initialize", G_SCALAR);
32158 0           SPAGAIN;
32159 0           error_SV = POPs;
32160 0           PUTBACK;
32161 0           error = PDL->SvPDLV(error_SV);
32162             }
32163 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32164 0           nfound_SV = sv_newmortal();
32165 0           nfound = PDL->null();
32166 0           PDL->SetSV_PDL(nfound_SV,nfound);
32167 0 0         if (bless_stash) nfound_SV = sv_bless(nfound_SV, bless_stash);
32168             } else {
32169 0 0         PUSHMARK(SP);
32170 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32171 0           PUTBACK;
32172 0           perl_call_method("initialize", G_SCALAR);
32173 0           SPAGAIN;
32174 0           nfound_SV = POPs;
32175 0           PUTBACK;
32176 0           nfound = PDL->SvPDLV(nfound_SV);
32177             }
32178             }
32179             else {
32180 0           croak ("Usage: PDL::kmedoids(nclusters,distance,npass,clusterids,error,nfound) (you may leave temporaries or output variables out of list)");
32181             }
32182             }
32183             {
32184             }
32185             { pdl_kmedoids_struct *__privtrans;
32186 2           int badflag_cache = 0;
32187 2           __privtrans = malloc(sizeof(*__privtrans));
32188 2           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32189 2           PDL_TR_SETMAGIC(__privtrans);
32190 2           __privtrans->flags = 0;
32191 2           __privtrans->__ddone = 0;
32192 2           __privtrans->vtable = &pdl_kmedoids_vtable;
32193 2           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32194 2           __privtrans->bvalflag = 0;
32195 2 50         badflag_cache = ((nclusters->state & PDL_BADVAL) > 0) || ((distance->state & PDL_BADVAL) > 0) || ((npass->state & PDL_BADVAL) > 0);
    50          
    50          
32196 2 50         if (badflag_cache) __privtrans->bvalflag = 1;
32197 2 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32198 0 0         else if(__privtrans->__datatype == PDL_S) {}
32199 0 0         else if(__privtrans->__datatype == PDL_U) {}
32200 0 0         else if(__privtrans->__datatype == PDL_L) {}
32201 0 0         else if(__privtrans->__datatype == PDL_N) {}
32202 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32203 0 0         else if(__privtrans->__datatype == PDL_F) {}
32204 0 0         else if(__privtrans->__datatype == PDL_D) {}
32205 0           else __privtrans->__datatype = PDL_D;
32206 2 50         if(PDL_L != nclusters->datatype) {
32207 2           nclusters = PDL->get_convertedpdl(nclusters,PDL_L);
32208 2 50         }if(PDL_D != distance->datatype) {
32209 0           distance = PDL->get_convertedpdl(distance,PDL_D);
32210 2 50         }if(PDL_L != npass->datatype) {
32211 2           npass = PDL->get_convertedpdl(npass,PDL_L);
32212 2 50         }if( (clusterids->state & PDL_NOMYDIMS) && clusterids->trans == NULL ) {
    0          
32213 0           clusterids->datatype = PDL_L;
32214 2 50         } else if(PDL_L != clusterids->datatype) {
32215 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
32216 2 50         }if( (error->state & PDL_NOMYDIMS) && error->trans == NULL ) {
    0          
32217 0           error->datatype = PDL_D;
32218 2 50         } else if(PDL_D != error->datatype) {
32219 0           error = PDL->get_convertedpdl(error,PDL_D);
32220 2 50         }if( (nfound->state & PDL_NOMYDIMS) && nfound->trans == NULL ) {
    0          
32221 0           nfound->datatype = PDL_L;
32222 2 50         } else if(PDL_L != nfound->datatype) {
32223 2           nfound = PDL->get_convertedpdl(nfound,PDL_L);
32224 2           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = nclusters;
32225 2           __privtrans->pdls[1] = distance;
32226 2           __privtrans->pdls[2] = npass;
32227 2           __privtrans->pdls[3] = clusterids;
32228 2           __privtrans->pdls[4] = error;
32229 2           __privtrans->pdls[5] = nfound;
32230 2           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32231 2 50         if (badflag_cache) {
32232 0           clusterids->state |= PDL_BADVAL;
32233 0           error->state |= PDL_BADVAL;
32234 0           nfound->state |= PDL_BADVAL;
32235             }
32236 2 50         if (nreturn) {
32237 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32238 0           ST(0) = clusterids_SV;
32239 0           ST(1) = error_SV;
32240 0           ST(2) = nfound_SV;
32241 0           XSRETURN(nreturn);
32242             } else {
32243 2           XSRETURN(0);
32244             }
32245             }
32246              
32247             void
32248             treecluster(...)
32249             PREINIT:
32250 8           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32251             by pp_bless ? (CS) */
32252 8           HV *bless_stash = 0;
32253 8           SV *parent = 0;
32254             int nreturn;
32255             SV *tree_SV;
32256             SV *lnkdist_SV;
32257             pdl *data;
32258             pdl *mask;
32259             pdl *weight;
32260             pdl *tree;
32261             pdl *lnkdist;
32262             char *distFlag;
32263             char *methodFlag;
32264             PPCODE:
32265             {
32266             PDL_COMMENT("Check if you can get a package name for this input value. ")
32267             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32268             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32269 8 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
32270 8           parent = ST(0);
32271 8 50         if (sv_isobject(parent)){
32272 8           bless_stash = SvSTASH(SvRV(ST(0)));
32273 8 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
32274             }
32275             }
32276 8 50         if (items == 7) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32277 8           nreturn = 0;
32278 8           data = PDL->SvPDLV(ST(0));
32279 8           mask = PDL->SvPDLV(ST(1));
32280 8           weight = PDL->SvPDLV(ST(2));
32281 8           tree = PDL->SvPDLV(ST(3));
32282 8           lnkdist = PDL->SvPDLV(ST(4));
32283 8 50         distFlag = (char *)SvPV_nolen(ST(5))
32284             ;
32285 8 50         methodFlag = (char *)SvPV_nolen(ST(6))
32286             ;
32287             }
32288 0 0         else if (items == 5) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32289 0           nreturn = 2;
32290 0           data = PDL->SvPDLV(ST(0));
32291 0           mask = PDL->SvPDLV(ST(1));
32292 0           weight = PDL->SvPDLV(ST(2));
32293 0 0         distFlag = (char *)SvPV_nolen(ST(3))
32294             ;
32295 0 0         methodFlag = (char *)SvPV_nolen(ST(4))
32296             ;
32297 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32298 0           tree_SV = sv_newmortal();
32299 0           tree = PDL->null();
32300 0           PDL->SetSV_PDL(tree_SV,tree);
32301 0 0         if (bless_stash) tree_SV = sv_bless(tree_SV, bless_stash);
32302             } else {
32303 0 0         PUSHMARK(SP);
32304 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32305 0           PUTBACK;
32306 0           perl_call_method("initialize", G_SCALAR);
32307 0           SPAGAIN;
32308 0           tree_SV = POPs;
32309 0           PUTBACK;
32310 0           tree = PDL->SvPDLV(tree_SV);
32311             }
32312 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32313 0           lnkdist_SV = sv_newmortal();
32314 0           lnkdist = PDL->null();
32315 0           PDL->SetSV_PDL(lnkdist_SV,lnkdist);
32316 0 0         if (bless_stash) lnkdist_SV = sv_bless(lnkdist_SV, bless_stash);
32317             } else {
32318 0 0         PUSHMARK(SP);
32319 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32320 0           PUTBACK;
32321 0           perl_call_method("initialize", G_SCALAR);
32322 0           SPAGAIN;
32323 0           lnkdist_SV = POPs;
32324 0           PUTBACK;
32325 0           lnkdist = PDL->SvPDLV(lnkdist_SV);
32326             }
32327             }
32328             else {
32329 0           croak ("Usage: PDL::treecluster(data,mask,weight,tree,lnkdist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
32330             }
32331             }
32332             {
32333             }
32334             { pdl_treecluster_struct *__privtrans;
32335 8           int badflag_cache = 0;
32336 8           __privtrans = malloc(sizeof(*__privtrans));
32337 8           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32338 8           PDL_TR_SETMAGIC(__privtrans);
32339 8           __privtrans->flags = 0;
32340 8           __privtrans->__ddone = 0;
32341 8           __privtrans->vtable = &pdl_treecluster_vtable;
32342 8           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32343 8           __privtrans->bvalflag = 0;
32344 8 50         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0);
    50          
    50          
32345 8 50         if (badflag_cache) __privtrans->bvalflag = 1;
32346 8 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32347 0 0         else if(__privtrans->__datatype == PDL_S) {}
32348 0 0         else if(__privtrans->__datatype == PDL_U) {}
32349 0 0         else if(__privtrans->__datatype == PDL_L) {}
32350 0 0         else if(__privtrans->__datatype == PDL_N) {}
32351 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32352 0 0         else if(__privtrans->__datatype == PDL_F) {}
32353 0 0         else if(__privtrans->__datatype == PDL_D) {}
32354 0           else __privtrans->__datatype = PDL_D;
32355 8 50         if(PDL_D != data->datatype) {
32356 0           data = PDL->get_convertedpdl(data,PDL_D);
32357 8 50         }if(PDL_L != mask->datatype) {
32358 8           mask = PDL->get_convertedpdl(mask,PDL_L);
32359 8 50         }if(PDL_D != weight->datatype) {
32360 0           weight = PDL->get_convertedpdl(weight,PDL_D);
32361 8 50         }if( (tree->state & PDL_NOMYDIMS) && tree->trans == NULL ) {
    0          
32362 0           tree->datatype = PDL_L;
32363 8 50         } else if(PDL_L != tree->datatype) {
32364 0           tree = PDL->get_convertedpdl(tree,PDL_L);
32365 8 50         }if( (lnkdist->state & PDL_NOMYDIMS) && lnkdist->trans == NULL ) {
    0          
32366 0           lnkdist->datatype = PDL_D;
32367 8 50         } else if(PDL_D != lnkdist->datatype) {
32368 0           lnkdist = PDL->get_convertedpdl(lnkdist,PDL_D);
32369 8           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
32370 8           __privtrans->pdls[1] = mask;
32371 8           __privtrans->pdls[2] = weight;
32372 8           __privtrans->pdls[3] = tree;
32373 8           __privtrans->pdls[4] = lnkdist;
32374 8           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32375 8 50         if (badflag_cache) {
32376 0           tree->state |= PDL_BADVAL;
32377 0           lnkdist->state |= PDL_BADVAL;
32378             }
32379 8 50         if (nreturn) {
32380 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32381 0           ST(0) = tree_SV;
32382 0           ST(1) = lnkdist_SV;
32383 0           XSRETURN(nreturn);
32384             } else {
32385 8           XSRETURN(0);
32386             }
32387             }
32388              
32389             void
32390             treeclusterd(...)
32391             PREINIT:
32392 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32393             by pp_bless ? (CS) */
32394 0           HV *bless_stash = 0;
32395 0           SV *parent = 0;
32396             int nreturn;
32397             SV *tree_SV;
32398             SV *lnkdist_SV;
32399             pdl *data;
32400             pdl *mask;
32401             pdl *weight;
32402             pdl *distances;
32403             pdl *tree;
32404             pdl *lnkdist;
32405             char *distFlag;
32406             char *methodFlag;
32407             PPCODE:
32408             {
32409             PDL_COMMENT("Check if you can get a package name for this input value. ")
32410             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32411             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32412 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
32413 0           parent = ST(0);
32414 0 0         if (sv_isobject(parent)){
32415 0           bless_stash = SvSTASH(SvRV(ST(0)));
32416 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
32417             }
32418             }
32419 0 0         if (items == 8) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32420 0           nreturn = 0;
32421 0           data = PDL->SvPDLV(ST(0));
32422 0           mask = PDL->SvPDLV(ST(1));
32423 0           weight = PDL->SvPDLV(ST(2));
32424 0           distances = PDL->SvPDLV(ST(3));
32425 0           tree = PDL->SvPDLV(ST(4));
32426 0           lnkdist = PDL->SvPDLV(ST(5));
32427 0 0         distFlag = (char *)SvPV_nolen(ST(6))
32428             ;
32429 0 0         methodFlag = (char *)SvPV_nolen(ST(7))
32430             ;
32431             }
32432 0 0         else if (items == 6) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32433 0           nreturn = 2;
32434 0           data = PDL->SvPDLV(ST(0));
32435 0           mask = PDL->SvPDLV(ST(1));
32436 0           weight = PDL->SvPDLV(ST(2));
32437 0           distances = PDL->SvPDLV(ST(3));
32438 0 0         distFlag = (char *)SvPV_nolen(ST(4))
32439             ;
32440 0 0         methodFlag = (char *)SvPV_nolen(ST(5))
32441             ;
32442 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32443 0           tree_SV = sv_newmortal();
32444 0           tree = PDL->null();
32445 0           PDL->SetSV_PDL(tree_SV,tree);
32446 0 0         if (bless_stash) tree_SV = sv_bless(tree_SV, bless_stash);
32447             } else {
32448 0 0         PUSHMARK(SP);
32449 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32450 0           PUTBACK;
32451 0           perl_call_method("initialize", G_SCALAR);
32452 0           SPAGAIN;
32453 0           tree_SV = POPs;
32454 0           PUTBACK;
32455 0           tree = PDL->SvPDLV(tree_SV);
32456             }
32457 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32458 0           lnkdist_SV = sv_newmortal();
32459 0           lnkdist = PDL->null();
32460 0           PDL->SetSV_PDL(lnkdist_SV,lnkdist);
32461 0 0         if (bless_stash) lnkdist_SV = sv_bless(lnkdist_SV, bless_stash);
32462             } else {
32463 0 0         PUSHMARK(SP);
32464 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32465 0           PUTBACK;
32466 0           perl_call_method("initialize", G_SCALAR);
32467 0           SPAGAIN;
32468 0           lnkdist_SV = POPs;
32469 0           PUTBACK;
32470 0           lnkdist = PDL->SvPDLV(lnkdist_SV);
32471             }
32472             }
32473             else {
32474 0           croak ("Usage: PDL::treeclusterd(data,mask,weight,distances,tree,lnkdist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
32475             }
32476             }
32477             {
32478             }
32479             { pdl_treeclusterd_struct *__privtrans;
32480 0           int badflag_cache = 0;
32481 0           __privtrans = malloc(sizeof(*__privtrans));
32482 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32483 0           PDL_TR_SETMAGIC(__privtrans);
32484 0           __privtrans->flags = 0;
32485 0           __privtrans->__ddone = 0;
32486 0           __privtrans->vtable = &pdl_treeclusterd_vtable;
32487 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32488 0           __privtrans->bvalflag = 0;
32489 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((distances->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
32490 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
32491 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32492 0 0         else if(__privtrans->__datatype == PDL_S) {}
32493 0 0         else if(__privtrans->__datatype == PDL_U) {}
32494 0 0         else if(__privtrans->__datatype == PDL_L) {}
32495 0 0         else if(__privtrans->__datatype == PDL_N) {}
32496 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32497 0 0         else if(__privtrans->__datatype == PDL_F) {}
32498 0 0         else if(__privtrans->__datatype == PDL_D) {}
32499 0           else __privtrans->__datatype = PDL_D;
32500 0 0         if(PDL_D != data->datatype) {
32501 0           data = PDL->get_convertedpdl(data,PDL_D);
32502 0 0         }if(PDL_L != mask->datatype) {
32503 0           mask = PDL->get_convertedpdl(mask,PDL_L);
32504 0 0         }if(PDL_D != weight->datatype) {
32505 0           weight = PDL->get_convertedpdl(weight,PDL_D);
32506 0 0         }if(PDL_D != distances->datatype) {
32507 0           distances = PDL->get_convertedpdl(distances,PDL_D);
32508 0 0         }if( (tree->state & PDL_NOMYDIMS) && tree->trans == NULL ) {
    0          
32509 0           tree->datatype = PDL_L;
32510 0 0         } else if(PDL_L != tree->datatype) {
32511 0           tree = PDL->get_convertedpdl(tree,PDL_L);
32512 0 0         }if( (lnkdist->state & PDL_NOMYDIMS) && lnkdist->trans == NULL ) {
    0          
32513 0           lnkdist->datatype = PDL_D;
32514 0 0         } else if(PDL_D != lnkdist->datatype) {
32515 0           lnkdist = PDL->get_convertedpdl(lnkdist,PDL_D);
32516 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
32517 0           __privtrans->pdls[1] = mask;
32518 0           __privtrans->pdls[2] = weight;
32519 0           __privtrans->pdls[3] = distances;
32520 0           __privtrans->pdls[4] = tree;
32521 0           __privtrans->pdls[5] = lnkdist;
32522 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32523 0 0         if (badflag_cache) {
32524 0           tree->state |= PDL_BADVAL;
32525 0           lnkdist->state |= PDL_BADVAL;
32526             }
32527 0 0         if (nreturn) {
32528 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32529 0           ST(0) = tree_SV;
32530 0           ST(1) = lnkdist_SV;
32531 0           XSRETURN(nreturn);
32532             } else {
32533 0           XSRETURN(0);
32534             }
32535             }
32536              
32537             void
32538             cuttree(...)
32539             PREINIT:
32540 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32541             by pp_bless ? (CS) */
32542 0           HV *bless_stash = 0;
32543 0           SV *parent = 0;
32544             int nreturn;
32545             SV *clusterids_SV;
32546             pdl *tree;
32547             pdl *nclusters;
32548             pdl *clusterids;
32549             PPCODE:
32550             {
32551             PDL_COMMENT("Check if you can get a package name for this input value. ")
32552             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32553             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32554 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
32555 0           parent = ST(0);
32556 0 0         if (sv_isobject(parent)){
32557 0           bless_stash = SvSTASH(SvRV(ST(0)));
32558 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
32559             }
32560             }
32561 0 0         if (items == 3) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32562 0           nreturn = 0;
32563 0           tree = PDL->SvPDLV(ST(0));
32564 0           nclusters = PDL->SvPDLV(ST(1));
32565 0           clusterids = PDL->SvPDLV(ST(2));
32566             }
32567 0 0         else if (items == 2) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32568 0           nreturn = 1;
32569 0           tree = PDL->SvPDLV(ST(0));
32570 0           nclusters = PDL->SvPDLV(ST(1));
32571 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32572 0           clusterids_SV = sv_newmortal();
32573 0           clusterids = PDL->null();
32574 0           PDL->SetSV_PDL(clusterids_SV,clusterids);
32575 0 0         if (bless_stash) clusterids_SV = sv_bless(clusterids_SV, bless_stash);
32576             } else {
32577 0 0         PUSHMARK(SP);
32578 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32579 0           PUTBACK;
32580 0           perl_call_method("initialize", G_SCALAR);
32581 0           SPAGAIN;
32582 0           clusterids_SV = POPs;
32583 0           PUTBACK;
32584 0           clusterids = PDL->SvPDLV(clusterids_SV);
32585             }
32586             }
32587             else {
32588 0           croak ("Usage: PDL::cuttree(tree,nclusters,clusterids) (you may leave temporaries or output variables out of list)");
32589             }
32590             }
32591             {
32592             }
32593             { pdl_cuttree_struct *__privtrans;
32594 0           int badflag_cache = 0;
32595 0           __privtrans = malloc(sizeof(*__privtrans));
32596 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32597 0           PDL_TR_SETMAGIC(__privtrans);
32598 0           __privtrans->flags = 0;
32599 0           __privtrans->__ddone = 0;
32600 0           __privtrans->vtable = &pdl_cuttree_vtable;
32601 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32602 0           __privtrans->bvalflag = 0;
32603 0 0         badflag_cache = ((tree->state & PDL_BADVAL) > 0) || ((nclusters->state & PDL_BADVAL) > 0);
    0          
32604 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
32605 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32606 0 0         else if(__privtrans->__datatype == PDL_S) {}
32607 0 0         else if(__privtrans->__datatype == PDL_U) {}
32608 0 0         else if(__privtrans->__datatype == PDL_L) {}
32609 0 0         else if(__privtrans->__datatype == PDL_N) {}
32610 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32611 0 0         else if(__privtrans->__datatype == PDL_F) {}
32612 0 0         else if(__privtrans->__datatype == PDL_D) {}
32613 0           else __privtrans->__datatype = PDL_D;
32614 0 0         if(PDL_L != tree->datatype) {
32615 0           tree = PDL->get_convertedpdl(tree,PDL_L);
32616 0 0         }if(PDL_L != nclusters->datatype) {
32617 0           nclusters = PDL->get_convertedpdl(nclusters,PDL_L);
32618 0 0         }if( (clusterids->state & PDL_NOMYDIMS) && clusterids->trans == NULL ) {
    0          
32619 0           clusterids->datatype = PDL_L;
32620 0 0         } else if(PDL_L != clusterids->datatype) {
32621 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
32622 0           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = tree;
32623 0           __privtrans->pdls[1] = nclusters;
32624 0           __privtrans->pdls[2] = clusterids;
32625 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32626 0 0         if (badflag_cache) {
32627 0           clusterids->state |= PDL_BADVAL;
32628             }
32629 0 0         if (nreturn) {
32630 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32631 0           ST(0) = clusterids_SV;
32632 0           XSRETURN(nreturn);
32633             } else {
32634 0           XSRETURN(0);
32635             }
32636             }
32637              
32638             void
32639             somcluster(...)
32640             PREINIT:
32641 2           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32642             by pp_bless ? (CS) */
32643 2           HV *bless_stash = 0;
32644 2           SV *parent = 0;
32645             int nreturn;
32646             SV *clusterids_SV;
32647             pdl *data;
32648             pdl *mask;
32649             pdl *weight;
32650             pdl *nxnodes;
32651             pdl *nynodes;
32652             pdl *inittau;
32653             pdl *niter;
32654             pdl *clusterids;
32655             char *distFlag;
32656             PPCODE:
32657             {
32658             PDL_COMMENT("Check if you can get a package name for this input value. ")
32659             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32660             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32661 2 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
32662 2           parent = ST(0);
32663 2 50         if (sv_isobject(parent)){
32664 2           bless_stash = SvSTASH(SvRV(ST(0)));
32665 2 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
32666             }
32667             }
32668 2 50         if (items == 9) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32669 2           nreturn = 0;
32670 2           data = PDL->SvPDLV(ST(0));
32671 2           mask = PDL->SvPDLV(ST(1));
32672 2           weight = PDL->SvPDLV(ST(2));
32673 2           nxnodes = PDL->SvPDLV(ST(3));
32674 2           nynodes = PDL->SvPDLV(ST(4));
32675 2           inittau = PDL->SvPDLV(ST(5));
32676 2           niter = PDL->SvPDLV(ST(6));
32677 2           clusterids = PDL->SvPDLV(ST(7));
32678 2 50         distFlag = (char *)SvPV_nolen(ST(8))
32679             ;
32680             }
32681 0 0         else if (items == 8) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32682 0           nreturn = 1;
32683 0           data = PDL->SvPDLV(ST(0));
32684 0           mask = PDL->SvPDLV(ST(1));
32685 0           weight = PDL->SvPDLV(ST(2));
32686 0           nxnodes = PDL->SvPDLV(ST(3));
32687 0           nynodes = PDL->SvPDLV(ST(4));
32688 0           inittau = PDL->SvPDLV(ST(5));
32689 0           niter = PDL->SvPDLV(ST(6));
32690 0 0         distFlag = (char *)SvPV_nolen(ST(7))
32691             ;
32692 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32693 0           clusterids_SV = sv_newmortal();
32694 0           clusterids = PDL->null();
32695 0           PDL->SetSV_PDL(clusterids_SV,clusterids);
32696 0 0         if (bless_stash) clusterids_SV = sv_bless(clusterids_SV, bless_stash);
32697             } else {
32698 0 0         PUSHMARK(SP);
32699 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32700 0           PUTBACK;
32701 0           perl_call_method("initialize", G_SCALAR);
32702 0           SPAGAIN;
32703 0           clusterids_SV = POPs;
32704 0           PUTBACK;
32705 0           clusterids = PDL->SvPDLV(clusterids_SV);
32706             }
32707             }
32708             else {
32709 0           croak ("Usage: PDL::somcluster(data,mask,weight,nxnodes,nynodes,inittau,niter,clusterids,distFlag) (you may leave temporaries or output variables out of list)");
32710             }
32711             }
32712             {
32713             }
32714             { pdl_somcluster_struct *__privtrans;
32715 2           int badflag_cache = 0;
32716 2           __privtrans = malloc(sizeof(*__privtrans));
32717 2           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32718 2           PDL_TR_SETMAGIC(__privtrans);
32719 2           __privtrans->flags = 0;
32720 2           __privtrans->__ddone = 0;
32721 2           __privtrans->vtable = &pdl_somcluster_vtable;
32722 2           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32723 2           __privtrans->bvalflag = 0;
32724 2 50         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((nxnodes->state & PDL_BADVAL) > 0) || ((nynodes->state & PDL_BADVAL) > 0) || ((inittau->state & PDL_BADVAL) > 0) || ((niter->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
    50          
    50          
32725 2 50         if (badflag_cache) __privtrans->bvalflag = 1;
32726 2 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32727 0 0         else if(__privtrans->__datatype == PDL_S) {}
32728 0 0         else if(__privtrans->__datatype == PDL_U) {}
32729 0 0         else if(__privtrans->__datatype == PDL_L) {}
32730 0 0         else if(__privtrans->__datatype == PDL_N) {}
32731 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32732 0 0         else if(__privtrans->__datatype == PDL_F) {}
32733 0 0         else if(__privtrans->__datatype == PDL_D) {}
32734 0           else __privtrans->__datatype = PDL_D;
32735 2 50         if(PDL_D != data->datatype) {
32736 0           data = PDL->get_convertedpdl(data,PDL_D);
32737 2 50         }if(PDL_L != mask->datatype) {
32738 2           mask = PDL->get_convertedpdl(mask,PDL_L);
32739 2 50         }if(PDL_D != weight->datatype) {
32740 0           weight = PDL->get_convertedpdl(weight,PDL_D);
32741 2 50         }if(PDL_L != nxnodes->datatype) {
32742 2           nxnodes = PDL->get_convertedpdl(nxnodes,PDL_L);
32743 2 50         }if(PDL_L != nynodes->datatype) {
32744 2           nynodes = PDL->get_convertedpdl(nynodes,PDL_L);
32745 2 50         }if(PDL_D != inittau->datatype) {
32746 0           inittau = PDL->get_convertedpdl(inittau,PDL_D);
32747 2 50         }if(PDL_L != niter->datatype) {
32748 2           niter = PDL->get_convertedpdl(niter,PDL_L);
32749 2 50         }if( (clusterids->state & PDL_NOMYDIMS) && clusterids->trans == NULL ) {
    0          
32750 0           clusterids->datatype = PDL_L;
32751 2 50         } else if(PDL_L != clusterids->datatype) {
32752 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
32753 2           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
32754 2           __privtrans->pdls[1] = mask;
32755 2           __privtrans->pdls[2] = weight;
32756 2           __privtrans->pdls[3] = nxnodes;
32757 2           __privtrans->pdls[4] = nynodes;
32758 2           __privtrans->pdls[5] = inittau;
32759 2           __privtrans->pdls[6] = niter;
32760 2           __privtrans->pdls[7] = clusterids;
32761 2           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32762 2 50         if (badflag_cache) {
32763 0           clusterids->state |= PDL_BADVAL;
32764             }
32765 2 50         if (nreturn) {
32766 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32767 0           ST(0) = clusterids_SV;
32768 0           XSRETURN(nreturn);
32769             } else {
32770 2           XSRETURN(0);
32771             }
32772             }
32773              
32774             void
32775             pca(...)
32776             PREINIT:
32777 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32778             by pp_bless ? (CS) */
32779 0           HV *bless_stash = 0;
32780 0           SV *parent = 0;
32781             int nreturn;
32782             SV *U_SV;
32783             SV *S_SV;
32784             SV *V_SV;
32785             pdl *U;
32786             pdl *S;
32787             pdl *V;
32788             PPCODE:
32789             {
32790             PDL_COMMENT("Check if you can get a package name for this input value. ")
32791             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32792             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32793 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
32794 0           parent = ST(0);
32795 0 0         if (sv_isobject(parent)){
32796 0           bless_stash = SvSTASH(SvRV(ST(0)));
32797 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
32798             }
32799             }
32800 0 0         if (items == 3) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32801 0           nreturn = 0;
32802 0           U = PDL->SvPDLV(ST(0));
32803 0           S = PDL->SvPDLV(ST(1));
32804 0           V = PDL->SvPDLV(ST(2));
32805             }
32806 0 0         else if (items == 0) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32807 0           nreturn = 3;
32808 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32809 0           U_SV = sv_newmortal();
32810 0           U = PDL->null();
32811 0           PDL->SetSV_PDL(U_SV,U);
32812 0 0         if (bless_stash) U_SV = sv_bless(U_SV, bless_stash);
32813             } else {
32814 0 0         PUSHMARK(SP);
32815 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32816 0           PUTBACK;
32817 0           perl_call_method("initialize", G_SCALAR);
32818 0           SPAGAIN;
32819 0           U_SV = POPs;
32820 0           PUTBACK;
32821 0           U = PDL->SvPDLV(U_SV);
32822             }
32823 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32824 0           S_SV = sv_newmortal();
32825 0           S = PDL->null();
32826 0           PDL->SetSV_PDL(S_SV,S);
32827 0 0         if (bless_stash) S_SV = sv_bless(S_SV, bless_stash);
32828             } else {
32829 0 0         PUSHMARK(SP);
32830 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32831 0           PUTBACK;
32832 0           perl_call_method("initialize", G_SCALAR);
32833 0           SPAGAIN;
32834 0           S_SV = POPs;
32835 0           PUTBACK;
32836 0           S = PDL->SvPDLV(S_SV);
32837             }
32838 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32839 0           V_SV = sv_newmortal();
32840 0           V = PDL->null();
32841 0           PDL->SetSV_PDL(V_SV,V);
32842 0 0         if (bless_stash) V_SV = sv_bless(V_SV, bless_stash);
32843             } else {
32844 0 0         PUSHMARK(SP);
32845 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32846 0           PUTBACK;
32847 0           perl_call_method("initialize", G_SCALAR);
32848 0           SPAGAIN;
32849 0           V_SV = POPs;
32850 0           PUTBACK;
32851 0           V = PDL->SvPDLV(V_SV);
32852             }
32853             }
32854             else {
32855 0           croak ("Usage: PDL::pca(U,S,V) (you may leave temporaries or output variables out of list)");
32856             }
32857             }
32858             {
32859             }
32860             { pdl_pca_struct *__privtrans;
32861 0           int badflag_cache = 0;
32862 0           __privtrans = malloc(sizeof(*__privtrans));
32863 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32864 0           PDL_TR_SETMAGIC(__privtrans);
32865 0           __privtrans->flags = 0;
32866 0           __privtrans->__ddone = 0;
32867 0           __privtrans->vtable = &pdl_pca_vtable;
32868 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32869 0           __privtrans->bvalflag = 0;
32870 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32871 0 0         else if(__privtrans->__datatype == PDL_S) {}
32872 0 0         else if(__privtrans->__datatype == PDL_U) {}
32873 0 0         else if(__privtrans->__datatype == PDL_L) {}
32874 0 0         else if(__privtrans->__datatype == PDL_N) {}
32875 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32876 0 0         else if(__privtrans->__datatype == PDL_F) {}
32877 0 0         else if(__privtrans->__datatype == PDL_D) {}
32878 0           else __privtrans->__datatype = PDL_D;
32879 0 0         if( (U->state & PDL_NOMYDIMS) && U->trans == NULL ) {
    0          
32880 0           U->datatype = PDL_D;
32881 0 0         } else if(PDL_D != U->datatype) {
32882 0           U = PDL->get_convertedpdl(U,PDL_D);
32883 0 0         }if( (S->state & PDL_NOMYDIMS) && S->trans == NULL ) {
    0          
32884 0           S->datatype = PDL_D;
32885 0 0         } else if(PDL_D != S->datatype) {
32886 0           S = PDL->get_convertedpdl(S,PDL_D);
32887 0 0         }if( (V->state & PDL_NOMYDIMS) && V->trans == NULL ) {
    0          
32888 0           V->datatype = PDL_D;
32889 0 0         } else if(PDL_D != V->datatype) {
32890 0           V = PDL->get_convertedpdl(V,PDL_D);
32891 0           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = U;
32892 0           __privtrans->pdls[1] = S;
32893 0           __privtrans->pdls[2] = V;
32894 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
32895 0 0         if (badflag_cache) {
32896 0           U->state |= PDL_BADVAL;
32897 0           S->state |= PDL_BADVAL;
32898 0           V->state |= PDL_BADVAL;
32899             }
32900 0 0         if (nreturn) {
32901 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
32902 0           ST(0) = U_SV;
32903 0           ST(1) = S_SV;
32904 0           ST(2) = V_SV;
32905 0           XSRETURN(nreturn);
32906             } else {
32907 0           XSRETURN(0);
32908             }
32909             }
32910              
32911             void
32912             rowdistances(...)
32913             PREINIT:
32914 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
32915             by pp_bless ? (CS) */
32916 0           HV *bless_stash = 0;
32917 0           SV *parent = 0;
32918             int nreturn;
32919             SV *dist_SV;
32920             pdl *data;
32921             pdl *mask;
32922             pdl *weight;
32923             pdl *rowids1;
32924             pdl *rowids2;
32925             pdl *dist;
32926             char *distFlag;
32927             PPCODE:
32928             {
32929             PDL_COMMENT("Check if you can get a package name for this input value. ")
32930             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
32931             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
32932 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
32933 0           parent = ST(0);
32934 0 0         if (sv_isobject(parent)){
32935 0           bless_stash = SvSTASH(SvRV(ST(0)));
32936 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
32937             }
32938             }
32939 0 0         if (items == 7) { PDL_COMMENT("all variables on stack, read in output and temp vars")
32940 0           nreturn = 0;
32941 0           data = PDL->SvPDLV(ST(0));
32942 0           mask = PDL->SvPDLV(ST(1));
32943 0           weight = PDL->SvPDLV(ST(2));
32944 0           rowids1 = PDL->SvPDLV(ST(3));
32945 0           rowids2 = PDL->SvPDLV(ST(4));
32946 0           dist = PDL->SvPDLV(ST(5));
32947 0 0         distFlag = (char *)SvPV_nolen(ST(6))
32948             ;
32949             }
32950 0 0         else if (items == 6) { PDL_COMMENT("only input variables on stack, create outputs and temps")
32951 0           nreturn = 1;
32952 0           data = PDL->SvPDLV(ST(0));
32953 0           mask = PDL->SvPDLV(ST(1));
32954 0           weight = PDL->SvPDLV(ST(2));
32955 0           rowids1 = PDL->SvPDLV(ST(3));
32956 0           rowids2 = PDL->SvPDLV(ST(4));
32957 0 0         distFlag = (char *)SvPV_nolen(ST(5))
32958             ;
32959 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
32960 0           dist_SV = sv_newmortal();
32961 0           dist = PDL->null();
32962 0           PDL->SetSV_PDL(dist_SV,dist);
32963 0 0         if (bless_stash) dist_SV = sv_bless(dist_SV, bless_stash);
32964             } else {
32965 0 0         PUSHMARK(SP);
32966 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
32967 0           PUTBACK;
32968 0           perl_call_method("initialize", G_SCALAR);
32969 0           SPAGAIN;
32970 0           dist_SV = POPs;
32971 0           PUTBACK;
32972 0           dist = PDL->SvPDLV(dist_SV);
32973             }
32974             }
32975             else {
32976 0           croak ("Usage: PDL::rowdistances(data,mask,weight,rowids1,rowids2,dist,distFlag) (you may leave temporaries or output variables out of list)");
32977             }
32978             }
32979             {
32980             }
32981             { pdl_rowdistances_struct *__privtrans;
32982 0           int badflag_cache = 0;
32983 0           __privtrans = malloc(sizeof(*__privtrans));
32984 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
32985 0           PDL_TR_SETMAGIC(__privtrans);
32986 0           __privtrans->flags = 0;
32987 0           __privtrans->__ddone = 0;
32988 0           __privtrans->vtable = &pdl_rowdistances_vtable;
32989 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
32990 0           __privtrans->bvalflag = 0;
32991 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((rowids1->state & PDL_BADVAL) > 0) || ((rowids2->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
32992 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
32993 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
32994 0 0         else if(__privtrans->__datatype == PDL_S) {}
32995 0 0         else if(__privtrans->__datatype == PDL_U) {}
32996 0 0         else if(__privtrans->__datatype == PDL_L) {}
32997 0 0         else if(__privtrans->__datatype == PDL_N) {}
32998 0 0         else if(__privtrans->__datatype == PDL_Q) {}
32999 0 0         else if(__privtrans->__datatype == PDL_F) {}
33000 0 0         else if(__privtrans->__datatype == PDL_D) {}
33001 0           else __privtrans->__datatype = PDL_D;
33002 0 0         if(PDL_D != data->datatype) {
33003 0           data = PDL->get_convertedpdl(data,PDL_D);
33004 0 0         }if(PDL_L != mask->datatype) {
33005 0           mask = PDL->get_convertedpdl(mask,PDL_L);
33006 0 0         }if(PDL_D != weight->datatype) {
33007 0           weight = PDL->get_convertedpdl(weight,PDL_D);
33008 0 0         }if(PDL_L != rowids1->datatype) {
33009 0           rowids1 = PDL->get_convertedpdl(rowids1,PDL_L);
33010 0 0         }if(PDL_L != rowids2->datatype) {
33011 0           rowids2 = PDL->get_convertedpdl(rowids2,PDL_L);
33012 0 0         }if( (dist->state & PDL_NOMYDIMS) && dist->trans == NULL ) {
    0          
33013 0           dist->datatype = PDL_D;
33014 0 0         } else if(PDL_D != dist->datatype) {
33015 0           dist = PDL->get_convertedpdl(dist,PDL_D);
33016 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
33017 0           __privtrans->pdls[1] = mask;
33018 0           __privtrans->pdls[2] = weight;
33019 0           __privtrans->pdls[3] = rowids1;
33020 0           __privtrans->pdls[4] = rowids2;
33021 0           __privtrans->pdls[5] = dist;
33022 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33023 0 0         if (badflag_cache) {
33024 0           dist->state |= PDL_BADVAL;
33025             }
33026 0 0         if (nreturn) {
33027 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33028 0           ST(0) = dist_SV;
33029 0           XSRETURN(nreturn);
33030             } else {
33031 0           XSRETURN(0);
33032             }
33033             }
33034              
33035             void
33036             clusterdistances(...)
33037             PREINIT:
33038 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33039             by pp_bless ? (CS) */
33040 0           HV *bless_stash = 0;
33041 0           SV *parent = 0;
33042             int nreturn;
33043             SV *dist_SV;
33044             pdl *data;
33045             pdl *mask;
33046             pdl *weight;
33047             pdl *rowids;
33048             pdl *index2;
33049             pdl *dist;
33050             char *distFlag;
33051             char *methodFlag;
33052             PPCODE:
33053             {
33054             PDL_COMMENT("Check if you can get a package name for this input value. ")
33055             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33056             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33057 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
33058 0           parent = ST(0);
33059 0 0         if (sv_isobject(parent)){
33060 0           bless_stash = SvSTASH(SvRV(ST(0)));
33061 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
33062             }
33063             }
33064 0 0         if (items == 8) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33065 0           nreturn = 0;
33066 0           data = PDL->SvPDLV(ST(0));
33067 0           mask = PDL->SvPDLV(ST(1));
33068 0           weight = PDL->SvPDLV(ST(2));
33069 0           rowids = PDL->SvPDLV(ST(3));
33070 0           index2 = PDL->SvPDLV(ST(4));
33071 0           dist = PDL->SvPDLV(ST(5));
33072 0 0         distFlag = (char *)SvPV_nolen(ST(6))
33073             ;
33074 0 0         methodFlag = (char *)SvPV_nolen(ST(7))
33075             ;
33076             }
33077 0 0         else if (items == 7) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33078 0           nreturn = 1;
33079 0           data = PDL->SvPDLV(ST(0));
33080 0           mask = PDL->SvPDLV(ST(1));
33081 0           weight = PDL->SvPDLV(ST(2));
33082 0           rowids = PDL->SvPDLV(ST(3));
33083 0           index2 = PDL->SvPDLV(ST(4));
33084 0 0         distFlag = (char *)SvPV_nolen(ST(5))
33085             ;
33086 0 0         methodFlag = (char *)SvPV_nolen(ST(6))
33087             ;
33088 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33089 0           dist_SV = sv_newmortal();
33090 0           dist = PDL->null();
33091 0           PDL->SetSV_PDL(dist_SV,dist);
33092 0 0         if (bless_stash) dist_SV = sv_bless(dist_SV, bless_stash);
33093             } else {
33094 0 0         PUSHMARK(SP);
33095 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33096 0           PUTBACK;
33097 0           perl_call_method("initialize", G_SCALAR);
33098 0           SPAGAIN;
33099 0           dist_SV = POPs;
33100 0           PUTBACK;
33101 0           dist = PDL->SvPDLV(dist_SV);
33102             }
33103             }
33104             else {
33105 0           croak ("Usage: PDL::clusterdistances(data,mask,weight,rowids,index2,dist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
33106             }
33107             }
33108             {
33109             }
33110             { pdl_clusterdistances_struct *__privtrans;
33111 0           int badflag_cache = 0;
33112 0           __privtrans = malloc(sizeof(*__privtrans));
33113 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33114 0           PDL_TR_SETMAGIC(__privtrans);
33115 0           __privtrans->flags = 0;
33116 0           __privtrans->__ddone = 0;
33117 0           __privtrans->vtable = &pdl_clusterdistances_vtable;
33118 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33119 0           __privtrans->bvalflag = 0;
33120 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((rowids->state & PDL_BADVAL) > 0) || ((index2->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
33121 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
33122 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33123 0 0         else if(__privtrans->__datatype == PDL_S) {}
33124 0 0         else if(__privtrans->__datatype == PDL_U) {}
33125 0 0         else if(__privtrans->__datatype == PDL_L) {}
33126 0 0         else if(__privtrans->__datatype == PDL_N) {}
33127 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33128 0 0         else if(__privtrans->__datatype == PDL_F) {}
33129 0 0         else if(__privtrans->__datatype == PDL_D) {}
33130 0           else __privtrans->__datatype = PDL_D;
33131 0 0         if(PDL_D != data->datatype) {
33132 0           data = PDL->get_convertedpdl(data,PDL_D);
33133 0 0         }if(PDL_L != mask->datatype) {
33134 0           mask = PDL->get_convertedpdl(mask,PDL_L);
33135 0 0         }if(PDL_D != weight->datatype) {
33136 0           weight = PDL->get_convertedpdl(weight,PDL_D);
33137 0 0         }if(PDL_L != rowids->datatype) {
33138 0           rowids = PDL->get_convertedpdl(rowids,PDL_L);
33139 0 0         }if(PDL_L != index2->datatype) {
33140 0           index2 = PDL->get_convertedpdl(index2,PDL_L);
33141 0 0         }if( (dist->state & PDL_NOMYDIMS) && dist->trans == NULL ) {
    0          
33142 0           dist->datatype = PDL_D;
33143 0 0         } else if(PDL_D != dist->datatype) {
33144 0           dist = PDL->get_convertedpdl(dist,PDL_D);
33145 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
33146 0           __privtrans->pdls[1] = mask;
33147 0           __privtrans->pdls[2] = weight;
33148 0           __privtrans->pdls[3] = rowids;
33149 0           __privtrans->pdls[4] = index2;
33150 0           __privtrans->pdls[5] = dist;
33151 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33152 0 0         if (badflag_cache) {
33153 0           dist->state |= PDL_BADVAL;
33154             }
33155 0 0         if (nreturn) {
33156 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33157 0           ST(0) = dist_SV;
33158 0           XSRETURN(nreturn);
33159             } else {
33160 0           XSRETURN(0);
33161             }
33162             }
33163              
33164             void
33165             clustersizes(...)
33166             PREINIT:
33167 1           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33168             by pp_bless ? (CS) */
33169 1           HV *bless_stash = 0;
33170 1           SV *parent = 0;
33171             int nreturn;
33172             SV *clustersizes_SV;
33173             pdl *clusterids;
33174             pdl *clustersizes;
33175             PPCODE:
33176             {
33177             PDL_COMMENT("Check if you can get a package name for this input value. ")
33178             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33179             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33180 1 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
33181 1           parent = ST(0);
33182 1 50         if (sv_isobject(parent)){
33183 1           bless_stash = SvSTASH(SvRV(ST(0)));
33184 1 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
33185             }
33186             }
33187 1 50         if (items == 2) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33188 1           nreturn = 0;
33189 1           clusterids = PDL->SvPDLV(ST(0));
33190 1           clustersizes = PDL->SvPDLV(ST(1));
33191             }
33192 0 0         else if (items == 1) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33193 0           nreturn = 1;
33194 0           clusterids = PDL->SvPDLV(ST(0));
33195 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33196 0           clustersizes_SV = sv_newmortal();
33197 0           clustersizes = PDL->null();
33198 0           PDL->SetSV_PDL(clustersizes_SV,clustersizes);
33199 0 0         if (bless_stash) clustersizes_SV = sv_bless(clustersizes_SV, bless_stash);
33200             } else {
33201 0 0         PUSHMARK(SP);
33202 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33203 0           PUTBACK;
33204 0           perl_call_method("initialize", G_SCALAR);
33205 0           SPAGAIN;
33206 0           clustersizes_SV = POPs;
33207 0           PUTBACK;
33208 0           clustersizes = PDL->SvPDLV(clustersizes_SV);
33209             }
33210             }
33211             else {
33212 0           croak ("Usage: PDL::clustersizes(clusterids,clustersizes) (you may leave temporaries or output variables out of list)");
33213             }
33214             }
33215             {
33216             }
33217             { pdl_clustersizes_struct *__privtrans;
33218 1           int badflag_cache = 0;
33219 1           __privtrans = malloc(sizeof(*__privtrans));
33220 1           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33221 1           PDL_TR_SETMAGIC(__privtrans);
33222 1           __privtrans->flags = 0;
33223 1           __privtrans->__ddone = 0;
33224 1           __privtrans->vtable = &pdl_clustersizes_vtable;
33225 1           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33226 1           __privtrans->bvalflag = 0;
33227 1           badflag_cache = ((clusterids->state & PDL_BADVAL) > 0);
33228 1 50         if (badflag_cache) __privtrans->bvalflag = 1;
33229 1 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33230 0 0         else if(__privtrans->__datatype == PDL_S) {}
33231 0 0         else if(__privtrans->__datatype == PDL_U) {}
33232 0 0         else if(__privtrans->__datatype == PDL_L) {}
33233 0 0         else if(__privtrans->__datatype == PDL_N) {}
33234 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33235 0 0         else if(__privtrans->__datatype == PDL_F) {}
33236 0 0         else if(__privtrans->__datatype == PDL_D) {}
33237 0           else __privtrans->__datatype = PDL_D;
33238 1 50         if(PDL_L != clusterids->datatype) {
33239 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
33240 1 50         }if( (clustersizes->state & PDL_NOMYDIMS) && clustersizes->trans == NULL ) {
    0          
33241 0           clustersizes->datatype = PDL_L;
33242 1 50         } else if(PDL_L != clustersizes->datatype) {
33243 0           clustersizes = PDL->get_convertedpdl(clustersizes,PDL_L);
33244 1           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = clusterids;
33245 1           __privtrans->pdls[1] = clustersizes;
33246 1           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33247 1 50         clustersizes->state &= ~PDL_BADVAL; /* always make sure the output is "good" */if (nreturn) {
33248 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33249 0           ST(0) = clustersizes_SV;
33250 0           XSRETURN(nreturn);
33251             } else {
33252 1           XSRETURN(0);
33253             }
33254             }
33255              
33256             void
33257             clusterelements(...)
33258             PREINIT:
33259 1           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33260             by pp_bless ? (CS) */
33261 1           HV *bless_stash = 0;
33262 1           SV *parent = 0;
33263             int nreturn;
33264             SV *clustersizes_SV;
33265             SV *eltids_SV;
33266             pdl *clusterids;
33267             pdl *clustersizes;
33268             pdl *eltids;
33269             PPCODE:
33270             {
33271             PDL_COMMENT("Check if you can get a package name for this input value. ")
33272             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33273             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33274 1 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
33275 1           parent = ST(0);
33276 1 50         if (sv_isobject(parent)){
33277 1           bless_stash = SvSTASH(SvRV(ST(0)));
33278 1 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
33279             }
33280             }
33281 1 50         if (items == 3) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33282 1           nreturn = 0;
33283 1           clusterids = PDL->SvPDLV(ST(0));
33284 1           clustersizes = PDL->SvPDLV(ST(1));
33285 1           eltids = PDL->SvPDLV(ST(2));
33286             }
33287 0 0         else if (items == 1) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33288 0           nreturn = 2;
33289 0           clusterids = PDL->SvPDLV(ST(0));
33290 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33291 0           clustersizes_SV = sv_newmortal();
33292 0           clustersizes = PDL->null();
33293 0           PDL->SetSV_PDL(clustersizes_SV,clustersizes);
33294 0 0         if (bless_stash) clustersizes_SV = sv_bless(clustersizes_SV, bless_stash);
33295             } else {
33296 0 0         PUSHMARK(SP);
33297 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33298 0           PUTBACK;
33299 0           perl_call_method("initialize", G_SCALAR);
33300 0           SPAGAIN;
33301 0           clustersizes_SV = POPs;
33302 0           PUTBACK;
33303 0           clustersizes = PDL->SvPDLV(clustersizes_SV);
33304             }
33305 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33306 0           eltids_SV = sv_newmortal();
33307 0           eltids = PDL->null();
33308 0           PDL->SetSV_PDL(eltids_SV,eltids);
33309 0 0         if (bless_stash) eltids_SV = sv_bless(eltids_SV, bless_stash);
33310             } else {
33311 0 0         PUSHMARK(SP);
33312 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33313 0           PUTBACK;
33314 0           perl_call_method("initialize", G_SCALAR);
33315 0           SPAGAIN;
33316 0           eltids_SV = POPs;
33317 0           PUTBACK;
33318 0           eltids = PDL->SvPDLV(eltids_SV);
33319             }
33320             }
33321             else {
33322 0           croak ("Usage: PDL::clusterelements(clusterids,clustersizes,eltids) (you may leave temporaries or output variables out of list)");
33323             }
33324             }
33325             {
33326             }
33327             { pdl_clusterelements_struct *__privtrans;
33328 1           int badflag_cache = 0;
33329 1           __privtrans = malloc(sizeof(*__privtrans));
33330 1           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33331 1           PDL_TR_SETMAGIC(__privtrans);
33332 1           __privtrans->flags = 0;
33333 1           __privtrans->__ddone = 0;
33334 1           __privtrans->vtable = &pdl_clusterelements_vtable;
33335 1           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33336 1           __privtrans->bvalflag = 0;
33337 1           badflag_cache = ((clusterids->state & PDL_BADVAL) > 0);
33338 1 50         if (badflag_cache) __privtrans->bvalflag = 1;
33339 1 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33340 0 0         else if(__privtrans->__datatype == PDL_S) {}
33341 0 0         else if(__privtrans->__datatype == PDL_U) {}
33342 0 0         else if(__privtrans->__datatype == PDL_L) {}
33343 0 0         else if(__privtrans->__datatype == PDL_N) {}
33344 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33345 0 0         else if(__privtrans->__datatype == PDL_F) {}
33346 0 0         else if(__privtrans->__datatype == PDL_D) {}
33347 0           else __privtrans->__datatype = PDL_D;
33348 1 50         if(PDL_L != clusterids->datatype) {
33349 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
33350 1 50         }if( (clustersizes->state & PDL_NOMYDIMS) && clustersizes->trans == NULL ) {
    0          
33351 0           clustersizes->datatype = PDL_L;
33352 1 50         } else if(PDL_L != clustersizes->datatype) {
33353 0           clustersizes = PDL->get_convertedpdl(clustersizes,PDL_L);
33354 1 50         }if( (eltids->state & PDL_NOMYDIMS) && eltids->trans == NULL ) {
    0          
33355 0           eltids->datatype = PDL_L;
33356 1 50         } else if(PDL_L != eltids->datatype) {
33357 0           eltids = PDL->get_convertedpdl(eltids,PDL_L);
33358 1           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = clusterids;
33359 1           __privtrans->pdls[1] = clustersizes;
33360 1           __privtrans->pdls[2] = eltids;
33361 1           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33362 1 50         if (badflag_cache) {
33363 0           clustersizes->state |= PDL_BADVAL;
33364 0           eltids->state |= PDL_BADVAL;
33365             }
33366 1 50         if (nreturn) {
33367 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33368 0           ST(0) = clustersizes_SV;
33369 0           ST(1) = eltids_SV;
33370 0           XSRETURN(nreturn);
33371             } else {
33372 1           XSRETURN(0);
33373             }
33374             }
33375              
33376             void
33377             clusterelementmask(...)
33378             PREINIT:
33379 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33380             by pp_bless ? (CS) */
33381 0           HV *bless_stash = 0;
33382 0           SV *parent = 0;
33383             int nreturn;
33384             SV *eltmask_SV;
33385             pdl *clusterids;
33386             pdl *eltmask;
33387             PPCODE:
33388             {
33389             PDL_COMMENT("Check if you can get a package name for this input value. ")
33390             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33391             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33392 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
33393 0           parent = ST(0);
33394 0 0         if (sv_isobject(parent)){
33395 0           bless_stash = SvSTASH(SvRV(ST(0)));
33396 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
33397             }
33398             }
33399 0 0         if (items == 2) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33400 0           nreturn = 0;
33401 0           clusterids = PDL->SvPDLV(ST(0));
33402 0           eltmask = PDL->SvPDLV(ST(1));
33403             }
33404 0 0         else if (items == 1) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33405 0           nreturn = 1;
33406 0           clusterids = PDL->SvPDLV(ST(0));
33407 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33408 0           eltmask_SV = sv_newmortal();
33409 0           eltmask = PDL->null();
33410 0           PDL->SetSV_PDL(eltmask_SV,eltmask);
33411 0 0         if (bless_stash) eltmask_SV = sv_bless(eltmask_SV, bless_stash);
33412             } else {
33413 0 0         PUSHMARK(SP);
33414 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33415 0           PUTBACK;
33416 0           perl_call_method("initialize", G_SCALAR);
33417 0           SPAGAIN;
33418 0           eltmask_SV = POPs;
33419 0           PUTBACK;
33420 0           eltmask = PDL->SvPDLV(eltmask_SV);
33421             }
33422             }
33423             else {
33424 0           croak ("Usage: PDL::clusterelementmask(clusterids,eltmask) (you may leave temporaries or output variables out of list)");
33425             }
33426             }
33427             {
33428             }
33429             { pdl_clusterelementmask_struct *__privtrans;
33430 0           int badflag_cache = 0;
33431 0           __privtrans = malloc(sizeof(*__privtrans));
33432 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33433 0           PDL_TR_SETMAGIC(__privtrans);
33434 0           __privtrans->flags = 0;
33435 0           __privtrans->__ddone = 0;
33436 0           __privtrans->vtable = &pdl_clusterelementmask_vtable;
33437 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33438 0           __privtrans->bvalflag = 0;
33439 0           badflag_cache = ((clusterids->state & PDL_BADVAL) > 0);
33440 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
33441 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33442 0 0         else if(__privtrans->__datatype == PDL_S) {}
33443 0 0         else if(__privtrans->__datatype == PDL_U) {}
33444 0 0         else if(__privtrans->__datatype == PDL_L) {}
33445 0 0         else if(__privtrans->__datatype == PDL_N) {}
33446 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33447 0 0         else if(__privtrans->__datatype == PDL_F) {}
33448 0 0         else if(__privtrans->__datatype == PDL_D) {}
33449 0           else __privtrans->__datatype = PDL_D;
33450 0 0         if(PDL_L != clusterids->datatype) {
33451 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
33452 0 0         }if( (eltmask->state & PDL_NOMYDIMS) && eltmask->trans == NULL ) {
    0          
33453 0           eltmask->datatype = PDL_B;
33454 0 0         } else if(PDL_B != eltmask->datatype) {
33455 0           eltmask = PDL->get_convertedpdl(eltmask,PDL_B);
33456 0           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = clusterids;
33457 0           __privtrans->pdls[1] = eltmask;
33458 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33459 0 0         if (badflag_cache) {
33460 0           eltmask->state |= PDL_BADVAL;
33461             }
33462 0 0         if (nreturn) {
33463 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33464 0           ST(0) = eltmask_SV;
33465 0           XSRETURN(nreturn);
33466             } else {
33467 0           XSRETURN(0);
33468             }
33469             }
33470              
33471             void
33472             clusterdistancematrix(...)
33473             PREINIT:
33474 5           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33475             by pp_bless ? (CS) */
33476 5           HV *bless_stash = 0;
33477 5           SV *parent = 0;
33478             int nreturn;
33479             SV *dist_SV;
33480             pdl *data;
33481             pdl *mask;
33482             pdl *weight;
33483             pdl *rowids;
33484             pdl *clustersizes;
33485             pdl *eltids;
33486             pdl *dist;
33487             char *distFlag;
33488             char *methodFlag;
33489             PPCODE:
33490             {
33491             PDL_COMMENT("Check if you can get a package name for this input value. ")
33492             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33493             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33494 5 50         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    50          
    0          
33495 5           parent = ST(0);
33496 5 50         if (sv_isobject(parent)){
33497 5           bless_stash = SvSTASH(SvRV(ST(0)));
33498 5 50         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    50          
    50          
    0          
    50          
    50          
33499             }
33500             }
33501 5 50         if (items == 9) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33502 5           nreturn = 0;
33503 5           data = PDL->SvPDLV(ST(0));
33504 5           mask = PDL->SvPDLV(ST(1));
33505 5           weight = PDL->SvPDLV(ST(2));
33506 5           rowids = PDL->SvPDLV(ST(3));
33507 5           clustersizes = PDL->SvPDLV(ST(4));
33508 5           eltids = PDL->SvPDLV(ST(5));
33509 5           dist = PDL->SvPDLV(ST(6));
33510 5 50         distFlag = (char *)SvPV_nolen(ST(7))
33511             ;
33512 5 50         methodFlag = (char *)SvPV_nolen(ST(8))
33513             ;
33514             }
33515 0 0         else if (items == 8) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33516 0           nreturn = 1;
33517 0           data = PDL->SvPDLV(ST(0));
33518 0           mask = PDL->SvPDLV(ST(1));
33519 0           weight = PDL->SvPDLV(ST(2));
33520 0           rowids = PDL->SvPDLV(ST(3));
33521 0           clustersizes = PDL->SvPDLV(ST(4));
33522 0           eltids = PDL->SvPDLV(ST(5));
33523 0 0         distFlag = (char *)SvPV_nolen(ST(6))
33524             ;
33525 0 0         methodFlag = (char *)SvPV_nolen(ST(7))
33526             ;
33527 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33528 0           dist_SV = sv_newmortal();
33529 0           dist = PDL->null();
33530 0           PDL->SetSV_PDL(dist_SV,dist);
33531 0 0         if (bless_stash) dist_SV = sv_bless(dist_SV, bless_stash);
33532             } else {
33533 0 0         PUSHMARK(SP);
33534 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33535 0           PUTBACK;
33536 0           perl_call_method("initialize", G_SCALAR);
33537 0           SPAGAIN;
33538 0           dist_SV = POPs;
33539 0           PUTBACK;
33540 0           dist = PDL->SvPDLV(dist_SV);
33541             }
33542             }
33543             else {
33544 0           croak ("Usage: PDL::clusterdistancematrix(data,mask,weight,rowids,clustersizes,eltids,dist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
33545             }
33546             }
33547             {
33548             }
33549             { pdl_clusterdistancematrix_struct *__privtrans;
33550 5           int badflag_cache = 0;
33551 5           __privtrans = malloc(sizeof(*__privtrans));
33552 5           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33553 5           PDL_TR_SETMAGIC(__privtrans);
33554 5           __privtrans->flags = 0;
33555 5           __privtrans->__ddone = 0;
33556 5           __privtrans->vtable = &pdl_clusterdistancematrix_vtable;
33557 5           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33558 5           __privtrans->bvalflag = 0;
33559 5 50         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((rowids->state & PDL_BADVAL) > 0) || ((clustersizes->state & PDL_BADVAL) > 0) || ((eltids->state & PDL_BADVAL) > 0);
    50          
    50          
    50          
    50          
    50          
33560 5 50         if (badflag_cache) __privtrans->bvalflag = 1;
33561 5 50         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33562 0 0         else if(__privtrans->__datatype == PDL_S) {}
33563 0 0         else if(__privtrans->__datatype == PDL_U) {}
33564 0 0         else if(__privtrans->__datatype == PDL_L) {}
33565 0 0         else if(__privtrans->__datatype == PDL_N) {}
33566 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33567 0 0         else if(__privtrans->__datatype == PDL_F) {}
33568 0 0         else if(__privtrans->__datatype == PDL_D) {}
33569 0           else __privtrans->__datatype = PDL_D;
33570 5 50         if(PDL_D != data->datatype) {
33571 0           data = PDL->get_convertedpdl(data,PDL_D);
33572 5 50         }if(PDL_L != mask->datatype) {
33573 5           mask = PDL->get_convertedpdl(mask,PDL_L);
33574 5 50         }if(PDL_D != weight->datatype) {
33575 0           weight = PDL->get_convertedpdl(weight,PDL_D);
33576 5 50         }if(PDL_L != rowids->datatype) {
33577 0           rowids = PDL->get_convertedpdl(rowids,PDL_L);
33578 5 50         }if(PDL_L != clustersizes->datatype) {
33579 0           clustersizes = PDL->get_convertedpdl(clustersizes,PDL_L);
33580 5 50         }if(PDL_L != eltids->datatype) {
33581 0           eltids = PDL->get_convertedpdl(eltids,PDL_L);
33582 5 50         }if( (dist->state & PDL_NOMYDIMS) && dist->trans == NULL ) {
    0          
33583 0           dist->datatype = PDL_D;
33584 5 50         } else if(PDL_D != dist->datatype) {
33585 0           dist = PDL->get_convertedpdl(dist,PDL_D);
33586 5           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
33587 5           __privtrans->pdls[1] = mask;
33588 5           __privtrans->pdls[2] = weight;
33589 5           __privtrans->pdls[3] = rowids;
33590 5           __privtrans->pdls[4] = clustersizes;
33591 5           __privtrans->pdls[5] = eltids;
33592 5           __privtrans->pdls[6] = dist;
33593 5           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33594 5 50         if (badflag_cache) {
33595 0           dist->state |= PDL_BADVAL;
33596             }
33597 5 50         if (nreturn) {
33598 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33599 0           ST(0) = dist_SV;
33600 0           XSRETURN(nreturn);
33601             } else {
33602 5           XSRETURN(0);
33603             }
33604             }
33605              
33606             void
33607             clusterdistancematrixenc(...)
33608             PREINIT:
33609 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33610             by pp_bless ? (CS) */
33611 0           HV *bless_stash = 0;
33612 0           SV *parent = 0;
33613             int nreturn;
33614             SV *dist_SV;
33615             pdl *data;
33616             pdl *mask;
33617             pdl *weight;
33618             pdl *clens1;
33619             pdl *crowids1;
33620             pdl *clens2;
33621             pdl *crowids2;
33622             pdl *dist;
33623             char *distFlag;
33624             char *methodFlag;
33625             PPCODE:
33626             {
33627             PDL_COMMENT("Check if you can get a package name for this input value. ")
33628             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33629             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33630 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
33631 0           parent = ST(0);
33632 0 0         if (sv_isobject(parent)){
33633 0           bless_stash = SvSTASH(SvRV(ST(0)));
33634 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
33635             }
33636             }
33637 0 0         if (items == 10) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33638 0           nreturn = 0;
33639 0           data = PDL->SvPDLV(ST(0));
33640 0           mask = PDL->SvPDLV(ST(1));
33641 0           weight = PDL->SvPDLV(ST(2));
33642 0           clens1 = PDL->SvPDLV(ST(3));
33643 0           crowids1 = PDL->SvPDLV(ST(4));
33644 0           clens2 = PDL->SvPDLV(ST(5));
33645 0           crowids2 = PDL->SvPDLV(ST(6));
33646 0           dist = PDL->SvPDLV(ST(7));
33647 0 0         distFlag = (char *)SvPV_nolen(ST(8))
33648             ;
33649 0 0         methodFlag = (char *)SvPV_nolen(ST(9))
33650             ;
33651             }
33652 0 0         else if (items == 9) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33653 0           nreturn = 1;
33654 0           data = PDL->SvPDLV(ST(0));
33655 0           mask = PDL->SvPDLV(ST(1));
33656 0           weight = PDL->SvPDLV(ST(2));
33657 0           clens1 = PDL->SvPDLV(ST(3));
33658 0           crowids1 = PDL->SvPDLV(ST(4));
33659 0           clens2 = PDL->SvPDLV(ST(5));
33660 0           crowids2 = PDL->SvPDLV(ST(6));
33661 0 0         distFlag = (char *)SvPV_nolen(ST(7))
33662             ;
33663 0 0         methodFlag = (char *)SvPV_nolen(ST(8))
33664             ;
33665 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33666 0           dist_SV = sv_newmortal();
33667 0           dist = PDL->null();
33668 0           PDL->SetSV_PDL(dist_SV,dist);
33669 0 0         if (bless_stash) dist_SV = sv_bless(dist_SV, bless_stash);
33670             } else {
33671 0 0         PUSHMARK(SP);
33672 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33673 0           PUTBACK;
33674 0           perl_call_method("initialize", G_SCALAR);
33675 0           SPAGAIN;
33676 0           dist_SV = POPs;
33677 0           PUTBACK;
33678 0           dist = PDL->SvPDLV(dist_SV);
33679             }
33680             }
33681             else {
33682 0           croak ("Usage: PDL::clusterdistancematrixenc(data,mask,weight,clens1,crowids1,clens2,crowids2,dist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
33683             }
33684             }
33685             {
33686             }
33687             { pdl_clusterdistancematrixenc_struct *__privtrans;
33688 0           int badflag_cache = 0;
33689 0           __privtrans = malloc(sizeof(*__privtrans));
33690 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33691 0           PDL_TR_SETMAGIC(__privtrans);
33692 0           __privtrans->flags = 0;
33693 0           __privtrans->__ddone = 0;
33694 0           __privtrans->vtable = &pdl_clusterdistancematrixenc_vtable;
33695 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33696 0           __privtrans->bvalflag = 0;
33697 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((clens1->state & PDL_BADVAL) > 0) || ((crowids1->state & PDL_BADVAL) > 0) || ((clens2->state & PDL_BADVAL) > 0) || ((crowids2->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
    0          
33698 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
33699 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33700 0 0         else if(__privtrans->__datatype == PDL_S) {}
33701 0 0         else if(__privtrans->__datatype == PDL_U) {}
33702 0 0         else if(__privtrans->__datatype == PDL_L) {}
33703 0 0         else if(__privtrans->__datatype == PDL_N) {}
33704 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33705 0 0         else if(__privtrans->__datatype == PDL_F) {}
33706 0 0         else if(__privtrans->__datatype == PDL_D) {}
33707 0           else __privtrans->__datatype = PDL_D;
33708 0 0         if(PDL_D != data->datatype) {
33709 0           data = PDL->get_convertedpdl(data,PDL_D);
33710 0 0         }if(PDL_L != mask->datatype) {
33711 0           mask = PDL->get_convertedpdl(mask,PDL_L);
33712 0 0         }if(PDL_D != weight->datatype) {
33713 0           weight = PDL->get_convertedpdl(weight,PDL_D);
33714 0 0         }if(PDL_L != clens1->datatype) {
33715 0           clens1 = PDL->get_convertedpdl(clens1,PDL_L);
33716 0 0         }if(PDL_L != crowids1->datatype) {
33717 0           crowids1 = PDL->get_convertedpdl(crowids1,PDL_L);
33718 0 0         }if(PDL_L != clens2->datatype) {
33719 0           clens2 = PDL->get_convertedpdl(clens2,PDL_L);
33720 0 0         }if(PDL_L != crowids2->datatype) {
33721 0           crowids2 = PDL->get_convertedpdl(crowids2,PDL_L);
33722 0 0         }if( (dist->state & PDL_NOMYDIMS) && dist->trans == NULL ) {
    0          
33723 0           dist->datatype = PDL_D;
33724 0 0         } else if(PDL_D != dist->datatype) {
33725 0           dist = PDL->get_convertedpdl(dist,PDL_D);
33726 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
33727 0           __privtrans->pdls[1] = mask;
33728 0           __privtrans->pdls[2] = weight;
33729 0           __privtrans->pdls[3] = clens1;
33730 0           __privtrans->pdls[4] = crowids1;
33731 0           __privtrans->pdls[5] = clens2;
33732 0           __privtrans->pdls[6] = crowids2;
33733 0           __privtrans->pdls[7] = dist;
33734 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33735 0 0         if (badflag_cache) {
33736 0           dist->state |= PDL_BADVAL;
33737             }
33738 0 0         if (nreturn) {
33739 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33740 0           ST(0) = dist_SV;
33741 0           XSRETURN(nreturn);
33742             } else {
33743 0           XSRETURN(0);
33744             }
33745             }
33746              
33747             void
33748             clusterdistancesenc(...)
33749             PREINIT:
33750 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33751             by pp_bless ? (CS) */
33752 0           HV *bless_stash = 0;
33753 0           SV *parent = 0;
33754             int nreturn;
33755             SV *dists_SV;
33756             pdl *data;
33757             pdl *mask;
33758             pdl *weight;
33759             pdl *coffsets1;
33760             pdl *crowids1;
33761             pdl *cwhich1;
33762             pdl *coffsets2;
33763             pdl *crowids2;
33764             pdl *cwhich2;
33765             pdl *dists;
33766             char *distFlag;
33767             char *methodFlag;
33768             PPCODE:
33769             {
33770             PDL_COMMENT("Check if you can get a package name for this input value. ")
33771             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33772             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33773 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
33774 0           parent = ST(0);
33775 0 0         if (sv_isobject(parent)){
33776 0           bless_stash = SvSTASH(SvRV(ST(0)));
33777 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
33778             }
33779             }
33780 0 0         if (items == 12) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33781 0           nreturn = 0;
33782 0           data = PDL->SvPDLV(ST(0));
33783 0           mask = PDL->SvPDLV(ST(1));
33784 0           weight = PDL->SvPDLV(ST(2));
33785 0           coffsets1 = PDL->SvPDLV(ST(3));
33786 0           crowids1 = PDL->SvPDLV(ST(4));
33787 0           cwhich1 = PDL->SvPDLV(ST(5));
33788 0           coffsets2 = PDL->SvPDLV(ST(6));
33789 0           crowids2 = PDL->SvPDLV(ST(7));
33790 0           cwhich2 = PDL->SvPDLV(ST(8));
33791 0           dists = PDL->SvPDLV(ST(9));
33792 0 0         distFlag = (char *)SvPV_nolen(ST(10))
33793             ;
33794 0 0         methodFlag = (char *)SvPV_nolen(ST(11))
33795             ;
33796             }
33797 0 0         else if (items == 11) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33798 0           nreturn = 1;
33799 0           data = PDL->SvPDLV(ST(0));
33800 0           mask = PDL->SvPDLV(ST(1));
33801 0           weight = PDL->SvPDLV(ST(2));
33802 0           coffsets1 = PDL->SvPDLV(ST(3));
33803 0           crowids1 = PDL->SvPDLV(ST(4));
33804 0           cwhich1 = PDL->SvPDLV(ST(5));
33805 0           coffsets2 = PDL->SvPDLV(ST(6));
33806 0           crowids2 = PDL->SvPDLV(ST(7));
33807 0           cwhich2 = PDL->SvPDLV(ST(8));
33808 0 0         distFlag = (char *)SvPV_nolen(ST(9))
33809             ;
33810 0 0         methodFlag = (char *)SvPV_nolen(ST(10))
33811             ;
33812 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33813 0           dists_SV = sv_newmortal();
33814 0           dists = PDL->null();
33815 0           PDL->SetSV_PDL(dists_SV,dists);
33816 0 0         if (bless_stash) dists_SV = sv_bless(dists_SV, bless_stash);
33817             } else {
33818 0 0         PUSHMARK(SP);
33819 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33820 0           PUTBACK;
33821 0           perl_call_method("initialize", G_SCALAR);
33822 0           SPAGAIN;
33823 0           dists_SV = POPs;
33824 0           PUTBACK;
33825 0           dists = PDL->SvPDLV(dists_SV);
33826             }
33827             }
33828             else {
33829 0           croak ("Usage: PDL::clusterdistancesenc(data,mask,weight,coffsets1,crowids1,cwhich1,coffsets2,crowids2,cwhich2,dists,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
33830             }
33831             }
33832             {
33833             }
33834             { pdl_clusterdistancesenc_struct *__privtrans;
33835 0           int badflag_cache = 0;
33836 0           __privtrans = malloc(sizeof(*__privtrans));
33837 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33838 0           PDL_TR_SETMAGIC(__privtrans);
33839 0           __privtrans->flags = 0;
33840 0           __privtrans->__ddone = 0;
33841 0           __privtrans->vtable = &pdl_clusterdistancesenc_vtable;
33842 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33843 0           __privtrans->bvalflag = 0;
33844 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((coffsets1->state & PDL_BADVAL) > 0) || ((crowids1->state & PDL_BADVAL) > 0) || ((cwhich1->state & PDL_BADVAL) > 0) || ((coffsets2->state & PDL_BADVAL) > 0) || ((crowids2->state & PDL_BADVAL) > 0) || ((cwhich2->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
33845 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
33846 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33847 0 0         else if(__privtrans->__datatype == PDL_S) {}
33848 0 0         else if(__privtrans->__datatype == PDL_U) {}
33849 0 0         else if(__privtrans->__datatype == PDL_L) {}
33850 0 0         else if(__privtrans->__datatype == PDL_N) {}
33851 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33852 0 0         else if(__privtrans->__datatype == PDL_F) {}
33853 0 0         else if(__privtrans->__datatype == PDL_D) {}
33854 0           else __privtrans->__datatype = PDL_D;
33855 0 0         if(PDL_D != data->datatype) {
33856 0           data = PDL->get_convertedpdl(data,PDL_D);
33857 0 0         }if(PDL_L != mask->datatype) {
33858 0           mask = PDL->get_convertedpdl(mask,PDL_L);
33859 0 0         }if(PDL_D != weight->datatype) {
33860 0           weight = PDL->get_convertedpdl(weight,PDL_D);
33861 0 0         }if(PDL_L != coffsets1->datatype) {
33862 0           coffsets1 = PDL->get_convertedpdl(coffsets1,PDL_L);
33863 0 0         }if(PDL_L != crowids1->datatype) {
33864 0           crowids1 = PDL->get_convertedpdl(crowids1,PDL_L);
33865 0 0         }if(PDL_L != cwhich1->datatype) {
33866 0           cwhich1 = PDL->get_convertedpdl(cwhich1,PDL_L);
33867 0 0         }if(PDL_L != coffsets2->datatype) {
33868 0           coffsets2 = PDL->get_convertedpdl(coffsets2,PDL_L);
33869 0 0         }if(PDL_L != crowids2->datatype) {
33870 0           crowids2 = PDL->get_convertedpdl(crowids2,PDL_L);
33871 0 0         }if(PDL_L != cwhich2->datatype) {
33872 0           cwhich2 = PDL->get_convertedpdl(cwhich2,PDL_L);
33873 0 0         }if( (dists->state & PDL_NOMYDIMS) && dists->trans == NULL ) {
    0          
33874 0           dists->datatype = PDL_D;
33875 0 0         } else if(PDL_D != dists->datatype) {
33876 0           dists = PDL->get_convertedpdl(dists,PDL_D);
33877 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
33878 0           __privtrans->pdls[1] = mask;
33879 0           __privtrans->pdls[2] = weight;
33880 0           __privtrans->pdls[3] = coffsets1;
33881 0           __privtrans->pdls[4] = crowids1;
33882 0           __privtrans->pdls[5] = cwhich1;
33883 0           __privtrans->pdls[6] = coffsets2;
33884 0           __privtrans->pdls[7] = crowids2;
33885 0           __privtrans->pdls[8] = cwhich2;
33886 0           __privtrans->pdls[9] = dists;
33887 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
33888 0 0         if (badflag_cache) {
33889 0           dists->state |= PDL_BADVAL;
33890             }
33891 0 0         if (nreturn) {
33892 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
33893 0           ST(0) = dists_SV;
33894 0           XSRETURN(nreturn);
33895             } else {
33896 0           XSRETURN(0);
33897             }
33898             }
33899              
33900             void
33901             getclusterwsum(...)
33902             PREINIT:
33903 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
33904             by pp_bless ? (CS) */
33905 0           HV *bless_stash = 0;
33906 0           SV *parent = 0;
33907             int nreturn;
33908             SV *cdata_SV;
33909             SV *cmask_SV;
33910             pdl *data;
33911             pdl *mask;
33912             pdl *clusterwts;
33913             pdl *cdata;
33914             pdl *cmask;
33915             PPCODE:
33916             {
33917             PDL_COMMENT("Check if you can get a package name for this input value. ")
33918             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
33919             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
33920 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
33921 0           parent = ST(0);
33922 0 0         if (sv_isobject(parent)){
33923 0           bless_stash = SvSTASH(SvRV(ST(0)));
33924 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
33925             }
33926             }
33927 0 0         if (items == 5) { PDL_COMMENT("all variables on stack, read in output and temp vars")
33928 0           nreturn = 0;
33929 0           data = PDL->SvPDLV(ST(0));
33930 0           mask = PDL->SvPDLV(ST(1));
33931 0           clusterwts = PDL->SvPDLV(ST(2));
33932 0           cdata = PDL->SvPDLV(ST(3));
33933 0           cmask = PDL->SvPDLV(ST(4));
33934             }
33935 0 0         else if (items == 3) { PDL_COMMENT("only input variables on stack, create outputs and temps")
33936 0           nreturn = 2;
33937 0           data = PDL->SvPDLV(ST(0));
33938 0           mask = PDL->SvPDLV(ST(1));
33939 0           clusterwts = PDL->SvPDLV(ST(2));
33940 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33941 0           cdata_SV = sv_newmortal();
33942 0           cdata = PDL->null();
33943 0           PDL->SetSV_PDL(cdata_SV,cdata);
33944 0 0         if (bless_stash) cdata_SV = sv_bless(cdata_SV, bless_stash);
33945             } else {
33946 0 0         PUSHMARK(SP);
33947 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33948 0           PUTBACK;
33949 0           perl_call_method("initialize", G_SCALAR);
33950 0           SPAGAIN;
33951 0           cdata_SV = POPs;
33952 0           PUTBACK;
33953 0           cdata = PDL->SvPDLV(cdata_SV);
33954             }
33955 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
33956 0           cmask_SV = sv_newmortal();
33957 0           cmask = PDL->null();
33958 0           PDL->SetSV_PDL(cmask_SV,cmask);
33959 0 0         if (bless_stash) cmask_SV = sv_bless(cmask_SV, bless_stash);
33960             } else {
33961 0 0         PUSHMARK(SP);
33962 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
33963 0           PUTBACK;
33964 0           perl_call_method("initialize", G_SCALAR);
33965 0           SPAGAIN;
33966 0           cmask_SV = POPs;
33967 0           PUTBACK;
33968 0           cmask = PDL->SvPDLV(cmask_SV);
33969             }
33970             }
33971             else {
33972 0           croak ("Usage: PDL::getclusterwsum(data,mask,clusterwts,cdata,cmask) (you may leave temporaries or output variables out of list)");
33973             }
33974             }
33975             {
33976             }
33977             { pdl_getclusterwsum_struct *__privtrans;
33978 0           int badflag_cache = 0;
33979 0           __privtrans = malloc(sizeof(*__privtrans));
33980 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
33981 0           PDL_TR_SETMAGIC(__privtrans);
33982 0           __privtrans->flags = 0;
33983 0           __privtrans->__ddone = 0;
33984 0           __privtrans->vtable = &pdl_getclusterwsum_vtable;
33985 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
33986 0           __privtrans->bvalflag = 0;
33987 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((clusterwts->state & PDL_BADVAL) > 0);
    0          
    0          
33988 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
33989 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
33990 0 0         else if(__privtrans->__datatype == PDL_S) {}
33991 0 0         else if(__privtrans->__datatype == PDL_U) {}
33992 0 0         else if(__privtrans->__datatype == PDL_L) {}
33993 0 0         else if(__privtrans->__datatype == PDL_N) {}
33994 0 0         else if(__privtrans->__datatype == PDL_Q) {}
33995 0 0         else if(__privtrans->__datatype == PDL_F) {}
33996 0 0         else if(__privtrans->__datatype == PDL_D) {}
33997 0           else __privtrans->__datatype = PDL_D;
33998 0 0         if(PDL_D != data->datatype) {
33999 0           data = PDL->get_convertedpdl(data,PDL_D);
34000 0 0         }if(PDL_L != mask->datatype) {
34001 0           mask = PDL->get_convertedpdl(mask,PDL_L);
34002 0 0         }if(PDL_D != clusterwts->datatype) {
34003 0           clusterwts = PDL->get_convertedpdl(clusterwts,PDL_D);
34004 0 0         }if( (cdata->state & PDL_NOMYDIMS) && cdata->trans == NULL ) {
    0          
34005 0           cdata->datatype = PDL_D;
34006 0 0         } else if(PDL_D != cdata->datatype) {
34007 0           cdata = PDL->get_convertedpdl(cdata,PDL_D);
34008 0 0         }if( (cmask->state & PDL_NOMYDIMS) && cmask->trans == NULL ) {
    0          
34009 0           cmask->datatype = PDL_L;
34010 0 0         } else if(PDL_L != cmask->datatype) {
34011 0           cmask = PDL->get_convertedpdl(cmask,PDL_L);
34012 0           }{}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
34013 0           __privtrans->pdls[1] = mask;
34014 0           __privtrans->pdls[2] = clusterwts;
34015 0           __privtrans->pdls[3] = cdata;
34016 0           __privtrans->pdls[4] = cmask;
34017 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
34018 0 0         if (badflag_cache) {
34019 0           cdata->state |= PDL_BADVAL;
34020 0           cmask->state |= PDL_BADVAL;
34021             }
34022 0 0         if (nreturn) {
34023 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
34024 0           ST(0) = cdata_SV;
34025 0           ST(1) = cmask_SV;
34026 0           XSRETURN(nreturn);
34027             } else {
34028 0           XSRETURN(0);
34029             }
34030             }
34031              
34032             void
34033             attachtonearest(...)
34034             PREINIT:
34035 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
34036             by pp_bless ? (CS) */
34037 0           HV *bless_stash = 0;
34038 0           SV *parent = 0;
34039             int nreturn;
34040             SV *clusterids_SV;
34041             SV *cdist_SV;
34042             pdl *data;
34043             pdl *mask;
34044             pdl *weight;
34045             pdl *rowids;
34046             pdl *cdata;
34047             pdl *cmask;
34048             pdl *clusterids;
34049             pdl *cdist;
34050             char *distFlag;
34051             char *methodFlag;
34052             PPCODE:
34053             {
34054             PDL_COMMENT("Check if you can get a package name for this input value. ")
34055             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
34056             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
34057 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
34058 0           parent = ST(0);
34059 0 0         if (sv_isobject(parent)){
34060 0           bless_stash = SvSTASH(SvRV(ST(0)));
34061 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
34062             }
34063             }
34064 0 0         if (items == 10) { PDL_COMMENT("all variables on stack, read in output and temp vars")
34065 0           nreturn = 0;
34066 0           data = PDL->SvPDLV(ST(0));
34067 0           mask = PDL->SvPDLV(ST(1));
34068 0           weight = PDL->SvPDLV(ST(2));
34069 0           rowids = PDL->SvPDLV(ST(3));
34070 0           cdata = PDL->SvPDLV(ST(4));
34071 0           cmask = PDL->SvPDLV(ST(5));
34072 0           clusterids = PDL->SvPDLV(ST(6));
34073 0           cdist = PDL->SvPDLV(ST(7));
34074 0 0         distFlag = (char *)SvPV_nolen(ST(8))
34075             ;
34076 0 0         methodFlag = (char *)SvPV_nolen(ST(9))
34077             ;
34078             }
34079 0 0         else if (items == 8) { PDL_COMMENT("only input variables on stack, create outputs and temps")
34080 0           nreturn = 2;
34081 0           data = PDL->SvPDLV(ST(0));
34082 0           mask = PDL->SvPDLV(ST(1));
34083 0           weight = PDL->SvPDLV(ST(2));
34084 0           rowids = PDL->SvPDLV(ST(3));
34085 0           cdata = PDL->SvPDLV(ST(4));
34086 0           cmask = PDL->SvPDLV(ST(5));
34087 0 0         distFlag = (char *)SvPV_nolen(ST(6))
34088             ;
34089 0 0         methodFlag = (char *)SvPV_nolen(ST(7))
34090             ;
34091 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34092 0           clusterids_SV = sv_newmortal();
34093 0           clusterids = PDL->null();
34094 0           PDL->SetSV_PDL(clusterids_SV,clusterids);
34095 0 0         if (bless_stash) clusterids_SV = sv_bless(clusterids_SV, bless_stash);
34096             } else {
34097 0 0         PUSHMARK(SP);
34098 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34099 0           PUTBACK;
34100 0           perl_call_method("initialize", G_SCALAR);
34101 0           SPAGAIN;
34102 0           clusterids_SV = POPs;
34103 0           PUTBACK;
34104 0           clusterids = PDL->SvPDLV(clusterids_SV);
34105             }
34106 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34107 0           cdist_SV = sv_newmortal();
34108 0           cdist = PDL->null();
34109 0           PDL->SetSV_PDL(cdist_SV,cdist);
34110 0 0         if (bless_stash) cdist_SV = sv_bless(cdist_SV, bless_stash);
34111             } else {
34112 0 0         PUSHMARK(SP);
34113 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34114 0           PUTBACK;
34115 0           perl_call_method("initialize", G_SCALAR);
34116 0           SPAGAIN;
34117 0           cdist_SV = POPs;
34118 0           PUTBACK;
34119 0           cdist = PDL->SvPDLV(cdist_SV);
34120             }
34121             }
34122             else {
34123 0           croak ("Usage: PDL::attachtonearest(data,mask,weight,rowids,cdata,cmask,clusterids,cdist,distFlag,methodFlag) (you may leave temporaries or output variables out of list)");
34124             }
34125             }
34126             {
34127             }
34128             { pdl_attachtonearest_struct *__privtrans;
34129 0           int badflag_cache = 0;
34130 0           __privtrans = malloc(sizeof(*__privtrans));
34131 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
34132 0           PDL_TR_SETMAGIC(__privtrans);
34133 0           __privtrans->flags = 0;
34134 0           __privtrans->__ddone = 0;
34135 0           __privtrans->vtable = &pdl_attachtonearest_vtable;
34136 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
34137 0           __privtrans->bvalflag = 0;
34138 0 0         badflag_cache = ((data->state & PDL_BADVAL) > 0) || ((mask->state & PDL_BADVAL) > 0) || ((weight->state & PDL_BADVAL) > 0) || ((rowids->state & PDL_BADVAL) > 0) || ((cdata->state & PDL_BADVAL) > 0) || ((cmask->state & PDL_BADVAL) > 0);
    0          
    0          
    0          
    0          
    0          
34139 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
34140 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype == PDL_B) {}
34141 0 0         else if(__privtrans->__datatype == PDL_S) {}
34142 0 0         else if(__privtrans->__datatype == PDL_U) {}
34143 0 0         else if(__privtrans->__datatype == PDL_L) {}
34144 0 0         else if(__privtrans->__datatype == PDL_N) {}
34145 0 0         else if(__privtrans->__datatype == PDL_Q) {}
34146 0 0         else if(__privtrans->__datatype == PDL_F) {}
34147 0 0         else if(__privtrans->__datatype == PDL_D) {}
34148 0           else __privtrans->__datatype = PDL_D;
34149 0 0         if(PDL_D != data->datatype) {
34150 0           data = PDL->get_convertedpdl(data,PDL_D);
34151 0 0         }if(PDL_L != mask->datatype) {
34152 0           mask = PDL->get_convertedpdl(mask,PDL_L);
34153 0 0         }if(PDL_D != weight->datatype) {
34154 0           weight = PDL->get_convertedpdl(weight,PDL_D);
34155 0 0         }if(PDL_L != rowids->datatype) {
34156 0           rowids = PDL->get_convertedpdl(rowids,PDL_L);
34157 0 0         }if(PDL_D != cdata->datatype) {
34158 0           cdata = PDL->get_convertedpdl(cdata,PDL_D);
34159 0 0         }if(PDL_L != cmask->datatype) {
34160 0           cmask = PDL->get_convertedpdl(cmask,PDL_L);
34161 0 0         }if( (clusterids->state & PDL_NOMYDIMS) && clusterids->trans == NULL ) {
    0          
34162 0           clusterids->datatype = PDL_L;
34163 0 0         } else if(PDL_L != clusterids->datatype) {
34164 0           clusterids = PDL->get_convertedpdl(clusterids,PDL_L);
34165 0 0         }if( (cdist->state & PDL_NOMYDIMS) && cdist->trans == NULL ) {
    0          
34166 0           cdist->datatype = PDL_D;
34167 0 0         } else if(PDL_D != cdist->datatype) {
34168 0           cdist = PDL->get_convertedpdl(cdist,PDL_D);
34169 0           }{(__privtrans->distFlag) = malloc(strlen(distFlag)+1); strcpy(__privtrans->distFlag,distFlag);(__privtrans->methodFlag) = malloc(strlen(methodFlag)+1); strcpy(__privtrans->methodFlag,methodFlag);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = data;
34170 0           __privtrans->pdls[1] = mask;
34171 0           __privtrans->pdls[2] = weight;
34172 0           __privtrans->pdls[3] = rowids;
34173 0           __privtrans->pdls[4] = cdata;
34174 0           __privtrans->pdls[5] = cmask;
34175 0           __privtrans->pdls[6] = clusterids;
34176 0           __privtrans->pdls[7] = cdist;
34177 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
34178 0 0         if (badflag_cache) {
34179 0           clusterids->state |= PDL_BADVAL;
34180 0           cdist->state |= PDL_BADVAL;
34181             }
34182 0 0         if (nreturn) {
34183 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
34184 0           ST(0) = clusterids_SV;
34185 0           ST(1) = cdist_SV;
34186 0           XSRETURN(nreturn);
34187             } else {
34188 0           XSRETURN(0);
34189             }
34190             }
34191              
34192             void
34193             checkprototypes(...)
34194             PREINIT:
34195 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
34196             by pp_bless ? (CS) */
34197 0           HV *bless_stash = 0;
34198 0           SV *parent = 0;
34199             int nreturn;
34200             SV *cprotos_SV;
34201             SV *otmp_SV;
34202             pdl *protos;
34203             pdl *cprotos;
34204             pdl *otmp;
34205             int nsize;
34206             PPCODE:
34207             {
34208             PDL_COMMENT("Check if you can get a package name for this input value. ")
34209             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
34210             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
34211 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
34212 0           parent = ST(0);
34213 0 0         if (sv_isobject(parent)){
34214 0           bless_stash = SvSTASH(SvRV(ST(0)));
34215 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
34216             }
34217             }
34218 0 0         if (items == 4) { PDL_COMMENT("all variables on stack, read in output and temp vars")
34219 0           nreturn = 0;
34220 0           protos = PDL->SvPDLV(ST(0));
34221 0           cprotos = PDL->SvPDLV(ST(1));
34222 0           otmp = PDL->SvPDLV(ST(2));
34223 0 0         nsize = (int)SvIV(ST(3))
34224             ;
34225             }
34226 0 0         else if (items == 3) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
34227 0           protos = PDL->SvPDLV(ST(0));
34228 0           cprotos = PDL->SvPDLV(ST(1));
34229 0 0         nsize = (int)SvIV(ST(2))
34230             ;
34231 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34232 0           otmp_SV = sv_newmortal();
34233 0           otmp = PDL->null();
34234 0           PDL->SetSV_PDL(otmp_SV,otmp);
34235 0 0         if (bless_stash) otmp_SV = sv_bless(otmp_SV, bless_stash);
34236             } else {
34237 0 0         PUSHMARK(SP);
34238 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34239 0           PUTBACK;
34240 0           perl_call_method("initialize", G_SCALAR);
34241 0           SPAGAIN;
34242 0           otmp_SV = POPs;
34243 0           PUTBACK;
34244 0           otmp = PDL->SvPDLV(otmp_SV);
34245             }
34246             }
34247 0 0         else if (items == 2) { PDL_COMMENT("only input variables on stack, create outputs and temps")
34248 0           nreturn = 1;
34249 0           protos = PDL->SvPDLV(ST(0));
34250 0 0         nsize = (int)SvIV(ST(1))
34251             ;
34252 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34253 0           cprotos_SV = sv_newmortal();
34254 0           cprotos = PDL->null();
34255 0           PDL->SetSV_PDL(cprotos_SV,cprotos);
34256 0 0         if (bless_stash) cprotos_SV = sv_bless(cprotos_SV, bless_stash);
34257             } else {
34258 0 0         PUSHMARK(SP);
34259 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34260 0           PUTBACK;
34261 0           perl_call_method("initialize", G_SCALAR);
34262 0           SPAGAIN;
34263 0           cprotos_SV = POPs;
34264 0           PUTBACK;
34265 0           cprotos = PDL->SvPDLV(cprotos_SV);
34266             }
34267 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34268 0           otmp_SV = sv_newmortal();
34269 0           otmp = PDL->null();
34270 0           PDL->SetSV_PDL(otmp_SV,otmp);
34271 0 0         if (bless_stash) otmp_SV = sv_bless(otmp_SV, bless_stash);
34272             } else {
34273 0 0         PUSHMARK(SP);
34274 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34275 0           PUTBACK;
34276 0           perl_call_method("initialize", G_SCALAR);
34277 0           SPAGAIN;
34278 0           otmp_SV = POPs;
34279 0           PUTBACK;
34280 0           otmp = PDL->SvPDLV(otmp_SV);
34281             }
34282             }
34283             else {
34284 0           croak ("Usage: PDL::checkprototypes(protos,cprotos,otmp,nsize) (you may leave temporaries or output variables out of list)");
34285             }
34286             }
34287             {
34288 0 0         if ( protos->state & PDL_INPLACE && (cprotos != protos)) {
    0          
34289 0           protos->state &= ~PDL_INPLACE; PDL_COMMENT("unset")
34290 0           cprotos = protos; PDL_COMMENT("discard output value, leak ?")
34291 0           PDL->SetSV_PDL(cprotos_SV,cprotos);
34292             }
34293             }
34294             { pdl_checkprototypes_struct *__privtrans;
34295 0           int badflag_cache = 0;
34296 0           __privtrans = malloc(sizeof(*__privtrans));
34297 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
34298 0           PDL_TR_SETMAGIC(__privtrans);
34299 0           __privtrans->flags = 0;
34300 0           __privtrans->__ddone = 0;
34301 0           __privtrans->vtable = &pdl_checkprototypes_vtable;
34302 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
34303 0           __privtrans->bvalflag = 0;
34304 0           badflag_cache = ((protos->state & PDL_BADVAL) > 0);
34305 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
34306 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < protos->datatype) {
34307 0           __privtrans->__datatype = protos->datatype;
34308             }
34309 0 0         if(!((cprotos->state & PDL_NOMYDIMS) &&
    0          
34310 0 0         cprotos->trans == NULL) && __privtrans->__datatype < cprotos->datatype) {
34311 0           __privtrans->__datatype = cprotos->datatype;
34312             }
34313 0 0         if(__privtrans->__datatype == PDL_B) {}
34314 0 0         else if(__privtrans->__datatype == PDL_S) {}
34315 0 0         else if(__privtrans->__datatype == PDL_U) {}
34316 0 0         else if(__privtrans->__datatype == PDL_L) {}
34317 0           else __privtrans->__datatype = PDL_L;
34318 0 0         if(__privtrans->__datatype != protos->datatype) {
34319 0           protos = PDL->get_convertedpdl(protos,__privtrans->__datatype);
34320 0 0         }if( (cprotos->state & PDL_NOMYDIMS) && cprotos->trans == NULL ) {
    0          
34321 0           cprotos->datatype = __privtrans->__datatype;
34322 0 0         } else if(__privtrans->__datatype != cprotos->datatype) {
34323 0           cprotos = PDL->get_convertedpdl(cprotos,__privtrans->__datatype);
34324 0 0         }if( (otmp->state & PDL_NOMYDIMS) && otmp->trans == NULL ) {
    0          
34325 0           otmp->datatype = PDL_B;
34326 0 0         } else if(PDL_B != otmp->datatype) {
34327 0           otmp = PDL->get_convertedpdl(otmp,PDL_B);
34328 0           }{(__privtrans->nsize) = (nsize);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = protos;
34329 0           __privtrans->pdls[1] = cprotos;
34330 0           __privtrans->pdls[2] = otmp;
34331 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
34332 0 0         if (badflag_cache) {
34333 0           cprotos->state |= PDL_BADVAL;
34334             }
34335 0 0         if (nreturn) {
34336 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
34337 0           ST(0) = cprotos_SV;
34338 0           XSRETURN(nreturn);
34339             } else {
34340 0           XSRETURN(0);
34341             }
34342             }
34343              
34344             void
34345             checkpartitions(...)
34346             PREINIT:
34347 0           char *objname = "PDL"; /* XXX maybe that class should actually depend on the value set
34348             by pp_bless ? (CS) */
34349 0           HV *bless_stash = 0;
34350 0           SV *parent = 0;
34351             int nreturn;
34352             SV *cpart_SV;
34353             SV *ptmp_SV;
34354             pdl *part;
34355             pdl *cpart;
34356             pdl *ptmp;
34357             int ksize;
34358             PPCODE:
34359             {
34360             PDL_COMMENT("Check if you can get a package name for this input value. ")
34361             PDL_COMMENT("It can be either a PDL (SVt_PVMG) or a hash which is a ")
34362             PDL_COMMENT("derived PDL subclass (SVt_PVHV) ")
34363 0 0         if (SvROK(ST(0)) && ((SvTYPE(SvRV(ST(0))) == SVt_PVMG) || (SvTYPE(SvRV(ST(0))) == SVt_PVHV))) {
    0          
    0          
34364 0           parent = ST(0);
34365 0 0         if (sv_isobject(parent)){
34366 0           bless_stash = SvSTASH(SvRV(ST(0)));
34367 0 0         objname = HvNAME((bless_stash)); PDL_COMMENT("The package to bless output vars into is taken from the first input var")
    0          
    0          
    0          
    0          
    0          
34368             }
34369             }
34370 0 0         if (items == 4) { PDL_COMMENT("all variables on stack, read in output and temp vars")
34371 0           nreturn = 0;
34372 0           part = PDL->SvPDLV(ST(0));
34373 0           cpart = PDL->SvPDLV(ST(1));
34374 0           ptmp = PDL->SvPDLV(ST(2));
34375 0 0         ksize = (int)SvIV(ST(3))
34376             ;
34377             }
34378 0 0         else if (items == 3) { PDL_COMMENT("all but temps on stack, read in output, create temps") nreturn = 0;
34379 0           part = PDL->SvPDLV(ST(0));
34380 0           cpart = PDL->SvPDLV(ST(1));
34381 0 0         ksize = (int)SvIV(ST(2))
34382             ;
34383 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34384 0           ptmp_SV = sv_newmortal();
34385 0           ptmp = PDL->null();
34386 0           PDL->SetSV_PDL(ptmp_SV,ptmp);
34387 0 0         if (bless_stash) ptmp_SV = sv_bless(ptmp_SV, bless_stash);
34388             } else {
34389 0 0         PUSHMARK(SP);
34390 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34391 0           PUTBACK;
34392 0           perl_call_method("initialize", G_SCALAR);
34393 0           SPAGAIN;
34394 0           ptmp_SV = POPs;
34395 0           PUTBACK;
34396 0           ptmp = PDL->SvPDLV(ptmp_SV);
34397             }
34398             }
34399 0 0         else if (items == 2) { PDL_COMMENT("only input variables on stack, create outputs and temps")
34400 0           nreturn = 1;
34401 0           part = PDL->SvPDLV(ST(0));
34402 0 0         ksize = (int)SvIV(ST(1))
34403             ;
34404 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34405 0           cpart_SV = sv_newmortal();
34406 0           cpart = PDL->null();
34407 0           PDL->SetSV_PDL(cpart_SV,cpart);
34408 0 0         if (bless_stash) cpart_SV = sv_bless(cpart_SV, bless_stash);
34409             } else {
34410 0 0         PUSHMARK(SP);
34411 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34412 0           PUTBACK;
34413 0           perl_call_method("initialize", G_SCALAR);
34414 0           SPAGAIN;
34415 0           cpart_SV = POPs;
34416 0           PUTBACK;
34417 0           cpart = PDL->SvPDLV(cpart_SV);
34418             }
34419 0 0         if (strcmp(objname,"PDL") == 0) { PDL_COMMENT("shortcut if just PDL")
34420 0           ptmp_SV = sv_newmortal();
34421 0           ptmp = PDL->null();
34422 0           PDL->SetSV_PDL(ptmp_SV,ptmp);
34423 0 0         if (bless_stash) ptmp_SV = sv_bless(ptmp_SV, bless_stash);
34424             } else {
34425 0 0         PUSHMARK(SP);
34426 0 0         XPUSHs(sv_2mortal(newSVpv(objname, 0)));
34427 0           PUTBACK;
34428 0           perl_call_method("initialize", G_SCALAR);
34429 0           SPAGAIN;
34430 0           ptmp_SV = POPs;
34431 0           PUTBACK;
34432 0           ptmp = PDL->SvPDLV(ptmp_SV);
34433             }
34434             }
34435             else {
34436 0           croak ("Usage: PDL::checkpartitions(part,cpart,ptmp,ksize) (you may leave temporaries or output variables out of list)");
34437             }
34438             }
34439             {
34440 0 0         if ( part->state & PDL_INPLACE && (cpart != part)) {
    0          
34441 0           part->state &= ~PDL_INPLACE; PDL_COMMENT("unset")
34442 0           cpart = part; PDL_COMMENT("discard output value, leak ?")
34443 0           PDL->SetSV_PDL(cpart_SV,cpart);
34444             }
34445             }
34446             { pdl_checkpartitions_struct *__privtrans;
34447 0           int badflag_cache = 0;
34448 0           __privtrans = malloc(sizeof(*__privtrans));
34449 0           PDL_THR_CLRMAGIC(&__privtrans->__pdlthread);
34450 0           PDL_TR_SETMAGIC(__privtrans);
34451 0           __privtrans->flags = 0;
34452 0           __privtrans->__ddone = 0;
34453 0           __privtrans->vtable = &pdl_checkpartitions_vtable;
34454 0           __privtrans->freeproc = PDL->trans_mallocfreeproc;
34455 0           __privtrans->bvalflag = 0;
34456 0           badflag_cache = ((part->state & PDL_BADVAL) > 0);
34457 0 0         if (badflag_cache) __privtrans->bvalflag = 1;
34458 0 0         __privtrans->__datatype = 0;if(__privtrans->__datatype < part->datatype) {
34459 0           __privtrans->__datatype = part->datatype;
34460             }
34461 0 0         if(!((cpart->state & PDL_NOMYDIMS) &&
    0          
34462 0 0         cpart->trans == NULL) && __privtrans->__datatype < cpart->datatype) {
34463 0           __privtrans->__datatype = cpart->datatype;
34464             }
34465 0 0         if(!((ptmp->state & PDL_NOMYDIMS) &&
    0          
34466 0 0         ptmp->trans == NULL) && __privtrans->__datatype < ptmp->datatype) {
34467 0           __privtrans->__datatype = ptmp->datatype;
34468             }
34469 0 0         if(__privtrans->__datatype == PDL_B) {}
34470 0 0         else if(__privtrans->__datatype == PDL_S) {}
34471 0 0         else if(__privtrans->__datatype == PDL_U) {}
34472 0 0         else if(__privtrans->__datatype == PDL_L) {}
34473 0           else __privtrans->__datatype = PDL_L;
34474 0 0         if(__privtrans->__datatype != part->datatype) {
34475 0           part = PDL->get_convertedpdl(part,__privtrans->__datatype);
34476 0 0         }if( (cpart->state & PDL_NOMYDIMS) && cpart->trans == NULL ) {
    0          
34477 0           cpart->datatype = __privtrans->__datatype;
34478 0 0         } else if(__privtrans->__datatype != cpart->datatype) {
34479 0           cpart = PDL->get_convertedpdl(cpart,__privtrans->__datatype);
34480 0 0         }if( (ptmp->state & PDL_NOMYDIMS) && ptmp->trans == NULL ) {
    0          
34481 0           ptmp->datatype = __privtrans->__datatype;
34482 0 0         } else if(__privtrans->__datatype != ptmp->datatype) {
34483 0           ptmp = PDL->get_convertedpdl(ptmp,__privtrans->__datatype);
34484 0           }{(__privtrans->ksize) = (ksize);}PDL_COMMENT("No flow")__privtrans->__pdlthread.inds = 0;__privtrans->pdls[0] = part;
34485 0           __privtrans->pdls[1] = cpart;
34486 0           __privtrans->pdls[2] = ptmp;
34487 0           PDL->make_trans_mutual((pdl_trans *)__privtrans);
34488 0 0         if (badflag_cache) {
34489 0           cpart->state |= PDL_BADVAL;
34490             }
34491 0 0         if (nreturn) {
34492 0 0         if (nreturn - items > 0) EXTEND (SP, nreturn - items);
    0          
    0          
34493 0           ST(0) = cpart_SV;
34494 0           XSRETURN(nreturn);
34495             } else {
34496 0           XSRETURN(0);
34497             }
34498             }
34499              
34500              
34501             BOOT:
34502              
34503             PDL_COMMENT("Get pointer to structure of core shared C routines")
34504             PDL_COMMENT("make sure PDL::Core is loaded")
34505            
34506 9           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
34507             #ifndef aTHX_
34508             #define aTHX_
34509             #endif
34510 9 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    50          
    50          
    0          
    50          
    50          
    0          
    0          
    0          
    0          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    50          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    0          
    50          
    0          
    0          
    0          
    0          
34511 9           CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* SV* value */
34512 9 50         if (CoreSV==NULL)
34513 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
34514 9 50         PDL = INT2PTR(Core*,SvIV( CoreSV )); /* Core* value */
34515 9 50         if (PDL->Version != PDL_CORE_VERSION)
34516 0           Perl_croak(aTHX_ "[PDL->Version: %d PDL_CORE_VERSION: %d XS_VERSION: %s] PDL::Cluster needs to be recompiled against the newly installed PDL", PDL->Version, PDL_CORE_VERSION, XS_VERSION);
34517              
34518              
34519