File Coverage

lib/PDL/Stats/Kmeans.xs
Criterion Covered Total %
statement 21 24 87.5
branch 64 164 39.0
condition n/a
subroutine n/a
pod n/a
total 85 188 45.2


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/Stats/Kmeans.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_Stats_Kmeans
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/Stats/Kmeans.xs"
23              
24             #include
25             #include
26             #include
27              
28             pdl_error pdl_run__random_cluster(pdl *rand_data,pdl *b);
29             pdl_error pdl_run_which_cluster(pdl *a,pdl *b);
30             pdl_error pdl_run_assign(pdl *data,pdl *centroid,pdl *cluster);
31             pdl_error pdl_run_centroid(pdl *data,pdl *cluster,pdl *m,pdl *ss);
32             pdl_error pdl_run__d_p2l(pdl *xc,pdl *yc,pdl *xa,pdl *ya,pdl *xb,pdl *yb,pdl *d);
33              
34             #line 449 "lib/PDL/PP.pm"
35             #include "pdlperl.h"
36             #line 37 "lib/PDL/Stats/Kmeans.xs"
37              
38             Core* PDL = NULL; /* Structure hold core C functions */
39              
40             MODULE = PDL::Stats::Kmeans PACKAGE = PDL PREFIX=pdl_run_
41              
42             PROTOTYPES: DISABLE
43              
44              
45             void
46             pdl_run__random_cluster(rand_data, b=PDL_XS_PERLINIT_initsv(b_SV))
47             SV *b_SV = items > 1 ? ST(1) : NULL;
48             PREINIT:
49 6 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
50             INPUT:
51             pdl *rand_data
52             pdl *b
53             PPCODE:
54 6           PDL->barf_if_error(pdl_run__random_cluster(rand_data,b));
55 6 50         PDL_XS_RETURN(ST(0) = b_SV)
    0          
    0          
    0          
    50          
56              
57             void
58             pdl_run_which_cluster(a, b=PDL_XS_PERLINIT_initsv(b_SV))
59             SV *b_SV = items > 1 ? ST(1) : NULL;
60             PREINIT:
61 1 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
62             INPUT:
63             pdl *a
64             pdl *b
65             PPCODE:
66 1           PDL->barf_if_error(pdl_run_which_cluster(a,b));
67 1 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
68              
69             void
70             pdl_run_assign(data, centroid, cluster=PDL_XS_PERLINIT_initsv(cluster_SV))
71             SV *cluster_SV = items > 2 ? ST(2) : NULL;
72             PREINIT:
73 17 50         PDL_XS_PREAMBLE((items == 3) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
74             INPUT:
75             pdl *data
76             pdl *centroid
77             pdl *cluster
78             PPCODE:
79 17           PDL->barf_if_error(pdl_run_assign(data,centroid,cluster));
80 17 50         PDL_XS_RETURN(ST(0) = cluster_SV)
    50          
    50          
    50          
    0          
81              
82             void
83             pdl_run_centroid(data, cluster, m=PDL_XS_PERLINIT_initsv(m_SV), ss=PDL_XS_PERLINIT_initsv(ss_SV))
84             SV *m_SV = items > 2 ? ST(2) : NULL;
85             SV *ss_SV = items > 3 ? ST(3) : NULL;
86             PREINIT:
87 99 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 2);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
88             INPUT:
89             pdl *data
90             pdl *cluster
91             pdl *m
92             pdl *ss
93             PPCODE:
94 99           PDL->barf_if_error(pdl_run_centroid(data,cluster,m,ss));
95 99 50         PDL_XS_RETURN(ST(0) = m_SV;ST(1) = ss_SV)
    50          
    50          
    50          
    0          
96              
97             void
98             pdl_run__d_p2l(xc, yc, xa, ya, xb, yb, d=PDL_XS_PERLINIT_initsv(d_SV))
99             SV *d_SV = items > 6 ? ST(6) : NULL;
100             PREINIT:
101 1 50         PDL_XS_PREAMBLE((items == 7) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
102             INPUT:
103             pdl *xc
104             pdl *yc
105             pdl *xa
106             pdl *ya
107             pdl *xb
108             pdl *yb
109             pdl *d
110             PPCODE:
111 1           PDL->barf_if_error(pdl_run__d_p2l(xc,yc,xa,ya,xb,yb,d));
112 1 50         PDL_XS_RETURN(ST(0) = d_SV)
    50          
    50          
    50          
    0          
113              
114              
115             #line 483 "lib/PDL/PP.pm"
116             BOOT:
117             /* Get pointer to structure of core shared C routines */
118             /* make sure PDL::Core is loaded */
119             #line 120 "lib/PDL/Stats/Kmeans.xs"
120 3           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
121             #ifndef aTHX_
122             #define aTHX_
123             #endif
124 3 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
125 3           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
126 3 50         if (!CoreSV)
127 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
128 3 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
129 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
130 3 50         if (PDL->Version != PDL_CORE_VERSION)
131 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::Stats::Kmeans needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);