File Coverage

lib/PDL/MatrixOps.xs
Criterion Covered Total %
statement 32 36 88.8
branch 105 238 44.1
condition n/a
subroutine n/a
pod n/a
total 137 274 50.0


line stmt bran cond sub pod time code
1              
2             #line 453 "lib/PDL/PP.pm"
3             /*
4             * THIS FILE WAS GENERATED BY PDL::PP from lib/PDL/MatrixOps.pd! Do not modify!
5             */
6              
7             #define PDL_FREE_CODE(trans, destroy, comp_free_code, ntpriv_free_code) \
8             if (destroy) { \
9             comp_free_code \
10             } \
11             if ((trans)->dims_redone) { \
12             ntpriv_free_code \
13             }
14              
15             #include "EXTERN.h"
16             #include "perl.h"
17             #include "XSUB.h"
18             #include "pdl.h"
19             #include "pdlcore.h"
20             #define PDL PDL_MatrixOps
21             extern Core* PDL; /* Structure hold core C functions */
22             #line 23 "lib/PDL/MatrixOps.xs"
23              
24             #include
25             pdl_error pdl_run_eigens_sym(pdl *a,pdl *ev,pdl *e);
26             pdl_error pdl_run_eigens(pdl *a,pdl *ev,pdl *e);
27             pdl_error pdl_run_svd(pdl *a,pdl *u,pdl *z,pdl *v);
28             pdl_error pdl_run_simq(pdl *a,pdl *b,pdl *x,pdl *ips,int flag);
29             pdl_error pdl_run_squaretotri(pdl *a,pdl *b);
30             pdl_error pdl_run_tritosquare(pdl *a,pdl *b);
31             pdl_error pdl_run_tricpy(pdl *A,pdl *C,int uplo);
32             pdl_error pdl_run_mstack(pdl *x,pdl *y,pdl *out);
33             pdl_error pdl_run_augment(pdl *x,pdl *y,pdl *out);
34              
35             #line 449 "lib/PDL/PP.pm"
36             #include "pdlperl.h"
37             #line 38 "lib/PDL/MatrixOps.xs"
38              
39             Core* PDL = NULL; /* Structure hold core C functions */
40              
41             MODULE = PDL::MatrixOps PACKAGE = PDL PREFIX=pdl_run_
42              
43             PROTOTYPES: DISABLE
44              
45              
46             void
47             _eigens_sym_int(a,ev,e)
48             pdl *a
49             pdl *ev
50             pdl *e
51             CODE:
52 5           PDL->barf_if_error(pdl_run_eigens_sym(a,ev,e));
53              
54             void
55             _eigens_int(a,ev,e)
56             pdl *a
57             pdl *ev
58             pdl *e
59             CODE:
60 4           PDL->barf_if_error(pdl_run_eigens(a,ev,e));
61              
62             void
63             pdl_run_svd(a, u=PDL_XS_PERLINIT_initsv(u_SV), z=PDL_XS_PERLINIT_initsv(z_SV), v=PDL_XS_PERLINIT_initsv(v_SV))
64             SV *u_SV = items > 1 ? ST(1) : NULL;
65             SV *z_SV = items > 2 ? ST(2) : NULL;
66             SV *v_SV = items > 3 ? ST(3) : NULL;
67             PREINIT:
68 23 50         PDL_XS_PREAMBLE((items == 4) ? 0 : 3);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
69             INPUT:
70             pdl *a
71             pdl *u
72             pdl *z
73             pdl *v
74             PPCODE:
75 23           PDL->barf_if_error(pdl_run_svd(a,u,z,v));
76 23 50         PDL_XS_RETURN(ST(0) = u_SV;ST(1) = z_SV;ST(2) = v_SV)
    50          
    50          
    50          
    0          
77              
78             void
79             pdl_run_simq(a, b, x=x, ips=ips, flag=flag)
80             SV *x_SV = (items == 5) ? ST(2) : NULL;
81             SV *ips_SV = (items == 5) ? ST(3) : NULL;
82             SV *flag_SV = (items == 5) ? ST(4) : ST(2);
83             PREINIT:
84 7 100         PDL_XS_PREAMBLE((items == 5) ? 0 : 2);
    50          
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
85 7 100         if (!((items == 3) || (items == 5)))
    50          
86 0           croak("Usage: PDL::simq(a,b,[x],[ips],flag) (you may leave [outputs] and values with =defaults out of list)");
87             INPUT:
88             pdl *a
89             pdl *b
90             pdl *x=NO_INIT
91             pdl *ips=NO_INIT
92             int flag; { flag = (int)SvIV(flag_SV); }
93             PPCODE:
94 7 100         if (x_SV) { x = PDL_CORE_(SvPDLV)(x_SV); } else x = PDL_XS_PERLINIT_initsv(x_SV);
    50          
95 7 100         if (ips_SV) { ips = PDL_CORE_(SvPDLV)(ips_SV); } else ips = PDL_XS_PERLINIT_initsv(ips_SV);
    50          
96 7           PDL->barf_if_error(pdl_run_simq(a,b,x,ips,flag));
97 4 100         PDL_XS_RETURN(ST(0) = x_SV;ST(1) = ips_SV)
    50          
    50          
    50          
    50          
98              
99             void
100             pdl_run_squaretotri(a, b=PDL_XS_PERLINIT_initsv(b_SV))
101             SV *b_SV = items > 1 ? ST(1) : NULL;
102             PREINIT:
103 9 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
104             INPUT:
105             pdl *a
106             pdl *b
107             PPCODE:
108 9           PDL->barf_if_error(pdl_run_squaretotri(a,b));
109 8 100         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    50          
110              
111             void
112             pdl_run_tritosquare(a, b=PDL_XS_PERLINIT_initsv(b_SV))
113             SV *b_SV = items > 1 ? ST(1) : NULL;
114             PREINIT:
115 1 50         PDL_XS_PREAMBLE((items == 2) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
116             INPUT:
117             pdl *a
118             pdl *b
119             PPCODE:
120 1           PDL->barf_if_error(pdl_run_tritosquare(a,b));
121 1 50         PDL_XS_RETURN(ST(0) = b_SV)
    50          
    50          
    50          
    0          
122              
123             void
124             pdl_run_tricpy(A, uplo=0, C=PDL_XS_PERLINIT_initsv(C_SV))
125             SV *C_SV = items > 2 ? ST(2) : NULL;
126             PREINIT:
127 5 50         PDL_XS_PREAMBLE(1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
128             INPUT:
129             pdl *A
130             int uplo
131             pdl *C
132             PPCODE:
133 5           PDL->barf_if_error(pdl_run_tricpy(A,C,uplo));
134 5 50         PDL_XS_RETURN(ST(0) = C_SV)
    50          
    50          
    50          
    0          
135              
136             void
137             pdl_run_mstack(x, y, out=PDL_XS_PERLINIT_initsv(out_SV))
138             SV *out_SV = items > 2 ? ST(2) : NULL;
139             PREINIT:
140 1 50         PDL_XS_PREAMBLE((items == 3) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
141             INPUT:
142             pdl *x
143             pdl *y
144             pdl *out
145             PPCODE:
146 1           PDL->barf_if_error(pdl_run_mstack(x,y,out));
147 1 50         PDL_XS_RETURN(ST(0) = out_SV)
    50          
    50          
    50          
    0          
148              
149             void
150             pdl_run_augment(x, y, out=PDL_XS_PERLINIT_initsv(out_SV))
151             SV *out_SV = items > 2 ? ST(2) : NULL;
152             PREINIT:
153 1 50         PDL_XS_PREAMBLE((items == 3) ? 0 : 1);
    50          
    0          
    50          
    50          
    50          
    50          
    0          
    50          
    50          
154             INPUT:
155             pdl *x
156             pdl *y
157             pdl *out
158             PPCODE:
159 1           PDL->barf_if_error(pdl_run_augment(x,y,out));
160 1 50         PDL_XS_RETURN(ST(0) = out_SV)
    50          
    50          
    50          
    0          
161              
162              
163             #line 483 "lib/PDL/PP.pm"
164             BOOT:
165             /* Get pointer to structure of core shared C routines */
166             /* make sure PDL::Core is loaded */
167             #line 168 "lib/PDL/MatrixOps.xs"
168 71           perl_require_pv ("PDL/Core.pm"); /* make sure PDL::Core is loaded */
169             #ifndef aTHX_
170             #define aTHX_
171             #endif
172 71 50         if (SvTRUE (ERRSV)) Perl_croak(aTHX_ "%s",SvPV_nolen (ERRSV));
    50          
    0          
173 71           SV* CoreSV = perl_get_sv("PDL::SHARE",FALSE); /* var with core structure */
174 71 50         if (!CoreSV)
175 0           Perl_croak(aTHX_ "We require the PDL::Core module, which was not found");
176 71 50         if (!(PDL = INT2PTR(Core*,SvIV( CoreSV )))) /* Core* value */
177 0           Perl_croak(aTHX_ "Got NULL pointer for PDL");
178 71 50         if (PDL->Version != PDL_CORE_VERSION)
179 0           Perl_croak(aTHX_ "[PDL->Version: %ld PDL_CORE_VERSION: %ld XS_VERSION: %s] PDL::MatrixOps needs to be recompiled against the newly installed PDL", (long int)PDL->Version, (long int)PDL_CORE_VERSION, XS_VERSION);