Brownian.xs

filter: Statementstmt 100% 40 / 40 Branchbran 75.0% 12 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 92.8% 52 / 56 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« hosking.c ↑ Summary cov.c »
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4  
5 #include "ppport.h"
6  
7 #include <src/Brownian.h>
8  
9  
10 #include "const-c.inc"
11  
12 MODULE = Math::Random::Brownian PACKAGE = Math::Random::Brownian
13  
14 INCLUDE: const-xs.inc
15  
16 AV *
17 __hosking(n, H, L, cum, seed1, seed2)
18 long n
19 double H
20 double L
21 int cum
22 long seed1
23 long seed2
24 PREINIT:
25 int i;
26 double m;
27 double *output;
28 AV *results;
29 CODE:
30 1 m = pow(2.0,n);
31 1 ▶ New(0,output,m,double);
Branch: 1 branch
BranchTrueFalseTotal
New(0,output,m,double); 0 1 1
32 1 hosking(&n,&H,&L,&cum,&seed1,&seed2,output);
33
34 /* Declare results as mortal to avoid passing */
35 /* it back with REFCNT = 2 */
36 1 results = (AV*)sv_2mortal((SV*)newAV());
37 65 ▶ for(i=0;i<m;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<m;i++) 64 1 65
38 {
39 64 av_push(results,newSVnv(output[i]));
40 }
41 /* Push the new random seeds on to the bottom of the return array */
42 1 av_push(results,newSVnv(seed1));
43 1 av_push(results,newSVnv(seed2));
44 1 Safefree(output);
45 1 RETVAL = results;
46  
47 OUTPUT:
48 RETVAL
49  
50 AV *
51 __circulant(n, H, L, cum, seed1, seed2)
52 long n
53 double H
54 double L
55 int cum
56 long seed1
57 long seed2
58 PREINIT:
59 int i;
60 double m;
61 double *output;
62 AV *results;
63 CODE:
64 1 m = pow(2.0,n);
65 1 ▶ New(0,output,m,double);
Branch: 1 branch
BranchTrueFalseTotal
New(0,output,m,double); 0 1 1
66 1 circulant(&n,&H,&L,&cum,&seed1,&seed2,output);
67
68 /* Declare results as mortal to avoid passing */
69 /* it back with REFCNT = 2 */
70 1 results = (AV*)sv_2mortal((SV*)newAV());
71 65 ▶ for(i=0;i<m;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<m;i++) 64 1 65
72 {
73 64 av_push(results,newSVnv(output[i]));
74 }
75 /* Push the new random seeds on to the bottom of the return array */
76 1 av_push(results,newSVnv(seed1));
77 1 av_push(results,newSVnv(seed2));
78 1 Safefree(output);
79 1 RETVAL = results;
80  
81 OUTPUT:
82 RETVAL
83  
84 AV *
85 __apprcirc(n, H, L, cum, seed1, seed2)
86 long n
87 double H
88 double L
89 int cum
90 long seed1
91 long seed2
92 PREINIT:
93 int i;
94 double m;
95 double *output;
96 AV *results;
97 CODE:
98 1 m = pow(2.0,n);
99 1 ▶ New(0,output,m,double);
Branch: 1 branch
BranchTrueFalseTotal
New(0,output,m,double); 0 1 1
100 1 apprcirc(&n,&H,&L,&cum,&seed1,&seed2,output);
101
102 /* Declare results as mortal to avoid passing */
103 /* it back with REFCNT = 2 */
104 1 results = (AV*)sv_2mortal((SV*)newAV());
105 65 ▶ for(i=0;i<m;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<m;i++) 64 1 65
106 {
107 64 av_push(results,newSVnv(output[i]));
108 }
109 /* Push the new random seeds on to the bottom of the return array */
110 1 av_push(results,newSVnv(seed1));
111 1 av_push(results,newSVnv(seed2));
112 1 Safefree(output);
113 1 RETVAL = results;
114  
115 OUTPUT:
116 RETVAL
117  
118 AV *
119 __paxson(n, H, L, cum, seed1, seed2)
120 long n
121 double H
122 double L
123 int cum
124 long seed1
125 long seed2
126 PREINIT:
127 int i;
128 double m;
129 double *output;
130 AV *results;
131 CODE:
132 1 m = pow(2.0,n);
133 1 ▶ New(0,output,m,double);
Branch: 1 branch
BranchTrueFalseTotal
New(0,output,m,double); 0 1 1
134 1 paxson(&n,&H,&L,&cum,&seed1,&seed2,output);
135
136 /* Declare results as mortal to avoid passing */
137 /* it back with REFCNT = 2 */
138 1 results = (AV*)sv_2mortal((SV*)newAV());
139 65 ▶ for(i=0;i<m;i++)
Branch: 1 branch
BranchTrueFalseTotal
for(i=0;i<m;i++) 64 1 65
140 {
141 64 av_push(results,newSVnv(output[i]));
142 }
143 /* Push the new random seeds on to the bottom of the return array */
144 1 av_push(results,newSVnv(seed1));
145 1 av_push(results,newSVnv(seed2));
146 1 Safefree(output);
147 1 RETVAL = results;
148  
149 OUTPUT:
150 RETVAL
151  
« hosking.c ↑ Summary cov.c »