-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest.js
More file actions
42 lines (34 loc) · 1.28 KB
/
test.js
File metadata and controls
42 lines (34 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
let DFA = require("./dfa");
const testLengths = [128, 200, 256, 512, 65536, 262144];
let randomArrays = [];
console.log("generating signals");
// testLengths.forEach((length) => {
// randomArrays.push(
// Array.from({ length: length }, () => Math.floor(Math.random() * 1000) + 1)
// );
// });
randomArrays.push([
3, 3, 3, 3, 3, 3, 3, 3, 1, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 1, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2,
3, 3, 2, 2, 4, 4, 4, 3, 3, 3, 4, 3, 3, 4, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 2, 2,
3, 2, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
]);
const before = Date.now();
randomArrays.forEach((data) => {
console.log(JSON.stringify(data));
let dfa = new DFA(data);
let alpha_component = dfa.compute();
console.log(
`N=${alpha_component.lengthOfData}, scales:`,
alpha_component.scales
);
console.log(
`Alpha: ${alpha_component.alpha}, Alpha1: ${alpha_component.alpha1}, Alpha2: ${alpha_component.alpha2}`
);
console.log(`scalesAlpha1:`, alpha_component.scalesAlpha1);
console.log(`scalesAlpha2:`, alpha_component.scalesAlpha2);
console.log("---");
});
const after = Date.now();
console.log(`Time taken: ${after - before}ms`);