version bump 0.2.0: cleanup

This commit is contained in:
SheetJS 2016-01-16 13:47:42 -05:00
parent 771b56dcc5
commit fb5bf1e014
30 changed files with 19072 additions and 57 deletions

17
.flowconfig Normal file
View File

@ -0,0 +1,17 @@
[ignore]
.*/node_modules/.*
.*/dist/.*
.*/test.js
.*/vdc.js
.*/bits/.*
.*/ctest/.*
.*/misc/.*
.*/perf/.*
[include]
vdc.flow.js
[libs]
[options]

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
test_files/out.*

6
.jscs.json Normal file
View File

@ -0,0 +1,6 @@
{
"requireCommaBeforeLineBreak": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true
}

4
.jshintrc Normal file
View File

@ -0,0 +1,4 @@
{
"bitwise": false,
"curly": false
}

10
.npmignore Normal file
View File

@ -0,0 +1,10 @@
node_modules
misc/
test_files/
test.js
.travis.yml
.jscs.json
.jshintrc
.flowconfig
.npmignore
Makefile

View File

@ -1,6 +1,10 @@
language: node_js
node_js:
- "5.0"
- "4.2"
- "0.12"
- "0.10"
- "0.8"
before_install:
- "npm install -g npm@next"
- "npm install -g mocha"

15
LICENSE
View File

@ -1,9 +1,14 @@
Copyright (C) 2013 SheetJS
Copyright (C) 2013-present SheetJS
The MIT License (MIT)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
http://www.apache.org/licenses/LICENSE-2.0
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,35 +1,39 @@
ifndef BASE
BASE=2
endif
LIB=vdc
REQS=
ADDONS=
AUXTARGETS=
ifndef NELTS
NELTS=10
endif
BASELINE=./test_files/baseline.$(BASE).$(NELTS)
TESTFILE=./test_files/out.$(BASE).$(NELTS)
.PHONY: test
test: $(BASELINE)
node test_files/test_standalone.js $(BASE) $(NELTS) > $(TESTFILE)
diff $(BASELINE) $(TESTFILE)
.PHONY: mocha
mocha: $(BASELINE)
mocha -R spec
.PHONY: baseline
baseline $(BASELINE):
bash test_files/generate_baseline.sh $(BASE) $(NELTS) > $(BASELINE)
ULIB=$(shell echo $(LIB) | tr a-z A-Z)
DEPS=
TARGET=$(LIB).js
.PHONY: all
all:
bash test_files/make.sh
all: $(TARGET) $(AUXTARGETS)
$(TARGET) $(AUXTARGETS): %.js : %.flow.js
node -e 'process.stdout.write(require("fs").readFileSync("$<","utf8").replace(/^\s*\/\*:[^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*:[^*]*\*\//gm,""))' > $@
.PHONY: clean
clean:
rm -f test_files/out.*
clean: clean-baseline
rm -f $(TARGET)
.PHONY: clean-base
clean-base: clean
rm -f test_files/baseline.*
.PHONY: test mocha
test mocha: test.js $(TARGET)
mocha -R spec -t 20000
.PHONY: lint
lint: $(TARGET) $(AUXTARGETS)
jshint --show-non-errors $(TARGET) $(AUXTARGETS)
jshint --show-non-errors package.json
jscs $(TARGET) $(AUXTARGETS)
.PHONY: flow
flow: lint
flow check --all --show-all-errors
.PHONY: baseline clean-baseline
baseline:
./misc/make_baseline.sh
clean-baseline:
rm -f test_files/*.*

25
bin/vdc.njs Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env node
/* js-vdc (C) 2013-present SheetJS -- http://sheetjs.com */
var vdc = require('../');
require('exit-on-epipe');
var program = require('commander');
program
.version("1.0")
.usage('[options]')
.option('-b, --base <base>', 'base (default 2)', 2)
.option('-N, --start <N>', 'starting index (default 0)', 0)
.option('-n, --end <n>', 'ending index (default 10)', 10)
program.parse(process.argv);
var die = function(msg, code) { console.error(msg); process.exit(code||1); };
var b = +program.base, N = +program.start, n = +program.end;
if((b!=b)||!(b==(b|0))||b<2) die("base must be a positive integer >= 2");
if((N!=N)||!(N==(N|0))||N<0) die("start must be a nonnegative integer");
if((n!=n)||!(n==(n|0))||n<0) die("end must be a nonnegative integer");
if(N >= n) die("end must exceed start");
var x = new vdc({b:b, n:N});
while(N++ < n) console.log(x.next());

View File

@ -1,6 +1,6 @@
#!/bin/bash
# generate_baseline.sh -- generate test baseline using mathematica
# Copyright (C) 2013 SheetJS
# Copyright (C) 2013-present SheetJS
# usage: $0 [base:2] [nelts:10]
MCMD=math
@ -9,6 +9,7 @@ if [ -x /Applications/Mathematica.app/Contents/MacOS/MathKernel ]; then
fi
SCRIPT=test_files/vdc.m
if [ ! -e $SCRIPT ]; then SCRIPT=misc/vdc.m; fi
if [ ! -e $SCRIPT ]; then SCRIPT=vdc.m; fi
$MCMD -script $SCRIPT 7 ${1:-2} ${2:-10} | awk 'NF {print $1 "\t" $2}'

11
misc/make_baseline.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
for base in 2 3 5 7 11 13 17 19 23; do
for nelts in {2,5,10}{,0{,0{,0}}}; do
OF=./test_files/baseline.$base.$nelts
if [ ! -e $OF ]; then
echo $base $nelts
bash misc/generate_baseline.sh $base $nelts > $OF
fi
done
done

View File

@ -14,10 +14,10 @@ d={argdigs,argdigs};
http://reference.wolfram.com/mathematica/CUDALink/tutorial/Applications.html
this function returns a table of the form
[iteration, fraction]
[iteration, fraction]
*)
VanDerCorput[base_][len_]:=Table[
{n, With[{digits = Reverse@IntegerDigits[n, base]},
{n, With[{digits = Reverse@IntegerDigits[n, base]},
N[Sum[argbase^(-ii)*digits[[ii]], {ii, Length[digits]}],d]]}, {n, len}];
(* print table form *)

View File

@ -1,17 +1,25 @@
{
"name": "vdc",
"version": "0.1.1",
"version": "0.2.0",
"author": "SheetJS",
"description": "van der Corput low-discrepancy sequences",
"keywords": [ "math", "random", "qrng", "lds" ],
"bin": {
"vdc": "./bin/vdc.njs"
},
"main": "./vdc",
"dependencies": {
"exit-on-epipe":"",
"commander":""
},
"devDependencies": {
"mocha":""
},
"repository": { "type":"git", "url":"git://github.com/SheetJS/js-vdc.git" },
"scripts": {
"test": "make mocha"
"test": "make test"
},
"bugs": { "url": "https://github.com/SheetJS/js-vdc/issues" },
"license": "MIT"
"license": "Apache-2.0",
"engines": { "node": ">=0.8" }
}

View File

@ -12,8 +12,7 @@ describe('should reproduce baselines', function() {
it("base=" + base + " elts=" + elts, function() {
var opts = {'n':1,'b':base};
var gen = VDC(opts);
var data = fs.readFileSync('./test_files/' + x, 'utf-8').split("\n")
.filter(function(x) { return x.length > 1; });
var data = fs.readFileSync('./test_files/' + x, 'utf-8').split("\n").filter(function(x) { return x.length > 1; });
for(var i = 1; i <= elts; ++i) assert.equal((i +"\t"+ gen.next().toFixed(6)).slice(0,-1),data[i-1].slice(0,-1));
});
});

10
test_files/baseline.23.10 Normal file
View File

@ -0,0 +1,10 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783

100
test_files/baseline.23.100 Normal file
View File

@ -0,0 +1,100 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783
11 0.478261
12 0.521739
13 0.565217
14 0.608696
15 0.652174
16 0.695652
17 0.739130
18 0.782609
19 0.826087
20 0.869565
21 0.913043
22 0.956522
23 0.001890
24 0.045369
25 0.088847
26 0.132325
27 0.175803
28 0.219282
29 0.262760
30 0.306238
31 0.349716
32 0.393195
33 0.436673
34 0.480151
35 0.523629
36 0.567108
37 0.610586
38 0.654064
39 0.697543
40 0.741021
41 0.784499
42 0.827977
43 0.871456
44 0.914934
45 0.958412
46 0.003781
47 0.047259
48 0.090737
49 0.134216
50 0.177694
51 0.221172
52 0.264650
53 0.308129
54 0.351607
55 0.395085
56 0.438563
57 0.482042
58 0.525520
59 0.568998
60 0.612476
61 0.655955
62 0.699433
63 0.742911
64 0.786389
65 0.829868
66 0.873346
67 0.916824
68 0.960302
69 0.005671
70 0.049149
71 0.092628
72 0.136106
73 0.179584
74 0.223062
75 0.266541
76 0.310019
77 0.353497
78 0.396975
79 0.440454
80 0.483932
81 0.527410
82 0.570888
83 0.614367
84 0.657845
85 0.701323
86 0.744802
87 0.788280
88 0.831758
89 0.875236
90 0.918715
91 0.962193
92 0.007561
93 0.051040
94 0.094518
95 0.137996
96 0.181474
97 0.224953
98 0.268431
99 0.311909
100 0.355388

1000
test_files/baseline.23.1000 Normal file

File diff suppressed because it is too large Load Diff

10000
test_files/baseline.23.10000 Normal file

File diff suppressed because it is too large Load Diff

2
test_files/baseline.23.2 Normal file
View File

@ -0,0 +1,2 @@
1 0.043478
2 0.086957

20
test_files/baseline.23.20 Normal file
View File

@ -0,0 +1,20 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783
11 0.478261
12 0.521739
13 0.565217
14 0.608696
15 0.652174
16 0.695652
17 0.739130
18 0.782609
19 0.826087
20 0.869565

200
test_files/baseline.23.200 Normal file
View File

@ -0,0 +1,200 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783
11 0.478261
12 0.521739
13 0.565217
14 0.608696
15 0.652174
16 0.695652
17 0.739130
18 0.782609
19 0.826087
20 0.869565
21 0.913043
22 0.956522
23 0.001890
24 0.045369
25 0.088847
26 0.132325
27 0.175803
28 0.219282
29 0.262760
30 0.306238
31 0.349716
32 0.393195
33 0.436673
34 0.480151
35 0.523629
36 0.567108
37 0.610586
38 0.654064
39 0.697543
40 0.741021
41 0.784499
42 0.827977
43 0.871456
44 0.914934
45 0.958412
46 0.003781
47 0.047259
48 0.090737
49 0.134216
50 0.177694
51 0.221172
52 0.264650
53 0.308129
54 0.351607
55 0.395085
56 0.438563
57 0.482042
58 0.525520
59 0.568998
60 0.612476
61 0.655955
62 0.699433
63 0.742911
64 0.786389
65 0.829868
66 0.873346
67 0.916824
68 0.960302
69 0.005671
70 0.049149
71 0.092628
72 0.136106
73 0.179584
74 0.223062
75 0.266541
76 0.310019
77 0.353497
78 0.396975
79 0.440454
80 0.483932
81 0.527410
82 0.570888
83 0.614367
84 0.657845
85 0.701323
86 0.744802
87 0.788280
88 0.831758
89 0.875236
90 0.918715
91 0.962193
92 0.007561
93 0.051040
94 0.094518
95 0.137996
96 0.181474
97 0.224953
98 0.268431
99 0.311909
100 0.355388
101 0.398866
102 0.442344
103 0.485822
104 0.529301
105 0.572779
106 0.616257
107 0.659735
108 0.703214
109 0.746692
110 0.790170
111 0.833648
112 0.877127
113 0.920605
114 0.964083
115 0.009452
116 0.052930
117 0.096408
118 0.139887
119 0.183365
120 0.226843
121 0.270321
122 0.313800
123 0.357278
124 0.400756
125 0.444234
126 0.487713
127 0.531191
128 0.574669
129 0.618147
130 0.661626
131 0.705104
132 0.748582
133 0.792060
134 0.835539
135 0.879017
136 0.922495
137 0.965974
138 0.011342
139 0.054820
140 0.098299
141 0.141777
142 0.185255
143 0.228733
144 0.272212
145 0.315690
146 0.359168
147 0.402647
148 0.446125
149 0.489603
150 0.533081
151 0.576560
152 0.620038
153 0.663516
154 0.706994
155 0.750473
156 0.793951
157 0.837429
158 0.880907
159 0.924386
160 0.967864
161 0.013233
162 0.056711
163 0.100189
164 0.143667
165 0.187146
166 0.230624
167 0.274102
168 0.317580
169 0.361059
170 0.404537
171 0.448015
172 0.491493
173 0.534972
174 0.578450
175 0.621928
176 0.665406
177 0.708885
178 0.752363
179 0.795841
180 0.839319
181 0.882798
182 0.926276
183 0.969754
184 0.015123
185 0.058601
186 0.102079
187 0.145558
188 0.189036
189 0.232514
190 0.275992
191 0.319471
192 0.362949
193 0.406427
194 0.449905
195 0.493384
196 0.536862
197 0.580340
198 0.623819
199 0.667297
200 0.710775

2000
test_files/baseline.23.2000 Normal file

File diff suppressed because it is too large Load Diff

5
test_files/baseline.23.5 Normal file
View File

@ -0,0 +1,5 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391

50
test_files/baseline.23.50 Normal file
View File

@ -0,0 +1,50 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783
11 0.478261
12 0.521739
13 0.565217
14 0.608696
15 0.652174
16 0.695652
17 0.739130
18 0.782609
19 0.826087
20 0.869565
21 0.913043
22 0.956522
23 0.001890
24 0.045369
25 0.088847
26 0.132325
27 0.175803
28 0.219282
29 0.262760
30 0.306238
31 0.349716
32 0.393195
33 0.436673
34 0.480151
35 0.523629
36 0.567108
37 0.610586
38 0.654064
39 0.697543
40 0.741021
41 0.784499
42 0.827977
43 0.871456
44 0.914934
45 0.958412
46 0.003781
47 0.047259
48 0.090737
49 0.134216
50 0.177694

500
test_files/baseline.23.500 Normal file
View File

@ -0,0 +1,500 @@
1 0.043478
2 0.086957
3 0.130435
4 0.173913
5 0.217391
6 0.260870
7 0.304348
8 0.347826
9 0.391304
10 0.434783
11 0.478261
12 0.521739
13 0.565217
14 0.608696
15 0.652174
16 0.695652
17 0.739130
18 0.782609
19 0.826087
20 0.869565
21 0.913043
22 0.956522
23 0.001890
24 0.045369
25 0.088847
26 0.132325
27 0.175803
28 0.219282
29 0.262760
30 0.306238
31 0.349716
32 0.393195
33 0.436673
34 0.480151
35 0.523629
36 0.567108
37 0.610586
38 0.654064
39 0.697543
40 0.741021
41 0.784499
42 0.827977
43 0.871456
44 0.914934
45 0.958412
46 0.003781
47 0.047259
48 0.090737
49 0.134216
50 0.177694
51 0.221172
52 0.264650
53 0.308129
54 0.351607
55 0.395085
56 0.438563
57 0.482042
58 0.525520
59 0.568998
60 0.612476
61 0.655955
62 0.699433
63 0.742911
64 0.786389
65 0.829868
66 0.873346
67 0.916824
68 0.960302
69 0.005671
70 0.049149
71 0.092628
72 0.136106
73 0.179584
74 0.223062
75 0.266541
76 0.310019
77 0.353497
78 0.396975
79 0.440454
80 0.483932
81 0.527410
82 0.570888
83 0.614367
84 0.657845
85 0.701323
86 0.744802
87 0.788280
88 0.831758
89 0.875236
90 0.918715
91 0.962193
92 0.007561
93 0.051040
94 0.094518
95 0.137996
96 0.181474
97 0.224953
98 0.268431
99 0.311909
100 0.355388
101 0.398866
102 0.442344
103 0.485822
104 0.529301
105 0.572779
106 0.616257
107 0.659735
108 0.703214
109 0.746692
110 0.790170
111 0.833648
112 0.877127
113 0.920605
114 0.964083
115 0.009452
116 0.052930
117 0.096408
118 0.139887
119 0.183365
120 0.226843
121 0.270321
122 0.313800
123 0.357278
124 0.400756
125 0.444234
126 0.487713
127 0.531191
128 0.574669
129 0.618147
130 0.661626
131 0.705104
132 0.748582
133 0.792060
134 0.835539
135 0.879017
136 0.922495
137 0.965974
138 0.011342
139 0.054820
140 0.098299
141 0.141777
142 0.185255
143 0.228733
144 0.272212
145 0.315690
146 0.359168
147 0.402647
148 0.446125
149 0.489603
150 0.533081
151 0.576560
152 0.620038
153 0.663516
154 0.706994
155 0.750473
156 0.793951
157 0.837429
158 0.880907
159 0.924386
160 0.967864
161 0.013233
162 0.056711
163 0.100189
164 0.143667
165 0.187146
166 0.230624
167 0.274102
168 0.317580
169 0.361059
170 0.404537
171 0.448015
172 0.491493
173 0.534972
174 0.578450
175 0.621928
176 0.665406
177 0.708885
178 0.752363
179 0.795841
180 0.839319
181 0.882798
182 0.926276
183 0.969754
184 0.015123
185 0.058601
186 0.102079
187 0.145558
188 0.189036
189 0.232514
190 0.275992
191 0.319471
192 0.362949
193 0.406427
194 0.449905
195 0.493384
196 0.536862
197 0.580340
198 0.623819
199 0.667297
200 0.710775
201 0.754253
202 0.797732
203 0.841210
204 0.884688
205 0.928166
206 0.971645
207 0.017013
208 0.060491
209 0.103970
210 0.147448
211 0.190926
212 0.234405
213 0.277883
214 0.321361
215 0.364839
216 0.408318
217 0.451796
218 0.495274
219 0.538752
220 0.582231
221 0.625709
222 0.669187
223 0.712665
224 0.756144
225 0.799622
226 0.843100
227 0.886578
228 0.930057
229 0.973535
230 0.018904
231 0.062382
232 0.105860
233 0.149338
234 0.192817
235 0.236295
236 0.279773
237 0.323251
238 0.366730
239 0.410208
240 0.453686
241 0.497164
242 0.540643
243 0.584121
244 0.627599
245 0.671078
246 0.714556
247 0.758034
248 0.801512
249 0.844991
250 0.888469
251 0.931947
252 0.975425
253 0.020794
254 0.064272
255 0.107750
256 0.151229
257 0.194707
258 0.238185
259 0.281664
260 0.325142
261 0.368620
262 0.412098
263 0.455577
264 0.499055
265 0.542533
266 0.586011
267 0.629490
268 0.672968
269 0.716446
270 0.759924
271 0.803403
272 0.846881
273 0.890359
274 0.933837
275 0.977316
276 0.022684
277 0.066163
278 0.109641
279 0.153119
280 0.196597
281 0.240076
282 0.283554
283 0.327032
284 0.370510
285 0.413989
286 0.457467
287 0.500945
288 0.544423
289 0.587902
290 0.631380
291 0.674858
292 0.718336
293 0.761815
294 0.805293
295 0.848771
296 0.892250
297 0.935728
298 0.979206
299 0.024575
300 0.068053
301 0.111531
302 0.155009
303 0.198488
304 0.241966
305 0.285444
306 0.328922
307 0.372401
308 0.415879
309 0.459357
310 0.502836
311 0.546314
312 0.589792
313 0.633270
314 0.676749
315 0.720227
316 0.763705
317 0.807183
318 0.850662
319 0.894140
320 0.937618
321 0.981096
322 0.026465
323 0.069943
324 0.113422
325 0.156900
326 0.200378
327 0.243856
328 0.287335
329 0.330813
330 0.374291
331 0.417769
332 0.461248
333 0.504726
334 0.548204
335 0.591682
336 0.635161
337 0.678639
338 0.722117
339 0.765595
340 0.809074
341 0.852552
342 0.896030
343 0.939509
344 0.982987
345 0.028355
346 0.071834
347 0.115312
348 0.158790
349 0.202268
350 0.245747
351 0.289225
352 0.332703
353 0.376181
354 0.419660
355 0.463138
356 0.506616
357 0.550095
358 0.593573
359 0.637051
360 0.680529
361 0.724008
362 0.767486
363 0.810964
364 0.854442
365 0.897921
366 0.941399
367 0.984877
368 0.030246
369 0.073724
370 0.117202
371 0.160681
372 0.204159
373 0.247637
374 0.291115
375 0.334594
376 0.378072
377 0.421550
378 0.465028
379 0.508507
380 0.551985
381 0.595463
382 0.638941
383 0.682420
384 0.725898
385 0.769376
386 0.812854
387 0.856333
388 0.899811
389 0.943289
390 0.986767
391 0.032136
392 0.075614
393 0.119093
394 0.162571
395 0.206049
396 0.249527
397 0.293006
398 0.336484
399 0.379962
400 0.423440
401 0.466919
402 0.510397
403 0.553875
404 0.597353
405 0.640832
406 0.684310
407 0.727788
408 0.771267
409 0.814745
410 0.858223
411 0.901701
412 0.945180
413 0.988658
414 0.034026
415 0.077505
416 0.120983
417 0.164461
418 0.207940
419 0.251418
420 0.294896
421 0.338374
422 0.381853
423 0.425331
424 0.468809
425 0.512287
426 0.555766
427 0.599244
428 0.642722
429 0.686200
430 0.729679
431 0.773157
432 0.816635
433 0.860113
434 0.903592
435 0.947070
436 0.990548
437 0.035917
438 0.079395
439 0.122873
440 0.166352
441 0.209830
442 0.253308
443 0.296786
444 0.340265
445 0.383743
446 0.427221
447 0.470699
448 0.514178
449 0.557656
450 0.601134
451 0.644612
452 0.688091
453 0.731569
454 0.775047
455 0.818526
456 0.862004
457 0.905482
458 0.948960
459 0.992439
460 0.037807
461 0.081285
462 0.124764
463 0.168242
464 0.211720
465 0.255198
466 0.298677
467 0.342155
468 0.385633
469 0.429112
470 0.472590
471 0.516068
472 0.559546
473 0.603025
474 0.646503
475 0.689981
476 0.733459
477 0.776938
478 0.820416
479 0.863894
480 0.907372
481 0.950851
482 0.994329
483 0.039698
484 0.083176
485 0.126654
486 0.170132
487 0.213611
488 0.257089
489 0.300567
490 0.344045
491 0.387524
492 0.431002
493 0.474480
494 0.517958
495 0.561437
496 0.604915
497 0.648393
498 0.691871
499 0.735350
500 0.778828

5000
test_files/baseline.23.5000 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
#!/bin/bash
make clean-base
for base in 2 3 5 7 11 13 17 19; do
for nelts in {2,5,10}{,0{,0{,0}}}; do
BASE=$base NELTS=$nelts make baseline
done
done

37
vdc.flow.js Normal file
View File

@ -0,0 +1,37 @@
/* vdc.js (C) 2013-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*::
type VDCArgs = {
b?: number,
n?: number
};
*/
function VDC (opts/*:?VDCArgs*/) {
if(!(this instanceof VDC)) return new VDC(opts);
var o = opts || {b:2, n:0};
this._b = o.b || 2;
this._n = 0;
this.last = 0;
this.reset(o);
}
VDC.prototype.reset = function(opts/*:?VDCArgs*/) {
this._n = (opts||{n:0}).n||0;
};
VDC.prototype.next = function()/*:number*/ {
var n = this._n++;
var p = 0, q = 1;
while(n >= 1) {
p = p * this._b + (n % this._b);
q *= this._b;
n = (n/this._b)>>>0;
}
this.last = p/q;
return this.last;
};
if(typeof module !== 'undefined') {
module.exports = VDC;
}

18
vdc.js
View File

@ -1,14 +1,17 @@
/* vdc.js (C) 2013-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
function VDC (opts) {
if(!(this instanceof VDC)) return new VDC(opts);
var o = opts || {}
var o = opts || {b:2, n:0};
this._b = o.b || 2;
this._n = 0;
this.last = 0;
this.reset(o);
};
}
VDC.prototype.reset = function(opts) {
this._n = (opts||{}).n||0;
}
this._n = (opts||{n:0}).n||0;
};
VDC.prototype.next = function() {
var n = this._n++;
@ -16,10 +19,11 @@ VDC.prototype.next = function() {
while(n >= 1) {
p = p * this._b + (n % this._b);
q *= this._b;
n = (n/this._b)|0;
n = (n/this._b)>>>0;
}
return this.last = p / q;
}
this.last = p/q;
return this.last;
};
if(typeof module !== 'undefined') {
module.exports = VDC;