content
stringlengths 5
1.03M
| input_ids
sequencelengths 4
823k
| ratio_char_token
float64 0.4
12.5
| token_count
int64 4
823k
|
---|---|---|---|
/**
* This class models a cloud storage API.
*/
class Cloud {
int{L} cloud;
/**
* Put a value into the cloud.
*/
void put(int x) {
this.cloud = x;
}
/**
* Put the only value the cloud stores.
*/
int get() {
return this.cloud;
}
}
| [
35343,
198,
1635,
770,
1398,
4981,
257,
6279,
6143,
7824,
13,
198,
9466,
198,
4871,
10130,
1391,
198,
220,
220,
220,
493,
90,
43,
92,
6279,
26,
628,
220,
220,
220,
42638,
198,
220,
220,
220,
220,
1635,
5930,
257,
1988,
656,
262,
6279,
13,
198,
220,
220,
220,
220,
9466,
198,
220,
220,
220,
7951,
1234,
7,
600,
2124,
8,
1391,
198,
197,
5661,
13,
17721,
796,
2124,
26,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
42638,
198,
220,
220,
220,
220,
1635,
5930,
262,
691,
1988,
262,
6279,
7000,
13,
198,
220,
220,
220,
220,
9466,
198,
220,
220,
220,
493,
651,
3419,
1391,
198,
197,
7783,
428,
13,
17721,
26,
198,
220,
220,
220,
1782,
198,
92,
198
] | 2.300813 | 123 |
# Tests for align.jl
@testset "Align" begin
coords_one = [
1.0 0.0 0.0;
0.0 1.0 0.0;
0.0 0.0 0.0;
]
coords_two = [
0.0 -1.0 0.0;
1.0 0.0 0.0;
1.0 1.0 1.0;
]
trans_one_test, trans_two_test, rotation_test = kabschalignment(coords_one, coords_two)
trans_one_real = [1/3, 1/3, 0]
trans_two_real = [-1/3, 1/3, 1]
rotation_real = [
0.0 -1.0 0.0;
1.0 0.0 0.0;
0.0 0.0 1.0;
]
@test isapprox(trans_one_test, trans_one_real)
@test isapprox(trans_two_test, trans_two_real)
@test isapprox(rotation_test, rotation_real)
coords_one = [
1.0 0.0 0.0;
0.0 1.0 0.0;
0.0 0.0 0.0;
]
coords_two = [
0.0 -1.0 0.0;
1.0 0.0 0.0;
1.0 1.0 1.0;
]
devs_test = displacements(coords_one, coords_two)
devs_real = [sqrt(3), sqrt(3), 1.0]
@test isapprox(devs_test, devs_real)
atom_one = Atom("CA", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_two = Atom("C", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_thr = Atom("CA", "ALA", 'A', 21, [0.0, 0.0, 0.0], "C")
atoms = [atom_one, atom_two, atom_thr]
coords_one = [
0.0 1.0 2.0;
0.0 1.0 0.0;
0.0 0.0 0.0;
]
coords_two = [
0.0 -1.0 0.0;
0.0 0.0 3.0;
3.0 3.0 3.0;
]
align!(coords_one, coords_two, atoms)
coords_one_real = [
0.0 0.5 3.0;
-1.0 1.5 3.0;
0.0 2.5 3.0;
]
coords_one_real = [
0.0 -1.0 0.0;
0.5 1.5 2.5;
3.0 3.0 3.0;
]
@test coords_one == coords_one_real
atom_one = Atom("CA", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_two = Atom("C", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_thr = Atom("CA", "ALA", 'A', 21, [0.0, 0.0, 0.0], "C")
atoms = [atom_one, atom_two, atom_thr]
coords_one = [
0.0 1.0 2.0;
0.0 1.0 0.0;
0.0 0.0 0.0;
]
coords_two = [
0.0 -1.0 0.0;
0.0 0.0 3.0;
3.0 3.0 3.0;
]
alignsimple!(coords_one, coords_two, atoms)
coords_one_real = [
0.0 -1.0 0.0;
0.5 1.5 2.5;
3.0 3.0 3.0;
]
@test coords_one == coords_one_real
atom_one = Atom("CA", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_two = Atom("C", "ALA", 'A', 20, [1.0, 1.0, 0.0], "C")
atom_thr = Atom("CA", "ALA", 'A', 21, [2.0, 0.0, 0.0], "C")
atoms = [atom_one, atom_two, atom_thr]
atoms_new = deepcopy(atoms)
coords_ref = [
0.0 -1.0 0.0;
0.0 0.0 3.0;
3.0 3.0 3.0;
]
alignatoms!(atoms, coords_ref)
coords_real = [
0.0 -1.0 0.0;
0.5 1.5 2.5;
3.0 3.0 3.0;
]
@test atomcoords(atoms) == coords_real
atoms_ref = atomcoords(atoms, coords_ref)
alignatoms!(atoms_new, atoms_ref)
@test atomcoords(atoms_new) == coords_real
atom_one = Atom("CA", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_two = Atom("CA", "ALA", 'A', 30, [0.0, 0.0, 0.0], "C")
struc_one = ModelledStructure(0.0, [0.0 5.0; 0.0 5.0; 0.0 5.0])
struc_two = ModelledStructure(0.0, [1.0 4.0; 1.0 4.0; 1.0 4.0])
ensemble = ModelledEnsemble([atom_one, atom_two], [struc_one, struc_two])
average_test = centroid(ensemble)
average_real = [0.5 4.5; 0.5 4.5; 0.5 4.5]
@test average_test == average_real
coords_one = [
0.0 3.0 13.0;
0.0 0.0 0.0;
0.0 0.0 0.0;
]
coords_two = [
0.0 5.0 10.0;
1.0 0.0 0.0;
0.0 0.0 0.0;
]
atom_one = Atom("CA", "ALA", 'A', 20, [0.0, 0.0, 0.0], "C")
atom_two = Atom("CA", "ALA", 'A', 30, [0.0, 0.0, 0.0], "C")
atom_thr = Atom("C", "ALA", 'A', 40, [0.0, 0.0, 0.0], "C")
atoms = [atom_one, atom_two, atom_thr]
@test isapprox(rmsd(coords_one, coords_two, atoms), sqrt(2.5))
coords_one = [
0.0 3.0;
0.0 0.0;
0.0 0.0;
]
coords_two = [
0.0 5.0;
1.0 0.0;
0.0 0.0;
]
@test isapprox(rmsd(coords_one, coords_two), sqrt(2.5))
end
| [
2,
30307,
329,
10548,
13,
20362,
628,
198,
31,
9288,
2617,
366,
2348,
570,
1,
2221,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
352,
13,
15,
352,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
1007,
62,
505,
62,
9288,
11,
1007,
62,
11545,
62,
9288,
11,
13179,
62,
9288,
796,
479,
8937,
38009,
16747,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
8,
198,
220,
220,
220,
1007,
62,
505,
62,
5305,
796,
685,
16,
14,
18,
11,
352,
14,
18,
11,
657,
60,
198,
220,
220,
220,
1007,
62,
11545,
62,
5305,
796,
25915,
16,
14,
18,
11,
352,
14,
18,
11,
352,
60,
198,
220,
220,
220,
13179,
62,
5305,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
352,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
7645,
62,
505,
62,
9288,
11,
1007,
62,
505,
62,
5305,
8,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
7645,
62,
11545,
62,
9288,
11,
1007,
62,
11545,
62,
5305,
8,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
10599,
341,
62,
9288,
11,
13179,
62,
5305,
8,
628,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
352,
13,
15,
352,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
41470,
62,
9288,
796,
7845,
28613,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
8,
198,
220,
220,
220,
41470,
62,
5305,
796,
685,
31166,
17034,
7,
18,
828,
19862,
17034,
7,
18,
828,
352,
13,
15,
60,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
7959,
82,
62,
9288,
11,
41470,
62,
5305,
8,
628,
198,
220,
220,
220,
22037,
62,
505,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
11545,
796,
33102,
7203,
34,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
400,
81,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
2310,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
23235,
796,
685,
37696,
62,
505,
11,
22037,
62,
11545,
11,
22037,
62,
400,
81,
60,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
362,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
10548,
0,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
11,
23235,
8,
198,
220,
220,
220,
763,
3669,
62,
505,
62,
5305,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
20,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
532,
16,
13,
15,
352,
13,
20,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
362,
13,
20,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
505,
62,
5305,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
20,
352,
13,
20,
362,
13,
20,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
2488,
9288,
763,
3669,
62,
505,
6624,
763,
3669,
62,
505,
62,
5305,
628,
198,
220,
220,
220,
22037,
62,
505,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
11545,
796,
33102,
7203,
34,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
400,
81,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
2310,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
23235,
796,
685,
37696,
62,
505,
11,
22037,
62,
11545,
11,
22037,
62,
400,
81,
60,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
362,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
352,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
10548,
36439,
0,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
11,
23235,
8,
198,
220,
220,
220,
763,
3669,
62,
505,
62,
5305,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
20,
352,
13,
20,
362,
13,
20,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
2488,
9288,
763,
3669,
62,
505,
6624,
763,
3669,
62,
505,
62,
5305,
628,
198,
220,
220,
220,
22037,
62,
505,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
11545,
796,
33102,
7203,
34,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
16,
13,
15,
11,
352,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
400,
81,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
2310,
11,
685,
17,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
23235,
796,
685,
37696,
62,
505,
11,
22037,
62,
11545,
11,
22037,
62,
400,
81,
60,
198,
220,
220,
220,
23235,
62,
3605,
796,
2769,
30073,
7,
265,
3150,
8,
198,
220,
220,
220,
763,
3669,
62,
5420,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
10548,
265,
3150,
0,
7,
265,
3150,
11,
763,
3669,
62,
5420,
8,
198,
220,
220,
220,
763,
3669,
62,
5305,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
532,
16,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
20,
352,
13,
20,
362,
13,
20,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
13,
15,
513,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
2488,
9288,
22037,
1073,
3669,
7,
265,
3150,
8,
6624,
763,
3669,
62,
5305,
198,
220,
220,
220,
23235,
62,
5420,
796,
22037,
1073,
3669,
7,
265,
3150,
11,
763,
3669,
62,
5420,
8,
198,
220,
220,
220,
10548,
265,
3150,
0,
7,
265,
3150,
62,
3605,
11,
23235,
62,
5420,
8,
198,
220,
220,
220,
2488,
9288,
22037,
1073,
3669,
7,
265,
3150,
62,
3605,
8,
6624,
763,
3669,
62,
5305,
628,
198,
220,
220,
220,
22037,
62,
505,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
11545,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1542,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
2874,
66,
62,
505,
796,
3401,
11978,
1273,
5620,
7,
15,
13,
15,
11,
685,
15,
13,
15,
642,
13,
15,
26,
657,
13,
15,
642,
13,
15,
26,
657,
13,
15,
642,
13,
15,
12962,
198,
220,
220,
220,
2874,
66,
62,
11545,
796,
3401,
11978,
1273,
5620,
7,
15,
13,
15,
11,
685,
16,
13,
15,
604,
13,
15,
26,
352,
13,
15,
604,
13,
15,
26,
352,
13,
15,
604,
13,
15,
12962,
198,
220,
220,
220,
34549,
796,
3401,
11978,
4834,
15140,
26933,
37696,
62,
505,
11,
22037,
62,
11545,
4357,
685,
19554,
66,
62,
505,
11,
2874,
66,
62,
11545,
12962,
198,
220,
220,
220,
2811,
62,
9288,
796,
1247,
3882,
7,
1072,
11306,
8,
198,
220,
220,
220,
2811,
62,
5305,
796,
685,
15,
13,
20,
604,
13,
20,
26,
657,
13,
20,
604,
13,
20,
26,
657,
13,
20,
604,
13,
20,
60,
198,
220,
220,
220,
2488,
9288,
2811,
62,
9288,
6624,
2811,
62,
5305,
628,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
513,
13,
15,
1511,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
642,
13,
15,
838,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
22037,
62,
505,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1160,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
11545,
796,
33102,
7203,
8141,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
1542,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
22037,
62,
400,
81,
796,
33102,
7203,
34,
1600,
366,
1847,
32,
1600,
705,
32,
3256,
2319,
11,
685,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
4357,
366,
34,
4943,
198,
220,
220,
220,
23235,
796,
685,
37696,
62,
505,
11,
22037,
62,
11545,
11,
22037,
62,
400,
81,
60,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
81,
907,
67,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
11,
23235,
828,
19862,
17034,
7,
17,
13,
20,
4008,
628,
198,
220,
220,
220,
763,
3669,
62,
505,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
513,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
763,
3669,
62,
11545,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
642,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15,
657,
13,
15,
26,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
81,
907,
67,
7,
1073,
3669,
62,
505,
11,
763,
3669,
62,
11545,
828,
19862,
17034,
7,
17,
13,
20,
4008,
198,
437,
198
] | 1.629988 | 2,481 |
module Jags
using Compat, Pkg, Documenter, DelimitedFiles, Unicode, MCMCChains, StatsPlots
#### Includes ####
include("jagsmodel.jl")
include("jagscode.jl")
if !isdefined(Main, :Stanmodel)
include("utilities.jl")
end
"""The directory which contains the executable `bin/stanc`. Inferred
from `Main.JAGS_HOME` or `ENV["JAGS_HOME"]` when available. Use
`set_jags_home!` to modify."""
JAGS_HOME=""
function __init__()
global JAGS_HOME = if isdefined(Main, :JAGS_HOME)
eval(Main, :JAGS_HOME)
elseif haskey(ENV, "JAGS_HOME")
ENV["JAGS_HOME"]
else
println("Environment variable JAGS_HOME not found. Use set_jags_home!.")
""
end
end
"""Set the path for `Jags`.
Example: `set_jags_home!(homedir() * "/src/src/cmdstan-2.11.0/")`
"""
set_jags_home!(path) = global JAGS_HOME=path
#### Exports ####
export
# From this file
set_jags_home!,
# From Jags.jl
JAGS_HOME,
# From jagsmodel.jl
Jagsmodel,
# From jagscode.jl
jags
end # module
| [
21412,
449,
3775,
198,
198,
3500,
3082,
265,
11,
350,
10025,
11,
16854,
263,
11,
4216,
320,
863,
25876,
11,
34371,
11,
13122,
9655,
1925,
1299,
11,
20595,
3646,
1747,
198,
198,
4242,
29581,
1303,
21017,
198,
198,
17256,
7203,
73,
3775,
19849,
13,
20362,
4943,
198,
17256,
7203,
73,
363,
1416,
1098,
13,
20362,
4943,
198,
198,
361,
5145,
271,
23211,
7,
13383,
11,
1058,
32140,
19849,
8,
198,
220,
2291,
7203,
315,
2410,
13,
20362,
4943,
198,
437,
198,
198,
37811,
464,
8619,
543,
4909,
262,
28883,
4600,
8800,
14,
301,
1192,
44646,
554,
18186,
198,
6738,
4600,
13383,
13,
41,
4760,
50,
62,
39069,
63,
393,
4600,
1677,
53,
14692,
41,
4760,
50,
62,
39069,
8973,
63,
618,
1695,
13,
5765,
198,
63,
2617,
62,
73,
3775,
62,
11195,
0,
63,
284,
13096,
526,
15931,
198,
41,
4760,
50,
62,
39069,
33151,
198,
198,
8818,
11593,
15003,
834,
3419,
198,
220,
220,
220,
3298,
449,
4760,
50,
62,
39069,
796,
611,
318,
23211,
7,
13383,
11,
1058,
41,
4760,
50,
62,
39069,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5418,
7,
13383,
11,
1058,
41,
4760,
50,
62,
39069,
8,
198,
220,
220,
220,
2073,
361,
468,
2539,
7,
1677,
53,
11,
366,
41,
4760,
50,
62,
39069,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
12964,
53,
14692,
41,
4760,
50,
62,
39069,
8973,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
31441,
7885,
449,
4760,
50,
62,
39069,
407,
1043,
13,
5765,
900,
62,
73,
3775,
62,
11195,
0,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
13538,
198,
220,
220,
220,
886,
198,
437,
198,
198,
37811,
7248,
262,
3108,
329,
4600,
41,
3775,
44646,
198,
198,
16281,
25,
4600,
2617,
62,
73,
3775,
62,
11195,
0,
7,
71,
12657,
343,
3419,
1635,
12813,
10677,
14,
10677,
14,
28758,
14192,
12,
17,
13,
1157,
13,
15,
14,
4943,
63,
198,
37811,
198,
2617,
62,
73,
3775,
62,
11195,
0,
7,
6978,
8,
796,
3298,
449,
4760,
50,
62,
39069,
28,
6978,
198,
198,
4242,
1475,
3742,
1303,
21017,
198,
198,
39344,
198,
2,
3574,
428,
2393,
198,
220,
900,
62,
73,
3775,
62,
11195,
28265,
198,
2,
3574,
449,
3775,
13,
20362,
198,
220,
449,
4760,
50,
62,
39069,
11,
198,
198,
2,
3574,
474,
3775,
19849,
13,
20362,
198,
220,
449,
3775,
19849,
11,
198,
198,
2,
3574,
474,
363,
1416,
1098,
13,
20362,
198,
220,
474,
3775,
198,
198,
437,
1303,
8265,
198
] | 2.348341 | 422 |
using Base.Test
reload("ForwardBackwardOptim")
m = ForwardBackwardOptim
tests = [
"optims"
]
for t in tests
tfile = string(t, ".jl")
println(" * $tfile ...")
include(tfile)
end
println("Finished testing.") | [
3500,
7308,
13,
14402,
198,
198,
260,
2220,
7203,
39746,
7282,
904,
27871,
320,
4943,
198,
76,
796,
19530,
7282,
904,
27871,
320,
198,
198,
41989,
796,
685,
198,
220,
220,
220,
366,
8738,
12078,
1,
198,
60,
198,
198,
1640,
256,
287,
5254,
198,
220,
220,
220,
256,
7753,
796,
4731,
7,
83,
11,
27071,
20362,
4943,
198,
220,
220,
220,
44872,
7203,
220,
1635,
720,
83,
7753,
35713,
8,
198,
220,
220,
220,
2291,
7,
83,
7753,
8,
198,
437,
198,
198,
35235,
7203,
18467,
1348,
4856,
19570
] | 2.511111 | 90 |
#!/usr/bin/env julia
# https://github.com/JuliaEditorSupport/julia-emacs/blob/master/make-julia-latexsubs.jl
@assert VERSION >= v"1"
import REPL
"""
Create latex symbols formatted for elisp as either abbrev or hash table.
- ds : elisp output data structure - either "abbrev" or "hash"
- varname : name of hashtable if "hash" output
- dest : out stream
"""
function generate_unicode(ds::AbstractString, varname::AbstractString, dest::IO)
if dest != stdout
println(dest, ";; -*- coding: utf-8; mode: emacs-lisp; -*-")
end
if ds == "abbrev"
println(dest, "(define-abbrev-table 'unicode-latex-abbrev-table\n '(")
elseif ds == "hash"
println(dest, "(defvar $(varname) (make-hash-table :test 'equal))\n")
end
for (k, v) in sort!(collect(REPL.REPLCompletions.latex_symbols), by=last)
ks = escape_string(k)
vs = escape_string(v)
if ds == ""
println(dest, "\"$ks\" => \"$vs\"")
elseif ds == "hash" && occursin(r"^\\U[0-9A-Fa-f]+$", vs)
cp = vs[3:end]
println(dest,
"(let ((c (decode-char 'ucs #x$cp)))\n",
" (if c (puthash \"$ks\" (char-to-string c) $(varname))))")
else
if ds == "hash"
println(dest, "(puthash \"$ks\" \"$vs\" $(varname))")
elseif ds == "abbrev"
println(dest, " (\"$ks\" \"$vs\" nil :system t)")
else
println(dest, "\"$ks\" => \"$vs\"")
end
end
end
if ds == "abbrev"
println(dest,
" )\n",
" \"Unicode latex abbrevs (julia generated).\"\n",
" :regexp \"\\\\(\\\\\\\\[\\\\A-Za-z0-9^]+\\\\)\")")
end
end
# CLI
if length(ARGS) < 1
generate_unicode("", "", stdout)
else
dest = length(ARGS) > 2 ? open(ARGS[3], "w") : stdout
if ARGS[1] == "abbrev"
generate_unicode("abbrev", "", dest)
elseif ARGS[1] == "hash"
generate_unicode(ARGS[1], ARGS[2], dest)
else
println(dest, "Unknown type")
end
end
| [
2,
48443,
14629,
14,
8800,
14,
24330,
474,
43640,
198,
198,
2,
3740,
1378,
12567,
13,
785,
14,
16980,
544,
17171,
15514,
14,
73,
43640,
12,
368,
16436,
14,
2436,
672,
14,
9866,
14,
15883,
12,
73,
43640,
12,
17660,
87,
7266,
82,
13,
20362,
198,
31,
30493,
44156,
2849,
18189,
410,
1,
16,
1,
198,
198,
11748,
45285,
198,
198,
37811,
198,
16447,
47038,
14354,
39559,
329,
1288,
8802,
355,
2035,
28873,
85,
393,
12234,
3084,
13,
198,
12,
288,
82,
220,
220,
220,
220,
220,
1058,
1288,
8802,
5072,
1366,
4645,
532,
2035,
366,
397,
4679,
85,
1,
393,
366,
17831,
1,
198,
12,
1401,
3672,
1058,
1438,
286,
20267,
540,
611,
366,
17831,
1,
5072,
198,
12,
2244,
220,
220,
220,
1058,
503,
4269,
198,
37811,
198,
8818,
7716,
62,
46903,
1098,
7,
9310,
3712,
23839,
10100,
11,
1401,
3672,
3712,
23839,
10100,
11,
2244,
3712,
9399,
8,
198,
220,
220,
220,
611,
2244,
14512,
14367,
448,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
366,
7665,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
26,
4235,
25,
795,
16436,
12,
75,
8802,
26,
532,
9,
12,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
288,
82,
6624,
366,
397,
4679,
85,
1,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
30629,
13086,
12,
397,
4679,
85,
12,
11487,
705,
46903,
1098,
12,
17660,
87,
12,
397,
4679,
85,
12,
11487,
59,
77,
220,
29513,
4943,
198,
220,
220,
220,
2073,
361,
288,
82,
6624,
366,
17831,
1,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
30629,
4299,
7785,
29568,
85,
1501,
480,
8,
357,
15883,
12,
17831,
12,
11487,
1058,
9288,
705,
40496,
4008,
59,
77,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
329,
357,
74,
11,
410,
8,
287,
3297,
0,
7,
33327,
7,
2200,
6489,
13,
2200,
6489,
5377,
37069,
507,
13,
17660,
87,
62,
1837,
2022,
10220,
828,
416,
28,
12957,
8,
198,
220,
220,
220,
220,
220,
220,
220,
479,
82,
796,
6654,
62,
8841,
7,
74,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3691,
796,
6654,
62,
8841,
7,
85,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
288,
82,
6624,
13538,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
366,
7879,
3,
591,
7879,
5218,
19990,
3,
14259,
7879,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
288,
82,
6624,
366,
17831,
1,
11405,
8833,
259,
7,
81,
1,
61,
6852,
52,
58,
15,
12,
24,
32,
12,
50110,
12,
69,
48688,
3,
1600,
3691,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31396,
796,
3691,
58,
18,
25,
437,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30629,
1616,
14808,
66,
357,
12501,
1098,
12,
10641,
705,
1229,
82,
1303,
87,
3,
13155,
4008,
19415,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
220,
357,
361,
269,
357,
79,
1071,
1077,
19990,
3,
591,
7879,
357,
10641,
12,
1462,
12,
8841,
269,
8,
29568,
85,
1501,
480,
35514,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
288,
82,
6624,
366,
17831,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
30629,
79,
1071,
1077,
19990,
3,
591,
7879,
19990,
3,
14259,
7879,
29568,
85,
1501,
480,
4008,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
288,
82,
6624,
366,
397,
4679,
85,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
366,
220,
220,
220,
357,
7879,
3,
591,
7879,
19990,
3,
14259,
7879,
18038,
1058,
10057,
256,
8,
4943,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
366,
7879,
3,
591,
7879,
5218,
19990,
3,
14259,
7879,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
288,
82,
6624,
366,
397,
4679,
85,
1,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
220,
220,
220,
1267,
59,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
220,
19990,
3118,
291,
1098,
47038,
28873,
14259,
357,
73,
43640,
7560,
737,
7879,
59,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
220,
1058,
260,
25636,
79,
19990,
13426,
7,
21807,
58,
13426,
32,
12,
57,
64,
12,
89,
15,
12,
24,
61,
48688,
13426,
19415,
4943,
4943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
43749,
198,
198,
361,
4129,
7,
1503,
14313,
8,
1279,
352,
198,
220,
220,
220,
7716,
62,
46903,
1098,
7203,
1600,
366,
1600,
14367,
448,
8,
198,
17772,
198,
220,
220,
220,
2244,
796,
4129,
7,
1503,
14313,
8,
1875,
362,
5633,
1280,
7,
1503,
14313,
58,
18,
4357,
366,
86,
4943,
1058,
14367,
448,
198,
220,
220,
220,
611,
5923,
14313,
58,
16,
60,
6624,
366,
397,
4679,
85,
1,
198,
220,
220,
220,
220,
220,
220,
220,
7716,
62,
46903,
1098,
7203,
397,
4679,
85,
1600,
366,
1600,
2244,
8,
198,
220,
220,
220,
2073,
361,
5923,
14313,
58,
16,
60,
6624,
366,
17831,
1,
198,
220,
220,
220,
220,
220,
220,
220,
7716,
62,
46903,
1098,
7,
1503,
14313,
58,
16,
4357,
5923,
14313,
58,
17,
4357,
2244,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16520,
11,
366,
20035,
2099,
4943,
198,
220,
220,
220,
886,
198,
437,
198
] | 1.96286 | 1,077 |
# Energy calculation
export
total_energy,
kinetic_energy,
temperature,
potential_energy
"""
total_energy(s, neighbors=nothing)
Calculate the total energy of the system.
If the interactions use neighbor lists, the neighbors should be computed
first and passed to the function.
"""
total_energy(s, neighbors=nothing) = kinetic_energy(s) + potential_energy(s, neighbors)
kinetic_energy_noconvert(s) = sum(mass.(s.atoms) .* sum.(abs2, s.velocities)) / 2
"""
kinetic_energy(s)
Calculate the kinetic energy of the system.
"""
function kinetic_energy(s::System{D, G, T}) where {D, G, T}
ke = kinetic_energy_noconvert(s)
# Convert energy to per mol if required
if dimension(s.energy_units) == u"𝐋^2 * 𝐌 * 𝐍^-1 * 𝐓^-2"
return T(uconvert(s.energy_units, ke * Unitful.Na))
else
return T(uconvert(s.energy_units, ke))
end
end
const temp_conversion_factor = ustrip(u"nm^2 * u * K^-1 * ps^-2", Unitful.k)
"""
temperature(system)
Calculate the temperature of a system from the kinetic energy of the atoms.
"""
function temperature(s::System{D, G, T}) where {D, G, T}
ke = kinetic_energy_noconvert(s)
df = 3 * length(s) - 3
if unit(ke) == NoUnits
k = T(temp_conversion_factor)
else
k = T(uconvert(u"K^-1" * unit(ke), Unitful.k))
end
return 2 * ke / (df * k)
end
function check_energy_units(E, energy_units)
if unit(E) != energy_units
error("System energy units are ", energy_units, " but encountered energy units ",
unit(E))
end
end
@inline @inbounds function potential_energy_nounit(inters, coord_i, coord_j, atom_i, atom_j,
box_size, energy_units, weight_14::Bool=false)
dr = vector(coord_i, coord_j, box_size)
sum(inters) do inter
if weight_14
E = potential_energy(inter, dr, coord_i, coord_j, atom_i, atom_j,
box_size, true)
else
E = potential_energy(inter, dr, coord_i, coord_j, atom_i, atom_j,
box_size)
end
check_energy_units(E, energy_units)
return ustrip(E)
end
end
@views function potential_energy_inters(inters, coords, atoms, neighbors, box_size,
energy_units, weights_14)
coords_i, atoms_i = getindices_i(coords, neighbors), getindices_i(atoms, neighbors)
coords_j, atoms_j = getindices_j(coords, neighbors), getindices_j(atoms, neighbors)
@inbounds energies = potential_energy_nounit.((inters,), coords_i, coords_j,
atoms_i, atoms_j, (box_size,), energy_units, weights_14)
return sum(energies) * energy_units
end
"""
potential_energy(s, neighbors=nothing)
Calculate the potential energy of the system using the pairwise, specific and
general interactions.
If the interactions use neighbor lists, the neighbors should be computed
first and passed to the function.
potential_energy(inter::PairwiseInteraction, vec_ij, coord_i, coord_j,
atom_i, atom_j, box_size)
potential_energy(inter::SpecificInteraction, coords_i, coords_j,
box_size)
potential_energy(inter::SpecificInteraction, coords_i, coords_j,
coords_k, box_size)
potential_energy(inter::SpecificInteraction, coords_i, coords_j,
coords_k, coords_l, box_size)
potential_energy(inter, system, neighbors=nothing)
Calculate the potential energy due to a given interation type.
Custom interaction types should implement this function.
"""
function potential_energy(s::System{D, false, T}, neighbors=nothing) where {D, T}
n_atoms = length(s)
potential = zero(T) * s.energy_units
for inter in values(s.pairwise_inters)
if inter.nl_only
if isnothing(neighbors)
error("An interaction uses the neighbor list but neighbors is nothing")
end
@inbounds for ni in 1:neighbors.n
i, j, weight_14 = neighbors.list[ni]
dr = vector(s.coords[i], s.coords[j], s.box_size)
if weight_14
potential += potential_energy(inter, dr, s.coords[i], s.coords[j], s.atoms[i],
s.atoms[j], s.box_size, true)
else
potential += potential_energy(inter, dr, s.coords[i], s.coords[j], s.atoms[i],
s.atoms[j], s.box_size)
end
end
else
for i in 1:n_atoms
for j in (i + 1):n_atoms
dr = vector(s.coords[i], s.coords[j], s.box_size)
potential += potential_energy(inter, dr, s.coords[i], s.coords[j], s.atoms[i],
s.atoms[j], s.box_size)
end
end
end
end
for inter_list in values(s.specific_inter_lists)
potential += potential_energy(inter_list, s.coords, s.box_size)
end
for inter in values(s.general_inters)
potential += potential_energy(inter, s, neighbors)
end
return uconvert(s.energy_units, potential)
end
function potential_energy(s::System{D, true, T}, neighbors=nothing) where {D, T}
potential = zero(T) * s.energy_units
pairwise_inters_nonl = filter(inter -> !inter.nl_only, values(s.pairwise_inters))
if length(pairwise_inters_nonl) > 0
potential += potential_energy_inters(pairwise_inters_nonl, s.coords, s.atoms,
neighbors.all, s.box_size, s.energy_units, false)
end
pairwise_inters_nl = filter(inter -> inter.nl_only, values(s.pairwise_inters))
if length(pairwise_inters_nl) > 0 && length(neighbors.close.nbsi) > 0
potential += potential_energy_inters(pairwise_inters_nl, s.coords, s.atoms,
neighbors.close, s.box_size, s.energy_units, neighbors.close.weights_14)
end
for inter_list in values(s.specific_inter_lists)
potential += potential_energy(inter_list, s.coords, s.box_size)
end
for inter in values(s.general_inters)
potential += potential_energy(inter, s, neighbors)
end
return uconvert(s.energy_units, potential)
end
@views function potential_energy(inter_list::InteractionList2Atoms, coords, box_size)
return sum(potential_energy.(inter_list.inters, coords[inter_list.is], coords[inter_list.js],
(box_size,)))
end
@views function potential_energy(inter_list::InteractionList3Atoms, coords, box_size)
return sum(potential_energy.(inter_list.inters, coords[inter_list.is], coords[inter_list.js],
coords[inter_list.ks], (box_size,)))
end
@views function potential_energy(inter_list::InteractionList4Atoms, coords, box_size)
return sum(potential_energy.(inter_list.inters, coords[inter_list.is], coords[inter_list.js],
coords[inter_list.ks], coords[inter_list.ls], (box_size,)))
end
| [
2,
6682,
17952,
198,
198,
39344,
198,
220,
220,
220,
2472,
62,
22554,
11,
198,
220,
220,
220,
37892,
62,
22554,
11,
198,
220,
220,
220,
5951,
11,
198,
220,
220,
220,
2785,
62,
22554,
198,
198,
37811,
198,
220,
220,
220,
2472,
62,
22554,
7,
82,
11,
12020,
28,
22366,
8,
198,
198,
9771,
3129,
378,
262,
2472,
2568,
286,
262,
1080,
13,
198,
1532,
262,
12213,
779,
4780,
8341,
11,
262,
12020,
815,
307,
29231,
198,
11085,
290,
3804,
284,
262,
2163,
13,
198,
37811,
198,
23350,
62,
22554,
7,
82,
11,
12020,
28,
22366,
8,
796,
37892,
62,
22554,
7,
82,
8,
1343,
2785,
62,
22554,
7,
82,
11,
12020,
8,
198,
198,
5116,
5139,
62,
22554,
62,
77,
36221,
1851,
7,
82,
8,
796,
2160,
7,
22208,
12195,
82,
13,
265,
3150,
8,
764,
9,
2160,
12195,
8937,
17,
11,
264,
13,
626,
420,
871,
4008,
1220,
362,
198,
198,
37811,
198,
220,
220,
220,
37892,
62,
22554,
7,
82,
8,
198,
198,
9771,
3129,
378,
262,
37892,
2568,
286,
262,
1080,
13,
198,
37811,
198,
8818,
37892,
62,
22554,
7,
82,
3712,
11964,
90,
35,
11,
402,
11,
309,
30072,
810,
1391,
35,
11,
402,
11,
309,
92,
198,
220,
220,
220,
885,
796,
37892,
62,
22554,
62,
77,
36221,
1851,
7,
82,
8,
198,
220,
220,
220,
1303,
38240,
2568,
284,
583,
18605,
611,
2672,
198,
220,
220,
220,
611,
15793,
7,
82,
13,
22554,
62,
41667,
8,
6624,
334,
1,
47728,
238,
233,
61,
17,
1635,
220,
47728,
238,
234,
1635,
220,
47728,
238,
235,
61,
12,
16,
1635,
220,
47728,
238,
241,
61,
12,
17,
1,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
309,
7,
84,
1102,
1851,
7,
82,
13,
22554,
62,
41667,
11,
885,
1635,
11801,
913,
13,
26705,
4008,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
309,
7,
84,
1102,
1851,
7,
82,
13,
22554,
62,
41667,
11,
885,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
9979,
20218,
62,
1102,
9641,
62,
31412,
796,
334,
36311,
7,
84,
1,
21533,
61,
17,
1635,
334,
1635,
509,
61,
12,
16,
1635,
26692,
61,
12,
17,
1600,
11801,
913,
13,
74,
8,
198,
198,
37811,
198,
220,
220,
220,
5951,
7,
10057,
8,
198,
198,
9771,
3129,
378,
262,
5951,
286,
257,
1080,
422,
262,
37892,
2568,
286,
262,
23235,
13,
198,
37811,
198,
8818,
5951,
7,
82,
3712,
11964,
90,
35,
11,
402,
11,
309,
30072,
810,
1391,
35,
11,
402,
11,
309,
92,
198,
220,
220,
220,
885,
796,
37892,
62,
22554,
62,
77,
36221,
1851,
7,
82,
8,
198,
220,
220,
220,
47764,
796,
513,
1635,
4129,
7,
82,
8,
532,
513,
198,
220,
220,
220,
611,
4326,
7,
365,
8,
6624,
1400,
3118,
896,
198,
220,
220,
220,
220,
220,
220,
220,
479,
796,
309,
7,
29510,
62,
1102,
9641,
62,
31412,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
479,
796,
309,
7,
84,
1102,
1851,
7,
84,
1,
42,
61,
12,
16,
1,
1635,
4326,
7,
365,
828,
11801,
913,
13,
74,
4008,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
362,
1635,
885,
1220,
357,
7568,
1635,
479,
8,
198,
437,
198,
198,
8818,
2198,
62,
22554,
62,
41667,
7,
36,
11,
2568,
62,
41667,
8,
198,
220,
220,
220,
611,
4326,
7,
36,
8,
14512,
2568,
62,
41667,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
11964,
2568,
4991,
389,
33172,
2568,
62,
41667,
11,
366,
475,
12956,
2568,
4991,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4326,
7,
36,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
45145,
2488,
259,
65,
3733,
2163,
2785,
62,
22554,
62,
77,
977,
270,
7,
20193,
11,
6349,
62,
72,
11,
6349,
62,
73,
11,
22037,
62,
72,
11,
22037,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
62,
7857,
11,
2568,
62,
41667,
11,
3463,
62,
1415,
3712,
33,
970,
28,
9562,
8,
198,
220,
220,
220,
1553,
796,
15879,
7,
37652,
62,
72,
11,
6349,
62,
73,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
2160,
7,
20193,
8,
466,
987,
198,
220,
220,
220,
220,
220,
220,
220,
611,
3463,
62,
1415,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
796,
2785,
62,
22554,
7,
3849,
11,
1553,
11,
6349,
62,
72,
11,
6349,
62,
73,
11,
22037,
62,
72,
11,
22037,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
62,
7857,
11,
2081,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
412,
796,
2785,
62,
22554,
7,
3849,
11,
1553,
11,
6349,
62,
72,
11,
6349,
62,
73,
11,
22037,
62,
72,
11,
22037,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2198,
62,
22554,
62,
41667,
7,
36,
11,
2568,
62,
41667,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
334,
36311,
7,
36,
8,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
33571,
2163,
2785,
62,
22554,
62,
20193,
7,
20193,
11,
763,
3669,
11,
23235,
11,
12020,
11,
3091,
62,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2568,
62,
41667,
11,
19590,
62,
1415,
8,
198,
220,
220,
220,
763,
3669,
62,
72,
11,
23235,
62,
72,
796,
651,
521,
1063,
62,
72,
7,
1073,
3669,
11,
12020,
828,
651,
521,
1063,
62,
72,
7,
265,
3150,
11,
12020,
8,
198,
220,
220,
220,
763,
3669,
62,
73,
11,
23235,
62,
73,
796,
651,
521,
1063,
62,
73,
7,
1073,
3669,
11,
12020,
828,
651,
521,
1063,
62,
73,
7,
265,
3150,
11,
12020,
8,
198,
220,
220,
220,
2488,
259,
65,
3733,
27598,
796,
2785,
62,
22554,
62,
77,
977,
270,
12195,
7,
20193,
11,
828,
763,
3669,
62,
72,
11,
763,
3669,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23235,
62,
72,
11,
23235,
62,
73,
11,
357,
3524,
62,
7857,
11,
828,
2568,
62,
41667,
11,
19590,
62,
1415,
8,
198,
220,
220,
220,
1441,
2160,
7,
877,
70,
444,
8,
1635,
2568,
62,
41667,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2785,
62,
22554,
7,
82,
11,
12020,
28,
22366,
8,
198,
198,
9771,
3129,
378,
262,
2785,
2568,
286,
262,
1080,
1262,
262,
5166,
3083,
11,
2176,
290,
198,
24622,
12213,
13,
198,
1532,
262,
12213,
779,
4780,
8341,
11,
262,
12020,
815,
307,
29231,
198,
11085,
290,
3804,
284,
262,
2163,
13,
628,
220,
220,
220,
2785,
62,
22554,
7,
3849,
3712,
47,
958,
3083,
9492,
2673,
11,
43030,
62,
2926,
11,
6349,
62,
72,
11,
6349,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22037,
62,
72,
11,
22037,
62,
73,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
2785,
62,
22554,
7,
3849,
3712,
32419,
9492,
2673,
11,
763,
3669,
62,
72,
11,
763,
3669,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3091,
62,
7857,
8,
198,
220,
220,
220,
2785,
62,
22554,
7,
3849,
3712,
32419,
9492,
2673,
11,
763,
3669,
62,
72,
11,
763,
3669,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
763,
3669,
62,
74,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
2785,
62,
22554,
7,
3849,
3712,
32419,
9492,
2673,
11,
763,
3669,
62,
72,
11,
763,
3669,
62,
73,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
763,
3669,
62,
74,
11,
763,
3669,
62,
75,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
2785,
62,
22554,
7,
3849,
11,
1080,
11,
12020,
28,
22366,
8,
198,
198,
9771,
3129,
378,
262,
2785,
2568,
2233,
284,
257,
1813,
987,
341,
2099,
13,
198,
15022,
10375,
3858,
815,
3494,
428,
2163,
13,
198,
37811,
198,
8818,
2785,
62,
22554,
7,
82,
3712,
11964,
90,
35,
11,
3991,
11,
309,
5512,
12020,
28,
22366,
8,
810,
1391,
35,
11,
309,
92,
198,
220,
220,
220,
299,
62,
265,
3150,
796,
4129,
7,
82,
8,
198,
220,
220,
220,
2785,
796,
6632,
7,
51,
8,
1635,
264,
13,
22554,
62,
41667,
628,
220,
220,
220,
329,
987,
287,
3815,
7,
82,
13,
24874,
3083,
62,
20193,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
987,
13,
21283,
62,
8807,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
22366,
7,
710,
394,
32289,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
2025,
10375,
3544,
262,
4780,
1351,
475,
12020,
318,
2147,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
329,
37628,
287,
352,
25,
710,
394,
32289,
13,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
11,
474,
11,
3463,
62,
1415,
796,
12020,
13,
4868,
58,
8461,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1553,
796,
15879,
7,
82,
13,
1073,
3669,
58,
72,
4357,
264,
13,
1073,
3669,
58,
73,
4357,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3463,
62,
1415,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
11,
1553,
11,
264,
13,
1073,
3669,
58,
72,
4357,
264,
13,
1073,
3669,
58,
73,
4357,
264,
13,
265,
3150,
58,
72,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
13,
265,
3150,
58,
73,
4357,
264,
13,
3524,
62,
7857,
11,
2081,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
11,
1553,
11,
264,
13,
1073,
3669,
58,
72,
4357,
264,
13,
1073,
3669,
58,
73,
4357,
264,
13,
265,
3150,
58,
72,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
13,
265,
3150,
58,
73,
4357,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
352,
25,
77,
62,
265,
3150,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
357,
72,
1343,
352,
2599,
77,
62,
265,
3150,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1553,
796,
15879,
7,
82,
13,
1073,
3669,
58,
72,
4357,
264,
13,
1073,
3669,
58,
73,
4357,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
11,
1553,
11,
264,
13,
1073,
3669,
58,
72,
4357,
264,
13,
1073,
3669,
58,
73,
4357,
264,
13,
265,
3150,
58,
72,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
13,
265,
3150,
58,
73,
4357,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
987,
62,
4868,
287,
3815,
7,
82,
13,
11423,
62,
3849,
62,
20713,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
62,
4868,
11,
264,
13,
1073,
3669,
11,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
987,
287,
3815,
7,
82,
13,
24622,
62,
20193,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
11,
264,
11,
12020,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
334,
1102,
1851,
7,
82,
13,
22554,
62,
41667,
11,
2785,
8,
198,
437,
198,
198,
8818,
2785,
62,
22554,
7,
82,
3712,
11964,
90,
35,
11,
2081,
11,
309,
5512,
12020,
28,
22366,
8,
810,
1391,
35,
11,
309,
92,
198,
220,
220,
220,
2785,
796,
6632,
7,
51,
8,
1635,
264,
13,
22554,
62,
41667,
628,
220,
220,
220,
5166,
3083,
62,
20193,
62,
13159,
75,
796,
8106,
7,
3849,
4613,
5145,
3849,
13,
21283,
62,
8807,
11,
3815,
7,
82,
13,
24874,
3083,
62,
20193,
4008,
198,
220,
220,
220,
611,
4129,
7,
24874,
3083,
62,
20193,
62,
13159,
75,
8,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
62,
20193,
7,
24874,
3083,
62,
20193,
62,
13159,
75,
11,
264,
13,
1073,
3669,
11,
264,
13,
265,
3150,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12020,
13,
439,
11,
264,
13,
3524,
62,
7857,
11,
264,
13,
22554,
62,
41667,
11,
3991,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
5166,
3083,
62,
20193,
62,
21283,
796,
8106,
7,
3849,
4613,
987,
13,
21283,
62,
8807,
11,
3815,
7,
82,
13,
24874,
3083,
62,
20193,
4008,
198,
220,
220,
220,
611,
4129,
7,
24874,
3083,
62,
20193,
62,
21283,
8,
1875,
657,
11405,
4129,
7,
710,
394,
32289,
13,
19836,
13,
77,
1443,
72,
8,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
62,
20193,
7,
24874,
3083,
62,
20193,
62,
21283,
11,
264,
13,
1073,
3669,
11,
264,
13,
265,
3150,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12020,
13,
19836,
11,
264,
13,
3524,
62,
7857,
11,
264,
13,
22554,
62,
41667,
11,
12020,
13,
19836,
13,
43775,
62,
1415,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
987,
62,
4868,
287,
3815,
7,
82,
13,
11423,
62,
3849,
62,
20713,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
62,
4868,
11,
264,
13,
1073,
3669,
11,
264,
13,
3524,
62,
7857,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
987,
287,
3815,
7,
82,
13,
24622,
62,
20193,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2785,
15853,
2785,
62,
22554,
7,
3849,
11,
264,
11,
12020,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
334,
1102,
1851,
7,
82,
13,
22554,
62,
41667,
11,
2785,
8,
198,
437,
198,
198,
31,
33571,
2163,
2785,
62,
22554,
7,
3849,
62,
4868,
3712,
9492,
2673,
8053,
17,
2953,
3150,
11,
763,
3669,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
1441,
2160,
7,
13059,
1843,
62,
22554,
12195,
3849,
62,
4868,
13,
20193,
11,
763,
3669,
58,
3849,
62,
4868,
13,
271,
4357,
763,
3669,
58,
3849,
62,
4868,
13,
8457,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
3524,
62,
7857,
11,
22305,
198,
437,
198,
198,
31,
33571,
2163,
2785,
62,
22554,
7,
3849,
62,
4868,
3712,
9492,
2673,
8053,
18,
2953,
3150,
11,
763,
3669,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
1441,
2160,
7,
13059,
1843,
62,
22554,
12195,
3849,
62,
4868,
13,
20193,
11,
763,
3669,
58,
3849,
62,
4868,
13,
271,
4357,
763,
3669,
58,
3849,
62,
4868,
13,
8457,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
763,
3669,
58,
3849,
62,
4868,
13,
591,
4357,
357,
3524,
62,
7857,
11,
22305,
198,
437,
198,
198,
31,
33571,
2163,
2785,
62,
22554,
7,
3849,
62,
4868,
3712,
9492,
2673,
8053,
19,
2953,
3150,
11,
763,
3669,
11,
3091,
62,
7857,
8,
198,
220,
220,
220,
1441,
2160,
7,
13059,
1843,
62,
22554,
12195,
3849,
62,
4868,
13,
20193,
11,
763,
3669,
58,
3849,
62,
4868,
13,
271,
4357,
763,
3669,
58,
3849,
62,
4868,
13,
8457,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
763,
3669,
58,
3849,
62,
4868,
13,
591,
4357,
763,
3669,
58,
3849,
62,
4868,
13,
7278,
4357,
357,
3524,
62,
7857,
11,
22305,
198,
437,
198
] | 2.190887 | 3,248 |
#########
# setk! #
#########
function setk!(x, k_requested, v)
k = setk!_inner(x, k_requested, v)
if k > 0
error("Index ", k_requested, " is out of bounds.")
end
end
@generated function setk!_inner(x::T, k, v) where {T}
if T <: Array
if eltype(T) <: Real
quote
if k <= length(x)
x[k] = v
return 0
end
return k-length(x)
end
else
quote
for c = 1:length(x)
k = setk!_inner(x[c], k, v)
if k <= 0
return 0
end
end
end
end
elseif T <: Nothing
quote
# We shouldn't be trying to set a Nothing. Skip it.
# if k <= 1
# # x[k] = v
# return 0
# end
return k
end
elseif !isempty(fieldnames(T))
expr = Vector{Expr}()
for f in fieldnames(x)
push!(expr, quote
if typeof(x.$f) <: Real # For scalars, we must overwrite the field directly.
if k == 1
x.$f = v
return 0
end
k -= 1
elseif typeof(x.$f) <: Nothing # For nothings, we ignore the write.
# if k == 1
# x.$f = nothing
# return 0
# end
k # We didn't use any index for this.
else # For anything else, it's assumed that we can recur and set something inside the field.
k = setk!_inner(x.$f, k, v)
if k <= 0
return 0
end
end
end)
end
push!(expr, :( return k ))
Expr(:block, expr...)
else
error("I don't know how to set an index of a ", T, ".")
end
end
########
# getk #
########
# Get index k of x, which might be a struct of struct of vectors or something.
function getk(x, k_requested)
r, k = getk_inner(x, k_requested)
if k > 0
error("Index ", k_requested, " is out of bounds.")
end
return r
end
@generated function getk_inner(x::T, k) where {T}
if T <: Real
quote
if k == 1
return (x, 0)
end
return (0., k-1)
end
elseif T <: Nothing
quote
# if k == 1
# return (0., 0)
# end
return (0., k)
end
elseif T <: Array
if eltype(T) <: Real
quote
if k <= length(x)
return (x[k], 0)
end
return (0., k-length(x))
end
else
quote
for c = 1:length(x)
r, k = getk_inner(x[c], k)
if k <= 0
return (r, 0)
end
end
end
end
elseif !isempty(fieldnames(T))
expr = Vector{Expr}()
push!(expr, :( r = 0. ))
for f in fieldnames(x)
push!(expr, quote
r, k = getk_inner(x.$f, k)
if k <= 0
return (r, 0)
end
end)
end
push!(expr, :( return (0., k) ))
Expr(:block, expr...)
else
error("I don't know how to get an index of a ", T, ".")
end
end
###########
# stackem #
###########
# Stacks reals, arrays, and anything with fieldnames into a new vector, returning the vector.
stackem(y::T) where {T} = stackem!(Vector{Float64}(), y)
# Stacks reals, arrays, and anything with fieldnames into an existing vector. Super fast!
# We write this as an if on the type, because this allows us to do more than multiple dispatch.
# E.g., we can detect a struct by asking for its field names.
@generated function stackem!(x, y::T) where {T}
if T <: Real
:( push!(x, y) )
elseif T <: Enum
:( push!(x, Base.Enums.basetype(T)(y)) )
elseif T <: Array
if eltype(T) <: Real
:( append!(x, y) )
else
quote
for c = 1:length(y)
stackem!(x, y[c])
end
x
end
end
elseif !isempty(fieldnames(T)) # This is nice; we can't do this with multiple dispatch. Do this for + and * and remove the ModelStates thing?
Expr(:block, ( :( stackem!(x, y.$f) ) for f in fieldnames(T) )...)
elseif T <: Nothing # There's nothing to stack.
:(x) # :o
else
error("Sorry, I don't know how to stack a ", T, ".")
end
end
# Stack into a preallocated vector, starting at k+1. Returns k, the number elements written.
@generated function stackem!(x, y::T, k) where {T}
if T <: Real || T <: Enum
quote
x[k+1] = y
k+1
end
elseif T <: Array
if eltype(T) <: Real
quote
x[k+1:k+length(y)] = y[:]
k+length(y)
end
else
quote
for c = 1:length(y)
k = stackem!(x, y[c], k)
end
end
end
elseif !isempty(fieldnames(T)) # This is nice; we can't do this with multiple dispatch. Do this for + and * and remove the ModelStates thing?
Expr(:block, ( :( k = stackem!(x, y.$f, k) ) for f in fieldnames(T) )...)
elseif T <: Nothing
:(k) # Don't choke on that k, my friend.
else
error("Sorry, I don't know how to stack a ", T, ".")
end
end
| [
7804,
2,
198,
2,
900,
74,
0,
1303,
198,
7804,
2,
198,
198,
8818,
900,
74,
0,
7,
87,
11,
479,
62,
25927,
276,
11,
410,
8,
198,
220,
220,
220,
479,
796,
900,
74,
0,
62,
5083,
7,
87,
11,
479,
62,
25927,
276,
11,
410,
8,
198,
220,
220,
220,
611,
479,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
15732,
33172,
479,
62,
25927,
276,
11,
366,
318,
503,
286,
22303,
19570,
198,
220,
220,
220,
886,
198,
437,
198,
31,
27568,
2163,
900,
74,
0,
62,
5083,
7,
87,
3712,
51,
11,
479,
11,
410,
8,
810,
1391,
51,
92,
198,
220,
220,
220,
611,
309,
1279,
25,
15690,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1288,
4906,
7,
51,
8,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
4129,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
58,
74,
60,
796,
410,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
479,
12,
13664,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
269,
796,
352,
25,
13664,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
796,
900,
74,
0,
62,
5083,
7,
87,
58,
66,
4357,
479,
11,
410,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
10528,
198,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
775,
6584,
470,
307,
2111,
284,
900,
257,
10528,
13,
32214,
340,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
479,
19841,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1303,
2124,
58,
74,
60,
796,
410,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
479,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
5145,
271,
28920,
7,
3245,
14933,
7,
51,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
44052,
796,
20650,
90,
3109,
1050,
92,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
329,
277,
287,
2214,
14933,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
31937,
11,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2099,
1659,
7,
87,
48082,
69,
8,
1279,
25,
6416,
1303,
1114,
16578,
945,
11,
356,
1276,
49312,
262,
2214,
3264,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
48082,
69,
796,
410,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
48185,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
2099,
1659,
7,
87,
48082,
69,
8,
1279,
25,
10528,
1303,
1114,
407,
71,
654,
11,
356,
8856,
262,
3551,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
479,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
2124,
48082,
69,
796,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
1303,
775,
1422,
470,
779,
597,
6376,
329,
428,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
1303,
1114,
1997,
2073,
11,
340,
338,
9672,
326,
356,
460,
664,
333,
290,
900,
1223,
2641,
262,
2214,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
796,
900,
74,
0,
62,
5083,
7,
87,
48082,
69,
11,
479,
11,
410,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
31937,
11,
36147,
1441,
479,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
9967,
11,
44052,
23029,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
40,
836,
470,
760,
703,
284,
900,
281,
6376,
286,
257,
33172,
309,
11,
366,
19570,
198,
220,
220,
220,
886,
198,
437,
198,
198,
7804,
198,
2,
651,
74,
1303,
198,
7804,
198,
198,
2,
3497,
6376,
479,
286,
2124,
11,
543,
1244,
307,
257,
2878,
286,
2878,
286,
30104,
393,
1223,
13,
198,
8818,
651,
74,
7,
87,
11,
479,
62,
25927,
276,
8,
198,
220,
220,
220,
374,
11,
479,
796,
651,
74,
62,
5083,
7,
87,
11,
479,
62,
25927,
276,
8,
198,
220,
220,
220,
611,
479,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
15732,
33172,
479,
62,
25927,
276,
11,
366,
318,
503,
286,
22303,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
374,
198,
437,
198,
31,
27568,
2163,
651,
74,
62,
5083,
7,
87,
3712,
51,
11,
479,
8,
810,
1391,
51,
92,
198,
220,
220,
220,
611,
309,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
87,
11,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
15,
1539,
479,
12,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
10528,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
611,
479,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1441,
357,
15,
1539,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
15,
1539,
479,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
15690,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1288,
4906,
7,
51,
8,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
4129,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
87,
58,
74,
4357,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
15,
1539,
479,
12,
13664,
7,
87,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
269,
796,
352,
25,
13664,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
11,
479,
796,
651,
74,
62,
5083,
7,
87,
58,
66,
4357,
479,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
81,
11,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
5145,
271,
28920,
7,
3245,
14933,
7,
51,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
44052,
796,
20650,
90,
3109,
1050,
92,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
31937,
11,
36147,
374,
796,
657,
13,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
329,
277,
287,
2214,
14933,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
31937,
11,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
11,
479,
796,
651,
74,
62,
5083,
7,
87,
48082,
69,
11,
479,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
479,
19841,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
81,
11,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
31937,
11,
36147,
1441,
357,
15,
1539,
479,
8,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
9967,
11,
44052,
23029,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
40,
836,
470,
760,
703,
284,
651,
281,
6376,
286,
257,
33172,
309,
11,
366,
19570,
198,
220,
220,
220,
886,
198,
437,
198,
198,
7804,
21017,
198,
2,
336,
330,
365,
76,
1303,
198,
7804,
21017,
198,
198,
2,
520,
4595,
302,
874,
11,
26515,
11,
290,
1997,
351,
2214,
14933,
656,
257,
649,
15879,
11,
8024,
262,
15879,
13,
198,
301,
330,
365,
76,
7,
88,
3712,
51,
8,
810,
1391,
51,
92,
796,
336,
330,
365,
76,
0,
7,
38469,
90,
43879,
2414,
92,
22784,
331,
8,
198,
198,
2,
520,
4595,
302,
874,
11,
26515,
11,
290,
1997,
351,
2214,
14933,
656,
281,
4683,
15879,
13,
3115,
3049,
0,
198,
2,
775,
3551,
428,
355,
281,
611,
319,
262,
2099,
11,
780,
428,
3578,
514,
284,
466,
517,
621,
3294,
27965,
13,
198,
2,
412,
13,
70,
1539,
356,
460,
4886,
257,
2878,
416,
4737,
329,
663,
2214,
3891,
13,
198,
31,
27568,
2163,
336,
330,
365,
76,
0,
7,
87,
11,
331,
3712,
51,
8,
810,
1391,
51,
92,
198,
220,
220,
220,
611,
309,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
36147,
4574,
0,
7,
87,
11,
331,
8,
1267,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
2039,
388,
198,
220,
220,
220,
220,
220,
220,
220,
36147,
4574,
0,
7,
87,
11,
7308,
13,
4834,
5700,
13,
12093,
2963,
431,
7,
51,
5769,
88,
4008,
1267,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
15690,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1288,
4906,
7,
51,
8,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
24443,
0,
7,
87,
11,
331,
8,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
269,
796,
352,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
330,
365,
76,
0,
7,
87,
11,
331,
58,
66,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
5145,
271,
28920,
7,
3245,
14933,
7,
51,
4008,
1303,
770,
318,
3621,
26,
356,
460,
470,
466,
428,
351,
3294,
27965,
13,
2141,
428,
329,
1343,
290,
1635,
290,
4781,
262,
9104,
42237,
1517,
30,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
9967,
11,
357,
36147,
336,
330,
365,
76,
0,
7,
87,
11,
331,
48082,
69,
8,
1267,
329,
277,
287,
2214,
14933,
7,
51,
8,
1267,
23029,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
10528,
1303,
1318,
338,
2147,
284,
8931,
13,
198,
220,
220,
220,
220,
220,
220,
220,
36147,
87,
8,
1303,
1058,
78,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
14385,
11,
314,
836,
470,
760,
703,
284,
8931,
257,
33172,
309,
11,
366,
19570,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
23881,
656,
257,
662,
439,
10533,
15879,
11,
3599,
379,
479,
10,
16,
13,
16409,
479,
11,
262,
1271,
4847,
3194,
13,
198,
31,
27568,
2163,
336,
330,
365,
76,
0,
7,
87,
11,
331,
3712,
51,
11,
479,
8,
810,
1391,
51,
92,
198,
220,
220,
220,
611,
309,
1279,
25,
6416,
8614,
309,
1279,
25,
2039,
388,
198,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
58,
74,
10,
16,
60,
796,
331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
10,
16,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
15690,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1288,
4906,
7,
51,
8,
1279,
25,
6416,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
58,
74,
10,
16,
25,
74,
10,
13664,
7,
88,
15437,
796,
331,
58,
47715,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
10,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
269,
796,
352,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
796,
336,
330,
365,
76,
0,
7,
87,
11,
331,
58,
66,
4357,
479,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
5145,
271,
28920,
7,
3245,
14933,
7,
51,
4008,
1303,
770,
318,
3621,
26,
356,
460,
470,
466,
428,
351,
3294,
27965,
13,
2141,
428,
329,
1343,
290,
1635,
290,
4781,
262,
9104,
42237,
1517,
30,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
9967,
11,
357,
36147,
479,
796,
336,
330,
365,
76,
0,
7,
87,
11,
331,
48082,
69,
11,
479,
8,
1267,
329,
277,
287,
2214,
14933,
7,
51,
8,
1267,
23029,
198,
220,
220,
220,
2073,
361,
309,
1279,
25,
10528,
198,
220,
220,
220,
220,
220,
220,
220,
36147,
74,
8,
1303,
2094,
470,
28504,
319,
326,
479,
11,
616,
1545,
13,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
14385,
11,
314,
836,
470,
760,
703,
284,
8931,
257,
33172,
309,
11,
366,
19570,
198,
220,
220,
220,
886,
198,
437,
198
] | 1.763431 | 3,276 |
using GPX
using TimeZones
using LightXML: XMLDocument, save_file
author = GPXAuthor("S. Celles")
metadata = GPXMetadata(
name="07/11/2019 LFBI (09:32) LFBI (11:34)",
author=author,
time=ZonedDateTime("2019-01-01T00:00:0.000+00:00"), # ZonedDateTime("2019-01-01T00:00:00.000Z") when https://github.com/JuliaTime/TimeZones.jl/pull/227 will be merged
)
gpx = GPXDocument(metadata)
track = new_track(gpx)
track_segment = new_track_segment(track)
point = GPXPoint(0.0, 0.0, 0.0, ZonedDateTime("2019-11-09T09:14:17.473+00:00"), "")
push!(track_segment, point)
# println(gpx)
xdoc = XMLDocument(gpx)
println(xdoc)
fname = "generated.gpx"
save_file(xdoc, fname)
println("GPX file saved to \"$fname\"")
| [
3500,
14714,
55,
198,
3500,
3862,
57,
1952,
198,
3500,
4401,
55,
5805,
25,
23735,
24941,
11,
3613,
62,
7753,
628,
198,
9800,
796,
14714,
55,
13838,
7203,
50,
13,
12440,
274,
4943,
198,
198,
38993,
796,
14714,
55,
9171,
14706,
7,
198,
220,
220,
220,
1438,
2625,
2998,
14,
1157,
14,
23344,
406,
39379,
357,
2931,
25,
2624,
8,
406,
39379,
357,
1157,
25,
2682,
42501,
198,
220,
220,
220,
1772,
28,
9800,
11,
198,
220,
220,
220,
640,
28,
57,
12004,
10430,
7575,
7203,
23344,
12,
486,
12,
486,
51,
405,
25,
405,
25,
15,
13,
830,
10,
405,
25,
405,
12340,
1303,
1168,
12004,
10430,
7575,
7203,
23344,
12,
486,
12,
486,
51,
405,
25,
405,
25,
405,
13,
830,
57,
4943,
618,
3740,
1378,
12567,
13,
785,
14,
16980,
544,
7575,
14,
7575,
57,
1952,
13,
20362,
14,
31216,
14,
24403,
481,
307,
23791,
198,
8,
198,
198,
70,
8416,
796,
14714,
55,
24941,
7,
38993,
8,
198,
198,
11659,
796,
649,
62,
11659,
7,
70,
8416,
8,
198,
11659,
62,
325,
5154,
796,
649,
62,
11659,
62,
325,
5154,
7,
11659,
8,
198,
4122,
796,
14714,
55,
12727,
7,
15,
13,
15,
11,
657,
13,
15,
11,
657,
13,
15,
11,
1168,
12004,
10430,
7575,
7203,
23344,
12,
1157,
12,
2931,
51,
2931,
25,
1415,
25,
1558,
13,
37804,
10,
405,
25,
405,
12340,
366,
4943,
198,
14689,
0,
7,
11659,
62,
325,
5154,
11,
966,
8,
198,
198,
2,
44872,
7,
70,
8416,
8,
198,
198,
87,
15390,
796,
23735,
24941,
7,
70,
8416,
8,
198,
198,
35235,
7,
87,
15390,
8,
198,
198,
69,
3672,
796,
366,
27568,
13,
70,
8416,
1,
198,
21928,
62,
7753,
7,
87,
15390,
11,
277,
3672,
8,
198,
35235,
7203,
16960,
55,
2393,
7448,
284,
19990,
3,
69,
3672,
7879,
4943,
198
] | 2.344262 | 305 |
using LinearAlgebraicRepresentation
Lar = LinearAlgebraicRepresentation
# Compute coboundary_1 in 2D via product FV * EV^t with fixing of redundancies
FV = [[1,2,3,4,5,17,16,12],
[1,2,3,4,6,7,8,9,10,11,12,13,14,15],
[4,5,9,11,12,13,14,15,16,17],
[2,3,6,7], [8,9,10,11]]
EV = [[1,2],[2,3],[3,4],[4,5],[1,12],[2,6],[3,7],[4,9],[5,17],[6,7],[8,9],
[8,10],[9,11],[10,11],[11,15],[12,13],[12,16],[13,14],[14,15],[16,17]]
V = Float64[ 0 2 5 7 10 2 5 3 7 3 7 0 3 3 7 0 10;
16 16 16 16 16 13 13 11 11 8 8 5 5 2 2 0 0]
# non-convex cells (convex=false), including outer cell (exterior=true)
copFE = Lar.coboundary_1( V::Lar.Points, FV::Lar.Cells, EV::Lar.Cells, false,true );
Matrix(copFE)
VV = [[k] for k in 1:size(V,2)];
using Plasm
Plasm.view( Plasm.numbering(3)((V,[VV, EV, FV])) )
# final solid visualization
copEV = Lar.coboundary_0(EV)
W = convert(Lar.Points, V')
triangulated_faces = Lar.triangulate2D(W, [copEV, copFE])
#triangulated_faces = Lar.triangulate2d(V, EV)
FVs = convert(Array{Lar.Cells}, triangulated_faces)
Plasm.viewcolor(V::Lar.Points, FVs::Array{Lar.Cells})
#TODO: debug ...
| [
3500,
44800,
2348,
29230,
291,
40171,
341,
198,
43,
283,
796,
44800,
2348,
29230,
291,
40171,
341,
198,
198,
2,
3082,
1133,
22843,
633,
560,
62,
16,
287,
362,
35,
2884,
1720,
376,
53,
1635,
8696,
61,
83,
351,
18682,
286,
22916,
16183,
198,
198,
37,
53,
796,
16410,
16,
11,
17,
11,
18,
11,
19,
11,
20,
11,
1558,
11,
1433,
11,
1065,
4357,
198,
58,
16,
11,
17,
11,
18,
11,
19,
11,
21,
11,
22,
11,
23,
11,
24,
11,
940,
11,
1157,
11,
1065,
11,
1485,
11,
1415,
11,
1314,
4357,
198,
58,
19,
11,
20,
11,
24,
11,
1157,
11,
1065,
11,
1485,
11,
1415,
11,
1314,
11,
1433,
11,
1558,
4357,
198,
58,
17,
11,
18,
11,
21,
11,
22,
4357,
685,
23,
11,
24,
11,
940,
11,
1157,
11907,
198,
198,
20114,
796,
16410,
16,
11,
17,
38430,
17,
11,
18,
38430,
18,
11,
19,
38430,
19,
11,
20,
38430,
16,
11,
1065,
38430,
17,
11,
21,
38430,
18,
11,
22,
38430,
19,
11,
24,
38430,
20,
11,
1558,
38430,
21,
11,
22,
38430,
23,
11,
24,
4357,
198,
58,
23,
11,
940,
38430,
24,
11,
1157,
38430,
940,
11,
1157,
38430,
1157,
11,
1314,
38430,
1065,
11,
1485,
38430,
1065,
11,
1433,
38430,
1485,
11,
1415,
38430,
1415,
11,
1314,
38430,
1433,
11,
1558,
11907,
198,
198,
53,
796,
48436,
2414,
58,
657,
220,
220,
362,
220,
220,
642,
220,
220,
767,
220,
838,
220,
220,
362,
220,
220,
642,
220,
220,
513,
220,
220,
767,
220,
513,
220,
767,
220,
657,
220,
513,
220,
513,
220,
767,
220,
657,
220,
838,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1467,
220,
1467,
220,
1467,
220,
1467,
220,
1467,
220,
1511,
220,
1511,
220,
1367,
220,
1367,
220,
807,
220,
807,
220,
642,
220,
642,
220,
362,
220,
362,
220,
657,
220,
220,
657,
60,
198,
198,
2,
1729,
12,
1102,
303,
87,
4778,
357,
1102,
303,
87,
28,
9562,
828,
1390,
12076,
2685,
357,
1069,
14172,
28,
7942,
8,
198,
22163,
15112,
796,
25577,
13,
66,
672,
633,
560,
62,
16,
7,
569,
3712,
43,
283,
13,
40710,
11,
376,
53,
3712,
43,
283,
13,
34,
19187,
11,
8696,
3712,
43,
283,
13,
34,
19187,
11,
3991,
11,
7942,
5619,
198,
46912,
7,
22163,
15112,
8,
198,
198,
53,
53,
796,
16410,
74,
60,
329,
479,
287,
352,
25,
7857,
7,
53,
11,
17,
8,
11208,
198,
3500,
1345,
8597,
198,
3646,
8597,
13,
1177,
7,
1345,
8597,
13,
17618,
278,
7,
18,
5769,
7,
53,
17414,
53,
53,
11,
8696,
11,
376,
53,
60,
4008,
1267,
198,
198,
2,
2457,
4735,
32704,
198,
22163,
20114,
796,
25577,
13,
66,
672,
633,
560,
62,
15,
7,
20114,
8,
198,
54,
796,
10385,
7,
43,
283,
13,
40710,
11,
569,
11537,
198,
28461,
648,
4817,
62,
32186,
796,
25577,
13,
28461,
648,
5039,
17,
35,
7,
54,
11,
685,
22163,
20114,
11,
2243,
15112,
12962,
198,
2,
28461,
648,
4817,
62,
32186,
796,
25577,
13,
28461,
648,
5039,
17,
67,
7,
53,
11,
8696,
8,
198,
37,
23266,
796,
10385,
7,
19182,
90,
43,
283,
13,
34,
19187,
5512,
1333,
648,
4817,
62,
32186,
8,
198,
3646,
8597,
13,
1177,
8043,
7,
53,
3712,
43,
283,
13,
40710,
11,
376,
23266,
3712,
19182,
90,
43,
283,
13,
34,
19187,
30072,
198,
198,
2,
51,
3727,
46,
25,
14257,
2644,
198
] | 2.006981 | 573 |
# This dictionary maps easy to remember names to Youtube video IDs
# after adding an ID here, you can use the {{youtube <shortname>}}
# syntax in your markdown files to embed the video into the page!
videos = Dict(
"course-intro" => "vxjRWtWoD_w",
"installation" => "OOjKEgbt8AI",
"array-intro" => "CwDI-YOjWhc",
"cute-one" => "foN1_hAGfNg",
"images-intro" => "DGojI9xcCfg",
"convolution" => "8rrHTtUzyZA",
"ted-talk" => "qGW0GT1rCvs",
"image-seam" => "rpB6zQNsbQU",
"array-views" => "gTGJ80HayK0",
"image-seam-reminiscing" => "IQxN1Q8W6bI",
"james-image-seam" => "ALcohd1q3dk",
"conv-gpus" => "aa3JkX_cj_I",
"conv-real-world" => "e6WnzfvnFlY",
"types" => "yU8P_cHPn8Q",
"dispatch" => "DXtbaSP_LFI",
"ides" => "PgeLMzw_-Ww",
"structure" => "ConoBmjlivs",
"macros-intro" => "e6LGMeoQhfs",
"understanding-data" => "KrQV6mZ8hvI",
"introspection" => "IuOXXQR7dAo",
"covid-data" => "m1dmT-31Qwc",
"dataframes" => "Pt8Iz4Udg2E",
"functions-are-objects" => "_O-HBDZMLrM",
"covid-live" => "Yx055xdSkx0",
"computational-illustrated" => "6bBFkBCzwh4",
"matrix-graphs" => "zxHVpNnFt1U",
"verbs-nouns" => "LvoLXE0U5og",
"grant-epidemic" => "ErO_Hy01X98",
"r0" => "VNo5WrKZ8Yc",
"self-doc" => "MQoE69CbfHo",
"paramtypes" => "2WVFvRfocjI",
"raytracing1" => "MkkZb5V6HqM",
"byop" => "dczkYlOM2sg",
"what-is-array" => "gUZVpMUY4qY",
"raytracing2" => "JwyQezsQkkw",
"resistors" => "UKG-xk2F3Ak",
"hier-thinking" => "rJyJZ_fMy9Q",
"pde-schemes" => "f7g1LTfNmnA",
"multigrid" => "rRCGNvMdLEY",
)
| [
2,
770,
22155,
8739,
2562,
284,
3505,
3891,
284,
27431,
2008,
32373,
198,
2,
706,
4375,
281,
4522,
994,
11,
345,
460,
779,
262,
22935,
11604,
1279,
19509,
3672,
29,
11709,
198,
2,
15582,
287,
534,
1317,
2902,
3696,
284,
11525,
262,
2008,
656,
262,
2443,
0,
198,
32861,
796,
360,
713,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
17319,
12,
600,
305,
1,
5218,
366,
85,
87,
73,
46747,
83,
49450,
35,
62,
86,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
17350,
341,
1,
5218,
366,
6684,
73,
7336,
70,
18347,
23,
20185,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18747,
12,
600,
305,
1,
220,
5218,
366,
34,
86,
17931,
12,
56,
46,
73,
1199,
66,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
66,
1133,
12,
505,
1,
220,
220,
220,
220,
5218,
366,
6513,
45,
16,
62,
71,
4760,
69,
45,
70,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
17566,
12,
600,
305,
1,
5218,
366,
35,
5247,
73,
40,
24,
25306,
34,
40616,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
42946,
2122,
1,
220,
5218,
366,
23,
21062,
6535,
83,
52,
7357,
34892,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1513,
12,
16620,
1,
220,
220,
220,
220,
5218,
366,
80,
33191,
15,
19555,
16,
81,
34,
14259,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
9060,
12,
325,
321,
1,
220,
220,
5218,
366,
81,
79,
33,
21,
89,
48,
45,
36299,
10917,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18747,
12,
33571,
1,
220,
5218,
366,
70,
35990,
41,
1795,
31306,
42,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
9060,
12,
325,
321,
12,
260,
1084,
271,
2259,
1,
5218,
366,
33866,
87,
45,
16,
48,
23,
54,
21,
65,
40,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
73,
1047,
12,
9060,
12,
325,
321,
1,
5218,
366,
1847,
1073,
31298,
16,
80,
18,
34388,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
42946,
12,
31197,
385,
1,
220,
220,
220,
5218,
366,
7252,
18,
41,
74,
55,
62,
66,
73,
62,
40,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
42946,
12,
5305,
12,
6894,
1,
5218,
366,
68,
21,
54,
27305,
69,
85,
77,
7414,
56,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
19199,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
366,
88,
52,
23,
47,
62,
66,
14082,
77,
23,
48,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
6381,
17147,
1,
220,
220,
220,
220,
5218,
366,
36227,
83,
7012,
4303,
62,
43,
11674,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1460,
1,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
366,
47,
469,
31288,
89,
86,
22955,
54,
86,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
301,
5620,
1,
220,
220,
220,
5218,
366,
3103,
78,
33,
76,
73,
16017,
82,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
20285,
4951,
12,
600,
305,
1,
5218,
366,
68,
21,
41257,
5308,
78,
48,
71,
9501,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
4625,
5646,
12,
7890,
1,
5218,
366,
42,
81,
48,
53,
21,
76,
57,
23,
71,
85,
40,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
600,
305,
31308,
1,
5218,
366,
40,
84,
46,
8051,
48,
49,
22,
67,
32,
78,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
66,
709,
312,
12,
7890,
1,
5218,
366,
76,
16,
36020,
51,
12,
3132,
48,
86,
66,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
7890,
37805,
1,
5218,
366,
47,
83,
23,
40,
89,
19,
52,
67,
70,
17,
36,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
12543,
2733,
12,
533,
12,
48205,
1,
5218,
45434,
46,
12,
39,
14529,
57,
5805,
81,
44,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
66,
709,
312,
12,
12583,
1,
5218,
366,
56,
87,
47838,
24954,
15739,
87,
15,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
785,
1996,
864,
12,
359,
436,
4111,
1,
5218,
366,
21,
65,
29499,
74,
2749,
89,
1929,
19,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
6759,
8609,
12,
34960,
82,
1,
5218,
366,
42592,
39,
53,
79,
45,
77,
37,
83,
16,
52,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
46211,
12,
77,
977,
82,
1,
5218,
366,
43,
13038,
43,
55,
36,
15,
52,
20,
519,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2164,
415,
12,
538,
312,
5314,
1,
5218,
366,
9139,
46,
62,
21217,
486,
55,
4089,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
81,
15,
1,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
366,
53,
2949,
20,
39213,
42,
57,
23,
56,
66,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
944,
12,
15390,
1,
220,
220,
220,
220,
5218,
366,
49215,
78,
36,
3388,
34,
19881,
28900,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
17143,
19199,
1,
220,
220,
5218,
366,
17,
54,
53,
37,
85,
49,
69,
420,
73,
40,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2433,
2213,
4092,
16,
1,
220,
5218,
366,
44,
28747,
57,
65,
20,
53,
21,
39,
80,
44,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1525,
404,
1,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
366,
17896,
89,
74,
56,
75,
2662,
17,
45213,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
10919,
12,
271,
12,
18747,
1,
5218,
366,
70,
52,
57,
53,
79,
42422,
56,
19,
80,
56,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2433,
2213,
4092,
17,
1,
5218,
366,
41,
21768,
48,
8471,
82,
48,
28747,
86,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
35119,
669,
1,
220,
220,
5218,
366,
15039,
38,
12,
87,
74,
17,
37,
18,
33901,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
71,
959,
12,
28973,
1,
5218,
366,
81,
41,
88,
41,
57,
62,
69,
3666,
24,
48,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
79,
2934,
12,
1416,
4411,
274,
1,
5218,
366,
69,
22,
70,
16,
27734,
69,
45,
10295,
32,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
16680,
3692,
312,
1,
5218,
366,
81,
7397,
16630,
85,
44,
67,
25173,
1600,
198,
8,
198
] | 1.547813 | 1,349 |
using SciPy
using Test
@testset "SciPy.jl" begin
# Print configulations before start testings.
print_configulations()
@testset "cluster" begin
features = [[ 1.9 2.3];
[ 1.5 2.5];
[ 0.8 0.6];
[ 0.4 1.8];
[ 0.1 0.1];
[ 0.2 1.8];
[ 2.0 0.5];
[ 0.3 1.5];
[ 1.0 1.0]]
whitened = cluster.vq.whiten(features)
@test whitened[1, 1] == 2.739596711878806
end
@testset "constants" begin
@test constants.golden == 1.618033988749895
end
@testset "fft" begin
fft = SciPy.fft.fft(exp.(π/8 * collect(1:8)))
@test length(fft) == 8
end
@testset "integrate" begin
f(x) = x^2
result = SciPy.integrate.quad(f, 0, 4)
@test result[1] == 21.333333333333336
end
@testset "interpolate" begin
include("interpolateTest.jl")
end
@testset "stats" begin
include("statsTest.jl")
end
@testset "optimize" begin
include("optimizeTest.jl")
end
@testset "spatial" begin
include("spatialTest.jl")
end
end
| [
3500,
10286,
20519,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
50,
979,
20519,
13,
20362,
1,
2221,
198,
220,
220,
220,
1303,
12578,
4566,
5768,
878,
923,
1332,
654,
13,
198,
220,
220,
220,
3601,
62,
11250,
5768,
3419,
628,
220,
220,
220,
2488,
9288,
2617,
366,
565,
5819,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
3033,
220,
796,
16410,
352,
13,
24,
220,
362,
13,
18,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
352,
13,
20,
362,
13,
20,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
23,
657,
13,
21,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
19,
352,
13,
23,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
16,
657,
13,
16,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
17,
352,
13,
23,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
362,
13,
15,
657,
13,
20,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
657,
13,
18,
352,
13,
20,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
352,
13,
15,
352,
13,
15,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
20542,
2945,
796,
13946,
13,
85,
80,
13,
1929,
270,
268,
7,
40890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
20542,
2945,
58,
16,
11,
352,
60,
6624,
362,
13,
22,
2670,
3270,
3134,
16817,
3695,
37988,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
9979,
1187,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
38491,
13,
24267,
268,
6624,
352,
13,
21,
15259,
29626,
46660,
36260,
3865,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
487,
83,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
277,
701,
796,
10286,
20519,
13,
487,
83,
13,
487,
83,
7,
11201,
12195,
46582,
14,
23,
1635,
2824,
7,
16,
25,
23,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
487,
83,
8,
6624,
807,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
18908,
4873,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
277,
7,
87,
8,
796,
2124,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
796,
10286,
20519,
13,
18908,
4873,
13,
47003,
7,
69,
11,
657,
11,
604,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1255,
58,
16,
60,
6624,
2310,
13,
24840,
24840,
24840,
29211,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
3849,
16104,
378,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
7203,
3849,
16104,
378,
14402,
13,
20362,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
34242,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
7203,
34242,
14402,
13,
20362,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
40085,
1096,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
7203,
40085,
1096,
14402,
13,
20362,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
2777,
34961,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
7203,
2777,
34961,
14402,
13,
20362,
4943,
198,
220,
220,
220,
886,
198,
198,
437,
198
] | 1.80924 | 671 |
Optional{T} = Union{Nothing,T}
mutable struct Address
street::String
house_nr::String
zip_code::String
town::String
iid::DbId
end
function Address()
return Address("","","","",DbId())
end
mutable struct Employee
name::String
contact_person_first::String
contact_person_second::String
job_title::String
salutation::String
call_text::String
done::Bool
address_rel::Optional{Address}
callback_date::Optional{DateTime}
iid::DbId
end
| [
30719,
90,
51,
92,
796,
4479,
90,
18465,
11,
51,
92,
198,
198,
76,
18187,
2878,
17917,
198,
220,
220,
220,
4675,
3712,
10100,
198,
220,
220,
220,
2156,
62,
48624,
3712,
10100,
198,
220,
220,
220,
19974,
62,
8189,
3712,
10100,
198,
220,
220,
220,
3240,
3712,
10100,
198,
220,
220,
220,
1312,
312,
3712,
43832,
7390,
198,
437,
198,
198,
8818,
17917,
3419,
198,
220,
220,
220,
1441,
17917,
7203,
2430,
2430,
2430,
1600,
43832,
7390,
28955,
198,
437,
198,
198,
76,
18187,
2878,
36824,
198,
220,
220,
220,
1438,
3712,
10100,
198,
220,
220,
220,
2800,
62,
6259,
62,
11085,
3712,
10100,
198,
220,
220,
220,
2800,
62,
6259,
62,
12227,
3712,
10100,
198,
220,
220,
220,
1693,
62,
7839,
3712,
10100,
198,
220,
220,
220,
3664,
7094,
3712,
10100,
198,
220,
220,
220,
869,
62,
5239,
3712,
10100,
198,
220,
220,
220,
1760,
3712,
33,
970,
198,
220,
220,
220,
2209,
62,
2411,
3712,
30719,
90,
20231,
92,
198,
220,
220,
220,
23838,
62,
4475,
3712,
30719,
90,
10430,
7575,
92,
198,
220,
220,
220,
1312,
312,
3712,
43832,
7390,
198,
437,
198
] | 2.652406 | 187 |
@testset "88.merge-sorted-array.jl" begin
nums1 = [1, 2, 3, 0, 0, 0]
m = 3
nums2 = [2, 5, 6]
n = 3
merge_sorted_array(nums1, m, nums2, n)
@test nums1 == [1, 2, 2, 3, 5, 6]
end
| [
31,
9288,
2617,
366,
3459,
13,
647,
469,
12,
82,
9741,
12,
18747,
13,
20362,
1,
2221,
198,
220,
220,
220,
997,
82,
16,
796,
685,
16,
11,
362,
11,
513,
11,
657,
11,
657,
11,
657,
60,
198,
220,
220,
220,
285,
796,
513,
198,
220,
220,
220,
997,
82,
17,
796,
685,
17,
11,
642,
11,
718,
60,
198,
220,
220,
220,
299,
796,
513,
628,
220,
220,
220,
20121,
62,
82,
9741,
62,
18747,
7,
77,
5700,
16,
11,
285,
11,
997,
82,
17,
11,
299,
8,
198,
220,
220,
220,
2488,
9288,
997,
82,
16,
6624,
685,
16,
11,
362,
11,
362,
11,
513,
11,
642,
11,
718,
60,
198,
437,
198
] | 1.732759 | 116 |
using Surrogates
using LinearAlgebra
using Flux
using Flux: @epochs
using Zygote
using PolyChaos
using Test
#using Zygote: @nograd
#=
#FORWARD
###### 1D ######
lb = 0.0
ub = 10.0
n = 5
x = sample(n,lb,ub,SobolSample())
f = x -> x^2
y = f.(x)
#Radials
my_rad = RadialBasis(x,y,lb,ub,x->norm(x),2)
g = x -> ForwardDiff.derivative(my_rad,x)
g(5.0)
#Kriging
p = 1.5
my_krig = Kriging(x,y,p)
g = x -> ForwardDiff.derivative(my_krig,x)
g(5.0)
#Linear Surrogate
my_linear = LinearSurrogate(x,y,lb,ub)
g = x -> ForwardDiff.derivative(my_linear,x)
g(5.0)
#Inverse distance
p = 1.4
my_inverse = InverseDistanceSurrogate(x,y,p,lb,ub)
g = x -> ForwardDiff.derivative(my_inverse,x)
g(5.0)
#Lobachesky
n = 4
α = 2.4
my_loba = LobacheskySurrogate(x,y,α,n,lb,ub)
g = x -> ForwardDiff.derivative(my_loba,x)
g(5.0)
#Second order polynomial
my_second = SecondOrderPolynomialSurrogate(x,y,lb,ub)
g = x -> ForwardDiff.derivative(my_second,x)
g(5.0)
###### ND ######
lb = [0.0,0.0]
ub = [10.0,10.0]
n = 5
x = sample(n,lb,ub,SobolSample())
f = x -> x[1]*x[2]
y = f.(x)
#Radials
my_rad = RadialBasis(x,y,[lb,ub],z->norm(z),2)
g = x -> ForwardDiff.gradient(my_rad,x)
g([2.0,5.0])
#Kriging
theta = [2.0,2.0]
p = [1.9,1.9]
my_krig = Kriging(x,y,p,theta)
g = x -> ForwardDiff.gradient(my_krig,x)
g([2.0,5.0])
#Linear Surrogate
my_linear = LinearSurrogate(x,y,lb,ub)
g = x -> ForwardDiff.gradient(my_linear,x)
g([2.0,5.0])
#Inverse Distance
p = 1.4
my_inverse = InverseDistanceSurrogate(x,y,p,lb,ub)
g = x -> ForwardDiff.gradient(my_inverse,x)
g([2.0,5.0])
#Lobachesky
alpha = [1.4,1.4]
n = 4
my_loba_ND = LobacheskySurrogate(x,y,alpha,n,lb,ub)
g = x -> ForwardDiff.gradient(my_loba_ND,x)
g([2.0,5.0])
#Second order polynomial
my_second = SecondOrderPolynomialSurrogate(x,y,lb,ub)
g = x -> ForwardDiff.gradient(my_second,x)
g([2.0,5.0])
=#
##############
### ZYGOTE ###
##############
############
#### 1D ####
############
lb = 0.0
ub = 10.0
n = 5
x = sample(n,lb,ub,SobolSample())
f = x -> x^2
y = f.(x)
#Radials
my_rad = RadialBasis(x,y,lb,ub,rad = linearRadial)
g = x -> my_rad'(x)
g(5.0)
#Kriging
my_p = 1.5
my_krig = Kriging(x,y,lb,ub,p=my_p)
g = x -> my_krig'(x)
g(5.0)
#Linear Surrogate
my_linear = LinearSurrogate(x,y,lb,ub)
g = x -> my_linear'(x)
g(5.0)
#Inverse distance
my_p = 1.4
my_inverse = InverseDistanceSurrogate(x,y,lb,ub,p=my_p)
g = x -> my_inverse'(x)
g(5.0)
#Second order polynomial
my_second = SecondOrderPolynomialSurrogate(x,y,lb,ub)
g = x -> my_second'(x)
g(5.0)
#Lobachesky
n = 4
α = 2.4
my_loba = LobacheskySurrogate(x,y,lb,ub, alpha = α, n = 4)
g = x -> my_loba'(x)
g(0.0)
#NN
my_model = Chain(Dense(1,1), first)
my_loss(x, y) = Flux.mse(my_model(x), y)
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x,y,lb,ub,model=my_model,loss=my_loss,opt=my_opt,n_echos=1)
g = x->my_neural'(x)
g(3.4)
#Wendland
my_wend = Wendland(x,y,lb,ub)
g = x -> my_wend'(x)
g(3.0)
#MOE and VariableFidelity for free because they are Linear combinations
#of differentiable surrogates
#Polynomialchaos
n = 50
x = sample(n,lb,ub,SobolSample())
y = f.(x)
my_poli = PolynomialChaosSurrogate(x,y,lb,ub)
g = x -> my_poli'(x)
g(3.0)
#Gek
n = 10
lb = 0.0
ub = 5.0
x = sample(n,lb,ub,SobolSample())
f = x-> x^2
y1 = f.(x)
der = x->2*x
y2 = der.(x)
y = vcat(y1,y2)
my_gek = GEK(x,y,lb,ub)
g = x-> my_gek'(x)
g(3.0)
################
###### ND ######
################
lb = [0.0,0.0]
ub = [10.0,10.0]
n = 5
x = sample(n,lb,ub,SobolSample())
f = x -> x[1]*x[2]
y = f.(x)
#Radials
my_rad = RadialBasis(x,y,lb,ub,rad = linearRadial, scale_factor = 2.1)
g = x -> Zygote.gradient(my_rad,x)
g((2.0,5.0))
#Kriging
my_theta = [2.0,2.0]
my_p = [1.9,1.9]
my_krig = Kriging(x,y,lb,ub,p=my_p,theta=my_theta)
g = x -> Zygote.gradient(my_krig,x)
g((2.0,5.0))
#Linear Surrogate
my_linear = LinearSurrogate(x,y,lb,ub)
g = x -> Zygote.gradient(my_linear,x)
g((2.0,5.0))
#Inverse Distance
my_p = 1.4
my_inverse = InverseDistanceSurrogate(x,y,lb,ub,p=my_p)
g = x -> Zygote.gradient(my_inverse,x)
g((2.0,5.0))
#Lobachesky not working yet weird issue with Zygote @nograd
#=
Zygote.refresh()
alpha = [1.4,1.4]
n = 4
my_loba_ND = LobacheskySurrogate(x,y,alpha,n,lb,ub)
g = x -> Zygote.gradient(my_loba_ND,x)
g((2.0,5.0))
=#
#Second order polynomial mutating arrays
my_second = SecondOrderPolynomialSurrogate(x,y,lb,ub)
g = x -> Zygote.gradient(my_second,x)
g((2.0,5.0))
#NN
my_model = Chain(Dense(2,1), first)
my_loss(x, y) = Flux.mse(my_model(x), y)
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x,y,lb,ub,model=my_model,loss=my_loss,opt=my_opt,n_echos=1)
g = x -> Zygote.gradient(my_neural, x)
g((2.0,5.0))
#wendland
my_wend_ND = Wendland(x,y,lb,ub)
g = x -> Zygote.gradient(my_wend_ND,x)
g((2.0,5.0))
#MOE and VariableFidelity for free because they are Linear combinations
#of differentiable surrogates
#PolynomialChaos
n = 50
lb = [0.0,0.0]
ub = [10.0,10.0]
x = sample(n,lb,ub,SobolSample())
f = x -> x[1]*x[2]
y = f.(x)
my_poli_ND = PolynomialChaosSurrogate(x,y,lb,ub)
g = x -> Zygote.gradient(my_poli_ND,x)
@test_broken g((1.0,1.0)) #will work on Zygote0.5 when I will be able to update
n = 10
d = 2
lb = [0.0,0.0]
ub = [5.0,5.0]
x = sample(n,lb,ub,SobolSample())
f = x -> x[1]^2 + x[2]^2
y1 = f.(x)
grad1 = x -> 2*x[1]
grad2 = x -> 2*x[2]
function create_grads(n,d,grad1,grad2,y)
c = 0
y2 = zeros(eltype(y[1]),n*d)
for i = 1:n
y2[i+c] = grad1(x[i])
y2[i+c+1] = grad2(x[i])
c = c+1
end
return y2
end
y2 = create_grads(n,d,grad1,grad2,y)
y = vcat(y1,y2)
my_gek_ND = GEK(x,y,lb,ub)
g = x -> Zygote.gradient(my_gek_ND,x)
g((2.0,5.0))
###### ND -> ND ######
lb = [0.0, 0.0]
ub = [10.0, 2.0]
n = 5
x = sample(n,lb,ub,SobolSample())
f = x -> [x[1]^2, x[2]]
y = f.(x)
#NN
my_model = Chain(Dense(2,2))
my_loss(x, y) = Flux.mse(my_model(x), y)
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x,y,lb,ub,model=my_model,loss=my_loss,opt=my_opt,n_echos=1)
Zygote.gradient(x -> sum(my_neural(x)), (2.0, 5.0))
my_rad = RadialBasis(x,y,lb,ub,rad = linearRadial)
Zygote.gradient(x -> sum(my_rad(x)), (2.0, 5.0))
my_p = 1.4
my_inverse = InverseDistanceSurrogate(x,y,lb,ub,p=my_p)
my_inverse((2.0, 5.0))
Zygote.gradient(x -> sum(my_inverse(x)), (2.0, 5.0))
my_second = SecondOrderPolynomialSurrogate(x,y,lb,ub)
Zygote.gradient(x -> sum(my_second(x)), (2.0, 5.0))
| [
3500,
4198,
3828,
689,
198,
3500,
44800,
2348,
29230,
198,
3500,
1610,
2821,
198,
3500,
1610,
2821,
25,
2488,
538,
5374,
82,
198,
3500,
1168,
35641,
1258,
198,
3500,
12280,
1925,
7495,
198,
3500,
6208,
198,
2,
3500,
1168,
35641,
1258,
25,
2488,
77,
519,
6335,
198,
2,
28,
198,
2,
13775,
39743,
198,
4242,
2235,
352,
35,
46424,
2,
198,
23160,
796,
657,
13,
15,
198,
549,
796,
838,
13,
15,
198,
77,
796,
642,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
61,
17,
198,
88,
796,
277,
12195,
87,
8,
198,
198,
2,
15546,
8231,
198,
1820,
62,
6335,
796,
5325,
498,
15522,
271,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
87,
3784,
27237,
7,
87,
828,
17,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
6335,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
42,
4359,
278,
198,
79,
796,
352,
13,
20,
198,
1820,
62,
74,
4359,
796,
509,
4359,
278,
7,
87,
11,
88,
11,
79,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
74,
4359,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
14993,
451,
4198,
3828,
378,
198,
1820,
62,
29127,
796,
44800,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
29127,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
818,
4399,
5253,
198,
79,
796,
352,
13,
19,
198,
1820,
62,
259,
4399,
796,
554,
4399,
45767,
14214,
3828,
378,
7,
87,
11,
88,
11,
79,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
259,
4399,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
43,
672,
3694,
2584,
198,
77,
796,
604,
198,
17394,
796,
362,
13,
19,
198,
1820,
62,
75,
19981,
796,
32684,
3694,
2584,
14214,
3828,
378,
7,
87,
11,
88,
11,
17394,
11,
77,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
75,
19981,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
12211,
1502,
745,
6213,
49070,
198,
1820,
62,
12227,
796,
5498,
18743,
34220,
26601,
498,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
1820,
62,
12227,
11,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
4242,
2235,
25524,
46424,
2,
198,
23160,
796,
685,
15,
13,
15,
11,
15,
13,
15,
60,
198,
549,
796,
685,
940,
13,
15,
11,
940,
13,
15,
60,
198,
77,
796,
642,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
58,
16,
60,
9,
87,
58,
17,
60,
198,
88,
796,
277,
12195,
87,
8,
198,
198,
2,
15546,
8231,
198,
1820,
62,
6335,
796,
5325,
498,
15522,
271,
7,
87,
11,
88,
17414,
23160,
11,
549,
4357,
89,
3784,
27237,
7,
89,
828,
17,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
6335,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
198,
2,
42,
4359,
278,
198,
1169,
8326,
796,
685,
17,
13,
15,
11,
17,
13,
15,
60,
198,
79,
796,
685,
16,
13,
24,
11,
16,
13,
24,
60,
198,
1820,
62,
74,
4359,
796,
509,
4359,
278,
7,
87,
11,
88,
11,
79,
11,
1169,
8326,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
74,
4359,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
198,
2,
14993,
451,
4198,
3828,
378,
198,
1820,
62,
29127,
796,
44800,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
29127,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
198,
2,
818,
4399,
34600,
198,
79,
796,
352,
13,
19,
198,
1820,
62,
259,
4399,
796,
554,
4399,
45767,
14214,
3828,
378,
7,
87,
11,
88,
11,
79,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
259,
4399,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
198,
2,
43,
672,
3694,
2584,
198,
26591,
796,
685,
16,
13,
19,
11,
16,
13,
19,
60,
198,
77,
796,
604,
198,
1820,
62,
75,
19981,
62,
8575,
796,
32684,
3694,
2584,
14214,
3828,
378,
7,
87,
11,
88,
11,
26591,
11,
77,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
75,
19981,
62,
8575,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
198,
2,
12211,
1502,
745,
6213,
49070,
198,
1820,
62,
12227,
796,
5498,
18743,
34220,
26601,
498,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
19530,
28813,
13,
49607,
7,
1820,
62,
12227,
11,
87,
8,
198,
70,
26933,
17,
13,
15,
11,
20,
13,
15,
12962,
198,
46249,
198,
198,
7804,
4242,
2235,
198,
21017,
1168,
56,
38,
23051,
44386,
198,
7804,
4242,
2235,
628,
198,
7804,
4242,
198,
4242,
352,
35,
1303,
21017,
198,
7804,
4242,
198,
23160,
796,
657,
13,
15,
198,
549,
796,
838,
13,
15,
198,
77,
796,
642,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
61,
17,
198,
88,
796,
277,
12195,
87,
8,
198,
198,
2,
15546,
8231,
198,
1820,
62,
6335,
796,
5325,
498,
15522,
271,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
6335,
796,
14174,
15546,
498,
8,
198,
70,
796,
2124,
4613,
616,
62,
6335,
6,
7,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
42,
4359,
278,
198,
1820,
62,
79,
796,
352,
13,
20,
198,
1820,
62,
74,
4359,
796,
509,
4359,
278,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
79,
28,
1820,
62,
79,
8,
198,
70,
796,
2124,
4613,
616,
62,
74,
4359,
6,
7,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
14993,
451,
4198,
3828,
378,
198,
1820,
62,
29127,
796,
44800,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
616,
62,
29127,
6,
7,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
818,
4399,
5253,
198,
1820,
62,
79,
796,
352,
13,
19,
198,
1820,
62,
259,
4399,
796,
554,
4399,
45767,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
79,
28,
1820,
62,
79,
8,
198,
70,
796,
2124,
4613,
616,
62,
259,
4399,
6,
7,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
12211,
1502,
745,
6213,
49070,
198,
1820,
62,
12227,
796,
5498,
18743,
34220,
26601,
498,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
616,
62,
12227,
6,
7,
87,
8,
198,
70,
7,
20,
13,
15,
8,
198,
198,
2,
43,
672,
3694,
2584,
198,
77,
796,
604,
198,
17394,
796,
362,
13,
19,
198,
1820,
62,
75,
19981,
796,
32684,
3694,
2584,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
17130,
796,
26367,
11,
299,
796,
604,
8,
198,
70,
796,
2124,
4613,
616,
62,
75,
19981,
6,
7,
87,
8,
198,
70,
7,
15,
13,
15,
8,
198,
198,
2,
6144,
198,
1820,
62,
19849,
796,
21853,
7,
35,
1072,
7,
16,
11,
16,
828,
717,
8,
198,
1820,
62,
22462,
7,
87,
11,
331,
8,
796,
1610,
2821,
13,
76,
325,
7,
1820,
62,
19849,
7,
87,
828,
331,
8,
198,
1820,
62,
8738,
796,
2935,
1087,
7,
15,
13,
486,
8,
198,
77,
62,
3055,
418,
796,
352,
198,
1820,
62,
710,
1523,
796,
47986,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
19849,
28,
1820,
62,
19849,
11,
22462,
28,
1820,
62,
22462,
11,
8738,
28,
1820,
62,
8738,
11,
77,
62,
3055,
418,
28,
16,
8,
198,
70,
796,
2124,
3784,
1820,
62,
710,
1523,
6,
7,
87,
8,
198,
70,
7,
18,
13,
19,
8,
198,
198,
2,
54,
437,
1044,
198,
1820,
62,
86,
437,
796,
21042,
1044,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
616,
62,
86,
437,
6,
7,
87,
8,
198,
70,
7,
18,
13,
15,
8,
198,
198,
2,
11770,
36,
290,
35748,
37,
23091,
329,
1479,
780,
484,
389,
44800,
17790,
198,
2,
1659,
1180,
3379,
27552,
689,
198,
198,
2,
34220,
26601,
498,
354,
7495,
198,
77,
796,
2026,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
88,
796,
277,
12195,
87,
8,
198,
1820,
62,
79,
11106,
796,
12280,
26601,
498,
1925,
7495,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
616,
62,
79,
11106,
6,
7,
87,
8,
198,
70,
7,
18,
13,
15,
8,
628,
198,
2,
38,
988,
198,
77,
796,
838,
198,
23160,
796,
657,
13,
15,
198,
549,
796,
642,
13,
15,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
3784,
2124,
61,
17,
198,
88,
16,
796,
277,
12195,
87,
8,
198,
1082,
796,
2124,
3784,
17,
9,
87,
198,
88,
17,
796,
4587,
12195,
87,
8,
198,
88,
796,
410,
9246,
7,
88,
16,
11,
88,
17,
8,
198,
198,
1820,
62,
469,
74,
796,
22319,
42,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
3784,
616,
62,
469,
74,
6,
7,
87,
8,
198,
70,
7,
18,
13,
15,
8,
198,
198,
14468,
198,
4242,
2235,
25524,
46424,
2,
198,
14468,
198,
198,
23160,
796,
685,
15,
13,
15,
11,
15,
13,
15,
60,
198,
549,
796,
685,
940,
13,
15,
11,
940,
13,
15,
60,
198,
77,
796,
642,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
58,
16,
60,
9,
87,
58,
17,
60,
198,
88,
796,
277,
12195,
87,
8,
198,
198,
2,
15546,
8231,
198,
1820,
62,
6335,
796,
5325,
498,
15522,
271,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
6335,
796,
14174,
15546,
498,
11,
5046,
62,
31412,
796,
362,
13,
16,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
6335,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
42,
4359,
278,
198,
1820,
62,
1169,
8326,
796,
685,
17,
13,
15,
11,
17,
13,
15,
60,
198,
1820,
62,
79,
796,
685,
16,
13,
24,
11,
16,
13,
24,
60,
198,
1820,
62,
74,
4359,
796,
509,
4359,
278,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
79,
28,
1820,
62,
79,
11,
1169,
8326,
28,
1820,
62,
1169,
8326,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
74,
4359,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
14993,
451,
4198,
3828,
378,
198,
1820,
62,
29127,
796,
44800,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
29127,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
818,
4399,
34600,
198,
1820,
62,
79,
796,
352,
13,
19,
198,
1820,
62,
259,
4399,
796,
554,
4399,
45767,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
79,
28,
1820,
62,
79,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
259,
4399,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
628,
198,
198,
2,
43,
672,
3694,
2584,
407,
1762,
1865,
7650,
2071,
351,
1168,
35641,
1258,
2488,
77,
519,
6335,
198,
2,
28,
198,
57,
35641,
1258,
13,
5420,
3447,
3419,
198,
26591,
796,
685,
16,
13,
19,
11,
16,
13,
19,
60,
198,
77,
796,
604,
198,
1820,
62,
75,
19981,
62,
8575,
796,
32684,
3694,
2584,
14214,
3828,
378,
7,
87,
11,
88,
11,
26591,
11,
77,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
75,
19981,
62,
8575,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
46249,
198,
198,
2,
12211,
1502,
745,
6213,
49070,
4517,
803,
26515,
198,
1820,
62,
12227,
796,
5498,
18743,
34220,
26601,
498,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
12227,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
6144,
198,
1820,
62,
19849,
796,
21853,
7,
35,
1072,
7,
17,
11,
16,
828,
717,
8,
198,
1820,
62,
22462,
7,
87,
11,
331,
8,
796,
1610,
2821,
13,
76,
325,
7,
1820,
62,
19849,
7,
87,
828,
331,
8,
198,
1820,
62,
8738,
796,
2935,
1087,
7,
15,
13,
486,
8,
198,
77,
62,
3055,
418,
796,
352,
198,
1820,
62,
710,
1523,
796,
47986,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
19849,
28,
1820,
62,
19849,
11,
22462,
28,
1820,
62,
22462,
11,
8738,
28,
1820,
62,
8738,
11,
77,
62,
3055,
418,
28,
16,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
710,
1523,
11,
2124,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
86,
437,
1044,
198,
1820,
62,
86,
437,
62,
8575,
796,
21042,
1044,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
86,
437,
62,
8575,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
2,
11770,
36,
290,
35748,
37,
23091,
329,
1479,
780,
484,
389,
44800,
17790,
198,
2,
1659,
1180,
3379,
27552,
689,
628,
198,
2,
34220,
26601,
498,
1925,
7495,
198,
77,
796,
2026,
198,
23160,
796,
685,
15,
13,
15,
11,
15,
13,
15,
60,
198,
549,
796,
685,
940,
13,
15,
11,
940,
13,
15,
60,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
58,
16,
60,
9,
87,
58,
17,
60,
198,
88,
796,
277,
12195,
87,
8,
198,
1820,
62,
79,
11106,
62,
8575,
796,
12280,
26601,
498,
1925,
7495,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
79,
11106,
62,
8575,
11,
87,
8,
198,
31,
9288,
62,
25826,
308,
19510,
16,
13,
15,
11,
16,
13,
15,
4008,
1303,
10594,
670,
319,
1168,
35641,
1258,
15,
13,
20,
618,
314,
481,
307,
1498,
284,
4296,
198,
198,
77,
796,
838,
198,
67,
796,
362,
198,
23160,
796,
685,
15,
13,
15,
11,
15,
13,
15,
60,
198,
549,
796,
685,
20,
13,
15,
11,
20,
13,
15,
60,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
2124,
58,
16,
60,
61,
17,
1343,
2124,
58,
17,
60,
61,
17,
198,
88,
16,
796,
277,
12195,
87,
8,
198,
9744,
16,
796,
2124,
4613,
362,
9,
87,
58,
16,
60,
198,
9744,
17,
796,
2124,
4613,
362,
9,
87,
58,
17,
60,
198,
8818,
2251,
62,
2164,
5643,
7,
77,
11,
67,
11,
9744,
16,
11,
9744,
17,
11,
88,
8,
198,
220,
220,
220,
269,
796,
657,
198,
220,
220,
220,
331,
17,
796,
1976,
27498,
7,
417,
4906,
7,
88,
58,
16,
46570,
77,
9,
67,
8,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
331,
17,
58,
72,
10,
66,
60,
796,
3915,
16,
7,
87,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
331,
17,
58,
72,
10,
66,
10,
16,
60,
796,
3915,
17,
7,
87,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
269,
796,
269,
10,
16,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
331,
17,
198,
437,
198,
88,
17,
796,
2251,
62,
2164,
5643,
7,
77,
11,
67,
11,
9744,
16,
11,
9744,
17,
11,
88,
8,
198,
88,
796,
410,
9246,
7,
88,
16,
11,
88,
17,
8,
198,
1820,
62,
469,
74,
62,
8575,
796,
22319,
42,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
70,
796,
2124,
4613,
1168,
35641,
1258,
13,
49607,
7,
1820,
62,
469,
74,
62,
8575,
11,
87,
8,
198,
70,
19510,
17,
13,
15,
11,
20,
13,
15,
4008,
198,
198,
4242,
2235,
25524,
4613,
25524,
46424,
2,
198,
198,
23160,
796,
685,
15,
13,
15,
11,
657,
13,
15,
60,
198,
549,
796,
685,
940,
13,
15,
11,
362,
13,
15,
60,
198,
77,
796,
642,
198,
87,
796,
6291,
7,
77,
11,
23160,
11,
549,
11,
50,
672,
349,
36674,
28955,
198,
69,
796,
2124,
4613,
685,
87,
58,
16,
60,
61,
17,
11,
2124,
58,
17,
11907,
198,
88,
796,
277,
12195,
87,
8,
198,
198,
2,
6144,
198,
1820,
62,
19849,
796,
21853,
7,
35,
1072,
7,
17,
11,
17,
4008,
198,
1820,
62,
22462,
7,
87,
11,
331,
8,
796,
1610,
2821,
13,
76,
325,
7,
1820,
62,
19849,
7,
87,
828,
331,
8,
198,
1820,
62,
8738,
796,
2935,
1087,
7,
15,
13,
486,
8,
198,
77,
62,
3055,
418,
796,
352,
198,
1820,
62,
710,
1523,
796,
47986,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
19849,
28,
1820,
62,
19849,
11,
22462,
28,
1820,
62,
22462,
11,
8738,
28,
1820,
62,
8738,
11,
77,
62,
3055,
418,
28,
16,
8,
198,
57,
35641,
1258,
13,
49607,
7,
87,
4613,
2160,
7,
1820,
62,
710,
1523,
7,
87,
36911,
357,
17,
13,
15,
11,
642,
13,
15,
4008,
198,
198,
1820,
62,
6335,
796,
5325,
498,
15522,
271,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
6335,
796,
14174,
15546,
498,
8,
198,
57,
35641,
1258,
13,
49607,
7,
87,
4613,
2160,
7,
1820,
62,
6335,
7,
87,
36911,
357,
17,
13,
15,
11,
642,
13,
15,
4008,
198,
198,
1820,
62,
79,
796,
352,
13,
19,
198,
1820,
62,
259,
4399,
796,
554,
4399,
45767,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
11,
79,
28,
1820,
62,
79,
8,
198,
1820,
62,
259,
4399,
19510,
17,
13,
15,
11,
642,
13,
15,
4008,
198,
57,
35641,
1258,
13,
49607,
7,
87,
4613,
2160,
7,
1820,
62,
259,
4399,
7,
87,
36911,
357,
17,
13,
15,
11,
642,
13,
15,
4008,
198,
198,
1820,
62,
12227,
796,
5498,
18743,
34220,
26601,
498,
14214,
3828,
378,
7,
87,
11,
88,
11,
23160,
11,
549,
8,
198,
57,
35641,
1258,
13,
49607,
7,
87,
4613,
2160,
7,
1820,
62,
12227,
7,
87,
36911,
357,
17,
13,
15,
11,
642,
13,
15,
4008,
198
] | 1.915306 | 3,306 |
function _count_by_state(
events::EventObservations{T, M},
state::DiseaseState,
time::Float64) where {
T <: DiseaseStateSequence,
M <: ILM}
n_ids = 0
if state == State_I && State_R ∈ T
# E/I at or before time and I/R after time or never
for i = 1:individuals(events)
n_ids += events[state][i] <= time && ((events[State_R][i] > time) || (events[State_R][i] === NaN))
end
else
for i = 1:individuals(events)
n_ids += events[state][i] <= time
end
end
@debug "$n_ids individual(s) observered in state $state at t = $time"
return n_ids
end
function _obs_curve(
events::EventObservations{T, M},
state::DiseaseState,
min::Float64,
max::Float64) where {
T <: DiseaseStateSequence,
M <: ILM}
if min >= max
@error "Minimum time must be less than maximum time"
end
local times
if state == State_I && State_R ∈ T
times = events[[State_I; State_R]][:]
else
times = events[state]
end
times = times[Ref(min) .< times .< Ref(max)]
sort!(times)
insert!(times, 1, min)
push!(times, max)
counts = _count_by_state.(Ref(events), Ref(state), times)
return times, counts
end
@recipe function f(
events::EventObservations{T, M},
state::DiseaseState,
min::Float64,
max::Float64) where {
T <: DiseaseStateSequence,
M <: ILM}
xguide --> "Time"
yguide --> "N"
linewidth --> 2.0
linecolor --> _state_color(state)
label --> ""
seriestype --> :steppost
_obs_curve(events, state, min, max)
end
@recipe function f(
events::EventObservations{T, M},
state::DiseaseState) where {
T <: DiseaseStateSequence,
M <: ILM}
events, state, 0.0, maximum(events)
end
@recipe function f(
events::EventObservations{T, M},
min::Float64,
max::Float64) where {
T <: DiseaseStateSequence,
M <: ILM}
@series begin
linecolor --> _state_color(State_I)
label --> "I"
events, State_I, min, max
end
if State_R ∈ T
@series begin
linecolor --> _state_color(State_R)
label --> "R"
events, State_R, min, max
end
end
end
@recipe function f(
events::EventObservations{T, M}) where {
T <: DiseaseStateSequence,
M <: ILM}
events, minimum(events), maximum(events)
end
| [
8818,
4808,
9127,
62,
1525,
62,
5219,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
5512,
198,
220,
1181,
3712,
35,
786,
589,
9012,
11,
198,
220,
640,
3712,
43879,
2414,
8,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
299,
62,
2340,
796,
657,
198,
220,
611,
1181,
6624,
1812,
62,
40,
11405,
1812,
62,
49,
18872,
230,
309,
198,
220,
1303,
412,
14,
40,
379,
393,
878,
640,
290,
314,
14,
49,
706,
640,
393,
1239,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
43129,
82,
7,
31534,
8,
198,
220,
220,
220,
220,
220,
299,
62,
2340,
15853,
2995,
58,
5219,
7131,
72,
60,
19841,
640,
11405,
14808,
31534,
58,
9012,
62,
49,
7131,
72,
60,
1875,
640,
8,
8614,
357,
31534,
58,
9012,
62,
49,
7131,
72,
60,
24844,
11013,
45,
4008,
198,
220,
220,
220,
886,
198,
220,
2073,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
43129,
82,
7,
31534,
8,
198,
220,
220,
220,
220,
220,
299,
62,
2340,
15853,
2995,
58,
5219,
7131,
72,
60,
19841,
640,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
2488,
24442,
17971,
77,
62,
2340,
1981,
7,
82,
8,
12414,
445,
287,
1181,
720,
5219,
379,
256,
796,
720,
2435,
1,
198,
220,
1441,
299,
62,
2340,
198,
437,
198,
198,
8818,
4808,
8158,
62,
22019,
303,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
5512,
198,
220,
1181,
3712,
35,
786,
589,
9012,
11,
198,
220,
949,
3712,
43879,
2414,
11,
198,
220,
3509,
3712,
43879,
2414,
8,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
611,
949,
18189,
3509,
198,
220,
220,
220,
2488,
18224,
366,
44046,
640,
1276,
307,
1342,
621,
5415,
640,
1,
198,
220,
886,
198,
220,
1957,
1661,
198,
220,
611,
1181,
6624,
1812,
62,
40,
11405,
1812,
62,
49,
18872,
230,
309,
198,
220,
220,
220,
1661,
796,
2995,
30109,
9012,
62,
40,
26,
1812,
62,
49,
60,
7131,
47715,
198,
220,
2073,
198,
220,
220,
220,
1661,
796,
2995,
58,
5219,
60,
198,
220,
886,
198,
220,
1661,
796,
1661,
58,
8134,
7,
1084,
8,
764,
27,
1661,
764,
27,
6524,
7,
9806,
15437,
198,
220,
3297,
0,
7,
22355,
8,
198,
220,
7550,
0,
7,
22355,
11,
352,
11,
949,
8,
198,
220,
4574,
0,
7,
22355,
11,
3509,
8,
198,
220,
9853,
796,
4808,
9127,
62,
1525,
62,
5219,
12195,
8134,
7,
31534,
828,
6524,
7,
5219,
828,
1661,
8,
198,
220,
1441,
1661,
11,
9853,
198,
437,
198,
198,
31,
29102,
431,
2163,
277,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
5512,
198,
220,
1181,
3712,
35,
786,
589,
9012,
11,
198,
220,
949,
3712,
43879,
2414,
11,
198,
220,
3509,
3712,
43879,
2414,
8,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
2124,
41311,
14610,
366,
7575,
1,
198,
220,
331,
41311,
14610,
366,
45,
1,
198,
220,
9493,
413,
5649,
14610,
362,
13,
15,
198,
220,
1627,
8043,
14610,
4808,
5219,
62,
8043,
7,
5219,
8,
198,
220,
6167,
14610,
13538,
198,
220,
1055,
6386,
2981,
14610,
1058,
4169,
381,
455,
198,
220,
4808,
8158,
62,
22019,
303,
7,
31534,
11,
1181,
11,
949,
11,
3509,
8,
198,
437,
198,
198,
31,
29102,
431,
2163,
277,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
5512,
198,
220,
1181,
3712,
35,
786,
589,
9012,
8,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
2995,
11,
1181,
11,
657,
13,
15,
11,
5415,
7,
31534,
8,
198,
437,
198,
198,
31,
29102,
431,
2163,
277,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
5512,
198,
220,
949,
3712,
43879,
2414,
11,
198,
220,
3509,
3712,
43879,
2414,
8,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
2488,
25076,
2221,
198,
220,
220,
220,
1627,
8043,
14610,
4808,
5219,
62,
8043,
7,
9012,
62,
40,
8,
198,
220,
220,
220,
6167,
14610,
366,
40,
1,
198,
220,
220,
220,
2995,
11,
1812,
62,
40,
11,
949,
11,
3509,
198,
220,
886,
198,
220,
611,
1812,
62,
49,
18872,
230,
309,
198,
220,
220,
220,
2488,
25076,
2221,
198,
220,
220,
220,
220,
220,
1627,
8043,
14610,
4808,
5219,
62,
8043,
7,
9012,
62,
49,
8,
198,
220,
220,
220,
220,
220,
6167,
14610,
366,
49,
1,
198,
220,
220,
220,
220,
220,
2995,
11,
1812,
62,
49,
11,
949,
11,
3509,
198,
220,
220,
220,
886,
198,
220,
886,
198,
437,
198,
198,
31,
29102,
431,
2163,
277,
7,
198,
220,
2995,
3712,
9237,
31310,
712,
602,
90,
51,
11,
337,
30072,
810,
1391,
198,
220,
220,
220,
309,
1279,
25,
17344,
9012,
44015,
594,
11,
198,
220,
220,
220,
337,
1279,
25,
14639,
44,
92,
198,
220,
2995,
11,
5288,
7,
31534,
828,
5415,
7,
31534,
8,
198,
437,
198
] | 2.462983 | 905 |
##### embarrassingly parallel computation is embarrassingly easy
# This computation is automatically distributed across
# all available compute nodes, and the result, reduced by summation (+),
# is returned at the calling node.
nheads = @parallel (+) for i=1:10000
rand(Bool)
end
#### multithreading
# at the command line,
# export JULIA_NUM_THREADS=4
Threads.nthreads()
# simple example
a = zeros(10)
Threads.@threads for i = 1:10
a[i] = Threads.threadid()
end
n=10
niters=4000000
a = zeros(n)
# if all works correctly, it will be faster than single threaded
# note: += is not atomic here
@time Threads.@threads for i = 1:niters
a[i%n+1] += 1
end
a = zeros(n)
@time for i = 1:niters
a[i%n+1] += 1
end
n=10
niters=4000000
a = zeros(n)
# if all works correctly, it will be faster than single threaded
# note: += is not atomic here
@time Threads.@threads for i = 1:niters
a[i%n+1] += 1
end
a = zeros(n)
@parallel (+) for i = 1:niters
a[i%n+1] += 1
end
| [
4242,
2,
9614,
4420,
10730,
29964,
318,
9614,
4420,
2562,
198,
198,
2,
770,
29964,
318,
6338,
9387,
1973,
198,
2,
477,
1695,
24061,
13760,
11,
290,
262,
1255,
11,
5322,
416,
30114,
341,
11502,
828,
198,
2,
318,
4504,
379,
262,
4585,
10139,
13,
198,
77,
16600,
796,
2488,
1845,
29363,
11502,
8,
329,
1312,
28,
16,
25,
49388,
198,
220,
43720,
7,
33,
970,
8,
198,
437,
198,
198,
4242,
1963,
342,
25782,
198,
198,
2,
379,
262,
3141,
1627,
11,
198,
2,
10784,
49349,
3539,
62,
41359,
62,
4221,
15675,
50,
28,
19,
198,
198,
16818,
82,
13,
77,
16663,
82,
3419,
198,
198,
2,
2829,
1672,
198,
64,
796,
1976,
27498,
7,
940,
8,
198,
16818,
82,
13,
31,
16663,
82,
329,
1312,
796,
352,
25,
940,
198,
220,
220,
220,
257,
58,
72,
60,
796,
14122,
82,
13,
16663,
312,
3419,
198,
437,
198,
198,
77,
28,
940,
198,
48825,
364,
28,
19,
10535,
198,
64,
796,
1976,
27498,
7,
77,
8,
198,
2,
611,
477,
2499,
9380,
11,
340,
481,
307,
5443,
621,
2060,
40945,
198,
2,
3465,
25,
15853,
318,
407,
17226,
994,
198,
31,
2435,
14122,
82,
13,
31,
16663,
82,
329,
1312,
796,
352,
25,
48825,
364,
198,
220,
220,
220,
257,
58,
72,
4,
77,
10,
16,
60,
15853,
352,
198,
437,
198,
198,
64,
796,
1976,
27498,
7,
77,
8,
198,
31,
2435,
329,
1312,
796,
352,
25,
48825,
364,
198,
220,
220,
220,
257,
58,
72,
4,
77,
10,
16,
60,
15853,
352,
198,
437,
628,
198,
77,
28,
940,
198,
48825,
364,
28,
19,
10535,
198,
64,
796,
1976,
27498,
7,
77,
8,
198,
2,
611,
477,
2499,
9380,
11,
340,
481,
307,
5443,
621,
2060,
40945,
198,
2,
3465,
25,
15853,
318,
407,
17226,
994,
198,
31,
2435,
14122,
82,
13,
31,
16663,
82,
329,
1312,
796,
352,
25,
48825,
364,
198,
220,
220,
220,
257,
58,
72,
4,
77,
10,
16,
60,
15853,
352,
198,
437,
198,
198,
64,
796,
1976,
27498,
7,
77,
8,
198,
31,
1845,
29363,
11502,
8,
329,
1312,
796,
352,
25,
48825,
364,
198,
220,
220,
220,
257,
58,
72,
4,
77,
10,
16,
60,
15853,
352,
198,
437,
198
] | 2.654054 | 370 |
using Test, Random, FillArrays
import LuxurySparse: IMatrix, PermMatrix
Random.seed!(2)
p1 = IMatrix{4}()
sp = sprand(ComplexF64, 4,4, 0.5)
ds = rand(ComplexF64, 4,4)
pm = PermMatrix([2,3,4,1], randn(4))
v = [0.5, 0.3im, 0.2, 1.0]
dv = Diagonal(v)
@testset "basic" begin
@test p1==copy(p1)
@test eltype(p1) == Bool
@test size(p1) == (4, 4)
@test size(p1, 1) == size(p1, 2) == 4
@test Matrix(p1) == [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1]
end
@testset "conversion" begin
for mat in [p1, pm, dv]
@test mat == SparseMatrixCSC(mat)
@test mat == Matrix(mat)
end
for mat in [p1, pm, dv]
@test mat == PermMatrix(mat)
end
@test Diagonal(p1) == p1
@test SparseMatrixCSC(Diagonal(Fill(2, 4))) ≈ Diagonal(Fill(2, 4))
end
@testset "sparse" begin
@test nnz(p1) == 4
@test nonzeros(p1) == ones(4)
end
@testset "linalg" begin
for op in [conj, real, transpose, copy, inv]
@test op(p1) == Matrix(I, 4, 4)
@test typeof(op(p1)) == typeof(p1)
end
@test imag(p1) == zeros(4, 4)
@test p1' == Matrix(I, 4, 4)
# This will be lazy evaluated in 0.7+
@static if VERSION < v"0.7-"
@test typeof(p1') == typeof(p1)
end
@test ishermitian(p1)
end
@testset "elementary" begin
@test all(isapprox.(conj(p1), conj(Matrix(p1))))
@test all(isapprox.(real(p1), real(Matrix(p1))))
@test all(isapprox.(imag(p1), imag(Matrix(p1))))
end
@testset "basicmath" begin
@test p1*2im == Matrix(p1)*2im
@test p1/2.0 == Matrix(p1)/2.0
end
| [
3500,
6208,
11,
14534,
11,
27845,
3163,
20477,
198,
11748,
17145,
1601,
50,
29572,
25,
8959,
265,
8609,
11,
2448,
76,
46912,
198,
198,
29531,
13,
28826,
0,
7,
17,
8,
198,
198,
79,
16,
796,
8959,
265,
8609,
90,
19,
92,
3419,
198,
2777,
796,
7500,
392,
7,
5377,
11141,
37,
2414,
11,
604,
11,
19,
11,
657,
13,
20,
8,
198,
9310,
796,
43720,
7,
5377,
11141,
37,
2414,
11,
604,
11,
19,
8,
198,
4426,
796,
2448,
76,
46912,
26933,
17,
11,
18,
11,
19,
11,
16,
4357,
43720,
77,
7,
19,
4008,
198,
85,
796,
685,
15,
13,
20,
11,
657,
13,
18,
320,
11,
657,
13,
17,
11,
352,
13,
15,
60,
198,
67,
85,
796,
6031,
27923,
7,
85,
8,
198,
198,
31,
9288,
2617,
366,
35487,
1,
2221,
198,
220,
220,
220,
2488,
9288,
279,
16,
855,
30073,
7,
79,
16,
8,
198,
220,
220,
220,
2488,
9288,
1288,
4906,
7,
79,
16,
8,
6624,
347,
970,
198,
220,
220,
220,
2488,
9288,
2546,
7,
79,
16,
8,
6624,
357,
19,
11,
604,
8,
198,
220,
220,
220,
2488,
9288,
2546,
7,
79,
16,
11,
352,
8,
6624,
2546,
7,
79,
16,
11,
362,
8,
6624,
604,
198,
220,
220,
220,
2488,
9288,
24936,
7,
79,
16,
8,
6624,
685,
16,
657,
657,
657,
26,
657,
352,
657,
657,
26,
657,
657,
352,
657,
26,
657,
657,
657,
352,
60,
198,
437,
198,
198,
31,
9288,
2617,
366,
1102,
9641,
1,
2221,
198,
220,
220,
220,
329,
2603,
287,
685,
79,
16,
11,
9114,
11,
288,
85,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2603,
6624,
1338,
17208,
46912,
34,
6173,
7,
6759,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2603,
6624,
24936,
7,
6759,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
329,
2603,
287,
685,
79,
16,
11,
9114,
11,
288,
85,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2603,
6624,
2448,
76,
46912,
7,
6759,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
6031,
27923,
7,
79,
16,
8,
6624,
279,
16,
628,
220,
220,
220,
2488,
9288,
1338,
17208,
46912,
34,
6173,
7,
18683,
27923,
7,
33762,
7,
17,
11,
604,
22305,
15139,
230,
6031,
27923,
7,
33762,
7,
17,
11,
604,
4008,
198,
437,
198,
198,
31,
9288,
2617,
366,
82,
29572,
1,
2221,
198,
220,
220,
220,
2488,
9288,
299,
27305,
7,
79,
16,
8,
6624,
604,
198,
220,
220,
220,
2488,
9288,
1729,
9107,
418,
7,
79,
16,
8,
6624,
3392,
7,
19,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
75,
1292,
70,
1,
2221,
198,
220,
220,
220,
329,
1034,
287,
685,
1102,
73,
11,
1103,
11,
1007,
3455,
11,
4866,
11,
800,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1034,
7,
79,
16,
8,
6624,
24936,
7,
40,
11,
604,
11,
604,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2099,
1659,
7,
404,
7,
79,
16,
4008,
6624,
2099,
1659,
7,
79,
16,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
3590,
7,
79,
16,
8,
6624,
1976,
27498,
7,
19,
11,
604,
8,
198,
220,
220,
220,
2488,
9288,
279,
16,
6,
6624,
24936,
7,
40,
11,
604,
11,
604,
8,
628,
220,
220,
220,
1303,
770,
481,
307,
16931,
16726,
287,
657,
13,
22,
10,
198,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1279,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2099,
1659,
7,
79,
16,
11537,
6624,
2099,
1659,
7,
79,
16,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
318,
372,
2781,
666,
7,
79,
16,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
30854,
560,
1,
2221,
198,
220,
220,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
1102,
73,
7,
79,
16,
828,
11644,
7,
46912,
7,
79,
16,
35514,
198,
220,
220,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
5305,
7,
79,
16,
828,
1103,
7,
46912,
7,
79,
16,
35514,
198,
220,
220,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
48466,
7,
79,
16,
828,
3590,
7,
46912,
7,
79,
16,
35514,
198,
437,
198,
198,
31,
9288,
2617,
366,
35487,
11018,
1,
2221,
198,
220,
220,
220,
2488,
9288,
279,
16,
9,
17,
320,
6624,
24936,
7,
79,
16,
27493,
17,
320,
198,
220,
220,
220,
2488,
9288,
279,
16,
14,
17,
13,
15,
6624,
24936,
7,
79,
16,
20679,
17,
13,
15,
198,
437,
198
] | 2.001294 | 773 |
@testset "NoiseApproximation" begin
using DiffEqNoiseProcess, DiffEqBase, StochasticDiffEq
using Test
using DiffEqProblemLibrary.SDEProblemLibrary: importsdeproblems; importsdeproblems()
import DiffEqProblemLibrary.SDEProblemLibrary: prob_sde_linear, prob_sde_2Dlinear
prob = prob_sde_linear
integrator = init(prob,EM(),dt=0.01)
W = NoiseApproximation(integrator)
dt = 0.1
calculate_step!(W,dt,nothing,nothing)
dWold = W.dW
@test W.curW == W[1]
@test W.curt == 0.0
accept_step!(W,dt,nothing,nothing)
@test W.curW == 0.5 + dWold
@test W.curt == dt
@test W.curW + W.dW == W[end]
@test W.curW == W[11]
W = NoiseApproximation(integrator)
for i in 1:10
accept_step!(W,dt,nothing,nothing)
end
W.t[end] == 1.0
W = NoiseApproximation(integrator)
prob = NoiseProblem(W,(0.0,1.0))
sol = solve(prob;dt=0.1)
prob = prob_sde_2Dlinear
integrator = init(prob,EM(),dt=0.01)
W = NoiseApproximation(integrator)
prob = NoiseProblem(W,(0.0,1.0))
sol = solve(prob;dt=0.1)
end
| [
31,
9288,
2617,
366,
2949,
786,
4677,
13907,
18991,
1,
2221,
198,
198,
3500,
10631,
36,
80,
2949,
786,
18709,
11,
10631,
36,
80,
14881,
11,
520,
5374,
3477,
28813,
36,
80,
198,
3500,
6208,
198,
198,
3500,
10631,
36,
80,
40781,
23377,
13,
50,
7206,
40781,
23377,
25,
17944,
10378,
305,
22143,
26,
17944,
10378,
305,
22143,
3419,
198,
11748,
10631,
36,
80,
40781,
23377,
13,
50,
7206,
40781,
23377,
25,
1861,
62,
82,
2934,
62,
29127,
11,
1861,
62,
82,
2934,
62,
17,
35,
29127,
198,
198,
1676,
65,
796,
1861,
62,
82,
2934,
62,
29127,
198,
18908,
12392,
796,
2315,
7,
1676,
65,
11,
3620,
22784,
28664,
28,
15,
13,
486,
8,
198,
198,
54,
796,
30964,
4677,
13907,
18991,
7,
18908,
12392,
8,
628,
198,
28664,
796,
657,
13,
16,
198,
9948,
3129,
378,
62,
9662,
0,
7,
54,
11,
28664,
11,
22366,
11,
22366,
8,
198,
67,
54,
727,
796,
370,
13,
67,
54,
198,
31,
9288,
370,
13,
22019,
54,
6624,
370,
58,
16,
60,
198,
31,
9288,
370,
13,
66,
3325,
6624,
657,
13,
15,
198,
13635,
62,
9662,
0,
7,
54,
11,
28664,
11,
22366,
11,
22366,
8,
198,
31,
9288,
370,
13,
22019,
54,
6624,
657,
13,
20,
1343,
288,
54,
727,
198,
31,
9288,
370,
13,
66,
3325,
6624,
288,
83,
198,
31,
9288,
370,
13,
22019,
54,
1343,
370,
13,
67,
54,
6624,
370,
58,
437,
60,
198,
31,
9288,
370,
13,
22019,
54,
6624,
370,
58,
1157,
60,
198,
198,
54,
796,
30964,
4677,
13907,
18991,
7,
18908,
12392,
8,
198,
1640,
1312,
287,
352,
25,
940,
198,
220,
2453,
62,
9662,
0,
7,
54,
11,
28664,
11,
22366,
11,
22366,
8,
198,
437,
198,
54,
13,
83,
58,
437,
60,
6624,
352,
13,
15,
198,
198,
54,
796,
30964,
4677,
13907,
18991,
7,
18908,
12392,
8,
198,
1676,
65,
796,
30964,
40781,
7,
54,
11,
7,
15,
13,
15,
11,
16,
13,
15,
4008,
198,
34453,
796,
8494,
7,
1676,
65,
26,
28664,
28,
15,
13,
16,
8,
628,
198,
1676,
65,
796,
1861,
62,
82,
2934,
62,
17,
35,
29127,
198,
18908,
12392,
796,
2315,
7,
1676,
65,
11,
3620,
22784,
28664,
28,
15,
13,
486,
8,
198,
54,
796,
30964,
4677,
13907,
18991,
7,
18908,
12392,
8,
198,
1676,
65,
796,
30964,
40781,
7,
54,
11,
7,
15,
13,
15,
11,
16,
13,
15,
4008,
198,
34453,
796,
8494,
7,
1676,
65,
26,
28664,
28,
15,
13,
16,
8,
198,
198,
437,
198
] | 2.315789 | 418 |
module SoftSquishyMatter
"""
Flush output so that jobs can be monitored on cluster.
"""
@inline println(args...) = println(stdout, args...)
@inline function println(io::IO, args...)
Base.println(io, args...)
flush(io)
end
using Random
using Serialization
using DataStructures
using Plots
include("definitions.jl")
include("runsimulation.jl")
include("activeforces.jl")
include("particle.jl")
include("integrators.jl")
include("celllist.jl")
include("interactions.jl")
include("externalforces.jl")
include("analysis/visualize.jl")
println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
println("SoftSquishyMatter Loaded!")
println("Michael Wang")
println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
end
| [
21412,
8297,
22266,
49785,
44,
1436,
201,
198,
201,
198,
37811,
201,
198,
7414,
1530,
5072,
523,
326,
3946,
460,
307,
20738,
319,
13946,
13,
201,
198,
37811,
201,
198,
31,
45145,
44872,
7,
22046,
23029,
796,
44872,
7,
19282,
448,
11,
26498,
23029,
201,
198,
31,
45145,
2163,
44872,
7,
952,
3712,
9399,
11,
26498,
23029,
201,
198,
220,
220,
220,
7308,
13,
35235,
7,
952,
11,
26498,
23029,
201,
198,
220,
220,
220,
24773,
7,
952,
8,
201,
198,
437,
201,
198,
201,
198,
3500,
14534,
201,
198,
3500,
23283,
1634,
201,
198,
3500,
6060,
44909,
942,
201,
198,
3500,
1345,
1747,
201,
198,
201,
198,
17256,
7203,
4299,
50101,
13,
20362,
4943,
201,
198,
17256,
7203,
5143,
14323,
1741,
13,
20362,
4943,
201,
198,
17256,
7203,
5275,
27087,
13,
20362,
4943,
201,
198,
17256,
7203,
3911,
1548,
13,
20362,
4943,
201,
198,
17256,
7203,
18908,
18942,
13,
20362,
4943,
201,
198,
17256,
7203,
3846,
4868,
13,
20362,
4943,
201,
198,
17256,
7203,
3849,
4658,
13,
20362,
4943,
201,
198,
17256,
7203,
1069,
759,
1604,
273,
728,
13,
20362,
4943,
201,
198,
201,
198,
17256,
7203,
20930,
14,
41464,
1096,
13,
20362,
4943,
201,
198,
201,
198,
35235,
7203,
27156,
27156,
27156,
27156,
4943,
201,
198,
35235,
7203,
18380,
22266,
49785,
44,
1436,
42485,
2474,
8,
201,
198,
35235,
7203,
13256,
15233,
4943,
201,
198,
35235,
7203,
27156,
27156,
27156,
27156,
4943,
201,
198,
201,
198,
437,
201,
198
] | 3.294606 | 241 |
# TODO: Move SimpleLogger in here
| [
2,
16926,
46,
25,
10028,
17427,
11187,
1362,
287,
994,
198
] | 3.090909 | 11 |
module segment
import Term
import Term: remove_markup, remove_ansi
import ..style: apply_style, MarkupStyle
import ..measure: Measure
export Segment
# ---------------------------------------------------------------------------- #
# SEGMENT #
# ---------------------------------------------------------------------------- #
"""
Segment
stores one piece of text with all the styles applied to it.
"""
struct Segment
text::AbstractString # text with ANSI codes injected
plain::AbstractString # plain text with no style
measure::Measure # measure of plain text
end
# ------------------------------- constructors ------------------------------- #
"""
Segment(text::AbstractString)
Construct a Segment out of a string with markup.
"""
function Segment(text::Union{Segment,AbstractString})
if typeof(text) == Segment
return text
end
plain = remove_ansi(remove_markup(text))
# len(x) = (length ∘ remove_ansi ∘ remove_markup)(x)
# @info "Creating segment" len(text) len(apply_style(text)) len(remove_markup(apply_style(text)))
return Segment(remove_markup(apply_style(text)), plain, Measure(plain))
end
"""
Segment(text::Union{Segment, AbstractString}, markup::AbstractString)
Construct a Segment out of a plain string and a markup string with style info
"""
function Segment(text::Union{Segment,AbstractString}, markup::Union{Nothing,AbstractString})
return isnothing(markup) ? Segment(text) : Segment("[$markup]" * text)
end
"""
Segment(text::Union{Segment, AbstractString}, style::MarkupStyle)
Construct a Segment out of a plain string and a MarkupStyle object.
"""
function Segment(text::Union{Segment,AbstractString}, style::Union{Nothing,MarkupStyle})
if isnothing(style)
Segment(text, text, Measure(text))
else
Segment(apply_style(text, style), text, Measure(text))
end
end
Segment(text::Union{AbstractString,Segment}, null::Nothing) = Segment(text)
# --------------------------------- printing --------------------------------- #
"""print styled in stdout, info otherwise"""
function Base.show(io::IO, seg::Segment)
if io == stdout
print(io, seg.text)
else
print(io, "Segment \e[2m(size: $(seg.measure))\e[0m")
end
end
# ---------------------------------------------------------------------------- #
# LAYOUT #
# ---------------------------------------------------------------------------- #
"""
Term.fillin(segments::Vector{Segment})::Vector{Segment}
Ensure that for each segment the text has the same width
"""
function Term.fillin(segments::Vector{Segment})::Vector{Segment}
widths = [seg.measure.w for seg in segments]
w = max(widths...)
filled::Vector{Segment} = []
for seg in segments
push!(filled, Segment(seg.text * " "^(w-seg.measure.w)))
end
return filled
end
# -------------------------------- concatenate ------------------------------- #
"""
concatenate strings and segments
"""
Base.:*(seg::Segment, str::AbstractString) = Segment(seg.text * str)
Base.:*(str::AbstractString, seg::Segment) = Segment(str * seg.text)
Base.:*(seg1::Segment, seg2::Segment) = Segment(seg1.text * seg2.text)
end
| [
21412,
10618,
198,
11748,
35118,
198,
11748,
35118,
25,
4781,
62,
4102,
929,
11,
4781,
62,
504,
72,
198,
11748,
11485,
7635,
25,
4174,
62,
7635,
11,
2940,
929,
21466,
198,
11748,
11485,
1326,
5015,
25,
24291,
198,
198,
39344,
1001,
5154,
198,
198,
2,
16529,
10541,
1303,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
311,
7156,
10979,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
16529,
10541,
1303,
198,
198,
37811,
198,
220,
220,
220,
1001,
5154,
198,
198,
43409,
530,
3704,
286,
2420,
351,
477,
262,
12186,
5625,
284,
340,
13,
198,
37811,
198,
7249,
1001,
5154,
198,
220,
220,
220,
2420,
3712,
23839,
10100,
220,
220,
1303,
2420,
351,
3537,
11584,
12416,
25077,
198,
220,
220,
220,
8631,
3712,
23839,
10100,
220,
1303,
8631,
2420,
351,
645,
3918,
198,
220,
220,
220,
3953,
3712,
47384,
220,
220,
220,
220,
220,
220,
1303,
3953,
286,
8631,
2420,
198,
437,
198,
198,
2,
34400,
24305,
5678,
669,
34400,
24305,
1303,
198,
37811,
198,
220,
220,
220,
1001,
5154,
7,
5239,
3712,
23839,
10100,
8,
198,
198,
42316,
257,
1001,
5154,
503,
286,
257,
4731,
351,
41485,
13,
198,
37811,
198,
8818,
1001,
5154,
7,
5239,
3712,
38176,
90,
41030,
434,
11,
23839,
10100,
30072,
198,
220,
220,
220,
611,
2099,
1659,
7,
5239,
8,
6624,
1001,
5154,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2420,
198,
220,
220,
220,
886,
198,
220,
220,
220,
8631,
796,
4781,
62,
504,
72,
7,
28956,
62,
4102,
929,
7,
5239,
4008,
628,
220,
220,
220,
1303,
18896,
7,
87,
8,
796,
357,
13664,
18872,
246,
4781,
62,
504,
72,
18872,
246,
4781,
62,
4102,
929,
5769,
87,
8,
198,
220,
220,
220,
1303,
2488,
10951,
366,
32071,
10618,
1,
18896,
7,
5239,
8,
18896,
7,
39014,
62,
7635,
7,
5239,
4008,
18896,
7,
28956,
62,
4102,
929,
7,
39014,
62,
7635,
7,
5239,
22305,
198,
220,
220,
220,
1441,
1001,
5154,
7,
28956,
62,
4102,
929,
7,
39014,
62,
7635,
7,
5239,
36911,
8631,
11,
24291,
7,
25638,
4008,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
1001,
5154,
7,
5239,
3712,
38176,
90,
41030,
434,
11,
27741,
10100,
5512,
41485,
3712,
23839,
10100,
8,
198,
198,
42316,
257,
1001,
5154,
503,
286,
257,
8631,
4731,
290,
257,
41485,
4731,
351,
3918,
7508,
198,
37811,
198,
8818,
1001,
5154,
7,
5239,
3712,
38176,
90,
41030,
434,
11,
23839,
10100,
5512,
41485,
3712,
38176,
90,
18465,
11,
23839,
10100,
30072,
198,
220,
220,
220,
1441,
318,
22366,
7,
4102,
929,
8,
5633,
1001,
5154,
7,
5239,
8,
1058,
1001,
5154,
7203,
58,
3,
4102,
929,
30866,
1635,
2420,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
1001,
5154,
7,
5239,
3712,
38176,
90,
41030,
434,
11,
27741,
10100,
5512,
3918,
3712,
9704,
929,
21466,
8,
198,
198,
42316,
257,
1001,
5154,
503,
286,
257,
8631,
4731,
290,
257,
2940,
929,
21466,
2134,
13,
198,
37811,
198,
8818,
1001,
5154,
7,
5239,
3712,
38176,
90,
41030,
434,
11,
23839,
10100,
5512,
3918,
3712,
38176,
90,
18465,
11,
9704,
929,
21466,
30072,
198,
220,
220,
220,
611,
318,
22366,
7,
7635,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1001,
5154,
7,
5239,
11,
2420,
11,
24291,
7,
5239,
4008,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1001,
5154,
7,
39014,
62,
7635,
7,
5239,
11,
3918,
828,
2420,
11,
24291,
7,
5239,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
41030,
434,
7,
5239,
3712,
38176,
90,
23839,
10100,
11,
41030,
434,
5512,
9242,
3712,
18465,
8,
796,
1001,
5154,
7,
5239,
8,
198,
198,
2,
20368,
12,
13570,
20368,
12,
1303,
198,
37811,
4798,
45552,
287,
14367,
448,
11,
7508,
4306,
37811,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
384,
70,
3712,
41030,
434,
8,
198,
220,
220,
220,
611,
33245,
6624,
14367,
448,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
952,
11,
384,
70,
13,
5239,
8,
628,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
952,
11,
366,
41030,
434,
3467,
68,
58,
17,
76,
7,
7857,
25,
29568,
325,
70,
13,
1326,
5015,
4008,
59,
68,
58,
15,
76,
4943,
198,
220,
220,
220,
886,
198,
437,
628,
198,
198,
2,
16529,
10541,
1303,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
406,
4792,
12425,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
16529,
10541,
1303,
198,
198,
37811,
198,
220,
220,
220,
35118,
13,
20797,
259,
7,
325,
11726,
3712,
38469,
90,
41030,
434,
92,
2599,
25,
38469,
90,
41030,
434,
92,
198,
198,
4834,
19532,
326,
329,
1123,
10618,
262,
2420,
468,
262,
976,
9647,
198,
37811,
198,
8818,
35118,
13,
20797,
259,
7,
325,
11726,
3712,
38469,
90,
41030,
434,
92,
2599,
25,
38469,
90,
41030,
434,
92,
198,
220,
220,
220,
9647,
82,
796,
685,
325,
70,
13,
1326,
5015,
13,
86,
329,
384,
70,
287,
17894,
60,
198,
220,
220,
220,
266,
796,
3509,
7,
10394,
82,
23029,
628,
220,
220,
220,
5901,
3712,
38469,
90,
41030,
434,
92,
796,
17635,
198,
220,
220,
220,
329,
384,
70,
287,
17894,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
20286,
11,
1001,
5154,
7,
325,
70,
13,
5239,
1635,
366,
366,
61,
7,
86,
12,
325,
70,
13,
1326,
5015,
13,
86,
22305,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
5901,
198,
437,
198,
198,
2,
20368,
1673,
36686,
378,
34400,
24305,
1303,
198,
37811,
198,
1102,
9246,
268,
378,
13042,
290,
17894,
198,
37811,
198,
14881,
11207,
9,
7,
325,
70,
3712,
41030,
434,
11,
965,
3712,
23839,
10100,
8,
796,
1001,
5154,
7,
325,
70,
13,
5239,
1635,
965,
8,
198,
14881,
11207,
9,
7,
2536,
3712,
23839,
10100,
11,
384,
70,
3712,
41030,
434,
8,
796,
1001,
5154,
7,
2536,
1635,
384,
70,
13,
5239,
8,
198,
14881,
11207,
9,
7,
325,
70,
16,
3712,
41030,
434,
11,
384,
70,
17,
3712,
41030,
434,
8,
796,
1001,
5154,
7,
325,
70,
16,
13,
5239,
1635,
384,
70,
17,
13,
5239,
8,
198,
198,
437,
198
] | 2.915937 | 1,142 |
### A Pluto.jl notebook ###
# v0.12.10
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : missing
el
end
end
# ╔═╡ 0a774706-1d0e-11eb-1d3a-6d641500d34d
using Pkg, DrWatson
# ╔═╡ 0a7776e0-1d0e-11eb-2a05-795e2470b260
begin
@quickactivate "StatisticsWithJuliaPlutoNotebooks"
using PlutoUI
using Plots
end
# ╔═╡ bc93b1e6-1d0d-11eb-3a1b-cf047fc8d621
md"## Listing 1.1"
# ╔═╡ 0a77d522-1d0e-11eb-1dfa-af3a546454ae
"There is more than one way to say hello:"
# ╔═╡ 0a83a6a4-1d0e-11eb-27cf-6b1ae5c75d6c
md"##### This is an array consisting of three strings."
# ╔═╡ 5cce7a9c-1d0e-11eb-0a59-43dceb80ee34
helloArray = ["Hello","G'day","Shalom"]
# ╔═╡ 0970cc02-1d35-11eb-0636-4d61aba864fe
md"##### Printing intermediate results in Pluto notebooks is a bit tedious currently, e.g.:"
# ╔═╡ ae5f130c-1d32-11eb-0322-4387a35fcae7
map(1:length(helloArray)) do i
gr = helloArray[i]
md" $gr world"
end
# ╔═╡ 33ffe1f2-2688-11eb-071d-ef4974b52b73
helloArray[1], "universe"
# ╔═╡ 5eee59a6-1d35-11eb-0e55-e53b9fef1b9c
md"##### Note the space in front of the first interpolation ( `$gr` )."
# ╔═╡ 5a9ab6da-1d33-11eb-27b2-a3ec1b2d8e02
map(1:3) do i
R = i+100
T = R^2
md"hello $R and $T"
end
# ╔═╡ 988eab90-1d33-11eb-1278-0f39acc4dcd0
map(1:3) do i
R = i+100
T = R^2
Text("hello $R and $T")
end
# ╔═╡ 0a8f6b9c-1d0e-11eb-0109-21ef005e63fe
md"##### Below we use a construct called a `comprehension' (or 'list comprehension')"
# ╔═╡ 0a8eef00-1d0e-11eb-11b7-d566161ac295
md"##### These squares are just perfect:"
# ╔═╡ 3d114318-1d10-11eb-2b93-ed04fda820ca
squares = [i^2 for i in 0:10]
# ╔═╡ 5eaa07b2-2689-11eb-23ce-55972c6a2861
md"##### Or, the above printing example:"
# ╔═╡ 8c1e52ee-2688-11eb-3fc7-ad83de5ec8c7
[("$(helloArray[i]) universe") for i in 1:length(helloArray)]
# ╔═╡ 0a9a2898-1d0e-11eb-1583-3bfdf887a967
md"##### You can loop on elements of arrays without having to use indexing. The last line of every code snippet is also evaluated as output (in addition to any figures and printing output shown previously)."
# ╔═╡ a0e7ab92-1d22-11eb-27fd-ef499034dd88
map(squares) do s
sqrt(s)
end
# ╔═╡ 8b5571fa-1d35-11eb-1fef-1749f6da2d5e
md"##### Another important concept in Julia is `broadcasting` over an Array:"
# ╔═╡ 464824a8-1d0e-11eb-08b0-39b95ed0c30c
sqrt.(squares)
# ╔═╡ aca76098-1d35-11eb-1cf3-1b68437e17f7
md"##### Finally, the most tricky difference between the Julia REPL and other notebook formats is the reactivity of Pluto. It's cool, but also prevents multiple definitions across cells. If this happens, Pluto will suggest to bracket the assigments in a single cell with `begin` and `end`"
# ╔═╡ 01420810-1d36-11eb-1846-b579d2238fcc
begin
x = 5
x = x^2
end
# ╔═╡ 9e47c86e-1d38-11eb-0dae-ed14a8c961ad
md"##### Example of Pluto reactivity."
# ╔═╡ 88c09530-1d37-11eb-1b90-1991d07df0c2
@bind y Slider(3:12; default=7, show_value=true)
# ╔═╡ eaf674e0-1d37-11eb-234e-cbd28ef92cda
y^2
# ╔═╡ 569dad26-1d38-11eb-3a0b-69598098bf7c
plot(rand(y^3), lab="y^3 samples", leg=:topleft)
# ╔═╡ 02efc864-1d0e-11eb-027c-2f992de0069e
md"## End of listing 1. 1"
# ╔═╡ Cell order:
# ╟─bc93b1e6-1d0d-11eb-3a1b-cf047fc8d621
# ╠═0a774706-1d0e-11eb-1d3a-6d641500d34d
# ╠═0a7776e0-1d0e-11eb-2a05-795e2470b260
# ╠═0a77d522-1d0e-11eb-1dfa-af3a546454ae
# ╟─0a83a6a4-1d0e-11eb-27cf-6b1ae5c75d6c
# ╠═5cce7a9c-1d0e-11eb-0a59-43dceb80ee34
# ╟─0970cc02-1d35-11eb-0636-4d61aba864fe
# ╠═ae5f130c-1d32-11eb-0322-4387a35fcae7
# ╠═33ffe1f2-2688-11eb-071d-ef4974b52b73
# ╟─5eee59a6-1d35-11eb-0e55-e53b9fef1b9c
# ╠═5a9ab6da-1d33-11eb-27b2-a3ec1b2d8e02
# ╠═988eab90-1d33-11eb-1278-0f39acc4dcd0
# ╟─0a8f6b9c-1d0e-11eb-0109-21ef005e63fe
# ╟─0a8eef00-1d0e-11eb-11b7-d566161ac295
# ╠═3d114318-1d10-11eb-2b93-ed04fda820ca
# ╟─5eaa07b2-2689-11eb-23ce-55972c6a2861
# ╠═8c1e52ee-2688-11eb-3fc7-ad83de5ec8c7
# ╟─0a9a2898-1d0e-11eb-1583-3bfdf887a967
# ╠═a0e7ab92-1d22-11eb-27fd-ef499034dd88
# ╟─8b5571fa-1d35-11eb-1fef-1749f6da2d5e
# ╠═464824a8-1d0e-11eb-08b0-39b95ed0c30c
# ╟─aca76098-1d35-11eb-1cf3-1b68437e17f7
# ╠═01420810-1d36-11eb-1846-b579d2238fcc
# ╟─9e47c86e-1d38-11eb-0dae-ed14a8c961ad
# ╠═88c09530-1d37-11eb-1b90-1991d07df0c2
# ╠═eaf674e0-1d37-11eb-234e-cbd28ef92cda
# ╠═569dad26-1d38-11eb-3a0b-69598098bf7c
# ╟─02efc864-1d0e-11eb-027c-2f992de0069e
| [
21017,
317,
32217,
13,
20362,
20922,
44386,
198,
2,
410,
15,
13,
1065,
13,
940,
198,
198,
3500,
2940,
2902,
198,
3500,
21365,
18274,
4487,
198,
198,
2,
770,
32217,
20922,
3544,
2488,
21653,
329,
9427,
3458,
13,
1649,
2491,
428,
20922,
2354,
286,
32217,
11,
262,
1708,
705,
76,
735,
2196,
6,
286,
2488,
21653,
3607,
5421,
9633,
257,
4277,
1988,
357,
38070,
286,
281,
4049,
737,
198,
20285,
305,
11007,
7,
4299,
11,
5002,
8,
198,
220,
220,
220,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
1288,
796,
29568,
3798,
7,
30854,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
29568,
3798,
7,
4299,
4008,
796,
7231,
13,
1324,
677,
540,
7,
14881,
13,
1136,
11,
1288,
8,
5633,
7308,
13,
1136,
7,
417,
8,
1058,
4814,
198,
220,
220,
220,
220,
220,
220,
220,
1288,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
3324,
27790,
21,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
16,
67,
18,
64,
12,
21,
67,
2414,
33698,
67,
2682,
67,
198,
3500,
350,
10025,
11,
1583,
54,
13506,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
3324,
4304,
68,
15,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
17,
64,
2713,
12,
41544,
68,
1731,
2154,
65,
21719,
198,
27471,
198,
197,
31,
24209,
39022,
366,
48346,
3152,
16980,
544,
3646,
9390,
6425,
12106,
1,
198,
197,
3500,
32217,
10080,
198,
197,
3500,
1345,
1747,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
47125,
6052,
65,
16,
68,
21,
12,
16,
67,
15,
67,
12,
1157,
1765,
12,
18,
64,
16,
65,
12,
12993,
48000,
16072,
23,
67,
21,
2481,
198,
9132,
1,
2235,
7343,
278,
352,
13,
16,
1,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
3324,
67,
49542,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
16,
7568,
64,
12,
1878,
18,
64,
49489,
34229,
3609,
198,
1,
1858,
318,
517,
621,
530,
835,
284,
910,
23748,
11097,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
5999,
64,
21,
64,
19,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1983,
12993,
12,
21,
65,
16,
3609,
20,
66,
2425,
67,
21,
66,
198,
9132,
1,
4242,
2,
770,
318,
281,
7177,
17747,
286,
1115,
13042,
526,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
66,
344,
22,
64,
24,
66,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
15,
64,
3270,
12,
3559,
67,
344,
65,
1795,
1453,
2682,
198,
31373,
19182,
796,
14631,
15496,
2430,
38,
1549,
323,
2430,
2484,
282,
296,
8973,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
7769,
2154,
535,
2999,
12,
16,
67,
2327,
12,
1157,
1765,
12,
3312,
2623,
12,
19,
67,
5333,
15498,
39570,
5036,
198,
9132,
1,
4242,
2,
44118,
19898,
2482,
287,
32217,
43935,
318,
257,
1643,
32460,
3058,
11,
304,
13,
70,
13,
11097,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
257,
68,
20,
69,
12952,
66,
12,
16,
67,
2624,
12,
1157,
1765,
12,
3070,
1828,
12,
19,
32220,
64,
2327,
16072,
3609,
22,
198,
8899,
7,
16,
25,
13664,
7,
31373,
19182,
4008,
466,
1312,
198,
197,
2164,
796,
23748,
19182,
58,
72,
60,
198,
220,
220,
220,
45243,
1,
720,
2164,
995,
1,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
4747,
16658,
16,
69,
17,
12,
2075,
3459,
12,
1157,
1765,
12,
2998,
16,
67,
12,
891,
2920,
4524,
65,
4309,
65,
4790,
198,
31373,
19182,
58,
16,
4357,
366,
403,
3997,
1,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
1453,
68,
3270,
64,
21,
12,
16,
67,
2327,
12,
1157,
1765,
12,
15,
68,
2816,
12,
68,
4310,
65,
24,
69,
891,
16,
65,
24,
66,
198,
9132,
1,
4242,
2,
5740,
262,
2272,
287,
2166,
286,
262,
717,
39555,
341,
357,
4600,
3,
2164,
63,
1267,
526,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
64,
24,
397,
21,
6814,
12,
16,
67,
2091,
12,
1157,
1765,
12,
1983,
65,
17,
12,
64,
18,
721,
16,
65,
17,
67,
23,
68,
2999,
198,
8899,
7,
16,
25,
18,
8,
466,
1312,
198,
220,
220,
220,
371,
796,
1312,
10,
3064,
198,
220,
220,
220,
309,
796,
371,
61,
17,
198,
220,
220,
220,
45243,
1,
31373,
720,
49,
290,
720,
51,
1,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
860,
3459,
68,
397,
3829,
12,
16,
67,
2091,
12,
1157,
1765,
12,
1065,
3695,
12,
15,
69,
2670,
4134,
19,
67,
10210,
15,
198,
8899,
7,
16,
25,
18,
8,
466,
1312,
198,
220,
220,
220,
371,
796,
1312,
10,
3064,
198,
220,
220,
220,
309,
796,
371,
61,
17,
198,
220,
220,
220,
8255,
7203,
31373,
720,
49,
290,
720,
51,
4943,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
23,
69,
21,
65,
24,
66,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
486,
2931,
12,
2481,
891,
22544,
68,
5066,
5036,
198,
9132,
1,
4242,
2,
10383,
356,
779,
257,
5678,
1444,
257,
4600,
785,
3866,
5135,
295,
6,
357,
273,
705,
4868,
35915,
11537,
1,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
23,
68,
891,
405,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1157,
65,
22,
12,
67,
20,
2791,
25948,
330,
25710,
198,
9132,
1,
4242,
2,
2312,
24438,
389,
655,
2818,
11097,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
513,
67,
1157,
3559,
1507,
12,
16,
67,
940,
12,
1157,
1765,
12,
17,
65,
6052,
12,
276,
3023,
69,
6814,
41739,
6888,
198,
16485,
3565,
796,
685,
72,
61,
17,
329,
1312,
287,
657,
25,
940,
60,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
68,
7252,
2998,
65,
17,
12,
2075,
4531,
12,
1157,
1765,
12,
1954,
344,
12,
38605,
4761,
66,
21,
64,
2078,
5333,
198,
9132,
1,
4242,
2,
1471,
11,
262,
2029,
13570,
1672,
11097,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
807,
66,
16,
68,
4309,
1453,
12,
2075,
3459,
12,
1157,
1765,
12,
18,
16072,
22,
12,
324,
5999,
2934,
20,
721,
23,
66,
22,
198,
58,
7203,
3,
7,
31373,
19182,
58,
72,
12962,
6881,
4943,
329,
1312,
287,
352,
25,
13664,
7,
31373,
19182,
15437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
64,
24,
64,
2078,
4089,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1314,
5999,
12,
18,
19881,
7568,
46660,
64,
24,
3134,
198,
9132,
1,
4242,
2,
921,
460,
9052,
319,
4847,
286,
26515,
1231,
1719,
284,
779,
6376,
278,
13,
383,
938,
1627,
286,
790,
2438,
39442,
318,
635,
16726,
355,
5072,
357,
259,
3090,
284,
597,
5538,
290,
13570,
5072,
3402,
4271,
21387,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
257,
15,
68,
22,
397,
5892,
12,
16,
67,
1828,
12,
1157,
1765,
12,
1983,
16344,
12,
891,
28324,
49841,
1860,
3459,
198,
8899,
7,
16485,
3565,
8,
466,
264,
198,
197,
31166,
17034,
7,
82,
8,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
807,
65,
2816,
4869,
13331,
12,
16,
67,
2327,
12,
1157,
1765,
12,
16,
69,
891,
12,
1558,
2920,
69,
21,
6814,
17,
67,
20,
68,
198,
9132,
1,
4242,
2,
6023,
1593,
3721,
287,
22300,
318,
4600,
36654,
19913,
63,
625,
281,
15690,
11097,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
604,
34287,
1731,
64,
23,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
2919,
65,
15,
12,
2670,
65,
3865,
276,
15,
66,
1270,
66,
198,
31166,
17034,
12195,
16485,
3565,
8,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
936,
64,
40761,
4089,
12,
16,
67,
2327,
12,
1157,
1765,
12,
16,
12993,
18,
12,
16,
65,
41580,
2718,
68,
1558,
69,
22,
198,
9132,
1,
4242,
2,
9461,
11,
262,
749,
17198,
3580,
1022,
262,
22300,
45285,
290,
584,
20922,
17519,
318,
262,
6324,
3458,
286,
32217,
13,
632,
338,
3608,
11,
475,
635,
15174,
3294,
17336,
1973,
4778,
13,
1002,
428,
4325,
11,
32217,
481,
1950,
284,
19096,
262,
840,
328,
902,
287,
257,
2060,
2685,
351,
4600,
27471,
63,
290,
4600,
437,
63,
1,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
5534,
19,
21315,
940,
12,
16,
67,
2623,
12,
1157,
1765,
12,
1507,
3510,
12,
65,
41734,
67,
1828,
2548,
69,
535,
198,
27471,
198,
197,
87,
796,
642,
198,
197,
87,
796,
2124,
61,
17,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
860,
68,
2857,
66,
4521,
68,
12,
16,
67,
2548,
12,
1157,
1765,
12,
15,
67,
3609,
12,
276,
1415,
64,
23,
66,
4846,
16,
324,
198,
9132,
1,
4242,
2,
17934,
286,
32217,
6324,
3458,
526,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
9193,
66,
2931,
38612,
12,
16,
67,
2718,
12,
1157,
1765,
12,
16,
65,
3829,
12,
24529,
67,
2998,
7568,
15,
66,
17,
198,
31,
21653,
331,
3454,
1304,
7,
18,
25,
1065,
26,
4277,
28,
22,
11,
905,
62,
8367,
28,
7942,
8,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
304,
1878,
45385,
68,
15,
12,
16,
67,
2718,
12,
1157,
1765,
12,
24409,
68,
12,
66,
17457,
2078,
891,
5892,
66,
6814,
198,
88,
61,
17,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
3388,
47984,
2075,
12,
16,
67,
2548,
12,
1157,
1765,
12,
18,
64,
15,
65,
12,
3388,
3270,
1795,
4089,
19881,
22,
66,
198,
29487,
7,
25192,
7,
88,
61,
18,
828,
2248,
2625,
88,
61,
18,
8405,
1600,
1232,
28,
25,
83,
643,
701,
8,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
7816,
891,
66,
39570,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
44698,
66,
12,
17,
69,
41561,
2934,
405,
3388,
68,
198,
9132,
1,
2235,
5268,
286,
13487,
352,
13,
352,
1,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
12440,
1502,
25,
198,
2,
2343,
243,
253,
7280,
15630,
6052,
65,
16,
68,
21,
12,
16,
67,
15,
67,
12,
1157,
1765,
12,
18,
64,
16,
65,
12,
12993,
48000,
16072,
23,
67,
21,
2481,
198,
2,
2343,
243,
254,
28670,
15,
64,
3324,
27790,
21,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
16,
67,
18,
64,
12,
21,
67,
2414,
33698,
67,
2682,
67,
198,
2,
2343,
243,
254,
28670,
15,
64,
3324,
4304,
68,
15,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
17,
64,
2713,
12,
41544,
68,
1731,
2154,
65,
21719,
198,
2,
2343,
243,
254,
28670,
15,
64,
3324,
67,
49542,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
16,
7568,
64,
12,
1878,
18,
64,
49489,
34229,
3609,
198,
2,
2343,
243,
253,
7280,
15,
64,
5999,
64,
21,
64,
19,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1983,
12993,
12,
21,
65,
16,
3609,
20,
66,
2425,
67,
21,
66,
198,
2,
2343,
243,
254,
28670,
20,
66,
344,
22,
64,
24,
66,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
15,
64,
3270,
12,
3559,
67,
344,
65,
1795,
1453,
2682,
198,
2,
2343,
243,
253,
7280,
2931,
2154,
535,
2999,
12,
16,
67,
2327,
12,
1157,
1765,
12,
3312,
2623,
12,
19,
67,
5333,
15498,
39570,
5036,
198,
2,
2343,
243,
254,
28670,
3609,
20,
69,
12952,
66,
12,
16,
67,
2624,
12,
1157,
1765,
12,
3070,
1828,
12,
19,
32220,
64,
2327,
16072,
3609,
22,
198,
2,
2343,
243,
254,
28670,
2091,
16658,
16,
69,
17,
12,
2075,
3459,
12,
1157,
1765,
12,
2998,
16,
67,
12,
891,
2920,
4524,
65,
4309,
65,
4790,
198,
2,
2343,
243,
253,
7280,
20,
1453,
68,
3270,
64,
21,
12,
16,
67,
2327,
12,
1157,
1765,
12,
15,
68,
2816,
12,
68,
4310,
65,
24,
69,
891,
16,
65,
24,
66,
198,
2,
2343,
243,
254,
28670,
20,
64,
24,
397,
21,
6814,
12,
16,
67,
2091,
12,
1157,
1765,
12,
1983,
65,
17,
12,
64,
18,
721,
16,
65,
17,
67,
23,
68,
2999,
198,
2,
2343,
243,
254,
28670,
24,
3459,
68,
397,
3829,
12,
16,
67,
2091,
12,
1157,
1765,
12,
1065,
3695,
12,
15,
69,
2670,
4134,
19,
67,
10210,
15,
198,
2,
2343,
243,
253,
7280,
15,
64,
23,
69,
21,
65,
24,
66,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
486,
2931,
12,
2481,
891,
22544,
68,
5066,
5036,
198,
2,
2343,
243,
253,
7280,
15,
64,
23,
68,
891,
405,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1157,
65,
22,
12,
67,
20,
2791,
25948,
330,
25710,
198,
2,
2343,
243,
254,
28670,
18,
67,
1157,
3559,
1507,
12,
16,
67,
940,
12,
1157,
1765,
12,
17,
65,
6052,
12,
276,
3023,
69,
6814,
41739,
6888,
198,
2,
2343,
243,
253,
7280,
20,
68,
7252,
2998,
65,
17,
12,
2075,
4531,
12,
1157,
1765,
12,
1954,
344,
12,
38605,
4761,
66,
21,
64,
2078,
5333,
198,
2,
2343,
243,
254,
28670,
23,
66,
16,
68,
4309,
1453,
12,
2075,
3459,
12,
1157,
1765,
12,
18,
16072,
22,
12,
324,
5999,
2934,
20,
721,
23,
66,
22,
198,
2,
2343,
243,
253,
7280,
15,
64,
24,
64,
2078,
4089,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
1314,
5999,
12,
18,
19881,
7568,
46660,
64,
24,
3134,
198,
2,
2343,
243,
254,
28670,
64,
15,
68,
22,
397,
5892,
12,
16,
67,
1828,
12,
1157,
1765,
12,
1983,
16344,
12,
891,
28324,
49841,
1860,
3459,
198,
2,
2343,
243,
253,
7280,
23,
65,
2816,
4869,
13331,
12,
16,
67,
2327,
12,
1157,
1765,
12,
16,
69,
891,
12,
1558,
2920,
69,
21,
6814,
17,
67,
20,
68,
198,
2,
2343,
243,
254,
28670,
19,
34287,
1731,
64,
23,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
2919,
65,
15,
12,
2670,
65,
3865,
276,
15,
66,
1270,
66,
198,
2,
2343,
243,
253,
7280,
22260,
40761,
4089,
12,
16,
67,
2327,
12,
1157,
1765,
12,
16,
12993,
18,
12,
16,
65,
41580,
2718,
68,
1558,
69,
22,
198,
2,
2343,
243,
254,
28670,
28645,
21315,
940,
12,
16,
67,
2623,
12,
1157,
1765,
12,
1507,
3510,
12,
65,
41734,
67,
1828,
2548,
69,
535,
198,
2,
2343,
243,
253,
7280,
24,
68,
2857,
66,
4521,
68,
12,
16,
67,
2548,
12,
1157,
1765,
12,
15,
67,
3609,
12,
276,
1415,
64,
23,
66,
4846,
16,
324,
198,
2,
2343,
243,
254,
28670,
3459,
66,
2931,
38612,
12,
16,
67,
2718,
12,
1157,
1765,
12,
16,
65,
3829,
12,
24529,
67,
2998,
7568,
15,
66,
17,
198,
2,
2343,
243,
254,
28670,
68,
1878,
45385,
68,
15,
12,
16,
67,
2718,
12,
1157,
1765,
12,
24409,
68,
12,
66,
17457,
2078,
891,
5892,
66,
6814,
198,
2,
2343,
243,
254,
28670,
20,
3388,
47984,
2075,
12,
16,
67,
2548,
12,
1157,
1765,
12,
18,
64,
15,
65,
12,
3388,
3270,
1795,
4089,
19881,
22,
66,
198,
2,
2343,
243,
253,
7280,
2999,
891,
66,
39570,
12,
16,
67,
15,
68,
12,
1157,
1765,
12,
44698,
66,
12,
17,
69,
41561,
2934,
405,
3388,
68,
198
] | 1.808962 | 2,544 |
abstract type AbstractIterativeInversion end
struct ColumnarVortex{F,R,L,D,P}
ψ :: F
ϕ :: F
q :: F
x :: R
∂ :: R
b :: R
L :: L
domain :: D
params :: P
end
function ColumnarVortex(; domain, params)
ψ = new_field(domain)
ϕ = new_field(domain)
q = new_field(domain)
ρ = new_field(domain)
x = new_rhs(domain)
∂ = new_rhs(domain)
b = new_rhs(domain)
L = generate_∇²(domain)
return ColumnarVortex(ψ, ϕ, q, x, ∂, b, L, domain, params)
end
function initialize!(inv::ColumnarVortex, q′fun::Function, args...)
q′hfun = (x, y, z, args...) -> q′fun(x, y, NaN, args...)
q = inv.q
domain = inv.domain
params = inv.params
set_q!(q, domain, params, q′hfun, args...)
return inv
end
function solve!(inv::ColumnarVortex; verbose = false)
ψ = inv.ψ
ϕ = inv.ϕ
q = inv.q
x = inv.x
b = inv.b
∂ = inv.∂
L = inv.L
domain = inv.domain
params = inv.params
set_cv_∂ψ!(∂, domain, params)
set_cv_bψ!(b, q, domain)
@. b = b - ∂
idrs!(x, L, b; log = false, verbose = verbose)
field_from_rhs!(ψ, x, domain)
fill_ψ_halos!(ψ, domain, params)
set_cv_∂ϕ!(∂, domain, params)
set_cv_bϕ!(b, ψ, domain)
@. b = b - ∂
idrs!(x, L, b; log = false, verbose = verbose)
field_from_rhs!(ϕ, x, domain)
fill_ϕ_halos!(ϕ, domain, params)
return inv
end
function save_inversion_results(fname, inv::ColumnarVortex)
jldopen(fname, "w") do file
file["ψ"] = inv.ψ
file["ϕ"] = inv.ϕ
file["q"] = inv.q
file["domain"] = inv.domain
file["params"] = inv.params
end
end
struct LinearizedSparseInversion{F,R,S,LU,D,P}
ψ0 :: F
ϕ0 :: F
ψ′ :: F
ϕ′ :: F
q′ :: F
x :: R
b :: R
S :: S
LU :: LU
domain :: D
params :: P
end
function LinearizedSparseInversion(;
ψ0, ϕ0, domain, params, verbose = false
)
verbose && println("Allocating fields and RHS vectors")
ψ′, ϕ′, q′ = allocate_fields(domain)
x, b = allocate_linearized_rhs(domain)
fill_ψ_halos!(ψ0, domain, params)
fill_ϕ_halos!(ϕ0, domain, params)
verbose && println("Allocation complete")
verbose && println("Assembling sparse matrix operator")
S = generate_sparse_linearized_L(ψ0, ϕ0, domain)
verbose && println("Operator assembly complete")
verbose && print_sparse_statistics(S)
verbose && println("Computing LU decomposition")
LU = lu(S)
verbose && println("LU decomposition complete")
verbose && println("Lower triangular factor:")
verbose && print_sparse_statistics(LU.L)
verbose && println("Upper triangular factor:")
verbose && print_sparse_statistics(LU.U)
return LinearizedSparseInversion(
ψ0, ϕ0, ψ′, ϕ′, q′,
x, b, S, LU,
domain, params
)
end
function initialize!(inv::LinearizedSparseInversion, q′fun::Function, args...)
q′ = inv.q′
domain = inv.domain
params = inv.params
set_q′!(q′, domain, params, q′fun, args...)
return inv
end
function initialize!(inv::LinearizedSparseInversion, q′arr::AbstractArray)
@. inv.q′ = q′arr
return inv
end
function solve!(inv::LinearizedSparseInversion)
ϕ′ = inv.ϕ′
ψ′ = inv.ψ′
q′ = inv.q′
x = inv.x
b = inv.b
LU = inv.LU
domain = inv.domain
set_linearized_b!(b, q′, domain)
ldiv!(x, LU, b)
fields_from_linearized_rhs!(ϕ′, ψ′, x, domain)
fill_ψ′_halos!(ψ′, domain)
fill_ϕ′_halos!(ϕ′, domain)
return inv
end
function save_inversion_results(fname, inv::LinearizedSparseInversion)
jldopen(fname, "w") do file
file["ψ0"] = inv.ψ0
file["ϕ0"] = inv.ϕ0
file["ψ′"] = inv.ψ′
file["ϕ′"] = inv.ϕ′
file["q′"] = inv.q′
file["domain"] = inv.domain
file["params"] = inv.params
end
end
struct LinearizedInversion{F,R,L,D,P,T}
ψ0 :: F
ϕ0 :: F
ψ′ :: F
ϕ′ :: F
q′ :: F
x :: R
b :: R
L :: L
domain :: D
params :: P
atolϕ :: T
end
function LinearizedInversion(;
ψ0, ϕ0, domain, params, atolϕ = 1.0
)
ψ′, ϕ′, q′ = allocate_fields(domain)
x, b = allocate_linearized_rhs(domain)
L = generate_linearized_L(ψ0, ϕ0, domain; T = float_type(params))
fill_ψ_halos!(ψ0, domain, params)
fill_ϕ_halos!(ϕ0, domain, params)
atolϕ = atolϕ/(params.S*params.Π^2)
return LinearizedInversion(
ψ0, ϕ0, ψ′, ϕ′, q′,
x, b, L,
domain, params,
atolϕ
)
end
function initialize!(inv::LinearizedInversion, q′fun::Function, args...)
q′ = inv.q′
domain = inv.domain
params = inv.params
set_q′!(q′, domain, params, q′fun, args...)
return inv
end
function initialize!(inv::LinearizedInversion, q′arr::AbstractArray)
@. inv.q′ = q′arr
return inv
end
function solve!(inv::LinearizedInversion; Pl = IterativeSolvers.Identity(), verbose = false, use_atol = true)
ϕ′ = inv.ϕ′
ψ′ = inv.ψ′
q′ = inv.q′
x = inv.x
b = inv.b
L = inv.L
domain = inv.domain
set_linearized_b!(b, q′, domain)
atol = use_atol ? inv.atolϕ : zero(eltype(b))
idrs!(x, L, b; Pl = Pl, log = false, verbose = verbose, abstol = atol)
fields_from_linearized_rhs!(ϕ′, ψ′, x, domain)
fill_ψ′_halos!(ψ′, domain)
fill_ϕ′_halos!(ϕ′, domain)
return inv
end
function save_inversion_results(fname, inv::LinearizedInversion)
jldopen(fname, "w") do file
file["ψ0"] = inv.ψ0
file["ϕ0"] = inv.ϕ0
file["ψ′"] = inv.ψ′
file["ϕ′"] = inv.ϕ′
file["q′"] = inv.q′
file["domain"] = inv.domain
file["params"] = inv.params
end
end
struct NLInversion{F,R,LS,LG,D,P,S} <: AbstractIterativeInversion
ψ :: F
ϕ :: F
q :: F
xψ :: R
∂ψ :: R
bψ :: R
xϕ :: R
∂ϕ :: R
bϕ :: R
Lψ :: LS
Lϕ :: LG
domain :: D
params :: P
sψ :: S
sϕ :: S
end
function NLInversion(;
domain, params,
sψ = Solver(params; ω = 0.7),
sϕ = Solver(params; ω = 0.7)
)
ψ, ϕ, q = allocate_fields(domain)
xψ, ∂ψ, bψ, xϕ, ∂ϕ, bϕ = allocate_rhs(domain)
Lψ = generate_Lψ(ϕ, domain; T = float_type(params))
Lϕ = generate_Lϕ(ψ, domain; T = float_type(params))
return NLInversion(
ψ, ϕ, q,
xψ, ∂ψ, bψ,
xϕ, ∂ϕ, bϕ,
Lψ, Lϕ,
domain, params,
sψ, sϕ
)
end
function initialize!(inv::NLInversion, q′::Function, args...)
ψ = inv.ψ
ϕ = inv.ϕ
q = inv.q
domain = inv.domain
params = inv.params
set_background_ψ!(ψ, domain, params)
set_background_ϕ!(ϕ, domain, params)
set_q!(q, domain, params, q′, args...)
fill_ψ_halos!(ψ, domain, params)
fill_ϕ_halos!(ϕ, domain, params)
return inv
end
function initialize!(inv::NLInversion, ψi::AbstractArray, ϕi::AbstractArray, q′::Function, args...)
ψ = inv.ψ
ϕ = inv.ϕ
q = inv.q
domain = inv.domain
params = inv.params
@. ψ = ψi
@. ϕ = ϕi
set_q!(q, domain, params, q′, args...)
fill_ψ_halos!(ψ, domain, params)
fill_ϕ_halos!(ϕ, domain, params)
return inv
end
function iterate!(inv::NLInversion; verbose = false)
ψ = inv.ψ
ϕ = inv.ϕ
q = inv.q
xψ = inv.xψ
∂ψ = inv.∂ψ
bψ = inv.bψ
xϕ = inv.xϕ
∂ϕ = inv.∂ϕ
bϕ = inv.bϕ
Lψ = inv.Lψ
Lϕ = inv.Lϕ
domain = inv.domain
params = inv.params
sψ = inv.sψ
sϕ = inv.sϕ
set_∂ψ!(∂ψ, ϕ, domain, params)
set_bψ!(bψ, ψ, ϕ, q, domain)
@. bψ = bψ - ∂ψ
bicgstabl!(xψ, Lψ, bψ; log = false, verbose = false)
relax!(ψ, xψ, sψ, domain; verbose = verbose)
fill_ψ_halos!(ψ, domain, params)
set_∂ϕ!(∂ϕ, ψ, domain, params)
set_bϕ!(bϕ, ψ, ϕ, q, domain)
@. bϕ = bϕ - ∂ϕ
bicgstabl!(xϕ, Lϕ, bϕ; log = false, verbose = false)
relax!(ϕ, xϕ, sϕ, domain; verbose = verbose)
fill_ϕ_halos!(ϕ, domain, params)
return inv
end
function is_converged(inv::NLInversion)
return is_converged(inv.sψ) && is_converged(inv.sϕ)
end
function save_inversion_results(fname, inv::NLInversion)
is_converged(inv) || throw(ArgumentError("inv has not converged"))
jldopen(fname, "w") do file
file["ψ"] = inv.ψ
file["ϕ"] = inv.ϕ
file["q"] = inv.q
file["domain"] = inv.domain
file["params"] = inv.params
end
end | [
397,
8709,
2099,
27741,
29993,
876,
818,
9641,
886,
198,
198,
7249,
29201,
283,
53,
26158,
90,
37,
11,
49,
11,
43,
11,
35,
11,
47,
92,
198,
220,
220,
220,
18074,
230,
7904,
376,
198,
220,
220,
220,
18074,
243,
7904,
376,
198,
220,
220,
220,
10662,
7904,
376,
198,
220,
220,
220,
2124,
7904,
371,
198,
220,
220,
220,
18872,
224,
7904,
371,
198,
220,
220,
220,
275,
7904,
371,
198,
220,
220,
220,
406,
7904,
406,
198,
220,
220,
220,
7386,
7904,
360,
198,
220,
220,
220,
42287,
7904,
350,
198,
437,
198,
198,
8818,
29201,
283,
53,
26158,
7,
26,
7386,
11,
42287,
8,
198,
220,
220,
220,
18074,
230,
796,
649,
62,
3245,
7,
27830,
8,
198,
220,
220,
220,
18074,
243,
796,
649,
62,
3245,
7,
27830,
8,
198,
220,
220,
220,
10662,
796,
649,
62,
3245,
7,
27830,
8,
198,
220,
220,
220,
18074,
223,
796,
649,
62,
3245,
7,
27830,
8,
198,
220,
220,
220,
2124,
796,
649,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
18872,
224,
796,
649,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
275,
796,
649,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
406,
796,
7716,
62,
24861,
229,
31185,
7,
27830,
8,
198,
220,
220,
220,
1441,
29201,
283,
53,
26158,
7,
139,
230,
11,
18074,
243,
11,
10662,
11,
2124,
11,
18872,
224,
11,
275,
11,
406,
11,
7386,
11,
42287,
8,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
39470,
283,
53,
26158,
11,
10662,
17478,
12543,
3712,
22203,
11,
26498,
23029,
198,
220,
220,
220,
10662,
17478,
71,
12543,
796,
357,
87,
11,
331,
11,
1976,
11,
26498,
23029,
4613,
10662,
17478,
12543,
7,
87,
11,
331,
11,
11013,
45,
11,
26498,
23029,
198,
220,
220,
220,
10662,
796,
800,
13,
80,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
900,
62,
80,
0,
7,
80,
11,
7386,
11,
42287,
11,
10662,
17478,
71,
12543,
11,
26498,
23029,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
8494,
0,
7,
16340,
3712,
39470,
283,
53,
26158,
26,
15942,
577,
796,
3991,
8,
198,
220,
220,
220,
18074,
230,
796,
800,
13,
139,
230,
198,
220,
220,
220,
18074,
243,
796,
800,
13,
139,
243,
198,
220,
220,
220,
10662,
796,
800,
13,
80,
198,
220,
220,
220,
2124,
796,
800,
13,
87,
198,
220,
220,
220,
275,
796,
800,
13,
65,
198,
220,
220,
220,
18872,
224,
796,
800,
13,
24861,
224,
198,
220,
220,
220,
406,
796,
800,
13,
43,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
628,
220,
220,
220,
900,
62,
33967,
62,
24861,
224,
139,
230,
0,
7,
24861,
224,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
33967,
62,
65,
139,
230,
0,
7,
65,
11,
10662,
11,
7386,
8,
198,
220,
220,
220,
2488,
13,
275,
796,
275,
532,
18872,
224,
198,
220,
220,
220,
4686,
3808,
0,
7,
87,
11,
406,
11,
275,
26,
2604,
796,
3991,
11,
15942,
577,
796,
15942,
577,
8,
198,
220,
220,
220,
2214,
62,
6738,
62,
81,
11994,
0,
7,
139,
230,
11,
2124,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
11,
7386,
11,
42287,
8,
628,
220,
220,
220,
900,
62,
33967,
62,
24861,
224,
139,
243,
0,
7,
24861,
224,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
33967,
62,
65,
139,
243,
0,
7,
65,
11,
18074,
230,
11,
7386,
8,
198,
220,
220,
220,
2488,
13,
275,
796,
275,
532,
18872,
224,
198,
220,
220,
220,
4686,
3808,
0,
7,
87,
11,
406,
11,
275,
26,
2604,
796,
3991,
11,
15942,
577,
796,
15942,
577,
8,
198,
220,
220,
220,
2214,
62,
6738,
62,
81,
11994,
0,
7,
139,
243,
11,
2124,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
11,
7386,
11,
42287,
8,
628,
220,
220,
220,
1441,
800,
198,
198,
437,
198,
198,
8818,
3613,
62,
259,
9641,
62,
43420,
7,
69,
3672,
11,
800,
3712,
39470,
283,
53,
26158,
8,
198,
220,
220,
220,
474,
335,
9654,
7,
69,
3672,
11,
366,
86,
4943,
466,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
8973,
796,
220,
800,
13,
139,
230,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
8973,
796,
220,
800,
13,
139,
243,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
80,
8973,
796,
220,
800,
13,
80,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
27830,
8973,
796,
800,
13,
27830,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
37266,
8973,
796,
800,
13,
37266,
198,
220,
220,
220,
886,
198,
437,
198,
198,
7249,
44800,
1143,
50,
29572,
818,
9641,
90,
37,
11,
49,
11,
50,
11,
41596,
11,
35,
11,
47,
92,
198,
220,
220,
220,
18074,
230,
15,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
243,
15,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
230,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
243,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
10662,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
2124,
220,
7904,
371,
198,
220,
220,
220,
275,
220,
7904,
371,
198,
220,
220,
220,
311,
7904,
311,
198,
220,
220,
220,
50168,
7904,
50168,
198,
220,
220,
220,
7386,
7904,
360,
220,
198,
220,
220,
220,
42287,
7904,
350,
198,
437,
198,
198,
8818,
44800,
1143,
50,
29572,
818,
9641,
7,
26,
198,
220,
220,
220,
18074,
230,
15,
11,
18074,
243,
15,
11,
7386,
11,
42287,
11,
15942,
577,
796,
3991,
198,
8,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
3237,
27123,
7032,
290,
371,
7998,
30104,
4943,
198,
220,
220,
220,
18074,
230,
17478,
11,
18074,
243,
17478,
11,
10662,
17478,
796,
31935,
62,
25747,
7,
27830,
8,
198,
220,
220,
220,
2124,
11,
275,
796,
31935,
62,
29127,
1143,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
15,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
15,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
3237,
5040,
1844,
4943,
628,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
1722,
4428,
1359,
29877,
17593,
10088,
4943,
198,
220,
220,
220,
311,
796,
7716,
62,
82,
29572,
62,
29127,
1143,
62,
43,
7,
139,
230,
15,
11,
18074,
243,
15,
11,
7386,
8,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
18843,
1352,
10474,
1844,
4943,
198,
220,
220,
220,
15942,
577,
11405,
3601,
62,
82,
29572,
62,
14269,
3969,
7,
50,
8,
628,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
5377,
48074,
50168,
26969,
9150,
4943,
198,
220,
220,
220,
50168,
796,
300,
84,
7,
50,
8,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
41596,
26969,
9150,
1844,
4943,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
31426,
46963,
5766,
25,
4943,
198,
220,
220,
220,
15942,
577,
11405,
3601,
62,
82,
29572,
62,
14269,
3969,
7,
41596,
13,
43,
8,
198,
220,
220,
220,
15942,
577,
11405,
44872,
7203,
52,
2848,
46963,
5766,
25,
4943,
198,
220,
220,
220,
15942,
577,
11405,
3601,
62,
82,
29572,
62,
14269,
3969,
7,
41596,
13,
52,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
44800,
1143,
50,
29572,
818,
9641,
7,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
230,
15,
11,
18074,
243,
15,
11,
18074,
230,
17478,
11,
18074,
243,
17478,
11,
10662,
17478,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
11,
275,
11,
311,
11,
50168,
11,
198,
220,
220,
220,
220,
220,
220,
220,
7386,
11,
42287,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
14993,
451,
1143,
50,
29572,
818,
9641,
11,
10662,
17478,
12543,
3712,
22203,
11,
26498,
23029,
198,
220,
220,
220,
10662,
17478,
796,
800,
13,
80,
17478,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
900,
62,
80,
17478,
0,
7,
80,
17478,
11,
7386,
11,
42287,
11,
10662,
17478,
12543,
11,
26498,
23029,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
14993,
451,
1143,
50,
29572,
818,
9641,
11,
10662,
17478,
3258,
3712,
23839,
19182,
8,
198,
220,
220,
220,
2488,
13,
800,
13,
80,
17478,
796,
10662,
17478,
3258,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
8494,
0,
7,
16340,
3712,
14993,
451,
1143,
50,
29572,
818,
9641,
8,
198,
220,
220,
220,
18074,
243,
17478,
796,
800,
13,
139,
243,
17478,
198,
220,
220,
220,
18074,
230,
17478,
796,
800,
13,
139,
230,
17478,
198,
220,
220,
220,
10662,
17478,
796,
800,
13,
80,
17478,
198,
220,
220,
220,
2124,
796,
800,
13,
87,
198,
220,
220,
220,
275,
796,
800,
13,
65,
198,
220,
220,
220,
50168,
796,
800,
13,
41596,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
900,
62,
29127,
1143,
62,
65,
0,
7,
65,
11,
10662,
17478,
11,
7386,
8,
198,
220,
220,
220,
300,
7146,
0,
7,
87,
11,
50168,
11,
275,
8,
198,
220,
220,
220,
7032,
62,
6738,
62,
29127,
1143,
62,
81,
11994,
0,
7,
139,
243,
17478,
11,
18074,
230,
17478,
11,
2124,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
230,
17478,
62,
14201,
418,
0,
7,
139,
230,
17478,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
17478,
62,
14201,
418,
0,
7,
139,
243,
17478,
11,
7386,
8,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
3613,
62,
259,
9641,
62,
43420,
7,
69,
3672,
11,
800,
3712,
14993,
451,
1143,
50,
29572,
818,
9641,
8,
198,
220,
220,
220,
474,
335,
9654,
7,
69,
3672,
11,
366,
86,
4943,
466,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
15,
8973,
796,
220,
800,
13,
139,
230,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
15,
8973,
796,
220,
800,
13,
139,
243,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
17478,
8973,
796,
220,
800,
13,
139,
230,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
17478,
8973,
796,
220,
800,
13,
139,
243,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
80,
17478,
8973,
796,
220,
800,
13,
80,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
27830,
8973,
796,
800,
13,
27830,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
37266,
8973,
796,
800,
13,
37266,
198,
220,
220,
220,
886,
198,
437,
198,
198,
7249,
44800,
1143,
818,
9641,
90,
37,
11,
49,
11,
43,
11,
35,
11,
47,
11,
51,
92,
198,
220,
220,
220,
18074,
230,
15,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
243,
15,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
230,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
18074,
243,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
10662,
17478,
220,
220,
7904,
376,
198,
220,
220,
220,
2124,
220,
7904,
371,
198,
220,
220,
220,
275,
220,
7904,
371,
198,
220,
220,
220,
406,
7904,
406,
198,
220,
220,
220,
7386,
7904,
360,
220,
198,
220,
220,
220,
42287,
7904,
350,
198,
220,
220,
220,
379,
349,
139,
243,
7904,
309,
198,
437,
198,
198,
8818,
44800,
1143,
818,
9641,
7,
26,
198,
220,
220,
220,
18074,
230,
15,
11,
18074,
243,
15,
11,
7386,
11,
42287,
11,
379,
349,
139,
243,
796,
352,
13,
15,
198,
8,
198,
220,
220,
220,
18074,
230,
17478,
11,
18074,
243,
17478,
11,
10662,
17478,
796,
31935,
62,
25747,
7,
27830,
8,
198,
220,
220,
220,
2124,
11,
275,
796,
31935,
62,
29127,
1143,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
406,
796,
7716,
62,
29127,
1143,
62,
43,
7,
139,
230,
15,
11,
18074,
243,
15,
11,
7386,
26,
309,
796,
12178,
62,
4906,
7,
37266,
4008,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
15,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
15,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
379,
349,
139,
243,
796,
379,
349,
139,
243,
29006,
37266,
13,
50,
9,
37266,
13,
138,
254,
61,
17,
8,
198,
220,
220,
220,
1441,
44800,
1143,
818,
9641,
7,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
230,
15,
11,
18074,
243,
15,
11,
18074,
230,
17478,
11,
18074,
243,
17478,
11,
10662,
17478,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
11,
275,
11,
406,
11,
198,
220,
220,
220,
220,
220,
220,
220,
7386,
11,
42287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
379,
349,
139,
243,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
14993,
451,
1143,
818,
9641,
11,
10662,
17478,
12543,
3712,
22203,
11,
26498,
23029,
198,
220,
220,
220,
10662,
17478,
796,
800,
13,
80,
17478,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
900,
62,
80,
17478,
0,
7,
80,
17478,
11,
7386,
11,
42287,
11,
10662,
17478,
12543,
11,
26498,
23029,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
14993,
451,
1143,
818,
9641,
11,
10662,
17478,
3258,
3712,
23839,
19182,
8,
198,
220,
220,
220,
2488,
13,
800,
13,
80,
17478,
796,
10662,
17478,
3258,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
8494,
0,
7,
16340,
3712,
14993,
451,
1143,
818,
9641,
26,
1345,
796,
40806,
876,
36949,
690,
13,
7390,
26858,
22784,
15942,
577,
796,
3991,
11,
779,
62,
265,
349,
796,
2081,
8,
198,
220,
220,
220,
18074,
243,
17478,
796,
800,
13,
139,
243,
17478,
198,
220,
220,
220,
18074,
230,
17478,
796,
800,
13,
139,
230,
17478,
198,
220,
220,
220,
10662,
17478,
796,
800,
13,
80,
17478,
198,
220,
220,
220,
2124,
796,
800,
13,
87,
198,
220,
220,
220,
275,
796,
800,
13,
65,
198,
220,
220,
220,
406,
796,
800,
13,
43,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
900,
62,
29127,
1143,
62,
65,
0,
7,
65,
11,
10662,
17478,
11,
7386,
8,
198,
220,
220,
220,
379,
349,
796,
779,
62,
265,
349,
5633,
800,
13,
265,
349,
139,
243,
1058,
6632,
7,
417,
4906,
7,
65,
4008,
198,
220,
220,
220,
4686,
3808,
0,
7,
87,
11,
406,
11,
275,
26,
1345,
796,
1345,
11,
2604,
796,
3991,
11,
15942,
577,
796,
15942,
577,
11,
16552,
349,
796,
379,
349,
8,
198,
220,
220,
220,
7032,
62,
6738,
62,
29127,
1143,
62,
81,
11994,
0,
7,
139,
243,
17478,
11,
18074,
230,
17478,
11,
2124,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
230,
17478,
62,
14201,
418,
0,
7,
139,
230,
17478,
11,
7386,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
17478,
62,
14201,
418,
0,
7,
139,
243,
17478,
11,
7386,
8,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
3613,
62,
259,
9641,
62,
43420,
7,
69,
3672,
11,
800,
3712,
14993,
451,
1143,
818,
9641,
8,
198,
220,
220,
220,
474,
335,
9654,
7,
69,
3672,
11,
366,
86,
4943,
466,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
15,
8973,
796,
220,
800,
13,
139,
230,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
15,
8973,
796,
220,
800,
13,
139,
243,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
17478,
8973,
796,
220,
800,
13,
139,
230,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
17478,
8973,
796,
220,
800,
13,
139,
243,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
80,
17478,
8973,
796,
220,
800,
13,
80,
17478,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
27830,
8973,
796,
800,
13,
27830,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
37266,
8973,
796,
800,
13,
37266,
198,
220,
220,
220,
886,
198,
437,
198,
198,
7249,
22879,
818,
9641,
90,
37,
11,
49,
11,
6561,
11,
41257,
11,
35,
11,
47,
11,
50,
92,
1279,
25,
27741,
29993,
876,
818,
9641,
198,
220,
220,
220,
18074,
230,
7904,
376,
198,
220,
220,
220,
18074,
243,
7904,
376,
220,
198,
220,
220,
220,
10662,
7904,
376,
220,
198,
220,
220,
220,
2124,
139,
230,
7904,
371,
220,
198,
220,
220,
220,
18872,
224,
139,
230,
7904,
371,
220,
198,
220,
220,
220,
275,
139,
230,
7904,
371,
220,
198,
220,
220,
220,
2124,
139,
243,
7904,
371,
220,
198,
220,
220,
220,
18872,
224,
139,
243,
7904,
371,
220,
198,
220,
220,
220,
275,
139,
243,
7904,
371,
220,
198,
220,
220,
220,
406,
139,
230,
7904,
30948,
220,
198,
220,
220,
220,
406,
139,
243,
7904,
17370,
198,
220,
220,
220,
7386,
7904,
360,
220,
198,
220,
220,
220,
42287,
7904,
350,
198,
220,
220,
220,
264,
139,
230,
7904,
311,
198,
220,
220,
220,
264,
139,
243,
7904,
311,
198,
437,
198,
198,
8818,
22879,
818,
9641,
7,
26,
220,
198,
220,
220,
220,
7386,
11,
42287,
11,
220,
198,
220,
220,
220,
264,
139,
230,
796,
4294,
332,
7,
37266,
26,
18074,
231,
796,
657,
13,
22,
828,
198,
220,
220,
220,
264,
139,
243,
796,
4294,
332,
7,
37266,
26,
18074,
231,
796,
657,
13,
22,
8,
198,
8,
628,
220,
220,
220,
18074,
230,
11,
18074,
243,
11,
10662,
796,
31935,
62,
25747,
7,
27830,
8,
198,
220,
220,
220,
2124,
139,
230,
11,
18872,
224,
139,
230,
11,
275,
139,
230,
11,
2124,
139,
243,
11,
18872,
224,
139,
243,
11,
275,
139,
243,
796,
31935,
62,
81,
11994,
7,
27830,
8,
198,
220,
220,
220,
406,
139,
230,
796,
7716,
62,
43,
139,
230,
7,
139,
243,
11,
7386,
26,
309,
796,
12178,
62,
4906,
7,
37266,
4008,
198,
220,
220,
220,
406,
139,
243,
796,
7716,
62,
43,
139,
243,
7,
139,
230,
11,
7386,
26,
309,
796,
12178,
62,
4906,
7,
37266,
4008,
198,
220,
220,
220,
1441,
22879,
818,
9641,
7,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
230,
11,
18074,
243,
11,
10662,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
139,
230,
11,
18872,
224,
139,
230,
11,
275,
139,
230,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
139,
243,
11,
18872,
224,
139,
243,
11,
275,
139,
243,
11,
198,
220,
220,
220,
220,
220,
220,
220,
406,
139,
230,
11,
406,
139,
243,
11,
198,
220,
220,
220,
220,
220,
220,
220,
7386,
11,
42287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
139,
230,
11,
264,
139,
243,
198,
220,
220,
220,
1267,
198,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
32572,
818,
9641,
11,
10662,
17478,
3712,
22203,
11,
26498,
23029,
198,
220,
220,
220,
18074,
230,
796,
800,
13,
139,
230,
198,
220,
220,
220,
18074,
243,
796,
800,
13,
139,
243,
198,
220,
220,
220,
10662,
796,
800,
13,
80,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
900,
62,
25249,
62,
139,
230,
0,
7,
139,
230,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
25249,
62,
139,
243,
0,
7,
139,
243,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
80,
0,
7,
80,
11,
7386,
11,
42287,
11,
10662,
17478,
11,
26498,
23029,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
41216,
0,
7,
16340,
3712,
32572,
818,
9641,
11,
18074,
230,
72,
3712,
23839,
19182,
11,
18074,
243,
72,
3712,
23839,
19182,
11,
10662,
17478,
3712,
22203,
11,
26498,
23029,
198,
220,
220,
220,
18074,
230,
796,
800,
13,
139,
230,
198,
220,
220,
220,
18074,
243,
796,
800,
13,
139,
243,
198,
220,
220,
220,
10662,
796,
800,
13,
80,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
2488,
13,
18074,
230,
796,
18074,
230,
72,
198,
220,
220,
220,
2488,
13,
18074,
243,
796,
18074,
243,
72,
198,
220,
220,
220,
900,
62,
80,
0,
7,
80,
11,
7386,
11,
42287,
11,
10662,
17478,
11,
26498,
23029,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
1441,
800,
198,
437,
198,
198,
8818,
11629,
378,
0,
7,
16340,
3712,
32572,
818,
9641,
26,
15942,
577,
796,
3991,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
18074,
230,
796,
800,
13,
139,
230,
198,
220,
220,
220,
18074,
243,
796,
800,
13,
139,
243,
198,
220,
220,
220,
10662,
796,
800,
13,
80,
198,
220,
220,
220,
2124,
139,
230,
796,
800,
13,
87,
139,
230,
198,
220,
220,
220,
18872,
224,
139,
230,
796,
800,
13,
24861,
224,
139,
230,
198,
220,
220,
220,
275,
139,
230,
796,
800,
13,
65,
139,
230,
198,
220,
220,
220,
2124,
139,
243,
796,
800,
13,
87,
139,
243,
198,
220,
220,
220,
18872,
224,
139,
243,
796,
800,
13,
24861,
224,
139,
243,
198,
220,
220,
220,
275,
139,
243,
796,
800,
13,
65,
139,
243,
198,
220,
220,
220,
406,
139,
230,
796,
800,
13,
43,
139,
230,
198,
220,
220,
220,
406,
139,
243,
796,
800,
13,
43,
139,
243,
198,
220,
220,
220,
7386,
796,
800,
13,
27830,
198,
220,
220,
220,
42287,
796,
800,
13,
37266,
198,
220,
220,
220,
264,
139,
230,
796,
800,
13,
82,
139,
230,
198,
220,
220,
220,
264,
139,
243,
796,
800,
13,
82,
139,
243,
628,
220,
220,
220,
900,
62,
24861,
224,
139,
230,
0,
7,
24861,
224,
139,
230,
11,
18074,
243,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
65,
139,
230,
0,
7,
65,
139,
230,
11,
18074,
230,
11,
18074,
243,
11,
10662,
11,
7386,
8,
198,
220,
220,
220,
2488,
13,
275,
139,
230,
796,
275,
139,
230,
532,
18872,
224,
139,
230,
198,
220,
220,
220,
275,
291,
70,
301,
23117,
0,
7,
87,
139,
230,
11,
406,
139,
230,
11,
275,
139,
230,
26,
2604,
796,
3991,
11,
15942,
577,
796,
3991,
8,
198,
220,
220,
220,
8960,
0,
7,
139,
230,
11,
2124,
139,
230,
11,
264,
139,
230,
11,
7386,
26,
15942,
577,
796,
15942,
577,
8,
198,
220,
220,
220,
6070,
62,
139,
230,
62,
14201,
418,
0,
7,
139,
230,
11,
7386,
11,
42287,
8,
628,
220,
220,
220,
900,
62,
24861,
224,
139,
243,
0,
7,
24861,
224,
139,
243,
11,
18074,
230,
11,
7386,
11,
42287,
8,
198,
220,
220,
220,
900,
62,
65,
139,
243,
0,
7,
65,
139,
243,
11,
18074,
230,
11,
18074,
243,
11,
10662,
11,
7386,
8,
198,
220,
220,
220,
2488,
13,
275,
139,
243,
796,
275,
139,
243,
532,
18872,
224,
139,
243,
198,
220,
220,
220,
275,
291,
70,
301,
23117,
0,
7,
87,
139,
243,
11,
406,
139,
243,
11,
275,
139,
243,
26,
2604,
796,
3991,
11,
15942,
577,
796,
3991,
8,
198,
220,
220,
220,
8960,
0,
7,
139,
243,
11,
2124,
139,
243,
11,
264,
139,
243,
11,
7386,
26,
15942,
577,
796,
15942,
577,
8,
198,
220,
220,
220,
6070,
62,
139,
243,
62,
14201,
418,
0,
7,
139,
243,
11,
7386,
11,
42287,
8,
628,
220,
220,
220,
1441,
800,
198,
198,
437,
198,
198,
8818,
318,
62,
1102,
332,
2004,
7,
16340,
3712,
32572,
818,
9641,
8,
198,
220,
220,
220,
1441,
318,
62,
1102,
332,
2004,
7,
16340,
13,
82,
139,
230,
8,
11405,
318,
62,
1102,
332,
2004,
7,
16340,
13,
82,
139,
243,
8,
198,
437,
198,
198,
8818,
3613,
62,
259,
9641,
62,
43420,
7,
69,
3672,
11,
800,
3712,
32572,
818,
9641,
8,
198,
220,
220,
220,
318,
62,
1102,
332,
2004,
7,
16340,
8,
8614,
3714,
7,
28100,
1713,
12331,
7203,
16340,
468,
407,
6718,
2004,
48774,
198,
220,
220,
220,
474,
335,
9654,
7,
69,
3672,
11,
366,
86,
4943,
466,
2393,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
230,
8973,
796,
220,
800,
13,
139,
230,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
139,
243,
8973,
796,
220,
800,
13,
139,
243,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
80,
8973,
796,
220,
800,
13,
80,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
27830,
8973,
796,
800,
13,
27830,
198,
220,
220,
220,
220,
220,
220,
220,
2393,
14692,
37266,
8973,
796,
800,
13,
37266,
198,
220,
220,
220,
886,
198,
437
] | 1.938194 | 4,320 |
println("\n\n\nStarting runtests.jl $(join(ARGS, " ")) ...")
using Tests
using KShiftsClustering
getdata(n) = 10*rand(1, n) .+ 0.5
centers = kshifts(getdata(1_000_000), 10)
@test all(round.(Int, sort(vec(centers))) .== collect(1:10))
centers = kshifts(getdata(1000), 10)
for i = 1:100
kshifts!(centers, getdata(1000))
end
@test all(round.(Int, sort(vec(centers))) .== collect(1:10))
| [
35235,
7203,
59,
77,
59,
77,
59,
77,
22851,
1057,
41989,
13,
20362,
29568,
22179,
7,
1503,
14313,
11,
366,
366,
4008,
35713,
8,
198,
198,
3500,
30307,
198,
3500,
509,
2484,
19265,
2601,
436,
1586,
198,
198,
1136,
7890,
7,
77,
8,
796,
838,
9,
25192,
7,
16,
11,
299,
8,
764,
10,
657,
13,
20,
198,
198,
1087,
364,
796,
479,
1477,
19265,
7,
1136,
7890,
7,
16,
62,
830,
62,
830,
828,
838,
8,
198,
31,
9288,
477,
7,
744,
12195,
5317,
11,
3297,
7,
35138,
7,
1087,
364,
22305,
220,
764,
855,
220,
2824,
7,
16,
25,
940,
4008,
198,
198,
1087,
364,
796,
479,
1477,
19265,
7,
1136,
7890,
7,
12825,
828,
838,
8,
198,
1640,
1312,
796,
352,
25,
3064,
198,
220,
220,
220,
479,
1477,
19265,
0,
7,
1087,
364,
11,
651,
7890,
7,
12825,
4008,
198,
437,
198,
31,
9288,
477,
7,
744,
12195,
5317,
11,
3297,
7,
35138,
7,
1087,
364,
22305,
220,
764,
855,
220,
2824,
7,
16,
25,
940,
4008,
628
] | 2.302326 | 172 |
include("bike-attributes.jl")
mutable struct Bike
bike_attributes :: BikeAttributes
x_position :: Int
y_position :: Int
end | [
17256,
7203,
32256,
12,
1078,
7657,
13,
20362,
4943,
198,
198,
76,
18187,
2878,
26397,
220,
198,
220,
220,
220,
220,
198,
220,
220,
220,
7161,
62,
1078,
7657,
7904,
26397,
29021,
198,
220,
220,
220,
2124,
62,
9150,
7904,
2558,
198,
220,
220,
220,
331,
62,
9150,
7904,
2558,
198,
198,
437
] | 2.698113 | 53 |
@testset "correctname" begin
# not very complete. Need better way to test
@test LPWriter.correctname(repeat("x", 17)) == repeat("x", 16)
@test LPWriter.correctname(".x") == "x"
@test LPWriter.correctname("0x") == "x"
@test LPWriter.correctname("x^") == "x"
@test LPWriter.correctname("x*ds") == "xds"
@test LPWriter.correctname("x*ds[1]") == "xds1"
@test LPWriter.correctname("ex*ds[1]") == "xds1"
@test LPWriter.correctname("Ex*ds[1]") == "xds1"
end
@testset "verifyname" begin
# not very complete. Need better way to test
@test LPWriter.verifyname("x")
@test LPWriter.verifyname(repeat("x", 16))
@test LPWriter.verifyname(repeat("x", 17)) == false
@test LPWriter.verifyname(".x") == false
@test LPWriter.verifyname("0x") == false
@test LPWriter.verifyname("exe") == false
@test LPWriter.verifyname("ExE") == false
@test LPWriter.verifyname("x^") == false
@test LPWriter.verifyname("x*ds") == false
end
@testset "print_objective!" begin
io = IOBuffer()
LPWriter.print_objective!(io, [0, 1, -2.3, 4e3], ["A", "B", "C", "x"])
@test String(take!(io)) == "obj: 1 B - 2.3 C + 4e3 x\n"
close(io)
end
@testset "print_variable_coefficient!" begin
io = IOBuffer()
LPWriter.print_variable_coefficient!(io, -1.3, "x", true)
@test String(take!(io)) == "-1.3 x"
LPWriter.print_variable_coefficient!(io, 1.3, "x", true)
@test String(take!(io)) == "1.3 x"
LPWriter.print_variable_coefficient!(io, -1.3, "x", false)
@test String(take!(io)) == " - 1.3 x"
LPWriter.print_variable_coefficient!(io, 1.3, "x", false)
@test String(take!(io)) == " + 1.3 x"
close(io)
end
@testset "getrowsense" begin
# LE, GE, Eq, Ranged
row_sense, hasranged = LPWriter.getrowsense([-Inf, 0.], [0., Inf])
@test row_sense == [:(<=), :(>=)]
@test hasranged == false
row_sense, hasranged = LPWriter.getrowsense([1., -1.], [1., 1.])
@test row_sense == [:(==), :ranged]
@test hasranged == true
@test_throws Exception LPWriter.getrowsense([1.], [1., 1.])
@test_throws Exception LPWriter.getrowsense([-Inf], [Inf])
end
@testset "print_constraints!" begin
io = IOBuffer()
LPWriter.print_constraints!(io, [1 -1], [-Inf], [1.0], ["x", "y"], ["r1"])
@test String(take!(io)) == "Subject To\nr1: 1 x - 1 y <= 1.0\n"
LPWriter.print_constraints!(io, [1 0 -1], [-1.2], [Inf], ["x", "z", "y"], ["r1"])
@test String(take!(io)) == "Subject To\nr1: 1 x - 1 y >= -1.2\n"
@test_throws Exception LPWriter.print_constraints!(io, [1 -1], [-1.2], [1], ["x", "y"], ["r1"])
close(io)
end
@testset "print_bounds!" begin
io = IOBuffer()
LPWriter.print_bounds!(io, [-Inf, -Inf, -1, -1, 0, 1], [Inf, 2, Inf, 3, Inf, Inf], ["A", "B", "C", "D", "E", "F"])
@test String(take!(io)) == "Bounds\nA free\n-inf <= B <= 2\n-1 <= C <= +inf\n-1 <= D <= 3\n0 <= E <= +inf\n1 <= F <= +inf\n"
close(io)
end
@testset "print_category!" begin
io = IOBuffer()
@test_throws Exception LPWriter.print_category!(io, [:Cont, :SemiCont], ["A", "B"])
@test_throws Exception LPWriter.print_category!(io, [:Cont, :SemiInt], ["A", "B"])
LPWriter.print_category!(io, [:Cont, :Int], ["A", "B"])
@test String(take!(io)) == "General\nB\nBinary\n"
LPWriter.print_category!(io, [:Cont, :Bin], ["A", "B"])
@test String(take!(io)) == "General\nBinary\nB\n"
LPWriter.print_category!(io, [:Cont, :Bin, :Cont, :Int], ["A", "B", "C", "D"])
@test String(take!(io)) == "General\nD\nBinary\nB\n"
close(io)
end
@testset "print_sos!" begin
io = IOBuffer()
LPWriter.print_sos!(io, "csos1", (1, [1,2], [2.0, 4.0]), ["V1", "V2"])
@test String(take!(io)) == "csos1: S1:: V1:2 V2:4\n"
LPWriter.print_sos!(io, "anyname", (2, [2,3], [2.0, 4.0]), ["V1", "V2", "X"])
@test String(take!(io)) == "anyname: S2:: V2:2 X:4\n"
close(io)
end
@testset "write" begin
@testset "Quadratic Objectives" begin
io = IOBuffer()
@test_throws Exception LPWriter.write(io,
Array{Float64}(0,0), [], [], [], [], [], :Max, Symbol[],
LPWriter.SOS[], [1 0; 0 1])
close(io)
end
@testset "Bad sense" begin
io = IOBuffer()
@test_throws Exception LPWriter.write(io,
Array{Float64}(0,0), [], [], [], [], [], :maximum, Symbol[],
LPWriter.SOS[], Array{Float64}(0,0))
close(io)
end
# @testset "Special Ordered Sets" begin
# io = IOBuffer()
# @test_throws Exception LPWriter.write(io,
# Array{Float64}(0,0), [], [], [], [], [], :Max, Symbol[],
# LPWriter.SOS[LPWriter.SOS(2, [5,6,7], [1,2,3])], Array{Float64}(0,0))
# close(io)
# end
@testset "write" begin
io = IOBuffer()
LPWriter.write(io,
[
1 0 0 0 0 0 0 0;
0 1 0 0 0 0 0 0;
0 0 1 0 0 0 0 0;
0 0 0 0 1 1 1 0
],
[-Inf, -Inf, -Inf, 5.5, 0, 0, 0, 0],
[3, 3, 3, Inf, 1, 1, 1, 1],
[0,0,0,-1,1,0,0,0],
[0, 2, -Inf, -Inf],
[Inf, Inf, 2.5, 1],
:Max,
[:Cont, :Cont, :Cont, :Int, :Cont, :Cont, :Cont, :Bin],
LPWriter.SOS[
(1, [1,3,5], [1.0, 2.0, 3.0]),
(2, [2,4,5], [2.0, 1.0, 2.5])
],
Array{Float64}(0,0),
"TestModel",
["V$i" for i in 1:8],
["CON$i" for i in 1:4]
)
MODEL1 = replace(readstring(joinpath(@__DIR__, "model1.lp")), "\r\n", "\n")
@test String(take!(io)) == MODEL1
close(io)
end
@testset "write2" begin
io = IOBuffer()
LPWriter.write(io,
[
1 0 0 0 0 0 0 0;
0 1 0 0 0 0 0 0;
0 0 1 0 0 0 0 0;
0 0 0 0 1 1 1 0
],
[-Inf, -Inf, -Inf, 5.5, 0, 0, 0, 0],
[3, 3, 3, Inf, 1, 1, 1, 1],
[0,0,0,-1,1,0,0,0],
[0, 2, -Inf, -Inf],
[Inf, Inf, 2.5, 1],
:Min,
[:Cont, :Cont, :Cont, :Int, :Cont, :Cont, :Cont, :Bin],
LPWriter.SOS[],
Array{Float64}(0,0),
"TestModel",
["V[$(i)]" for i in 1:8],
["$(i)CON$i" for i in 1:4]
)
MODEL2 = replace(readstring(joinpath(@__DIR__, "model2.lp")), "\r\n", "\n")
@test String(take!(io)) == MODEL2
close(io)
end
end
| [
31,
9288,
2617,
366,
30283,
3672,
1,
2221,
198,
220,
220,
220,
1303,
407,
845,
1844,
13,
10664,
1365,
835,
284,
1332,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7,
44754,
7203,
87,
1600,
1596,
4008,
6624,
9585,
7203,
87,
1600,
1467,
8,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7,
1911,
87,
4943,
6624,
366,
87,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
15,
87,
4943,
6624,
366,
87,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
87,
61,
4943,
6624,
366,
87,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
87,
9,
9310,
4943,
6624,
366,
87,
9310,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
87,
9,
9310,
58,
16,
60,
4943,
6624,
366,
87,
9310,
16,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
1069,
9,
9310,
58,
16,
60,
4943,
6624,
366,
87,
9310,
16,
1,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
30283,
3672,
7203,
3109,
9,
9310,
58,
16,
60,
4943,
6624,
366,
87,
9310,
16,
1,
198,
437,
198,
198,
31,
9288,
2617,
366,
332,
1958,
3672,
1,
2221,
198,
220,
220,
220,
1303,
407,
845,
1844,
13,
10664,
1365,
835,
284,
1332,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
87,
4943,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7,
44754,
7203,
87,
1600,
1467,
4008,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7,
44754,
7203,
87,
1600,
1596,
4008,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7,
1911,
87,
4943,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
15,
87,
4943,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
13499,
4943,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
3109,
36,
4943,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
87,
61,
4943,
6624,
3991,
198,
220,
220,
220,
2488,
9288,
18470,
34379,
13,
332,
1958,
3672,
7203,
87,
9,
9310,
4943,
6624,
3991,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
15252,
425,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
15252,
425,
0,
7,
952,
11,
685,
15,
11,
352,
11,
532,
17,
13,
18,
11,
604,
68,
18,
4357,
14631,
32,
1600,
366,
33,
1600,
366,
34,
1600,
366,
87,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
26801,
25,
352,
347,
532,
362,
13,
18,
327,
1343,
604,
68,
18,
2124,
59,
77,
1,
628,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
45286,
62,
1073,
16814,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
45286,
62,
1073,
16814,
0,
7,
952,
11,
532,
16,
13,
18,
11,
366,
87,
1600,
2081,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
27444,
16,
13,
18,
2124,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
45286,
62,
1073,
16814,
0,
7,
952,
11,
352,
13,
18,
11,
366,
87,
1600,
2081,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
16,
13,
18,
2124,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
45286,
62,
1073,
16814,
0,
7,
952,
11,
532,
16,
13,
18,
11,
366,
87,
1600,
3991,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
532,
352,
13,
18,
2124,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
45286,
62,
1073,
16814,
0,
7,
952,
11,
352,
13,
18,
11,
366,
87,
1600,
3991,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
1343,
352,
13,
18,
2124,
1,
628,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
1136,
8516,
1072,
1,
2221,
198,
220,
220,
220,
1303,
12509,
11,
22319,
11,
412,
80,
11,
371,
5102,
198,
220,
220,
220,
5752,
62,
33819,
11,
468,
34457,
796,
18470,
34379,
13,
1136,
8516,
1072,
26933,
12,
18943,
11,
657,
13,
4357,
685,
15,
1539,
4806,
12962,
198,
220,
220,
220,
2488,
9288,
5752,
62,
33819,
6624,
685,
37498,
27,
28,
828,
36147,
29,
28,
15437,
198,
220,
220,
220,
2488,
9288,
468,
34457,
6624,
3991,
628,
220,
220,
220,
5752,
62,
33819,
11,
468,
34457,
796,
18470,
34379,
13,
1136,
8516,
1072,
26933,
16,
1539,
532,
16,
13,
4357,
685,
16,
1539,
352,
8183,
8,
198,
220,
220,
220,
2488,
9288,
5752,
62,
33819,
6624,
685,
37498,
855,
828,
1058,
34457,
60,
198,
220,
220,
220,
2488,
9288,
468,
34457,
6624,
2081,
628,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
1136,
8516,
1072,
26933,
16,
13,
4357,
685,
16,
1539,
352,
8183,
8,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
1136,
8516,
1072,
26933,
12,
18943,
4357,
685,
18943,
12962,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
1102,
2536,
6003,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
1102,
2536,
6003,
0,
7,
952,
11,
685,
16,
532,
16,
4357,
25915,
18943,
4357,
685,
16,
13,
15,
4357,
14631,
87,
1600,
366,
88,
33116,
14631,
81,
16,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
19776,
1675,
59,
48624,
16,
25,
352,
2124,
532,
352,
331,
19841,
352,
13,
15,
59,
77,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
1102,
2536,
6003,
0,
7,
952,
11,
685,
16,
657,
532,
16,
4357,
25915,
16,
13,
17,
4357,
685,
18943,
4357,
14631,
87,
1600,
366,
89,
1600,
366,
88,
33116,
14631,
81,
16,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
19776,
1675,
59,
48624,
16,
25,
352,
2124,
532,
352,
331,
18189,
532,
16,
13,
17,
59,
77,
1,
628,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
4798,
62,
1102,
2536,
6003,
0,
7,
952,
11,
685,
16,
532,
16,
4357,
25915,
16,
13,
17,
4357,
685,
16,
4357,
14631,
87,
1600,
366,
88,
33116,
14631,
81,
16,
8973,
8,
628,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
65,
3733,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
65,
3733,
0,
7,
952,
11,
25915,
18943,
11,
532,
18943,
11,
532,
16,
11,
532,
16,
11,
657,
11,
352,
4357,
685,
18943,
11,
362,
11,
4806,
11,
513,
11,
4806,
11,
4806,
4357,
14631,
32,
1600,
366,
33,
1600,
366,
34,
1600,
366,
35,
1600,
366,
36,
1600,
366,
37,
8973,
8,
628,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
33,
3733,
59,
77,
32,
1479,
59,
77,
12,
10745,
19841,
347,
19841,
362,
59,
77,
12,
16,
19841,
327,
19841,
1343,
10745,
59,
77,
12,
16,
19841,
360,
19841,
513,
59,
77,
15,
19841,
412,
19841,
1343,
10745,
59,
77,
16,
19841,
376,
19841,
1343,
10745,
59,
77,
1,
628,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
22872,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
628,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
4798,
62,
22872,
0,
7,
952,
11,
685,
25,
4264,
11,
1058,
13900,
72,
4264,
4357,
14631,
32,
1600,
366,
33,
8973,
8,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
4798,
62,
22872,
0,
7,
952,
11,
685,
25,
4264,
11,
1058,
13900,
72,
5317,
4357,
14631,
32,
1600,
366,
33,
8973,
8,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
22872,
0,
7,
952,
11,
685,
25,
4264,
11,
1058,
5317,
4357,
14631,
32,
1600,
366,
33,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
12218,
59,
77,
33,
59,
77,
33,
3219,
59,
77,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
22872,
0,
7,
952,
11,
685,
25,
4264,
11,
1058,
33,
259,
4357,
14631,
32,
1600,
366,
33,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
12218,
59,
77,
33,
3219,
59,
77,
33,
59,
77,
1,
628,
220,
220,
220,
18470,
34379,
13,
4798,
62,
22872,
0,
7,
952,
11,
685,
25,
4264,
11,
1058,
33,
259,
11,
1058,
4264,
11,
1058,
5317,
4357,
14631,
32,
1600,
366,
33,
1600,
366,
34,
1600,
366,
35,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
12218,
59,
77,
35,
59,
77,
33,
3219,
59,
77,
33,
59,
77,
1,
628,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4798,
62,
82,
418,
2474,
2221,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
18470,
34379,
13,
4798,
62,
82,
418,
0,
7,
952,
11,
366,
6359,
418,
16,
1600,
357,
16,
11,
685,
16,
11,
17,
4357,
685,
17,
13,
15,
11,
604,
13,
15,
46570,
14631,
53,
16,
1600,
366,
53,
17,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
6359,
418,
16,
25,
311,
16,
3712,
569,
16,
25,
17,
569,
17,
25,
19,
59,
77,
1,
198,
220,
220,
220,
18470,
34379,
13,
4798,
62,
82,
418,
0,
7,
952,
11,
366,
1092,
3672,
1600,
357,
17,
11,
685,
17,
11,
18,
4357,
685,
17,
13,
15,
11,
604,
13,
15,
46570,
14631,
53,
16,
1600,
366,
53,
17,
1600,
366,
55,
8973,
8,
198,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
366,
1092,
3672,
25,
311,
17,
3712,
569,
17,
25,
17,
1395,
25,
19,
59,
77,
1,
198,
220,
220,
220,
1969,
7,
952,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
13564,
1,
2221,
628,
220,
220,
220,
2488,
9288,
2617,
366,
4507,
41909,
1512,
9515,
1083,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
13564,
7,
952,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
828,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
1058,
11518,
11,
38357,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
50,
2640,
58,
4357,
685,
16,
657,
26,
657,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1969,
7,
952,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
22069,
2565,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
13564,
7,
952,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
828,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
1058,
47033,
11,
38357,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
50,
2640,
58,
4357,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1969,
7,
952,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
2488,
9288,
2617,
366,
13409,
14230,
1068,
21394,
1,
2221,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
35528,
18470,
34379,
13,
13564,
7,
952,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
828,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
685,
4357,
1058,
11518,
11,
38357,
58,
4357,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
50,
2640,
58,
19930,
34379,
13,
50,
2640,
7,
17,
11,
685,
20,
11,
21,
11,
22,
4357,
685,
16,
11,
17,
11,
18,
12962,
4357,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
4008,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
1969,
7,
952,
8,
198,
220,
220,
220,
1303,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
13564,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
13564,
7,
952,
11,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
657,
657,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
352,
657,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
657,
352,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
657,
657,
657,
352,
352,
352,
657,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
25915,
18943,
11,
532,
18943,
11,
532,
18943,
11,
642,
13,
20,
11,
657,
11,
657,
11,
657,
11,
657,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
18,
11,
513,
11,
513,
11,
4806,
11,
352,
11,
352,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
15,
11,
15,
12095,
16,
11,
16,
11,
15,
11,
15,
11,
15,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
362,
11,
532,
18943,
11,
532,
18943,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
18943,
11,
4806,
11,
362,
13,
20,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
11518,
11,
198,
220,
220,
220,
220,
220,
220,
220,
685,
25,
4264,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
5317,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
33,
259,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
50,
2640,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
16,
11,
685,
16,
11,
18,
11,
20,
4357,
685,
16,
13,
15,
11,
362,
13,
15,
11,
513,
13,
15,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
17,
11,
685,
17,
11,
19,
11,
20,
4357,
685,
17,
13,
15,
11,
352,
13,
15,
11,
362,
13,
20,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
828,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
17633,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
14631,
53,
3,
72,
1,
329,
1312,
287,
352,
25,
23,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
14631,
10943,
3,
72,
1,
329,
1312,
287,
352,
25,
19,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
19164,
3698,
16,
796,
6330,
7,
961,
8841,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
19849,
16,
13,
34431,
4943,
828,
37082,
81,
59,
77,
1600,
37082,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
19164,
3698,
16,
198,
220,
220,
220,
220,
220,
220,
220,
1969,
7,
952,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
13564,
17,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
13564,
7,
952,
11,
198,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
657,
657,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
352,
657,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
657,
352,
657,
657,
657,
657,
657,
26,
198,
220,
220,
220,
220,
220,
220,
220,
657,
657,
657,
657,
352,
352,
352,
657,
198,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
25915,
18943,
11,
532,
18943,
11,
532,
18943,
11,
642,
13,
20,
11,
657,
11,
657,
11,
657,
11,
657,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
18,
11,
513,
11,
513,
11,
4806,
11,
352,
11,
352,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
15,
11,
15,
12095,
16,
11,
16,
11,
15,
11,
15,
11,
15,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
15,
11,
362,
11,
532,
18943,
11,
532,
18943,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
685,
18943,
11,
4806,
11,
362,
13,
20,
11,
352,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
9452,
11,
198,
220,
220,
220,
220,
220,
220,
220,
685,
25,
4264,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
5317,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
4264,
11,
1058,
33,
259,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
18470,
34379,
13,
50,
2640,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
43879,
2414,
92,
7,
15,
11,
15,
828,
198,
220,
220,
220,
220,
220,
220,
220,
366,
14402,
17633,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
14631,
53,
58,
3,
7,
72,
15437,
1,
329,
1312,
287,
352,
25,
23,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
14631,
3,
7,
72,
8,
10943,
3,
72,
1,
329,
1312,
287,
352,
25,
19,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
19164,
3698,
17,
796,
6330,
7,
961,
8841,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
19849,
17,
13,
34431,
4943,
828,
37082,
81,
59,
77,
1600,
37082,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
10903,
7,
20657,
0,
7,
952,
4008,
6624,
19164,
3698,
17,
198,
220,
220,
220,
220,
220,
220,
220,
1969,
7,
952,
8,
198,
220,
220,
220,
886,
198,
198,
437,
198
] | 1.972309 | 3,214 |
# Sample script for plotting fieldlines with handpicked seeds, multi-processing version.
#
# To run on a single node,
# julia -p $ncores demo_fieldline_mp_pyplot.jl
#
# Hongyang Zhou, hyzhou@umich.edu
using Distributed, ParallelDataTransfer, Glob
@everywhere using Vlasiator, PyPlot, PyCall, Printf, LaTeXStrings, FieldTracer
@everywhere using Vlasiator: RE
function generate_seeds(coordmin, coordmax, dim_, nseeds)
seeds = Matrix{Float64}(undef, 2, nseeds)
for i in 1:nseeds
seeds[1,i] = coordmin[dim_[1]] +
(coordmax[dim_[1]] - coordmin[dim_[1]]) / nseeds * (i - 1)
seeds[2,i] = -20RE
end
seeds
end
@everywhere function init_figure(pArgs, norm, ticks, seeds, extent)
fig, ax = plt.subplots(1, 1; num=myid(),
figsize=(6, 8), constrained_layout=true)
fontsize = "x-large"
ax.set_aspect("equal")
# Set border line widths
for loc in ("left", "bottom", "right", "top")
edge = get(ax.spines, loc, nothing)
edge.set_linewidth(2.0)
end
ax.xaxis.set_tick_params(width=2.0, length=3)
ax.yaxis.set_tick_params(width=2.0, length=3)
ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator())
ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator())
ax.set_xlabel(pArgs.strx; fontsize)
ax.set_ylabel(pArgs.stry; fontsize)
ax.set_title("Density"; fontsize)
x1, x2 = Vlasiator.get_axis(pArgs)
range1 = searchsortedfirst(x1, extent[1]):searchsortedlast(x1, extent[2])
range2 = searchsortedfirst(x2, extent[3]):searchsortedlast(x2, extent[4])
fakedata = zeros(Float32, length(range2), length(range1))
c = ax.pcolormesh(x1[range1], x2[range2], fakedata; norm, cmap=matplotlib.cm.turbo)
format = matplotlib.ticker.FormatStrFormatter("%.1f")
cb1 = colorbar(c; ax, ticks, format)
cb1.ax.set_ylabel("[amu/cc]"; fontsize)
cb1.outline.set_linewidth(1.0)
fakeline = [0.0, 1.0]
ls = [ax.plot(fakeline, fakeline, color="w") for _ in 1:size(seeds,2)]
return fig, ax, c, ls, range1, range2
end
@everywhere function update_plot!(ax, c, ls, range1, range2, dim_, seeds, grid1, grid2,
outdir, file)
isfile(outdir*file[end-8:end-5]*".png") && return
println("file = $file")
meta = load(file)
data = Vlasiator.prep2d(meta, "proton/vg_rho", :mag)'
c.set_array(data[range2,range1] ./ 1f6)
str_title = @sprintf "Density pulse run, t= %4.1fs" meta.time
ax.set_title(str_title; fontsize="x-large")
b = meta["vg_b_vol"]
b1 = reshape(b[dim_[1],:], meta.ncells[dim_[1]], meta.ncells[dim_[2]])
b2 = reshape(b[dim_[2],:], meta.ncells[dim_[1]], meta.ncells[dim_[2]])
# Find existing arrow annotations
annotations = [child for child in ax.get_children() if
pybuiltin(:isinstance)(child, matplotlib.text.Annotation)]
# Remove existing arrows
for a in annotations
a.remove()
end
# Add new arrows along field lines
for i in axes(seeds,2)
startx, starty = seeds[:,i]
x1, y1 = trace(b1, b2, startx, starty, grid1, grid2;
ds=0.5, maxstep=4000, gridtype="ndgrid")
x1 ./= RE
y1 ./= RE
if length(x1) < 5; continue; end
ls[i][1].set_xdata(x1)
ls[i][1].set_ydata(y1)
add_arrow(ls[i][1])
end
savefig(outdir*file[end-8:end-5]*".png", bbox_inches="tight")
end
function make_jobs(files)
for f in files
put!(jobs, f)
end
end
@everywhere function do_work(jobs, status,
outdir, pArgs, norm, ticks, grid1, grid2, dim_, seeds, extent)
fig, ax, c, ls, range1, range2 = init_figure(pArgs, norm, ticks, seeds, extent)
while true
file = take!(jobs)
update_plot!(ax, c, ls, range1, range2, dim_, seeds, grid1, grid2, outdir, file)
put!(status, true)
end
close(fig)
end
############################################################################################
files = glob("bulk*.vlsv", ".")
nfile = length(files)
# Set output directory
outdir = "out/"
const jobs = RemoteChannel(()->Channel{String}(nfile))
const status = RemoteChannel(()->Channel{Bool}(nworkers()))
axisunit = EARTH # contour plot axes unit
extent = [0., 20., -20., 20.] # [RE], default full domain: [-Inf32, Inf32, -Inf32, Inf32]
# Upper/lower limits for each variable
ρmin, ρmax = 0.0, 11.0 # [amu/cc]
meta = load(files[1])
# Construct pieces for plotting
pArgs = Vlasiator.set_args(meta, "proton/vg_rho", axisunit; normal=:none)
norm, ticks = Vlasiator.set_colorbar(Linear, ρmin, ρmax)
# Mark spatial dimensions
dim_ = pArgs.stry[1] == 'Z' ? (1,3) : (1,2)
(;coordmin, coordmax, ncells) = meta
# Generate regular Cartesian range
grid1 = range(coordmin[dim_[1]], coordmax[dim_[1]], length=ncells[dim_[1]])
grid2 = range(coordmin[dim_[2]], coordmax[dim_[2]], length=ncells[dim_[2]])
# Generate seeds for in-plane field line tracing
nseeds = 10
seeds = generate_seeds(coordmin, coordmax, dim_, nseeds)
println("Total number of files: $nfile")
println("Running with $(nworkers()) workers...")
@async make_jobs(files) # Feed the jobs channel with all files to process.
@sync for p in workers()
@async remote_do(do_work, p, jobs, status,
outdir, pArgs, norm, ticks, grid1, grid2, dim_, seeds, extent)
end
let n = nfile
t = @elapsed while n > 0 # wait for all jobs to complete
take!(status)
n -= 1
end
println("Finished in $(round(t, digits=2))s.")
end | [
2,
27565,
4226,
329,
29353,
2214,
6615,
351,
1021,
41891,
11904,
11,
5021,
12,
36948,
2196,
13,
198,
2,
198,
2,
1675,
1057,
319,
257,
2060,
10139,
11,
198,
2,
474,
43640,
532,
79,
720,
10782,
2850,
13605,
62,
3245,
1370,
62,
3149,
62,
9078,
29487,
13,
20362,
198,
2,
198,
2,
9764,
17859,
32222,
11,
2537,
38536,
31,
388,
488,
13,
15532,
198,
198,
3500,
4307,
6169,
11,
42945,
6601,
43260,
11,
40713,
198,
31,
16833,
3003,
1262,
569,
75,
17053,
1352,
11,
9485,
43328,
11,
9485,
14134,
11,
12578,
69,
11,
4689,
49568,
13290,
654,
11,
7663,
2898,
11736,
198,
31,
16833,
3003,
1262,
569,
75,
17053,
1352,
25,
4526,
198,
198,
8818,
7716,
62,
325,
5379,
7,
37652,
1084,
11,
6349,
9806,
11,
5391,
62,
11,
299,
325,
5379,
8,
198,
220,
220,
11904,
796,
24936,
90,
43879,
2414,
92,
7,
917,
891,
11,
362,
11,
299,
325,
5379,
8,
198,
220,
220,
329,
1312,
287,
352,
25,
77,
325,
5379,
198,
220,
220,
220,
220,
220,
11904,
58,
16,
11,
72,
60,
796,
6349,
1084,
58,
27740,
62,
58,
16,
11907,
1343,
198,
220,
220,
220,
220,
220,
220,
220,
220,
357,
37652,
9806,
58,
27740,
62,
58,
16,
11907,
532,
6349,
1084,
58,
27740,
62,
58,
16,
11907,
8,
1220,
299,
325,
5379,
1635,
357,
72,
532,
352,
8,
198,
220,
220,
220,
220,
220,
11904,
58,
17,
11,
72,
60,
796,
532,
1238,
2200,
198,
220,
220,
886,
198,
220,
220,
11904,
198,
437,
198,
198,
31,
16833,
3003,
2163,
2315,
62,
26875,
7,
79,
42035,
11,
2593,
11,
36066,
11,
11904,
11,
6287,
8,
198,
220,
220,
2336,
11,
7877,
796,
458,
83,
13,
7266,
489,
1747,
7,
16,
11,
352,
26,
997,
28,
1820,
312,
22784,
198,
220,
220,
220,
220,
220,
2336,
7857,
16193,
21,
11,
807,
828,
31070,
62,
39786,
28,
7942,
8,
628,
220,
220,
10369,
7857,
796,
366,
87,
12,
11664,
1,
628,
220,
220,
7877,
13,
2617,
62,
292,
806,
7203,
40496,
4943,
198,
220,
220,
1303,
5345,
4865,
1627,
9647,
82,
198,
220,
220,
329,
1179,
287,
5855,
9464,
1600,
366,
22487,
1600,
366,
3506,
1600,
366,
4852,
4943,
198,
220,
220,
220,
220,
220,
5743,
796,
651,
7,
897,
13,
2777,
1127,
11,
1179,
11,
2147,
8,
198,
220,
220,
220,
220,
220,
5743,
13,
2617,
62,
2815,
413,
5649,
7,
17,
13,
15,
8,
198,
220,
220,
886,
198,
220,
220,
7877,
13,
87,
22704,
13,
2617,
62,
42298,
62,
37266,
7,
10394,
28,
17,
13,
15,
11,
4129,
28,
18,
8,
198,
220,
220,
7877,
13,
88,
22704,
13,
2617,
62,
42298,
62,
37266,
7,
10394,
28,
17,
13,
15,
11,
4129,
28,
18,
8,
198,
220,
220,
7877,
13,
87,
22704,
13,
2617,
62,
1084,
273,
62,
17946,
1352,
7,
6759,
29487,
8019,
13,
83,
15799,
13,
27722,
39825,
33711,
1352,
28955,
198,
220,
220,
7877,
13,
88,
22704,
13,
2617,
62,
1084,
273,
62,
17946,
1352,
7,
6759,
29487,
8019,
13,
83,
15799,
13,
27722,
39825,
33711,
1352,
28955,
628,
220,
220,
7877,
13,
2617,
62,
87,
18242,
7,
79,
42035,
13,
2536,
87,
26,
10369,
7857,
8,
198,
220,
220,
7877,
13,
2617,
62,
2645,
9608,
7,
79,
42035,
13,
301,
563,
26,
10369,
7857,
8,
628,
220,
220,
7877,
13,
2617,
62,
7839,
7203,
35,
6377,
8172,
10369,
7857,
8,
628,
220,
220,
2124,
16,
11,
2124,
17,
796,
569,
75,
17053,
1352,
13,
1136,
62,
22704,
7,
79,
42035,
8,
628,
220,
220,
2837,
16,
796,
2989,
82,
9741,
11085,
7,
87,
16,
11,
6287,
58,
16,
60,
2599,
12947,
82,
9741,
12957,
7,
87,
16,
11,
6287,
58,
17,
12962,
198,
220,
220,
2837,
17,
796,
2989,
82,
9741,
11085,
7,
87,
17,
11,
6287,
58,
18,
60,
2599,
12947,
82,
9741,
12957,
7,
87,
17,
11,
6287,
58,
19,
12962,
628,
220,
220,
49184,
1045,
796,
1976,
27498,
7,
43879,
2624,
11,
4129,
7,
9521,
17,
828,
4129,
7,
9521,
16,
4008,
198,
220,
220,
269,
796,
7877,
13,
79,
4033,
579,
5069,
7,
87,
16,
58,
9521,
16,
4357,
2124,
17,
58,
9521,
17,
4357,
49184,
1045,
26,
2593,
11,
269,
8899,
28,
6759,
29487,
8019,
13,
11215,
13,
36590,
2127,
8,
628,
220,
220,
5794,
796,
2603,
29487,
8019,
13,
83,
15799,
13,
26227,
13290,
8479,
1436,
7203,
7225,
16,
69,
4943,
198,
220,
220,
269,
65,
16,
796,
3124,
5657,
7,
66,
26,
7877,
11,
36066,
11,
5794,
8,
198,
220,
220,
269,
65,
16,
13,
897,
13,
2617,
62,
2645,
9608,
7203,
58,
321,
84,
14,
535,
60,
8172,
10369,
7857,
8,
198,
220,
220,
269,
65,
16,
13,
448,
1370,
13,
2617,
62,
2815,
413,
5649,
7,
16,
13,
15,
8,
628,
220,
220,
8390,
1370,
796,
685,
15,
13,
15,
11,
352,
13,
15,
60,
198,
220,
220,
43979,
796,
685,
897,
13,
29487,
7,
30706,
1370,
11,
8390,
1370,
11,
220,
3124,
2625,
86,
4943,
329,
4808,
287,
352,
25,
7857,
7,
325,
5379,
11,
17,
15437,
628,
220,
220,
1441,
2336,
11,
7877,
11,
269,
11,
43979,
11,
2837,
16,
11,
2837,
17,
198,
437,
198,
198,
31,
16833,
3003,
2163,
4296,
62,
29487,
0,
7,
897,
11,
269,
11,
43979,
11,
2837,
16,
11,
2837,
17,
11,
5391,
62,
11,
11904,
11,
10706,
16,
11,
10706,
17,
11,
198,
220,
220,
503,
15908,
11,
2393,
8,
198,
220,
220,
318,
7753,
7,
448,
15908,
9,
7753,
58,
437,
12,
23,
25,
437,
12,
20,
60,
9,
1911,
11134,
4943,
11405,
1441,
628,
220,
220,
44872,
7203,
7753,
796,
720,
7753,
4943,
198,
220,
220,
13634,
796,
3440,
7,
7753,
8,
628,
220,
220,
1366,
796,
569,
75,
17053,
1352,
13,
46012,
17,
67,
7,
28961,
11,
366,
1676,
1122,
14,
45119,
62,
81,
8873,
1600,
1058,
19726,
33047,
198,
220,
220,
269,
13,
2617,
62,
18747,
7,
7890,
58,
9521,
17,
11,
9521,
16,
60,
24457,
352,
69,
21,
8,
628,
220,
220,
965,
62,
7839,
796,
2488,
82,
37435,
366,
35,
6377,
19445,
1057,
11,
256,
28,
4064,
19,
13,
16,
9501,
1,
13634,
13,
2435,
198,
220,
220,
7877,
13,
2617,
62,
7839,
7,
2536,
62,
7839,
26,
10369,
7857,
2625,
87,
12,
11664,
4943,
628,
220,
220,
275,
796,
13634,
14692,
45119,
62,
65,
62,
10396,
8973,
198,
220,
220,
275,
16,
796,
27179,
1758,
7,
65,
58,
27740,
62,
58,
16,
4357,
25,
4357,
13634,
13,
1198,
297,
82,
58,
27740,
62,
58,
16,
60,
4357,
13634,
13,
1198,
297,
82,
58,
27740,
62,
58,
17,
11907,
8,
198,
220,
220,
275,
17,
796,
27179,
1758,
7,
65,
58,
27740,
62,
58,
17,
4357,
25,
4357,
13634,
13,
1198,
297,
82,
58,
27740,
62,
58,
16,
60,
4357,
13634,
13,
1198,
297,
82,
58,
27740,
62,
58,
17,
11907,
8,
198,
220,
220,
1303,
9938,
4683,
15452,
37647,
198,
220,
220,
37647,
796,
685,
9410,
329,
1200,
287,
7877,
13,
1136,
62,
17197,
3419,
611,
198,
220,
220,
220,
220,
220,
12972,
18780,
259,
7,
25,
271,
39098,
5769,
9410,
11,
2603,
29487,
8019,
13,
5239,
13,
2025,
38983,
15437,
198,
220,
220,
1303,
17220,
4683,
20507,
198,
220,
220,
329,
257,
287,
37647,
198,
220,
220,
220,
220,
220,
257,
13,
28956,
3419,
198,
220,
220,
886,
198,
220,
220,
1303,
3060,
649,
20507,
1863,
2214,
3951,
198,
220,
220,
329,
1312,
287,
34197,
7,
325,
5379,
11,
17,
8,
198,
220,
220,
220,
220,
220,
923,
87,
11,
923,
88,
796,
11904,
58,
45299,
72,
60,
198,
220,
220,
220,
220,
220,
2124,
16,
11,
331,
16,
796,
12854,
7,
65,
16,
11,
275,
17,
11,
923,
87,
11,
923,
88,
11,
10706,
16,
11,
10706,
17,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
288,
82,
28,
15,
13,
20,
11,
3509,
9662,
28,
27559,
11,
10706,
4906,
2625,
358,
25928,
4943,
198,
220,
220,
220,
220,
220,
2124,
16,
24457,
28,
4526,
198,
220,
220,
220,
220,
220,
331,
16,
24457,
28,
4526,
198,
220,
220,
220,
220,
220,
611,
4129,
7,
87,
16,
8,
1279,
642,
26,
2555,
26,
886,
198,
220,
220,
220,
220,
220,
43979,
58,
72,
7131,
16,
4083,
2617,
62,
87,
7890,
7,
87,
16,
8,
198,
220,
220,
220,
220,
220,
43979,
58,
72,
7131,
16,
4083,
2617,
62,
5173,
1045,
7,
88,
16,
8,
198,
220,
220,
220,
220,
220,
751,
62,
6018,
7,
7278,
58,
72,
7131,
16,
12962,
198,
220,
220,
886,
628,
220,
220,
3613,
5647,
7,
448,
15908,
9,
7753,
58,
437,
12,
23,
25,
437,
12,
20,
60,
9,
1911,
11134,
1600,
275,
3524,
62,
45457,
2625,
33464,
4943,
198,
437,
198,
198,
8818,
787,
62,
43863,
7,
16624,
8,
198,
220,
220,
329,
277,
287,
3696,
198,
220,
220,
220,
220,
220,
220,
1234,
0,
7,
43863,
11,
277,
8,
198,
220,
220,
886,
198,
437,
198,
198,
31,
16833,
3003,
2163,
466,
62,
1818,
7,
43863,
11,
3722,
11,
198,
220,
220,
503,
15908,
11,
279,
42035,
11,
2593,
11,
36066,
11,
10706,
16,
11,
10706,
17,
11,
5391,
62,
11,
11904,
11,
6287,
8,
628,
220,
220,
2336,
11,
7877,
11,
269,
11,
43979,
11,
2837,
16,
11,
2837,
17,
796,
2315,
62,
26875,
7,
79,
42035,
11,
2593,
11,
36066,
11,
11904,
11,
6287,
8,
628,
220,
220,
981,
2081,
198,
220,
220,
220,
220,
220,
2393,
796,
1011,
0,
7,
43863,
8,
198,
220,
220,
220,
220,
220,
4296,
62,
29487,
0,
7,
897,
11,
269,
11,
43979,
11,
2837,
16,
11,
2837,
17,
11,
5391,
62,
11,
11904,
11,
10706,
16,
11,
10706,
17,
11,
503,
15908,
11,
2393,
8,
198,
220,
220,
220,
220,
220,
1234,
0,
7,
13376,
11,
2081,
8,
198,
220,
220,
886,
198,
220,
220,
1969,
7,
5647,
8,
198,
437,
198,
198,
29113,
29113,
14468,
7804,
4242,
198,
16624,
796,
15095,
7203,
65,
12171,
24620,
85,
7278,
85,
1600,
366,
19570,
198,
198,
77,
7753,
796,
4129,
7,
16624,
8,
198,
2,
5345,
5072,
8619,
198,
448,
15908,
796,
366,
448,
30487,
198,
198,
9979,
3946,
220,
220,
796,
21520,
29239,
7,
3419,
3784,
29239,
90,
10100,
92,
7,
77,
7753,
4008,
198,
9979,
3722,
796,
21520,
29239,
7,
3419,
3784,
29239,
90,
33,
970,
92,
7,
77,
22896,
3419,
4008,
198,
198,
22704,
20850,
796,
31834,
4221,
1303,
542,
454,
7110,
34197,
4326,
198,
2302,
298,
796,
685,
15,
1539,
1160,
1539,
532,
1238,
1539,
1160,
8183,
1303,
685,
2200,
4357,
4277,
1336,
7386,
25,
25915,
18943,
2624,
11,
4806,
2624,
11,
532,
18943,
2624,
11,
4806,
2624,
60,
198,
198,
2,
20390,
14,
21037,
7095,
329,
1123,
7885,
198,
33643,
1084,
11,
18074,
223,
9806,
796,
657,
13,
15,
11,
1367,
13,
15,
220,
220,
220,
220,
220,
1303,
685,
321,
84,
14,
535,
60,
198,
198,
28961,
796,
3440,
7,
16624,
58,
16,
12962,
198,
2,
28407,
5207,
329,
29353,
198,
79,
42035,
796,
569,
75,
17053,
1352,
13,
2617,
62,
22046,
7,
28961,
11,
366,
1676,
1122,
14,
45119,
62,
81,
8873,
1600,
16488,
20850,
26,
3487,
28,
25,
23108,
8,
198,
27237,
11,
36066,
796,
569,
75,
17053,
1352,
13,
2617,
62,
8043,
5657,
7,
14993,
451,
11,
18074,
223,
1084,
11,
18074,
223,
9806,
8,
198,
198,
2,
2940,
21739,
15225,
198,
27740,
62,
796,
279,
42035,
13,
301,
563,
58,
16,
60,
6624,
705,
57,
6,
5633,
357,
16,
11,
18,
8,
1058,
357,
16,
11,
17,
8,
198,
198,
7,
26,
37652,
1084,
11,
6349,
9806,
11,
299,
46342,
8,
796,
13634,
198,
198,
2,
2980,
378,
3218,
13690,
35610,
2837,
198,
25928,
16,
796,
2837,
7,
37652,
1084,
58,
27740,
62,
58,
16,
60,
4357,
6349,
9806,
58,
27740,
62,
58,
16,
60,
4357,
4129,
28,
1198,
297,
82,
58,
27740,
62,
58,
16,
11907,
8,
220,
198,
25928,
17,
796,
2837,
7,
37652,
1084,
58,
27740,
62,
58,
17,
60,
4357,
6349,
9806,
58,
27740,
62,
58,
17,
60,
4357,
4129,
28,
1198,
297,
82,
58,
27740,
62,
58,
17,
11907,
8,
198,
2,
2980,
378,
11904,
329,
287,
12,
14382,
2214,
1627,
35328,
198,
77,
325,
5379,
796,
838,
198,
325,
5379,
796,
7716,
62,
325,
5379,
7,
37652,
1084,
11,
6349,
9806,
11,
5391,
62,
11,
299,
325,
5379,
8,
628,
198,
35235,
7203,
14957,
1271,
286,
3696,
25,
720,
77,
7753,
4943,
198,
35235,
7203,
28768,
351,
29568,
77,
22896,
28955,
3259,
9313,
8,
198,
198,
31,
292,
13361,
787,
62,
43863,
7,
16624,
8,
1303,
18272,
262,
3946,
6518,
351,
477,
3696,
284,
1429,
13,
198,
198,
31,
27261,
329,
279,
287,
3259,
3419,
198,
220,
220,
2488,
292,
13361,
6569,
62,
4598,
7,
4598,
62,
1818,
11,
279,
11,
3946,
11,
3722,
11,
198,
220,
220,
220,
220,
220,
503,
15908,
11,
279,
42035,
11,
2593,
11,
36066,
11,
10706,
16,
11,
10706,
17,
11,
5391,
62,
11,
11904,
11,
6287,
8,
198,
437,
198,
198,
1616,
299,
796,
299,
7753,
198,
220,
220,
256,
796,
2488,
417,
28361,
981,
299,
1875,
657,
1303,
4043,
329,
477,
3946,
284,
1844,
198,
220,
220,
220,
220,
220,
1011,
0,
7,
13376,
8,
198,
220,
220,
220,
220,
220,
299,
48185,
352,
198,
220,
220,
886,
198,
220,
220,
44872,
7203,
18467,
1348,
287,
29568,
744,
7,
83,
11,
19561,
28,
17,
4008,
82,
19570,
198,
437
] | 2.397396 | 2,227 |
function molecule(::Molecule"H₂O")
return """
O 1.2091536548 1.7664118189 -0.0171613972
H 2.1984800075 1.7977100627 0.0121161719
H 0.9197881882 2.4580185570 0.6297938830
"""
end
molecule(m::Molecule"water") = molecule(alias(m))
alias(::Molecule"water") = Molecule"H₂O"()
| [
8818,
27756,
7,
3712,
44,
2305,
23172,
1,
39,
158,
224,
224,
46,
4943,
198,
220,
1441,
37227,
198,
220,
440,
352,
13,
22567,
1314,
24760,
2780,
352,
13,
4304,
2414,
16817,
23362,
532,
15,
13,
29326,
1433,
20219,
4761,
198,
220,
367,
362,
13,
22337,
2780,
830,
2425,
352,
13,
3720,
3324,
3064,
49856,
220,
657,
13,
30206,
18298,
1558,
1129,
198,
220,
367,
657,
13,
24,
24991,
3459,
1507,
6469,
362,
13,
29334,
29159,
2816,
2154,
220,
657,
13,
48602,
3720,
30460,
1270,
198,
220,
37227,
198,
437,
198,
76,
2305,
23172,
7,
76,
3712,
44,
2305,
23172,
1,
7050,
4943,
796,
27756,
7,
26011,
7,
76,
4008,
198,
26011,
7,
3712,
44,
2305,
23172,
1,
7050,
4943,
796,
25726,
23172,
1,
39,
158,
224,
224,
46,
1,
3419,
198
] | 2.143939 | 132 |
using Test
@testset "App" begin
include("HealthHandler.jl")
end | [
3500,
6208,
198,
198,
31,
9288,
2617,
366,
4677,
1,
2221,
198,
220,
220,
220,
2291,
7203,
18081,
25060,
13,
20362,
4943,
198,
437
] | 2.833333 | 24 |
using Catlab.CategoricalAlgebra
using Catlab.Present
using Catlab.Theories
using Catlab.Graphs.BasicGraphs: TheoryGraph
using Catlab.Graphs
using DataStructures: OrderedDict
"""
Reference: CT for computing science:
https://www.math.mcgill.ca/triples/Barr-Wells-ctcs.pdf
We are concerned with "Regular" sketches, where no node is the vertex of more
than one cone.
Here are also interesting examples + explanation of connection to Essentially
Algebraic Theories: https://www.math.mcgill.ca/barr/papers/sketch.pdf
Section 7.7 describes how this is essentially the same as the
syntactic version. Maybe useful to help convert between.
FD theories add cocones and model sum types. This goes beyond what we want to
model with a GAT, though may be interesting to consider for the model
enumeration project.
Also check Fiore: categorical semantics of dependent type theory
"""
"""
Section 7.3+10.1.3 Shorthand Caveats:
2. nodes a×b×c IMPLICITLY have a cone with projection legs.
3. likewise nodes labeled 1 are implicitly terminal (empty base limit)
4. arrows labeled ⟨f₁,f₂,...⟩:a->b₁×b₂×... , where edges fₙ all share a codomain, are implicitly assumed to have diagrams:
fᵢ
a ⟶ bᵢ
⟨f₁,f₂,...⟩ ↓ ↗ pᵢ
b₁×b₂×...
5. arrows labeled f₁×f₂×...: a₁×a₂×...->b₁×b₂×...
are implicitly assumed to have diagrams:
pᵢ
a₁×a₂×... --> aᵢ
f₁×f₂×...↓ ↓ fᵢ
b₁×b₂×... --> bᵢ
pᵢ
6. diagrams of the form of two paths with a common start and end can be specified as s₁;s₂;... = t₁;t₂;...
7. If one leg of the above paths is empty, we require an identity arrow and set the other path to be equal to it.
8. Nodes labeled a×ᵧb implies the existence of a cone
a×ᵧb
↙ ↘
a→ γ ←b
9. an arrow s: a↣b (i.e. s is monic) implies the existence of a cone
a
id ╱ | ╲ id
↙ ↓s ↘
a ⟶ b ⟵ a
s s
"""
"""
Combinatorial representation of data of a finite limit sketch
It is not yet clear whether this captures everything we want to capture, e.g.
we expect that the diagrams are trees without cycles so that there are only a
finite number of equations to check, but there could be alternative styles of
diagrams that would work better in a CSet.
"""
@present TheoryFLSketch(FreeSchema) begin
# Main Graph
(V, E)::Ob
(src, tgt)::Hom(E,V)
# Diagrams
(Dv, De)::Ob
root::Hom(V, Dv)
(dSrc, dTgt)::Hom(De,Dv) # graph data of all diagrams (disjoint union)
dV::Hom(Dv, V) # Partition union of graphs
dE::Hom(De, V) # via map into V
# Cones
(Cone, Leg, Cv, Ce)::Ob
(cSrc, cTgt)::Hom(Ce,Cv) # graph data of all cone bases (disjoint union)
apex::Hom(Cone, V) # Which object is the cone vertex?
legCone::Hom(Leg, Cone) # Which Cone does this leg belong to?
legTgt::Hom(Leg, Cv)
legEdge::Hom(Leg, E)
cV::Hom(Cv, Cone) # Partition cone graph
cE::Hom(Ce, Cone) # via map into Cone
# Homorphisms data
cvMap::Hom(Cv, V)
ceMap::Hom(Ce, E)
dvMap::Hom(Dv, V)
deMap::Hom(De, E)
# Diagrams/cones don't touch each other
compose(cSrc, cV) == cE # EQUATION ON Ce
compose(cTgt, cV) == cE # EQUATION ON Ce
compose(dSrc, dV) == dE # EQUATION ON De
compose(dTgt, dV) == dE # EQUATION ON De
# Root of each diagram is the right vertex
compose(root, dV) == id(V) # EQUATION ON V
compose(root, dvMap) == id(V) # EQUATION ON V
# Homomorphism properties
compose(legEdge, src) == compose(legCone, apex) # EQUATION ON CONE LEGS
compose(legEdge, tgt) == compose(legTgt, cvMap) # EQUATION ON CONE LEGS
compose(deMap, src) == compose(dSrc, dvMap) # EQUATION ON De
compose(deMap, tgt) == compose(dTgt, dvMap) # EQUATION ON De
compose(ceMap, src) == compose(cSrc, cvMap) # EQUATION ON Ce
compose(ceMap, tgt) == compose(cTgt, cvMap) # EQUATION ON Ce
end;
"""Append either _src or _tgt to a symbol"""
function add_srctgt(fk::Symbol, src::Bool)::Symbol
return Symbol(string(fk) * "_" * (src ? "src" : "tgt"))
end
"""Append both _src and _tgt to a symbol"""
function add_srctgt(fk::Symbol)::Pair{Symbol, Symbol}
return add_srctgt(fk, true) => add_srctgt(fk, false)
end
if !isdefined(Main, :Fls) # because we are currently running this as a script
const Fls = CSetType(TheoryFLSketch, index=[
:src, :tgt, :dSrc, :dV, :dE, :cV, :cE, :apex, :legCone]);
end
"""Edges and vertices labeled by symbols"""
@present TheoryLabeledGraph <: TheoryGraph begin
Label::Data
vlabel::AttrType(V,Label)
elabel::AttrType(E,Label)
end;
# we don't want unique_index=[:vlabel, :elabel] because we want to use
# labels to specify homomorphisms which may not be injective
@acset_type LabeledGraph(TheoryLabeledGraph, index=[:src,:tgt]){Symbol};
"""Annotate a FLS CSet with labels"""
struct LabeledFLS
fls::Fls
labels::Pair{Vector{Symbol}, Vector{Symbol}} # label nodes and edges
function LabeledFLS(f::Fls, l::Pair{Vector{Symbol}, Vector{Symbol}})
for labs in l
length(labs)==length(Set(labs)) || error("labels must be unique: $labs")
end
length(l[1]) == nparts(f, :V) || error("incorrect # of vlabels $(l[1])")
length(l[2]) == nparts(f, :E) || error("incorrect # of elabels $(l[2])")
return new(f, l)
end
end
"""Access vertex labels of graph underlying FLS"""
function vi(fls::LabeledFLS, v::Symbol)::Int
return findfirst(==(v), fls.labels[1])
end
"""Access edge labels of graph underlying FLS"""
function ei(fls::LabeledFLS, v::Symbol)::Int
return findfirst(==(v), fls.labels[2])
end
"""No cones, trivial diagrams"""
function FLSinit(g::LabeledGraph)::LabeledFLS
fls = Fls()
add_parts!(fls, :V, nv(g))
add_parts!(fls, :Dv, nv(g), dV=1:nv(g), dvMap=1:nv(g))
add_parts!(fls, :E, ne(g))
set_subpart!(fls, :src, g[:src])
set_subpart!(fls, :tgt, g[:tgt])
set_subpart!(fls, :root, 1:nv(g))
return LabeledFLS(fls, g[:vlabel] => g[:elabel])
end
"""Get the commutivity diagram of a FLS"""
function get_diagram(fls::LabeledFLS, root::Symbol)::LabeledGraph
res = LabeledGraph()
f = fls.fls
rooti = vi(fls, root)
nodes = f.indices[:dV][rooti]
edges = f.indices[:dE][rooti]
nodedict = Dict([i=>e for (e, i) in enumerate(nodes)])
vlab = [fls.labels[1][f[:dvMap][i]] for i in nodes]
add_parts!(res, :V, length(nodes), vlabel=vlab)
edata = [(e, f[:dSrc][e], f[:dTgt][e]) for e in edges]
for (e, s, t) in edata
elab = fls.labels[2][f[:deMap][e]]
add_part!(res, :E, src=nodedict[s], tgt=nodedict[t], elabel=elab)
end
return res
end
"""Get whole cone (apex last index), or just the base of of the cone"""
function get_cone(fls::LabeledFLS, apex::Symbol, base::Bool=false
)::Union{Nothing, LabeledGraph}
f = fls.fls
apexes = fls.labels[1][f[:apex]]
cone_ind = findfirst(==(apex), apexes)
if cone_ind === nothing
return nothing
end
res = LabeledGraph()
cv, ce = [f.indices[x][cone_ind] for x in [:cV, :cE]]
reind = [findfirst(==(i), cv) for i in 1:(isempty(cv) ? 0 : maximum(cv))]
vlab = fls.labels[1][f[:cvMap][cv]]
add_parts!(res, :V, length(cv), vlabel=vlab)
elab = fls.labels[2][f[:ceMap][ce]]
es = reind[f[:cSrc][ce]]
et = reind[f[:cTgt][ce]]
add_parts!(res, :E, length(ce), elabel=elab, src=es, tgt=et)
if !base
pex = add_part!(res, :V, vlabel=fls.labels[1][f[:apex][cone_ind]])
legs = f.indices[:legCone][cone_ind]
el = fls.labels[2][f[:legEdge][legs]]
tg = reind[f[:legTgt][legs]]
add_parts!(res, :E, length(legs), elabel=el, src=pex, tgt=tg)
end
return res
end
"""Extract the underlying graph (no diagrams/cones)"""
function get_schema(fls::LabeledFLS)::LabeledGraph
res = LabeledGraph()
add_parts!(res, :V, length(fls.labels[1]), vlabel=fls.labels[1])
add_parts!(res, :E, length(fls.labels[2]), src=fls.fls[:src], tgt=fls.fls[:tgt], elabel=fls.labels[2])
return res
end
"""Get all commuting paths starting at a particular node"""
function all_paths(fls, root::Symbol)::OrderedDict{Vector{Symbol}, Int}
res = OrderedDict{Vector{Symbol}, Int}()
rooti = vi(fls, root)
f = fls.fls
rootind = f[:root][rooti]
stack = Tuple{Int,Vector{Symbol}}[(rootind, [])]
seen = Set()
while !isempty(stack)
currnode, currpath = pop!(stack)
res[currpath] = currnode
if !(currnode in seen)
push!(seen, currnode)
for e in f.indices[:dSrc][currnode]
orig_e = f[:deMap][e]
e_symbol = fls.labels[2][orig_e]
nextnode = f[:dTgt][e]
push!(stack, (nextnode, vcat(currpath, [e_symbol])))
end
end
end
return res
end
"""
Add a diagram where the first node is the root. Labels indicate homomorphism.
"""
function add_diagram!(fls::LabeledFLS, d::LabeledGraph)::Nothing
rootless = LabeledGraph()
add_parts!(rootless, :V, nv(d), vlabel=d[:vlabel])
for (e, (ss, tt)) in enumerate(zip(d[:src], d[:tgt]))
if tt != 1
add_part!(rootless, :E, elabel=d[:elabel][e], src=ss, tgt=tt)
end
end
topological_sort(rootless) # must be acyclic, after removing loops to root
root = d[:vlabel][1]
rooti = vi(fls, root)
# paths that already exist in the FLS
location = all_paths(fls, root)
f = fls.fls
seen = Dict{Int, Int}() # index in d => index in FLS diagram
# (index in d, index in FLS diagram, path in d)
stack = Tuple{Int,Int,Vector{Symbol}}[(1, f[:root][rooti], Symbol[])]
while !isempty(stack)
dnode, currnode, currpath = pop!(stack)
seen[dnode] = currnode
vlabel = d[:vlabel][dnode]
nextedges = d.indices[:src][dnode]
for e in nextedges
elab = d[:elabel][e]
orig_edge = ei(fls, elab)
nextpath = vcat(currpath, [elab])
seenflag = false
if haskey(location, nextpath)
nextnode = location[nextpath]
else
next_d = d[:tgt][e]
next_orig = vi(fls, d[:vlabel][next_d])
if haskey(seen, next_d)
nextnode = seen[next_d]
seenflag=true
else
nextnode = add_part!(f, :Dv, dV=rooti, dvMap=next_orig)
end
add_part!(f, :De, dSrc=currnode, dTgt=nextnode,
dE=rooti, deMap=orig_edge)
end
if !seenflag
push!(stack, (d[:tgt][e], nextnode, nextpath))
end
end
end
end
"""
Add a cone, assuming the last vertex of the graph is the apex
"""
function add_cone!(fls::LabeledFLS, c::LabeledGraph)::Nothing
f = fls.fls
conetgt = vi(fls, c[:vlabel][end])
prevcones = vcat(f.indices[:apex]...)
@assert !(conetgt in prevcones) "No more than one cone on a given vertex"
cone_id = add_part!(f, :Cone)
vert_ids = add_parts!(f, :Cv, nv(c)-1, cV=cone_id,
cvMap=[vi(fls, l) for l in c[:vlabel][1:end-1]])
nonlegs = [i for (i, t) in enumerate(c[:src]) if t!=nv(c)]
legs = [i for (i, t) in enumerate(c[:src]) if t==nv(c)]
emap, lemap = [[ei(fls, l) for l in c[:elabel][x]]
for x in [nonlegs, legs]]
esrc = vert_ids[c[:src][nonlegs]]
etgt, letgt = [vert_ids[c[:tgt][x]] for x in [nonlegs, legs]]
add_parts!(f, :Ce, length(nonlegs), cE=cone_id, ceMap=emap, cSrc=esrc, cTgt=etgt)
set_subpart!(f, cone_id, :apex, vi(fls, c[:vlabel][nv(c)]))
add_parts!(f, :Leg, length(legs), legCone=cone_id,
legEdge=lemap, legTgt=letgt)
return nothing
end
"""
Create a linear sketch (no cones) based on a CSet presentation
"""
function catpres_to_linear(pres::Presentation)::LabeledFLS
obs = pres.generators[:Ob]
homs = pres.generators[:Hom]
vlab = [x.args[1] for x in obs]
odict = Dict([o => i for (i, o) in enumerate(obs)])
idsymbs = [Symbol("_id_"*string(v)) for v in vlab]
elab = vcat([x.args[1] for x in homs], idsymbs)
# Create initial graph
g = LabeledGraph()
n, nh = length(vlab), length(homs)
add_parts!(g, :V, n, vlabel=vlab)
srcs = vcat([odict[h.type_args[1]] for h in homs], 1:n)
tgts = vcat([odict[h.type_args[2]] for h in homs], 1:n)
add_parts!(g, :E, nh+n, src=srcs, tgt=tgts, elabel=elab)
fls = FLSinit(g)
# Add diagrams
for (p1, p2) in pres.equations
d = paths_to_diagram(p1, p2)
add_diagram!(fls, d)
end
return fls
end
"""Create a diagram from a path equality"""
function paths_to_diagram(p1, p2)::LabeledGraph
d = LabeledGraph()
root = p1.type_args[1].args[1]
add_part!(d, :V, vlabel=root)
function add_path!(start::Bool, p)::Nothing
typ = typeof(p).parameters[1]
if typ == :id
if start
tgt = add_part!(d, :V, vlabel=root)
else
tgt = nparts(d, :V)
end
elab = Symbol("_id_"*string(root))
add_part!(d, :E, src=1, tgt=tgt, elabel=elab)
elseif typ == :compose
homs = p.args
curr = 1
if start
last = length(homs) + 1
else
last = nparts(d, :V)
end
for (i, hom) in enumerate(homs)
add_part!(d, :V, vlabel=hom.type_args[2].args[1])
if i == length(homs)
tgt = last
else
tgt = curr+1
end
add_part!(d, :E, src=curr, tgt=tgt, elabel=hom.args[1])
curr += 1
end
elseif typ == :generator
if start
last = add_part!(d, :V, vlabel=p.type_args[2].args[1])
else
last = nparts(d, :V)
end
add_part!(d, :E, src=1, tgt = last, elabel=p.args[1])
else
@assert false "Not prepared for type $typ"
end
return nothing
end
add_path!(true, p1)
add_path!(false, p2)
return d
end
| [
3500,
5181,
23912,
13,
34,
2397,
12409,
2348,
29230,
198,
3500,
5181,
23912,
13,
34695,
198,
3500,
5181,
23912,
13,
464,
1749,
198,
3500,
5181,
23912,
13,
37065,
82,
13,
26416,
37065,
82,
25,
17003,
37065,
198,
3500,
5181,
23912,
13,
37065,
82,
198,
3500,
6060,
44909,
942,
25,
14230,
1068,
35,
713,
198,
198,
37811,
198,
26687,
25,
16356,
329,
14492,
3783,
25,
198,
5450,
1378,
2503,
13,
11018,
13,
23209,
70,
359,
13,
6888,
14,
28461,
2374,
14,
33,
3258,
12,
5779,
82,
12,
310,
6359,
13,
12315,
198,
198,
1135,
389,
5213,
351,
366,
40164,
1,
34035,
11,
810,
645,
10139,
318,
262,
37423,
286,
517,
198,
14813,
530,
27763,
13,
198,
198,
4342,
389,
635,
3499,
6096,
1343,
7468,
286,
4637,
284,
34039,
198,
2348,
29230,
291,
383,
1749,
25,
3740,
1378,
2503,
13,
11018,
13,
23209,
70,
359,
13,
6888,
14,
65,
3258,
14,
40491,
14,
82,
7126,
354,
13,
12315,
198,
198,
16375,
767,
13,
22,
8477,
703,
428,
318,
6986,
262,
976,
355,
262,
198,
1837,
429,
12009,
2196,
13,
6674,
4465,
284,
1037,
10385,
1022,
13,
198,
198,
26009,
10946,
751,
8954,
1952,
290,
2746,
2160,
3858,
13,
770,
2925,
3675,
644,
356,
765,
284,
198,
19849,
351,
257,
402,
1404,
11,
996,
743,
307,
3499,
284,
2074,
329,
262,
2746,
198,
268,
6975,
341,
1628,
13,
198,
198,
7583,
2198,
23238,
382,
25,
4253,
12409,
33815,
286,
10795,
2099,
4583,
198,
37811,
198,
198,
37811,
198,
16375,
767,
13,
18,
10,
940,
13,
16,
13,
18,
911,
1506,
392,
18603,
1381,
25,
198,
17,
13,
13760,
257,
12906,
65,
12906,
66,
8959,
31484,
2043,
11319,
423,
257,
27763,
351,
20128,
7405,
13,
198,
18,
13,
20467,
13760,
15494,
352,
389,
31821,
12094,
357,
28920,
2779,
4179,
8,
198,
19,
13,
20507,
15494,
2343,
253,
101,
69,
158,
224,
223,
11,
69,
158,
224,
224,
42303,
158,
253,
102,
25,
64,
3784,
65,
158,
224,
223,
12906,
65,
158,
224,
224,
12906,
986,
837,
810,
13015,
277,
158,
224,
247,
477,
2648,
257,
14873,
296,
391,
11,
389,
31821,
9672,
284,
423,
37067,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
39611,
95,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
2343,
253,
114,
275,
39611,
95,
198,
2343,
253,
101,
69,
158,
224,
223,
11,
69,
158,
224,
224,
42303,
158,
253,
102,
220,
17804,
241,
220,
220,
17804,
245,
279,
39611,
95,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
158,
224,
223,
12906,
65,
158,
224,
224,
12906,
986,
198,
198,
20,
13,
20507,
15494,
277,
158,
224,
223,
12906,
69,
158,
224,
224,
12906,
986,
25,
257,
158,
224,
223,
12906,
64,
158,
224,
224,
12906,
986,
3784,
65,
158,
224,
223,
12906,
65,
158,
224,
224,
12906,
986,
198,
533,
31821,
9672,
284,
423,
37067,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
39611,
95,
198,
220,
220,
220,
220,
220,
257,
158,
224,
223,
12906,
64,
158,
224,
224,
12906,
986,
14610,
257,
39611,
95,
198,
69,
158,
224,
223,
12906,
69,
158,
224,
224,
12906,
986,
29705,
241,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17804,
241,
277,
39611,
95,
198,
220,
220,
220,
220,
220,
275,
158,
224,
223,
12906,
65,
158,
224,
224,
12906,
986,
14610,
275,
39611,
95,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
39611,
95,
198,
198,
21,
13,
37067,
286,
262,
1296,
286,
734,
13532,
351,
257,
2219,
923,
290,
886,
460,
307,
7368,
355,
264,
158,
224,
223,
26,
82,
158,
224,
224,
26,
986,
796,
256,
158,
224,
223,
26,
83,
158,
224,
224,
26,
986,
198,
22,
13,
1002,
530,
1232,
286,
262,
2029,
13532,
318,
6565,
11,
356,
2421,
281,
5369,
15452,
290,
900,
262,
584,
3108,
284,
307,
4961,
284,
340,
13,
198,
23,
13,
399,
4147,
15494,
257,
12906,
39611,
100,
65,
15565,
262,
6224,
286,
257,
27763,
198,
220,
220,
220,
220,
220,
220,
220,
257,
12906,
39611,
100,
65,
198,
220,
220,
220,
220,
220,
220,
17804,
247,
220,
220,
17804,
246,
198,
220,
220,
220,
220,
220,
257,
39310,
7377,
111,
17804,
238,
65,
198,
24,
13,
281,
15452,
264,
25,
257,
29705,
96,
65,
357,
72,
13,
68,
13,
264,
318,
937,
291,
8,
15565,
262,
6224,
286,
257,
27763,
198,
220,
220,
220,
220,
220,
220,
220,
257,
198,
220,
220,
4686,
2343,
243,
109,
930,
2343,
243,
110,
4686,
198,
220,
220,
220,
17804,
247,
220,
220,
17804,
241,
82,
220,
17804,
246,
198,
220,
220,
257,
2343,
253,
114,
275,
2343,
253,
113,
257,
198,
220,
220,
220,
220,
264,
220,
220,
220,
220,
264,
198,
37811,
198,
198,
37811,
198,
20575,
20900,
498,
10552,
286,
1366,
286,
257,
27454,
4179,
17548,
198,
198,
1026,
318,
407,
1865,
1598,
1771,
428,
23007,
2279,
356,
765,
284,
8006,
11,
304,
13,
70,
13,
198,
732,
1607,
326,
262,
37067,
389,
7150,
1231,
16006,
523,
326,
612,
389,
691,
257,
198,
69,
9504,
1271,
286,
27490,
284,
2198,
11,
475,
612,
714,
307,
5559,
12186,
286,
198,
10989,
6713,
82,
326,
561,
670,
1365,
287,
257,
327,
7248,
13,
198,
37811,
198,
31,
25579,
17003,
3697,
50,
7126,
354,
7,
11146,
27054,
2611,
8,
2221,
198,
220,
1303,
8774,
29681,
198,
220,
357,
53,
11,
412,
2599,
25,
5944,
198,
220,
357,
10677,
11,
256,
13655,
2599,
25,
28718,
7,
36,
11,
53,
8,
628,
220,
1303,
6031,
6713,
82,
198,
220,
357,
35,
85,
11,
1024,
2599,
25,
5944,
198,
220,
6808,
3712,
28718,
7,
53,
11,
360,
85,
8,
198,
220,
357,
67,
50,
6015,
11,
288,
51,
13655,
2599,
25,
28718,
7,
5005,
11,
35,
85,
8,
1303,
4823,
1366,
286,
477,
37067,
357,
6381,
73,
1563,
6441,
8,
198,
220,
288,
53,
3712,
28718,
7,
35,
85,
11,
569,
8,
1303,
2142,
653,
6441,
286,
28770,
198,
220,
288,
36,
3712,
28718,
7,
5005,
11,
569,
8,
1303,
2884,
3975,
656,
569,
628,
220,
1303,
1482,
274,
198,
220,
357,
34,
505,
11,
3564,
11,
327,
85,
11,
20101,
2599,
25,
5944,
198,
220,
357,
66,
50,
6015,
11,
269,
51,
13655,
2599,
25,
28718,
7,
34,
68,
11,
34,
85,
8,
1303,
4823,
1366,
286,
477,
27763,
12536,
357,
6381,
73,
1563,
6441,
8,
198,
220,
40167,
3712,
28718,
7,
34,
505,
11,
569,
8,
220,
220,
220,
1303,
9022,
2134,
318,
262,
27763,
37423,
30,
198,
220,
1232,
34,
505,
3712,
28718,
7,
11484,
11,
327,
505,
8,
1303,
9022,
327,
505,
857,
428,
1232,
5594,
284,
30,
198,
220,
1232,
51,
13655,
3712,
28718,
7,
11484,
11,
327,
85,
8,
198,
220,
1232,
37021,
3712,
28718,
7,
11484,
11,
412,
8,
198,
220,
269,
53,
3712,
28718,
7,
34,
85,
11,
327,
505,
8,
220,
220,
220,
1303,
2142,
653,
27763,
4823,
198,
220,
269,
36,
3712,
28718,
7,
34,
68,
11,
327,
505,
8,
220,
220,
220,
1303,
2884,
3975,
656,
327,
505,
628,
220,
1303,
8074,
13425,
6583,
1366,
198,
220,
269,
85,
13912,
3712,
28718,
7,
34,
85,
11,
569,
8,
198,
220,
2906,
13912,
3712,
28718,
7,
34,
68,
11,
412,
8,
198,
220,
288,
85,
13912,
3712,
28718,
7,
35,
85,
11,
569,
8,
198,
220,
390,
13912,
3712,
28718,
7,
5005,
11,
412,
8,
628,
220,
1303,
6031,
6713,
82,
14,
1102,
274,
836,
470,
3638,
1123,
584,
198,
220,
36664,
7,
66,
50,
6015,
11,
269,
53,
8,
6624,
269,
36,
220,
220,
220,
1303,
46886,
6234,
6177,
20101,
198,
220,
36664,
7,
66,
51,
13655,
11,
269,
53,
8,
6624,
269,
36,
220,
220,
220,
1303,
46886,
6234,
6177,
20101,
198,
220,
36664,
7,
67,
50,
6015,
11,
288,
53,
8,
6624,
288,
36,
220,
220,
220,
1303,
46886,
6234,
6177,
1024,
198,
220,
36664,
7,
67,
51,
13655,
11,
288,
53,
8,
6624,
288,
36,
220,
220,
220,
1303,
46886,
6234,
6177,
1024,
628,
220,
1303,
20410,
286,
1123,
16362,
318,
262,
826,
37423,
198,
220,
36664,
7,
15763,
11,
288,
53,
8,
6624,
4686,
7,
53,
8,
220,
1303,
46886,
6234,
6177,
569,
198,
220,
36664,
7,
15763,
11,
288,
85,
13912,
8,
6624,
4686,
7,
53,
8,
220,
1303,
46886,
6234,
6177,
569,
628,
220,
1303,
8074,
25831,
1042,
6608,
198,
220,
36664,
7,
1455,
37021,
11,
12351,
8,
6624,
36664,
7,
1455,
34,
505,
11,
40167,
8,
1303,
46886,
6234,
6177,
7102,
36,
20978,
50,
198,
220,
36664,
7,
1455,
37021,
11,
256,
13655,
8,
6624,
36664,
7,
1455,
51,
13655,
11,
269,
85,
13912,
8,
1303,
46886,
6234,
6177,
7102,
36,
20978,
50,
198,
220,
36664,
7,
2934,
13912,
11,
12351,
8,
6624,
36664,
7,
67,
50,
6015,
11,
288,
85,
13912,
8,
1303,
46886,
6234,
6177,
1024,
198,
220,
36664,
7,
2934,
13912,
11,
256,
13655,
8,
6624,
36664,
7,
67,
51,
13655,
11,
288,
85,
13912,
8,
1303,
46886,
6234,
6177,
1024,
198,
220,
36664,
7,
344,
13912,
11,
12351,
8,
6624,
36664,
7,
66,
50,
6015,
11,
269,
85,
13912,
8,
1303,
46886,
6234,
6177,
20101,
198,
220,
36664,
7,
344,
13912,
11,
256,
13655,
8,
6624,
36664,
7,
66,
51,
13655,
11,
269,
85,
13912,
8,
1303,
46886,
6234,
6177,
20101,
198,
437,
26,
198,
198,
37811,
4677,
437,
2035,
4808,
10677,
393,
4808,
83,
13655,
284,
257,
6194,
37811,
198,
8818,
751,
62,
27891,
310,
13655,
7,
69,
74,
3712,
13940,
23650,
11,
12351,
3712,
33,
970,
2599,
25,
13940,
23650,
198,
220,
1441,
38357,
7,
8841,
7,
69,
74,
8,
1635,
45434,
1,
1635,
357,
10677,
5633,
366,
10677,
1,
1058,
366,
83,
13655,
48774,
198,
437,
198,
37811,
4677,
437,
1111,
4808,
10677,
290,
4808,
83,
13655,
284,
257,
6194,
37811,
198,
8818,
751,
62,
27891,
310,
13655,
7,
69,
74,
3712,
13940,
23650,
2599,
25,
47,
958,
90,
13940,
23650,
11,
38357,
92,
198,
220,
1441,
751,
62,
27891,
310,
13655,
7,
69,
74,
11,
2081,
8,
5218,
751,
62,
27891,
310,
13655,
7,
69,
74,
11,
3991,
8,
198,
437,
198,
198,
361,
5145,
271,
23211,
7,
13383,
11,
1058,
37,
7278,
8,
1303,
780,
356,
389,
3058,
2491,
428,
355,
257,
4226,
198,
9979,
1610,
82,
796,
327,
7248,
6030,
7,
464,
652,
3697,
50,
7126,
354,
11,
6376,
41888,
198,
220,
1058,
10677,
11,
1058,
83,
13655,
11,
1058,
67,
50,
6015,
11,
1058,
67,
53,
11,
1058,
67,
36,
11,
1058,
66,
53,
11,
1058,
66,
36,
11,
1058,
1758,
87,
11,
1058,
1455,
34,
505,
36563,
198,
437,
198,
198,
37811,
7407,
3212,
290,
9421,
1063,
15494,
416,
14354,
37811,
198,
31,
25579,
17003,
33986,
276,
37065,
1279,
25,
17003,
37065,
2221,
198,
220,
36052,
3712,
6601,
198,
220,
410,
18242,
3712,
8086,
81,
6030,
7,
53,
11,
33986,
8,
198,
220,
1288,
9608,
3712,
8086,
81,
6030,
7,
36,
11,
33986,
8,
198,
437,
26,
198,
2,
356,
836,
470,
765,
3748,
62,
9630,
41888,
25,
85,
18242,
11,
1058,
417,
9608,
60,
780,
356,
765,
284,
779,
198,
2,
14722,
284,
11986,
3488,
25831,
6583,
543,
743,
407,
307,
8677,
425,
198,
31,
330,
2617,
62,
4906,
3498,
18449,
37065,
7,
464,
652,
33986,
276,
37065,
11,
6376,
41888,
25,
10677,
11,
25,
83,
13655,
12962,
90,
13940,
23650,
19629,
198,
198,
37811,
2025,
1662,
378,
257,
376,
6561,
327,
7248,
351,
14722,
37811,
198,
7249,
3498,
18449,
3697,
50,
198,
220,
781,
82,
3712,
37,
7278,
198,
220,
14722,
3712,
47,
958,
90,
38469,
90,
13940,
23650,
5512,
20650,
90,
13940,
23650,
11709,
1303,
6167,
13760,
290,
13015,
198,
220,
2163,
3498,
18449,
3697,
50,
7,
69,
3712,
37,
7278,
11,
300,
3712,
47,
958,
90,
38469,
90,
13940,
23650,
5512,
20650,
90,
13940,
23650,
11709,
8,
198,
220,
220,
220,
329,
27887,
287,
300,
198,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
75,
8937,
8,
855,
13664,
7,
7248,
7,
75,
8937,
4008,
8614,
4049,
7203,
23912,
1424,
1276,
307,
3748,
25,
720,
75,
8937,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
4129,
7,
75,
58,
16,
12962,
6624,
299,
42632,
7,
69,
11,
1058,
53,
8,
8614,
4049,
7203,
1939,
47315,
1303,
286,
410,
23912,
1424,
29568,
75,
58,
16,
12962,
4943,
198,
220,
220,
220,
4129,
7,
75,
58,
17,
12962,
6624,
299,
42632,
7,
69,
11,
1058,
36,
8,
8614,
4049,
7203,
1939,
47315,
1303,
286,
1288,
397,
1424,
29568,
75,
58,
17,
12962,
4943,
198,
220,
220,
220,
1441,
649,
7,
69,
11,
300,
8,
198,
220,
886,
198,
437,
198,
198,
37811,
15457,
37423,
14722,
286,
4823,
10238,
376,
6561,
37811,
198,
8818,
25357,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
410,
3712,
13940,
23650,
2599,
25,
5317,
198,
220,
1441,
1064,
11085,
7,
855,
7,
85,
828,
781,
82,
13,
23912,
1424,
58,
16,
12962,
198,
437,
198,
198,
37811,
15457,
5743,
14722,
286,
4823,
10238,
376,
6561,
37811,
198,
8818,
304,
72,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
410,
3712,
13940,
23650,
2599,
25,
5317,
198,
220,
1441,
1064,
11085,
7,
855,
7,
85,
828,
781,
82,
13,
23912,
1424,
58,
17,
12962,
198,
437,
198,
198,
37811,
2949,
47314,
11,
20861,
37067,
37811,
198,
8818,
376,
6561,
15003,
7,
70,
3712,
33986,
276,
37065,
2599,
25,
33986,
276,
3697,
50,
198,
220,
781,
82,
796,
1610,
82,
3419,
198,
220,
751,
62,
42632,
0,
7,
2704,
82,
11,
1058,
53,
11,
299,
85,
7,
70,
4008,
198,
220,
751,
62,
42632,
0,
7,
2704,
82,
11,
1058,
35,
85,
11,
299,
85,
7,
70,
828,
288,
53,
28,
16,
25,
48005,
7,
70,
828,
288,
85,
13912,
28,
16,
25,
48005,
7,
70,
4008,
198,
220,
751,
62,
42632,
0,
7,
2704,
82,
11,
1058,
36,
11,
497,
7,
70,
4008,
198,
220,
900,
62,
7266,
3911,
0,
7,
2704,
82,
11,
1058,
10677,
11,
308,
58,
25,
10677,
12962,
198,
220,
900,
62,
7266,
3911,
0,
7,
2704,
82,
11,
1058,
83,
13655,
11,
308,
58,
25,
83,
13655,
12962,
198,
220,
900,
62,
7266,
3911,
0,
7,
2704,
82,
11,
1058,
15763,
11,
352,
25,
48005,
7,
70,
4008,
198,
220,
1441,
3498,
18449,
3697,
50,
7,
2704,
82,
11,
308,
58,
25,
85,
18242,
60,
5218,
308,
58,
25,
417,
9608,
12962,
198,
437,
198,
198,
37811,
3855,
262,
725,
315,
3458,
16362,
286,
257,
376,
6561,
37811,
198,
8818,
651,
62,
10989,
6713,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
6808,
3712,
13940,
23650,
2599,
25,
33986,
276,
37065,
198,
220,
581,
796,
3498,
18449,
37065,
3419,
198,
220,
277,
796,
781,
82,
13,
2704,
82,
198,
220,
686,
5092,
796,
25357,
7,
2704,
82,
11,
6808,
8,
198,
220,
13760,
796,
277,
13,
521,
1063,
58,
25,
67,
53,
7131,
305,
5092,
60,
198,
220,
13015,
796,
277,
13,
521,
1063,
58,
25,
67,
36,
7131,
305,
5092,
60,
198,
220,
299,
9043,
713,
796,
360,
713,
26933,
72,
14804,
68,
329,
357,
68,
11,
1312,
8,
287,
27056,
378,
7,
77,
4147,
8,
12962,
198,
220,
410,
23912,
796,
685,
2704,
82,
13,
23912,
1424,
58,
16,
7131,
69,
58,
25,
67,
85,
13912,
7131,
72,
11907,
329,
1312,
287,
13760,
60,
198,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
53,
11,
4129,
7,
77,
4147,
828,
410,
18242,
28,
19279,
397,
8,
198,
220,
1225,
1045,
796,
47527,
68,
11,
277,
58,
25,
67,
50,
6015,
7131,
68,
4357,
277,
58,
25,
67,
51,
13655,
7131,
68,
12962,
329,
304,
287,
13015,
60,
198,
220,
329,
357,
68,
11,
264,
11,
256,
8,
287,
1225,
1045,
198,
220,
220,
220,
1288,
397,
796,
781,
82,
13,
23912,
1424,
58,
17,
7131,
69,
58,
25,
2934,
13912,
7131,
68,
11907,
198,
220,
220,
220,
751,
62,
3911,
0,
7,
411,
11,
1058,
36,
11,
12351,
28,
77,
9043,
713,
58,
82,
4357,
256,
13655,
28,
77,
9043,
713,
58,
83,
4357,
1288,
9608,
28,
417,
397,
8,
198,
220,
886,
198,
220,
1441,
581,
198,
437,
198,
198,
37811,
3855,
2187,
27763,
357,
1758,
87,
938,
6376,
828,
393,
655,
262,
2779,
286,
286,
262,
27763,
37811,
198,
8818,
651,
62,
49180,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
40167,
3712,
13940,
23650,
11,
2779,
3712,
33,
970,
28,
9562,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
3712,
38176,
90,
18465,
11,
3498,
18449,
37065,
92,
198,
220,
277,
796,
781,
82,
13,
2704,
82,
198,
220,
40167,
274,
796,
781,
82,
13,
23912,
1424,
58,
16,
7131,
69,
58,
25,
1758,
87,
11907,
198,
220,
27763,
62,
521,
796,
1064,
11085,
7,
855,
7,
1758,
87,
828,
40167,
274,
8,
198,
220,
611,
27763,
62,
521,
24844,
2147,
198,
220,
220,
220,
1441,
2147,
198,
220,
886,
198,
220,
581,
796,
3498,
18449,
37065,
3419,
198,
220,
269,
85,
11,
2906,
796,
685,
69,
13,
521,
1063,
58,
87,
7131,
49180,
62,
521,
60,
329,
2124,
287,
685,
25,
66,
53,
11,
1058,
66,
36,
11907,
198,
220,
302,
521,
796,
685,
19796,
11085,
7,
855,
7,
72,
828,
269,
85,
8,
329,
1312,
287,
352,
37498,
271,
28920,
7,
33967,
8,
5633,
657,
1058,
5415,
7,
33967,
4008,
60,
198,
220,
410,
23912,
796,
781,
82,
13,
23912,
1424,
58,
16,
7131,
69,
58,
25,
33967,
13912,
7131,
33967,
11907,
198,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
53,
11,
4129,
7,
33967,
828,
410,
18242,
28,
19279,
397,
8,
628,
220,
1288,
397,
796,
781,
82,
13,
23912,
1424,
58,
17,
7131,
69,
58,
25,
344,
13912,
7131,
344,
11907,
198,
220,
1658,
796,
302,
521,
58,
69,
58,
25,
66,
50,
6015,
7131,
344,
11907,
198,
220,
2123,
796,
302,
521,
58,
69,
58,
25,
66,
51,
13655,
7131,
344,
11907,
198,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
36,
11,
4129,
7,
344,
828,
1288,
9608,
28,
417,
397,
11,
12351,
28,
274,
11,
256,
13655,
28,
316,
8,
198,
220,
611,
5145,
8692,
198,
220,
220,
220,
613,
87,
796,
751,
62,
3911,
0,
7,
411,
11,
1058,
53,
11,
410,
18242,
28,
2704,
82,
13,
23912,
1424,
58,
16,
7131,
69,
58,
25,
1758,
87,
7131,
49180,
62,
521,
11907,
8,
198,
220,
220,
220,
7405,
796,
277,
13,
521,
1063,
58,
25,
1455,
34,
505,
7131,
49180,
62,
521,
60,
198,
220,
220,
220,
1288,
796,
781,
82,
13,
23912,
1424,
58,
17,
7131,
69,
58,
25,
1455,
37021,
7131,
1455,
82,
11907,
198,
220,
220,
220,
256,
70,
796,
302,
521,
58,
69,
58,
25,
1455,
51,
13655,
7131,
1455,
82,
11907,
198,
220,
220,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
36,
11,
4129,
7,
1455,
82,
828,
1288,
9608,
28,
417,
11,
12351,
28,
24900,
11,
256,
13655,
28,
25297,
8,
198,
220,
886,
198,
220,
1441,
581,
198,
437,
198,
198,
37811,
11627,
974,
262,
10238,
4823,
357,
3919,
37067,
14,
1102,
274,
8,
37811,
198,
8818,
651,
62,
15952,
2611,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
2599,
25,
33986,
276,
37065,
198,
220,
581,
796,
3498,
18449,
37065,
3419,
198,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
53,
11,
4129,
7,
2704,
82,
13,
23912,
1424,
58,
16,
46570,
410,
18242,
28,
2704,
82,
13,
23912,
1424,
58,
16,
12962,
198,
220,
751,
62,
42632,
0,
7,
411,
11,
1058,
36,
11,
4129,
7,
2704,
82,
13,
23912,
1424,
58,
17,
46570,
12351,
28,
2704,
82,
13,
2704,
82,
58,
25,
10677,
4357,
256,
13655,
28,
2704,
82,
13,
2704,
82,
58,
25,
83,
13655,
4357,
1288,
9608,
28,
2704,
82,
13,
23912,
1424,
58,
17,
12962,
198,
220,
1441,
581,
198,
437,
198,
198,
37811,
3855,
477,
45309,
13532,
3599,
379,
257,
1948,
10139,
37811,
198,
8818,
477,
62,
6978,
82,
7,
2704,
82,
11,
6808,
3712,
13940,
23650,
2599,
25,
35422,
1068,
35,
713,
90,
38469,
90,
13940,
23650,
5512,
2558,
92,
198,
220,
581,
796,
14230,
1068,
35,
713,
90,
38469,
90,
13940,
23650,
5512,
2558,
92,
3419,
198,
220,
686,
5092,
796,
25357,
7,
2704,
82,
11,
6808,
8,
198,
220,
277,
796,
781,
82,
13,
2704,
82,
198,
220,
6808,
521,
796,
277,
58,
25,
15763,
7131,
305,
5092,
60,
198,
220,
8931,
796,
309,
29291,
90,
5317,
11,
38469,
90,
13940,
23650,
11709,
58,
7,
15763,
521,
11,
685,
12962,
60,
198,
220,
1775,
796,
5345,
3419,
198,
220,
981,
5145,
271,
28920,
7,
25558,
8,
198,
220,
220,
220,
1090,
81,
17440,
11,
1090,
81,
6978,
796,
1461,
0,
7,
25558,
8,
198,
220,
220,
220,
581,
58,
22019,
81,
6978,
60,
796,
1090,
81,
17440,
198,
220,
220,
220,
611,
5145,
7,
22019,
81,
17440,
287,
1775,
8,
198,
220,
220,
220,
220,
220,
4574,
0,
7,
15898,
11,
1090,
81,
17440,
8,
198,
220,
220,
220,
220,
220,
329,
304,
287,
277,
13,
521,
1063,
58,
25,
67,
50,
6015,
7131,
22019,
81,
17440,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1796,
62,
68,
796,
277,
58,
25,
2934,
13912,
7131,
68,
60,
198,
220,
220,
220,
220,
220,
220,
220,
304,
62,
1837,
23650,
796,
781,
82,
13,
23912,
1424,
58,
17,
7131,
11612,
62,
68,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1306,
17440,
796,
277,
58,
25,
67,
51,
13655,
7131,
68,
60,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
25558,
11,
357,
19545,
17440,
11,
410,
9246,
7,
22019,
81,
6978,
11,
685,
68,
62,
1837,
23650,
60,
22305,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
628,
220,
1441,
581,
198,
437,
198,
198,
37811,
198,
4550,
257,
16362,
810,
262,
717,
10139,
318,
262,
6808,
13,
3498,
1424,
7603,
3488,
25831,
1042,
13,
198,
37811,
198,
8818,
751,
62,
10989,
6713,
0,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
288,
3712,
33986,
276,
37065,
2599,
25,
18465,
198,
220,
6808,
1203,
796,
3498,
18449,
37065,
3419,
198,
220,
751,
62,
42632,
0,
7,
15763,
1203,
11,
1058,
53,
11,
299,
85,
7,
67,
828,
410,
18242,
28,
67,
58,
25,
85,
18242,
12962,
198,
220,
329,
357,
68,
11,
357,
824,
11,
256,
83,
4008,
287,
27056,
378,
7,
13344,
7,
67,
58,
25,
10677,
4357,
288,
58,
25,
83,
13655,
60,
4008,
198,
220,
220,
220,
611,
256,
83,
14512,
352,
198,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
15763,
1203,
11,
1058,
36,
11,
1288,
9608,
28,
67,
58,
25,
417,
9608,
7131,
68,
4357,
12351,
28,
824,
11,
256,
13655,
28,
926,
8,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
1353,
2770,
62,
30619,
7,
15763,
1203,
8,
220,
1303,
1276,
307,
936,
88,
565,
291,
11,
706,
10829,
23607,
284,
6808,
198,
220,
6808,
796,
288,
58,
25,
85,
18242,
7131,
16,
60,
198,
220,
686,
5092,
796,
25357,
7,
2704,
82,
11,
6808,
8,
198,
220,
1303,
13532,
326,
1541,
2152,
287,
262,
376,
6561,
198,
220,
4067,
796,
477,
62,
6978,
82,
7,
2704,
82,
11,
6808,
8,
198,
220,
277,
796,
781,
82,
13,
2704,
82,
198,
220,
1775,
796,
360,
713,
90,
5317,
11,
2558,
92,
3419,
1303,
6376,
287,
288,
5218,
6376,
287,
376,
6561,
16362,
198,
220,
1303,
357,
9630,
287,
288,
11,
6376,
287,
376,
6561,
16362,
11,
3108,
287,
288,
8,
198,
220,
8931,
796,
309,
29291,
90,
5317,
11,
5317,
11,
38469,
90,
13940,
23650,
11709,
58,
7,
16,
11,
277,
58,
25,
15763,
7131,
305,
5092,
4357,
38357,
58,
12962,
60,
198,
220,
981,
5145,
271,
28920,
7,
25558,
8,
198,
220,
220,
220,
288,
17440,
11,
1090,
81,
17440,
11,
1090,
81,
6978,
796,
1461,
0,
7,
25558,
8,
198,
220,
220,
220,
1775,
58,
67,
17440,
60,
796,
1090,
81,
17440,
198,
220,
220,
220,
410,
18242,
796,
288,
58,
25,
85,
18242,
7131,
67,
17440,
60,
198,
220,
220,
220,
1306,
276,
3212,
796,
288,
13,
521,
1063,
58,
25,
10677,
7131,
67,
17440,
60,
198,
220,
220,
220,
329,
304,
287,
1306,
276,
3212,
198,
220,
220,
220,
220,
220,
1288,
397,
796,
288,
58,
25,
417,
9608,
7131,
68,
60,
198,
220,
220,
220,
220,
220,
1796,
62,
14907,
796,
304,
72,
7,
2704,
82,
11,
1288,
397,
8,
198,
220,
220,
220,
220,
220,
1306,
6978,
796,
410,
9246,
7,
22019,
81,
6978,
11,
685,
417,
397,
12962,
198,
220,
220,
220,
220,
220,
1775,
32109,
796,
3991,
198,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
24886,
11,
1306,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1306,
17440,
796,
4067,
58,
19545,
6978,
60,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1306,
62,
67,
796,
288,
58,
25,
83,
13655,
7131,
68,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1306,
62,
11612,
796,
25357,
7,
2704,
82,
11,
288,
58,
25,
85,
18242,
7131,
19545,
62,
67,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
15898,
11,
1306,
62,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1306,
17440,
796,
1775,
58,
19545,
62,
67,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1775,
32109,
28,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1306,
17440,
796,
751,
62,
3911,
0,
7,
69,
11,
1058,
35,
85,
11,
288,
53,
28,
305,
5092,
11,
288,
85,
13912,
28,
19545,
62,
11612,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
69,
11,
1058,
5005,
11,
288,
50,
6015,
28,
22019,
81,
17440,
11,
288,
51,
13655,
28,
19545,
17440,
11,
198,
220,
220,
220,
220,
220,
220,
220,
288,
36,
28,
305,
5092,
11,
390,
13912,
28,
11612,
62,
14907,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
611,
5145,
15898,
32109,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
25558,
11,
357,
67,
58,
25,
83,
13655,
7131,
68,
4357,
1306,
17440,
11,
1306,
6978,
4008,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
437,
198,
37811,
198,
4550,
257,
27763,
11,
13148,
262,
938,
37423,
286,
262,
4823,
318,
262,
40167,
198,
37811,
198,
8818,
751,
62,
49180,
0,
7,
2704,
82,
3712,
33986,
276,
3697,
50,
11,
269,
3712,
33986,
276,
37065,
2599,
25,
18465,
198,
220,
277,
796,
781,
82,
13,
2704,
82,
198,
220,
369,
316,
13655,
796,
25357,
7,
2704,
82,
11,
269,
58,
25,
85,
18242,
7131,
437,
12962,
198,
220,
8654,
1102,
274,
796,
410,
9246,
7,
69,
13,
521,
1063,
58,
25,
1758,
87,
60,
23029,
198,
220,
2488,
30493,
5145,
7,
1102,
316,
13655,
287,
8654,
1102,
274,
8,
366,
2949,
517,
621,
530,
27763,
319,
257,
1813,
37423,
1,
198,
220,
27763,
62,
312,
796,
751,
62,
3911,
0,
7,
69,
11,
1058,
34,
505,
8,
198,
220,
9421,
62,
2340,
796,
751,
62,
42632,
0,
7,
69,
11,
1058,
34,
85,
11,
299,
85,
7,
66,
13219,
16,
11,
269,
53,
28,
49180,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
85,
13912,
41888,
8903,
7,
2704,
82,
11,
300,
8,
329,
300,
287,
269,
58,
25,
85,
18242,
7131,
16,
25,
437,
12,
16,
11907,
8,
198,
220,
1729,
1455,
82,
796,
685,
72,
329,
357,
72,
11,
256,
8,
287,
27056,
378,
7,
66,
58,
25,
10677,
12962,
611,
256,
0,
28,
48005,
7,
66,
15437,
198,
220,
7405,
220,
796,
685,
72,
329,
357,
72,
11,
256,
8,
287,
27056,
378,
7,
66,
58,
25,
10677,
12962,
611,
256,
855,
48005,
7,
66,
15437,
198,
220,
795,
499,
11,
443,
8899,
796,
16410,
20295,
7,
2704,
82,
11,
300,
8,
329,
300,
287,
269,
58,
25,
417,
9608,
7131,
87,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
2124,
287,
685,
13159,
1455,
82,
11,
7405,
11907,
198,
220,
1658,
6015,
796,
9421,
62,
2340,
58,
66,
58,
25,
10677,
7131,
13159,
1455,
82,
11907,
198,
220,
2123,
13655,
11,
1309,
13655,
796,
685,
1851,
62,
2340,
58,
66,
58,
25,
83,
13655,
7131,
87,
11907,
329,
2124,
287,
685,
13159,
1455,
82,
11,
7405,
11907,
198,
220,
751,
62,
42632,
0,
7,
69,
11,
1058,
34,
68,
11,
4129,
7,
13159,
1455,
82,
828,
269,
36,
28,
49180,
62,
312,
11,
2906,
13912,
28,
368,
499,
11,
269,
50,
6015,
28,
274,
6015,
11,
269,
51,
13655,
28,
316,
13655,
8,
198,
220,
900,
62,
7266,
3911,
0,
7,
69,
11,
27763,
62,
312,
11,
1058,
1758,
87,
11,
25357,
7,
2704,
82,
11,
269,
58,
25,
85,
18242,
7131,
48005,
7,
66,
15437,
4008,
198,
220,
751,
62,
42632,
0,
7,
69,
11,
1058,
11484,
11,
4129,
7,
1455,
82,
828,
1232,
34,
505,
28,
49180,
62,
312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1232,
37021,
28,
293,
8899,
11,
1232,
51,
13655,
28,
1616,
13655,
8,
198,
220,
1441,
2147,
198,
437,
628,
198,
37811,
198,
16447,
257,
14174,
17548,
357,
3919,
47314,
8,
1912,
319,
257,
327,
7248,
10470,
198,
37811,
198,
8818,
3797,
18302,
62,
1462,
62,
29127,
7,
18302,
3712,
34695,
341,
2599,
25,
33986,
276,
3697,
50,
198,
220,
10201,
796,
906,
13,
8612,
2024,
58,
25,
5944,
60,
198,
220,
289,
3150,
796,
906,
13,
8612,
2024,
58,
25,
28718,
60,
198,
220,
410,
23912,
796,
685,
87,
13,
22046,
58,
16,
60,
329,
2124,
287,
10201,
60,
198,
220,
267,
11600,
796,
360,
713,
26933,
78,
5218,
1312,
329,
357,
72,
11,
267,
8,
287,
27056,
378,
7,
8158,
8,
12962,
198,
220,
4686,
37047,
1443,
796,
685,
13940,
23650,
7203,
62,
312,
62,
1,
9,
8841,
7,
85,
4008,
329,
410,
287,
410,
23912,
60,
198,
220,
1288,
397,
796,
410,
9246,
26933,
87,
13,
22046,
58,
16,
60,
329,
2124,
287,
289,
3150,
4357,
4686,
37047,
1443,
8,
198,
220,
1303,
13610,
4238,
4823,
198,
220,
308,
796,
3498,
18449,
37065,
3419,
198,
220,
299,
11,
299,
71,
796,
4129,
7,
19279,
397,
828,
4129,
7,
71,
3150,
8,
198,
220,
751,
62,
42632,
0,
7,
70,
11,
1058,
53,
11,
299,
11,
410,
18242,
28,
19279,
397,
8,
198,
220,
12351,
82,
796,
410,
9246,
26933,
375,
713,
58,
71,
13,
4906,
62,
22046,
58,
16,
11907,
329,
289,
287,
289,
3150,
4357,
352,
25,
77,
8,
198,
220,
256,
70,
912,
796,
410,
9246,
26933,
375,
713,
58,
71,
13,
4906,
62,
22046,
58,
17,
11907,
329,
289,
287,
289,
3150,
4357,
352,
25,
77,
8,
198,
220,
751,
62,
42632,
0,
7,
70,
11,
1058,
36,
11,
299,
71,
10,
77,
11,
12351,
28,
10677,
82,
11,
256,
13655,
28,
25297,
912,
11,
1288,
9608,
28,
417,
397,
8,
198,
220,
781,
82,
796,
376,
6561,
15003,
7,
70,
8,
198,
220,
1303,
3060,
37067,
198,
220,
329,
357,
79,
16,
11,
279,
17,
8,
287,
906,
13,
4853,
602,
198,
220,
220,
220,
288,
796,
13532,
62,
1462,
62,
10989,
6713,
7,
79,
16,
11,
279,
17,
8,
198,
220,
220,
220,
751,
62,
10989,
6713,
0,
7,
2704,
82,
11,
288,
8,
198,
220,
886,
198,
220,
1441,
781,
82,
198,
437,
198,
198,
37811,
16447,
257,
16362,
422,
257,
3108,
10537,
37811,
198,
8818,
13532,
62,
1462,
62,
10989,
6713,
7,
79,
16,
11,
279,
17,
2599,
25,
33986,
276,
37065,
198,
220,
288,
796,
3498,
18449,
37065,
3419,
198,
220,
6808,
796,
279,
16,
13,
4906,
62,
22046,
58,
16,
4083,
22046,
58,
16,
60,
198,
220,
751,
62,
3911,
0,
7,
67,
11,
1058,
53,
11,
410,
18242,
28,
15763,
8,
198,
220,
2163,
751,
62,
6978,
0,
7,
9688,
3712,
33,
970,
11,
279,
2599,
25,
18465,
198,
220,
220,
220,
2170,
796,
2099,
1659,
7,
79,
737,
17143,
7307,
58,
16,
60,
198,
220,
220,
220,
611,
2170,
6624,
1058,
312,
198,
220,
220,
220,
220,
220,
611,
923,
198,
220,
220,
220,
220,
220,
220,
220,
256,
13655,
796,
751,
62,
3911,
0,
7,
67,
11,
1058,
53,
11,
410,
18242,
28,
15763,
8,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
256,
13655,
796,
299,
42632,
7,
67,
11,
1058,
53,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
1288,
397,
796,
38357,
7203,
62,
312,
62,
1,
9,
8841,
7,
15763,
4008,
198,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
67,
11,
1058,
36,
11,
12351,
28,
16,
11,
256,
13655,
28,
83,
13655,
11,
1288,
9608,
28,
417,
397,
8,
198,
220,
220,
220,
2073,
361,
2170,
6624,
1058,
785,
3455,
198,
220,
220,
220,
220,
220,
289,
3150,
796,
279,
13,
22046,
198,
220,
220,
220,
220,
220,
1090,
81,
796,
352,
198,
220,
220,
220,
220,
220,
611,
923,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
4129,
7,
71,
3150,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
299,
42632,
7,
67,
11,
1058,
53,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
329,
357,
72,
11,
3488,
8,
287,
27056,
378,
7,
71,
3150,
8,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
67,
11,
1058,
53,
11,
410,
18242,
28,
26452,
13,
4906,
62,
22046,
58,
17,
4083,
22046,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
4129,
7,
71,
3150,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
13655,
796,
938,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
13655,
796,
1090,
81,
10,
16,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
67,
11,
1058,
36,
11,
12351,
28,
22019,
81,
11,
256,
13655,
28,
83,
13655,
11,
1288,
9608,
28,
26452,
13,
22046,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
1090,
81,
15853,
352,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
361,
2170,
6624,
1058,
8612,
1352,
198,
220,
220,
220,
220,
220,
611,
923,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
751,
62,
3911,
0,
7,
67,
11,
1058,
53,
11,
410,
18242,
28,
79,
13,
4906,
62,
22046,
58,
17,
4083,
22046,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
299,
42632,
7,
67,
11,
1058,
53,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
751,
62,
3911,
0,
7,
67,
11,
1058,
36,
11,
12351,
28,
16,
11,
256,
13655,
796,
938,
11,
1288,
9608,
28,
79,
13,
22046,
58,
16,
12962,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
2488,
30493,
3991,
366,
3673,
5597,
329,
2099,
720,
28004,
1,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2147,
198,
220,
886,
198,
220,
751,
62,
6978,
0,
7,
7942,
11,
279,
16,
8,
198,
220,
751,
62,
6978,
0,
7,
9562,
11,
279,
17,
8,
198,
220,
1441,
288,
198,
437,
198
] | 2.217151 | 5,982 |
# Test specific data for one network:
println("- number/case9 check")
mpc = loadcase("case9")
gencost = [
2.0 1500.0 0.0 3.0 0.11 5.0 150.0
2.0 2000.0 0.0 3.0 0.085 1.2 600.0
2.0 3000.0 0.0 3.0 0.1225 1.0 335.0
]
@test mpc["gencost"] == gencost
# Ensure these networks exist in the `data`:
println("- file check")
@test issubset(["case96","case1354pegase"], casenames())
# Ensure every network's mpc Dict contains these keys:
println("- key check")
# key_list = ["gen";"branch" ;"docstring";"bus"]
key_list = ["gen";"branch";"bus"]
key_test = Bool[]
for name in casenames()
mpc = loadcase(name,describe=false)
push!(key_test,key_list ⊆ [key for key in keys(mpc)])
end
@test all(key_test)
println("- graceful failure test")
@test_throws ErrorException loadcase("invalidcasename")
@test_throws ErrorException loadcase("doesnotexist.mat")
| [
2,
6208,
2176,
1366,
329,
530,
3127,
25,
198,
35235,
7203,
12,
1271,
14,
7442,
24,
2198,
4943,
198,
3149,
66,
796,
3440,
7442,
7203,
7442,
24,
4943,
198,
5235,
15805,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
15,
220,
20007,
13,
15,
220,
657,
13,
15,
220,
513,
13,
15,
220,
657,
13,
1157,
220,
220,
220,
642,
13,
15,
220,
6640,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
15,
220,
4751,
13,
15,
220,
657,
13,
15,
220,
513,
13,
15,
220,
657,
13,
2919,
20,
220,
220,
352,
13,
17,
220,
10053,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
362,
13,
15,
220,
20343,
13,
15,
220,
657,
13,
15,
220,
513,
13,
15,
220,
657,
13,
1065,
1495,
220,
352,
13,
15,
220,
37144,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
31,
9288,
285,
14751,
14692,
5235,
15805,
8973,
6624,
2429,
15805,
198,
198,
2,
48987,
777,
7686,
2152,
287,
262,
4600,
7890,
63,
25,
198,
35235,
7203,
12,
2393,
2198,
4943,
198,
31,
9288,
1189,
549,
2617,
7,
14692,
7442,
4846,
2430,
7442,
1485,
4051,
22071,
589,
33116,
6124,
268,
1047,
28955,
198,
198,
2,
48987,
790,
3127,
338,
285,
14751,
360,
713,
4909,
777,
8251,
25,
198,
35235,
7203,
12,
1994,
2198,
4943,
198,
2,
1994,
62,
4868,
796,
14631,
5235,
8172,
1,
1671,
3702,
1,
2162,
1,
15390,
8841,
8172,
1,
10885,
8973,
198,
2539,
62,
4868,
796,
14631,
5235,
8172,
1,
1671,
3702,
8172,
1,
10885,
8973,
198,
2539,
62,
9288,
796,
347,
970,
21737,
198,
1640,
1438,
287,
6124,
268,
1047,
3419,
198,
220,
220,
220,
285,
14751,
796,
3440,
7442,
7,
3672,
11,
20147,
4892,
28,
9562,
8,
198,
220,
220,
220,
4574,
0,
7,
2539,
62,
9288,
11,
2539,
62,
4868,
2343,
232,
228,
685,
2539,
329,
1994,
287,
8251,
7,
3149,
66,
8,
12962,
198,
437,
198,
31,
9288,
477,
7,
2539,
62,
9288,
8,
198,
198,
35235,
7203,
12,
44363,
5287,
1332,
4943,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
3440,
7442,
7203,
259,
12102,
34004,
12453,
4943,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
3440,
7442,
7203,
22437,
1662,
38476,
13,
6759,
4943,
198
] | 2.380952 | 378 |
"""
grdvolume(cmd0::String="", arg1=[], kwargs...)
Reads one 2-D grid and returns xyz-triplets.
Full option list at [`grdvolume`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html)
Parameters
----------
- **C** : **contour** : -- Str or List -- Flags = cval or low/high/delta or rlow/high or rcval
Find area, volume and mean height (volume/area) inside the cval contour.
[`-C`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html#c)
- **L** : **base_level** : -- Number -- Flags = base
Also add in the volume from the level of the contour down to base [Default base is contour].
[`-L`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html#l)
- $(GMT.opt_R)
- **S** : **unit** : -- Str -- Flags = e|f|k|M|n|u
For geographical grids, append a unit from e|f|k|M|n|u [Default is meter (e)].
[`-S`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html#s)
- **T** : -- Str -- Flags = [c|h]
Determine the single contour that maximized the average height (= volume/area).
[`-T`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html#t)
- $(GMT.opt_V)
- **Z** : **scale** : -- Str or List -- Flags = fact[/shift]
Optionally subtract shift before scaling data by fact. [Default is no scaling].
[`-Z`](http://gmt.soest.hawaii.edu/doc/latest/grdvolume.html#z)
- $(GMT.opt_f)
- $(GMT.opt_o)
"""
function grdvolume(cmd0::String="", arg1=[]; kwargs...)
length(kwargs) == 0 && occursin(" -", cmd0) && return monolitic("grdvolume", cmd0, arg1) # Speedy mode
d = KW(kwargs)
cmd, = parse_R("", d)
cmd = parse_V_params(cmd, d)
cmd, = parse_f(cmd, d)
cmd, = parse_o(cmd, d)
cmd = add_opt(cmd, 'C', d, [:C :contour])
cmd = add_opt(cmd, 'L', d, [:L :base_level])
cmd = add_opt(cmd, 'S', d, [:S :unit])
cmd = add_opt(cmd, 'T', d, [:T])
cmd = add_opt(cmd, 'Z', d, [:Z :scale])
cmd, got_fname, arg1 = find_data(d, cmd0, cmd, 1, arg1)
return common_grd(d, cmd, got_fname, 1, "grdvolume", arg1) # Finish build cmd and run it
end
# ---------------------------------------------------------------------------------------------------
grdvolume(arg1=[], cmd0::String=""; kw...) = grdvolume(cmd0, arg1; kw...) | [
37811,
198,
197,
2164,
67,
29048,
7,
28758,
15,
3712,
10100,
2625,
1600,
1822,
16,
41888,
4357,
479,
86,
22046,
23029,
198,
198,
5569,
82,
530,
362,
12,
35,
10706,
290,
5860,
2124,
45579,
12,
28461,
46916,
13,
198,
198,
13295,
3038,
1351,
379,
685,
63,
2164,
67,
29048,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
8,
198,
198,
48944,
198,
35937,
198,
198,
12,
12429,
34,
1174,
1058,
12429,
3642,
454,
1174,
1058,
1377,
4285,
393,
7343,
1377,
220,
220,
34771,
796,
269,
2100,
393,
1877,
14,
8929,
14,
67,
12514,
393,
374,
9319,
14,
8929,
393,
48321,
2100,
628,
220,
220,
220,
9938,
1989,
11,
6115,
290,
1612,
6001,
357,
29048,
14,
20337,
8,
2641,
262,
269,
2100,
542,
454,
13,
198,
220,
220,
220,
685,
63,
12,
34,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
2,
66,
8,
198,
12,
12429,
43,
1174,
1058,
12429,
8692,
62,
5715,
1174,
1058,
1377,
7913,
1377,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34771,
796,
2779,
628,
220,
220,
220,
4418,
751,
287,
262,
6115,
422,
262,
1241,
286,
262,
542,
454,
866,
284,
2779,
685,
19463,
2779,
318,
542,
454,
4083,
198,
220,
220,
220,
685,
63,
12,
43,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
2,
75,
8,
198,
12,
29568,
49424,
13,
8738,
62,
49,
8,
198,
12,
12429,
50,
1174,
1058,
12429,
20850,
1174,
1058,
1377,
4285,
1377,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34771,
796,
304,
91,
69,
91,
74,
91,
44,
91,
77,
91,
84,
628,
220,
220,
220,
1114,
27465,
50000,
11,
24443,
257,
4326,
422,
304,
91,
69,
91,
74,
91,
44,
91,
77,
91,
84,
685,
19463,
318,
16430,
357,
68,
25295,
198,
220,
220,
220,
685,
63,
12,
50,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
2,
82,
8,
198,
12,
12429,
51,
1174,
1058,
1377,
4285,
1377,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34771,
796,
685,
66,
91,
71,
60,
628,
220,
220,
220,
45559,
3810,
262,
2060,
542,
454,
326,
12991,
1143,
262,
2811,
6001,
46121,
6115,
14,
20337,
737,
198,
220,
220,
220,
685,
63,
12,
51,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
2,
83,
8,
198,
12,
29568,
49424,
13,
8738,
62,
53,
8,
198,
12,
12429,
57,
1174,
1058,
12429,
9888,
1174,
1058,
1377,
4285,
393,
7343,
1377,
220,
220,
220,
220,
34771,
796,
1109,
13412,
30846,
60,
628,
220,
220,
220,
16018,
453,
34128,
6482,
878,
20796,
1366,
416,
1109,
13,
685,
19463,
318,
645,
20796,
4083,
198,
220,
220,
220,
685,
63,
12,
57,
63,
16151,
4023,
1378,
70,
16762,
13,
568,
395,
13,
26615,
42648,
13,
15532,
14,
15390,
14,
42861,
14,
2164,
67,
29048,
13,
6494,
2,
89,
8,
198,
12,
29568,
49424,
13,
8738,
62,
69,
8,
198,
12,
29568,
49424,
13,
8738,
62,
78,
8,
198,
37811,
198,
8818,
1036,
67,
29048,
7,
28758,
15,
3712,
10100,
2625,
1600,
1822,
16,
41888,
11208,
479,
86,
22046,
23029,
628,
197,
13664,
7,
46265,
22046,
8,
6624,
657,
11405,
8833,
259,
7203,
532,
1600,
23991,
15,
8,
11405,
1441,
937,
6212,
291,
7203,
2164,
67,
29048,
1600,
23991,
15,
11,
1822,
16,
8,
197,
2,
2531,
4716,
4235,
628,
197,
67,
796,
509,
54,
7,
46265,
22046,
8,
628,
197,
28758,
11,
796,
21136,
62,
49,
7203,
1600,
288,
8,
198,
197,
28758,
796,
21136,
62,
53,
62,
37266,
7,
28758,
11,
288,
8,
198,
197,
28758,
11,
796,
21136,
62,
69,
7,
28758,
11,
288,
8,
198,
197,
28758,
11,
796,
21136,
62,
78,
7,
28758,
11,
288,
8,
628,
197,
28758,
796,
751,
62,
8738,
7,
28758,
11,
705,
34,
3256,
288,
11,
685,
25,
34,
1058,
3642,
454,
12962,
198,
197,
28758,
796,
751,
62,
8738,
7,
28758,
11,
705,
43,
3256,
288,
11,
685,
25,
43,
1058,
8692,
62,
5715,
12962,
198,
197,
28758,
796,
751,
62,
8738,
7,
28758,
11,
705,
50,
3256,
288,
11,
685,
25,
50,
1058,
20850,
12962,
198,
197,
28758,
796,
751,
62,
8738,
7,
28758,
11,
705,
51,
3256,
288,
11,
685,
25,
51,
12962,
198,
197,
28758,
796,
751,
62,
8738,
7,
28758,
11,
705,
57,
3256,
288,
11,
685,
25,
57,
1058,
9888,
12962,
628,
197,
28758,
11,
1392,
62,
69,
3672,
11,
1822,
16,
796,
1064,
62,
7890,
7,
67,
11,
23991,
15,
11,
23991,
11,
352,
11,
1822,
16,
8,
198,
197,
7783,
2219,
62,
2164,
67,
7,
67,
11,
23991,
11,
1392,
62,
69,
3672,
11,
352,
11,
366,
2164,
67,
29048,
1600,
1822,
16,
8,
197,
197,
2,
32585,
1382,
23991,
290,
1057,
340,
198,
437,
198,
198,
2,
16529,
3880,
6329,
198,
2164,
67,
29048,
7,
853,
16,
41888,
4357,
23991,
15,
3712,
10100,
2625,
8172,
479,
86,
23029,
796,
1036,
67,
29048,
7,
28758,
15,
11,
1822,
16,
26,
479,
86,
23029
] | 2.417306 | 913 |
module LayerDicts
export LayerDict
struct LayerDict{K, V} <: AbstractDict{K, V}
dicts::Vector{<:AbstractDict}
end
function LayerDict(dicts::Tuple{Vararg{AbstractDict{K, V}}}) where {K, V}
return LayerDict{K, V}(collect(dicts))
end
function LayerDict(dicts::AbstractVector{<:AbstractDict{K, V}}) where {K, V}
return LayerDict{K, V}(dicts)
end
function LayerDict(dicts::AbstractVector{<:AbstractDict})
K, V = _kv_types(dicts)
return LayerDict{K, V}(dicts)
end
function LayerDict(dicts::Tuple{Vararg{AbstractDict}})
K, V = _kv_types(dicts)
return LayerDict{K, V}(collect(dicts))
end
LayerDict(::Tuple{}) = LayerDict{Any, Any}(AbstractDict[])
LayerDict(dicts::AbstractDict...) = LayerDict(dicts)
function _kv_types(dicts)
if isempty(dicts)
return (Any, Any)
end
first_dict = first(dicts)
K = keytype(first_dict)
V = valtype(first_dict)
for dict in dicts[2:end]
if K === Any && V === Any
break
end
K = typejoin(K, keytype(dict))
V = typejoin(V, valtype(dict))
end
return (K, V)
end
function Base.keys(ld::LayerDict{K}) where K
key_set = Set{K}()
for dict in ld.dicts
union!(key_set, keys(dict))
end
return key_set
end
Base.length(ld::LayerDict) = length(keys(ld))
function Base.iterate(ld::LayerDict, state=(keys(ld),))
ld_keys = first(state)
key_state = Base.tail(state)
@assert length(key_state) == 0 || length(key_state) == 1
iter = iterate(ld_keys, key_state...)
iter === nothing && return nothing
key, new_key_state = iter
return (key => ld[key]), (ld_keys, new_key_state)
end
function Base.getindex(ld::LayerDict{K, V}, key) where {K, V}
for dict in ld.dicts
if haskey(dict, key)
return dict[key]::V
end
end
throw(KeyError(key))
end
function Base.haskey(ld::LayerDict, key)
for dict in ld.dicts
if haskey(dict, key)
return true
end
end
return false
end
function Base.get(ld::LayerDict{K, V}, key, default::D) where {K, V, D}
ReturnType = typejoin(V, D)
for dict in ld.dicts
if haskey(dict, key)
return dict[key]::ReturnType
end
end
return default
end
function Base.get(f::Base.Callable, ld::LayerDict, key)
for dict in ld.dicts
if haskey(dict, key)
return dict[key]
end
end
return f()
end
end
| [
21412,
34398,
35,
14137,
198,
198,
39344,
34398,
35,
713,
198,
198,
7249,
34398,
35,
713,
90,
42,
11,
569,
92,
1279,
25,
27741,
35,
713,
90,
42,
11,
569,
92,
198,
220,
220,
220,
8633,
82,
3712,
38469,
90,
27,
25,
23839,
35,
713,
92,
198,
437,
198,
198,
8818,
34398,
35,
713,
7,
11600,
82,
3712,
51,
29291,
90,
19852,
853,
90,
23839,
35,
713,
90,
42,
11,
569,
11709,
30072,
810,
1391,
42,
11,
569,
92,
198,
220,
220,
220,
1441,
34398,
35,
713,
90,
42,
11,
569,
92,
7,
33327,
7,
11600,
82,
4008,
198,
437,
198,
198,
8818,
34398,
35,
713,
7,
11600,
82,
3712,
23839,
38469,
90,
27,
25,
23839,
35,
713,
90,
42,
11,
569,
11709,
8,
810,
1391,
42,
11,
569,
92,
198,
220,
220,
220,
1441,
34398,
35,
713,
90,
42,
11,
569,
92,
7,
11600,
82,
8,
198,
437,
198,
198,
8818,
34398,
35,
713,
7,
11600,
82,
3712,
23839,
38469,
90,
27,
25,
23839,
35,
713,
30072,
198,
220,
220,
220,
509,
11,
569,
796,
4808,
74,
85,
62,
19199,
7,
11600,
82,
8,
628,
220,
220,
220,
1441,
34398,
35,
713,
90,
42,
11,
569,
92,
7,
11600,
82,
8,
198,
437,
198,
198,
8818,
34398,
35,
713,
7,
11600,
82,
3712,
51,
29291,
90,
19852,
853,
90,
23839,
35,
713,
11709,
8,
198,
220,
220,
220,
509,
11,
569,
796,
4808,
74,
85,
62,
19199,
7,
11600,
82,
8,
628,
220,
220,
220,
1441,
34398,
35,
713,
90,
42,
11,
569,
92,
7,
33327,
7,
11600,
82,
4008,
198,
437,
198,
198,
49925,
35,
713,
7,
3712,
51,
29291,
90,
30072,
796,
34398,
35,
713,
90,
7149,
11,
4377,
92,
7,
23839,
35,
713,
58,
12962,
198,
198,
49925,
35,
713,
7,
11600,
82,
3712,
23839,
35,
713,
23029,
796,
34398,
35,
713,
7,
11600,
82,
8,
198,
198,
8818,
4808,
74,
85,
62,
19199,
7,
11600,
82,
8,
198,
220,
220,
220,
611,
318,
28920,
7,
11600,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
7149,
11,
4377,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
717,
62,
11600,
796,
717,
7,
11600,
82,
8,
198,
220,
220,
220,
509,
796,
1994,
4906,
7,
11085,
62,
11600,
8,
198,
220,
220,
220,
569,
796,
1188,
4906,
7,
11085,
62,
11600,
8,
628,
220,
220,
220,
329,
8633,
287,
8633,
82,
58,
17,
25,
437,
60,
198,
220,
220,
220,
220,
220,
220,
220,
611,
509,
24844,
4377,
11405,
569,
24844,
4377,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
509,
796,
2099,
22179,
7,
42,
11,
1994,
4906,
7,
11600,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
569,
796,
2099,
22179,
7,
53,
11,
1188,
4906,
7,
11600,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
357,
42,
11,
569,
8,
198,
437,
198,
198,
8818,
7308,
13,
13083,
7,
335,
3712,
49925,
35,
713,
90,
42,
30072,
810,
509,
198,
220,
220,
220,
1994,
62,
2617,
796,
5345,
90,
42,
92,
3419,
628,
220,
220,
220,
329,
8633,
287,
300,
67,
13,
11600,
82,
198,
220,
220,
220,
220,
220,
220,
220,
6441,
0,
7,
2539,
62,
2617,
11,
8251,
7,
11600,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
1994,
62,
2617,
198,
437,
198,
198,
14881,
13,
13664,
7,
335,
3712,
49925,
35,
713,
8,
796,
4129,
7,
13083,
7,
335,
4008,
198,
198,
8818,
7308,
13,
2676,
378,
7,
335,
3712,
49925,
35,
713,
11,
1181,
16193,
13083,
7,
335,
828,
4008,
198,
220,
220,
220,
300,
67,
62,
13083,
796,
717,
7,
5219,
8,
198,
220,
220,
220,
1994,
62,
5219,
796,
7308,
13,
13199,
7,
5219,
8,
628,
220,
220,
220,
2488,
30493,
4129,
7,
2539,
62,
5219,
8,
6624,
657,
8614,
4129,
7,
2539,
62,
5219,
8,
6624,
352,
628,
220,
220,
220,
11629,
796,
11629,
378,
7,
335,
62,
13083,
11,
1994,
62,
5219,
23029,
628,
220,
220,
220,
11629,
24844,
2147,
11405,
1441,
2147,
628,
220,
220,
220,
1994,
11,
649,
62,
2539,
62,
5219,
796,
11629,
628,
220,
220,
220,
1441,
357,
2539,
5218,
300,
67,
58,
2539,
46570,
357,
335,
62,
13083,
11,
649,
62,
2539,
62,
5219,
8,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
335,
3712,
49925,
35,
713,
90,
42,
11,
569,
5512,
1994,
8,
810,
1391,
42,
11,
569,
92,
198,
220,
220,
220,
329,
8633,
287,
300,
67,
13,
11600,
82,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
11600,
11,
1994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
8633,
58,
2539,
60,
3712,
53,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
3714,
7,
9218,
12331,
7,
2539,
4008,
198,
437,
198,
198,
8818,
7308,
13,
10134,
2539,
7,
335,
3712,
49925,
35,
713,
11,
1994,
8,
198,
220,
220,
220,
329,
8633,
287,
300,
67,
13,
11600,
82,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
11600,
11,
1994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
3991,
198,
437,
198,
198,
8818,
7308,
13,
1136,
7,
335,
3712,
49925,
35,
713,
90,
42,
11,
569,
5512,
1994,
11,
4277,
3712,
35,
8,
810,
1391,
42,
11,
569,
11,
360,
92,
198,
220,
220,
220,
8229,
6030,
796,
2099,
22179,
7,
53,
11,
360,
8,
628,
220,
220,
220,
329,
8633,
287,
300,
67,
13,
11600,
82,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
11600,
11,
1994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
8633,
58,
2539,
60,
3712,
13615,
6030,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
4277,
198,
437,
198,
198,
8818,
7308,
13,
1136,
7,
69,
3712,
14881,
13,
14134,
540,
11,
300,
67,
3712,
49925,
35,
713,
11,
1994,
8,
198,
220,
220,
220,
329,
8633,
287,
300,
67,
13,
11600,
82,
198,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
11600,
11,
1994,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
8633,
58,
2539,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
277,
3419,
198,
437,
198,
198,
437,
198
] | 2.18984 | 1,122 |
@testset "1038.binary-search-tree-to-greater-sum-tree.jl" begin
@test bst_to_gst(
TreeNode{Int}([
4, 1, 6, 0, 2, 5, 7, nothing, nothing, nothing, 3, nothing, nothing, nothing, 8
]),
) == TreeNode{Int}([
30,
36,
21,
36,
35,
26,
15,
nothing,
nothing,
nothing,
33,
nothing,
nothing,
nothing,
8,
])
@test bst_to_gst(TreeNode{Int}([0, nothing, 1])) == TreeNode{Int}([1, nothing, 1])
@test bst_to_gst(TreeNode{Int}([1, 0, 2])) == TreeNode{Int}([3, 3, 2])
@test bst_to_gst(TreeNode{Int}([3, 2, 4, 1])) == TreeNode{Int}([7, 9, 4, 10])
@test bst_to_gst(nothing) == nothing
end
| [
31,
9288,
2617,
366,
940,
2548,
13,
39491,
12,
12947,
12,
21048,
12,
1462,
12,
18223,
263,
12,
16345,
12,
21048,
13,
20362,
1,
2221,
198,
220,
220,
220,
2488,
9288,
275,
301,
62,
1462,
62,
70,
301,
7,
198,
220,
220,
220,
220,
220,
220,
220,
12200,
19667,
90,
5317,
92,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
604,
11,
352,
11,
718,
11,
657,
11,
362,
11,
642,
11,
767,
11,
2147,
11,
2147,
11,
2147,
11,
513,
11,
2147,
11,
2147,
11,
2147,
11,
807,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
828,
198,
220,
220,
220,
1267,
6624,
12200,
19667,
90,
5317,
92,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
1542,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4570,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2310,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4570,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3439,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2608,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1315,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
4747,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
198,
220,
220,
220,
220,
220,
220,
220,
807,
11,
198,
220,
220,
220,
33761,
198,
220,
220,
220,
2488,
9288,
275,
301,
62,
1462,
62,
70,
301,
7,
27660,
19667,
90,
5317,
92,
26933,
15,
11,
2147,
11,
352,
60,
4008,
6624,
12200,
19667,
90,
5317,
92,
26933,
16,
11,
2147,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
275,
301,
62,
1462,
62,
70,
301,
7,
27660,
19667,
90,
5317,
92,
26933,
16,
11,
657,
11,
362,
60,
4008,
6624,
12200,
19667,
90,
5317,
92,
26933,
18,
11,
513,
11,
362,
12962,
198,
220,
220,
220,
2488,
9288,
275,
301,
62,
1462,
62,
70,
301,
7,
27660,
19667,
90,
5317,
92,
26933,
18,
11,
362,
11,
604,
11,
352,
60,
4008,
6624,
12200,
19667,
90,
5317,
92,
26933,
22,
11,
860,
11,
604,
11,
838,
12962,
198,
220,
220,
220,
2488,
9288,
275,
301,
62,
1462,
62,
70,
301,
7,
22366,
8,
6624,
2147,
198,
437,
198
] | 1.788462 | 416 |
using Indexing
if VERSION < v"0.7-"
using Base.Test
else
using Test
end
@testset "getindices" begin
d = Dict(:a => "Alice", :b => "Bob", :c => "Charlie")
@test getindices(d, [:a, :c]) == ["Alice", "Charlie"]
@test getindices(d, (:a, :c)) == ("Alice", "Charlie")
@test getindices(d, Dict(:aa => :a, :cc => :c)) == Dict(:aa => "Alice", :cc => "Charlie")
@static if VERSION > v"0.7-"
@test getindices(d, (aa = :a, cc = :c)) == (aa = "Alice", cc = "Charlie")
end
@test getindices(d, :) == d
v = [11, 12, 13]
@test (getindices(v, 2)::Array{Int, 0})[] == 12
@test getindices(v, [1, 3]) == [11, 13]
@test getindices(v, Dict(:a => 1, :c => 3)) == Dict(:a => 11, :c => 13)
@test getindices(v, (1, 3)) === (11, 13)
@static if VERSION > v"0.7-"
@test getindices(v, (a = 1, c = 3)) === (a = 11, c = 13)
end
@test getindices(v, :) == v
t = (11, 12, 13)
@test getindices(t, [1, 3]) == [11, 13]
@test getindices(t, Dict(:a => 1, :c => 3)) == Dict(:a => 11, :c => 13)
@test getindices(t, (1, 3)) == (11, 13)
@static if VERSION > v"0.7-"
@test getindices(t, (a = 1, c = 3)) === (a = 11, c = 13)
end
@test getindices(t, :) == t
@static if VERSION > v"0.7-"
nt = (a = 1, b = 2.0, c = "three")
@test getindices(nt, [:a, :c]) == [1, "three"]
@test getindices(nt, Dict(:aa => :a, :cc => :c)) == Dict(:aa => 1, :cc => "three")
@test getindices(nt, (:a, :c)) == (1, "three")
@test getindices(nt, (aa = :a, cc = :c)) == (aa = 1, cc = "three")
@test getindices(nt, :) == nt
end
end
@testset "setindices!" begin
d = Dict(:a => "Alice", :b => "Bob", :c => "Charlie")
d2 = copy(d)
setindices!(d2, "Someone", [:a, :c])
@test d2 == Dict(:a => "Someone", :b => "Bob", :c => "Someone")
d3 = copy(d)
setindices!(d3, "Someone", (:a, :c))
@test d3 == Dict(:a => "Someone", :b => "Bob", :c => "Someone")
d4 = copy(d)
setindices!(d4, "Someone", Dict(:aa => :a, :cc => :c))
@test d4 == Dict(:a => "Someone", :b => "Bob", :c => "Someone")
@static if VERSION > v"0.7-"
d5 = copy(d)
setindices!(d5, "Someone", (aa = :a, cc = :c))
@test d5 == Dict(:a => "Someone", :b => "Bob", :c => "Someone")
end
d6 = copy(d)
setindices!(d6, "Someone", :)
@test d6 == Dict(:a => "Someone", :b => "Someone", :c => "Someone")
v = [11, 12, 13]
v2 = copy(v)
setindices!(v2, 20, [1, 3])
@test v2 == [20, 12, 20]
v3 = copy(v)
setindices!(v3, 20, (1, 3))
@test v3 == [20, 12, 20]
v4 = copy(v)
setindices!(v4, 20, Dict(:a => 1, :c => 3))
@test v4 == [20, 12, 20]
@static if VERSION > v"0.7-"
v5 = copy(v)
setindices!(v5, 20, (a = 1, c = 3))
@test v5 == [20, 12, 20]
end
v6 = copy(v)
setindices!(v6, 20, :)
@test v6 == [20, 20, 20]
end
@testset "view" begin
d = Dict(:a => "Alice", :b => "Bob", :c => "Charlie")
d2 = copy(d)
@test view(d, [:a, :c])::ViewArray == ["Alice", "Charlie"]
@test view(d, Dict(:aa => :a, :cc => :c))::ViewDict == Dict(:aa => "Alice", :cc => "Charlie")
av = view(d, [:a, :c])
@test parent(av) === d
@test av[1] == "Alice"
@test Indexing.axes(av) === (Base.OneTo(2),)
av[1] = "Someone"
@test d == Dict(:a => "Someone", :b => "Bob", :c => "Charlie")
dv = view(d2, Dict(:aa => :a, :cc => :c))
@test parent(dv) === d2
@test dv[:aa] == "Alice"
@test keys(dv) ⊆ [:aa, :cc] # Probably will want to change this
@test length(keys(dv)) == 2
@test haskey(dv, :aa)
dv[:aa] = "No-one"
@test d2 == Dict(:a => "No-one", :b => "Bob", :c => "Charlie")
v = [11, 12, 13]
@test view(v, Dict(:a =>1 , :c => 3))::ViewDict == Dict(:a => 11, :c => 13)
dv2 = view(v, Dict(:a =>1 , :c => 3))
@test parent(dv2) === v
@test dv2[:a] == 11
@test keys(dv2) ⊆ [:a, :c]
@test length(keys(dv2)) == 2
@test haskey(dv2, :a)
@test first(dv2) === (:a => 11) || first(dv2) === (:c => 13)
dv2[:a] = 21
@test v == [21, 12, 13]
@test ViewArray(d, [:b, :c])::ViewArray == ["Bob", "Charlie"]
@test ViewVector(d, [:b, :c])::ViewVector == ["Bob", "Charlie"]
@test ViewMatrix(d, [:b :c; :c :b])::ViewMatrix == ["Bob" "Charlie"; "Charlie" "Bob"]
end
| [
3500,
12901,
278,
198,
361,
44156,
2849,
1279,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
1262,
7308,
13,
14402,
198,
17772,
198,
220,
220,
220,
1262,
6208,
198,
437,
198,
198,
31,
9288,
2617,
366,
1136,
521,
1063,
1,
2221,
198,
220,
220,
220,
288,
796,
360,
713,
7,
25,
64,
5218,
366,
44484,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
37136,
4943,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
67,
11,
685,
25,
64,
11,
1058,
66,
12962,
6624,
14631,
44484,
1600,
366,
37136,
8973,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
67,
11,
357,
25,
64,
11,
1058,
66,
4008,
6624,
5855,
44484,
1600,
366,
37136,
4943,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
67,
11,
360,
713,
7,
25,
7252,
5218,
1058,
64,
11,
1058,
535,
5218,
1058,
66,
4008,
6624,
360,
713,
7,
25,
7252,
5218,
366,
44484,
1600,
1058,
535,
5218,
366,
37136,
4943,
198,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
67,
11,
357,
7252,
796,
1058,
64,
11,
36624,
796,
1058,
66,
4008,
6624,
357,
7252,
796,
366,
44484,
1600,
36624,
796,
366,
37136,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
67,
11,
14373,
6624,
288,
628,
220,
220,
220,
410,
796,
685,
1157,
11,
1105,
11,
1511,
60,
198,
220,
220,
220,
2488,
9288,
357,
1136,
521,
1063,
7,
85,
11,
362,
2599,
25,
19182,
90,
5317,
11,
657,
30072,
21737,
6624,
1105,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
85,
11,
685,
16,
11,
513,
12962,
6624,
685,
1157,
11,
1511,
60,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
85,
11,
360,
713,
7,
25,
64,
5218,
352,
11,
1058,
66,
5218,
513,
4008,
6624,
360,
713,
7,
25,
64,
5218,
1367,
11,
1058,
66,
5218,
1511,
8,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
85,
11,
357,
16,
11,
513,
4008,
24844,
357,
1157,
11,
1511,
8,
198,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
85,
11,
357,
64,
796,
352,
11,
269,
796,
513,
4008,
24844,
357,
64,
796,
1367,
11,
269,
796,
1511,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
85,
11,
14373,
6624,
410,
628,
220,
220,
220,
256,
796,
357,
1157,
11,
1105,
11,
1511,
8,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
83,
11,
685,
16,
11,
513,
12962,
6624,
685,
1157,
11,
1511,
60,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
83,
11,
360,
713,
7,
25,
64,
5218,
352,
11,
1058,
66,
5218,
513,
4008,
6624,
360,
713,
7,
25,
64,
5218,
1367,
11,
1058,
66,
5218,
1511,
8,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
83,
11,
357,
16,
11,
513,
4008,
6624,
357,
1157,
11,
1511,
8,
198,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
83,
11,
357,
64,
796,
352,
11,
269,
796,
513,
4008,
24844,
357,
64,
796,
1367,
11,
269,
796,
1511,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
83,
11,
14373,
6624,
256,
628,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
299,
83,
796,
357,
64,
796,
352,
11,
275,
796,
362,
13,
15,
11,
269,
796,
366,
15542,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
429,
11,
685,
25,
64,
11,
1058,
66,
12962,
6624,
685,
16,
11,
366,
15542,
8973,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
429,
11,
360,
713,
7,
25,
7252,
5218,
1058,
64,
11,
1058,
535,
5218,
1058,
66,
4008,
6624,
360,
713,
7,
25,
7252,
5218,
352,
11,
1058,
535,
5218,
366,
15542,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
429,
11,
357,
25,
64,
11,
1058,
66,
4008,
6624,
357,
16,
11,
366,
15542,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
429,
11,
357,
7252,
796,
1058,
64,
11,
36624,
796,
1058,
66,
4008,
6624,
357,
7252,
796,
352,
11,
36624,
796,
366,
15542,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
651,
521,
1063,
7,
429,
11,
14373,
6624,
299,
83,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
9288,
2617,
366,
2617,
521,
1063,
2474,
2221,
198,
220,
220,
220,
288,
796,
360,
713,
7,
25,
64,
5218,
366,
44484,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
37136,
4943,
198,
220,
220,
220,
288,
17,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
67,
17,
11,
366,
28211,
1600,
685,
25,
64,
11,
1058,
66,
12962,
198,
220,
220,
220,
2488,
9288,
288,
17,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
28211,
4943,
628,
220,
220,
220,
288,
18,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
67,
18,
11,
366,
28211,
1600,
357,
25,
64,
11,
1058,
66,
4008,
198,
220,
220,
220,
2488,
9288,
288,
18,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
28211,
4943,
628,
220,
220,
220,
288,
19,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
67,
19,
11,
366,
28211,
1600,
360,
713,
7,
25,
7252,
5218,
1058,
64,
11,
1058,
535,
5218,
1058,
66,
4008,
198,
220,
220,
220,
2488,
9288,
288,
19,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
28211,
4943,
628,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
288,
20,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
521,
1063,
0,
7,
67,
20,
11,
366,
28211,
1600,
357,
7252,
796,
1058,
64,
11,
36624,
796,
1058,
66,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
288,
20,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
28211,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
288,
21,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
67,
21,
11,
366,
28211,
1600,
14373,
198,
220,
220,
220,
2488,
9288,
288,
21,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
28211,
1600,
1058,
66,
5218,
366,
28211,
4943,
628,
220,
220,
220,
410,
796,
685,
1157,
11,
1105,
11,
1511,
60,
198,
220,
220,
220,
410,
17,
796,
4866,
7,
85,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
85,
17,
11,
1160,
11,
685,
16,
11,
513,
12962,
198,
220,
220,
220,
2488,
9288,
410,
17,
6624,
685,
1238,
11,
1105,
11,
1160,
60,
628,
220,
220,
220,
410,
18,
796,
4866,
7,
85,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
85,
18,
11,
1160,
11,
357,
16,
11,
513,
4008,
198,
220,
220,
220,
2488,
9288,
410,
18,
6624,
685,
1238,
11,
1105,
11,
1160,
60,
628,
220,
220,
220,
410,
19,
796,
4866,
7,
85,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
85,
19,
11,
1160,
11,
360,
713,
7,
25,
64,
5218,
352,
11,
1058,
66,
5218,
513,
4008,
198,
220,
220,
220,
2488,
9288,
410,
19,
6624,
685,
1238,
11,
1105,
11,
1160,
60,
628,
220,
220,
220,
2488,
12708,
611,
44156,
2849,
1875,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
220,
220,
220,
220,
410,
20,
796,
4866,
7,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
521,
1063,
0,
7,
85,
20,
11,
1160,
11,
357,
64,
796,
352,
11,
269,
796,
513,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
410,
20,
6624,
685,
1238,
11,
1105,
11,
1160,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
410,
21,
796,
4866,
7,
85,
8,
198,
220,
220,
220,
900,
521,
1063,
0,
7,
85,
21,
11,
1160,
11,
14373,
198,
220,
220,
220,
2488,
9288,
410,
21,
6624,
685,
1238,
11,
1160,
11,
1160,
60,
198,
437,
198,
198,
31,
9288,
2617,
366,
1177,
1,
2221,
198,
220,
220,
220,
288,
796,
360,
713,
7,
25,
64,
5218,
366,
44484,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
37136,
4943,
198,
220,
220,
220,
288,
17,
796,
4866,
7,
67,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
9288,
1570,
7,
67,
11,
685,
25,
64,
11,
1058,
66,
60,
2599,
25,
7680,
19182,
6624,
14631,
44484,
1600,
366,
37136,
8973,
198,
220,
220,
220,
2488,
9288,
1570,
7,
67,
11,
360,
713,
7,
25,
7252,
5218,
1058,
64,
11,
1058,
535,
5218,
1058,
66,
8,
2599,
25,
7680,
35,
713,
6624,
360,
713,
7,
25,
7252,
5218,
366,
44484,
1600,
1058,
535,
5218,
366,
37136,
4943,
628,
220,
220,
220,
1196,
796,
1570,
7,
67,
11,
685,
25,
64,
11,
1058,
66,
12962,
198,
220,
220,
220,
2488,
9288,
2560,
7,
615,
8,
24844,
288,
198,
220,
220,
220,
2488,
9288,
1196,
58,
16,
60,
6624,
366,
44484,
1,
198,
220,
220,
220,
2488,
9288,
12901,
278,
13,
897,
274,
7,
615,
8,
24844,
357,
14881,
13,
3198,
2514,
7,
17,
828,
8,
198,
220,
220,
220,
1196,
58,
16,
60,
796,
366,
28211,
1,
198,
220,
220,
220,
2488,
9288,
288,
6624,
360,
713,
7,
25,
64,
5218,
366,
28211,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
37136,
4943,
628,
220,
220,
220,
288,
85,
796,
1570,
7,
67,
17,
11,
360,
713,
7,
25,
7252,
5218,
1058,
64,
11,
1058,
535,
5218,
1058,
66,
4008,
198,
220,
220,
220,
2488,
9288,
2560,
7,
67,
85,
8,
24844,
288,
17,
198,
220,
220,
220,
2488,
9288,
288,
85,
58,
25,
7252,
60,
6624,
366,
44484,
1,
198,
220,
220,
220,
2488,
9288,
8251,
7,
67,
85,
8,
2343,
232,
228,
685,
25,
7252,
11,
1058,
535,
60,
1303,
18578,
481,
765,
284,
1487,
428,
198,
220,
220,
220,
2488,
9288,
4129,
7,
13083,
7,
67,
85,
4008,
6624,
362,
198,
220,
220,
220,
2488,
9288,
468,
2539,
7,
67,
85,
11,
1058,
7252,
8,
198,
220,
220,
220,
288,
85,
58,
25,
7252,
60,
796,
366,
2949,
12,
505,
1,
198,
220,
220,
220,
2488,
9288,
288,
17,
6624,
360,
713,
7,
25,
64,
5218,
366,
2949,
12,
505,
1600,
1058,
65,
5218,
366,
18861,
1600,
1058,
66,
5218,
366,
37136,
4943,
628,
220,
220,
220,
410,
796,
685,
1157,
11,
1105,
11,
1511,
60,
628,
220,
220,
220,
2488,
9288,
1570,
7,
85,
11,
360,
713,
7,
25,
64,
5218,
16,
837,
1058,
66,
5218,
513,
8,
2599,
25,
7680,
35,
713,
6624,
360,
713,
7,
25,
64,
5218,
1367,
11,
1058,
66,
5218,
1511,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
288,
85,
17,
796,
1570,
7,
85,
11,
360,
713,
7,
25,
64,
5218,
16,
837,
1058,
66,
5218,
513,
4008,
198,
220,
220,
220,
2488,
9288,
2560,
7,
67,
85,
17,
8,
24844,
410,
198,
220,
220,
220,
2488,
9288,
288,
85,
17,
58,
25,
64,
60,
6624,
1367,
198,
220,
220,
220,
2488,
9288,
8251,
7,
67,
85,
17,
8,
2343,
232,
228,
685,
25,
64,
11,
1058,
66,
60,
198,
220,
220,
220,
2488,
9288,
4129,
7,
13083,
7,
67,
85,
17,
4008,
6624,
362,
198,
220,
220,
220,
2488,
9288,
468,
2539,
7,
67,
85,
17,
11,
1058,
64,
8,
198,
220,
220,
220,
2488,
9288,
717,
7,
67,
85,
17,
8,
24844,
357,
25,
64,
5218,
1367,
8,
8614,
717,
7,
67,
85,
17,
8,
24844,
357,
25,
66,
5218,
1511,
8,
198,
220,
220,
220,
288,
85,
17,
58,
25,
64,
60,
796,
2310,
198,
220,
220,
220,
2488,
9288,
410,
6624,
685,
2481,
11,
1105,
11,
1511,
60,
628,
198,
220,
220,
220,
2488,
9288,
3582,
19182,
7,
67,
11,
685,
25,
65,
11,
1058,
66,
60,
2599,
25,
7680,
19182,
6624,
14631,
18861,
1600,
366,
37136,
8973,
198,
220,
220,
220,
2488,
9288,
3582,
38469,
7,
67,
11,
685,
25,
65,
11,
1058,
66,
60,
2599,
25,
7680,
38469,
6624,
14631,
18861,
1600,
366,
37136,
8973,
198,
220,
220,
220,
2488,
9288,
3582,
46912,
7,
67,
11,
685,
25,
65,
1058,
66,
26,
1058,
66,
1058,
65,
60,
2599,
25,
7680,
46912,
6624,
14631,
18861,
1,
366,
37136,
8172,
366,
37136,
1,
366,
18861,
8973,
198,
437,
198
] | 1.963996 | 2,222 |
# Define the AbstractGP type and its API.
"""
abstract type AbstractGP end
Supertype for various Gaussian process (GP) types. A common interface is provided for
interacting with each of these objects. See [1] for an overview of GPs.
[1] - C. E. Rasmussen and C. Williams. "Gaussian processes for machine learning".
MIT Press. 2006.
"""
abstract type AbstractGP end
"""
mean(f::AbstractGP, x::AbstractVector)
Computes the mean vector of the multivariate Normal `f(x)`.
"""
Statistics.mean(::AbstractGP, ::AbstractVector)
"""
cov(f::AbstractGP, x::AbstractVector)
Compute the `length(x)` by `length(x)` covariance matrix of the multivariate Normal `f(x)`.
"""
Statistics.cov(::AbstractGP, x::AbstractVector)
"""
var(f::AbstractGP, x::AbstractVector)
Compute only the diagonal elements of `cov(f(x))`.
"""
Statistics.var(::AbstractGP, ::AbstractVector)
"""
cov(f::AbstractGP, x::AbstractVector, y::AbstractVector)
Compute the `length(x)` by `length(y)` cross-covariance matrix between `f(x)` and `f(y)`.
"""
Statistics.cov(::AbstractGP, x::AbstractVector, y::AbstractVector)
"""
mean_and_cov(f::AbstractGP, x::AbstractVector)
Compute both `mean(f(x))` and `cov(f(x))`. Sometimes more efficient than separately
computation, particularly for posteriors.
"""
StatsBase.mean_and_cov(f::AbstractGP, x::AbstractVector) = (mean(f, x), cov(f, x))
"""
mean_and_var(f::AbstractGP, x::AbstractVector)
Compute both `mean(f(x))` and the diagonal elements of `cov(f(x))`. Sometimes more efficient
than separately computation, particularly for posteriors.
"""
StatsBase.mean_and_var(f::AbstractGP, x::AbstractVector) = (mean(f, x), var(f, x))
for (m, f) in [
(:Statistics, :mean),
(:Statistics, :var),
(:Statistics, :cov),
(:StatsBase, :mean_and_cov),
(:StatsBase, :mean_and_var),
]
@eval function $m.$f(::AbstractGP)
return error(
"`",
$f,
"(f::AbstractGP)` is not defined (on purpose!).\n",
"Please provide an `AbstractVector` of locations `x` at which you wish to compute your ",
$f,
$((f === :mean_and_cov || f === :mean_and_var) ? " vectors" : " vector"),
", and call `",
$f,
"(f(x))`\n",
"For more details please have a look at the AbstractGPs docs.",
)
end
end
| [
2,
2896,
500,
262,
27741,
16960,
2099,
290,
663,
7824,
13,
198,
198,
37811,
198,
220,
220,
220,
12531,
2099,
27741,
16960,
886,
198,
198,
12442,
4906,
329,
2972,
12822,
31562,
1429,
357,
16960,
8,
3858,
13,
317,
2219,
7071,
318,
2810,
329,
198,
3849,
27362,
351,
1123,
286,
777,
5563,
13,
4091,
685,
16,
60,
329,
281,
16700,
286,
402,
12016,
13,
198,
198,
58,
16,
60,
532,
327,
13,
412,
13,
46549,
290,
327,
13,
6484,
13,
366,
35389,
31562,
7767,
329,
4572,
4673,
1911,
220,
198,
36393,
4332,
13,
4793,
13,
198,
37811,
198,
397,
8709,
2099,
27741,
16960,
886,
198,
198,
37811,
198,
220,
220,
220,
1612,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
7293,
1769,
262,
1612,
15879,
286,
262,
1963,
42524,
14435,
4600,
69,
7,
87,
8,
44646,
198,
37811,
198,
48346,
13,
32604,
7,
3712,
23839,
16960,
11,
7904,
23839,
38469,
8,
198,
198,
37811,
198,
220,
220,
220,
39849,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
7293,
1133,
262,
4600,
13664,
7,
87,
8,
63,
416,
4600,
13664,
7,
87,
8,
63,
44829,
590,
17593,
286,
262,
1963,
42524,
14435,
4600,
69,
7,
87,
8,
44646,
198,
37811,
198,
48346,
13,
66,
709,
7,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
37811,
198,
220,
220,
220,
1401,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
7293,
1133,
691,
262,
40039,
4847,
286,
4600,
66,
709,
7,
69,
7,
87,
4008,
44646,
198,
37811,
198,
48346,
13,
7785,
7,
3712,
23839,
16960,
11,
7904,
23839,
38469,
8,
198,
198,
37811,
198,
220,
220,
220,
39849,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
11,
331,
3712,
23839,
38469,
8,
198,
198,
7293,
1133,
262,
4600,
13664,
7,
87,
8,
63,
416,
4600,
13664,
7,
88,
8,
63,
3272,
12,
66,
709,
2743,
590,
17593,
1022,
4600,
69,
7,
87,
8,
63,
290,
4600,
69,
7,
88,
8,
44646,
198,
37811,
198,
48346,
13,
66,
709,
7,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
11,
331,
3712,
23839,
38469,
8,
198,
198,
37811,
198,
220,
220,
220,
1612,
62,
392,
62,
66,
709,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
7293,
1133,
1111,
4600,
32604,
7,
69,
7,
87,
4008,
63,
290,
4600,
66,
709,
7,
69,
7,
87,
4008,
44646,
8975,
517,
6942,
621,
13869,
198,
785,
1996,
341,
11,
3573,
329,
11968,
12706,
13,
198,
37811,
198,
29668,
14881,
13,
32604,
62,
392,
62,
66,
709,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
796,
357,
32604,
7,
69,
11,
2124,
828,
39849,
7,
69,
11,
2124,
4008,
198,
198,
37811,
198,
220,
220,
220,
1612,
62,
392,
62,
7785,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
198,
198,
7293,
1133,
1111,
4600,
32604,
7,
69,
7,
87,
4008,
63,
290,
262,
40039,
4847,
286,
4600,
66,
709,
7,
69,
7,
87,
4008,
44646,
8975,
517,
6942,
198,
14813,
13869,
29964,
11,
3573,
329,
11968,
12706,
13,
198,
37811,
198,
29668,
14881,
13,
32604,
62,
392,
62,
7785,
7,
69,
3712,
23839,
16960,
11,
2124,
3712,
23839,
38469,
8,
796,
357,
32604,
7,
69,
11,
2124,
828,
1401,
7,
69,
11,
2124,
4008,
198,
198,
1640,
357,
76,
11,
277,
8,
287,
685,
198,
220,
220,
220,
357,
25,
48346,
11,
1058,
32604,
828,
198,
220,
220,
220,
357,
25,
48346,
11,
1058,
7785,
828,
198,
220,
220,
220,
357,
25,
48346,
11,
1058,
66,
709,
828,
198,
220,
220,
220,
357,
25,
29668,
14881,
11,
1058,
32604,
62,
392,
62,
66,
709,
828,
198,
220,
220,
220,
357,
25,
29668,
14881,
11,
1058,
32604,
62,
392,
62,
7785,
828,
198,
60,
198,
220,
220,
220,
2488,
18206,
2163,
720,
76,
48082,
69,
7,
3712,
23839,
16960,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
4049,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
63,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
69,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30629,
69,
3712,
23839,
16960,
8,
63,
318,
407,
5447,
357,
261,
4007,
19588,
59,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
5492,
2148,
281,
4600,
23839,
38469,
63,
286,
7064,
4600,
87,
63,
379,
543,
345,
4601,
284,
24061,
534,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
69,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
19510,
69,
24844,
1058,
32604,
62,
392,
62,
66,
709,
8614,
277,
24844,
1058,
32604,
62,
392,
62,
7785,
8,
5633,
366,
30104,
1,
1058,
366,
15879,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
290,
869,
4600,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
69,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
30629,
69,
7,
87,
4008,
63,
59,
77,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
1890,
517,
3307,
3387,
423,
257,
804,
379,
262,
27741,
38,
12016,
34165,
33283,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
886,
198,
437,
198
] | 2.59516 | 909 |
module Fluxes
using Adapt
using DocStringExtensions
export AbstractFlux,
FluxLW, FluxSW, init_flux_sw, set_flux_to_zero!, add_to_flux!
abstract type AbstractFlux{FT<:AbstractFloat,FTA2D<:AbstractArray{FT,2}} end
"""
FluxLW{FT,FTA2D}
Upward, downward and net longwave fluxes at each level.
# Fields
$(DocStringExtensions.FIELDS)
"""
struct FluxLW{FT<:AbstractFloat,FTA2D<:AbstractArray{FT,2}} <:
AbstractFlux{FT,FTA2D}
"upward flux `[W/m²]` `(nlev,ncol)`"
flux_up::FTA2D
"downward flux `[W/m²]` `(nlev,ncol)`"
flux_dn::FTA2D
"net flux `[W/m²]` `(nlev,ncol)`"
flux_net::FTA2D
end
FluxLW(flux_up, flux_dn, flux_net) =
FluxLW{eltype(flux_up),typeof(flux_up)}(flux_up, flux_dn, flux_net)
Adapt.@adapt_structure FluxLW
function FluxLW(
ncol::Int,
nlay::Int,
::Type{FT},
::Type{DA},
) where {FT<:AbstractFloat,DA}
flux_up = DA{FT}(undef, nlay + 1, ncol)
flux_dn = DA{FT}(undef, nlay + 1, ncol)
flux_net = DA{FT}(undef, nlay + 1, ncol)
return FluxLW{FT,typeof(flux_net)}(flux_up, flux_dn, flux_net)
end
"""
FluxSW{FT,FTA2D}
Upward, downward and net shortwave fluxes at each level.
# Fields
$(DocStringExtensions.FIELDS)
"""
struct FluxSW{FT<:AbstractFloat,FTA2D<:AbstractArray{FT,2}} <:
AbstractFlux{FT,FTA2D}
"upward flux `[W/m²]` `(nlev,ncol)`"
flux_up::FTA2D
"downward flux `[W/m²]` `(nlev,ncol)`"
flux_dn::FTA2D
"net flux `[W/m²]` `(nlev,ncol)`"
flux_net::FTA2D
"direct downward flux `[W/m²]` `(nlev,ncol)`"
flux_dn_dir::FTA2D
end
FluxSW(flux_up, flux_dn, flux_net, flux_dn_dir) =
FluxSW{eltype(flux_up),typeof(flux_up)}(
flux_up,
flux_dn,
flux_net,
flux_dn_dir,
)
Adapt.@adapt_structure FluxSW
function FluxSW(
ncol::Int,
nlay::Int,
::Type{FT},
::Type{DA},
) where {FT<:AbstractFloat,DA}
flux_up = DA{FT}(undef, nlay + 1, ncol)
flux_dn = DA{FT}(undef, nlay + 1, ncol)
flux_net = DA{FT}(undef, nlay + 1, ncol)
flux_dn_dir = DA{FT}(undef, nlay + 1, ncol)
return FluxSW{FT,typeof(flux_net)}(flux_up, flux_dn, flux_net, flux_dn_dir)
end
"""
set_flux_to_zero!(flux::FluxLW{FT}) where {FT<:AbstractFloat}
Set longwave flux to zero
"""
function set_flux_to_zero!(flux::FluxLW{FT}) where {FT<:AbstractFloat}
flux.flux_up .= FT(0)
flux.flux_dn .= FT(0)
flux.flux_net .= FT(0)
return nothing
end
"""
set_flux_to_zero!(flux::FluxSW{FT}) where {FT<:AbstractFloat}
Set shortwave flux to zero
"""
function set_flux_to_zero!(flux::FluxSW{FT}) where {FT<:AbstractFloat}
flux.flux_up .= FT(0)
flux.flux_dn .= FT(0)
flux.flux_net .= FT(0)
flux.flux_dn_dir .= FT(0)
return nothing
end
"""
add_to_flux!(flux1::FluxLW, flux2::FluxLW)
add longwave flux2 to longwave flux1
flux1 .+= flux2
"""
function add_to_flux!(flux1::FluxLW, flux2::FluxLW)
flux1.flux_up .+= flux2.flux_up
flux1.flux_dn .+= flux2.flux_dn
flux1.flux_net .+= flux2.flux_net
return nothing
end
"""
add_to_flux!(flux1::FluxSW, flux2::FluxSW)
add shortwave flux2 to shortwave flux1
flux1 .+= flux2
"""
function add_to_flux!(flux1::FluxSW, flux2::FluxSW)
flux1.flux_up .+= flux2.flux_up
flux1.flux_dn .+= flux2.flux_dn
flux1.flux_net .+= flux2.flux_net
flux1.flux_dn_dir .+= flux2.flux_dn_dir
return nothing
end
end
| [
21412,
1610,
2821,
274,
198,
198,
3500,
30019,
198,
3500,
14432,
10100,
11627,
5736,
198,
198,
39344,
27741,
37,
22564,
11,
198,
220,
220,
220,
1610,
2821,
43,
54,
11,
1610,
2821,
17887,
11,
2315,
62,
69,
22564,
62,
2032,
11,
900,
62,
69,
22564,
62,
1462,
62,
22570,
28265,
751,
62,
1462,
62,
69,
22564,
0,
198,
198,
397,
8709,
2099,
27741,
37,
22564,
90,
9792,
27,
25,
23839,
43879,
11,
37,
5603,
17,
35,
27,
25,
23839,
19182,
90,
9792,
11,
17,
11709,
886,
628,
198,
37811,
198,
220,
220,
220,
1610,
2821,
43,
54,
90,
9792,
11,
37,
5603,
17,
35,
92,
198,
198,
4933,
904,
11,
20841,
290,
2010,
890,
19204,
28462,
274,
379,
1123,
1241,
13,
198,
198,
2,
23948,
198,
3,
7,
23579,
10100,
11627,
5736,
13,
11674,
3698,
5258,
8,
198,
37811,
198,
7249,
1610,
2821,
43,
54,
90,
9792,
27,
25,
23839,
43879,
11,
37,
5603,
17,
35,
27,
25,
23839,
19182,
90,
9792,
11,
17,
11709,
1279,
25,
198,
220,
220,
220,
220,
220,
220,
27741,
37,
22564,
90,
9792,
11,
37,
5603,
17,
35,
92,
198,
220,
220,
220,
366,
929,
904,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
929,
3712,
37,
5603,
17,
35,
198,
220,
220,
220,
366,
2902,
904,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
32656,
3712,
37,
5603,
17,
35,
198,
220,
220,
220,
366,
3262,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
3262,
3712,
37,
5603,
17,
35,
198,
437,
198,
37,
22564,
43,
54,
7,
69,
22564,
62,
929,
11,
28462,
62,
32656,
11,
28462,
62,
3262,
8,
796,
198,
220,
220,
220,
1610,
2821,
43,
54,
90,
417,
4906,
7,
69,
22564,
62,
929,
828,
4906,
1659,
7,
69,
22564,
62,
929,
38165,
7,
69,
22564,
62,
929,
11,
28462,
62,
32656,
11,
28462,
62,
3262,
8,
198,
48003,
13,
31,
42552,
62,
301,
5620,
1610,
2821,
43,
54,
198,
198,
8818,
1610,
2821,
43,
54,
7,
198,
220,
220,
220,
299,
4033,
3712,
5317,
11,
198,
220,
220,
220,
299,
10724,
3712,
5317,
11,
198,
220,
220,
220,
7904,
6030,
90,
9792,
5512,
198,
220,
220,
220,
7904,
6030,
90,
5631,
5512,
198,
8,
810,
1391,
9792,
27,
25,
23839,
43879,
11,
5631,
92,
198,
220,
220,
220,
28462,
62,
929,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
28462,
62,
32656,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
28462,
62,
3262,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
1441,
1610,
2821,
43,
54,
90,
9792,
11,
4906,
1659,
7,
69,
22564,
62,
3262,
38165,
7,
69,
22564,
62,
929,
11,
28462,
62,
32656,
11,
28462,
62,
3262,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
1610,
2821,
17887,
90,
9792,
11,
37,
5603,
17,
35,
92,
198,
198,
4933,
904,
11,
20841,
290,
2010,
1790,
19204,
28462,
274,
379,
1123,
1241,
13,
198,
198,
2,
23948,
198,
3,
7,
23579,
10100,
11627,
5736,
13,
11674,
3698,
5258,
8,
198,
37811,
198,
7249,
1610,
2821,
17887,
90,
9792,
27,
25,
23839,
43879,
11,
37,
5603,
17,
35,
27,
25,
23839,
19182,
90,
9792,
11,
17,
11709,
1279,
25,
198,
220,
220,
220,
220,
220,
220,
27741,
37,
22564,
90,
9792,
11,
37,
5603,
17,
35,
92,
198,
220,
220,
220,
366,
929,
904,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
929,
3712,
37,
5603,
17,
35,
198,
220,
220,
220,
366,
2902,
904,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
32656,
3712,
37,
5603,
17,
35,
198,
220,
220,
220,
366,
3262,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
3262,
3712,
37,
5603,
17,
35,
198,
220,
220,
220,
366,
12942,
20841,
28462,
4600,
58,
54,
14,
76,
31185,
60,
63,
4600,
7,
77,
2768,
11,
77,
4033,
8,
63,
1,
198,
220,
220,
220,
28462,
62,
32656,
62,
15908,
3712,
37,
5603,
17,
35,
198,
437,
198,
37,
22564,
17887,
7,
69,
22564,
62,
929,
11,
28462,
62,
32656,
11,
28462,
62,
3262,
11,
28462,
62,
32656,
62,
15908,
8,
796,
198,
220,
220,
220,
1610,
2821,
17887,
90,
417,
4906,
7,
69,
22564,
62,
929,
828,
4906,
1659,
7,
69,
22564,
62,
929,
38165,
7,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
929,
11,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
32656,
11,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
3262,
11,
198,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
32656,
62,
15908,
11,
198,
220,
220,
220,
1267,
198,
48003,
13,
31,
42552,
62,
301,
5620,
1610,
2821,
17887,
198,
198,
8818,
1610,
2821,
17887,
7,
198,
220,
220,
220,
299,
4033,
3712,
5317,
11,
198,
220,
220,
220,
299,
10724,
3712,
5317,
11,
198,
220,
220,
220,
7904,
6030,
90,
9792,
5512,
198,
220,
220,
220,
7904,
6030,
90,
5631,
5512,
198,
8,
810,
1391,
9792,
27,
25,
23839,
43879,
11,
5631,
92,
198,
220,
220,
220,
28462,
62,
929,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
28462,
62,
32656,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
28462,
62,
3262,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
28462,
62,
32656,
62,
15908,
796,
17051,
90,
9792,
92,
7,
917,
891,
11,
299,
10724,
1343,
352,
11,
299,
4033,
8,
198,
220,
220,
220,
1441,
1610,
2821,
17887,
90,
9792,
11,
4906,
1659,
7,
69,
22564,
62,
3262,
38165,
7,
69,
22564,
62,
929,
11,
28462,
62,
32656,
11,
28462,
62,
3262,
11,
28462,
62,
32656,
62,
15908,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
900,
62,
69,
22564,
62,
1462,
62,
22570,
0,
7,
69,
22564,
3712,
37,
22564,
43,
54,
90,
9792,
30072,
810,
1391,
9792,
27,
25,
23839,
43879,
92,
198,
198,
7248,
890,
19204,
28462,
284,
6632,
198,
198,
37811,
198,
8818,
900,
62,
69,
22564,
62,
1462,
62,
22570,
0,
7,
69,
22564,
3712,
37,
22564,
43,
54,
90,
9792,
30072,
810,
1391,
9792,
27,
25,
23839,
43879,
92,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
929,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
32656,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
3262,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
900,
62,
69,
22564,
62,
1462,
62,
22570,
0,
7,
69,
22564,
3712,
37,
22564,
17887,
90,
9792,
30072,
810,
1391,
9792,
27,
25,
23839,
43879,
92,
198,
198,
7248,
1790,
19204,
28462,
284,
6632,
198,
198,
37811,
198,
8818,
900,
62,
69,
22564,
62,
1462,
62,
22570,
0,
7,
69,
22564,
3712,
37,
22564,
17887,
90,
9792,
30072,
810,
1391,
9792,
27,
25,
23839,
43879,
92,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
929,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
32656,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
3262,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
28462,
13,
69,
22564,
62,
32656,
62,
15908,
764,
28,
19446,
7,
15,
8,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
751,
62,
1462,
62,
69,
22564,
0,
7,
69,
22564,
16,
3712,
37,
22564,
43,
54,
11,
28462,
17,
3712,
37,
22564,
43,
54,
8,
198,
198,
2860,
890,
19204,
28462,
17,
284,
890,
19204,
28462,
16,
220,
198,
69,
22564,
16,
764,
47932,
28462,
17,
198,
198,
37811,
198,
8818,
751,
62,
1462,
62,
69,
22564,
0,
7,
69,
22564,
16,
3712,
37,
22564,
43,
54,
11,
28462,
17,
3712,
37,
22564,
43,
54,
8,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
929,
764,
47932,
28462,
17,
13,
69,
22564,
62,
929,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
32656,
764,
47932,
28462,
17,
13,
69,
22564,
62,
32656,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
3262,
764,
47932,
28462,
17,
13,
69,
22564,
62,
3262,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
751,
62,
1462,
62,
69,
22564,
0,
7,
69,
22564,
16,
3712,
37,
22564,
17887,
11,
28462,
17,
3712,
37,
22564,
17887,
8,
198,
198,
2860,
1790,
19204,
28462,
17,
284,
1790,
19204,
28462,
16,
220,
198,
69,
22564,
16,
764,
47932,
28462,
17,
198,
198,
37811,
198,
8818,
751,
62,
1462,
62,
69,
22564,
0,
7,
69,
22564,
16,
3712,
37,
22564,
17887,
11,
28462,
17,
3712,
37,
22564,
17887,
8,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
929,
764,
47932,
28462,
17,
13,
69,
22564,
62,
929,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
32656,
764,
47932,
28462,
17,
13,
69,
22564,
62,
32656,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
3262,
764,
47932,
28462,
17,
13,
69,
22564,
62,
3262,
198,
220,
220,
220,
28462,
16,
13,
69,
22564,
62,
32656,
62,
15908,
764,
47932,
28462,
17,
13,
69,
22564,
62,
32656,
62,
15908,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
437,
198
] | 1.975338 | 1,703 |
for ( julia_fun, ippf_prefix ) in [ ( :"insert julia function name", "ippsFunctionBaseName" ) ]
for ( "TypeSignatures" ) in "AnArrayOfTuples"
julia_fun! = symbol(string(julia_fun, '!')) # in-place version if it makes sense
@eval begin
function $(julia_fun!)( buffer, "julia function arguments" )
sigLen = length( signal )
outLen = length( buffer )
@ippscall( $ippfsr, ( "the c function argument types" ),
"julia varables to pass to the c function")
buffer
end # function
$(julia_fun)( "julia function arguments" ) = $(julia_fun!)( "create a buffer", "julia function arguments" )
end # eval
end # type loop
end # function loop | [
1640,
357,
474,
43640,
62,
12543,
11,
1312,
381,
69,
62,
40290,
1267,
220,
287,
220,
685,
357,
220,
220,
1058,
1,
28463,
474,
43640,
2163,
1438,
1600,
220,
366,
3974,
82,
22203,
14881,
5376,
1,
220,
1267,
2361,
198,
220,
220,
220,
329,
357,
366,
6030,
11712,
6691,
1,
1267,
287,
366,
2025,
19182,
5189,
47247,
2374,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
474,
43640,
62,
12543,
0,
796,
6194,
7,
8841,
7,
73,
43640,
62,
12543,
11,
705,
13679,
4008,
1303,
287,
12,
5372,
2196,
611,
340,
1838,
2565,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
18206,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2163,
29568,
73,
43640,
62,
12543,
0,
5769,
11876,
11,
366,
73,
43640,
2163,
7159,
1,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
43237,
30659,
796,
4129,
7,
6737,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
30659,
796,
4129,
7,
11876,
1267,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
3974,
1416,
439,
7,
720,
3974,
9501,
81,
11,
220,
357,
220,
366,
1169,
269,
2163,
4578,
3858,
1,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
73,
43640,
1401,
2977,
284,
1208,
284,
262,
269,
2163,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11876,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
1303,
2163,
220,
220,
220,
220,
220,
220,
220,
220,
220,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29568,
73,
43640,
62,
12543,
5769,
366,
73,
43640,
2163,
7159,
1,
1267,
796,
29568,
73,
43640,
62,
12543,
0,
5769,
366,
17953,
257,
11876,
1600,
366,
73,
43640,
2163,
7159,
1,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
886,
1303,
5418,
198,
220,
220,
220,
886,
1303,
2099,
9052,
198,
437,
1303,
2163,
9052
] | 1.795993 | 549 |
# Simple Text File
immutable Simple <: FileFormat end
const _simpleparser_start = 2
const _simpleparser_first_final = 2
const _simpleparser_error = 0
const _simpleparser_en_main = 2
const __simpleparser_nfa_targs = Int8[ 0, 0 , ]
const __simpleparser_nfa_offsets = Int8[ 0, 0, 0, 0 , ]
const __simpleparser_nfa_push_actions = Int8[ 0, 0 , ]
const __simpleparser_nfa_pop_trans = Int8[ 0, 0 , ]
type SimpleParser <: AbstractParser
state::Ragel.State
seqbuf::BufferedOutputStream{ BufferedStreams.EmptyStreamSource}
function SimpleParser(input::BufferedInputStream)
begin
cs = convert( Int , _simpleparser_start );
end
return new(Ragel.State(cs, input), BufferedOutputStream())
end
end
Base.eltype(::Type{SimpleParser}) = Line
type Line
data::ASCIIString
Line() = new()
Line(line) = new(line)
end
Base.convert(::Type{ASCIIString}, line::Line) = line.data
function Base.open(input::BufferedInputStream, ::Type{Simple})
return SimpleParser(input)
end
Base.copy(line::Line) = Line(copy(line.data))
Ragel.@generate_read_fuction(
"_simpleparser",
SimpleParser,
Line,
begin
begin
if ( p == pe )
@goto _test_eof
end
if ( cs == 2 )
@goto st_case_2
elseif ( cs == 1 )
@goto st_case_1
elseif ( cs == 0 )
@goto st_case_0
end
@goto st_out
@label ctr1
begin
output.data = Ragel.@ascii_from_anchor!
yield = true
begin
p+= 1;
cs = 2;
@goto _out
end
end
begin
state.linenum += 1
end
@goto st2
@label st2
p+= 1;
if ( p == pe )
@goto _test_eof2
end
@label st_case_2
if ( (data[1+(p )])== 10 )
begin
@goto st0
end
end
begin
@goto ctr3
end
@label ctr2
begin
output.data = Ragel.@ascii_from_anchor!
yield = true
begin
p+= 1;
cs = 1;
@goto _out
end
end
@goto st1
@label ctr3
begin
Ragel.@anchor!
end
@goto st1
@label st1
p+= 1;
if ( p == pe )
@goto _test_eof1
end
@label st_case_1
if ( (data[1+(p )]) == 10 )
begin
@goto ctr1
end
elseif ( (data[1+(p )]) == 13 )
begin
@goto ctr2
end
end
begin
@goto st1
end
@label st_case_0
@label st0
cs = 0;
@goto _out
@label st_out
@label _test_eof2
cs = 2;
@goto _test_eof
@label _test_eof1
cs = 1;
@goto _test_eof
@label _test_eof
begin
end
@label _out
begin
end
end
end
)
| [
2,
17427,
8255,
9220,
198,
198,
8608,
18187,
17427,
1279,
25,
9220,
26227,
886,
198,
197,
198,
9979,
4808,
36439,
48610,
62,
9688,
220,
796,
362,
198,
9979,
4808,
36439,
48610,
62,
11085,
62,
20311,
220,
796,
362,
198,
9979,
4808,
36439,
48610,
62,
18224,
220,
796,
657,
198,
9979,
4808,
36439,
48610,
62,
268,
62,
12417,
220,
796,
362,
198,
9979,
11593,
36439,
48610,
62,
77,
13331,
62,
83,
22046,
796,
2558,
23,
58,
657,
11,
657,
837,
220,
2361,
198,
9979,
11593,
36439,
48610,
62,
77,
13331,
62,
8210,
1039,
796,
2558,
23,
58,
657,
11,
657,
11,
657,
11,
657,
837,
220,
2361,
198,
9979,
11593,
36439,
48610,
62,
77,
13331,
62,
14689,
62,
4658,
796,
2558,
23,
58,
657,
11,
657,
837,
220,
2361,
198,
9979,
11593,
36439,
48610,
62,
77,
13331,
62,
12924,
62,
7645,
796,
2558,
23,
58,
657,
11,
657,
837,
220,
2361,
198,
4906,
17427,
46677,
1279,
25,
27741,
46677,
198,
197,
5219,
3712,
49,
363,
417,
13,
9012,
198,
197,
41068,
29325,
3712,
36474,
1068,
26410,
12124,
90,
197,
36474,
1068,
12124,
82,
13,
40613,
12124,
7416,
92,
198,
198,
8818,
17427,
46677,
7,
15414,
3712,
36474,
1068,
20560,
12124,
8,
198,
197,
27471,
198,
197,
6359,
796,
10385,
7,
2558,
837,
4808,
36439,
48610,
62,
9688,
5619,
198,
197,
198,
437,
198,
7783,
649,
7,
49,
363,
417,
13,
9012,
7,
6359,
11,
5128,
828,
8792,
1068,
26410,
12124,
28955,
198,
437,
198,
197,
437,
198,
198,
14881,
13,
417,
4906,
7,
3712,
6030,
90,
26437,
46677,
30072,
796,
6910,
198,
198,
4906,
6910,
198,
7890,
3712,
42643,
3978,
10100,
198,
13949,
3419,
796,
649,
3419,
198,
13949,
7,
1370,
8,
796,
649,
7,
1370,
8,
198,
437,
198,
198,
14881,
13,
1102,
1851,
7,
3712,
6030,
90,
42643,
3978,
10100,
5512,
1627,
3712,
13949,
8,
796,
1627,
13,
7890,
198,
198,
8818,
7308,
13,
9654,
7,
15414,
3712,
36474,
1068,
20560,
12124,
11,
7904,
6030,
90,
26437,
30072,
198,
7783,
17427,
46677,
7,
15414,
8,
198,
437,
198,
198,
14881,
13,
30073,
7,
1370,
3712,
13949,
8,
796,
6910,
7,
30073,
7,
1370,
13,
7890,
4008,
198,
198,
49,
363,
417,
13,
31,
8612,
378,
62,
961,
62,
69,
8110,
7,
198,
1,
62,
36439,
48610,
1600,
198,
26437,
46677,
11,
198,
13949,
11,
198,
27471,
198,
27471,
198,
361,
357,
279,
6624,
613,
220,
1267,
198,
31,
70,
2069,
4808,
9288,
62,
68,
1659,
198,
198,
437,
198,
361,
357,
50115,
220,
6624,
362,
1267,
198,
31,
70,
2069,
336,
62,
7442,
62,
17,
198,
17772,
361,
357,
50115,
220,
6624,
352,
1267,
198,
31,
70,
2069,
336,
62,
7442,
62,
16,
198,
17772,
361,
357,
50115,
220,
6624,
657,
1267,
198,
31,
70,
2069,
336,
62,
7442,
62,
15,
198,
437,
198,
31,
70,
2069,
336,
62,
448,
198,
31,
18242,
269,
2213,
16,
198,
27471,
198,
22915,
13,
7890,
796,
38000,
417,
13,
31,
292,
979,
72,
62,
6738,
62,
3702,
273,
0,
198,
88,
1164,
796,
2081,
198,
27471,
198,
79,
47932,
352,
26,
198,
6359,
796,
362,
26,
198,
31,
70,
2069,
4808,
448,
198,
198,
437,
198,
198,
437,
198,
27471,
198,
5219,
13,
2815,
44709,
15853,
352,
198,
437,
198,
31,
70,
2069,
336,
17,
198,
31,
18242,
336,
17,
198,
79,
47932,
352,
26,
198,
361,
357,
279,
6624,
613,
220,
1267,
198,
31,
70,
2069,
4808,
9288,
62,
68,
1659,
17,
198,
198,
437,
198,
31,
18242,
336,
62,
7442,
62,
17,
198,
361,
357,
357,
7890,
58,
16,
33747,
79,
1267,
12962,
855,
838,
220,
1267,
198,
27471,
198,
31,
70,
2069,
336,
15,
198,
198,
437,
198,
198,
437,
198,
27471,
198,
31,
70,
2069,
269,
2213,
18,
198,
198,
437,
198,
31,
18242,
269,
2213,
17,
198,
27471,
198,
22915,
13,
7890,
796,
38000,
417,
13,
31,
292,
979,
72,
62,
6738,
62,
3702,
273,
0,
198,
88,
1164,
796,
2081,
198,
27471,
198,
79,
47932,
352,
26,
198,
6359,
796,
352,
26,
198,
31,
70,
2069,
4808,
448,
198,
198,
437,
198,
198,
437,
198,
31,
70,
2069,
336,
16,
198,
31,
18242,
269,
2213,
18,
198,
27471,
198,
49,
363,
417,
13,
31,
3702,
273,
0,
198,
437,
198,
31,
70,
2069,
336,
16,
198,
31,
18242,
336,
16,
198,
79,
47932,
352,
26,
198,
361,
357,
279,
6624,
613,
220,
1267,
198,
31,
70,
2069,
4808,
9288,
62,
68,
1659,
16,
198,
198,
437,
198,
31,
18242,
336,
62,
7442,
62,
16,
198,
361,
357,
357,
7890,
58,
16,
33747,
79,
1267,
12962,
6624,
838,
1267,
198,
27471,
198,
31,
70,
2069,
269,
2213,
16,
198,
198,
437,
198,
17772,
361,
357,
357,
7890,
58,
16,
33747,
79,
1267,
12962,
6624,
1511,
1267,
198,
27471,
198,
31,
70,
2069,
269,
2213,
17,
198,
198,
437,
198,
437,
198,
27471,
198,
31,
70,
2069,
336,
16,
198,
198,
437,
198,
31,
18242,
336,
62,
7442,
62,
15,
198,
31,
18242,
336,
15,
198,
6359,
796,
657,
26,
198,
31,
70,
2069,
4808,
448,
198,
31,
18242,
336,
62,
448,
198,
31,
18242,
4808,
9288,
62,
68,
1659,
17,
198,
6359,
796,
362,
26,
198,
31,
70,
2069,
4808,
9288,
62,
68,
1659,
198,
31,
18242,
4808,
9288,
62,
68,
1659,
16,
198,
6359,
796,
352,
26,
198,
31,
70,
2069,
4808,
9288,
62,
68,
1659,
198,
31,
18242,
4808,
9288,
62,
68,
1659,
198,
27471,
198,
198,
437,
198,
31,
18242,
4808,
448,
198,
27471,
198,
198,
437,
198,
198,
437,
198,
437,
198,
8,
198
] | 2.317047 | 921 |
const POSITIVES = 1:∞
struct Skip{Synthesizer}
synthesizer::Synthesizer
time::TIME
end
function make_series(skip::Skip, sample_rate)
make_series(skip.synthesizer, sample_rate)[
(round(Int, skip.time * sample_rate)+1):end
]
end
"""
Map(a_function, synthesizers...)
Map `a_function` over `synthesizers`. Supports [`make_series`](@ref).
```jldoctest
julia> using AudioSchedules
julia> using Unitful: Hz
julia> first(make_series(Map(sin, Cycles(440Hz)), 44100Hz))
0.06264832417874369
```
"""
struct Map{AFunction,Synthesizers}
a_function::AFunction
synthesizers::Synthesizers
function Map(a_function::AFunction, synthesizers...) where {AFunction}
new{AFunction,typeof(synthesizers)}(a_function, synthesizers)
end
end
export Map
"""
make_series(synthesizer, sample_rate)
Return an iterator that will the play the `synthesizer` at `sample_rate` (with frequency units, like `Hz`).
The iterator should yield `Float64`s between -1 and 1.
Assumes that iterators will never end while they are scheduled.
"""
function make_series(a_map::Map, sample_rate)
broadcast(
a_map.a_function,
map(let sample_rate = sample_rate
function (synthesizer)
make_series(synthesizer, sample_rate)
end
end, a_map.synthesizers)...,
)
end
export make_series
"""
Line(start_level, slope)
A line from `start_level` (unitless) with `slope` (with units per time like `1/s`). Supports
[`make_series`](@ref) and [`segments`](@ref).
```jldoctest
julia> using AudioSchedules
julia> using Unitful: Hz, s
julia> first(make_series(Line(0, 1 / s), 44100Hz))
2.2675736961451248e-5
```
"""
struct Line
start_level::Float64
slope::RATE
end
export Line
function make_series(line::Line, sample_rate)
line.start_level .+ (line.slope / sample_rate) .* POSITIVES
end
"""
segments(shape, start_level, duration, end_level)
Called for each envelope segment passed to [`push!`](@ref). Return a tuple of pairs in the form `(segment, duration)`,
where duration has units of time (like `s`), for a segment of shape `shape`.
```jldoctest
julia> using AudioSchedules
julia> using Unitful: s
julia> segments(Grow, 1, 1s, ℯ)
((Grow(1.0, 1.0 s⁻¹), 1 s),)
```
"""
function segments(::Type{Line}, start_level, duration, end_level)
((Line(start_level, (end_level - start_level) / duration), duration),)
end
export segments
const τ = 2 * π
# TODO: No need to cycle here; sin is periodic?
"""
Cycles(frequency)
Cycles from 0 to 2π to repeat at a `frequency` (with frequency units, like `Hz`).
Supports [`make_series`](@ref).
```jldoctest
julia> using AudioSchedules
julia> using Unitful: Hz
julia> first(make_series(Cycles(440Hz), 44100Hz))
0.06268937721449021
```
"""
struct Cycles
frequency::FREQUENCY
end
export Cycles
function make_series(cycles::Cycles, sample_rate)
((cycles.frequency / sample_rate * τ) .* POSITIVES) .% τ
end
"""
Grow(start_level, rate)
Exponentially grow or decay from `start_level` (unitless), at a continuous `rate` (with units per time like `1/s`).
Supports [`make_series`](@ref) and [`segments`](@ref).
```jldoctest
julia> using AudioSchedules
julia> using Unitful: Hz, s
julia> first(make_series(Grow(1, 1 / s), 44100Hz))
1.0000226759940578
```
"""
struct Grow
start_level::Float64
rate::RATE
end
export Grow
function make_series(grow::Grow, sample_rate)
grow.start_level .* exp(grow.rate / sample_rate) .^ POSITIVES
end
function segments(::Type{Grow}, start_level, duration, end_level)
((Grow(start_level, log(end_level / start_level) / duration), duration),)
end
| [
9979,
28069,
2043,
42472,
796,
352,
25,
24861,
252,
198,
198,
7249,
32214,
90,
13940,
429,
956,
7509,
92,
198,
220,
220,
220,
24983,
7509,
3712,
13940,
429,
956,
7509,
198,
220,
220,
220,
640,
3712,
34694,
198,
437,
198,
198,
8818,
787,
62,
25076,
7,
48267,
3712,
50232,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
787,
62,
25076,
7,
48267,
13,
1837,
429,
956,
7509,
11,
6291,
62,
4873,
38381,
198,
220,
220,
220,
220,
220,
220,
220,
357,
744,
7,
5317,
11,
14267,
13,
2435,
1635,
6291,
62,
4873,
47762,
16,
2599,
437,
198,
220,
220,
220,
2361,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
9347,
7,
64,
62,
8818,
11,
24983,
11341,
23029,
198,
198,
13912,
4600,
64,
62,
8818,
63,
625,
4600,
1837,
429,
956,
11341,
44646,
45267,
685,
63,
15883,
62,
25076,
63,
16151,
31,
5420,
737,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
1262,
13491,
50,
1740,
5028,
628,
198,
73,
43640,
29,
1262,
11801,
913,
25,
26109,
628,
198,
73,
43640,
29,
717,
7,
15883,
62,
25076,
7,
13912,
7,
31369,
11,
5934,
5427,
7,
25644,
7399,
36911,
5846,
3064,
7399,
4008,
198,
15,
13,
3312,
2075,
2780,
33916,
23188,
4524,
30803,
198,
15506,
63,
198,
37811,
198,
7249,
9347,
90,
8579,
4575,
11,
13940,
429,
956,
11341,
92,
198,
220,
220,
220,
257,
62,
8818,
3712,
8579,
4575,
198,
220,
220,
220,
24983,
11341,
3712,
13940,
429,
956,
11341,
198,
220,
220,
220,
2163,
9347,
7,
64,
62,
8818,
3712,
8579,
4575,
11,
24983,
11341,
23029,
810,
1391,
8579,
4575,
92,
198,
220,
220,
220,
220,
220,
220,
220,
649,
90,
8579,
4575,
11,
4906,
1659,
7,
1837,
429,
956,
11341,
38165,
7,
64,
62,
8818,
11,
24983,
11341,
8,
198,
220,
220,
220,
886,
198,
437,
198,
39344,
9347,
198,
198,
37811,
198,
220,
220,
220,
787,
62,
25076,
7,
1837,
429,
956,
7509,
11,
6291,
62,
4873,
8,
198,
198,
13615,
281,
41313,
326,
481,
262,
711,
262,
4600,
1837,
429,
956,
7509,
63,
379,
4600,
39873,
62,
4873,
63,
357,
4480,
8373,
4991,
11,
588,
4600,
7399,
63,
737,
198,
464,
41313,
815,
7800,
4600,
43879,
2414,
63,
82,
1022,
532,
16,
290,
352,
13,
198,
8021,
8139,
326,
11629,
2024,
481,
1239,
886,
981,
484,
389,
7530,
13,
198,
37811,
198,
8818,
787,
62,
25076,
7,
64,
62,
8899,
3712,
13912,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
7025,
7,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
8899,
13,
64,
62,
8818,
11,
198,
220,
220,
220,
220,
220,
220,
220,
3975,
7,
1616,
6291,
62,
4873,
796,
6291,
62,
4873,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2163,
357,
1837,
429,
956,
7509,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
25076,
7,
1837,
429,
956,
7509,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
11,
257,
62,
8899,
13,
1837,
429,
956,
11341,
26513,
11,
198,
220,
220,
220,
1267,
198,
437,
198,
39344,
787,
62,
25076,
198,
198,
37811,
198,
220,
220,
220,
6910,
7,
9688,
62,
5715,
11,
22638,
8,
198,
198,
32,
1627,
422,
4600,
9688,
62,
5715,
63,
357,
20850,
1203,
8,
351,
4600,
6649,
3008,
63,
357,
4480,
4991,
583,
640,
588,
4600,
16,
14,
82,
63,
737,
45267,
198,
58,
63,
15883,
62,
25076,
63,
16151,
31,
5420,
8,
290,
685,
63,
325,
11726,
63,
16151,
31,
5420,
737,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
1262,
13491,
50,
1740,
5028,
628,
198,
73,
43640,
29,
1262,
11801,
913,
25,
26109,
11,
264,
628,
198,
73,
43640,
29,
717,
7,
15883,
62,
25076,
7,
13949,
7,
15,
11,
352,
1220,
264,
828,
5846,
3064,
7399,
4008,
198,
17,
13,
2075,
39251,
2623,
4846,
18781,
1065,
2780,
68,
12,
20,
198,
15506,
63,
198,
37811,
198,
7249,
6910,
198,
220,
220,
220,
923,
62,
5715,
3712,
43879,
2414,
198,
220,
220,
220,
22638,
3712,
49,
6158,
198,
437,
198,
39344,
6910,
198,
198,
8818,
787,
62,
25076,
7,
1370,
3712,
13949,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
1627,
13,
9688,
62,
5715,
764,
10,
357,
1370,
13,
6649,
3008,
1220,
6291,
62,
4873,
8,
764,
9,
28069,
2043,
42472,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
17894,
7,
43358,
11,
923,
62,
5715,
11,
9478,
11,
886,
62,
5715,
8,
198,
198,
34,
4262,
329,
1123,
22878,
10618,
3804,
284,
685,
63,
14689,
0,
63,
16151,
31,
5420,
737,
8229,
257,
46545,
286,
14729,
287,
262,
1296,
4600,
7,
325,
5154,
11,
9478,
8,
47671,
198,
3003,
9478,
468,
4991,
286,
640,
357,
2339,
4600,
82,
63,
828,
329,
257,
10618,
286,
5485,
4600,
43358,
44646,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
1262,
13491,
50,
1740,
5028,
628,
198,
73,
43640,
29,
1262,
11801,
913,
25,
264,
628,
198,
73,
43640,
29,
17894,
7,
38,
808,
11,
352,
11,
352,
82,
11,
2343,
226,
107,
8,
198,
19510,
38,
808,
7,
16,
13,
15,
11,
352,
13,
15,
264,
46256,
119,
126,
117,
828,
352,
264,
828,
8,
198,
15506,
63,
198,
37811,
198,
8818,
17894,
7,
3712,
6030,
90,
13949,
5512,
923,
62,
5715,
11,
9478,
11,
886,
62,
5715,
8,
198,
220,
220,
220,
14808,
13949,
7,
9688,
62,
5715,
11,
357,
437,
62,
5715,
532,
923,
62,
5715,
8,
1220,
9478,
828,
9478,
828,
8,
198,
437,
198,
39344,
17894,
198,
198,
9979,
46651,
796,
362,
1635,
18074,
222,
198,
198,
2,
16926,
46,
25,
1400,
761,
284,
6772,
994,
26,
7813,
318,
27458,
30,
198,
37811,
198,
220,
220,
220,
5934,
5427,
7,
35324,
8,
198,
198,
20418,
5427,
422,
657,
284,
362,
46582,
284,
9585,
379,
257,
4600,
35324,
63,
357,
4480,
8373,
4991,
11,
588,
4600,
7399,
63,
737,
198,
15979,
2096,
685,
63,
15883,
62,
25076,
63,
16151,
31,
5420,
737,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
1262,
13491,
50,
1740,
5028,
628,
198,
73,
43640,
29,
1262,
11801,
913,
25,
26109,
628,
198,
73,
43640,
29,
717,
7,
15883,
62,
25076,
7,
20418,
5427,
7,
25644,
7399,
828,
5846,
3064,
7399,
4008,
198,
15,
13,
3312,
2075,
4531,
2718,
4761,
1415,
31503,
2481,
198,
15506,
63,
198,
37811,
198,
7249,
5934,
5427,
198,
220,
220,
220,
8373,
3712,
37,
2200,
10917,
45155,
198,
437,
198,
39344,
5934,
5427,
198,
198,
8818,
787,
62,
25076,
7,
32503,
3712,
20418,
5427,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
14808,
32503,
13,
35324,
1220,
6291,
62,
4873,
1635,
46651,
8,
764,
9,
28069,
2043,
42472,
8,
764,
4,
46651,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
26936,
7,
9688,
62,
5715,
11,
2494,
8,
198,
198,
16870,
3471,
1927,
1663,
393,
22119,
422,
4600,
9688,
62,
5715,
63,
357,
20850,
1203,
828,
379,
257,
12948,
4600,
4873,
63,
357,
4480,
4991,
583,
640,
588,
4600,
16,
14,
82,
63,
737,
198,
15979,
2096,
685,
63,
15883,
62,
25076,
63,
16151,
31,
5420,
8,
290,
685,
63,
325,
11726,
63,
16151,
31,
5420,
737,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
1262,
13491,
50,
1740,
5028,
628,
198,
73,
43640,
29,
1262,
11801,
913,
25,
26109,
11,
264,
628,
198,
73,
43640,
29,
717,
7,
15883,
62,
25076,
7,
38,
808,
7,
16,
11,
352,
1220,
264,
828,
5846,
3064,
7399,
4008,
198,
16,
13,
2388,
24909,
2425,
2079,
1821,
38907,
198,
15506,
63,
198,
37811,
198,
7249,
26936,
198,
220,
220,
220,
923,
62,
5715,
3712,
43879,
2414,
198,
220,
220,
220,
2494,
3712,
49,
6158,
198,
437,
198,
39344,
26936,
198,
198,
8818,
787,
62,
25076,
7,
45921,
3712,
38,
808,
11,
6291,
62,
4873,
8,
198,
220,
220,
220,
1663,
13,
9688,
62,
5715,
764,
9,
1033,
7,
45921,
13,
4873,
1220,
6291,
62,
4873,
8,
764,
61,
28069,
2043,
42472,
198,
437,
198,
198,
8818,
17894,
7,
3712,
6030,
90,
38,
808,
5512,
923,
62,
5715,
11,
9478,
11,
886,
62,
5715,
8,
198,
220,
220,
220,
14808,
38,
808,
7,
9688,
62,
5715,
11,
2604,
7,
437,
62,
5715,
1220,
923,
62,
5715,
8,
1220,
9478,
828,
9478,
828,
8,
198,
437,
198
] | 2.588944 | 1,411 |
using Bokeh; autoopen(true)
m = BCFL22C()
@time lzbar, lg = simulate_exog(m);
# κ = [0.05, 0.95, -0.1 0.5]
κ = [0.0, 1.0, 0.0]
κ0, κ1, κ2 = κ
ξ = 0.05
deg = 3
sim_data = X[1:capT-1, 2:end]
l♠, κ = main()
fstv = FullState(1.0, 2.0, 3.0, 5.0)
fst = FullState(κ, κ, κ, κ)
asarray(fst)
st = TimeTState([1,2], [3,4])
for (i, x) in enumerate(fst)
@show i,x
end
Matrix(fst)
plot(grid[:, 1], grid[:, 2], "b*")
plot(LHS)
plot(fsts.l♠)
pf = PolicyFunction{1}(ones(5))
evaluate(pf, fst)
Matrix(fst)
Matrix{Float64}(fst)
plot(l♠)
linear_coefs(m, lzbar, lg, κ, maxiter=5)
capT = length(lzbar)
♠ = ones(capT+1)
# simulate ♠ forward and solve for sa along the way
@inbounds for t=1:capT
# extract time t state
♠t = ♠[t]
lzt = lzbar[t]
# update ♠_{t+1}
♠p = b0+ b1*♠t + b2*lzt
♠[t+1] = ♠p
end
t
showplot(plot(1:capT, ♠[1:capT]))
showplot(plot(1:capT, lzbar))
plot(l♠)
a1 = 1-1e-15
t = 48
showplot(plot(1:length(c1)', [c1 c2], legends=["c1", "c2"]))
using StatsBase
@doc quantile
foobar(m, 0.4, 1.0)
qnwmonomial(2, eye(2), :second)
qnwgh(4, 2)[2]
extrema(exp(lzbar))
1/0.95
♠sim = ♠
zbarsim = exp(lzbar)
showplot(plot(♠sim, zbarsim, "."))
showplot(plot(eds[:,1], eds[:,2], "."))
x = linspace(0, 2pi)
y1 = sin(x)
y2 = cos(x)
y3 = tan(x)
plot(x, [y1 y2 y3], "rs|bo|g*")
showplot()
tol=1e-8
deg = 3 # 5.13 seconds
deg = 5 # 6.48 seconds
κ = κ_old
maxit = 5000
it
x = rand(2, 10)
showplot(plot(l♠))
showplot(plot(LHS))
showplot(plot([c1[1:t-1] c2[1:t-1]], legends=["c1", "c2"]))
#=
omega = 1-0.972; sigma =-2/3;
xi = 1.004;
ratio_phi = 1.9375;
b = @(a) xi/(1+((1-omega)^2/omega^2)^(1/(sigma-1))*(a/(1-a)));
c1 = @(a) ((1-omega)*a^sigma + omega*(xi-b(a))^sigma)^(1/sigma);
c2 = @(a) ((1-omega)*b(a)^sigma + omega*(1-a)^sigmaIs )^(1/sigma);
ratio_implied = @(a) c2(a)^(1-sigma)*omega*(1-a)^(sigma-1)/(c1(a)^(1-sigma)*(1-omega)*a^(sigma-1));
tol=1; alb = eps; aub = 1-eps;
while tol>1e-5
a = (alb+aub)/2;
foc = ratio_implied(a) - ratio_phi;
if foc<=0
alb = a;
else
aub = a;
end
tol = abs(foc);
tol
pause
end
=#
n_complete(2, 3)
pf = PolicyFunction{3}(rand(10))
@code_warntype evaluate(pf, [1.0, 2.0])
state = [1.0, 2.0]
complete_polynomial([1 3], 3)
complete_polynomial(rand(5, 2), 3)
| [
3500,
347,
2088,
71,
26,
8295,
9654,
7,
7942,
8,
198,
198,
76,
796,
11843,
3697,
1828,
34,
3419,
198,
31,
2435,
300,
89,
5657,
11,
300,
70,
796,
29308,
62,
1069,
519,
7,
76,
1776,
198,
2,
7377,
118,
796,
685,
15,
13,
2713,
11,
657,
13,
3865,
11,
532,
15,
13,
16,
657,
13,
20,
60,
198,
43000,
796,
685,
15,
13,
15,
11,
352,
13,
15,
11,
657,
13,
15,
60,
198,
43000,
15,
11,
7377,
118,
16,
11,
7377,
118,
17,
796,
7377,
118,
198,
138,
122,
796,
657,
13,
2713,
198,
13500,
796,
513,
198,
14323,
62,
7890,
796,
1395,
58,
16,
25,
11128,
51,
12,
16,
11,
362,
25,
437,
60,
198,
75,
17992,
254,
11,
7377,
118,
796,
1388,
3419,
198,
198,
69,
301,
85,
796,
6462,
9012,
7,
16,
13,
15,
11,
362,
13,
15,
11,
513,
13,
15,
11,
642,
13,
15,
8,
198,
69,
301,
796,
6462,
9012,
7,
43000,
11,
7377,
118,
11,
7377,
118,
11,
7377,
118,
8,
198,
292,
18747,
7,
69,
301,
8,
198,
198,
301,
796,
3862,
51,
9012,
26933,
16,
11,
17,
4357,
685,
18,
11,
19,
12962,
198,
198,
1640,
357,
72,
11,
2124,
8,
287,
27056,
378,
7,
69,
301,
8,
198,
220,
220,
220,
2488,
12860,
1312,
11,
87,
198,
437,
198,
198,
46912,
7,
69,
301,
8,
198,
198,
29487,
7,
25928,
58,
45299,
352,
4357,
10706,
58,
45299,
362,
4357,
366,
65,
9,
4943,
198,
198,
29487,
7,
43,
7998,
8,
198,
29487,
7,
69,
6448,
13,
75,
17992,
254,
8,
198,
198,
79,
69,
796,
7820,
22203,
90,
16,
92,
7,
1952,
7,
20,
4008,
198,
49786,
7,
79,
69,
11,
277,
301,
8,
198,
198,
46912,
7,
69,
301,
8,
198,
198,
46912,
90,
43879,
2414,
92,
7,
69,
301,
8,
628,
198,
29487,
7,
75,
17992,
254,
8,
198,
29127,
62,
1073,
891,
82,
7,
76,
11,
300,
89,
5657,
11,
300,
70,
11,
7377,
118,
11,
3509,
2676,
28,
20,
8,
198,
198,
11128,
51,
796,
4129,
7,
75,
89,
5657,
8,
198,
17992,
254,
796,
3392,
7,
11128,
51,
10,
16,
8,
198,
198,
2,
29308,
20724,
254,
2651,
290,
8494,
329,
473,
1863,
262,
835,
198,
31,
259,
65,
3733,
329,
256,
28,
16,
25,
11128,
51,
198,
220,
220,
220,
1303,
7925,
640,
256,
1181,
198,
220,
220,
220,
20724,
254,
83,
796,
20724,
254,
58,
83,
60,
198,
220,
220,
220,
300,
89,
83,
796,
300,
89,
5657,
58,
83,
60,
628,
220,
220,
220,
1303,
4296,
20724,
254,
23330,
83,
10,
16,
92,
198,
220,
220,
220,
20724,
254,
79,
796,
275,
15,
10,
275,
16,
9,
17992,
254,
83,
1343,
275,
17,
9,
75,
89,
83,
198,
220,
220,
220,
20724,
254,
58,
83,
10,
16,
60,
796,
20724,
254,
79,
198,
437,
198,
83,
198,
12860,
29487,
7,
29487,
7,
16,
25,
11128,
51,
11,
20724,
254,
58,
16,
25,
11128,
51,
60,
4008,
198,
12860,
29487,
7,
29487,
7,
16,
25,
11128,
51,
11,
300,
89,
5657,
4008,
198,
198,
29487,
7,
75,
17992,
254,
8,
198,
198,
64,
16,
796,
352,
12,
16,
68,
12,
1314,
198,
83,
796,
4764,
198,
198,
12860,
29487,
7,
29487,
7,
16,
25,
13664,
7,
66,
16,
8,
3256,
685,
66,
16,
269,
17,
4357,
24901,
28,
14692,
66,
16,
1600,
366,
66,
17,
8973,
4008,
198,
198,
3500,
20595,
14881,
198,
198,
31,
15390,
5554,
576,
628,
198,
6513,
30973,
7,
76,
11,
657,
13,
19,
11,
352,
13,
15,
8,
628,
198,
80,
47516,
2144,
49070,
7,
17,
11,
4151,
7,
17,
828,
1058,
12227,
8,
198,
198,
80,
47516,
456,
7,
19,
11,
362,
38381,
17,
60,
628,
198,
2302,
260,
2611,
7,
11201,
7,
75,
89,
5657,
4008,
198,
16,
14,
15,
13,
3865,
628,
198,
17992,
254,
14323,
796,
20724,
254,
198,
14969,
945,
320,
796,
1033,
7,
75,
89,
5657,
8,
198,
198,
12860,
29487,
7,
29487,
7,
17992,
254,
14323,
11,
1976,
34046,
320,
11,
366,
526,
4008,
198,
12860,
29487,
7,
29487,
7,
5379,
58,
45299,
16,
4357,
1225,
82,
58,
45299,
17,
4357,
366,
526,
4008,
198,
198,
87,
796,
300,
1040,
10223,
7,
15,
11,
362,
14415,
8,
198,
88,
16,
796,
7813,
7,
87,
8,
198,
88,
17,
796,
8615,
7,
87,
8,
198,
88,
18,
796,
25706,
7,
87,
8,
198,
198,
29487,
7,
87,
11,
685,
88,
16,
331,
17,
331,
18,
4357,
366,
3808,
91,
2127,
91,
70,
9,
4943,
198,
12860,
29487,
3419,
628,
198,
83,
349,
28,
16,
68,
12,
23,
198,
13500,
796,
513,
220,
1303,
642,
13,
1485,
4201,
198,
13500,
796,
642,
220,
1303,
718,
13,
2780,
4201,
198,
43000,
796,
7377,
118,
62,
727,
198,
9806,
270,
796,
23336,
198,
270,
198,
198,
87,
796,
43720,
7,
17,
11,
838,
8,
198,
198,
12860,
29487,
7,
29487,
7,
75,
17992,
254,
4008,
198,
12860,
29487,
7,
29487,
7,
43,
7998,
4008,
198,
12860,
29487,
7,
29487,
26933,
66,
16,
58,
16,
25,
83,
12,
16,
60,
269,
17,
58,
16,
25,
83,
12,
16,
60,
4357,
24901,
28,
14692,
66,
16,
1600,
366,
66,
17,
8973,
4008,
198,
198,
2,
28,
198,
462,
4908,
796,
352,
12,
15,
13,
24,
4761,
26,
264,
13495,
796,
12,
17,
14,
18,
26,
198,
198,
29992,
796,
352,
13,
22914,
26,
198,
198,
10366,
952,
62,
34846,
796,
352,
13,
6052,
2425,
26,
198,
198,
65,
796,
2488,
7,
64,
8,
2124,
72,
29006,
16,
10,
19510,
16,
12,
462,
4908,
8,
61,
17,
14,
462,
4908,
61,
17,
8,
61,
7,
16,
29006,
82,
13495,
12,
16,
4008,
9,
7,
64,
29006,
16,
12,
64,
4008,
1776,
198,
198,
66,
16,
796,
2488,
7,
64,
8,
14808,
16,
12,
462,
4908,
27493,
64,
61,
82,
13495,
1343,
37615,
9,
7,
29992,
12,
65,
7,
64,
4008,
61,
82,
13495,
8,
61,
7,
16,
14,
82,
13495,
1776,
198,
66,
17,
796,
2488,
7,
64,
8,
14808,
16,
12,
462,
4908,
27493,
65,
7,
64,
8,
61,
82,
13495,
1343,
37615,
9,
7,
16,
12,
64,
8,
61,
82,
13495,
3792,
1267,
61,
7,
16,
14,
82,
13495,
1776,
198,
10366,
952,
62,
23928,
798,
796,
2488,
7,
64,
8,
269,
17,
7,
64,
8,
61,
7,
16,
12,
82,
13495,
27493,
462,
4908,
9,
7,
16,
12,
64,
8,
61,
7,
82,
13495,
12,
16,
20679,
7,
66,
16,
7,
64,
8,
61,
7,
16,
12,
82,
13495,
27493,
7,
16,
12,
462,
4908,
27493,
64,
61,
7,
82,
13495,
12,
16,
18125,
198,
198,
83,
349,
28,
16,
26,
435,
65,
796,
304,
862,
26,
257,
549,
796,
352,
12,
25386,
26,
198,
198,
4514,
284,
75,
29,
16,
68,
12,
20,
628,
220,
220,
220,
257,
796,
357,
282,
65,
10,
64,
549,
20679,
17,
26,
198,
220,
220,
220,
2133,
796,
8064,
62,
23928,
798,
7,
64,
8,
532,
8064,
62,
34846,
26,
198,
220,
220,
220,
611,
2133,
27,
28,
15,
198,
220,
220,
220,
220,
220,
220,
220,
435,
65,
796,
257,
26,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
257,
549,
796,
257,
26,
198,
220,
220,
220,
886,
198,
220,
220,
220,
284,
75,
796,
2352,
7,
69,
420,
1776,
198,
220,
220,
220,
284,
75,
198,
220,
220,
220,
14985,
198,
437,
198,
46249,
198,
77,
62,
20751,
7,
17,
11,
513,
8,
198,
198,
79,
69,
796,
7820,
22203,
90,
18,
92,
7,
25192,
7,
940,
4008,
198,
31,
8189,
62,
5767,
429,
2981,
13446,
7,
79,
69,
11,
685,
16,
13,
15,
11,
362,
13,
15,
12962,
198,
198,
5219,
796,
685,
16,
13,
15,
11,
362,
13,
15,
60,
198,
20751,
62,
35428,
26601,
498,
26933,
16,
513,
4357,
513,
8,
198,
198,
20751,
62,
35428,
26601,
498,
7,
25192,
7,
20,
11,
362,
828,
513,
8,
198
] | 1.727891 | 1,323 |
using LightGraphs
using SimpleWeightedGraphs
using Test
testdir = dirname(@__FILE__)
testgraphs(g) = [g, SimpleWeightedGraph{UInt8,Float64}(g), SimpleWeightedGraph{Int16,Float32}(g)]
testdigraphs(g) = [g, SimpleWeightedDiGraph{UInt8,Float64}(g), SimpleWeightedDiGraph{Int16,Float32}(g)]
testsimplegraphs(g) = [g, LightGraphs.SimpleGraph{UInt8}(g), LightGraphs.SimpleGraph{Int16}(g)]
testsimpledigraphs(g) = [g, LightGraphs.SimpleDiGraph{UInt8}(g), LightGraphs.SimpleDiGraph{Int16}(g)]
tests = [
"simpleweightededge",
"simpleweightedgraph",
"overrides",
"persistence",
"connectivity"
]
@testset "SimpleWeightedGraphs" begin
for t in tests
tp = joinpath(testdir, "$(t).jl")
include(tp)
end
end
| [
3500,
4401,
37065,
82,
198,
3500,
17427,
25844,
276,
37065,
82,
198,
3500,
6208,
198,
198,
9288,
15908,
796,
26672,
3672,
7,
31,
834,
25664,
834,
8,
198,
198,
9288,
34960,
82,
7,
70,
8,
796,
685,
70,
11,
17427,
25844,
276,
37065,
90,
52,
5317,
23,
11,
43879,
2414,
92,
7,
70,
828,
17427,
25844,
276,
37065,
90,
5317,
1433,
11,
43879,
2624,
92,
7,
70,
15437,
198,
9288,
12894,
1470,
82,
7,
70,
8,
796,
685,
70,
11,
17427,
25844,
276,
18683,
37065,
90,
52,
5317,
23,
11,
43879,
2414,
92,
7,
70,
828,
17427,
25844,
276,
18683,
37065,
90,
5317,
1433,
11,
43879,
2624,
92,
7,
70,
15437,
198,
198,
41989,
320,
1154,
34960,
82,
7,
70,
8,
796,
685,
70,
11,
4401,
37065,
82,
13,
26437,
37065,
90,
52,
5317,
23,
92,
7,
70,
828,
4401,
37065,
82,
13,
26437,
37065,
90,
5317,
1433,
92,
7,
70,
15437,
198,
41989,
320,
10137,
45920,
82,
7,
70,
8,
796,
685,
70,
11,
4401,
37065,
82,
13,
26437,
18683,
37065,
90,
52,
5317,
23,
92,
7,
70,
828,
4401,
37065,
82,
13,
26437,
18683,
37065,
90,
5317,
1433,
92,
7,
70,
15437,
198,
198,
41989,
796,
685,
198,
220,
220,
220,
366,
36439,
6551,
276,
14907,
1600,
198,
220,
220,
220,
366,
36439,
6551,
276,
34960,
1600,
198,
220,
220,
220,
366,
2502,
81,
1460,
1600,
198,
220,
220,
220,
366,
19276,
13274,
1600,
198,
220,
220,
220,
366,
8443,
3458,
1,
198,
60,
198,
198,
31,
9288,
2617,
366,
26437,
25844,
276,
37065,
82,
1,
2221,
198,
220,
220,
220,
329,
256,
287,
5254,
198,
220,
220,
220,
220,
220,
220,
220,
256,
79,
796,
4654,
6978,
7,
9288,
15908,
11,
17971,
7,
83,
737,
20362,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2291,
7,
34788,
8,
198,
220,
220,
220,
886,
198,
437,
198
] | 2.390323 | 310 |
module μodule
export @μ
macro μ(words::Symbol...)
token = :μ
for word in words
token = μagic(word, token)
end
return esc(token)
end
function μagic(word::Symbol, token)
glyphs = [Symbol(glyph) for glyph in string(word)]
while length(glyphs) > 0
glyph = eval(pop!(glyphs))
token = glyph(glyphs, token)
end
return token
end
Table = Dict([
:a => :+
:e => :^
:i => :*
:o => :/
:q => :\
:u => :-
])
a(glyphs, token) = token
b(glyphs, token) = :(x = $token; (x, x))
d(glyphs, token) = (length(glyphs) > 0 ? (f = Table[pop!(glyphs)]; :(reduce($f, $token))) :
Expr(token.head, :reduce, token.args[2:end]...))
e(glyphs, token) = (:(x = $token; ($(eval(Expr(:call, pop!(glyphs), glyphs, :(:x)))), $(eval(Expr(:call, pop!(glyphs), glyphs, :(:x)))))))
f(glyphs, token) = (fname = Symbol(glyphs...); empty!(glyphs); :($fname(μ) = $token))
g(glyphs, token) = (fname = Symbol(glyphs...); empty!(glyphs); :($fname(μ...) = $token))
h(glyphs, token) = (:(first($token)))
k(glyphs, token) = :(collect($token))
l(glyphs, token) = :(last($token))
m(glyphs, token) = (f = Table[pop!(glyphs)]; :(map($f, $token)))
n(glyphs, token) = :(x = $token; (one(x), x))
p(glyphs, token) = :(prod($token))
q(glyphs, token) = Expr(token.head, reverse(token.args))
r(glyphs, token) = (reverse!(glyphs); token)
s(glyphs, token) = :(sum($token))
t(glyphs, token) = (:($token[2:end]))
u(glyphs, token) = :(x = $token; UnitRange(x...))
w(glyphs, token) = (n = Int(first("$(pop!(glyphs))")); :($token, $n))
!(glyphs::Vector{Symbol}, token) = (:())
end
| [
21412,
18919,
375,
2261,
198,
198,
39344,
2488,
34703,
198,
198,
20285,
305,
18919,
7,
10879,
3712,
13940,
23650,
23029,
198,
220,
220,
220,
11241,
796,
1058,
34703,
198,
220,
220,
220,
329,
1573,
287,
2456,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
18919,
9083,
7,
4775,
11,
11241,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
3671,
7,
30001,
8,
198,
437,
198,
198,
8818,
18919,
9083,
7,
4775,
3712,
13940,
23650,
11,
11241,
8,
198,
220,
220,
220,
25874,
82,
796,
685,
13940,
23650,
7,
10853,
746,
8,
329,
25874,
287,
4731,
7,
4775,
15437,
198,
220,
220,
220,
981,
4129,
7,
10853,
746,
82,
8,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
25874,
796,
5418,
7,
12924,
0,
7,
10853,
746,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
25874,
7,
10853,
746,
82,
11,
11241,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
11241,
198,
437,
198,
198,
10962,
796,
360,
713,
26933,
198,
220,
220,
220,
1058,
64,
5218,
1058,
10,
198,
220,
220,
220,
1058,
68,
5218,
1058,
61,
198,
220,
220,
220,
1058,
72,
5218,
1058,
9,
198,
220,
220,
220,
1058,
78,
5218,
1058,
14,
198,
220,
220,
220,
1058,
80,
5218,
1058,
59,
198,
220,
220,
220,
1058,
84,
5218,
1058,
12,
198,
12962,
198,
198,
64,
7,
10853,
746,
82,
11,
11241,
8,
796,
11241,
198,
65,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
87,
796,
720,
30001,
26,
357,
87,
11,
2124,
4008,
198,
67,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
13664,
7,
10853,
746,
82,
8,
1875,
657,
5633,
357,
69,
796,
8655,
58,
12924,
0,
7,
10853,
746,
82,
8,
11208,
36147,
445,
7234,
16763,
69,
11,
720,
30001,
22305,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
30001,
13,
2256,
11,
1058,
445,
7234,
11,
11241,
13,
22046,
58,
17,
25,
437,
60,
986,
4008,
198,
68,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
37498,
87,
796,
720,
30001,
26,
7198,
7,
18206,
7,
3109,
1050,
7,
25,
13345,
11,
1461,
0,
7,
10853,
746,
82,
828,
25874,
82,
11,
36147,
25,
87,
22305,
828,
29568,
18206,
7,
3109,
1050,
7,
25,
13345,
11,
1461,
0,
7,
10853,
746,
82,
828,
25874,
82,
11,
36147,
25,
87,
35514,
22305,
198,
69,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
69,
3672,
796,
38357,
7,
10853,
746,
82,
986,
1776,
6565,
0,
7,
10853,
746,
82,
1776,
1058,
16763,
69,
3672,
7,
34703,
8,
796,
720,
30001,
4008,
198,
70,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
69,
3672,
796,
38357,
7,
10853,
746,
82,
986,
1776,
6565,
0,
7,
10853,
746,
82,
1776,
1058,
16763,
69,
3672,
7,
34703,
23029,
796,
720,
30001,
4008,
198,
71,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
37498,
11085,
16763,
30001,
22305,
198,
198,
74,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
33327,
16763,
30001,
4008,
198,
75,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
12957,
16763,
30001,
4008,
198,
198,
76,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
69,
796,
8655,
58,
12924,
0,
7,
10853,
746,
82,
8,
11208,
36147,
8899,
16763,
69,
11,
720,
30001,
22305,
198,
77,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
87,
796,
720,
30001,
26,
357,
505,
7,
87,
828,
2124,
4008,
198,
79,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
1676,
67,
16763,
30001,
4008,
198,
80,
7,
10853,
746,
82,
11,
11241,
8,
796,
1475,
1050,
7,
30001,
13,
2256,
11,
9575,
7,
30001,
13,
22046,
4008,
198,
81,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
50188,
0,
7,
10853,
746,
82,
1776,
11241,
8,
198,
82,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
16345,
16763,
30001,
4008,
198,
83,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
25,
16763,
30001,
58,
17,
25,
437,
60,
4008,
198,
198,
84,
7,
10853,
746,
82,
11,
11241,
8,
796,
36147,
87,
796,
720,
30001,
26,
11801,
17257,
7,
87,
986,
4008,
198,
86,
7,
10853,
746,
82,
11,
11241,
8,
796,
357,
77,
796,
2558,
7,
11085,
7203,
3,
7,
12924,
0,
7,
10853,
746,
82,
4008,
4943,
1776,
1058,
16763,
30001,
11,
720,
77,
4008,
198,
0,
7,
10853,
746,
82,
3712,
38469,
90,
13940,
23650,
5512,
11241,
8,
796,
357,
25,
28955,
198,
198,
437,
198
] | 2.113577 | 766 |
export getAnalyticalConstGrad2D,getAnalyticalConstGrad3D,getAnalyticalConstGradInv2D,getAnalyticalConstGradInv3D,getSmoothGaussianMedium,getSmoothFactoredModel,getSmoothFactoredModel3D
function getAnalyticalConstGrad2D(n::Array{Int64,1},h::Array{Float64,1})
src = [1,div(n[2],2)];
source1 = (src[1]-1)*h[1];
source2 = (src[2]-1)*h[2];
(X1,X2) = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2]);
a = -0.4;
s0 = 2.0;
kappaSquared = s0^2 .+ 2.0*a*(X1.-source1);
# matshow(kappaSquared); colorbar();
SBarSquared = s0^2 .+ a*(X1.-source1);
rSquared = ((X1.-source1).^2 .+ (X2.-source2).^2);
sigmaSquarred = 2*rSquared./(SBarSquared + sqrt.(SBarSquared.^2 .- (a^2).*rSquared));
sigma = sqrt.(sigmaSquarred);
T_exact = SBarSquared.*sigma .- (a^2).*(sigma.^3)./6;
return kappaSquared,src,T_exact;
end
function getAnalyticalConstGrad3D(n::Array{Int64,1},h::Array{Float64,1})
src = [div(n[1],2),div(n[2],2),1];
source1 = (src[1]-1)*h[1];
source2 = (src[2]-1)*h[2];
source3 = (src[3]-1)*h[3];
(X1,X2,X3) = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2],(0:(n[3]-1))*h[3]);
# a = -1.75;
a = -1.65;
s0 = 2.0;
kappaSquared = s0^2 .+ 2*a*(X3.-source3);
SBarSquared = s0^2 .+ a*(X3.-source3);
rSquared = (X1.-source1).^2 .+ (X2.-source2).^2 .+ (X3.-source3).^2;
sigmaSquarred = 2*rSquared./(SBarSquared .+ sqrt.(SBarSquared.^2 .- (a^2).*rSquared));
sigma = sqrt.(sigmaSquarred);
T_exact = SBarSquared.*sigma .- (a^2).*(sigma.^3)./6;
return kappaSquared,src,T_exact;
end
function getAnalyticalConstGradInv2D(n::Array{Int64,1},h::Array{Float64,1})
src = [1,div(n[2],2)];
source1 = (src[1]-1)*h[1];
source2 = (src[2]-1)*h[2];
(X1,X2) = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2]);
a = 1.0;
ainv = (1.0./a);
s0 = 2.0;
Kappa = 1.0./(1.0./s0 .+ a*(X1.-source1));
T_exact = ainv*acosh.(1.0.+(0.5*s0*a*a).*Kappa.*((X1.-source1).^2 .+ (X2.-source2).^2));
G2_exact = ainv*(1.0./sqrt.((1.0.+(0.5*s0*a*a).*Kappa.*((X1.-source1).^2 .+ (X2 .- source2).^2)).^2 .- 1)).*(0.5*s0*a*a).*Kappa.*2.0.*(X2.-source2);
G1_exact = ainv*(1.0./sqrt.((1.0.+(0.5*s0*a*a).*Kappa.*((X1.-source1).^2 .+ (X2 .- source2).^2)).^2 .- 1)).*((0.5*s0*a*a).*Kappa.*2.0.*(X1.-source1)
+ (0.5*s0*a*a).*((X1.-source1).^2 + (X2.-source2).^2).*(-(Kappa.^2)).*a);
kappaSquared = Kappa.^2;
return kappaSquared,src,T_exact;
end
function getAnalyticalConstGradInv3D(n::Array{Int64,1},h::Array{Float64,1})
src = [div(n[1],2),div(n[1],2),1];
source1 = (src[1]-1)*h[1];
source2 = (src[2]-1)*h[2];
source3 = (src[3]-1)*h[3];
(X1,X2,X3) = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2],(0:(n[3]-1))*h[3]);
a = 1.0;
ainv = (1.0./a);
s0 = 2.0;
Kappa = 1.0./(1.0./s0 .+ a*(X3.-source3));
Rsquared = (X1.-source1).^2 .+ (X2.-source2).^2 .+ (X3.-source3).^2;
T_exact = ainv*acosh.(1.0.+(0.5*s0*a*a).*Kappa.*(Rsquared));
G1_exact = ainv*(1.0./sqrt.((1.0.+(0.5*s0*a*a).*Kappa.*Rsquared).^2 .- 1.0)).*(0.5*s0*a*a).*Kappa.*2.0.*(X1.-source1);
G2_exact = ainv*(1.0./sqrt.((1.0.+(0.5*s0*a*a).*Kappa.*Rsquared).^2 .- 1.0)).*(0.5*s0*a*a).*Kappa.*2.0.*(X2.-source2);
G3_exact = ainv*(1.0./sqrt.((1.0.+(0.5*s0*a*a).*Kappa.*Rsquared).^2 .- 1.0)).*((0.5*s0*a*a).*Kappa.*2.0.*(X3.-source3)
.+ (0.5*s0*a*a).*(Rsquared).*(-(Kappa.^2)).*a);
kappaSquared = Kappa.^2;
return kappaSquared,src,T_exact;
end
function getSmoothGaussianMedium(n::Array{Int64,1},h::Array{Float64,1})
src = div.(n,4);
kappaSquared = [];
T_exact = [];
if length(n)==2
(T1_exact,G11_exact,G12_exact) = getSmoothFactoredModel(n,h);
(T0,G01,G02,L0) = getAnalytic2DeikonalSolutionAll(n,h,src);
G1_exact = T0.*G11_exact + G01.*T1_exact;
G2_exact = T0.*G12_exact + G02.*T1_exact;
kappaSquared = G1_exact.*G1_exact + G2_exact.*G2_exact;
# matshow(sqrt(kappaSquared)); colorbar();
# xlabel("y");
# ylabel("x");
# xticks(0:div(n[2],8):n[2],0:1:8);
# yticks(0:div(n[1],4):n[1],0:1:4);
#figure()
#CS = contour(kappaSquared,50);colorbar();title("kappaSquared");
#clabel(CS, inline=1, fontsize=10)
#figure()
#contour(G1_exact);colorbar();title("G1_exact");
T_exact = T0.*T1_exact;
#figure()
#contour(T_exact,100);colorbar();title("T exact");
else
(T1_exact,G11_exact,G12_exact,G13_exact) = getSmoothFactoredModel3D(n,h);
(T0,G01,G02,G03) = getAnalytic3DeikonalSolutionAll(n,h,src);
G1_exact = T0.*G11_exact + G01.*T1_exact;
G2_exact = T0.*G12_exact + G02.*T1_exact;
G3_exact = T0.*G13_exact + G03.*T1_exact;
kappaSquared = G1_exact.*G1_exact + G2_exact.*G2_exact + G3_exact.*G3_exact;
# Er = kappaSquared;
# for k=1:n[3]
# matshow(reshape(Er[:,:,k],n[1],n[2]));colorbar();title("kappaSQ");
# end
T_exact = T0.*T1_exact;
end
return kappaSquared,src,T_exact;
end
function getSmoothFactoredModel(n::Array{Int64,1},h::Array{Float64,1})
xsrc = zeros(2);
src_kappa = zeros(Int64,2);
src_kappa[1] = div(n[1],3);
src_kappa[2] = div(n[2],4);
xsrc[1] = (src_kappa[1]-1)*h[1];
xsrc[2] = (src_kappa[2]-1)*h[2];
X1,X2 = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2]);
sigma = 0.1;
T1_exact = (exp.( - (sigma*((X1 .- xsrc[1]).^2) + 4*sigma*((X2.-xsrc[2]).^2))) .+ 1)/2;
G11_exact = -2*sigma*(X1 .- xsrc[1]).*exp.( - (sigma*((X1 .- xsrc[1]).^2) + 4*sigma*((X2.-xsrc[2]).^2)))/2;
G12_exact = -8*sigma*(X2 .- xsrc[2]).*exp.( - (sigma*((X1 .- xsrc[1]).^2) + 4*sigma*((X2.-xsrc[2]).^2)))/2;
return T1_exact,G11_exact,G12_exact;
end
function getSmoothFactoredModel3D(n::Array{Int64,1},h::Array{Float64,1})
xsrc = zeros(3);
src_kappa = zeros(Int64,3);
src_kappa[1] = div(n[1],3);
src_kappa[2] = div(n[2],4);
src_kappa[3] = div(n[3],2);
xsrc[1] = (src_kappa[1]-1)*h[1];
xsrc[2] = (src_kappa[2]-1)*h[2];
xsrc[3] = (src_kappa[3]-1)*h[3];
X1,X2,X3 = ndgrid((0:(n[1]-1))*h[1],(0:(n[2]-1))*h[2],(0:(n[3]-1))*h[3]);
Sigma = [0.1,0.4,0.2];
EXPRSkewedSquared = exp.(-Sigma[1]*((X1 .- xsrc[1]).^2) .- Sigma[2]*((X2.-xsrc[2]).^2) .- Sigma[3]*((X3.-xsrc[3]).^2));
T1_exact = EXPRSkewedSquared/2.0 .+ 0.5;
G11_exact = -Sigma[1]*(X1 .- xsrc[1]).*EXPRSkewedSquared;
G12_exact = -Sigma[2]*(X2 .- xsrc[2]).*EXPRSkewedSquared;
G13_exact = -Sigma[3]*(X3 .- xsrc[3]).*EXPRSkewedSquared;
return T1_exact,G11_exact,G12_exact,G13_exact;
end
| [
39344,
651,
37702,
22869,
34184,
42731,
17,
35,
11,
1136,
37702,
22869,
34184,
42731,
18,
35,
11,
1136,
37702,
22869,
34184,
42731,
19904,
17,
35,
11,
1136,
37702,
22869,
34184,
42731,
19904,
18,
35,
11,
1136,
7556,
5226,
35389,
31562,
31205,
11,
1136,
7556,
5226,
29054,
1850,
17633,
11,
1136,
7556,
5226,
29054,
1850,
17633,
18,
35,
198,
198,
8818,
651,
37702,
22869,
34184,
42731,
17,
35,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
10677,
796,
685,
16,
11,
7146,
7,
77,
58,
17,
4357,
17,
8,
11208,
198,
198,
10459,
16,
796,
357,
10677,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
10459,
17,
796,
357,
10677,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
198,
7,
55,
16,
11,
55,
17,
8,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
36563,
198,
198,
64,
220,
796,
532,
15,
13,
19,
26,
198,
82,
15,
796,
362,
13,
15,
26,
198,
198,
74,
20975,
22266,
1144,
796,
264,
15,
61,
17,
764,
10,
362,
13,
15,
9,
64,
9,
7,
55,
16,
7874,
10459,
16,
1776,
198,
198,
2,
46054,
4919,
7,
74,
20975,
22266,
1144,
1776,
3124,
5657,
9783,
198,
50,
10374,
22266,
1144,
796,
264,
15,
61,
17,
764,
10,
257,
9,
7,
55,
16,
7874,
10459,
16,
1776,
198,
81,
22266,
1144,
796,
14808,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
7874,
10459,
17,
737,
61,
17,
1776,
198,
82,
13495,
22266,
283,
445,
796,
362,
9,
81,
22266,
1144,
19571,
7,
50,
10374,
22266,
1144,
1343,
19862,
17034,
12195,
50,
10374,
22266,
1144,
13,
61,
17,
764,
12,
357,
64,
61,
17,
737,
9,
81,
22266,
1144,
18125,
198,
82,
13495,
796,
19862,
17034,
12195,
82,
13495,
22266,
283,
445,
1776,
198,
51,
62,
1069,
529,
796,
220,
311,
10374,
22266,
1144,
15885,
82,
13495,
764,
12,
357,
64,
61,
17,
737,
9,
7,
82,
13495,
13,
61,
18,
737,
14,
21,
26,
220,
198,
198,
7783,
479,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
26,
198,
437,
198,
198,
8818,
651,
37702,
22869,
34184,
42731,
18,
35,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
10677,
796,
685,
7146,
7,
77,
58,
16,
4357,
17,
828,
7146,
7,
77,
58,
17,
4357,
17,
828,
16,
11208,
198,
198,
10459,
16,
796,
357,
10677,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
10459,
17,
796,
357,
10677,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
10459,
18,
796,
357,
10677,
58,
18,
45297,
16,
27493,
71,
58,
18,
11208,
198,
198,
7,
55,
16,
11,
55,
17,
11,
55,
18,
8,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
4357,
7,
15,
37498,
77,
58,
18,
45297,
16,
4008,
9,
71,
58,
18,
36563,
198,
198,
2,
257,
220,
796,
532,
16,
13,
2425,
26,
198,
64,
220,
796,
532,
16,
13,
2996,
26,
198,
82,
15,
796,
362,
13,
15,
26,
198,
198,
74,
20975,
22266,
1144,
796,
264,
15,
61,
17,
764,
10,
362,
9,
64,
9,
7,
55,
18,
7874,
10459,
18,
1776,
198,
50,
10374,
22266,
1144,
796,
264,
15,
61,
17,
764,
10,
257,
9,
7,
55,
18,
7874,
10459,
18,
1776,
198,
81,
22266,
1144,
796,
357,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
7874,
10459,
17,
737,
61,
17,
764,
10,
357,
55,
18,
7874,
10459,
18,
737,
61,
17,
26,
198,
82,
13495,
22266,
283,
445,
796,
362,
9,
81,
22266,
1144,
19571,
7,
50,
10374,
22266,
1144,
764,
10,
19862,
17034,
12195,
50,
10374,
22266,
1144,
13,
61,
17,
764,
12,
357,
64,
61,
17,
737,
9,
81,
22266,
1144,
18125,
198,
82,
13495,
796,
19862,
17034,
12195,
82,
13495,
22266,
283,
445,
1776,
198,
51,
62,
1069,
529,
796,
220,
311,
10374,
22266,
1144,
15885,
82,
13495,
764,
12,
357,
64,
61,
17,
737,
9,
7,
82,
13495,
13,
61,
18,
737,
14,
21,
26,
220,
198,
198,
7783,
479,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
26,
198,
437,
628,
198,
8818,
651,
37702,
22869,
34184,
42731,
19904,
17,
35,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
198,
10677,
796,
685,
16,
11,
7146,
7,
77,
58,
17,
4357,
17,
8,
11208,
198,
198,
10459,
16,
796,
357,
10677,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
10459,
17,
796,
357,
10677,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
198,
7,
55,
16,
11,
55,
17,
8,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
36563,
198,
198,
64,
220,
796,
352,
13,
15,
26,
198,
391,
85,
796,
357,
16,
13,
15,
19571,
64,
1776,
198,
82,
15,
796,
362,
13,
15,
26,
198,
198,
42,
20975,
796,
352,
13,
15,
19571,
7,
16,
13,
15,
19571,
82,
15,
764,
10,
257,
9,
7,
55,
16,
7874,
10459,
16,
18125,
198,
51,
62,
1069,
529,
796,
257,
16340,
9,
330,
3768,
12195,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
19510,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
7874,
10459,
17,
737,
61,
17,
18125,
198,
38,
17,
62,
1069,
529,
796,
257,
16340,
9,
7,
16,
13,
15,
19571,
31166,
17034,
12195,
7,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
19510,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
764,
12,
2723,
17,
737,
61,
17,
29720,
61,
17,
764,
12,
352,
29720,
9,
7,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
17,
13,
15,
15885,
7,
55,
17,
7874,
10459,
17,
1776,
198,
38,
16,
62,
1069,
529,
796,
257,
16340,
9,
7,
16,
13,
15,
19571,
31166,
17034,
12195,
7,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
19510,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
764,
12,
2723,
17,
737,
61,
17,
29720,
61,
17,
764,
12,
352,
29720,
9,
19510,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
17,
13,
15,
15885,
7,
55,
16,
7874,
10459,
16,
8,
220,
198,
197,
197,
197,
10,
357,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
19510,
55,
16,
7874,
10459,
16,
737,
61,
17,
1343,
357,
55,
17,
7874,
10459,
17,
737,
61,
17,
737,
9,
7,
30420,
42,
20975,
13,
61,
17,
29720,
9,
64,
1776,
198,
74,
20975,
22266,
1144,
796,
39553,
13,
61,
17,
26,
198,
198,
7783,
479,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
26,
198,
198,
437,
628,
198,
8818,
651,
37702,
22869,
34184,
42731,
19904,
18,
35,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
198,
10677,
796,
685,
7146,
7,
77,
58,
16,
4357,
17,
828,
7146,
7,
77,
58,
16,
4357,
17,
828,
16,
11208,
198,
198,
10459,
16,
796,
357,
10677,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
10459,
17,
796,
357,
10677,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
10459,
18,
796,
357,
10677,
58,
18,
45297,
16,
27493,
71,
58,
18,
11208,
198,
198,
7,
55,
16,
11,
55,
17,
11,
55,
18,
8,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
4357,
7,
15,
37498,
77,
58,
18,
45297,
16,
4008,
9,
71,
58,
18,
36563,
198,
198,
64,
220,
796,
352,
13,
15,
26,
198,
391,
85,
796,
357,
16,
13,
15,
19571,
64,
1776,
198,
82,
15,
796,
362,
13,
15,
26,
198,
42,
20975,
796,
352,
13,
15,
19571,
7,
16,
13,
15,
19571,
82,
15,
764,
10,
257,
9,
7,
55,
18,
7874,
10459,
18,
18125,
198,
49,
16485,
1144,
796,
357,
55,
16,
7874,
10459,
16,
737,
61,
17,
764,
10,
357,
55,
17,
7874,
10459,
17,
737,
61,
17,
764,
10,
357,
55,
18,
7874,
10459,
18,
737,
61,
17,
26,
198,
51,
62,
1069,
529,
796,
257,
16340,
9,
330,
3768,
12195,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
7,
49,
16485,
1144,
18125,
198,
38,
16,
62,
1069,
529,
796,
257,
16340,
9,
7,
16,
13,
15,
19571,
31166,
17034,
12195,
7,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
49,
16485,
1144,
737,
61,
17,
764,
12,
352,
13,
15,
29720,
9,
7,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
17,
13,
15,
15885,
7,
55,
16,
7874,
10459,
16,
1776,
198,
38,
17,
62,
1069,
529,
796,
257,
16340,
9,
7,
16,
13,
15,
19571,
31166,
17034,
12195,
7,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
49,
16485,
1144,
737,
61,
17,
764,
12,
352,
13,
15,
29720,
9,
7,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
17,
13,
15,
15885,
7,
55,
17,
7874,
10459,
17,
1776,
198,
38,
18,
62,
1069,
529,
796,
257,
16340,
9,
7,
16,
13,
15,
19571,
31166,
17034,
12195,
7,
16,
13,
15,
13,
33747,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
49,
16485,
1144,
737,
61,
17,
764,
12,
352,
13,
15,
29720,
9,
19510,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
42,
20975,
15885,
17,
13,
15,
15885,
7,
55,
18,
7874,
10459,
18,
8,
220,
198,
197,
197,
197,
13,
10,
357,
15,
13,
20,
9,
82,
15,
9,
64,
9,
64,
737,
9,
7,
49,
16485,
1144,
737,
9,
7,
30420,
42,
20975,
13,
61,
17,
29720,
9,
64,
1776,
198,
74,
20975,
22266,
1144,
796,
39553,
13,
61,
17,
26,
198,
198,
7783,
479,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
26,
198,
198,
437,
628,
198,
8818,
651,
7556,
5226,
35389,
31562,
31205,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
10677,
796,
2659,
12195,
77,
11,
19,
1776,
198,
74,
20975,
22266,
1144,
796,
25787,
198,
51,
62,
1069,
529,
796,
25787,
198,
361,
4129,
7,
77,
8,
855,
17,
198,
197,
7,
51,
16,
62,
1069,
529,
11,
38,
1157,
62,
1069,
529,
11,
38,
1065,
62,
1069,
529,
8,
796,
651,
7556,
5226,
29054,
1850,
17633,
7,
77,
11,
71,
1776,
198,
197,
7,
51,
15,
11,
38,
486,
11,
38,
2999,
11,
43,
15,
8,
796,
651,
37702,
13370,
17,
5005,
1134,
20996,
46344,
3237,
7,
77,
11,
71,
11,
10677,
1776,
198,
197,
38,
16,
62,
1069,
529,
796,
309,
15,
15885,
38,
1157,
62,
1069,
529,
1343,
402,
486,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
38,
17,
62,
1069,
529,
796,
309,
15,
15885,
38,
1065,
62,
1069,
529,
1343,
402,
2999,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
74,
20975,
22266,
1144,
796,
402,
16,
62,
1069,
529,
15885,
38,
16,
62,
1069,
529,
1343,
402,
17,
62,
1069,
529,
15885,
38,
17,
62,
1069,
529,
26,
198,
197,
2,
46054,
4919,
7,
31166,
17034,
7,
74,
20975,
22266,
1144,
18125,
3124,
5657,
9783,
198,
197,
2,
2124,
18242,
7203,
88,
15341,
198,
197,
2,
331,
18242,
7203,
87,
15341,
198,
197,
2,
220,
742,
3378,
7,
15,
25,
7146,
7,
77,
58,
17,
4357,
23,
2599,
77,
58,
17,
4357,
15,
25,
16,
25,
23,
1776,
198,
197,
2,
331,
83,
3378,
7,
15,
25,
7146,
7,
77,
58,
16,
4357,
19,
2599,
77,
58,
16,
4357,
15,
25,
16,
25,
19,
1776,
628,
197,
2,
26875,
3419,
198,
197,
2,
7902,
796,
542,
454,
7,
74,
20975,
22266,
1144,
11,
1120,
1776,
8043,
5657,
9783,
7839,
7203,
74,
20975,
22266,
1144,
15341,
198,
197,
2,
565,
9608,
7,
7902,
11,
26098,
28,
16,
11,
10369,
7857,
28,
940,
8,
198,
197,
2,
26875,
3419,
198,
197,
2,
3642,
454,
7,
38,
16,
62,
1069,
529,
1776,
8043,
5657,
9783,
7839,
7203,
38,
16,
62,
1069,
529,
15341,
198,
197,
51,
62,
1069,
529,
796,
309,
15,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
2,
26875,
3419,
198,
197,
2,
3642,
454,
7,
51,
62,
1069,
529,
11,
3064,
1776,
8043,
5657,
9783,
7839,
7203,
51,
2748,
15341,
628,
198,
17772,
628,
197,
7,
51,
16,
62,
1069,
529,
11,
38,
1157,
62,
1069,
529,
11,
38,
1065,
62,
1069,
529,
11,
38,
1485,
62,
1069,
529,
8,
796,
651,
7556,
5226,
29054,
1850,
17633,
18,
35,
7,
77,
11,
71,
1776,
628,
197,
7,
51,
15,
11,
38,
486,
11,
38,
2999,
11,
38,
3070,
8,
796,
651,
37702,
13370,
18,
5005,
1134,
20996,
46344,
3237,
7,
77,
11,
71,
11,
10677,
1776,
628,
197,
38,
16,
62,
1069,
529,
796,
309,
15,
15885,
38,
1157,
62,
1069,
529,
1343,
402,
486,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
38,
17,
62,
1069,
529,
796,
309,
15,
15885,
38,
1065,
62,
1069,
529,
1343,
402,
2999,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
38,
18,
62,
1069,
529,
796,
309,
15,
15885,
38,
1485,
62,
1069,
529,
1343,
402,
3070,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
74,
20975,
22266,
1144,
796,
402,
16,
62,
1069,
529,
15885,
38,
16,
62,
1069,
529,
1343,
402,
17,
62,
1069,
529,
15885,
38,
17,
62,
1069,
529,
1343,
402,
18,
62,
1069,
529,
15885,
38,
18,
62,
1069,
529,
26,
628,
197,
2,
5256,
796,
479,
20975,
22266,
1144,
26,
198,
197,
2,
329,
479,
28,
16,
25,
77,
58,
18,
60,
198,
197,
197,
2,
46054,
4919,
7,
3447,
1758,
7,
9139,
58,
45299,
45299,
74,
4357,
77,
58,
16,
4357,
77,
58,
17,
12962,
1776,
8043,
5657,
9783,
7839,
7203,
74,
20975,
50,
48,
15341,
198,
197,
2,
886,
628,
197,
51,
62,
1069,
529,
796,
309,
15,
15885,
51,
16,
62,
1069,
529,
26,
198,
197,
198,
437,
198,
198,
7783,
479,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
26,
198,
437,
198,
198,
8818,
651,
7556,
5226,
29054,
1850,
17633,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
87,
10677,
796,
1976,
27498,
7,
17,
1776,
198,
10677,
62,
74,
20975,
796,
1976,
27498,
7,
5317,
2414,
11,
17,
1776,
198,
10677,
62,
74,
20975,
58,
16,
60,
796,
2659,
7,
77,
58,
16,
4357,
18,
1776,
198,
10677,
62,
74,
20975,
58,
17,
60,
796,
2659,
7,
77,
58,
17,
4357,
19,
1776,
198,
198,
87,
10677,
58,
16,
60,
796,
357,
10677,
62,
74,
20975,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
87,
10677,
58,
17,
60,
796,
357,
10677,
62,
74,
20975,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
198,
55,
16,
11,
55,
17,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
36563,
198,
198,
82,
13495,
796,
657,
13,
16,
26,
198,
51,
16,
62,
1069,
529,
796,
357,
11201,
12195,
532,
357,
82,
13495,
9,
19510,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
61,
17,
8,
1343,
604,
9,
82,
13495,
9,
19510,
55,
17,
7874,
87,
10677,
58,
17,
35944,
61,
17,
22305,
764,
10,
352,
20679,
17,
26,
198,
38,
1157,
62,
1069,
529,
796,
532,
17,
9,
82,
13495,
9,
7,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
9,
11201,
12195,
532,
357,
82,
13495,
9,
19510,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
61,
17,
8,
1343,
604,
9,
82,
13495,
9,
19510,
55,
17,
7874,
87,
10677,
58,
17,
35944,
61,
17,
4008,
20679,
17,
26,
198,
38,
1065,
62,
1069,
529,
796,
532,
23,
9,
82,
13495,
9,
7,
55,
17,
764,
12,
2124,
10677,
58,
17,
35944,
9,
11201,
12195,
532,
357,
82,
13495,
9,
19510,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
61,
17,
8,
1343,
604,
9,
82,
13495,
9,
19510,
55,
17,
7874,
87,
10677,
58,
17,
35944,
61,
17,
4008,
20679,
17,
26,
198,
198,
7783,
309,
16,
62,
1069,
529,
11,
38,
1157,
62,
1069,
529,
11,
38,
1065,
62,
1069,
529,
26,
198,
437,
198,
198,
8818,
651,
7556,
5226,
29054,
1850,
17633,
18,
35,
7,
77,
3712,
19182,
90,
5317,
2414,
11,
16,
5512,
71,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
198,
87,
10677,
796,
1976,
27498,
7,
18,
1776,
198,
10677,
62,
74,
20975,
796,
1976,
27498,
7,
5317,
2414,
11,
18,
1776,
198,
10677,
62,
74,
20975,
58,
16,
60,
796,
2659,
7,
77,
58,
16,
4357,
18,
1776,
198,
10677,
62,
74,
20975,
58,
17,
60,
796,
2659,
7,
77,
58,
17,
4357,
19,
1776,
198,
10677,
62,
74,
20975,
58,
18,
60,
796,
2659,
7,
77,
58,
18,
4357,
17,
1776,
198,
198,
87,
10677,
58,
16,
60,
796,
357,
10677,
62,
74,
20975,
58,
16,
45297,
16,
27493,
71,
58,
16,
11208,
198,
87,
10677,
58,
17,
60,
796,
357,
10677,
62,
74,
20975,
58,
17,
45297,
16,
27493,
71,
58,
17,
11208,
198,
87,
10677,
58,
18,
60,
796,
357,
10677,
62,
74,
20975,
58,
18,
45297,
16,
27493,
71,
58,
18,
11208,
198,
198,
55,
16,
11,
55,
17,
11,
55,
18,
796,
299,
67,
25928,
19510,
15,
37498,
77,
58,
16,
45297,
16,
4008,
9,
71,
58,
16,
4357,
7,
15,
37498,
77,
58,
17,
45297,
16,
4008,
9,
71,
58,
17,
4357,
7,
15,
37498,
77,
58,
18,
45297,
16,
4008,
9,
71,
58,
18,
36563,
198,
198,
50,
13495,
796,
685,
15,
13,
16,
11,
15,
13,
19,
11,
15,
13,
17,
11208,
198,
6369,
4805,
50,
365,
19103,
22266,
1144,
796,
1033,
12195,
12,
50,
13495,
58,
16,
60,
9,
19510,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
61,
17,
8,
764,
12,
31669,
58,
17,
60,
9,
19510,
55,
17,
7874,
87,
10677,
58,
17,
35944,
61,
17,
8,
764,
12,
31669,
58,
18,
60,
9,
19510,
55,
18,
7874,
87,
10677,
58,
18,
35944,
61,
17,
18125,
198,
198,
51,
16,
62,
1069,
529,
796,
7788,
4805,
50,
365,
19103,
22266,
1144,
14,
17,
13,
15,
764,
10,
657,
13,
20,
26,
198,
38,
1157,
62,
1069,
529,
796,
532,
50,
13495,
58,
16,
60,
9,
7,
55,
16,
764,
12,
2124,
10677,
58,
16,
35944,
9,
6369,
4805,
50,
365,
19103,
22266,
1144,
26,
198,
38,
1065,
62,
1069,
529,
796,
532,
50,
13495,
58,
17,
60,
9,
7,
55,
17,
764,
12,
2124,
10677,
58,
17,
35944,
9,
6369,
4805,
50,
365,
19103,
22266,
1144,
26,
198,
38,
1485,
62,
1069,
529,
796,
532,
50,
13495,
58,
18,
60,
9,
7,
55,
18,
764,
12,
2124,
10677,
58,
18,
35944,
9,
6369,
4805,
50,
365,
19103,
22266,
1144,
26,
198,
198,
7783,
309,
16,
62,
1069,
529,
11,
38,
1157,
62,
1069,
529,
11,
38,
1065,
62,
1069,
529,
11,
38,
1485,
62,
1069,
529,
26,
198,
437,
198
] | 1.786009 | 3,388 |
# Implement experiments to measure the success of subgoal evolution as a function of:
# 1. Funcs
# 2. numinteriors
# 3. numinputs # 4. numoutputs
# 5. Length of goallist
# 5. max_steps
# Uses randomly generated goallist
# Keep track of number of "worse" and "same" updates of Chromosome since its last improvement
export run_mut_evolution, run_result, run_result_to_tuple
using DataFrames
using CSV
using Statistics
using Distributions
using Distributed
indiv_result_type = Main.CGP.indiv_result_type
#=
iterations = 4
numinputs = 2:2
numoutputs = 2:2
nodearity = 2
numinteriors = 18:18
numlevelsback = 6:6
ngoals = 4:4
goallistlength=8:8
levelsback=6:6
maxsteps = 400:400
run_mut_evolution( iterations, numinputs, numoutputs, numinteriors, goallistlength, maxsteps, levelsback, "testdata.csv" )
=#
#context = construct_contexts(numinputs)[numinputs]
#p = Parameters(numinputs, numoutputs, nodearity, numinteriors, numlevelsback)
#iterations = 20
#print_parameters(p)
function run_mut_evolution( numiterations::Int64, numinputs::IntRange, numoutputs::IntRange,
numinteriors::IntRange, goallistlength::IntRange, maxsteps::IntRange,
levelsback::IntRange, hamming_rng::IntRange, csvfile::String;
base::Float64=2.0, active_only::Bool=false, avgfit_rng::IntRange=false )
maxints_for_degen=20
max_numinteriors = collect(numinteriors)[end]
test_MyInt(max_numinteriors)
ftf_param = 0.95
nodearity = 2
run_result_list = indiv_result_type[]
df = DataFrame()
df.numinputs=Int64[]
df.numoutputs=Int64[]
df.numints=Int64[]
df.levelsback=Int64[]
df.ngoals=Int64[]
#df.hamming_sel=Bool[]
#df.robust_sel=Bool[]
#df.avgfitness=Bool[]
#df.fault_tol=Bool[]
#df.active_only=Bool[]
df.maxsteps=Int64[]
#df.gl_reps=Int64[]
#df.fit_limit=Float64[]
df.hdist=Float64[]
df.steps=Int64[]
df.same=Int64[]
df.worse=Int64[]
df.better=Int64[]
df.nactive=Int64[]
df.redundancy=Float64[]
df.complexity=Float64[]
df.degeneracy=Float64[]
df.sdegeneracy=Float64[]
println("size(df): ",size(df))
for num_inputs = numinputs
for num_outputs = numoutputs
fit_limit = Float64(num_outputs)
funcs = default_funcs(num_inputs)
for num_interiors = numinteriors
for num_goals = goallistlength
println("numinputs: ",num_inputs," numoutputs: ",num_outputs," numints: ",num_interiors," numgoals: ",num_goals)
for levsback = levelsback
for hamming_sel = hamming_rng
for avgfitness = avgfit_rng
for active_only = [false]
#println("hamming_sel: ",hamming_sel," active_only: ",active_only)
for max_steps = maxsteps
for _ = 1:numiterations
p = Parameters( num_inputs, num_outputs, nodearity, num_interiors, levsback )
rr = run_result( p, num_goals, hamming_sel, active_only, max_steps )
push!(run_result_list,rr)
#Base.push!( df, new_row )
end
end
end
end
end
end
end
end
end
end
new_run_result_list = pmap(r->run_mut_evolve!(r,maxints_for_degen=maxints_for_degen,base=base),run_result_list)
#new_run_result_list = map(r->run_mut_evolve!(r,maxints_for_degen=maxints_for_degen,base=base),run_result_list)
for r = new_run_result_list
new_row = run_result_to_tuple(r)
println("len row: ",length(new_row))
Base.push!( df, new_row )
end
println(default_funcs(2))
open( csvfile, "w" ) do f
println(f,"# funcs: ", Main.CGP.default_funcs(numinputs[end]))
println(f,"# nodearity: ",nodearity)
#println(f,"# active_only: ",active_only)
println(f,"# max_steps",maxsteps)
CSV.write( f, df, append=true, writeheader=true )
end
#println(df)
df
end
function run_mut_evolve!( rr::indiv_result_type; maxints_for_degen::Int64, gl_repetitions::Int64=1,
ftf_param::Float64=0.95, base::Float64=2.0 )
#println("run_mut_evolve! fault_tol: ",rr.fault_tol)
nodearity = 2 # built-in default
p = Parameters( numinputs=rr.numinputs, numoutputs=rr.numoutputs, numinteriors=rr.numints, numlevelsback=rr.levelsback )
#print_parameters( p )
gl = randgoallist(rr.ngoals,rr.numinputs,rr.numoutputs,repetitions=gl_repetitions)
#println("gl: ",gl)
funcs = default_funcs(rr.numinputs)
c = random_chromosome( p, funcs )
sav_c = deepcopy(c)
(new_c,rr.steps,rr.worse,rr.same,rr.better,output,matched_goals,matched_goals_list) =
mut_evolve(c,gl,funcs,rr.maxsteps,hamming_sel=rr.hamming_sel )
rr.hdist = hamming_distance( output_values(c), output_values(new_c), rr.numinputs )
rr.nactive = number_active( new_c )
rr.redundancy = redundancy( new_c, base=base )
rr.complexity = rr.numints <= maxints_for_degen ? complexity5( new_c, base=base ) : 0.0
rr.degeneracy = rr.numints <= maxints_for_degen ? degeneracy( new_c, base=base ) : 0.0
rr.sdegeneracy = rr.numints <= maxints_for_degen ? degeneracy( new_c, base=base, mutinf=mutinf2 ) : 0.0
rr
end
function run_result( p::Parameters, num_goals::Int64, hamming_sel::Bool, active_only::Bool, max_steps::Int64 )
indiv_result_type(
p.numinputs,
p.numoutputs,
p.numinteriors,
p.numlevelsback,
num_goals,
hamming_sel,
#avgfitness,
active_only,
max_steps,
#gl_reps,
#fault_tol,
#fit_limit,
0.0, # hdist
0, # steps
0, # same
0, # worse
0, # better
0, # nactive
0.0, # redundancy
0.0, # complexity
0.0, # degeneracy
0.0 # sdegeneracy
)
end
function run_result_to_tuple( rr::indiv_result_type )
(
rr.numinputs,
rr.numoutputs,
rr.numints,
rr.levelsback,
rr.ngoals,
#rr.hamming_sel,
#rr.avgfitness,
#rr.fault_tol,
#rr.active_only,
rr.maxsteps,
#rr.gl_reps,
#rr.fit_limit,
rr.hdist,
rr.steps,
rr.same,
rr.worse,
rr.better,
rr.nactive,
rr.redundancy,
rr.complexity,
rr.degeneracy,
rr.sdegeneracy
)
end
| [
2,
48282,
10256,
284,
3953,
262,
1943,
286,
850,
35231,
6954,
355,
257,
2163,
286,
25,
198,
2,
220,
352,
13,
220,
11138,
6359,
198,
2,
220,
362,
13,
220,
997,
3849,
12706,
198,
2,
220,
513,
13,
220,
997,
15414,
82,
1303,
220,
604,
13,
220,
997,
22915,
82,
198,
2,
220,
642,
13,
220,
22313,
286,
467,
439,
396,
198,
2,
220,
642,
13,
220,
3509,
62,
20214,
198,
2,
36965,
15456,
7560,
467,
439,
396,
198,
2,
9175,
2610,
286,
1271,
286,
366,
86,
7615,
1,
290,
366,
31642,
1,
5992,
286,
18255,
418,
462,
1201,
663,
938,
9025,
198,
39344,
1057,
62,
21973,
62,
1990,
2122,
11,
1057,
62,
20274,
11,
1057,
62,
20274,
62,
1462,
62,
83,
29291,
198,
3500,
6060,
35439,
220,
198,
3500,
44189,
198,
3500,
14370,
198,
3500,
46567,
507,
198,
3500,
4307,
6169,
198,
521,
452,
62,
20274,
62,
4906,
796,
8774,
13,
34,
16960,
13,
521,
452,
62,
20274,
62,
4906,
198,
2,
28,
198,
2676,
602,
796,
604,
198,
77,
7230,
1996,
82,
796,
362,
25,
17,
198,
22510,
22915,
82,
796,
362,
25,
17,
198,
77,
375,
451,
414,
796,
362,
198,
22510,
3849,
12706,
796,
1248,
25,
1507,
198,
22510,
46170,
1891,
796,
718,
25,
21,
198,
782,
78,
874,
796,
604,
25,
19,
198,
2188,
439,
396,
13664,
28,
23,
25,
23,
198,
46170,
1891,
28,
21,
25,
21,
198,
9806,
20214,
796,
7337,
25,
7029,
198,
5143,
62,
21973,
62,
1990,
2122,
7,
34820,
11,
997,
15414,
82,
11,
997,
22915,
82,
11,
997,
3849,
12706,
11,
467,
439,
396,
13664,
11,
3509,
20214,
11,
2974,
1891,
11,
366,
9288,
7890,
13,
40664,
1,
1267,
198,
46249,
198,
2,
22866,
796,
5678,
62,
22866,
82,
7,
77,
7230,
1996,
82,
38381,
77,
7230,
1996,
82,
60,
198,
2,
79,
796,
40117,
7,
77,
7230,
1996,
82,
11,
997,
22915,
82,
11,
18666,
451,
414,
11,
997,
3849,
12706,
11,
997,
46170,
1891,
8,
198,
2,
2676,
602,
796,
1160,
198,
2,
4798,
62,
17143,
7307,
7,
79,
8,
198,
198,
8818,
1057,
62,
21973,
62,
1990,
2122,
7,
997,
2676,
602,
3712,
5317,
2414,
11,
997,
15414,
82,
3712,
5317,
17257,
11,
997,
22915,
82,
3712,
5317,
17257,
11,
220,
198,
220,
220,
220,
997,
3849,
12706,
3712,
5317,
17257,
11,
467,
439,
396,
13664,
3712,
5317,
17257,
11,
3509,
20214,
3712,
5317,
17257,
11,
198,
220,
220,
220,
2974,
1891,
3712,
5317,
17257,
11,
8891,
2229,
62,
81,
782,
3712,
5317,
17257,
11,
269,
21370,
7753,
3712,
10100,
26,
220,
198,
220,
220,
220,
2779,
3712,
43879,
2414,
28,
17,
13,
15,
11,
4075,
62,
8807,
3712,
33,
970,
28,
9562,
11,
42781,
11147,
62,
81,
782,
3712,
5317,
17257,
28,
9562,
1267,
198,
220,
3509,
29503,
62,
1640,
62,
13500,
268,
28,
1238,
198,
220,
3509,
62,
22510,
3849,
12706,
796,
2824,
7,
22510,
3849,
12706,
38381,
437,
60,
198,
220,
1332,
62,
3666,
5317,
7,
9806,
62,
22510,
3849,
12706,
8,
198,
220,
10117,
69,
62,
17143,
796,
657,
13,
3865,
198,
220,
18666,
451,
414,
796,
362,
198,
220,
1057,
62,
20274,
62,
4868,
796,
773,
452,
62,
20274,
62,
4906,
21737,
198,
220,
47764,
796,
6060,
19778,
3419,
220,
198,
220,
47764,
13,
77,
7230,
1996,
82,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
22510,
22915,
82,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
22510,
29503,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
46170,
1891,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
782,
78,
874,
28,
5317,
2414,
21737,
198,
220,
1303,
7568,
13,
2763,
2229,
62,
741,
28,
33,
970,
21737,
198,
220,
1303,
7568,
13,
22609,
436,
62,
741,
28,
33,
970,
21737,
198,
220,
1303,
7568,
13,
615,
70,
69,
3659,
28,
33,
970,
21737,
198,
220,
1303,
7568,
13,
69,
1721,
62,
83,
349,
28,
33,
970,
21737,
198,
220,
1303,
7568,
13,
5275,
62,
8807,
28,
33,
970,
21737,
198,
220,
47764,
13,
9806,
20214,
28,
5317,
2414,
21737,
198,
220,
1303,
7568,
13,
4743,
62,
260,
862,
28,
5317,
2414,
21737,
198,
220,
1303,
7568,
13,
11147,
62,
32374,
28,
43879,
2414,
21737,
198,
220,
47764,
13,
71,
17080,
28,
43879,
2414,
21737,
198,
220,
47764,
13,
20214,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
31642,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
86,
7615,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
27903,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
77,
5275,
28,
5317,
2414,
21737,
198,
220,
47764,
13,
445,
917,
3883,
28,
43879,
2414,
21737,
198,
220,
47764,
13,
41887,
414,
28,
43879,
2414,
21737,
198,
220,
47764,
13,
13500,
877,
1590,
28,
43879,
2414,
21737,
198,
220,
47764,
13,
82,
13500,
877,
1590,
28,
43879,
2414,
21737,
198,
220,
44872,
7203,
7857,
7,
7568,
2599,
33172,
7857,
7,
7568,
4008,
198,
220,
329,
997,
62,
15414,
82,
796,
997,
15414,
82,
198,
220,
220,
220,
329,
997,
62,
22915,
82,
796,
997,
22915,
82,
198,
220,
220,
220,
220,
220,
4197,
62,
32374,
796,
48436,
2414,
7,
22510,
62,
22915,
82,
8,
198,
220,
220,
220,
220,
220,
1257,
6359,
796,
4277,
62,
12543,
6359,
7,
22510,
62,
15414,
82,
8,
220,
198,
220,
220,
220,
220,
220,
329,
997,
62,
3849,
12706,
796,
997,
3849,
12706,
198,
220,
220,
220,
220,
220,
220,
220,
329,
997,
62,
2188,
874,
796,
467,
439,
396,
13664,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
77,
7230,
1996,
82,
25,
33172,
22510,
62,
15414,
82,
553,
220,
997,
22915,
82,
25,
33172,
22510,
62,
22915,
82,
553,
220,
997,
29503,
25,
33172,
22510,
62,
3849,
12706,
553,
220,
997,
2188,
874,
25,
33172,
22510,
62,
2188,
874,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
443,
14259,
1891,
796,
2974,
1891,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
8891,
2229,
62,
741,
796,
8891,
2229,
62,
81,
782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
42781,
69,
3659,
796,
42781,
11147,
62,
81,
782,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
4075,
62,
8807,
796,
685,
9562,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
35235,
7203,
2763,
2229,
62,
741,
25,
33172,
2763,
2229,
62,
741,
553,
220,
4075,
62,
8807,
25,
33172,
5275,
62,
8807,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
3509,
62,
20214,
796,
3509,
20214,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
796,
352,
25,
22510,
2676,
602,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
40117,
7,
997,
62,
15414,
82,
11,
997,
62,
22915,
82,
11,
18666,
451,
414,
11,
997,
62,
3849,
12706,
11,
443,
14259,
1891,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
81,
796,
1057,
62,
20274,
7,
279,
11,
997,
62,
2188,
874,
11,
8891,
2229,
62,
741,
11,
4075,
62,
8807,
11,
3509,
62,
20214,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
5143,
62,
20274,
62,
4868,
11,
21062,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
14881,
13,
14689,
0,
7,
47764,
11,
649,
62,
808,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
649,
62,
5143,
62,
20274,
62,
4868,
796,
279,
8899,
7,
81,
3784,
5143,
62,
21973,
62,
1990,
6442,
0,
7,
81,
11,
9806,
29503,
62,
1640,
62,
13500,
268,
28,
9806,
29503,
62,
1640,
62,
13500,
268,
11,
8692,
28,
8692,
828,
5143,
62,
20274,
62,
4868,
8,
198,
220,
1303,
3605,
62,
5143,
62,
20274,
62,
4868,
796,
3975,
7,
81,
3784,
5143,
62,
21973,
62,
1990,
6442,
0,
7,
81,
11,
9806,
29503,
62,
1640,
62,
13500,
268,
28,
9806,
29503,
62,
1640,
62,
13500,
268,
11,
8692,
28,
8692,
828,
5143,
62,
20274,
62,
4868,
8,
198,
220,
329,
374,
796,
649,
62,
5143,
62,
20274,
62,
4868,
198,
220,
220,
220,
649,
62,
808,
796,
1057,
62,
20274,
62,
1462,
62,
83,
29291,
7,
81,
8,
198,
220,
220,
220,
44872,
7203,
11925,
5752,
25,
33172,
13664,
7,
3605,
62,
808,
4008,
198,
220,
220,
220,
7308,
13,
14689,
0,
7,
47764,
11,
649,
62,
808,
1267,
198,
220,
886,
198,
220,
44872,
7,
12286,
62,
12543,
6359,
7,
17,
4008,
198,
220,
1280,
7,
269,
21370,
7753,
11,
366,
86,
1,
1267,
466,
277,
198,
220,
220,
220,
44872,
7,
69,
553,
2,
1257,
6359,
25,
33172,
8774,
13,
34,
16960,
13,
12286,
62,
12543,
6359,
7,
77,
7230,
1996,
82,
58,
437,
60,
4008,
198,
220,
220,
220,
44872,
7,
69,
553,
2,
18666,
451,
414,
25,
33172,
77,
375,
451,
414,
8,
198,
220,
220,
220,
1303,
35235,
7,
69,
553,
2,
4075,
62,
8807,
25,
33172,
5275,
62,
8807,
8,
198,
220,
220,
220,
44872,
7,
69,
553,
2,
3509,
62,
20214,
1600,
9806,
20214,
8,
198,
220,
220,
220,
44189,
13,
13564,
7,
277,
11,
47764,
11,
24443,
28,
7942,
11,
3551,
25677,
28,
7942,
1267,
198,
220,
886,
198,
220,
1303,
35235,
7,
7568,
8,
198,
220,
47764,
198,
437,
198,
198,
8818,
1057,
62,
21973,
62,
1990,
6442,
0,
7,
374,
81,
3712,
521,
452,
62,
20274,
62,
4906,
26,
3509,
29503,
62,
1640,
62,
13500,
268,
3712,
5317,
2414,
11,
1278,
62,
260,
6449,
1756,
3712,
5317,
2414,
28,
16,
11,
220,
198,
220,
220,
220,
220,
220,
10117,
69,
62,
17143,
3712,
43879,
2414,
28,
15,
13,
3865,
11,
2779,
3712,
43879,
2414,
28,
17,
13,
15,
1267,
198,
220,
1303,
35235,
7203,
5143,
62,
21973,
62,
1990,
6442,
0,
8046,
62,
83,
349,
25,
33172,
21062,
13,
69,
1721,
62,
83,
349,
8,
198,
220,
18666,
451,
414,
796,
362,
220,
220,
1303,
3170,
12,
259,
4277,
198,
220,
279,
796,
40117,
7,
997,
15414,
82,
28,
21062,
13,
77,
7230,
1996,
82,
11,
997,
22915,
82,
28,
21062,
13,
22510,
22915,
82,
11,
997,
3849,
12706,
28,
21062,
13,
22510,
29503,
11,
997,
46170,
1891,
28,
21062,
13,
46170,
1891,
1267,
198,
220,
1303,
4798,
62,
17143,
7307,
7,
279,
1267,
198,
220,
1278,
796,
43720,
2188,
439,
396,
7,
21062,
13,
782,
78,
874,
11,
21062,
13,
77,
7230,
1996,
82,
11,
21062,
13,
22510,
22915,
82,
11,
260,
6449,
1756,
28,
4743,
62,
260,
6449,
1756,
8,
198,
220,
1303,
35235,
7203,
4743,
25,
33172,
4743,
8,
198,
220,
1257,
6359,
796,
4277,
62,
12543,
6359,
7,
21062,
13,
77,
7230,
1996,
82,
8,
220,
198,
220,
269,
796,
4738,
62,
28663,
418,
462,
7,
279,
11,
1257,
6359,
1267,
198,
220,
6799,
62,
66,
796,
2769,
30073,
7,
66,
8,
198,
220,
357,
3605,
62,
66,
11,
21062,
13,
20214,
11,
21062,
13,
86,
7615,
11,
21062,
13,
31642,
11,
21062,
13,
27903,
11,
22915,
11,
31409,
62,
2188,
874,
11,
31409,
62,
2188,
874,
62,
4868,
8,
796,
220,
198,
220,
220,
220,
220,
220,
4517,
62,
1990,
6442,
7,
66,
11,
4743,
11,
12543,
6359,
11,
21062,
13,
9806,
20214,
11,
2763,
2229,
62,
741,
28,
21062,
13,
2763,
2229,
62,
741,
1267,
198,
220,
374,
81,
13,
71,
17080,
796,
8891,
2229,
62,
30246,
7,
5072,
62,
27160,
7,
66,
828,
5072,
62,
27160,
7,
3605,
62,
66,
828,
374,
81,
13,
77,
7230,
1996,
82,
1267,
198,
220,
374,
81,
13,
77,
5275,
796,
1271,
62,
5275,
7,
649,
62,
66,
1267,
198,
220,
374,
81,
13,
445,
917,
3883,
796,
49052,
7,
649,
62,
66,
11,
2779,
28,
8692,
1267,
198,
220,
374,
81,
13,
41887,
414,
796,
374,
81,
13,
22510,
29503,
19841,
3509,
29503,
62,
1640,
62,
13500,
268,
5633,
13357,
20,
7,
649,
62,
66,
11,
2779,
28,
8692,
1267,
1058,
657,
13,
15,
198,
220,
374,
81,
13,
13500,
877,
1590,
796,
374,
81,
13,
22510,
29503,
19841,
3509,
29503,
62,
1640,
62,
13500,
268,
5633,
25419,
1590,
7,
649,
62,
66,
11,
2779,
28,
8692,
1267,
1058,
657,
13,
15,
198,
220,
374,
81,
13,
82,
13500,
877,
1590,
796,
374,
81,
13,
22510,
29503,
19841,
3509,
29503,
62,
1640,
62,
13500,
268,
5633,
25419,
1590,
7,
649,
62,
66,
11,
2779,
28,
8692,
11,
4517,
10745,
28,
21973,
10745,
17,
1267,
1058,
657,
13,
15,
198,
220,
374,
81,
198,
437,
198,
198,
8818,
1057,
62,
20274,
7,
279,
3712,
48944,
11,
997,
62,
2188,
874,
3712,
5317,
2414,
11,
8891,
2229,
62,
741,
3712,
33,
970,
11,
4075,
62,
8807,
3712,
33,
970,
11,
3509,
62,
20214,
3712,
5317,
2414,
1267,
198,
220,
773,
452,
62,
20274,
62,
4906,
7,
198,
220,
220,
220,
279,
13,
77,
7230,
1996,
82,
11,
198,
220,
220,
220,
279,
13,
22510,
22915,
82,
11,
198,
220,
220,
220,
279,
13,
22510,
3849,
12706,
11,
198,
220,
220,
220,
279,
13,
22510,
46170,
1891,
11,
198,
220,
220,
220,
997,
62,
2188,
874,
11,
198,
220,
220,
220,
8891,
2229,
62,
741,
11,
198,
220,
220,
220,
1303,
615,
70,
69,
3659,
11,
198,
220,
220,
220,
4075,
62,
8807,
11,
198,
220,
220,
220,
3509,
62,
20214,
11,
198,
220,
220,
220,
1303,
4743,
62,
260,
862,
11,
198,
220,
220,
220,
1303,
69,
1721,
62,
83,
349,
11,
198,
220,
220,
220,
1303,
11147,
62,
32374,
11,
198,
220,
220,
220,
657,
13,
15,
11,
220,
220,
220,
1303,
289,
17080,
198,
220,
220,
220,
657,
11,
220,
220,
220,
220,
220,
1303,
4831,
198,
220,
220,
220,
657,
11,
220,
220,
220,
220,
220,
1303,
976,
198,
220,
220,
220,
657,
11,
220,
220,
220,
220,
220,
1303,
4785,
198,
220,
220,
220,
657,
11,
220,
220,
220,
220,
220,
1303,
1365,
198,
220,
220,
220,
657,
11,
220,
220,
220,
220,
220,
1303,
299,
5275,
220,
198,
220,
220,
220,
657,
13,
15,
11,
220,
220,
220,
1303,
49052,
198,
220,
220,
220,
657,
13,
15,
11,
220,
220,
220,
1303,
13357,
198,
220,
220,
220,
657,
13,
15,
11,
220,
220,
220,
1303,
25419,
1590,
198,
220,
220,
220,
657,
13,
15,
220,
220,
220,
220,
1303,
264,
13500,
877,
1590,
198,
220,
1267,
198,
437,
198,
198,
8818,
1057,
62,
20274,
62,
1462,
62,
83,
29291,
7,
374,
81,
3712,
521,
452,
62,
20274,
62,
4906,
1267,
198,
357,
198,
220,
374,
81,
13,
77,
7230,
1996,
82,
11,
198,
220,
374,
81,
13,
22510,
22915,
82,
11,
198,
220,
374,
81,
13,
22510,
29503,
11,
198,
220,
374,
81,
13,
46170,
1891,
11,
198,
220,
374,
81,
13,
782,
78,
874,
11,
198,
220,
1303,
21062,
13,
2763,
2229,
62,
741,
11,
198,
220,
1303,
21062,
13,
615,
70,
69,
3659,
11,
198,
220,
1303,
21062,
13,
69,
1721,
62,
83,
349,
11,
198,
220,
1303,
21062,
13,
5275,
62,
8807,
11,
198,
220,
374,
81,
13,
9806,
20214,
11,
198,
220,
1303,
21062,
13,
4743,
62,
260,
862,
11,
198,
220,
1303,
21062,
13,
11147,
62,
32374,
11,
198,
220,
374,
81,
13,
71,
17080,
11,
198,
220,
374,
81,
13,
20214,
11,
198,
220,
374,
81,
13,
31642,
11,
198,
220,
374,
81,
13,
86,
7615,
11,
198,
220,
374,
81,
13,
27903,
11,
198,
220,
374,
81,
13,
77,
5275,
11,
198,
220,
374,
81,
13,
445,
917,
3883,
11,
198,
220,
374,
81,
13,
41887,
414,
11,
198,
220,
374,
81,
13,
13500,
877,
1590,
11,
198,
220,
374,
81,
13,
82,
13500,
877,
1590,
198,
1267,
198,
437,
198
] | 2.170662 | 2,795 |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Description
# ==============================================================================
#
# Functions to manage the SPI.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
export init_spi, spi_transfer, spi_transfer!
################################################################################
# Initialization
################################################################################
"""
init_spi(devices; mode = 0, max_speed_hz = 4_000_000, bits_per_word = 8)
Initialize the SPI devices. `devices` can be a string with the path to `spidev`
or a vector of strings with a set of SPI devices that will be initialized.
# Keywords
* `mode`: Set the mode of the SPI. (**Default** = 0)
* `max_speed_hz`: Maximum allowed speed in SPI communication [Hz].
(**Default** = 4_000_000)
* `bits_per_word`: Number of bits per word in SPI communication.
(**Default** = 8)
Notice that all keywords can be a `Integer`, when the configuration will be
applied to all SPI devices, or a `Vector` of `Integers`, when different
configurations can be applied to the initialized devices.
"""
@inline init_spi(devices::String; kwargs...) = init_spi([devices]; kwargs...)
function init_spi(devices::AbstractVector{String};
mode::Union{Integer,Vector{Integer}} = 0,
max_speed_hz::Union{Integer,Vector{Integer}} = 4_000_000,
bits_per_word::Union{Integer,Vector{Integer}} = 8)
# Number of devices that the user wants to initialize.
num_init_devices = length(devices)
# If the arguments are not vectors, then transform them to vectors
# considering the size of `devices`.
if !(typeof(mode) <: AbstractVector)
mode = [mode for _ = 1:num_init_devices]
end
if !(typeof(max_speed_hz) <: AbstractVector)
max_speed_hz = [max_speed_hz for _ = 1:num_init_devices]
end
if !(typeof(bits_per_word) <: AbstractVector)
bits_per_word = [bits_per_word for _ = 1:num_init_devices]
end
# If we have already initialized, then close all the devices first.
objects.spi_init && close_spi()
# Initialize each device.
spidev = Vector{SPIDEV}(undef, 0)
@inbounds for i = 1:num_init_devices
@assert (mode[i] ≥ 0) error("Invalid SPI mode.")
@assert (max_speed_hz[i] > 0) error("Invalid maximum speed [Hz].")
@assert (bits_per_word[i] > 0) error("Invalid number of bits per word.")
try
# Open the device
# ==================================================================
io = open(devices[i], "w+")
# Configure SPI interface
# ==================================================================
_ioctl(io, SPI_IOC_WR_MODE, Ref(mode[i]))
_ioctl(io, SPI_IOC_RD_MODE, Ref(mode[i]))
_ioctl(io, SPI_IOC_WR_BITS_PER_WORD, Ref(bits_per_word[i]))
_ioctl(io, SPI_IOC_RD_BITS_PER_WORD, Ref(bits_per_word[i]))
_ioctl(io, SPI_IOC_WR_MAX_SPEED_HZ, Ref(max_speed_hz[i]))
_ioctl(io, SPI_IOC_RD_MAX_SPEED_HZ, Ref(max_speed_hz[i]))
# Pack values
# ==================================================================
spidev_i = SPIDEV(io, max_speed_hz[i], bits_per_word[i])
push!(spidev, spidev_i)
catch
error("Could not open `$(devices[i])`. Make sure you have the required permissions.")
end
end
# Get the size of SPI buffer.
buffer_size = parse(Int, read("/sys/module/spidev/parameters/bufsiz", String))
objects.spidev = spidev
objects.spi_buffer_size = buffer_size
objects.spi_init = true
return nothing
end
"""
close_spi()
Close all SPI connections.
"""
function close_spi()
if objects.spi_init
@inbounds for d in objects.spidev
close(d.io)
end
objects.spidev = Vector{SPIDEV}(undef, 0)
objects.spi_init = false
end
return nothing
end
################################################################################
# Transfer
################################################################################
"""
spi_transfer(devid, tx_buf; kwargs...)
Execute a full duplex transfer to SPI device `devid`. `devid` is the ID of the
SPI device considering the initialization order when the function `init_spi` was
called.
`tx_buf` can be a vector of `Integer`, in which only one message will be sent,
or a vector of vectors of `Integer`, in which multiple messages will be sent.
The result is returned in an object with the same type of `tx_buf` together with
the number of words received.
!!! note "Allocations"
This function will perform allocations because they create the vector that
will be returned. If this is not desired, then use the in-place version
`spi_transfer!`.
# Keywords
The same keywords of `spi_transfer!` can be used.
"""
function spi_transfer(devid::Integer, tx_buf::AbstractVector{T}; kwargs...) where
T<:Integer
# Allocate the vector that will hold the returned words.
rx_buf = zeros(T, length(tx_buf))
# Perform the transfer.
ret = spi_transfer!(devid, tx_buf, rx_buf; kwargs...)
return rx_buf, ret
end
function spi_transfer(devid::Integer, tx_buf::AbstractVector{T}; kwargs...) where
T<:Vector{U} where U<:Integer
# Allocate the vectors that will hold the returned words.
rx_buf = zeros.(U, length.(tx_buf))
# Perform the transfer.
ret = spi_transfer!(devid, tx_buf, rx_buf; kwargs...)
return rx_buf, ret
end
"""
spi_transfer!(devid, tx_buf, rx_buf; kwargs...)
Execute a full duplex transfer to SPI device `devid`. `devid` is the ID of the
SPI device considering the initialization order when the function `init_spi` was
called.
`tx_buf` can be a vector of `Integer`, in which only one message will be sent,
or a vector of vectors of `Integer`, in which multiple messages will be sent.
The received data will be stored in `rx_buf` that must have the same type of
`tx_buf` and enough size.
This function returns the number of bytes received.
!!! note "Allocations"
This function will not allocate only if the number of messages sent is lower
than the constant `BaremetalPi._SPI_BUFFER_SIZE`. Otherwise, it will perform
an allocation because it must allocate a vector of
`struct_spi_ioc_transfer`.
# Keywords
* `max_speed_hz`: If > 0, then override the default maximum transfer speed with
this value [Hz]. (**Default** = 0)
* `delay_usecs`: If ≥ 0, then override the default delay with this value.
(**Default** = -1)
* `bits_per_word`: If > 0, then override the number of bits per word with this
value. (**Default** = 0)
* `cs_change`: If `false`, the deselect the device at the end of the transfer.
"""
function spi_transfer!(devid::Integer,
tx_buf::AbstractVector{T},
rx_buf::AbstractVector{T};
max_speed_hz::Integer = 0,
delay_usecs::Integer = -1,
bits_per_word::Integer = 8,
cs_change::Bool = false) where T<:Vector{U} where U <:Integer
@assert objects.spi_init "SPI not initialized. Run init_spi()."
@assert (0 < devid ≤ length(objects.spidev)) "SPI device ID is out of bounds."
spidev = objects.spidev[devid]
# Number of messages to be transmitted.
num_msgs = length(tx_buf)
@assert (length(rx_buf) ≥ num_msgs) "The number of buffers in `rx_buf` must be equal or bigger than the number of buffers in `tx_buf`."
# Check default parameters.
max_speed_hz ≤ 0 && (max_speed_hz = spidev.max_speed_hz)
delay_usecs < 0 && (delay_usecs = 0)
bits_per_word ≤ 0 && (bits_per_word = spidev.bits_per_word)
# Check if we can use the allocated buffer to transfer the message.
if num_msgs > _SPI_BUFFER_SIZE
descs = Vector{struct_spi_ioc_transfer}(undef, num_msgs)
else
descs = spidev.bdescs
end
@inbounds for i = 1:num_msgs
msg_size = length(tx_buf[i])
@assert (msg_size*bits_per_word ≤ objects.spi_buffer_size*8) "The message to be transmitted is larger than the SPI buffer."
@assert (length(rx_buf[i]) ≥ msg_size) "The length of `rx_buf[i]` must be equal or bigger than that of `tx_buf[i]`."
# Create the structure that contains the information of the SPI transfer.
descs[i] = struct_spi_ioc_transfer(pointer(tx_buf[i]),
pointer(rx_buf[i]),
# In SPI, the number of transmitted
# and received words are always the
# same.
msg_size*sizeof(U),
max_speed_hz,
delay_usecs,
bits_per_word,
cs_change)
end
# Execute the transfer.
return _ioctl(fd(spidev.io), SPI_IOC_MESSAGE(num_msgs), descs)
end
function spi_transfer!(devid::Integer,
tx_buf::AbstractVector{T},
rx_buf::AbstractVector{T};
max_speed_hz::Integer = 0,
delay_usecs::Integer = -1,
bits_per_word::Integer = 8,
cs_change::Bool = false) where T<:Integer
@assert objects.spi_init "SPI not initialized. Run init_spi()."
@assert (0 < devid ≤ length(objects.spidev)) "SPI device ID is out of bounds."
spidev = objects.spidev[devid]
# Check default parameters.
max_speed_hz ≤ 0 && (max_speed_hz = spidev.max_speed_hz)
delay_usecs < 0 && (delay_usecs = 0)
bits_per_word ≤ 0 && (bits_per_word = spidev.bits_per_word)
msg_size = length(tx_buf)
@assert (msg_size*bits_per_word ≤ objects.spi_buffer_size*8) "The message to be transmitted is larger than the SPI buffer."
@assert (length(rx_buf) ≥ msg_size) "The length of `rx_buf` must be equal or bigger than that of `tx_buf`."
# Create the structure that contains the information of the SPI transfer.
desc = struct_spi_ioc_transfer(pointer(tx_buf),
pointer(rx_buf),
# In SPI, the number of transmitted and
# received words are always the same.
msg_size*sizeof(T),
max_speed_hz,
delay_usecs,
bits_per_word,
cs_change)
# Execute the transfer.
return _ioctl(fd(spidev.io), SPI_IOC_MESSAGE(1), Ref(desc))
end
| [
2,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
198,
2,
198,
2,
12489,
198,
2,
38093,
25609,
28,
198,
2,
198,
2,
220,
220,
220,
220,
40480,
284,
6687,
262,
49091,
13,
198,
2,
198,
2,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
1303,
198,
198,
39344,
2315,
62,
2777,
72,
11,
599,
72,
62,
39437,
11,
599,
72,
62,
39437,
0,
198,
198,
29113,
29113,
14468,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20768,
1634,
198,
29113,
29113,
14468,
198,
198,
37811,
198,
220,
220,
220,
2315,
62,
2777,
72,
7,
42034,
26,
4235,
796,
657,
11,
3509,
62,
12287,
62,
32179,
796,
604,
62,
830,
62,
830,
11,
10340,
62,
525,
62,
4775,
796,
807,
8,
198,
198,
24243,
1096,
262,
49091,
4410,
13,
4600,
42034,
63,
460,
307,
257,
4731,
351,
262,
3108,
284,
4600,
2777,
485,
85,
63,
198,
273,
257,
15879,
286,
13042,
351,
257,
900,
286,
49091,
4410,
326,
481,
307,
23224,
13,
198,
198,
2,
7383,
10879,
198,
198,
9,
4600,
14171,
63,
25,
5345,
262,
4235,
286,
262,
49091,
13,
357,
1174,
19463,
1174,
796,
657,
8,
198,
9,
4600,
9806,
62,
12287,
62,
32179,
63,
25,
22246,
3142,
2866,
287,
49091,
6946,
685,
7399,
4083,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1174,
19463,
1174,
796,
604,
62,
830,
62,
830,
8,
198,
9,
4600,
9895,
62,
525,
62,
4775,
63,
25,
7913,
286,
10340,
583,
1573,
287,
49091,
6946,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1174,
19463,
1174,
796,
807,
8,
198,
198,
26396,
326,
477,
26286,
460,
307,
257,
4600,
46541,
47671,
618,
262,
8398,
481,
307,
198,
1324,
18511,
284,
477,
49091,
4410,
11,
393,
257,
4600,
38469,
63,
286,
4600,
34500,
364,
47671,
618,
1180,
198,
11250,
20074,
460,
307,
5625,
284,
262,
23224,
4410,
13,
198,
198,
37811,
198,
31,
45145,
2315,
62,
2777,
72,
7,
42034,
3712,
10100,
26,
479,
86,
22046,
23029,
796,
2315,
62,
2777,
72,
26933,
42034,
11208,
479,
86,
22046,
23029,
198,
198,
8818,
2315,
62,
2777,
72,
7,
42034,
3712,
23839,
38469,
90,
10100,
19629,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4235,
3712,
38176,
90,
46541,
11,
38469,
90,
46541,
11709,
796,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
3712,
38176,
90,
46541,
11,
38469,
90,
46541,
11709,
796,
604,
62,
830,
62,
830,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
3712,
38176,
90,
46541,
11,
38469,
90,
46541,
11709,
796,
807,
8,
628,
220,
220,
220,
1303,
7913,
286,
4410,
326,
262,
2836,
3382,
284,
41216,
13,
198,
220,
220,
220,
997,
62,
15003,
62,
42034,
796,
4129,
7,
42034,
8,
628,
220,
220,
220,
1303,
1002,
262,
7159,
389,
407,
30104,
11,
788,
6121,
606,
284,
30104,
198,
220,
220,
220,
1303,
6402,
262,
2546,
286,
4600,
42034,
44646,
198,
220,
220,
220,
611,
5145,
7,
4906,
1659,
7,
14171,
8,
1279,
25,
27741,
38469,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4235,
796,
685,
14171,
329,
4808,
796,
352,
25,
22510,
62,
15003,
62,
42034,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
5145,
7,
4906,
1659,
7,
9806,
62,
12287,
62,
32179,
8,
1279,
25,
27741,
38469,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
796,
685,
9806,
62,
12287,
62,
32179,
329,
4808,
796,
352,
25,
22510,
62,
15003,
62,
42034,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
5145,
7,
4906,
1659,
7,
9895,
62,
525,
62,
4775,
8,
1279,
25,
27741,
38469,
8,
198,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
796,
685,
9895,
62,
525,
62,
4775,
329,
4808,
796,
352,
25,
22510,
62,
15003,
62,
42034,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
1002,
356,
423,
1541,
23224,
11,
788,
1969,
477,
262,
4410,
717,
13,
198,
220,
220,
220,
5563,
13,
2777,
72,
62,
15003,
11405,
1969,
62,
2777,
72,
3419,
628,
220,
220,
220,
1303,
20768,
1096,
1123,
3335,
13,
198,
220,
220,
220,
599,
485,
85,
796,
20650,
90,
4303,
14114,
53,
92,
7,
917,
891,
11,
657,
8,
628,
220,
220,
220,
2488,
259,
65,
3733,
329,
1312,
796,
352,
25,
22510,
62,
15003,
62,
42034,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
357,
14171,
58,
72,
60,
26870,
657,
8,
4049,
7203,
44651,
49091,
4235,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
357,
9806,
62,
12287,
62,
32179,
58,
72,
60,
1875,
657,
8,
4049,
7203,
44651,
5415,
2866,
685,
7399,
60,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
357,
9895,
62,
525,
62,
4775,
58,
72,
60,
1875,
657,
8,
4049,
7203,
44651,
1271,
286,
10340,
583,
1573,
19570,
628,
220,
220,
220,
220,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4946,
262,
3335,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38093,
28,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33245,
796,
1280,
7,
42034,
58,
72,
4357,
366,
86,
10,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
17056,
495,
49091,
7071,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38093,
28,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
18564,
62,
49058,
11,
6524,
7,
14171,
58,
72,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
35257,
62,
49058,
11,
6524,
7,
14171,
58,
72,
60,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
18564,
62,
26094,
50,
62,
18973,
62,
54,
12532,
11,
6524,
7,
9895,
62,
525,
62,
4775,
58,
72,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
35257,
62,
26094,
50,
62,
18973,
62,
54,
12532,
11,
6524,
7,
9895,
62,
525,
62,
4775,
58,
72,
60,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
18564,
62,
22921,
62,
4303,
41841,
62,
39,
57,
11,
6524,
7,
9806,
62,
12287,
62,
32179,
58,
72,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
952,
34168,
7,
952,
11,
49091,
62,
40,
4503,
62,
35257,
62,
22921,
62,
4303,
41841,
62,
39,
57,
11,
6524,
7,
9806,
62,
12287,
62,
32179,
58,
72,
60,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6400,
3815,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
38093,
28,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
599,
485,
85,
62,
72,
796,
6226,
14114,
53,
7,
952,
11,
3509,
62,
12287,
62,
32179,
58,
72,
4357,
10340,
62,
525,
62,
4775,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
2777,
485,
85,
11,
599,
485,
85,
62,
72,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4929,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
23722,
407,
1280,
4600,
3,
7,
42034,
58,
72,
12962,
44646,
6889,
1654,
345,
423,
262,
2672,
21627,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
3497,
262,
2546,
286,
49091,
11876,
13,
198,
220,
220,
220,
11876,
62,
7857,
796,
21136,
7,
5317,
11,
1100,
7203,
14,
17597,
14,
21412,
14,
2777,
485,
85,
14,
17143,
7307,
14,
29325,
82,
528,
1600,
10903,
4008,
628,
220,
220,
220,
5563,
13,
2777,
485,
85,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
599,
485,
85,
198,
220,
220,
220,
5563,
13,
2777,
72,
62,
22252,
62,
7857,
796,
11876,
62,
7857,
198,
220,
220,
220,
5563,
13,
2777,
72,
62,
15003,
220,
220,
220,
220,
220,
220,
220,
796,
2081,
628,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
1969,
62,
2777,
72,
3419,
198,
198,
26125,
477,
49091,
8787,
13,
198,
198,
37811,
198,
8818,
1969,
62,
2777,
72,
3419,
198,
220,
220,
220,
611,
5563,
13,
2777,
72,
62,
15003,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
329,
288,
287,
5563,
13,
2777,
485,
85,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1969,
7,
67,
13,
952,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
5563,
13,
2777,
485,
85,
796,
20650,
90,
4303,
14114,
53,
92,
7,
917,
891,
11,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5563,
13,
2777,
72,
62,
15003,
796,
3991,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
20558,
198,
29113,
29113,
14468,
198,
198,
37811,
198,
220,
220,
220,
599,
72,
62,
39437,
7,
7959,
312,
11,
27765,
62,
29325,
26,
479,
86,
22046,
23029,
198,
198,
23002,
1133,
257,
1336,
32597,
2588,
4351,
284,
49091,
3335,
4600,
7959,
312,
44646,
4600,
7959,
312,
63,
318,
262,
4522,
286,
262,
198,
4303,
40,
3335,
6402,
262,
37588,
1502,
618,
262,
2163,
4600,
15003,
62,
2777,
72,
63,
373,
198,
7174,
13,
198,
198,
63,
17602,
62,
29325,
63,
460,
307,
257,
15879,
286,
4600,
46541,
47671,
287,
543,
691,
530,
3275,
481,
307,
1908,
11,
198,
273,
257,
15879,
286,
30104,
286,
4600,
46541,
47671,
287,
543,
3294,
6218,
481,
307,
1908,
13,
198,
198,
464,
1255,
318,
4504,
287,
281,
2134,
351,
262,
976,
2099,
286,
4600,
17602,
62,
29325,
63,
1978,
351,
198,
1169,
1271,
286,
2456,
2722,
13,
198,
198,
10185,
3465,
366,
3237,
20968,
1,
628,
220,
220,
220,
770,
2163,
481,
1620,
49157,
780,
484,
2251,
262,
15879,
326,
198,
220,
220,
220,
481,
307,
4504,
13,
1002,
428,
318,
407,
10348,
11,
788,
779,
262,
287,
12,
5372,
2196,
198,
220,
220,
220,
4600,
2777,
72,
62,
39437,
0,
44646,
198,
198,
2,
7383,
10879,
198,
198,
464,
976,
26286,
286,
4600,
2777,
72,
62,
39437,
0,
63,
460,
307,
973,
13,
198,
198,
37811,
198,
8818,
599,
72,
62,
39437,
7,
7959,
312,
3712,
46541,
11,
27765,
62,
29325,
3712,
23839,
38469,
90,
51,
19629,
479,
86,
22046,
23029,
810,
198,
220,
220,
220,
309,
27,
25,
46541,
628,
220,
220,
220,
1303,
1439,
13369,
262,
15879,
326,
481,
1745,
262,
4504,
2456,
13,
198,
220,
220,
220,
374,
87,
62,
29325,
796,
1976,
27498,
7,
51,
11,
4129,
7,
17602,
62,
29325,
4008,
628,
220,
220,
220,
1303,
35006,
262,
4351,
13,
198,
220,
220,
220,
1005,
796,
599,
72,
62,
39437,
0,
7,
7959,
312,
11,
27765,
62,
29325,
11,
374,
87,
62,
29325,
26,
479,
86,
22046,
23029,
628,
220,
220,
220,
1441,
374,
87,
62,
29325,
11,
1005,
198,
437,
198,
198,
8818,
599,
72,
62,
39437,
7,
7959,
312,
3712,
46541,
11,
27765,
62,
29325,
3712,
23839,
38469,
90,
51,
19629,
479,
86,
22046,
23029,
810,
198,
220,
220,
220,
309,
27,
25,
38469,
90,
52,
92,
810,
471,
27,
25,
46541,
628,
220,
220,
220,
1303,
1439,
13369,
262,
30104,
326,
481,
1745,
262,
4504,
2456,
13,
198,
220,
220,
220,
374,
87,
62,
29325,
796,
1976,
27498,
12195,
52,
11,
4129,
12195,
17602,
62,
29325,
4008,
628,
220,
220,
220,
1303,
35006,
262,
4351,
13,
198,
220,
220,
220,
1005,
796,
599,
72,
62,
39437,
0,
7,
7959,
312,
11,
27765,
62,
29325,
11,
374,
87,
62,
29325,
26,
479,
86,
22046,
23029,
628,
220,
220,
220,
1441,
374,
87,
62,
29325,
11,
1005,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
599,
72,
62,
39437,
0,
7,
7959,
312,
11,
27765,
62,
29325,
11,
374,
87,
62,
29325,
26,
479,
86,
22046,
23029,
198,
198,
23002,
1133,
257,
1336,
32597,
2588,
4351,
284,
49091,
3335,
4600,
7959,
312,
44646,
4600,
7959,
312,
63,
318,
262,
4522,
286,
262,
198,
4303,
40,
3335,
6402,
262,
37588,
1502,
618,
262,
2163,
4600,
15003,
62,
2777,
72,
63,
373,
198,
7174,
13,
198,
198,
63,
17602,
62,
29325,
63,
460,
307,
257,
15879,
286,
4600,
46541,
47671,
287,
543,
691,
530,
3275,
481,
307,
1908,
11,
198,
273,
257,
15879,
286,
30104,
286,
4600,
46541,
47671,
287,
543,
3294,
6218,
481,
307,
1908,
13,
198,
198,
464,
2722,
1366,
481,
307,
8574,
287,
4600,
40914,
62,
29325,
63,
326,
1276,
423,
262,
976,
2099,
286,
198,
63,
17602,
62,
29325,
63,
290,
1576,
2546,
13,
198,
198,
1212,
2163,
5860,
262,
1271,
286,
9881,
2722,
13,
198,
198,
10185,
3465,
366,
3237,
20968,
1,
628,
220,
220,
220,
770,
2163,
481,
407,
31935,
691,
611,
262,
1271,
286,
6218,
1908,
318,
2793,
198,
220,
220,
220,
621,
262,
6937,
4600,
33,
533,
28469,
38729,
13557,
4303,
40,
62,
19499,
45746,
62,
33489,
44646,
15323,
11,
340,
481,
1620,
198,
220,
220,
220,
281,
20157,
780,
340,
1276,
31935,
257,
15879,
286,
198,
220,
220,
220,
4600,
7249,
62,
2777,
72,
62,
72,
420,
62,
39437,
44646,
198,
198,
2,
7383,
10879,
198,
198,
9,
4600,
9806,
62,
12287,
62,
32179,
63,
25,
1002,
1875,
657,
11,
788,
20957,
262,
4277,
5415,
4351,
2866,
351,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
428,
1988,
685,
7399,
4083,
357,
1174,
19463,
1174,
796,
657,
8,
198,
9,
4600,
40850,
62,
1904,
6359,
63,
25,
1002,
26870,
657,
11,
788,
20957,
262,
4277,
5711,
351,
428,
1988,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1174,
19463,
1174,
796,
532,
16,
8,
198,
9,
4600,
9895,
62,
525,
62,
4775,
63,
25,
1002,
1875,
657,
11,
788,
20957,
262,
1271,
286,
10340,
583,
1573,
351,
428,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1988,
13,
357,
1174,
19463,
1174,
796,
657,
8,
198,
9,
4600,
6359,
62,
3803,
63,
25,
1002,
4600,
9562,
47671,
262,
748,
9509,
262,
3335,
379,
262,
886,
286,
262,
4351,
13,
198,
198,
37811,
198,
8818,
599,
72,
62,
39437,
0,
7,
7959,
312,
3712,
46541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27765,
62,
29325,
3712,
23839,
38469,
90,
51,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
87,
62,
29325,
3712,
23839,
38469,
90,
51,
19629,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
3712,
46541,
796,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5711,
62,
1904,
6359,
3712,
46541,
796,
532,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
3712,
46541,
796,
807,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
50115,
62,
3803,
3712,
33,
970,
796,
3991,
8,
810,
309,
27,
25,
38469,
90,
52,
92,
810,
471,
1279,
25,
46541,
628,
220,
220,
220,
2488,
30493,
5563,
13,
2777,
72,
62,
15003,
366,
4303,
40,
407,
23224,
13,
5660,
2315,
62,
2777,
72,
3419,
526,
198,
220,
220,
220,
2488,
30493,
357,
15,
1279,
1614,
312,
41305,
4129,
7,
48205,
13,
2777,
485,
85,
4008,
366,
4303,
40,
3335,
4522,
318,
503,
286,
22303,
526,
628,
220,
220,
220,
599,
485,
85,
796,
5563,
13,
2777,
485,
85,
58,
7959,
312,
60,
628,
220,
220,
220,
1303,
7913,
286,
6218,
284,
307,
18307,
13,
198,
220,
220,
220,
997,
62,
907,
14542,
796,
4129,
7,
17602,
62,
29325,
8,
628,
220,
220,
220,
2488,
30493,
357,
13664,
7,
40914,
62,
29325,
8,
26870,
997,
62,
907,
14542,
8,
366,
464,
1271,
286,
39334,
287,
4600,
40914,
62,
29325,
63,
1276,
307,
4961,
393,
5749,
621,
262,
1271,
286,
39334,
287,
4600,
17602,
62,
29325,
63,
526,
628,
220,
220,
220,
1303,
6822,
4277,
10007,
13,
198,
220,
220,
220,
3509,
62,
12287,
62,
32179,
220,
41305,
657,
11405,
357,
9806,
62,
12287,
62,
32179,
220,
796,
599,
485,
85,
13,
9806,
62,
12287,
62,
32179,
8,
198,
220,
220,
220,
5711,
62,
1904,
6359,
220,
220,
1279,
657,
11405,
357,
40850,
62,
1904,
6359,
220,
220,
796,
657,
8,
198,
220,
220,
220,
10340,
62,
525,
62,
4775,
41305,
657,
11405,
357,
9895,
62,
525,
62,
4775,
796,
599,
485,
85,
13,
9895,
62,
525,
62,
4775,
8,
628,
220,
220,
220,
1303,
6822,
611,
356,
460,
779,
262,
19171,
11876,
284,
4351,
262,
3275,
13,
198,
220,
220,
220,
611,
997,
62,
907,
14542,
1875,
4808,
4303,
40,
62,
19499,
45746,
62,
33489,
198,
220,
220,
220,
220,
220,
220,
220,
1715,
82,
796,
20650,
90,
7249,
62,
2777,
72,
62,
72,
420,
62,
39437,
92,
7,
917,
891,
11,
997,
62,
907,
14542,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1715,
82,
796,
599,
485,
85,
13,
17457,
3798,
82,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
259,
65,
3733,
329,
1312,
796,
352,
25,
22510,
62,
907,
14542,
198,
220,
220,
220,
220,
220,
220,
220,
31456,
62,
7857,
796,
4129,
7,
17602,
62,
29325,
58,
72,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
357,
19662,
62,
7857,
9,
9895,
62,
525,
62,
4775,
41305,
5563,
13,
2777,
72,
62,
22252,
62,
7857,
9,
23,
8,
366,
464,
3275,
284,
307,
18307,
318,
4025,
621,
262,
49091,
11876,
526,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
357,
13664,
7,
40914,
62,
29325,
58,
72,
12962,
26870,
31456,
62,
7857,
8,
366,
464,
4129,
286,
4600,
40914,
62,
29325,
58,
72,
60,
63,
1276,
307,
4961,
393,
5749,
621,
326,
286,
4600,
17602,
62,
29325,
58,
72,
60,
63,
526,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
13610,
262,
4645,
326,
4909,
262,
1321,
286,
262,
49091,
4351,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1715,
82,
58,
72,
60,
796,
2878,
62,
2777,
72,
62,
72,
420,
62,
39437,
7,
29536,
7,
17602,
62,
29325,
58,
72,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17562,
7,
40914,
62,
29325,
58,
72,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
554,
49091,
11,
262,
1271,
286,
18307,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
290,
2722,
2456,
389,
1464,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
976,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
62,
7857,
9,
7857,
1659,
7,
52,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5711,
62,
1904,
6359,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
50115,
62,
3803,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
8393,
1133,
262,
4351,
13,
198,
220,
220,
220,
1441,
4808,
952,
34168,
7,
16344,
7,
2777,
485,
85,
13,
952,
828,
49091,
62,
40,
4503,
62,
44,
1546,
4090,
8264,
7,
22510,
62,
907,
14542,
828,
1715,
82,
8,
198,
437,
198,
198,
8818,
599,
72,
62,
39437,
0,
7,
7959,
312,
3712,
46541,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27765,
62,
29325,
3712,
23839,
38469,
90,
51,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
87,
62,
29325,
3712,
23839,
38469,
90,
51,
19629,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
3712,
46541,
796,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5711,
62,
1904,
6359,
3712,
46541,
796,
532,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
3712,
46541,
796,
807,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
50115,
62,
3803,
3712,
33,
970,
796,
3991,
8,
810,
309,
27,
25,
46541,
628,
220,
220,
220,
2488,
30493,
5563,
13,
2777,
72,
62,
15003,
366,
4303,
40,
407,
23224,
13,
5660,
2315,
62,
2777,
72,
3419,
526,
198,
220,
220,
220,
2488,
30493,
357,
15,
1279,
1614,
312,
41305,
4129,
7,
48205,
13,
2777,
485,
85,
4008,
366,
4303,
40,
3335,
4522,
318,
503,
286,
22303,
526,
628,
220,
220,
220,
599,
485,
85,
796,
5563,
13,
2777,
485,
85,
58,
7959,
312,
60,
628,
220,
220,
220,
1303,
6822,
4277,
10007,
13,
198,
220,
220,
220,
3509,
62,
12287,
62,
32179,
220,
41305,
657,
11405,
357,
9806,
62,
12287,
62,
32179,
220,
796,
599,
485,
85,
13,
9806,
62,
12287,
62,
32179,
8,
198,
220,
220,
220,
5711,
62,
1904,
6359,
220,
220,
1279,
657,
11405,
357,
40850,
62,
1904,
6359,
220,
220,
796,
657,
8,
198,
220,
220,
220,
10340,
62,
525,
62,
4775,
41305,
657,
11405,
357,
9895,
62,
525,
62,
4775,
796,
599,
485,
85,
13,
9895,
62,
525,
62,
4775,
8,
628,
220,
220,
220,
31456,
62,
7857,
796,
4129,
7,
17602,
62,
29325,
8,
628,
220,
220,
220,
2488,
30493,
357,
19662,
62,
7857,
9,
9895,
62,
525,
62,
4775,
41305,
5563,
13,
2777,
72,
62,
22252,
62,
7857,
9,
23,
8,
366,
464,
3275,
284,
307,
18307,
318,
4025,
621,
262,
49091,
11876,
526,
198,
220,
220,
220,
2488,
30493,
357,
13664,
7,
40914,
62,
29325,
8,
26870,
31456,
62,
7857,
8,
366,
464,
4129,
286,
4600,
40914,
62,
29325,
63,
1276,
307,
4961,
393,
5749,
621,
326,
286,
4600,
17602,
62,
29325,
63,
526,
628,
220,
220,
220,
1303,
13610,
262,
4645,
326,
4909,
262,
1321,
286,
262,
49091,
4351,
13,
198,
220,
220,
220,
1715,
796,
2878,
62,
2777,
72,
62,
72,
420,
62,
39437,
7,
29536,
7,
17602,
62,
29325,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17562,
7,
40914,
62,
29325,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
554,
49091,
11,
262,
1271,
286,
18307,
290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2722,
2456,
389,
1464,
262,
976,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31456,
62,
7857,
9,
7857,
1659,
7,
51,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
12287,
62,
32179,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5711,
62,
1904,
6359,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10340,
62,
525,
62,
4775,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
50115,
62,
3803,
8,
628,
220,
220,
220,
1303,
8393,
1133,
262,
4351,
13,
198,
220,
220,
220,
1441,
4808,
952,
34168,
7,
16344,
7,
2777,
485,
85,
13,
952,
828,
49091,
62,
40,
4503,
62,
44,
1546,
4090,
8264,
7,
16,
828,
6524,
7,
20147,
4008,
198,
437,
198
] | 2.334103 | 4,762 |
export rule
@rule Gamma(:out, Marginalisation) (m_α::PointMass, m_θ::PointMass) = Gamma(mean(m_α), mean(m_θ))
@rule Gamma(:out, Marginalisation) (q_α::PointMass, q_θ::PointMass) = Gamma(mean(q_α), mean(q_θ)) | [
39344,
3896,
198,
198,
31,
25135,
43595,
7,
25,
448,
11,
11899,
1292,
5612,
8,
357,
76,
62,
17394,
3712,
12727,
20273,
11,
285,
62,
138,
116,
3712,
12727,
20273,
8,
796,
43595,
7,
32604,
7,
76,
62,
17394,
828,
1612,
7,
76,
62,
138,
116,
4008,
198,
198,
31,
25135,
43595,
7,
25,
448,
11,
11899,
1292,
5612,
8,
357,
80,
62,
17394,
3712,
12727,
20273,
11,
10662,
62,
138,
116,
3712,
12727,
20273,
8,
796,
43595,
7,
32604,
7,
80,
62,
17394,
828,
1612,
7,
80,
62,
138,
116,
4008
] | 2.271739 | 92 |
export richardson_lucy_iterative
"""
richardson_lucy_iterative(measured, psf; <keyword arguments>)
Classical iterative Richardson-Lucy iteration scheme for deconvolution.
`measured` is the measured array and `psf` the point spread function.
Converges slower than the optimization approach of `deconvolution`
# Keyword Arguments
- `regularizer=GR()`: A regularizer function. Can be exchanged
- `λ=0.05`: A float indicating the total weighting of the regularizer with
respect to the global loss function
- `iterations=100`: Specifies number of iterations.
# Example
```julia-repl
julia> using DeconvOptim, TestImages, Colors, Noise;
julia> img = Float32.(testimage("resolution_test_512"));
julia> psf = Float32.(generate_psf(size(img), 30));
julia> img_b = conv(img, psf);
julia> img_n = poisson(img_b, 300);
julia> @time res = richardson_lucy_iterative(img_n, psf);
```
"""
function richardson_lucy_iterative(measured, psf;
regularizer=GR(),
λ=0.05,
iterations=100,
conv_dims=1:ndims(psf))
otf, conv_temp = plan_conv(measured, psf, conv_dims)
otf_conj = conj.(otf)
# initializer
rec = abs.(conv_temp(measured, otf))#ones(eltype(measured), size(measured))
# buffer for gradient
buffer_grad = let
if !isnothing(regularizer)
gradient(regularizer, rec)[1]
else
nothing
end
end
∇reg(x) = buffer_grad .= gradient(regularizer, x)[1]
buffer = copy(measured)
iter_without_reg(rec) = begin
buffer .= measured ./ (conv_temp(rec, otf))
conv_temp(buffer, otf_conj)
end
iter_with_reg(rec) = buffer .= (iter_without_reg(rec) .- λ .* Base.invokelatest(∇reg, rec))
iter = isnothing(regularizer) ? iter_without_reg : iter_with_reg
for i in 1:iterations
rec .*= iter(rec)
end
return rec
end
| [
39344,
5527,
1371,
261,
62,
2290,
948,
62,
2676,
876,
198,
198,
37811,
198,
220,
220,
220,
5527,
1371,
261,
62,
2290,
948,
62,
2676,
876,
7,
1326,
34006,
11,
26692,
69,
26,
1279,
2539,
4775,
7159,
43734,
198,
198,
9487,
605,
11629,
876,
21679,
12,
25596,
948,
24415,
7791,
329,
37431,
85,
2122,
13,
198,
63,
1326,
34006,
63,
318,
262,
8630,
7177,
290,
4600,
862,
69,
63,
262,
966,
4104,
2163,
13,
198,
3103,
332,
3212,
13611,
621,
262,
23989,
3164,
286,
4600,
12501,
261,
85,
2122,
63,
198,
198,
2,
7383,
4775,
20559,
2886,
198,
12,
4600,
16338,
7509,
28,
10761,
3419,
63,
25,
317,
3218,
7509,
2163,
13,
1680,
307,
22112,
198,
12,
4600,
39377,
28,
15,
13,
2713,
63,
25,
317,
12178,
12739,
262,
2472,
3463,
278,
286,
262,
3218,
7509,
351,
220,
198,
220,
220,
220,
2461,
284,
262,
3298,
2994,
2163,
198,
12,
4600,
2676,
602,
28,
3064,
63,
25,
18291,
6945,
1271,
286,
34820,
13,
628,
198,
2,
17934,
198,
15506,
63,
73,
43640,
12,
35666,
198,
73,
43640,
29,
1262,
4280,
261,
85,
27871,
320,
11,
6208,
29398,
11,
29792,
11,
30964,
26,
198,
198,
73,
43640,
29,
33705,
796,
48436,
2624,
12195,
9288,
9060,
7203,
29268,
62,
9288,
62,
25836,
4943,
1776,
198,
198,
73,
43640,
29,
26692,
69,
796,
48436,
2624,
12195,
8612,
378,
62,
862,
69,
7,
7857,
7,
9600,
828,
1542,
18125,
198,
198,
73,
43640,
29,
33705,
62,
65,
796,
3063,
7,
9600,
11,
26692,
69,
1776,
198,
198,
73,
43640,
29,
33705,
62,
77,
796,
745,
30927,
7,
9600,
62,
65,
11,
5867,
1776,
198,
198,
73,
43640,
29,
2488,
2435,
581,
796,
5527,
1371,
261,
62,
2290,
948,
62,
2676,
876,
7,
9600,
62,
77,
11,
26692,
69,
1776,
198,
15506,
63,
198,
37811,
198,
8818,
5527,
1371,
261,
62,
2290,
948,
62,
2676,
876,
7,
1326,
34006,
11,
26692,
69,
26,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3218,
7509,
28,
10761,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
119,
28,
15,
13,
2713,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
34820,
28,
3064,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
67,
12078,
28,
16,
25,
358,
12078,
7,
862,
69,
4008,
628,
198,
220,
220,
220,
267,
27110,
11,
3063,
62,
29510,
796,
1410,
62,
42946,
7,
1326,
34006,
11,
26692,
69,
11,
3063,
62,
67,
12078,
8,
220,
198,
220,
220,
220,
267,
27110,
62,
1102,
73,
796,
11644,
12195,
313,
69,
8,
198,
220,
220,
220,
1303,
4238,
7509,
198,
220,
220,
220,
664,
796,
2352,
12195,
42946,
62,
29510,
7,
1326,
34006,
11,
267,
27110,
4008,
2,
1952,
7,
417,
4906,
7,
1326,
34006,
828,
2546,
7,
1326,
34006,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
11876,
329,
31312,
628,
220,
220,
220,
11876,
62,
9744,
796,
220,
1309,
220,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
271,
22366,
7,
16338,
7509,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
31312,
7,
16338,
7509,
11,
664,
38381,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
18872,
229,
2301,
7,
87,
8,
796,
11876,
62,
9744,
764,
28,
31312,
7,
16338,
7509,
11,
2124,
38381,
16,
60,
628,
220,
220,
220,
11876,
796,
4866,
7,
1326,
34006,
8,
628,
220,
220,
220,
11629,
62,
19419,
62,
2301,
7,
8344,
8,
796,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
11876,
764,
28,
8630,
24457,
357,
42946,
62,
29510,
7,
8344,
11,
267,
27110,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3063,
62,
29510,
7,
22252,
11,
267,
27110,
62,
1102,
73,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
11629,
62,
4480,
62,
2301,
7,
8344,
8,
796,
11876,
764,
28,
357,
2676,
62,
19419,
62,
2301,
7,
8344,
8,
764,
12,
7377,
119,
764,
9,
7308,
13,
37669,
42861,
7,
24861,
229,
2301,
11,
664,
4008,
628,
220,
220,
220,
11629,
796,
318,
22366,
7,
16338,
7509,
8,
5633,
11629,
62,
19419,
62,
2301,
1058,
11629,
62,
4480,
62,
2301,
628,
220,
220,
220,
329,
1312,
287,
352,
25,
2676,
602,
198,
220,
220,
220,
220,
220,
220,
220,
664,
764,
9,
28,
11629,
7,
8344,
8,
198,
220,
220,
220,
886,
628,
198,
220,
220,
220,
1441,
664,
198,
437,
628
] | 2.274914 | 873 |
module InterfaceTests
using Contour, Test
function setup()
nx, ny = 10, 10
xs = sort!(rand(nx))
ys = sort!(rand(ny))
zs = rand(nx, ny)
xs, ys, zs
end
xs, ys, zs = setup()
cs = @inferred contours(xs, ys, zs)
for c in levels(cs)
for l in lines(c)
x, y = coordinates(l)
@assert typeof(x) == typeof(y) == Vector{Float64}
end
end
end # InterfaceTests
| [
21412,
26491,
51,
3558,
198,
198,
3500,
2345,
454,
11,
6208,
198,
198,
8818,
9058,
3419,
198,
220,
220,
220,
299,
87,
11,
299,
88,
796,
838,
11,
838,
628,
220,
220,
220,
2124,
82,
796,
3297,
0,
7,
25192,
7,
77,
87,
4008,
198,
220,
220,
220,
331,
82,
796,
3297,
0,
7,
25192,
7,
3281,
4008,
198,
220,
220,
220,
1976,
82,
796,
43720,
7,
77,
87,
11,
299,
88,
8,
628,
220,
220,
220,
2124,
82,
11,
331,
82,
11,
1976,
82,
198,
437,
198,
198,
34223,
11,
331,
82,
11,
1976,
82,
796,
9058,
3419,
198,
198,
6359,
796,
2488,
259,
18186,
542,
4662,
7,
34223,
11,
331,
82,
11,
1976,
82,
8,
198,
1640,
269,
287,
2974,
7,
6359,
8,
198,
220,
220,
220,
329,
300,
287,
3951,
7,
66,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
11,
331,
796,
22715,
7,
75,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
2099,
1659,
7,
87,
8,
6624,
2099,
1659,
7,
88,
8,
6624,
20650,
90,
43879,
2414,
92,
198,
220,
220,
220,
886,
198,
437,
198,
198,
437,
1303,
26491,
51,
3558,
198
] | 2.046392 | 194 |
include("euler/euler.jl")
using .Calculus: fibonacci_index, fibonacci_numbers
using BenchmarkTools
BenchmarkTools.DEFAULT_PARAMETERS.samples = 100
function compute(n::Int)::Int
index = fibonacci_index(n)
fibonacci = fibonacci_numbers(index + 1, Int)
last_sum, new_sum = 0, 0
result = sum(fibonacci[1:4]) - 1
for i ∈ 5:index
last_sum, new_sum = new_sum, new_sum + last_sum + fibonacci[i - 3]
result += new_sum + fibonacci[i]
end
return result
end
compute(13)
compute(23_416_728_348_467_685)
@benchmark compute(23_416_728_348_467_685) | [
17256,
7203,
68,
18173,
14,
68,
18173,
13,
20362,
4943,
198,
3500,
764,
9771,
17576,
25,
12900,
261,
44456,
62,
9630,
11,
12900,
261,
44456,
62,
77,
17024,
198,
3500,
25187,
4102,
33637,
198,
44199,
4102,
33637,
13,
7206,
38865,
62,
27082,
2390,
2767,
4877,
13,
82,
12629,
796,
1802,
198,
198,
8818,
24061,
7,
77,
3712,
5317,
2599,
25,
5317,
198,
220,
220,
220,
6376,
796,
12900,
261,
44456,
62,
9630,
7,
77,
8,
198,
220,
220,
220,
12900,
261,
44456,
796,
12900,
261,
44456,
62,
77,
17024,
7,
9630,
1343,
352,
11,
2558,
8,
198,
220,
220,
220,
938,
62,
16345,
11,
649,
62,
16345,
796,
657,
11,
657,
198,
220,
220,
220,
1255,
796,
2160,
7,
69,
571,
261,
44456,
58,
16,
25,
19,
12962,
532,
352,
198,
220,
220,
220,
329,
1312,
18872,
230,
642,
25,
9630,
198,
220,
220,
220,
220,
220,
220,
220,
938,
62,
16345,
11,
649,
62,
16345,
796,
649,
62,
16345,
11,
649,
62,
16345,
1343,
938,
62,
16345,
1343,
12900,
261,
44456,
58,
72,
532,
513,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1255,
15853,
649,
62,
16345,
1343,
12900,
261,
44456,
58,
72,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
1255,
198,
437,
198,
198,
5589,
1133,
7,
1485,
8,
198,
198,
5589,
1133,
7,
1954,
62,
35218,
62,
48524,
62,
28978,
62,
24669,
62,
35978,
8,
198,
198,
31,
26968,
4102,
24061,
7,
1954,
62,
35218,
62,
48524,
62,
28978,
62,
24669,
62,
35978,
8
] | 2.29249 | 253 |
@testset "Constructors and basic properties" begin
let F = FullBinner()
@test typeof(F) <: AbstractVector{Float64}
@test eltype(F) == Float64
@test ndims(F) == 1
@test length(F) == 0
@test size(F) == (0,)
@test lastindex(F) == 0
@test axes(F) == (Base.OneTo(0),)
@test isempty(F)
end
let F = FullBinner(ComplexF64)
@test typeof(F) <: AbstractVector{ComplexF64}
@test eltype(F) == ComplexF64
end
let x = [0.84, 0.381169, 0.34174, 0.888868, 0.0973183, 0.722725, 0.0957878, 0.432443, 0.755033, 0.864252]
F = FullBinner(x)
@test length(F) == 10
@test lastindex(F) == 10
@test axes(F) == (Base.OneTo(10),)
@test !isempty(F)
end
let x = [rand(2,3) for _ in 1:100]
F = FullBinner(x)
@test length(F) == 100
@test eltype(F) == Array{Float64,2}
end
end
@testset "Scalars statistics" begin
# Real
let F = FullBinner(1:10_000)
@test isapprox(std_error(F), 361.4079699881821)
bs, stds, cum_stds = all_binning_errors(F)
@test bs == 1:312
@test isapprox(sum(stds), 106377.96306621947) # take sum as approx. hash
@test isapprox(sum(cum_stds), 75541.44622415205)
@test isapprox(tau(F), 77.86159630295694)
# beta: convergence
@test !BinningAnalysis.isconverged(F)
end
# Test 0/0 bug in R_value
@test std_error(FullBinner(fill(1.0, 100))) == 0.0
# Complex
let F = FullBinner((1:10_000) .+ ((10_000:-1:1) .* im))
@test isapprox(std_error(F), 511.10805270701564)
bs, stds, cum_stds = all_binning_errors(F)
@test bs == 1:312
@test isapprox(sum(stds), 150441.1581058718) # take sum as approx. hash
@test isapprox(sum(cum_stds), 106831.73777147368)
@test isapprox(tau(F), 77.86159630295694)
# beta: convergence
@test !BinningAnalysis.isconverged(F)
end
# R -> tau conversion
@test BinningAnalysis._tau(2.4) == 0.7
end
@testset "Arrays statistics" begin
# Real
Random.seed!(123)
let F = FullBinner([rand(2,3) for _ in 1:100])
@test length(F) == 100
@test isapprox(std_error(F), [0.029184472105069394 0.029581605926346424 0.027793717502753976; 0.029105387394205307 0.02741415651581391 0.029933054433434834])
@test isapprox(tau(F), [0.030183772076860294 0.027610002544459222 -0.047279410457739646; -0.003567404598109447 0.03282685243862249 0.06928989962602228])
end
# Complex
Random.seed!(123)
let F = FullBinner([rand(ComplexF64, 2,3) for _ in 1:100])
@test length(F) == 100
@test isapprox(std_error(F), [0.04445492633322362 0.04004496543964919 0.039737207226072296; 0.04099334255252945 0.039004215520294906 0.0409503504806149])
@test isapprox(tau(F), [0.062160208644724047 -0.005039096051545122 0.037487751473977315; 0.03850424600452085 -0.032173894672710424 0.0320190059417359])
end
end
@testset "Cosmetics (show, print, etc.)" begin
F = FullBinner();
# empty binner
oldstdout = stdout
(read_pipe, write_pipe) = redirect_stdout()
println(F) # compact
show(write_pipe, MIME"text/plain"(), F) # full
redirect_stdout(oldstdout);
close(write_pipe);
# compact
@test readline(read_pipe) == "FullBinner{Float64,Array{Float64,1}}()"
# full
@test readline(read_pipe) == "FullBinner{Float64,Array{Float64,1}}"
@test readline(read_pipe) == "| Count: 0"
@test length(readlines(read_pipe)) == 0
close(read_pipe);
# filled binner
Random.seed!(1234)
append!(F, rand(1000))
(read_pipe, write_pipe) = redirect_stdout()
show(write_pipe, MIME"text/plain"(), F)
redirect_stdout(oldstdout);
close(write_pipe);
@test readline(read_pipe) == "FullBinner{Float64,Array{Float64,1}}"
@test readline(read_pipe) == "| Count: 1000"
@test readline(read_pipe) == "| Mean: 0.49685"
@test length(readlines(read_pipe)) == 0
close(read_pipe);
end | [
31,
9288,
2617,
366,
42316,
669,
290,
4096,
6608,
1,
2221,
198,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2099,
1659,
7,
37,
8,
1279,
25,
27741,
38469,
90,
43879,
2414,
92,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1288,
4906,
7,
37,
8,
6624,
48436,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
299,
67,
12078,
7,
37,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
37,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2546,
7,
37,
8,
6624,
357,
15,
35751,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
938,
9630,
7,
37,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
34197,
7,
37,
8,
6624,
357,
14881,
13,
3198,
2514,
7,
15,
828,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
28920,
7,
37,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
7,
5377,
11141,
37,
2414,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2099,
1659,
7,
37,
8,
1279,
25,
27741,
38469,
90,
5377,
11141,
37,
2414,
92,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1288,
4906,
7,
37,
8,
6624,
19157,
37,
2414,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1309,
2124,
796,
685,
15,
13,
5705,
11,
657,
13,
2548,
1157,
3388,
11,
657,
13,
2682,
22985,
11,
657,
13,
3459,
3459,
3104,
11,
657,
13,
2931,
4790,
24839,
11,
657,
13,
22,
24403,
1495,
11,
657,
13,
2931,
38907,
3695,
11,
657,
13,
3559,
1731,
3559,
11,
657,
13,
2425,
1120,
2091,
11,
657,
13,
39570,
22800,
60,
198,
220,
220,
220,
220,
220,
220,
220,
376,
796,
6462,
33,
5083,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
37,
8,
6624,
838,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
938,
9630,
7,
37,
8,
6624,
838,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
34197,
7,
37,
8,
6624,
357,
14881,
13,
3198,
2514,
7,
940,
828,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
271,
28920,
7,
37,
8,
198,
220,
220,
220,
886,
628,
198,
220,
220,
220,
1309,
2124,
796,
685,
25192,
7,
17,
11,
18,
8,
329,
4808,
287,
352,
25,
3064,
60,
198,
220,
220,
220,
220,
220,
220,
220,
376,
796,
6462,
33,
5083,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
37,
8,
6624,
1802,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1288,
4906,
7,
37,
8,
6624,
15690,
90,
43879,
2414,
11,
17,
92,
198,
220,
220,
220,
886,
198,
437,
628,
198,
198,
31,
9288,
2617,
366,
3351,
282,
945,
7869,
1,
2221,
198,
220,
220,
220,
1303,
6416,
198,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
7,
16,
25,
940,
62,
830,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
19282,
62,
18224,
7,
37,
828,
47744,
13,
1821,
41060,
2079,
3459,
1507,
2481,
8,
198,
220,
220,
220,
220,
220,
220,
220,
275,
82,
11,
336,
9310,
11,
10973,
62,
301,
9310,
796,
477,
62,
8800,
768,
62,
48277,
7,
37,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
275,
82,
6624,
352,
25,
27970,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
16345,
7,
301,
9310,
828,
15696,
26514,
13,
4846,
1270,
2791,
28896,
2857,
8,
1303,
1011,
2160,
355,
5561,
13,
12234,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
16345,
7,
36340,
62,
301,
9310,
828,
767,
2816,
3901,
13,
2598,
5237,
1731,
1314,
21261,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
83,
559,
7,
37,
828,
8541,
13,
4521,
1314,
4846,
1270,
25710,
45214,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12159,
25,
40826,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
33,
23062,
32750,
13,
271,
1102,
332,
2004,
7,
37,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
6208,
657,
14,
15,
5434,
287,
371,
62,
8367,
198,
220,
220,
220,
2488,
9288,
14367,
62,
18224,
7,
13295,
33,
5083,
7,
20797,
7,
16,
13,
15,
11,
1802,
22305,
6624,
657,
13,
15,
628,
220,
220,
220,
1303,
19157,
198,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
19510,
16,
25,
940,
62,
830,
8,
764,
10,
14808,
940,
62,
830,
21912,
16,
25,
16,
8,
764,
9,
545,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
19282,
62,
18224,
7,
37,
828,
642,
1157,
13,
24045,
20,
1983,
2998,
25150,
2414,
8,
198,
220,
220,
220,
220,
220,
220,
220,
275,
82,
11,
336,
9310,
11,
10973,
62,
301,
9310,
796,
477,
62,
8800,
768,
62,
48277,
7,
37,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
275,
82,
6624,
352,
25,
27970,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
16345,
7,
301,
9310,
828,
6640,
39710,
13,
21273,
940,
44617,
1507,
8,
1303,
1011,
2160,
355,
5561,
13,
12234,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
16345,
7,
36340,
62,
301,
9310,
828,
838,
3104,
3132,
13,
22,
2718,
3324,
20198,
27412,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
83,
559,
7,
37,
828,
8541,
13,
4521,
1314,
4846,
1270,
25710,
45214,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
12159,
25,
40826,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
33,
23062,
32750,
13,
271,
1102,
332,
2004,
7,
37,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
371,
4613,
256,
559,
11315,
198,
220,
220,
220,
2488,
9288,
20828,
768,
32750,
13557,
83,
559,
7,
17,
13,
19,
8,
6624,
657,
13,
22,
198,
437,
628,
628,
198,
31,
9288,
2617,
366,
3163,
20477,
7869,
1,
2221,
198,
220,
220,
220,
1303,
6416,
198,
220,
220,
220,
14534,
13,
28826,
0,
7,
10163,
8,
198,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
26933,
25192,
7,
17,
11,
18,
8,
329,
4808,
287,
352,
25,
3064,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
37,
8,
6624,
1802,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
19282,
62,
18224,
7,
37,
828,
685,
15,
13,
48891,
1507,
2598,
4761,
940,
1120,
3388,
34626,
657,
13,
48891,
3365,
1433,
46712,
2075,
2682,
2414,
1731,
657,
13,
44698,
3720,
2718,
1558,
1120,
23195,
2670,
4304,
26,
657,
13,
48891,
13348,
32220,
34626,
21261,
22996,
657,
13,
15,
28857,
1415,
1314,
2996,
21273,
1485,
6420,
657,
13,
48891,
6052,
22515,
2598,
31380,
28978,
2682,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
83,
559,
7,
37,
828,
685,
15,
13,
3070,
29159,
26514,
22745,
3104,
1899,
27696,
657,
13,
44698,
5333,
830,
1495,
2598,
33459,
23148,
532,
15,
13,
48000,
1983,
5824,
940,
2231,
3324,
2670,
27720,
26,
532,
15,
13,
405,
2327,
3134,
1821,
2231,
4089,
14454,
34825,
657,
13,
3070,
2078,
2075,
5332,
1731,
2548,
5237,
21626,
657,
13,
3312,
24,
2078,
4089,
2079,
5237,
1899,
1828,
2078,
12962,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
19157,
198,
220,
220,
220,
14534,
13,
28826,
0,
7,
10163,
8,
198,
220,
220,
220,
1309,
376,
796,
6462,
33,
5083,
26933,
25192,
7,
5377,
11141,
37,
2414,
11,
362,
11,
18,
8,
329,
4808,
287,
352,
25,
3064,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
4129,
7,
37,
8,
6624,
1802,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
19282,
62,
18224,
7,
37,
828,
685,
15,
13,
43977,
2231,
2920,
2075,
20370,
1828,
35667,
657,
13,
3023,
405,
31911,
39111,
2670,
33300,
1129,
657,
13,
15,
33372,
2718,
22745,
1828,
31980,
1828,
4846,
26,
657,
13,
36676,
2079,
31380,
13381,
1495,
1959,
2231,
657,
13,
15,
2670,
405,
3682,
18742,
1238,
1959,
2920,
3312,
657,
13,
15,
29416,
1120,
14877,
22148,
21,
19442,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
83,
559,
7,
37,
828,
685,
15,
13,
3312,
17,
14198,
21315,
2414,
2857,
16102,
2857,
532,
15,
13,
405,
1120,
2670,
2931,
32417,
1314,
2231,
18376,
657,
13,
15,
2718,
2780,
34483,
20198,
2670,
3324,
27936,
26,
657,
13,
15,
2548,
33580,
1731,
8054,
2231,
1238,
5332,
532,
15,
13,
49959,
1558,
2548,
5824,
3134,
1983,
13464,
1731,
657,
13,
3070,
1264,
12865,
3270,
38547,
30743,
12962,
198,
220,
220,
220,
886,
198,
437,
628,
628,
198,
198,
31,
9288,
2617,
366,
36734,
27757,
357,
12860,
11,
3601,
11,
3503,
2014,
1,
2221,
198,
220,
220,
220,
376,
796,
6462,
33,
5083,
9783,
198,
220,
220,
220,
1303,
6565,
275,
5083,
198,
220,
220,
220,
1468,
19282,
448,
796,
14367,
448,
198,
220,
220,
220,
357,
961,
62,
34360,
11,
3551,
62,
34360,
8,
796,
18941,
62,
19282,
448,
3419,
198,
220,
220,
220,
44872,
7,
37,
8,
1303,
16001,
198,
220,
220,
220,
905,
7,
13564,
62,
34360,
11,
337,
12789,
1,
5239,
14,
25638,
18109,
828,
376,
8,
1303,
1336,
198,
220,
220,
220,
18941,
62,
19282,
448,
7,
727,
19282,
448,
1776,
198,
220,
220,
220,
1969,
7,
13564,
62,
34360,
1776,
628,
220,
220,
220,
1303,
16001,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
13295,
33,
5083,
90,
43879,
2414,
11,
19182,
90,
43879,
2414,
11,
16,
11709,
3419,
1,
198,
220,
220,
220,
1303,
1336,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
13295,
33,
5083,
90,
43879,
2414,
11,
19182,
90,
43879,
2414,
11,
16,
11709,
1,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
91,
2764,
25,
657,
1,
198,
220,
220,
220,
2488,
9288,
4129,
7,
961,
6615,
7,
961,
62,
34360,
4008,
6624,
657,
198,
220,
220,
220,
1969,
7,
961,
62,
34360,
1776,
628,
220,
220,
220,
1303,
5901,
275,
5083,
198,
220,
220,
220,
14534,
13,
28826,
0,
7,
1065,
2682,
8,
198,
220,
220,
220,
24443,
0,
7,
37,
11,
43720,
7,
12825,
4008,
198,
220,
220,
220,
357,
961,
62,
34360,
11,
3551,
62,
34360,
8,
796,
18941,
62,
19282,
448,
3419,
198,
220,
220,
220,
905,
7,
13564,
62,
34360,
11,
337,
12789,
1,
5239,
14,
25638,
18109,
828,
376,
8,
198,
220,
220,
220,
18941,
62,
19282,
448,
7,
727,
19282,
448,
1776,
198,
220,
220,
220,
1969,
7,
13564,
62,
34360,
1776,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
13295,
33,
5083,
90,
43879,
2414,
11,
19182,
90,
43879,
2414,
11,
16,
11709,
1,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
91,
2764,
25,
8576,
1,
198,
220,
220,
220,
2488,
9288,
1100,
1370,
7,
961,
62,
34360,
8,
6624,
366,
91,
22728,
25,
657,
13,
2920,
35978,
1,
198,
220,
220,
220,
2488,
9288,
4129,
7,
961,
6615,
7,
961,
62,
34360,
4008,
6624,
657,
198,
220,
220,
220,
1969,
7,
961,
62,
34360,
1776,
198,
437
] | 2.074949 | 1,948 |
# Unit examples of the FourierAnalysis Package for julia language
# v 0.0.1 - last update 24th of September 2019
#
# MIT License
# Copyright (c) 2019, Marco Congedo, CNRS, Grenobe, France:
# https://sites.google.com/site/marcocongedo/home
# ? CONTENTS :
# This example shows how to compute cross-spectra
# and how to extract inforation from them.
# ~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~ #
# #
# ~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~~¤~ #
using FourierAnalysis, FFTW, LinearAlgebra, Statistics, Plots, Plots.Measures
# add module for reading the two EEG text files to be used ater
push!(LOAD_PATH, @__DIR__)
using IOtxt
# Get EEG file names with complete path (they have extension .txt)
S=getFilesInDir(@__DIR__; ext=(".txt",))
# read the two EEG data files and put them in a Matrix object
X1=readEEG(S[1])
X2=readEEG(S[2])
# Cross-Spectra of EEG data
##########################################
t, sr, slide, tapering = 512, 128, 64, harris4
# gather some attributes to obtain nice spectra plots
spectraArgs=(left_margin = 2mm,
bottom_margin = 2mm,
xtickfont = font(10, "Times"),
ytickfont = font(10, "Times"))
# spectra
S=spectra(X1, sr, t; tapering=tapering, func=√)
plot(S; ytitle="Amplitude (\\muV)", spectraArgs...)
# smoothed spectra
S2=spectra(X1, sr, t; tapering=tapering, smoothing=blackmanSmoother, func=√)
plot(S2; ytitle="Amplitude (\\muV)", spectraArgs...)
#cross-spectra
𝙎=crossSpectra(X1, sr, t; tapering=tapering, tril=true)
# smooth a-posteriori the cross-spectra
𝙎2=smooth(blackmanSmoother, 𝙎)
# mean cross-spectra in 8Hz-12Hz range
alpha=mean(𝙎, (8, 12))
# extract all cross-spectra in 8Hz-12Hz range
E=extract(𝙎, (8, 12))
# mean smoothed cross-spectra in 8Hz-12Hz range
alpha=mean(𝙎2, (8, 12))
# extract smoothed cross-spectra in 8Hz-12Hz range
E=extract(𝙎2, (8, 12))
# get amplitude spectra from cross-spectra and compare with S (the long way)
S__=sqrt.(Real.([𝙎.y[i][j, j] for i=1:length(𝙎.y), j=1:size(X1, 2)]))
# the short way using FourierAnalysis
S_=Spectra(𝙎; func=√)
# check they are the same
norm(S.y-S_.y)
# cross-spectra of several data matrix at once
t, sr, slide, tapering = 1024, 128, 512, harris4
𝐗=[X1, X2]
# Compute the cross-spectra altogether
𝓢=crossSpectra(𝐗, sr, t; tapering=slepians(sr, t))
# mean cross-spectrum in 8Hz-12Hz range for each cross-spectra in 𝓢
alpha=mean(𝓢, (8, 12))
# mean of the above cross-spectra in one pass
alpha=mean(mean(𝓢, (8, 12)))
# the above computation without checking for homogeneity of elements in 𝓢 (faster)
alpha=mean(mean(𝓢, (8, 12), check=false))
# extract cross-spectra in 8Hz-12Hz range for all cross-spectra in 𝓢
E=extract(𝓢, (8, 12))
# average cross-spectra in 8Hz-12Hz range for 𝓢[1] only
Y=mean(𝓢[1], (8, 12))
# This (8 is the frequency in Hz)
Y=mean(𝓢[1], 8)
# is equivalent to this (64 is the bin where discrete Fourier Frequency 8Hz is)
𝓢[1].y[64]
# and equivalent to this
Y=extract(𝓢[1], 8)
# and equivalent to this
Y=extract(𝓢[1], (8, 8))
# Compute the lower-trianguler part of the cross-spectra
𝓢=crossSpectra(𝐗, sr, t; tapering=slepians(sr, t), tril=true)
# average cross-spectra in 8Hz-12Hz range for all 𝕃Vector in 𝓢
Y=mean(𝓢, (8, 12))
# extract cross-spectra in 8Hz-12Hz range for all 𝕃Vector in 𝓢
E=extract(𝓢, (8, 12))
# cross-spectra 𝓢[1] averaged in 1Hz band-pass regions
Z=bands(𝓢[1], 1)
# all cross-spectra in 𝓢 averaged in 1Hz band-pass regions
Z=bands(𝓢, 1)
# get amplitude spectra from cross-spectra (the long way)
S_=sqrt.(Real.([𝓢[1].y[i][j, j] for i=1:length(𝓢[1].y), j=1:size(X1, 2)]))*1.5687746
plot(S_)
# the short way using FourierAnalysis
S_sl=Spectra(𝓢[1]; func=x->sqrt(x)*1.5687746)
norm(S_sl.y-S_) # must be zero
# Compute non-linear cross-spectra
𝓢=crossSpectra(𝐗, sr, t; tapering=slepians(sr, t), tril=true, nonlinear=true)
| [
2,
220,
220,
11801,
6096,
286,
262,
34296,
5277,
32750,
15717,
329,
474,
43640,
3303,
198,
2,
220,
220,
410,
657,
13,
15,
13,
16,
532,
938,
4296,
1987,
400,
286,
2693,
13130,
198,
2,
198,
2,
220,
220,
17168,
13789,
198,
2,
220,
220,
15069,
357,
66,
8,
13130,
11,
16556,
2908,
24757,
11,
31171,
6998,
11,
19674,
5910,
11,
4881,
25,
198,
2,
220,
220,
3740,
1378,
49315,
13,
13297,
13,
785,
14,
15654,
14,
3876,
66,
420,
506,
24757,
14,
11195,
198,
198,
2,
5633,
22904,
15365,
1058,
198,
2,
220,
220,
770,
1672,
2523,
703,
284,
24061,
3272,
12,
4443,
430,
198,
2,
220,
220,
290,
703,
284,
7925,
1167,
6944,
422,
606,
13,
198,
198,
2,
220,
220,
5299,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
93,
220,
1303,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
2,
220,
220,
5299,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
4907,
126,
97,
93,
220,
1303,
628,
198,
3500,
34296,
5277,
32750,
11,
376,
9792,
54,
11,
44800,
2348,
29230,
11,
14370,
11,
1345,
1747,
11,
1345,
1747,
13,
5308,
13846,
198,
198,
2,
751,
8265,
329,
3555,
262,
734,
48749,
2420,
3696,
284,
307,
973,
257,
353,
198,
14689,
0,
7,
35613,
62,
34219,
11,
2488,
834,
34720,
834,
8,
198,
3500,
24418,
14116,
198,
198,
2,
3497,
48749,
2393,
3891,
351,
1844,
3108,
357,
9930,
423,
7552,
764,
14116,
8,
198,
50,
28,
1136,
25876,
818,
35277,
7,
31,
834,
34720,
834,
26,
1070,
16193,
1911,
14116,
1600,
4008,
198,
198,
2,
1100,
262,
734,
48749,
1366,
3696,
290,
1234,
606,
287,
257,
24936,
2134,
198,
55,
16,
28,
961,
6500,
38,
7,
50,
58,
16,
12962,
198,
55,
17,
28,
961,
6500,
38,
7,
50,
58,
17,
12962,
628,
198,
2,
6372,
12,
49738,
430,
286,
48749,
1366,
198,
29113,
7804,
2235,
198,
198,
83,
11,
19677,
11,
10649,
11,
9814,
1586,
796,
22243,
11,
13108,
11,
5598,
11,
3971,
2442,
19,
198,
198,
2,
6431,
617,
12608,
284,
7330,
3621,
5444,
430,
21528,
198,
4443,
430,
42035,
16193,
9464,
62,
36153,
220,
220,
796,
362,
3020,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4220,
62,
36153,
796,
362,
3020,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
742,
624,
10331,
220,
220,
220,
220,
796,
10369,
7,
940,
11,
366,
28595,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
42298,
10331,
220,
220,
220,
220,
796,
10369,
7,
940,
11,
366,
28595,
48774,
198,
198,
2,
5444,
430,
198,
50,
28,
4443,
430,
7,
55,
16,
11,
19677,
11,
256,
26,
9814,
1586,
28,
44335,
1586,
11,
25439,
28,
24861,
248,
8,
198,
29487,
7,
50,
26,
331,
7839,
2625,
5840,
489,
3984,
357,
6852,
30300,
53,
42501,
5444,
430,
42035,
23029,
198,
2,
32746,
704,
5444,
430,
198,
50,
17,
28,
4443,
430,
7,
55,
16,
11,
19677,
11,
256,
26,
9814,
1586,
28,
44335,
1586,
11,
32746,
722,
28,
13424,
805,
50,
5908,
847,
11,
25439,
28,
24861,
248,
8,
198,
29487,
7,
50,
17,
26,
331,
7839,
2625,
5840,
489,
3984,
357,
6852,
30300,
53,
42501,
5444,
430,
42035,
23029,
198,
198,
2,
19692,
12,
4443,
430,
198,
47728,
247,
236,
28,
19692,
49738,
430,
7,
55,
16,
11,
19677,
11,
256,
26,
9814,
1586,
28,
44335,
1586,
11,
491,
346,
28,
7942,
8,
198,
2,
7209,
257,
12,
79,
6197,
1504,
72,
262,
3272,
12,
4443,
430,
198,
47728,
247,
236,
17,
28,
5796,
5226,
7,
13424,
805,
50,
5908,
847,
11,
220,
47728,
247,
236,
8,
198,
198,
2,
1612,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
198,
26591,
28,
32604,
7,
47728,
247,
236,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
7925,
477,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
198,
36,
28,
2302,
974,
7,
47728,
247,
236,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
1612,
32746,
704,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
198,
26591,
28,
32604,
7,
47728,
247,
236,
17,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
7925,
32746,
704,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
198,
36,
28,
2302,
974,
7,
47728,
247,
236,
17,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
651,
37188,
5444,
430,
422,
3272,
12,
4443,
430,
290,
8996,
351,
311,
357,
1169,
890,
835,
8,
198,
50,
834,
28,
31166,
17034,
12195,
15633,
12195,
58,
47728,
247,
236,
13,
88,
58,
72,
7131,
73,
11,
474,
60,
329,
1312,
28,
16,
25,
13664,
7,
47728,
247,
236,
13,
88,
828,
474,
28,
16,
25,
7857,
7,
55,
16,
11,
362,
15437,
4008,
198,
2,
262,
1790,
835,
1262,
34296,
5277,
32750,
198,
50,
62,
28,
49738,
430,
7,
47728,
247,
236,
26,
25439,
28,
24861,
248,
8,
198,
198,
2,
2198,
484,
389,
262,
976,
198,
27237,
7,
50,
13,
88,
12,
50,
44807,
88,
8,
198,
198,
2,
3272,
12,
4443,
430,
286,
1811,
1366,
17593,
379,
1752,
198,
83,
11,
19677,
11,
10649,
11,
9814,
1586,
796,
28119,
11,
13108,
11,
22243,
11,
3971,
2442,
19,
198,
47728,
238,
245,
41888,
55,
16,
11,
1395,
17,
60,
198,
198,
2,
3082,
1133,
262,
3272,
12,
4443,
430,
13318,
198,
47728,
241,
95,
28,
19692,
49738,
430,
7,
47728,
238,
245,
11,
19677,
11,
256,
26,
9814,
1586,
28,
26738,
79,
1547,
7,
27891,
11,
256,
4008,
198,
198,
2,
1612,
3272,
12,
4443,
6582,
287,
807,
7399,
12,
1065,
7399,
2837,
329,
1123,
3272,
12,
4443,
430,
287,
220,
47728,
241,
95,
198,
26591,
28,
32604,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
4008,
198,
2,
1612,
286,
262,
2029,
3272,
12,
4443,
430,
287,
530,
1208,
198,
26591,
28,
32604,
7,
32604,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
22305,
198,
2,
262,
2029,
29964,
1231,
10627,
329,
3488,
37477,
286,
4847,
287,
220,
47728,
241,
95,
357,
69,
1603,
8,
198,
26591,
28,
32604,
7,
32604,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
828,
2198,
28,
9562,
4008,
198,
198,
2,
7925,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
329,
477,
3272,
12,
4443,
430,
287,
220,
47728,
241,
95,
198,
36,
28,
2302,
974,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
2811,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
329,
220,
47728,
241,
95,
58,
16,
60,
691,
198,
56,
28,
32604,
7,
47728,
241,
95,
58,
16,
4357,
357,
23,
11,
1105,
4008,
198,
198,
2,
770,
357,
23,
318,
262,
8373,
287,
26109,
8,
198,
56,
28,
32604,
7,
47728,
241,
95,
58,
16,
4357,
807,
8,
198,
2,
318,
7548,
284,
428,
357,
2414,
318,
262,
9874,
810,
28810,
34296,
5277,
31902,
807,
7399,
318,
8,
198,
47728,
241,
95,
58,
16,
4083,
88,
58,
2414,
60,
198,
2,
290,
7548,
284,
428,
198,
56,
28,
2302,
974,
7,
47728,
241,
95,
58,
16,
4357,
807,
8,
198,
2,
290,
7548,
284,
428,
198,
56,
28,
2302,
974,
7,
47728,
241,
95,
58,
16,
4357,
357,
23,
11,
807,
4008,
198,
198,
2,
3082,
1133,
262,
2793,
12,
28461,
648,
18173,
636,
286,
262,
3272,
12,
4443,
430,
198,
47728,
241,
95,
28,
19692,
49738,
430,
7,
47728,
238,
245,
11,
19677,
11,
256,
26,
9814,
1586,
28,
26738,
79,
1547,
7,
27891,
11,
256,
828,
491,
346,
28,
7942,
8,
198,
198,
2,
2811,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
329,
477,
220,
47728,
243,
225,
38469,
287,
220,
47728,
241,
95,
198,
56,
28,
32604,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
7925,
3272,
12,
4443,
430,
287,
807,
7399,
12,
1065,
7399,
2837,
329,
477,
220,
47728,
243,
225,
38469,
287,
220,
47728,
241,
95,
198,
36,
28,
2302,
974,
7,
47728,
241,
95,
11,
357,
23,
11,
1105,
4008,
198,
198,
2,
3272,
12,
4443,
430,
220,
47728,
241,
95,
58,
16,
60,
16449,
287,
352,
7399,
4097,
12,
6603,
7652,
198,
57,
28,
21397,
7,
47728,
241,
95,
58,
16,
4357,
352,
8,
198,
198,
2,
477,
3272,
12,
4443,
430,
287,
220,
47728,
241,
95,
16449,
287,
352,
7399,
4097,
12,
6603,
7652,
198,
57,
28,
21397,
7,
47728,
241,
95,
11,
352,
8,
198,
198,
2,
651,
37188,
5444,
430,
422,
3272,
12,
4443,
430,
357,
1169,
890,
835,
8,
198,
50,
62,
28,
31166,
17034,
12195,
15633,
12195,
58,
47728,
241,
95,
58,
16,
4083,
88,
58,
72,
7131,
73,
11,
474,
60,
329,
1312,
28,
16,
25,
13664,
7,
47728,
241,
95,
58,
16,
4083,
88,
828,
474,
28,
16,
25,
7857,
7,
55,
16,
11,
362,
15437,
4008,
9,
16,
13,
49211,
3324,
3510,
198,
29487,
7,
50,
62,
8,
198,
198,
2,
262,
1790,
835,
1262,
34296,
5277,
32750,
198,
50,
62,
6649,
28,
49738,
430,
7,
47728,
241,
95,
58,
16,
11208,
25439,
28,
87,
3784,
31166,
17034,
7,
87,
27493,
16,
13,
49211,
3324,
3510,
8,
198,
27237,
7,
50,
62,
6649,
13,
88,
12,
50,
62,
8,
1303,
1276,
307,
6632,
198,
198,
2,
3082,
1133,
1729,
12,
29127,
3272,
12,
4443,
430,
198,
47728,
241,
95,
28,
19692,
49738,
430,
7,
47728,
238,
245,
11,
19677,
11,
256,
26,
9814,
1586,
28,
26738,
79,
1547,
7,
27891,
11,
256,
828,
491,
346,
28,
7942,
11,
1729,
29127,
28,
7942,
8,
198
] | 2.209767 | 1,802 |
# Much of this code is lifted from LineSearches.jl
# I modified it to accept StaticArrays and not allocate
# Some of the optimization code is adapted from Optim.jl
@with_kw struct BackTracking{TF, TI}
c_1::TF = 1e-4
ρ_hi::TF = 0.5
ρ_lo::TF = 0.1
iterations::TI = 1_000
maxstep::TF = Inf
end
abstract type BackTrackingOrder end
struct Order2 <: BackTrackingOrder end
struct Order3 <: BackTrackingOrder end
struct Order0 <: BackTrackingOrder end
ordernum(::Order2) = 2
ordernum(::Order3) = 3
struct StaticOptimizationResults{Tx, Th, Tf}
initial_x::Tx
minimizer::Tx
minimum::Tf
iterations::Int
g_converged::Bool
g_tol::Tf
f_calls::Int
g_calls::Int
g::Tx
h::Th
end
struct StaticBFGS end
struct StaticNewton end
setresult(x::AbstractVector) = DiffResults.HessianResult(x)
setresult(x::Number) = DiffResults.DiffResult(x, x, x)
initialh(x::StaticVector{P,T}) where {P,T} = SMatrix{P,P,T}(I)
initialh(x::AbstractVector) = [i == j ? 1. : 0. for i in 1:size(x, 1), j in 1:size(x, 1)]
initialh(x::Number) = one(x)
setgradient!(res, f, x::AbstractVector) = ForwardDiff.gradient!(res, f, x)
setgradient!(res, f, x::Number) = ForwardDiff.derivative!(res, f, x)
sethessian!(res, f, x::AbstractVector) = ForwardDiff.hessian!(res, f, x)
function sethessian!(res, f, x::Number)
dx = ForwardDiff.Dual(ForwardDiff.Dual(x, one(typeof(x))), one(typeof(x)))
out = f(dx)
val = out.value.value
grad = out.partials.values[1].value
hess = out.partials.values[1].partials[1]
DiffResults.DiffResult(val, grad, hess)
end
function getgradient(res::DiffResults.ImmutableDiffResult)
DiffResults.gradient(res)
end
function getgradient(res::DiffResults.MutableDiffResult)
copy(DiffResults.gradient(res))
end
function getgradient(res::DiffResults.ImmutableDiffResult{1,T,Tuple{T}}) where T <: Number
DiffResults.derivative(res)
end
function getgradient(res::DiffResults.ImmutableDiffResult{1,T,Tuple{T, T}}) where T <: Number
DiffResults.derivative(res)
end
function gethessian(res::DiffResults.MutableDiffResult)
copy(DiffResults.hessian(res))
end
function gethessian(res::DiffResults.ImmutableDiffResult)
DiffResults.hessian(res)
end
function soptimize(f, x::Union{StaticVector{P,T}, TN, AbstractVector}; bto::BackTrackingOrder = Order2(), tol = 1e-8,
updating = true, maxiter = 200) where {P,T, TN <: Number}
res = setresult(x)
ls = BackTracking()
order = ordernum(bto)
xinit = copy(x)
x_new = copy(x)
hx = gethessian(res)
hold = initialh(x)::typeof(hx)
jold = copy(x); s = copy(x)
jx = jold
@unpack c_1, ρ_hi, ρ_lo, iterations = ls
iterfinitemax = -log2(eps(eltype(x)))
sqrttol = sqrt(eps(Float64))
α_0 = 1.
f_calls = 0
g_calls = 0
for n = 1:maxiter
## Compute
res = sethessian!(res, f, x); f_calls +=1; g_calls +=1; # Obtain gradient
ϕ_0 = DiffResults.value(res)
## Check convergence
isfinite(ϕ_0) || return StaticOptimizationResults(xinit, NaN*x,
NaN, n, false, tol, f_calls, g_calls, jx, hx)
jx = getgradient(res)
norm(jx, Inf) < tol && return StaticOptimizationResults(xinit, x,
ϕ_0, n, true, tol, f_calls, g_calls, jx, hx)
hx = gethessian(res)
## Compute search directions
s = -hx\jx
dϕ_0 = dot(jx, s)
if dϕ_0 >= 0. # If bad, reset search direction
hx = hold
s = -jx
dϕ_0 = dot(jx, s)
end
## Perform line search
# Count the total number of iterations
iteration = 0
ϕx_0, ϕx_1 = ϕ_0, ϕ_0
α_1, α_2 = α_0, α_0
ϕx_1 = f(x + α_1*s); f_calls +=1;
# Hard-coded backtrack until we find a finite function value
iterfinite = 0
while !isfinite(ϕx_1) && iterfinite < iterfinitemax
iterfinite += 1
α_1 = α_2
α_2 = α_1/2
ϕx_1 = f(x + α_2*s); f_calls += 1;
end
# Backtrack until we satisfy sufficient decrease condition
while ϕx_1 > ϕ_0 + c_1 * α_2 * dϕ_0
# If this part is reached we did not accept the initial linesearch
# guess, so we will need to update on the next iterations
# Increment the number of steps we've had to perform
iteration += 1
# Ensure termination
if iteration > iterations
error("Linesearch failed to converge, reached maximum iterations $(iterations).",
α_2)
end
# Shrink proposed step-size:
if order == 2 || iteration == 1
# backtracking via quadratic interpolation:
# This interpolates the available data
# f(0), f'(0), f(α)
# with a quadractic which is then minimised; this comes with a
# guaranteed backtracking factor 0.5 * (1-c_1)^{-1} which is < 1
# provided that c_1 < 1/2; the backtrack_condition at the beginning
# of the function guarantees at least a backtracking factor ρ.
α_tmp = - (dϕ_0 * α_2^2) / ( 2 * (ϕx_1 - ϕ_0 - dϕ_0*α_2) )
else
div = 1. / (α_1^2 * α_2^2 * (α_2 - α_1))
a = (α_1^2*(ϕx_1 - ϕ_0 - dϕ_0*α_2) - α_2^2*(ϕx_0 - ϕ_0 - dϕ_0*α_1))*div
b = (-α_1^3*(ϕx_1 - ϕ_0 - dϕ_0*α_2) + α_2^3*(ϕx_0 - ϕ_0 - dϕ_0*α_1))*div
if isapprox(a, zero(a), atol = eps(Float64))
α_tmp = dϕ_0 / (2*b)
else
# discriminant
d = max(b^2 - 3*a*dϕ_0, 0.)
# quadratic equation root
α_tmp = (-b + sqrt(d)) / (3*a)
end
end
α_1 = α_2
α_tmp = NaNMath.min(α_tmp, α_2*ρ_hi) # avoid too small reductions
α_2 = NaNMath.max(α_tmp, α_2*ρ_lo) # avoid too big reductions
# Evaluate f(x) at proposed position
ϕx_0, ϕx_1 = ϕx_1, f(x + α_2*s); f_calls += 1;
end
alpha, fpropose = α_2, ϕx_1
s = alpha*s
x = x + s # Update x
jold = copy(jx)
end
return StaticOptimizationResults(xinit, NaN*x,
NaN, maxiter, false, tol, f_calls, g_calls, jx, hx)
end
function Base.show(io::IO, r::StaticOptimizationResults)
@printf io "Results of Static Optimization Algorithm\n"
@printf io " * Initial guess: [%s]\n" join(r.initial_x, ",")
@printf io " * Minimizer: [%s]\n" join(r.minimizer, ",")
@printf io " * Minimum: [%s]\n" join(r.minimum, ",")
@printf io " * ∇f(x): [%s]\n" join(r.g, ",")
@printf io " * Hf(x) is size [%s]\n" join(size(r.h), ",")
@printf io " * Number of iterations: [%s]\n" join(r.iterations, ",")
@printf io " * Number of function calls: [%s]\n" join(r.f_calls, ",")
@printf io " * Number of gradient calls: [%s]\n" join(r.g_calls, ",")
@printf io " * Converged: [%s]\n" join(r.g_converged, ",")
return
end
### Modified Newton algorithm for root-finding
# I made this up, I do not know if it has nice convergence properties
# It first computes the value and derivative and performs a Newton step
# Then it computes the value and the potentially unnecessary derivative at the Newton point
# If this an improvement (closer to 0), the Newton step is accepted and it performs another Newton step
# If this is worse, it backtracks if the candidate is not finite
# Then it performs a Halley step using the function value at the candidate point
# If this is an improvement, the Halley step is accepted
# If it's still not an improvement, simple backtracking is done until it is
function snewton(f, x::Number; maxiter = 200, tol = 1e-8)
res = DiffResults.DiffResult(x, (x,))
iterfinitemax = -log2(eps(eltype(x)))
α_0 = 1.
res = ForwardDiff.derivative!(res, f, x) # Obtain gradient
ϕ_0 = DiffResults.value(res)
abs(ϕ_0) < tol && return (x = x, fx = ϕ_0, isroot = true, iter = 0)
isfinite(ϕ_0) || return (x = NaN*x, fx = NaN, isroot = false, iter = 0)
needsupdate = false
for n = 1:maxiter
if needsupdate
res = ForwardDiff.derivative!(res, f, x) # Obtain gradient
needsupdate = false
end
ϕ_0 = DiffResults.value(res)
abs(ϕ_0) < tol && return (x = x, fx = ϕ_0, isroot = true, iter = n)
isfinite(ϕ_0) || return (x = NaN*x, fx = NaN, isroot = false, iter = n)
jx = DiffResults.derivative(res)
x2 = x - ϕ_0/jx
# Count the total number of iterations
iteration = 0
ϕx_0, ϕx_1 = ϕ_0, ϕ_0
α_1, α_2 = α_0, α_0
res = ForwardDiff.derivative!(res, f, x2) # Obtain gradient
ϕx_1 = DiffResults.value(res)
abs(ϕx_1) < tol && return (x = x2, fx = ϕx_1, isroot = true, iter = n)
# Hard-coded backtrack until we find a finite function value
iterfinite = 0
x2old = x2
while !isfinite(ϕx_1) && iterfinite < iterfinitemax
needsupdate = true
iterfinite += 1
α_1 = α_2
α_2 = α_1/2
x2 = (1 - α_2)*x + α_2*x2old # convex combination
ϕx_1 = f(x2)
end
α_h = 1.
# Backtrack until we satisfy sufficient decrease condition
if abs(ϕx_1) > abs(ϕx_0) # Closer to 0?
needsupdate = true
# Increment the number of steps we've had to perform
# Interpolate available data using quadratic
hx = 2(ϕx_1 - ϕx_0 - jx*(x2 - x) ) / (x2 - x)^2 # Taylor approximation
x2 = x - 2ϕx_0*jx / (2jx^2 - ϕx_0*hx) # Halley step
ϕx_1 = f(x2)
iteration = 0
# If still not closer to 0, do simple backtracking until we are
while abs(ϕx_1) > abs(ϕx_0)
iteration += 1
α_1 = α_h
α_2 = α_1/2
x2 = (1 - α_2)*x + α_2*x2 # convex combination
ϕx_1 = f(x2)
iteration > 30 && error("Failed to converge")
end
end
x = x2
end
return (x = NaN*x, fx = NaN, isroot = false, iter = maxiter)
end
### Copied from Tamas Papp on Discourse
"""
bisection(f, a, b; fa = f(a), fb = f(b), ftol, wtol)
Bisection algorithm for finding the root ``f(x) ≈ 0`` within the initial bracket
`[a,b]`.
Returns a named tuple
`(x = x, fx = f(x), isroot = ::Bool, iter = ::Int, ismaxiter = ::Bool)`.
Terminates when either
1. `abs(f(x)) < ftol` (`isroot = true`),
2. the width of the bracket is `≤wtol` (`isroot = false`),
3. `maxiter` number of iterations is reached. (`isroot = false, maxiter = true`).
which are tested for in the above order. Therefore, care should be taken not to make `wtol` too large.
"""
function bisection(f, a::Real, b::Real;
ftol = √eps(), wtol = 0., maxiter = 100)
a, b = float(a), float(b)
fa, fb = f(a), f(b)
fa * fb ≤ 0 || error("Not a bracket")
(isfinite(a) && isfinite(b)) || error("Not finite")
_bisection(f, a, b, fa, fb, ftol, wtol, maxiter)
end
function _bisection(f, a, b, fa, fb, ftol, wtol, maxiter)
iter = 0
abs(fa) < ftol && return (x = a, fx = fa, isroot = true, iter = iter, ismaxiter = false)
abs(fb) < ftol && return (x = b, fx = fb, isroot = true, iter = iter, ismaxiter = false)
while true
iter += 1
m = middle(a, b)
fm = f(m)
abs(fm) < ftol && return (x = m, fx = fm, isroot = true, iter = iter, ismaxiter = false)
abs(b-a) ≤ wtol && return (x = m, fx = fm, isroot = false, iter = iter, ismaxiter = false)
if fa * fm > 0
a, fa = m, fm
else
b, fb = m, fm
end
iter == maxiter && return (x = m, fx = fm, isroot = false, iter = iter, ismaxiter = true)
end
end
sroot(f, x::Number) = snewton(f, x)
sroot(f, x::Tuple{T, T}) where T <: Number = @inbounds bisection(f, x[1], x[2])
function sroot(f, x::AbstractVector;
updating = true, tol = 1e-8, maxiter = 200)
f2(s) = sum(x -> x^2, f(s))
soptimize(f2, x, updating = updating, tol = tol, maxiter = maxiter )
end
#=
Algorithm:
Keep the actual hessian around
Restrict it to the active variables
Only then do the inversion (linear system)
Inverting the restricted hessian will be identical to just solving a lower dimensional problem
To keep dimensions constant, zero out the inactive part of the hessian, but fill the
diagonal with 1. This will be block diagonal and the inverse of the active region
will be the inverse of the hessian of the lower dimensional problem. The inverse
of the inactive region will just be 1 on the diagonal.
=#
function constrained_soptimize(f, x::Union{StaticVector{P,T}, TN, AbstractVector};
bto::BackTrackingOrder = Order2(), tol = 1e-7, lower = -Inf*x,
upper = Inf*x, maxiter = 200) where {P,T, TN <: Number}
res = setresult(x)
ls = BackTracking()
order = ordernum(bto)
xinit = copy(x)
x_new = copy(x)
hx = gethessian(res)
hold = initialh(x)::typeof(hx)
jold = copy(x); s = copy(x)
xold = copy(x)
jx = copy(jold)
@unpack c_1, ρ_hi, ρ_lo, iterations = ls
iterfinitemax = -log2(eps(eltype(x)))
sqrttol = sqrt(eps(Float64))
α_0 = 1.
f_calls = 0
g_calls = 0
clamp.(x, lower, upper) == x || error("Initial guess not in the feasible region")
for n = 1:maxiter
## Compute the gradient if needed
res = sethessian!(res, f, x); f_calls +=1; g_calls +=1; # Obtain hessian
ϕ_0 = DiffResults.value(res)
## Check convergence
isfinite(ϕ_0) || return StaticOptimizationResults(xinit, NaN*x,
NaN, n, false, tol, f_calls, g_calls, jx, hx)
jx = getgradient(res)
# Binding set 1
# true if free
s1l = .!( ((x .<= lower) .& (jx .>= 0)) .| ((x .>= upper) .& (jx .<= 0)) )
hx = gethessian(res)
function cdiag(x, c, i)
if c
return x
else
if i == 1.
return 1.
else
return 0.
end
end
end
isbinding(i, j) = i & j
# Binding set 2
binding = isbinding.(s1l, s1l')
#sizex = size(x)[1]
Ix = initialh(x) # An identity matrix of correct type
Hbar = cdiag.(hx, binding, Ix)
Sbargrad = (Hbar\jx)
s2l = .!( ((x .<= lower) .& (Sbargrad .> 0)) .| ((x .>= upper) .& (Sbargrad .< 0)) )
sl = s1l .& s2l
binding = isbinding.(sl, sl')
Hhat = cdiag.(hx, binding, Ix)
# set jxc to 0 if var in binding set
jxc = jx .* sl
norm(jxc, Inf) < tol && return StaticOptimizationResults(xinit, x,
ϕ_0, n, true, tol, f_calls, g_calls, jx, hx)
s = (-Hhat\jx) .* sl
dϕ_0 = dot(jx, s)
if dϕ_0 >= 0. # If bad, reset search direction
hx = hold
binding = isbinding.(s1l, s1l')
Shat = hx .* binding
s = -Shat*jx
dϕ_0 = dot(jx, s)
end
## Perform line search
# Count the total number of iterations
iteration = 0
ϕx_0, ϕx_1 = ϕ_0, ϕ_0
α_1, α_2 = α_0, α_0
ϕx_1 = f(clamp.(x + α_1*s, lower, upper)); f_calls +=1;
# Hard-coded backtrack until we find a finite function value
iterfinite = 0
while !isfinite(ϕx_1) && iterfinite < iterfinitemax
iterfinite += 1
α_1 = α_2
α_2 = α_1/2
ϕx_1 = f(clamp.(x + α_2*s, lower, upper)); f_calls += 1;
end
# Backtrack until we satisfy sufficient decrease condition
while ϕx_1 > ϕ_0 + c_1 * α_2 * dϕ_0
# If this part is reached we did not accept the initial linesearch
# guess, so we will need to update on the next iterations
# Increment the number of steps we've had to perform
iteration += 1
# Ensure termination
if iteration > iterations
error("Linesearch failed to converge, reached maximum iterations $(iterations).",
α_2)
end
# Shrink proposed step-size:
if order == 2 || iteration == 1
# backtracking via quadratic interpolation:
# This interpolates the available data
# f(0), f'(0), f(α)
# with a quadractic which is then minimised; this comes with a
# guaranteed backtracking factor 0.5 * (1-c_1)^{-1} which is < 1
# provided that c_1 < 1/2; the backtrack_condition at the beginning
# of the function guarantees at least a backtracking factor ρ.
α_tmp = - (dϕ_0 * α_2^2) / ( 2 * (ϕx_1 - ϕ_0 - dϕ_0*α_2) )
else
div = 1. / (α_1^2 * α_2^2 * (α_2 - α_1))
a = (α_1^2*(ϕx_1 - ϕ_0 - dϕ_0*α_2) - α_2^2*(ϕx_0 - ϕ_0 - dϕ_0*α_1))*div
b = (-α_1^3*(ϕx_1 - ϕ_0 - dϕ_0*α_2) + α_2^3*(ϕx_0 - ϕ_0 - dϕ_0*α_1))*div
#if norm(a) <= eps(Float64) + sqrttol*norm(a)
if isapprox(a, zero(a))
α_tmp = dϕ_0 / (2*b)
else
# discriminant
d = max(b^2 - 3*a*dϕ_0, 0.)
# quadratic equation root
α_tmp = (-b + sqrt(d)) / (3*a)
end
end
α_1 = α_2
α_tmp = NaNMath.min(α_tmp, α_2*ρ_hi) # avoid too small reductions
α_2 = NaNMath.max(α_tmp, α_2*ρ_lo) # avoid too big reductions
# Evaluate f(x) at proposed position
ϕx_0, ϕx_1 = ϕx_1, f(clamp.(x + α_2*s, lower, upper)); f_calls += 1;
end
alpha, fpropose = α_2, ϕx_1
s = alpha*s
xnew = clamp.(x + s, lower, upper) # Update x
s = xnew - x
xold = x
x = xnew
jold = copy(jx)
end
return StaticOptimizationResults(xinit, x,
NaN, maxiter, false, tol, f_calls, g_calls, jx, hx)
end
| [
2,
13111,
286,
428,
2438,
318,
13663,
422,
6910,
50,
451,
2052,
13,
20362,
198,
2,
314,
9518,
340,
284,
2453,
36125,
3163,
20477,
290,
407,
31935,
198,
198,
2,
2773,
286,
262,
23989,
2438,
318,
16573,
422,
30011,
13,
20362,
628,
198,
31,
4480,
62,
46265,
2878,
5157,
2898,
5430,
90,
10234,
11,
31598,
92,
198,
220,
220,
220,
269,
62,
16,
3712,
10234,
796,
352,
68,
12,
19,
198,
220,
220,
220,
18074,
223,
62,
5303,
3712,
10234,
796,
657,
13,
20,
198,
220,
220,
220,
18074,
223,
62,
5439,
3712,
10234,
796,
657,
13,
16,
198,
220,
220,
220,
34820,
3712,
25621,
796,
352,
62,
830,
198,
220,
220,
220,
3509,
9662,
3712,
10234,
796,
4806,
198,
437,
198,
198,
397,
8709,
2099,
5157,
2898,
5430,
18743,
886,
198,
7249,
8284,
17,
1279,
25,
5157,
2898,
5430,
18743,
886,
198,
7249,
8284,
18,
1279,
25,
5157,
2898,
5430,
18743,
886,
198,
7249,
8284,
15,
1279,
25,
5157,
2898,
5430,
18743,
886,
198,
585,
1142,
388,
7,
3712,
18743,
17,
8,
796,
362,
198,
585,
1142,
388,
7,
3712,
18743,
18,
8,
796,
513,
198,
7249,
36125,
27871,
320,
1634,
25468,
90,
46047,
11,
536,
11,
309,
69,
92,
198,
220,
220,
220,
4238,
62,
87,
3712,
46047,
198,
220,
220,
220,
10356,
7509,
3712,
46047,
198,
220,
220,
220,
5288,
3712,
51,
69,
198,
220,
220,
220,
34820,
3712,
5317,
198,
220,
220,
220,
308,
62,
1102,
332,
2004,
3712,
33,
970,
198,
220,
220,
220,
308,
62,
83,
349,
3712,
51,
69,
198,
220,
220,
220,
277,
62,
66,
5691,
3712,
5317,
198,
220,
220,
220,
308,
62,
66,
5691,
3712,
5317,
198,
220,
220,
220,
308,
3712,
46047,
198,
220,
220,
220,
289,
3712,
817,
198,
437,
198,
7249,
36125,
29499,
14313,
886,
198,
7249,
36125,
3791,
1122,
886,
198,
198,
2617,
20274,
7,
87,
3712,
23839,
38469,
8,
796,
10631,
25468,
13,
39,
408,
666,
23004,
7,
87,
8,
198,
2617,
20274,
7,
87,
3712,
15057,
8,
796,
10631,
25468,
13,
28813,
23004,
7,
87,
11,
2124,
11,
2124,
8,
198,
36733,
71,
7,
87,
3712,
45442,
38469,
90,
47,
11,
51,
30072,
810,
1391,
47,
11,
51,
92,
796,
9447,
265,
8609,
90,
47,
11,
47,
11,
51,
92,
7,
40,
8,
198,
36733,
71,
7,
87,
3712,
23839,
38469,
8,
796,
685,
72,
6624,
474,
5633,
352,
13,
1058,
657,
13,
329,
1312,
287,
352,
25,
7857,
7,
87,
11,
352,
828,
474,
287,
352,
25,
7857,
7,
87,
11,
352,
15437,
198,
36733,
71,
7,
87,
3712,
15057,
8,
796,
530,
7,
87,
8,
198,
198,
2617,
49607,
0,
7,
411,
11,
277,
11,
2124,
3712,
23839,
38469,
8,
796,
19530,
28813,
13,
49607,
0,
7,
411,
11,
277,
11,
2124,
8,
198,
2617,
49607,
0,
7,
411,
11,
277,
11,
2124,
3712,
15057,
8,
796,
19530,
28813,
13,
1082,
452,
876,
0,
7,
411,
11,
277,
11,
2124,
8,
198,
2617,
33979,
666,
0,
7,
411,
11,
277,
11,
2124,
3712,
23839,
38469,
8,
796,
19530,
28813,
13,
33979,
666,
0,
7,
411,
11,
277,
11,
2124,
8,
198,
8818,
900,
33979,
666,
0,
7,
411,
11,
277,
11,
2124,
3712,
15057,
8,
198,
220,
220,
220,
44332,
796,
19530,
28813,
13,
36248,
7,
39746,
28813,
13,
36248,
7,
87,
11,
530,
7,
4906,
1659,
7,
87,
4008,
828,
530,
7,
4906,
1659,
7,
87,
22305,
198,
220,
220,
220,
503,
796,
277,
7,
34350,
8,
198,
220,
220,
220,
1188,
796,
503,
13,
8367,
13,
8367,
198,
220,
220,
220,
3915,
796,
503,
13,
3911,
8231,
13,
27160,
58,
16,
4083,
8367,
198,
220,
220,
220,
339,
824,
796,
503,
13,
3911,
8231,
13,
27160,
58,
16,
4083,
3911,
8231,
58,
16,
60,
198,
220,
220,
220,
10631,
25468,
13,
28813,
23004,
7,
2100,
11,
3915,
11,
339,
824,
8,
198,
437,
198,
198,
8818,
651,
49607,
7,
411,
3712,
28813,
25468,
13,
24675,
18187,
28813,
23004,
8,
198,
220,
220,
220,
10631,
25468,
13,
49607,
7,
411,
8,
198,
437,
198,
8818,
651,
49607,
7,
411,
3712,
28813,
25468,
13,
44,
18187,
28813,
23004,
8,
198,
220,
220,
220,
4866,
7,
28813,
25468,
13,
49607,
7,
411,
4008,
198,
437,
198,
8818,
651,
49607,
7,
411,
3712,
28813,
25468,
13,
24675,
18187,
28813,
23004,
90,
16,
11,
51,
11,
51,
29291,
90,
51,
11709,
8,
810,
309,
1279,
25,
7913,
198,
220,
220,
220,
10631,
25468,
13,
1082,
452,
876,
7,
411,
8,
198,
437,
198,
198,
8818,
651,
49607,
7,
411,
3712,
28813,
25468,
13,
24675,
18187,
28813,
23004,
90,
16,
11,
51,
11,
51,
29291,
90,
51,
11,
309,
11709,
8,
810,
309,
1279,
25,
7913,
198,
220,
220,
220,
10631,
25468,
13,
1082,
452,
876,
7,
411,
8,
198,
437,
198,
198,
8818,
651,
33979,
666,
7,
411,
3712,
28813,
25468,
13,
44,
18187,
28813,
23004,
8,
198,
220,
220,
220,
4866,
7,
28813,
25468,
13,
33979,
666,
7,
411,
4008,
198,
437,
198,
8818,
651,
33979,
666,
7,
411,
3712,
28813,
25468,
13,
24675,
18187,
28813,
23004,
8,
198,
220,
220,
220,
10631,
25468,
13,
33979,
666,
7,
411,
8,
198,
437,
198,
198,
8818,
264,
40085,
1096,
7,
69,
11,
2124,
3712,
38176,
90,
45442,
38469,
90,
47,
11,
51,
5512,
29025,
11,
27741,
38469,
19629,
275,
1462,
3712,
7282,
2898,
5430,
18743,
796,
8284,
17,
22784,
284,
75,
796,
352,
68,
12,
23,
11,
198,
220,
220,
220,
19698,
796,
2081,
11,
3509,
2676,
796,
939,
8,
810,
1391,
47,
11,
51,
11,
29025,
1279,
25,
7913,
92,
198,
220,
220,
220,
581,
796,
900,
20274,
7,
87,
8,
198,
220,
220,
220,
43979,
796,
5157,
2898,
5430,
3419,
198,
220,
220,
220,
1502,
796,
1502,
22510,
7,
65,
1462,
8,
198,
220,
220,
220,
2124,
15003,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
2124,
62,
3605,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
289,
87,
796,
651,
33979,
666,
7,
411,
8,
198,
220,
220,
220,
1745,
796,
4238,
71,
7,
87,
2599,
25,
4906,
1659,
7,
71,
87,
8,
198,
220,
220,
220,
474,
727,
796,
4866,
7,
87,
1776,
264,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
474,
87,
796,
474,
727,
198,
220,
220,
220,
2488,
403,
8002,
269,
62,
16,
11,
18074,
223,
62,
5303,
11,
18074,
223,
62,
5439,
11,
34820,
796,
43979,
198,
220,
220,
220,
11629,
15643,
9186,
897,
796,
532,
6404,
17,
7,
25386,
7,
417,
4906,
7,
87,
22305,
198,
220,
220,
220,
19862,
81,
926,
349,
796,
19862,
17034,
7,
25386,
7,
43879,
2414,
4008,
198,
220,
220,
220,
26367,
62,
15,
796,
352,
13,
198,
220,
220,
220,
277,
62,
66,
5691,
796,
657,
198,
220,
220,
220,
308,
62,
66,
5691,
796,
657,
198,
220,
220,
220,
329,
299,
796,
352,
25,
9806,
2676,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
3082,
1133,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
900,
33979,
666,
0,
7,
411,
11,
277,
11,
2124,
1776,
277,
62,
66,
5691,
15853,
16,
26,
308,
62,
66,
5691,
15853,
16,
26,
1303,
1835,
3153,
31312,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
62,
15,
796,
10631,
25468,
13,
8367,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
6822,
40826,
198,
220,
220,
220,
220,
220,
220,
220,
318,
69,
9504,
7,
139,
243,
62,
15,
8,
8614,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
11013,
45,
9,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
11013,
45,
11,
299,
11,
3991,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
474,
87,
796,
651,
49607,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2593,
7,
73,
87,
11,
4806,
8,
1279,
284,
75,
11405,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
2124,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
62,
15,
11,
299,
11,
2081,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
796,
651,
33979,
666,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
3082,
1133,
2989,
11678,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
532,
71,
87,
59,
73,
87,
198,
220,
220,
220,
220,
220,
220,
220,
288,
139,
243,
62,
15,
796,
16605,
7,
73,
87,
11,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
288,
139,
243,
62,
15,
18189,
657,
13,
1303,
1002,
2089,
11,
13259,
2989,
4571,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
87,
796,
1745,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
796,
532,
73,
87,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
139,
243,
62,
15,
796,
16605,
7,
73,
87,
11,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
35006,
1627,
2989,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2764,
262,
2472,
1271,
286,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
24415,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
15,
11,
18074,
243,
87,
62,
16,
796,
18074,
243,
62,
15,
11,
18074,
243,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
11,
26367,
62,
17,
796,
26367,
62,
15,
11,
26367,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
87,
1343,
26367,
62,
16,
9,
82,
1776,
277,
62,
66,
5691,
15853,
16,
26,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6912,
12,
40976,
736,
11659,
1566,
356,
1064,
257,
27454,
2163,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
5145,
4468,
9504,
7,
139,
243,
87,
62,
16,
8,
11405,
11629,
69,
9504,
1279,
11629,
15643,
9186,
897,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
26367,
62,
16,
14,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
87,
1343,
26367,
62,
17,
9,
82,
1776,
277,
62,
66,
5691,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
5157,
11659,
1566,
356,
15959,
6751,
10070,
4006,
198,
220,
220,
220,
220,
220,
220,
220,
981,
18074,
243,
87,
62,
16,
1875,
18074,
243,
62,
15,
1343,
269,
62,
16,
1635,
26367,
62,
17,
1635,
288,
139,
243,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
428,
636,
318,
4251,
356,
750,
407,
2453,
262,
4238,
3951,
3679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4724,
11,
523,
356,
481,
761,
284,
4296,
319,
262,
1306,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10791,
434,
262,
1271,
286,
4831,
356,
1053,
550,
284,
1620,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24415,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
48987,
19883,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
24415,
1875,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
43,
1127,
3679,
4054,
284,
47873,
11,
4251,
5415,
34820,
29568,
2676,
602,
21387,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
911,
81,
676,
5150,
2239,
12,
7857,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1502,
6624,
362,
8614,
24415,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
736,
36280,
2884,
15094,
81,
1512,
39555,
341,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
770,
39555,
689,
262,
1695,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
277,
7,
15,
828,
277,
6,
7,
15,
828,
277,
7,
17394,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
351,
257,
15094,
974,
291,
543,
318,
788,
10356,
1417,
26,
428,
2058,
351,
257,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
11462,
736,
36280,
5766,
657,
13,
20,
1635,
357,
16,
12,
66,
62,
16,
8,
36796,
12,
16,
92,
543,
318,
1279,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2810,
326,
269,
62,
16,
1279,
352,
14,
17,
26,
262,
736,
11659,
62,
31448,
379,
262,
3726,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
286,
262,
2163,
19026,
379,
1551,
257,
736,
36280,
5766,
18074,
223,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
532,
357,
67,
139,
243,
62,
15,
1635,
26367,
62,
17,
61,
17,
8,
1220,
357,
362,
1635,
357,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2659,
796,
352,
13,
1220,
357,
17394,
62,
16,
61,
17,
1635,
26367,
62,
17,
61,
17,
1635,
357,
17394,
62,
17,
532,
26367,
62,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
796,
357,
17394,
62,
16,
61,
17,
9,
7,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
532,
26367,
62,
17,
61,
17,
9,
7,
139,
243,
87,
62,
15,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
16,
4008,
9,
7146,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
796,
13841,
17394,
62,
16,
61,
18,
9,
7,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
1343,
26367,
62,
17,
61,
18,
9,
7,
139,
243,
87,
62,
15,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
16,
4008,
9,
7146,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
1324,
13907,
7,
64,
11,
6632,
7,
64,
828,
379,
349,
796,
304,
862,
7,
43879,
2414,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
288,
139,
243,
62,
15,
1220,
357,
17,
9,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6534,
42483,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
796,
3509,
7,
65,
61,
17,
532,
513,
9,
64,
9,
67,
139,
243,
62,
15,
11,
657,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
15094,
81,
1512,
16022,
6808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
13841,
65,
1343,
19862,
17034,
7,
67,
4008,
1220,
357,
18,
9,
64,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
17,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
11013,
32755,
776,
13,
1084,
7,
17394,
62,
22065,
11,
26367,
62,
17,
9,
33643,
62,
5303,
8,
1303,
3368,
1165,
1402,
20691,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
11013,
32755,
776,
13,
9806,
7,
17394,
62,
22065,
11,
26367,
62,
17,
9,
33643,
62,
5439,
8,
1303,
3368,
1165,
1263,
20691,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26439,
4985,
277,
7,
87,
8,
379,
5150,
2292,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
15,
11,
18074,
243,
87,
62,
16,
796,
18074,
243,
87,
62,
16,
11,
277,
7,
87,
1343,
26367,
62,
17,
9,
82,
1776,
277,
62,
66,
5691,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
11,
277,
1676,
3455,
796,
26367,
62,
17,
11,
18074,
243,
87,
62,
16,
628,
220,
220,
220,
220,
220,
220,
220,
264,
796,
17130,
9,
82,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2124,
1343,
264,
1303,
10133,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
474,
727,
796,
4866,
7,
73,
87,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
11013,
45,
9,
87,
11,
198,
220,
220,
220,
11013,
45,
11,
3509,
2676,
11,
3991,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
198,
437,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
374,
3712,
45442,
27871,
320,
1634,
25468,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
25468,
286,
36125,
30011,
1634,
978,
42289,
59,
77,
1,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
20768,
4724,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
36733,
62,
87,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
1855,
320,
7509,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
1084,
320,
7509,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
26265,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
39504,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
18872,
229,
69,
7,
87,
2599,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
70,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
367,
69,
7,
87,
8,
318,
2546,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
7857,
7,
81,
13,
71,
828,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
7913,
286,
34820,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
2676,
602,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
7913,
286,
2163,
3848,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
69,
62,
66,
5691,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
7913,
286,
31312,
3848,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
70,
62,
66,
5691,
11,
366,
553,
8,
198,
220,
220,
220,
2488,
37435,
33245,
366,
1635,
35602,
2004,
25,
685,
4,
82,
60,
59,
77,
1,
4654,
7,
81,
13,
70,
62,
1102,
332,
2004,
11,
366,
553,
8,
198,
220,
220,
220,
1441,
198,
437,
628,
198,
21017,
40499,
17321,
11862,
329,
6808,
12,
41070,
198,
2,
314,
925,
428,
510,
11,
314,
466,
407,
760,
611,
340,
468,
3621,
40826,
6608,
198,
2,
632,
717,
552,
1769,
262,
1988,
290,
27255,
290,
17706,
257,
17321,
2239,
198,
2,
3244,
340,
552,
1769,
262,
1988,
290,
262,
6196,
13114,
27255,
379,
262,
17321,
966,
198,
2,
1002,
428,
281,
9025,
357,
565,
13416,
284,
657,
828,
262,
17321,
2239,
318,
6292,
290,
340,
17706,
1194,
17321,
2239,
198,
2,
1002,
428,
318,
4785,
11,
340,
736,
46074,
611,
262,
4540,
318,
407,
27454,
198,
2,
3244,
340,
17706,
257,
11023,
1636,
2239,
1262,
262,
2163,
1988,
379,
262,
4540,
966,
198,
2,
1002,
428,
318,
281,
9025,
11,
262,
11023,
1636,
2239,
318,
6292,
198,
2,
1002,
340,
338,
991,
407,
281,
9025,
11,
2829,
736,
36280,
318,
1760,
1566,
340,
318,
198,
8818,
3013,
413,
1122,
7,
69,
11,
2124,
3712,
15057,
26,
3509,
2676,
796,
939,
11,
284,
75,
796,
352,
68,
12,
23,
8,
198,
220,
220,
220,
581,
796,
10631,
25468,
13,
28813,
23004,
7,
87,
11,
357,
87,
11,
4008,
198,
220,
220,
220,
11629,
15643,
9186,
897,
796,
532,
6404,
17,
7,
25386,
7,
417,
4906,
7,
87,
22305,
198,
220,
220,
220,
26367,
62,
15,
796,
352,
13,
198,
220,
220,
220,
581,
796,
19530,
28813,
13,
1082,
452,
876,
0,
7,
411,
11,
277,
11,
2124,
8,
1303,
1835,
3153,
31312,
198,
220,
220,
220,
18074,
243,
62,
15,
796,
10631,
25468,
13,
8367,
7,
411,
8,
198,
220,
220,
220,
2352,
7,
139,
243,
62,
15,
8,
1279,
284,
75,
11405,
1441,
357,
87,
796,
2124,
11,
277,
87,
796,
18074,
243,
62,
15,
11,
318,
15763,
796,
2081,
11,
11629,
796,
657,
8,
198,
220,
220,
220,
318,
69,
9504,
7,
139,
243,
62,
15,
8,
8614,
1441,
357,
87,
796,
11013,
45,
9,
87,
11,
277,
87,
796,
11013,
45,
11,
318,
15763,
796,
3991,
11,
11629,
796,
657,
8,
628,
220,
220,
220,
2476,
19119,
796,
3991,
198,
220,
220,
220,
329,
299,
796,
352,
25,
9806,
2676,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2476,
19119,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
796,
19530,
28813,
13,
1082,
452,
876,
0,
7,
411,
11,
277,
11,
2124,
8,
1303,
1835,
3153,
31312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2476,
19119,
796,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
62,
15,
796,
10631,
25468,
13,
8367,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2352,
7,
139,
243,
62,
15,
8,
1279,
284,
75,
11405,
1441,
357,
87,
796,
2124,
11,
277,
87,
796,
18074,
243,
62,
15,
11,
318,
15763,
796,
2081,
11,
11629,
796,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
318,
69,
9504,
7,
139,
243,
62,
15,
8,
8614,
1441,
357,
87,
796,
11013,
45,
9,
87,
11,
277,
87,
796,
11013,
45,
11,
318,
15763,
796,
3991,
11,
11629,
796,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
474,
87,
796,
10631,
25468,
13,
1082,
452,
876,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
2124,
532,
18074,
243,
62,
15,
14,
73,
87,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2764,
262,
2472,
1271,
286,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
24415,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
15,
11,
18074,
243,
87,
62,
16,
796,
18074,
243,
62,
15,
11,
18074,
243,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
11,
26367,
62,
17,
796,
26367,
62,
15,
11,
26367,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
19530,
28813,
13,
1082,
452,
876,
0,
7,
411,
11,
277,
11,
2124,
17,
8,
1303,
1835,
3153,
31312,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
10631,
25468,
13,
8367,
7,
411,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2352,
7,
139,
243,
87,
62,
16,
8,
1279,
284,
75,
11405,
1441,
357,
87,
796,
2124,
17,
11,
277,
87,
796,
18074,
243,
87,
62,
16,
11,
318,
15763,
796,
2081,
11,
11629,
796,
299,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6912,
12,
40976,
736,
11659,
1566,
356,
1064,
257,
27454,
2163,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
727,
796,
2124,
17,
198,
220,
220,
220,
220,
220,
220,
220,
981,
5145,
4468,
9504,
7,
139,
243,
87,
62,
16,
8,
11405,
11629,
69,
9504,
1279,
11629,
15643,
9186,
897,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2476,
19119,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
26367,
62,
16,
14,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
357,
16,
532,
26367,
62,
17,
27493,
87,
1343,
26367,
62,
17,
9,
87,
17,
727,
1303,
24748,
87,
6087,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
87,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
71,
796,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5157,
11659,
1566,
356,
15959,
6751,
10070,
4006,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2352,
7,
139,
243,
87,
62,
16,
8,
1875,
2352,
7,
139,
243,
87,
62,
15,
8,
1303,
1012,
13416,
284,
657,
30,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2476,
19119,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10791,
434,
262,
1271,
286,
4831,
356,
1053,
550,
284,
1620,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4225,
16104,
378,
1695,
1366,
1262,
15094,
81,
1512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
87,
796,
362,
7,
139,
243,
87,
62,
16,
532,
18074,
243,
87,
62,
15,
532,
474,
87,
9,
7,
87,
17,
532,
2124,
8,
1267,
1220,
357,
87,
17,
532,
2124,
8,
61,
17,
1303,
8121,
40874,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
2124,
532,
362,
139,
243,
87,
62,
15,
9,
73,
87,
1220,
357,
17,
73,
87,
61,
17,
532,
18074,
243,
87,
62,
15,
9,
71,
87,
8,
1303,
11023,
1636,
2239,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
87,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24415,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
991,
407,
5699,
284,
657,
11,
466,
2829,
736,
36280,
1566,
356,
389,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
2352,
7,
139,
243,
87,
62,
16,
8,
1875,
2352,
7,
139,
243,
87,
62,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24415,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
71,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
26367,
62,
16,
14,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
357,
16,
532,
26367,
62,
17,
27493,
87,
1343,
26367,
62,
17,
9,
87,
17,
1303,
24748,
87,
6087,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
87,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24415,
1875,
1542,
11405,
4049,
7203,
37,
6255,
284,
47873,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2124,
17,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
357,
87,
796,
11013,
45,
9,
87,
11,
277,
87,
796,
11013,
45,
11,
318,
15763,
796,
3991,
11,
11629,
796,
3509,
2676,
8,
198,
437,
198,
198,
21017,
6955,
798,
422,
11552,
292,
350,
1324,
319,
8444,
9047,
198,
198,
37811,
198,
41907,
3213,
7,
69,
11,
257,
11,
275,
26,
24685,
796,
277,
7,
64,
828,
277,
65,
796,
277,
7,
65,
828,
10117,
349,
11,
266,
83,
349,
8,
198,
198,
33,
271,
3213,
11862,
329,
4917,
262,
6808,
7559,
69,
7,
87,
8,
15139,
230,
657,
15506,
1626,
262,
4238,
19096,
198,
220,
220,
220,
4600,
58,
64,
11,
65,
60,
44646,
628,
220,
220,
220,
16409,
257,
3706,
46545,
628,
220,
220,
220,
4600,
7,
87,
796,
2124,
11,
277,
87,
796,
277,
7,
87,
828,
318,
15763,
796,
7904,
33,
970,
11,
11629,
796,
7904,
5317,
11,
318,
9806,
2676,
796,
7904,
33,
970,
8,
44646,
628,
220,
220,
220,
15527,
689,
618,
2035,
628,
220,
220,
220,
352,
13,
4600,
8937,
7,
69,
7,
87,
4008,
1279,
10117,
349,
63,
357,
63,
271,
15763,
796,
2081,
63,
828,
198,
220,
220,
220,
362,
13,
262,
9647,
286,
262,
19096,
318,
4600,
35705,
97,
46569,
349,
63,
357,
63,
271,
15763,
796,
3991,
63,
828,
198,
220,
220,
220,
513,
13,
4600,
9806,
2676,
63,
1271,
286,
34820,
318,
4251,
13,
357,
63,
271,
15763,
796,
3991,
11,
3509,
2676,
796,
2081,
63,
737,
628,
220,
220,
220,
543,
389,
6789,
329,
287,
262,
2029,
1502,
13,
8447,
11,
1337,
815,
307,
2077,
407,
284,
787,
4600,
46569,
349,
63,
1165,
1588,
13,
198,
198,
37811,
198,
8818,
47457,
3213,
7,
69,
11,
257,
3712,
15633,
11,
275,
3712,
15633,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10117,
349,
796,
18872,
248,
25386,
22784,
266,
83,
349,
796,
657,
1539,
3509,
2676,
796,
1802,
8,
198,
220,
220,
220,
257,
11,
275,
796,
12178,
7,
64,
828,
12178,
7,
65,
8,
198,
220,
220,
220,
24685,
11,
277,
65,
796,
277,
7,
64,
828,
277,
7,
65,
8,
198,
220,
220,
220,
24685,
1635,
277,
65,
41305,
657,
8614,
4049,
7203,
3673,
257,
19096,
4943,
198,
220,
220,
220,
357,
4468,
9504,
7,
64,
8,
11405,
318,
69,
9504,
7,
65,
4008,
8614,
4049,
7203,
3673,
27454,
4943,
198,
220,
220,
220,
4808,
41907,
3213,
7,
69,
11,
257,
11,
275,
11,
24685,
11,
277,
65,
11,
10117,
349,
11,
266,
83,
349,
11,
3509,
2676,
8,
198,
437,
198,
198,
8818,
4808,
41907,
3213,
7,
69,
11,
257,
11,
275,
11,
24685,
11,
277,
65,
11,
10117,
349,
11,
266,
83,
349,
11,
3509,
2676,
8,
198,
220,
220,
220,
11629,
796,
657,
198,
220,
220,
220,
2352,
7,
13331,
8,
1279,
10117,
349,
11405,
1441,
357,
87,
796,
257,
11,
277,
87,
796,
24685,
11,
318,
15763,
796,
2081,
11,
11629,
796,
11629,
11,
318,
9806,
2676,
796,
3991,
8,
198,
220,
220,
220,
2352,
7,
21855,
8,
1279,
10117,
349,
11405,
1441,
357,
87,
796,
275,
11,
277,
87,
796,
277,
65,
11,
318,
15763,
796,
2081,
11,
11629,
796,
11629,
11,
318,
9806,
2676,
796,
3991,
8,
198,
220,
220,
220,
981,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
285,
796,
3504,
7,
64,
11,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
277,
76,
796,
277,
7,
76,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2352,
7,
38353,
8,
1279,
10117,
349,
11405,
1441,
357,
87,
796,
285,
11,
277,
87,
796,
277,
76,
11,
318,
15763,
796,
2081,
11,
11629,
796,
11629,
11,
318,
9806,
2676,
796,
3991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2352,
7,
65,
12,
64,
8,
41305,
266,
83,
349,
11405,
1441,
357,
87,
796,
285,
11,
277,
87,
796,
277,
76,
11,
318,
15763,
796,
3991,
11,
11629,
796,
11629,
11,
318,
9806,
2676,
796,
3991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
24685,
1635,
277,
76,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
11,
24685,
796,
285,
11,
277,
76,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
11,
277,
65,
796,
285,
11,
277,
76,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
6624,
3509,
2676,
11405,
1441,
357,
87,
796,
285,
11,
277,
87,
796,
277,
76,
11,
318,
15763,
796,
3991,
11,
11629,
796,
11629,
11,
318,
9806,
2676,
796,
2081,
8,
198,
220,
220,
220,
886,
198,
437,
628,
198,
82,
15763,
7,
69,
11,
2124,
3712,
15057,
8,
796,
3013,
413,
1122,
7,
69,
11,
2124,
8,
198,
82,
15763,
7,
69,
11,
2124,
3712,
51,
29291,
90,
51,
11,
309,
30072,
810,
309,
1279,
25,
7913,
796,
2488,
259,
65,
3733,
47457,
3213,
7,
69,
11,
2124,
58,
16,
4357,
2124,
58,
17,
12962,
198,
8818,
264,
15763,
7,
69,
11,
2124,
3712,
23839,
38469,
26,
198,
220,
220,
220,
19698,
796,
2081,
11,
284,
75,
796,
352,
68,
12,
23,
11,
3509,
2676,
796,
939,
8,
198,
220,
220,
220,
277,
17,
7,
82,
8,
796,
2160,
7,
87,
4613,
2124,
61,
17,
11,
277,
7,
82,
4008,
198,
220,
220,
220,
264,
40085,
1096,
7,
69,
17,
11,
2124,
11,
19698,
796,
19698,
11,
284,
75,
796,
284,
75,
11,
3509,
2676,
796,
3509,
2676,
1267,
198,
437,
628,
198,
198,
2,
28,
198,
2348,
42289,
25,
198,
15597,
262,
4036,
339,
824,
666,
1088,
198,
19452,
2012,
340,
284,
262,
4075,
9633,
198,
10049,
788,
466,
262,
287,
9641,
357,
29127,
1080,
8,
198,
198,
818,
48820,
262,
10770,
339,
824,
666,
481,
307,
10411,
284,
655,
18120,
257,
2793,
38517,
1917,
198,
198,
2514,
1394,
15225,
6937,
11,
6632,
503,
262,
28621,
636,
286,
262,
339,
824,
666,
11,
475,
6070,
262,
198,
10989,
27923,
351,
352,
13,
770,
481,
307,
2512,
40039,
290,
262,
34062,
286,
262,
4075,
3814,
198,
10594,
307,
262,
34062,
286,
262,
339,
824,
666,
286,
262,
2793,
38517,
1917,
13,
383,
34062,
198,
1659,
262,
28621,
3814,
481,
655,
307,
352,
319,
262,
40039,
13,
198,
46249,
628,
198,
8818,
31070,
62,
82,
40085,
1096,
7,
69,
11,
2124,
3712,
38176,
90,
45442,
38469,
90,
47,
11,
51,
5512,
29025,
11,
27741,
38469,
19629,
198,
220,
220,
220,
275,
1462,
3712,
7282,
2898,
5430,
18743,
796,
8284,
17,
22784,
284,
75,
796,
352,
68,
12,
22,
11,
2793,
796,
532,
18943,
9,
87,
11,
198,
220,
220,
220,
6727,
796,
4806,
9,
87,
11,
3509,
2676,
796,
939,
8,
810,
1391,
47,
11,
51,
11,
29025,
1279,
25,
7913,
92,
198,
220,
220,
220,
581,
796,
900,
20274,
7,
87,
8,
198,
220,
220,
220,
43979,
796,
5157,
2898,
5430,
3419,
198,
220,
220,
220,
1502,
796,
1502,
22510,
7,
65,
1462,
8,
198,
220,
220,
220,
2124,
15003,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
2124,
62,
3605,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
289,
87,
796,
651,
33979,
666,
7,
411,
8,
198,
220,
220,
220,
1745,
796,
4238,
71,
7,
87,
2599,
25,
4906,
1659,
7,
71,
87,
8,
198,
220,
220,
220,
474,
727,
796,
4866,
7,
87,
1776,
264,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
2124,
727,
796,
4866,
7,
87,
8,
198,
220,
220,
220,
474,
87,
796,
4866,
7,
73,
727,
8,
198,
220,
220,
220,
2488,
403,
8002,
269,
62,
16,
11,
18074,
223,
62,
5303,
11,
18074,
223,
62,
5439,
11,
34820,
796,
43979,
198,
220,
220,
220,
11629,
15643,
9186,
897,
796,
532,
6404,
17,
7,
25386,
7,
417,
4906,
7,
87,
22305,
198,
220,
220,
220,
19862,
81,
926,
349,
796,
19862,
17034,
7,
25386,
7,
43879,
2414,
4008,
198,
220,
220,
220,
26367,
62,
15,
796,
352,
13,
198,
220,
220,
220,
277,
62,
66,
5691,
796,
657,
198,
220,
220,
220,
308,
62,
66,
5691,
796,
657,
198,
220,
220,
220,
29405,
12195,
87,
11,
2793,
11,
6727,
8,
6624,
2124,
8614,
4049,
7203,
24243,
4724,
407,
287,
262,
23498,
3814,
4943,
198,
220,
220,
220,
329,
299,
796,
352,
25,
9806,
2676,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
3082,
1133,
262,
31312,
611,
2622,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
900,
33979,
666,
0,
7,
411,
11,
277,
11,
2124,
1776,
277,
62,
66,
5691,
15853,
16,
26,
308,
62,
66,
5691,
15853,
16,
26,
1303,
1835,
3153,
339,
824,
666,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
62,
15,
796,
10631,
25468,
13,
8367,
7,
411,
8,
628,
220,
220,
220,
220,
220,
220,
220,
22492,
6822,
40826,
198,
220,
220,
220,
220,
220,
220,
220,
318,
69,
9504,
7,
139,
243,
62,
15,
8,
8614,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
11013,
45,
9,
87,
11,
198,
220,
220,
220,
220,
220,
220,
220,
11013,
45,
11,
299,
11,
3991,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
474,
87,
796,
651,
49607,
7,
411,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
38904,
900,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2081,
611,
1479,
628,
220,
220,
220,
220,
220,
220,
220,
264,
16,
75,
796,
764,
0,
7,
14808,
87,
764,
27,
28,
2793,
8,
764,
5,
357,
73,
87,
764,
29,
28,
657,
4008,
764,
91,
14808,
87,
764,
29,
28,
6727,
8,
764,
5,
357,
73,
87,
764,
27,
28,
657,
4008,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
796,
651,
33979,
666,
7,
411,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2163,
269,
10989,
363,
7,
87,
11,
269,
11,
1312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
269,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
352,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
318,
30786,
7,
72,
11,
474,
8,
796,
1312,
1222,
474,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
38904,
900,
362,
198,
220,
220,
220,
220,
220,
220,
220,
12765,
796,
318,
30786,
12195,
82,
16,
75,
11,
264,
16,
75,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
82,
528,
1069,
796,
2546,
7,
87,
38381,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
314,
87,
796,
4238,
71,
7,
87,
8,
1303,
1052,
5369,
17593,
286,
3376,
2099,
198,
220,
220,
220,
220,
220,
220,
220,
367,
5657,
796,
269,
10989,
363,
12195,
71,
87,
11,
12765,
11,
314,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
311,
65,
853,
6335,
796,
357,
39,
5657,
59,
73,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
264,
17,
75,
796,
764,
0,
7,
14808,
87,
764,
27,
28,
2793,
8,
764,
5,
357,
50,
65,
853,
6335,
764,
29,
657,
4008,
764,
91,
14808,
87,
764,
29,
28,
6727,
8,
764,
5,
357,
50,
65,
853,
6335,
764,
27,
657,
4008,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
1017,
796,
264,
16,
75,
764,
5,
264,
17,
75,
198,
220,
220,
220,
220,
220,
220,
220,
12765,
796,
318,
30786,
12195,
6649,
11,
1017,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
367,
5183,
796,
269,
10989,
363,
12195,
71,
87,
11,
12765,
11,
314,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
900,
474,
25306,
284,
657,
611,
1401,
287,
12765,
900,
198,
220,
220,
220,
220,
220,
220,
220,
474,
25306,
796,
474,
87,
764,
9,
1017,
198,
220,
220,
220,
220,
220,
220,
220,
2593,
7,
73,
25306,
11,
4806,
8,
1279,
284,
75,
11405,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
2124,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
62,
15,
11,
299,
11,
2081,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
628,
220,
220,
220,
220,
220,
220,
220,
264,
796,
13841,
39,
5183,
59,
73,
87,
8,
764,
9,
1017,
198,
220,
220,
220,
220,
220,
220,
220,
288,
139,
243,
62,
15,
796,
16605,
7,
73,
87,
11,
264,
8,
628,
220,
220,
220,
220,
220,
220,
220,
611,
288,
139,
243,
62,
15,
18189,
657,
13,
1303,
1002,
2089,
11,
13259,
2989,
4571,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
87,
796,
1745,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12765,
796,
318,
30786,
12195,
82,
16,
75,
11,
264,
16,
75,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
911,
265,
796,
289,
87,
764,
9,
12765,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
796,
532,
2484,
265,
9,
73,
87,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
139,
243,
62,
15,
796,
16605,
7,
73,
87,
11,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
35006,
1627,
2989,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2764,
262,
2472,
1271,
286,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
24415,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
15,
11,
18074,
243,
87,
62,
16,
796,
18074,
243,
62,
15,
11,
18074,
243,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
11,
26367,
62,
17,
796,
26367,
62,
15,
11,
26367,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
565,
696,
12195,
87,
1343,
26367,
62,
16,
9,
82,
11,
2793,
11,
6727,
18125,
277,
62,
66,
5691,
15853,
16,
26,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
6912,
12,
40976,
736,
11659,
1566,
356,
1064,
257,
27454,
2163,
1988,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
5145,
4468,
9504,
7,
139,
243,
87,
62,
16,
8,
11405,
11629,
69,
9504,
1279,
11629,
15643,
9186,
897,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11629,
69,
9504,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
26367,
62,
16,
14,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
16,
796,
277,
7,
565,
696,
12195,
87,
1343,
26367,
62,
17,
9,
82,
11,
2793,
11,
6727,
18125,
277,
62,
66,
5691,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
5157,
11659,
1566,
356,
15959,
6751,
10070,
4006,
198,
220,
220,
220,
220,
220,
220,
220,
981,
18074,
243,
87,
62,
16,
1875,
18074,
243,
62,
15,
1343,
269,
62,
16,
1635,
26367,
62,
17,
1635,
288,
139,
243,
62,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
428,
636,
318,
4251,
356,
750,
407,
2453,
262,
4238,
3951,
3679,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4724,
11,
523,
356,
481,
761,
284,
4296,
319,
262,
1306,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
10791,
434,
262,
1271,
286,
4831,
356,
1053,
550,
284,
1620,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24415,
15853,
352,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
48987,
19883,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
24415,
1875,
34820,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
43,
1127,
3679,
4054,
284,
47873,
11,
4251,
5415,
34820,
29568,
2676,
602,
21387,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
911,
81,
676,
5150,
2239,
12,
7857,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1502,
6624,
362,
8614,
24415,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
736,
36280,
2884,
15094,
81,
1512,
39555,
341,
25,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
770,
39555,
689,
262,
1695,
1366,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
277,
7,
15,
828,
277,
6,
7,
15,
828,
277,
7,
17394,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
351,
257,
15094,
974,
291,
543,
318,
788,
10356,
1417,
26,
428,
2058,
351,
257,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
11462,
736,
36280,
5766,
657,
13,
20,
1635,
357,
16,
12,
66,
62,
16,
8,
36796,
12,
16,
92,
543,
318,
1279,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2810,
326,
269,
62,
16,
1279,
352,
14,
17,
26,
262,
736,
11659,
62,
31448,
379,
262,
3726,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
286,
262,
2163,
19026,
379,
1551,
257,
736,
36280,
5766,
18074,
223,
13,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
532,
357,
67,
139,
243,
62,
15,
1635,
26367,
62,
17,
61,
17,
8,
1220,
357,
362,
1635,
357,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2659,
796,
352,
13,
1220,
357,
17394,
62,
16,
61,
17,
1635,
26367,
62,
17,
61,
17,
1635,
357,
17394,
62,
17,
532,
26367,
62,
16,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
796,
357,
17394,
62,
16,
61,
17,
9,
7,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
532,
26367,
62,
17,
61,
17,
9,
7,
139,
243,
87,
62,
15,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
16,
4008,
9,
7146,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
796,
13841,
17394,
62,
16,
61,
18,
9,
7,
139,
243,
87,
62,
16,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
17,
8,
1343,
26367,
62,
17,
61,
18,
9,
7,
139,
243,
87,
62,
15,
532,
18074,
243,
62,
15,
532,
288,
139,
243,
62,
15,
9,
17394,
62,
16,
4008,
9,
7146,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
361,
2593,
7,
64,
8,
19841,
304,
862,
7,
43879,
2414,
8,
1343,
19862,
81,
926,
349,
9,
27237,
7,
64,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
1324,
13907,
7,
64,
11,
6632,
7,
64,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
288,
139,
243,
62,
15,
1220,
357,
17,
9,
65,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6534,
42483,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
288,
796,
3509,
7,
65,
61,
17,
532,
513,
9,
64,
9,
67,
139,
243,
62,
15,
11,
657,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
15094,
81,
1512,
16022,
6808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
13841,
65,
1343,
19862,
17034,
7,
67,
4008,
1220,
357,
18,
9,
64,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
16,
796,
26367,
62,
17,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
22065,
796,
11013,
32755,
776,
13,
1084,
7,
17394,
62,
22065,
11,
26367,
62,
17,
9,
33643,
62,
5303,
8,
1303,
3368,
1165,
1402,
20691,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26367,
62,
17,
796,
11013,
32755,
776,
13,
9806,
7,
17394,
62,
22065,
11,
26367,
62,
17,
9,
33643,
62,
5439,
8,
1303,
3368,
1165,
1263,
20691,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
26439,
4985,
277,
7,
87,
8,
379,
5150,
2292,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
243,
87,
62,
15,
11,
18074,
243,
87,
62,
16,
796,
18074,
243,
87,
62,
16,
11,
277,
7,
565,
696,
12195,
87,
1343,
26367,
62,
17,
9,
82,
11,
2793,
11,
6727,
18125,
277,
62,
66,
5691,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
17130,
11,
277,
1676,
3455,
796,
26367,
62,
17,
11,
18074,
243,
87,
62,
16,
628,
220,
220,
220,
220,
220,
220,
220,
264,
796,
17130,
9,
82,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
3605,
796,
29405,
12195,
87,
1343,
264,
11,
2793,
11,
6727,
8,
1303,
10133,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
2124,
3605,
532,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
727,
796,
2124,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
2124,
3605,
198,
220,
220,
220,
220,
220,
220,
220,
474,
727,
796,
4866,
7,
73,
87,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
36125,
27871,
320,
1634,
25468,
7,
87,
15003,
11,
2124,
11,
198,
220,
220,
220,
11013,
45,
11,
3509,
2676,
11,
3991,
11,
284,
75,
11,
277,
62,
66,
5691,
11,
308,
62,
66,
5691,
11,
474,
87,
11,
289,
87,
8,
198,
437,
198
] | 2.007435 | 9,012 |
using LazySequences
# Cons
c = cons(1, [42])
# Test first(s::Cons)
@assert first(c) == 1
# Test rest(s::Cons)
@assert first(rest(c)) == 42
ct = cat([1], [42])
# Test first(s::Cat)
@assert first(ct) == 1
# Test rest(s::Cat)
# Test getindex implementation
fibs = cat([0, 1], @lazyseq map(+, rest(fibs), fibs))
@assert fibs[1] == 0
@assert fibs[2] == 1
@assert fibs[3] == 1
@assert fibs[4] == 2
| [
3500,
406,
12582,
44015,
3007,
198,
198,
2,
3515,
198,
66,
796,
762,
7,
16,
11,
685,
3682,
12962,
198,
2,
6208,
717,
7,
82,
3712,
9444,
8,
198,
31,
30493,
717,
7,
66,
8,
6624,
352,
198,
2,
6208,
1334,
7,
82,
3712,
9444,
8,
198,
31,
30493,
717,
7,
2118,
7,
66,
4008,
6624,
5433,
198,
198,
310,
796,
3797,
26933,
16,
4357,
685,
3682,
12962,
198,
2,
6208,
717,
7,
82,
3712,
21979,
8,
198,
31,
30493,
717,
7,
310,
8,
6624,
352,
198,
2,
6208,
1334,
7,
82,
3712,
21979,
8,
628,
198,
2,
6208,
651,
9630,
7822,
198,
69,
571,
82,
796,
3797,
26933,
15,
11,
352,
4357,
2488,
75,
12582,
41068,
3975,
7,
28200,
1334,
7,
69,
571,
82,
828,
12900,
82,
4008,
198,
31,
30493,
12900,
82,
58,
16,
60,
6624,
657,
198,
31,
30493,
12900,
82,
58,
17,
60,
6624,
352,
198,
31,
30493,
12900,
82,
58,
18,
60,
6624,
352,
198,
31,
30493,
12900,
82,
58,
19,
60,
6624,
362,
198
] | 2.329412 | 170 |
# 定義の仕方がpython (:) と違って => を つかう
fruits = Dict("apple"=> 1, "banana"=> 2, "orange"=>3)
println(fruits)
# アクセスはキー
println(fruits["apple"])
fruits["mango"] = 4
println(fruits)
# 削除
pop!(fruits,"banana")
println(fruits)
# 削除part2
delete!(fruits,"apple")
println(fruits)
# 順序という概念がないから数値インデックスでアクセスはできない
# println(fruits[1])
# 辞書型の操作
println(haskey(fruits, "apple"))
# get(dict, key, default)
# ないときはdefault
println(get(fruits,"apple",42))
println(get(fruits,"mango",42))
# キーたちを取得したい時
println(keys(fruits))
# valueたちを取得したいとき
println(values(fruits))
# 複数の辞書もマージできるよ
a = Dict("apple"=>1,"banana"=>2)
b = Dict("banana"=>1,"peach"=>2)
# 後から来た方は上書きされる
println(merge(a,b))
println(merge(b,a))
| [
2,
10263,
106,
248,
163,
122,
102,
5641,
20015,
243,
43095,
35585,
29412,
357,
25,
8,
23294,
101,
34402,
243,
33180,
28134,
5218,
5099,
222,
31758,
23294,
97,
27370,
29557,
198,
198,
69,
50187,
796,
360,
713,
7203,
18040,
1,
14804,
352,
11,
366,
3820,
2271,
1,
14804,
362,
11,
366,
43745,
1,
14804,
18,
8,
198,
35235,
7,
69,
50187,
8,
198,
198,
2,
220,
11839,
14099,
47271,
8943,
31676,
25084,
6312,
198,
35235,
7,
69,
50187,
14692,
18040,
8973,
8,
198,
198,
69,
50187,
14692,
76,
14208,
8973,
796,
604,
198,
35235,
7,
69,
50187,
8,
198,
198,
2,
10263,
231,
232,
165,
247,
97,
198,
12924,
0,
7,
69,
50187,
553,
3820,
2271,
4943,
198,
35235,
7,
69,
50187,
8,
198,
198,
2,
10263,
231,
232,
165,
247,
97,
3911,
17,
198,
33678,
0,
7,
69,
50187,
553,
18040,
4943,
198,
35235,
7,
69,
50187,
8,
198,
198,
2,
16268,
254,
228,
41753,
237,
30201,
18566,
29557,
162,
99,
224,
33232,
113,
35585,
26945,
18566,
27370,
36853,
46763,
108,
161,
222,
97,
11482,
6527,
21959,
35702,
8943,
30640,
11839,
14099,
47271,
8943,
31676,
30640,
33778,
26945,
18566,
198,
2,
44872,
7,
69,
50187,
58,
16,
12962,
198,
198,
2,
5525,
122,
252,
162,
249,
116,
161,
252,
233,
27032,
241,
235,
43291,
198,
35235,
7,
10134,
2539,
7,
69,
50187,
11,
366,
18040,
48774,
198,
198,
2,
651,
7,
11600,
11,
1994,
11,
4277,
8,
198,
2,
23294,
103,
18566,
30201,
33778,
31676,
12286,
198,
35235,
7,
1136,
7,
69,
50187,
553,
18040,
1600,
3682,
4008,
198,
35235,
7,
1136,
7,
69,
50187,
553,
76,
14208,
1600,
3682,
4008,
198,
198,
2,
17433,
255,
6312,
25224,
2515,
94,
31758,
20998,
244,
36181,
245,
22180,
25224,
18566,
162,
25081,
198,
35235,
7,
13083,
7,
69,
50187,
4008,
198,
198,
2,
1988,
25224,
2515,
94,
31758,
20998,
244,
36181,
245,
22180,
25224,
18566,
30201,
33778,
198,
35235,
7,
27160,
7,
69,
50187,
4008,
198,
198,
2,
5525,
97,
229,
46763,
108,
5641,
164,
122,
252,
162,
249,
116,
43266,
20115,
6312,
21091,
30640,
33778,
25748,
1792,
230,
198,
64,
796,
360,
713,
7203,
18040,
1,
14804,
16,
553,
3820,
2271,
1,
14804,
17,
8,
198,
65,
796,
360,
713,
7203,
3820,
2271,
1,
14804,
16,
553,
431,
620,
1,
14804,
17,
8,
198,
198,
2,
10263,
122,
234,
27370,
36853,
30266,
98,
25224,
43095,
31676,
41468,
162,
249,
116,
33778,
43357,
39258,
25748,
198,
198,
35235,
7,
647,
469,
7,
64,
11,
65,
4008,
198,
35235,
7,
647,
469,
7,
65,
11,
64,
4008,
198
] | 1.63615 | 426 |
abstract type AbstractStorageFormulation <: AbstractDeviceFormulation end
struct BookKeeping <: AbstractStorageFormulation end
struct BookKeepingwReservation <: AbstractStorageFormulation end
#################################################Storage Variables#################################
function AddVariableSpec(
::Type{T},
::Type{U},
::PSIContainer,
) where {T <: ActivePowerInVariable, U <: PSY.Storage}
return AddVariableSpec(;
variable_name = make_variable_name(T, U),
binary = false,
expression_name = :nodal_balance_active,
sign = -1.0,
lb_value_func = x -> 0.0,
)
end
function AddVariableSpec(
::Type{T},
::Type{U},
::PSIContainer,
) where {T <: ActivePowerOutVariable, U <: PSY.Storage}
return AddVariableSpec(;
variable_name = make_variable_name(T, U),
binary = false,
expression_name = :nodal_balance_active,
lb_value_func = x -> 0.0,
)
end
function AddVariableSpec(
::Type{T},
::Type{U},
::PSIContainer,
) where {T <: ReactivePowerVariable, U <: PSY.Storage}
return AddVariableSpec(;
variable_name = make_variable_name(T, U),
binary = false,
expression_name = :nodal_balance_reactive,
)
end
function AddVariableSpec(
::Type{T},
::Type{U},
::PSIContainer,
) where {T <: EnergyVariable, U <: PSY.Storage}
return AddVariableSpec(;
variable_name = make_variable_name(T, U),
binary = false,
lb_value_func = x -> 0.0,
)
end
function AddVariableSpec(
::Type{T},
::Type{U},
::PSIContainer,
) where {T <: ReserveVariable, U <: PSY.Storage}
return AddVariableSpec(; variable_name = make_variable_name(T, U), binary = true)
end
################################## output power constraints#################################
function DeviceRangeConstraintSpec(
::Type{<:RangeConstraint},
::Type{ActivePowerOutVariable},
::Type{T},
::Type{<:BookKeeping},
::Type{<:PM.AbstractPowerModel},
feedforward::Union{Nothing, AbstractAffectFeedForward},
use_parameters::Bool,
use_forecasts::Bool,
) where {T <: PSY.Storage}
return DeviceRangeConstraintSpec(;
range_constraint_spec = RangeConstraintSpec(;
constraint_name = make_constraint_name(
RangeConstraint,
ActivePowerOutVariable,
T,
),
variable_name = make_variable_name(ActivePowerOutVariable, T),
limits_func = x -> PSY.get_output_active_power_limits(x),
constraint_func = device_range!,
constraint_struct = DeviceRangeConstraintInfo,
),
)
end
function DeviceRangeConstraintSpec(
::Type{<:RangeConstraint},
::Type{ActivePowerInVariable},
::Type{T},
::Type{<:BookKeeping},
::Type{<:PM.AbstractPowerModel},
feedforward::Union{Nothing, AbstractAffectFeedForward},
use_parameters::Bool,
use_forecasts::Bool,
) where {T <: PSY.Storage}
return DeviceRangeConstraintSpec(;
range_constraint_spec = RangeConstraintSpec(;
constraint_name = make_constraint_name(
RangeConstraint,
ActivePowerInVariable,
T,
),
variable_name = make_variable_name(ActivePowerInVariable, T),
limits_func = x -> PSY.get_input_active_power_limits(x),
constraint_func = device_range!,
constraint_struct = DeviceRangeConstraintInfo,
),
)
end
function DeviceRangeConstraintSpec(
::Type{<:RangeConstraint},
::Type{ActivePowerOutVariable},
::Type{T},
::Type{<:BookKeepingwReservation},
::Type{<:PM.AbstractPowerModel},
feedforward::Union{Nothing, AbstractAffectFeedForward},
use_parameters::Bool,
use_forecasts::Bool,
) where {T <: PSY.Storage}
return DeviceRangeConstraintSpec(;
range_constraint_spec = RangeConstraintSpec(;
constraint_name = make_constraint_name(
RangeConstraint,
ActivePowerOutVariable,
T,
),
variable_name = make_variable_name(ActivePowerOutVariable, T),
bin_variable_names = [make_variable_name(ReserveVariable, T)],
limits_func = x -> PSY.get_output_active_power_limits(x),
constraint_func = reserve_device_semicontinuousrange!,
constraint_struct = DeviceRangeConstraintInfo,
),
)
end
function DeviceRangeConstraintSpec(
::Type{<:RangeConstraint},
::Type{ActivePowerInVariable},
::Type{T},
::Type{<:BookKeepingwReservation},
::Type{<:PM.AbstractPowerModel},
feedforward::Union{Nothing, AbstractAffectFeedForward},
use_parameters::Bool,
use_forecasts::Bool,
) where {T <: PSY.Storage}
return DeviceRangeConstraintSpec(;
range_constraint_spec = RangeConstraintSpec(;
constraint_name = make_constraint_name(
RangeConstraint,
ActivePowerInVariable,
T,
),
variable_name = make_variable_name(ActivePowerInVariable, T),
bin_variable_names = [make_variable_name(ReserveVariable, T)],
limits_func = x -> PSY.get_input_active_power_limits(x),
constraint_func = reserve_device_semicontinuousrange!,
constraint_struct = DeviceRangeConstraintInfo,
),
)
end
"""
This function adds the reactive power limits of generators when there are CommitmentVariables
"""
function add_constraints!(
psi_container::PSIContainer,
::Type{<:RangeConstraint},
::Type{ReactivePowerVariable},
devices::IS.FlattenIteratorWrapper{St},
model::DeviceModel{St, D},
::Type{S},
feedforward::Union{Nothing, AbstractAffectFeedForward},
) where {St <: PSY.Storage, D <: AbstractStorageFormulation, S <: PM.AbstractPowerModel}
constraint_infos = Vector{DeviceRangeConstraintInfo}(undef, length(devices))
for (ix, d) in enumerate(devices)
name = PSY.get_name(d)
limits = PSY.get_reactive_power_limits(d)
constraint_infos[ix] = DeviceRangeConstraintInfo(name, limits)
end
device_range!(
psi_container,
RangeConstraintSpecInternal(
constraint_infos,
make_constraint_name(RangeConstraint, ReactivePowerVariable, St),
make_variable_name(ReactivePowerVariable, St),
),
)
return
end
########################## Make initial Conditions for a Model #############################
function initial_conditions!(
psi_container::PSIContainer,
devices::IS.FlattenIteratorWrapper{St},
::Type{D},
) where {St <: PSY.Storage, D <: AbstractStorageFormulation}
storage_energy_init(psi_container, devices)
return
end
############################ Energy Capacity Constraints####################################
function energy_capacity_constraints!(
psi_container::PSIContainer,
devices::IS.FlattenIteratorWrapper{St},
model::DeviceModel{St, D},
::Type{S},
feedforward::Union{Nothing, AbstractAffectFeedForward},
) where {St <: PSY.Storage, D <: AbstractStorageFormulation, S <: PM.AbstractPowerModel}
constraint_infos = Vector{DeviceRangeConstraintInfo}(undef, length(devices))
for (ix, d) in enumerate(devices)
name = PSY.get_name(d)
limits = PSY.get_state_of_charge_limits(d)
constraint_info = DeviceRangeConstraintInfo(name, limits)
add_device_services!(constraint_info, d, model)
constraint_infos[ix] = constraint_info
end
device_range!(
psi_container,
RangeConstraintSpecInternal(
constraint_infos,
make_constraint_name(ENERGY_CAPACITY, St),
make_variable_name(ENERGY, St),
),
)
return
end
############################ book keeping constraints ######################################
function make_efficiency_data(
devices::IS.FlattenIteratorWrapper{St},
) where {St <: PSY.Storage}
names = Vector{String}(undef, length(devices))
in_out = Vector{InOut}(undef, length(devices))
for (ix, d) in enumerate(devices)
names[ix] = PSY.get_name(d)
in_out[ix] = PSY.get_efficiency(d)
end
return names, in_out
end
function energy_balance_constraint!(
psi_container::PSIContainer,
devices::IS.FlattenIteratorWrapper{St},
::Type{D},
::Type{S},
feedforward::Union{Nothing, AbstractAffectFeedForward},
) where {St <: PSY.Storage, D <: AbstractStorageFormulation, S <: PM.AbstractPowerModel}
efficiency_data = make_efficiency_data(devices)
energy_balance(
psi_container,
get_initial_conditions(psi_container, ICKey(EnergyLevel, St)),
efficiency_data,
make_constraint_name(ENERGY_LIMIT, St),
(
make_variable_name(ACTIVE_POWER_IN, St),
make_variable_name(ACTIVE_POWER_OUT, St),
make_variable_name(ENERGY, St),
),
)
return
end
| [
397,
8709,
2099,
27741,
31425,
8479,
1741,
1279,
25,
27741,
24728,
8479,
1741,
886,
198,
7249,
4897,
44815,
1279,
25,
27741,
31425,
8479,
1741,
886,
198,
7249,
4897,
44815,
86,
4965,
13208,
1279,
25,
27741,
31425,
8479,
1741,
886,
198,
29113,
14468,
2,
31425,
15965,
2977,
29113,
2,
198,
198,
8818,
3060,
43015,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
52,
5512,
198,
220,
220,
220,
7904,
3705,
2149,
756,
10613,
11,
198,
8,
810,
1391,
51,
1279,
25,
14199,
13434,
818,
43015,
11,
471,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
3060,
43015,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
51,
11,
471,
828,
198,
220,
220,
220,
220,
220,
220,
220,
13934,
796,
3991,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5408,
62,
3672,
796,
1058,
77,
375,
282,
62,
20427,
62,
5275,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1051,
796,
532,
16,
13,
15,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18360,
62,
8367,
62,
20786,
796,
2124,
4613,
657,
13,
15,
11,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
3060,
43015,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
52,
5512,
198,
220,
220,
220,
7904,
3705,
2149,
756,
10613,
11,
198,
8,
810,
1391,
51,
1279,
25,
14199,
13434,
7975,
43015,
11,
471,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
3060,
43015,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
51,
11,
471,
828,
198,
220,
220,
220,
220,
220,
220,
220,
13934,
796,
3991,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5408,
62,
3672,
796,
1058,
77,
375,
282,
62,
20427,
62,
5275,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18360,
62,
8367,
62,
20786,
796,
2124,
4613,
657,
13,
15,
11,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
3060,
43015,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
52,
5512,
198,
220,
220,
220,
7904,
3705,
2149,
756,
10613,
11,
198,
8,
810,
1391,
51,
1279,
25,
797,
5275,
13434,
43015,
11,
471,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
3060,
43015,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
51,
11,
471,
828,
198,
220,
220,
220,
220,
220,
220,
220,
13934,
796,
3991,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5408,
62,
3672,
796,
1058,
77,
375,
282,
62,
20427,
62,
260,
5275,
11,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
3060,
43015,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
52,
5512,
198,
220,
220,
220,
7904,
3705,
2149,
756,
10613,
11,
198,
8,
810,
1391,
51,
1279,
25,
6682,
43015,
11,
471,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
3060,
43015,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
51,
11,
471,
828,
198,
220,
220,
220,
220,
220,
220,
220,
13934,
796,
3991,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18360,
62,
8367,
62,
20786,
796,
2124,
4613,
657,
13,
15,
11,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
3060,
43015,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
52,
5512,
198,
220,
220,
220,
7904,
3705,
2149,
756,
10613,
11,
198,
8,
810,
1391,
51,
1279,
25,
12224,
43015,
11,
471,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
3060,
43015,
22882,
7,
26,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
51,
11,
471,
828,
13934,
796,
2081,
8,
198,
437,
198,
198,
29113,
2235,
5072,
1176,
17778,
29113,
2,
198,
198,
8818,
16232,
17257,
3103,
2536,
2913,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
17257,
3103,
2536,
2913,
5512,
198,
220,
220,
220,
7904,
6030,
90,
13739,
13434,
7975,
43015,
5512,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
10482,
44815,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
5868,
13,
23839,
13434,
17633,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
220,
220,
220,
779,
62,
17143,
7307,
3712,
33,
970,
11,
198,
220,
220,
220,
779,
62,
754,
40924,
3712,
33,
970,
11,
198,
8,
810,
1391,
51,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
16232,
17257,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2837,
62,
1102,
2536,
2913,
62,
16684,
796,
13667,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
3672,
796,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14199,
13434,
7975,
43015,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
13739,
13434,
7975,
43015,
11,
309,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7095,
62,
20786,
796,
2124,
4613,
6599,
56,
13,
1136,
62,
22915,
62,
5275,
62,
6477,
62,
49196,
7,
87,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
20786,
796,
3335,
62,
9521,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
7249,
796,
16232,
17257,
3103,
2536,
2913,
12360,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
16232,
17257,
3103,
2536,
2913,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
17257,
3103,
2536,
2913,
5512,
198,
220,
220,
220,
7904,
6030,
90,
13739,
13434,
818,
43015,
5512,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
10482,
44815,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
5868,
13,
23839,
13434,
17633,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
220,
220,
220,
779,
62,
17143,
7307,
3712,
33,
970,
11,
198,
220,
220,
220,
779,
62,
754,
40924,
3712,
33,
970,
11,
198,
8,
810,
1391,
51,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
16232,
17257,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2837,
62,
1102,
2536,
2913,
62,
16684,
796,
13667,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
3672,
796,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14199,
13434,
818,
43015,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
13739,
13434,
818,
43015,
11,
309,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7095,
62,
20786,
796,
2124,
4613,
6599,
56,
13,
1136,
62,
15414,
62,
5275,
62,
6477,
62,
49196,
7,
87,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
20786,
796,
3335,
62,
9521,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
7249,
796,
16232,
17257,
3103,
2536,
2913,
12360,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
16232,
17257,
3103,
2536,
2913,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
17257,
3103,
2536,
2913,
5512,
198,
220,
220,
220,
7904,
6030,
90,
13739,
13434,
7975,
43015,
5512,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
10482,
44815,
86,
4965,
13208,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
5868,
13,
23839,
13434,
17633,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
220,
220,
220,
779,
62,
17143,
7307,
3712,
33,
970,
11,
198,
220,
220,
220,
779,
62,
754,
40924,
3712,
33,
970,
11,
198,
8,
810,
1391,
51,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
16232,
17257,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2837,
62,
1102,
2536,
2913,
62,
16684,
796,
13667,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
3672,
796,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14199,
13434,
7975,
43015,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
13739,
13434,
7975,
43015,
11,
309,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9874,
62,
45286,
62,
14933,
796,
685,
15883,
62,
45286,
62,
3672,
7,
4965,
3760,
43015,
11,
309,
8,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7095,
62,
20786,
796,
2124,
4613,
6599,
56,
13,
1136,
62,
22915,
62,
5275,
62,
6477,
62,
49196,
7,
87,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
20786,
796,
11515,
62,
25202,
62,
325,
9383,
756,
259,
5623,
9521,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
7249,
796,
16232,
17257,
3103,
2536,
2913,
12360,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
16232,
17257,
3103,
2536,
2913,
22882,
7,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
17257,
3103,
2536,
2913,
5512,
198,
220,
220,
220,
7904,
6030,
90,
13739,
13434,
818,
43015,
5512,
198,
220,
220,
220,
7904,
6030,
90,
51,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
10482,
44815,
86,
4965,
13208,
5512,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
5868,
13,
23839,
13434,
17633,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
220,
220,
220,
779,
62,
17143,
7307,
3712,
33,
970,
11,
198,
220,
220,
220,
779,
62,
754,
40924,
3712,
33,
970,
11,
198,
8,
810,
1391,
51,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
1441,
16232,
17257,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2837,
62,
1102,
2536,
2913,
62,
16684,
796,
13667,
3103,
2536,
2913,
22882,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
3672,
796,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
14199,
13434,
818,
43015,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7885,
62,
3672,
796,
787,
62,
45286,
62,
3672,
7,
13739,
13434,
818,
43015,
11,
309,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9874,
62,
45286,
62,
14933,
796,
685,
15883,
62,
45286,
62,
3672,
7,
4965,
3760,
43015,
11,
309,
8,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7095,
62,
20786,
796,
2124,
4613,
6599,
56,
13,
1136,
62,
15414,
62,
5275,
62,
6477,
62,
49196,
7,
87,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
20786,
796,
11515,
62,
25202,
62,
325,
9383,
756,
259,
5623,
9521,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
7249,
796,
16232,
17257,
3103,
2536,
2913,
12360,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
437,
198,
198,
37811,
198,
1212,
2163,
6673,
262,
32242,
220,
1176,
7095,
286,
27298,
618,
612,
389,
35910,
434,
23907,
2977,
198,
37811,
198,
8818,
751,
62,
1102,
2536,
6003,
0,
7,
198,
220,
220,
220,
46231,
62,
34924,
3712,
3705,
2149,
756,
10613,
11,
198,
220,
220,
220,
7904,
6030,
90,
27,
25,
17257,
3103,
2536,
2913,
5512,
198,
220,
220,
220,
7904,
6030,
90,
3041,
5275,
13434,
43015,
5512,
198,
220,
220,
220,
4410,
3712,
1797,
13,
7414,
41769,
37787,
36918,
2848,
90,
1273,
5512,
198,
220,
220,
220,
2746,
3712,
24728,
17633,
90,
1273,
11,
360,
5512,
198,
220,
220,
220,
7904,
6030,
90,
50,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
8,
810,
1391,
1273,
1279,
25,
6599,
56,
13,
31425,
11,
360,
1279,
25,
27741,
31425,
8479,
1741,
11,
311,
1279,
25,
3122,
13,
23839,
13434,
17633,
92,
198,
220,
220,
220,
32315,
62,
10745,
418,
796,
20650,
90,
24728,
17257,
3103,
2536,
2913,
12360,
92,
7,
917,
891,
11,
4129,
7,
42034,
4008,
198,
220,
220,
220,
329,
357,
844,
11,
288,
8,
287,
27056,
378,
7,
42034,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
6599,
56,
13,
1136,
62,
3672,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
7095,
796,
6599,
56,
13,
1136,
62,
260,
5275,
62,
6477,
62,
49196,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
10745,
418,
58,
844,
60,
796,
16232,
17257,
3103,
2536,
2913,
12360,
7,
3672,
11,
7095,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
3335,
62,
9521,
0,
7,
198,
220,
220,
220,
220,
220,
220,
220,
46231,
62,
34924,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
22882,
37693,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
10745,
418,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
17257,
3103,
2536,
2913,
11,
797,
5275,
13434,
43015,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
45286,
62,
3672,
7,
3041,
5275,
13434,
43015,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
1441,
198,
437,
198,
198,
14468,
7804,
2235,
6889,
4238,
27617,
329,
257,
9104,
1303,
14468,
7804,
4242,
198,
8818,
4238,
62,
17561,
1756,
0,
7,
198,
220,
220,
220,
46231,
62,
34924,
3712,
3705,
2149,
756,
10613,
11,
198,
220,
220,
220,
4410,
3712,
1797,
13,
7414,
41769,
37787,
36918,
2848,
90,
1273,
5512,
198,
220,
220,
220,
7904,
6030,
90,
35,
5512,
198,
8,
810,
1391,
1273,
1279,
25,
6599,
56,
13,
31425,
11,
360,
1279,
25,
27741,
31425,
8479,
1741,
92,
198,
220,
220,
220,
6143,
62,
22554,
62,
15003,
7,
862,
72,
62,
34924,
11,
4410,
8,
198,
220,
220,
220,
1441,
198,
437,
198,
198,
14468,
7804,
4242,
6682,
29765,
1482,
2536,
6003,
29113,
4242,
198,
198,
8818,
2568,
62,
42404,
62,
1102,
2536,
6003,
0,
7,
198,
220,
220,
220,
46231,
62,
34924,
3712,
3705,
2149,
756,
10613,
11,
198,
220,
220,
220,
4410,
3712,
1797,
13,
7414,
41769,
37787,
36918,
2848,
90,
1273,
5512,
198,
220,
220,
220,
2746,
3712,
24728,
17633,
90,
1273,
11,
360,
5512,
198,
220,
220,
220,
7904,
6030,
90,
50,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
8,
810,
1391,
1273,
1279,
25,
6599,
56,
13,
31425,
11,
360,
1279,
25,
27741,
31425,
8479,
1741,
11,
311,
1279,
25,
3122,
13,
23839,
13434,
17633,
92,
198,
220,
220,
220,
32315,
62,
10745,
418,
796,
20650,
90,
24728,
17257,
3103,
2536,
2913,
12360,
92,
7,
917,
891,
11,
4129,
7,
42034,
4008,
198,
220,
220,
220,
329,
357,
844,
11,
288,
8,
287,
27056,
378,
7,
42034,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
6599,
56,
13,
1136,
62,
3672,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
7095,
796,
6599,
56,
13,
1136,
62,
5219,
62,
1659,
62,
10136,
62,
49196,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
10951,
796,
16232,
17257,
3103,
2536,
2913,
12360,
7,
3672,
11,
7095,
8,
198,
220,
220,
220,
220,
220,
220,
220,
751,
62,
25202,
62,
30416,
0,
7,
1102,
2536,
2913,
62,
10951,
11,
288,
11,
2746,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
10745,
418,
58,
844,
60,
796,
32315,
62,
10951,
198,
220,
220,
220,
886,
628,
220,
220,
220,
3335,
62,
9521,
0,
7,
198,
220,
220,
220,
220,
220,
220,
220,
46231,
62,
34924,
11,
198,
220,
220,
220,
220,
220,
220,
220,
13667,
3103,
2536,
2913,
22882,
37693,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32315,
62,
10745,
418,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
1677,
1137,
31212,
62,
33177,
2246,
9050,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
45286,
62,
3672,
7,
1677,
1137,
31212,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
1441,
198,
437,
198,
198,
14468,
7804,
4242,
1492,
5291,
17778,
1303,
29113,
4242,
2,
198,
198,
8818,
787,
62,
45888,
62,
7890,
7,
198,
220,
220,
220,
4410,
3712,
1797,
13,
7414,
41769,
37787,
36918,
2848,
90,
1273,
5512,
198,
8,
810,
1391,
1273,
1279,
25,
6599,
56,
13,
31425,
92,
198,
220,
220,
220,
3891,
796,
20650,
90,
10100,
92,
7,
917,
891,
11,
4129,
7,
42034,
4008,
198,
220,
220,
220,
287,
62,
448,
796,
20650,
90,
818,
7975,
92,
7,
917,
891,
11,
4129,
7,
42034,
4008,
628,
220,
220,
220,
329,
357,
844,
11,
288,
8,
287,
27056,
378,
7,
42034,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3891,
58,
844,
60,
796,
6599,
56,
13,
1136,
62,
3672,
7,
67,
8,
198,
220,
220,
220,
220,
220,
220,
220,
287,
62,
448,
58,
844,
60,
796,
6599,
56,
13,
1136,
62,
45888,
7,
67,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
3891,
11,
287,
62,
448,
198,
437,
198,
198,
8818,
2568,
62,
20427,
62,
1102,
2536,
2913,
0,
7,
198,
220,
220,
220,
46231,
62,
34924,
3712,
3705,
2149,
756,
10613,
11,
198,
220,
220,
220,
4410,
3712,
1797,
13,
7414,
41769,
37787,
36918,
2848,
90,
1273,
5512,
198,
220,
220,
220,
7904,
6030,
90,
35,
5512,
198,
220,
220,
220,
7904,
6030,
90,
50,
5512,
198,
220,
220,
220,
3745,
11813,
3712,
38176,
90,
18465,
11,
27741,
32,
4812,
18332,
39746,
5512,
198,
8,
810,
1391,
1273,
1279,
25,
6599,
56,
13,
31425,
11,
360,
1279,
25,
27741,
31425,
8479,
1741,
11,
311,
1279,
25,
3122,
13,
23839,
13434,
17633,
92,
198,
220,
220,
220,
9332,
62,
7890,
796,
787,
62,
45888,
62,
7890,
7,
42034,
8,
198,
220,
220,
220,
2568,
62,
20427,
7,
198,
220,
220,
220,
220,
220,
220,
220,
46231,
62,
34924,
11,
198,
220,
220,
220,
220,
220,
220,
220,
651,
62,
36733,
62,
17561,
1756,
7,
862,
72,
62,
34924,
11,
12460,
9218,
7,
28925,
4971,
11,
520,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
9332,
62,
7890,
11,
198,
220,
220,
220,
220,
220,
220,
220,
787,
62,
1102,
2536,
2913,
62,
3672,
7,
1677,
1137,
31212,
62,
43,
3955,
2043,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
45286,
62,
3672,
7,
10659,
9306,
62,
47,
36048,
62,
1268,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
45286,
62,
3672,
7,
10659,
9306,
62,
47,
36048,
62,
12425,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
787,
62,
45286,
62,
3672,
7,
1677,
1137,
31212,
11,
520,
828,
198,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
1441,
198,
437,
198
] | 2.432856 | 3,701 |
# This file is a part of Julia. License is MIT: https://julialang.org/license
# BEGIN 0.7 deprecations
# PR #22062
function set_remote_url(repo::LibGit2.GitRepo, url::AbstractString; remote::AbstractString="origin")
Base.depwarn(string(
"`LibGit2.set_remote_url(repo, url; remote=remote)` is deprecated, use ",
"`LibGit2.set_remote_url(repo, remote, url)` instead."), :set_remote_url)
set_remote_url(repo, remote, url)
end
function set_remote_url(path::AbstractString, url::AbstractString; remote::AbstractString="origin")
Base.depwarn(string(
"`LibGit2.set_remote_url(path, url; remote=remote)` is deprecated, use ",
"`LibGit2.set_remote_url(path, remote, url)` instead."), :set_remote_url)
set_remote_url(path, remote, url)
end
function prompt(msg::AbstractString; default::AbstractString="", password::Bool=false)
Base.depwarn(string(
"`LibGit2.prompt(msg::AbstractString; default::AbstractString=\"\", password::Bool=false)` is deprecated, use ",
"`result = Base.prompt(msg, default=default, password=password); result === nothing ? \"\" : result` instead."), :prompt)
coalesce(Base.prompt(msg, default=default, password=password), "")
end
# PR #26437
# when this deprecation is deleted, remove all calls to it, and remove the keyword of:
# `payload` from "src/LibGit2.jl"
function deprecate_payload_keyword(f, sig, payload)
if payload !== nothing
Base.depwarn(string(
"`LibGit2.$f($sig; payload=cred)` is deprecated, use ",
"`LibGit2.$f($sig; credentials=cred)` instead."), f)
end
end
@deprecate get_creds!(cache::CachedCredentials, credid, default) get!(cache, credid, default)
@eval Base @deprecate merge!(repo::$(GitRepo), args...; kwargs...) $(LibGit2.merge!)(repo, args...; kwargs...)
@eval Base @deprecate push!(w::$(GitRevWalker), arg) $(LibGit2.push!)(w, arg)
@eval Base @deprecate count(diff::$(GitDiff)) $(LibGit2.count)(diff)
@eval Base @deprecate count(idx::$(GitIndex)) $(LibGit2.count)(idx)
@eval Base @deprecate count(rb::$(GitRebase)) $(LibGit2.count)(rb)
@eval Base @deprecate count(tree::$(GitTree)) $(LibGit2.count)(tree)
@eval Base @deprecate count(f::Function, walker::$(GitRevWalker); kwargs...) $(LibGit2.count)(f, walker; kwargs...)
@eval Base @deprecate map(f::Function, walker::$(GitRevWalker); kwargs...) $(LibGit2.map)(f, walker; kwargs...)
# PR #24594
@deprecate AbstractCredentials AbstractCredential false
@deprecate UserPasswordCredentials UserPasswordCredential false
@deprecate SSHCredentials SSHCredential false
@deprecate hex(id::LibGit2.GitHash) string(id)
@deprecate hex(id::LibGit2.GitShortHash) string(id)
| [
2,
770,
2393,
318,
257,
636,
286,
22300,
13,
13789,
318,
17168,
25,
3740,
1378,
73,
377,
498,
648,
13,
2398,
14,
43085,
198,
198,
2,
347,
43312,
657,
13,
22,
1207,
8344,
602,
198,
198,
2,
4810,
1303,
17572,
5237,
198,
8818,
900,
62,
47960,
62,
6371,
7,
260,
7501,
3712,
25835,
38,
270,
17,
13,
38,
270,
6207,
78,
11,
19016,
3712,
23839,
10100,
26,
6569,
3712,
23839,
10100,
2625,
47103,
4943,
198,
220,
220,
220,
7308,
13,
10378,
40539,
7,
8841,
7,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
13,
2617,
62,
47960,
62,
6371,
7,
260,
7501,
11,
19016,
26,
6569,
28,
47960,
8,
63,
318,
39224,
11,
779,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
13,
2617,
62,
47960,
62,
6371,
7,
260,
7501,
11,
6569,
11,
19016,
8,
63,
2427,
526,
828,
1058,
2617,
62,
47960,
62,
6371,
8,
198,
220,
220,
220,
900,
62,
47960,
62,
6371,
7,
260,
7501,
11,
6569,
11,
19016,
8,
198,
437,
198,
198,
8818,
900,
62,
47960,
62,
6371,
7,
6978,
3712,
23839,
10100,
11,
19016,
3712,
23839,
10100,
26,
6569,
3712,
23839,
10100,
2625,
47103,
4943,
198,
220,
220,
220,
7308,
13,
10378,
40539,
7,
8841,
7,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
13,
2617,
62,
47960,
62,
6371,
7,
6978,
11,
19016,
26,
6569,
28,
47960,
8,
63,
318,
39224,
11,
779,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
13,
2617,
62,
47960,
62,
6371,
7,
6978,
11,
6569,
11,
19016,
8,
63,
2427,
526,
828,
1058,
2617,
62,
47960,
62,
6371,
8,
198,
220,
220,
220,
900,
62,
47960,
62,
6371,
7,
6978,
11,
6569,
11,
19016,
8,
198,
437,
198,
198,
8818,
6152,
7,
19662,
3712,
23839,
10100,
26,
4277,
3712,
23839,
10100,
2625,
1600,
9206,
3712,
33,
970,
28,
9562,
8,
198,
220,
220,
220,
7308,
13,
10378,
40539,
7,
8841,
7,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
13,
16963,
457,
7,
19662,
3712,
23839,
10100,
26,
4277,
3712,
23839,
10100,
17553,
34607,
9206,
3712,
33,
970,
28,
9562,
8,
63,
318,
39224,
11,
779,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
366,
63,
20274,
796,
7308,
13,
16963,
457,
7,
19662,
11,
4277,
28,
12286,
11,
9206,
28,
28712,
1776,
1255,
24844,
2147,
5633,
19990,
7879,
1058,
1255,
63,
2427,
526,
828,
1058,
16963,
457,
8,
198,
220,
220,
220,
46064,
344,
7,
14881,
13,
16963,
457,
7,
19662,
11,
4277,
28,
12286,
11,
9206,
28,
28712,
828,
366,
4943,
198,
437,
198,
198,
2,
4810,
1303,
18897,
2718,
198,
2,
618,
428,
1207,
8344,
341,
318,
13140,
11,
4781,
477,
3848,
284,
340,
11,
290,
4781,
262,
21179,
286,
25,
198,
2,
4600,
15577,
2220,
63,
422,
366,
10677,
14,
25835,
38,
270,
17,
13,
20362,
1,
198,
8818,
1207,
8344,
378,
62,
15577,
2220,
62,
2539,
4775,
7,
69,
11,
43237,
11,
21437,
8,
198,
220,
220,
220,
611,
21437,
5145,
855,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
7308,
13,
10378,
40539,
7,
8841,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
48082,
69,
16763,
82,
328,
26,
21437,
28,
66,
445,
8,
63,
318,
39224,
11,
779,
33172,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
63,
25835,
38,
270,
17,
48082,
69,
16763,
82,
328,
26,
18031,
28,
66,
445,
8,
63,
2427,
526,
828,
277,
8,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
10378,
8344,
378,
651,
62,
66,
445,
82,
0,
7,
23870,
3712,
34,
2317,
34,
445,
14817,
11,
2600,
312,
11,
4277,
8,
651,
0,
7,
23870,
11,
2600,
312,
11,
4277,
8,
198,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
20121,
0,
7,
260,
7501,
3712,
3,
7,
38,
270,
6207,
78,
828,
26498,
986,
26,
479,
86,
22046,
23029,
29568,
25835,
38,
270,
17,
13,
647,
469,
0,
5769,
260,
7501,
11,
26498,
986,
26,
479,
86,
22046,
23029,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
4574,
0,
7,
86,
3712,
3,
7,
38,
270,
18009,
39950,
828,
1822,
8,
29568,
25835,
38,
270,
17,
13,
14689,
0,
5769,
86,
11,
1822,
8,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
954,
7,
26069,
3712,
3,
7,
38,
270,
28813,
4008,
29568,
25835,
38,
270,
17,
13,
9127,
5769,
26069,
8,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
954,
7,
312,
87,
3712,
3,
7,
38,
270,
15732,
4008,
29568,
25835,
38,
270,
17,
13,
9127,
5769,
312,
87,
8,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
954,
7,
26145,
3712,
3,
7,
38,
270,
28951,
589,
4008,
29568,
25835,
38,
270,
17,
13,
9127,
5769,
26145,
8,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
954,
7,
21048,
3712,
3,
7,
38,
270,
27660,
4008,
29568,
25835,
38,
270,
17,
13,
9127,
5769,
21048,
8,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
954,
7,
69,
3712,
22203,
11,
2513,
263,
3712,
3,
7,
38,
270,
18009,
39950,
1776,
479,
86,
22046,
23029,
29568,
25835,
38,
270,
17,
13,
9127,
5769,
69,
11,
2513,
263,
26,
479,
86,
22046,
23029,
198,
31,
18206,
7308,
2488,
10378,
8344,
378,
3975,
7,
69,
3712,
22203,
11,
2513,
263,
3712,
3,
7,
38,
270,
18009,
39950,
1776,
479,
86,
22046,
23029,
29568,
25835,
38,
270,
17,
13,
8899,
5769,
69,
11,
2513,
263,
26,
479,
86,
22046,
23029,
198,
198,
2,
4810,
1303,
1731,
46438,
198,
31,
10378,
8344,
378,
27741,
34,
445,
14817,
27741,
34,
445,
1843,
3991,
198,
31,
10378,
8344,
378,
11787,
35215,
34,
445,
14817,
11787,
35215,
34,
445,
1843,
3991,
198,
31,
10378,
8344,
378,
6723,
16045,
445,
14817,
6723,
16045,
445,
1843,
3991,
198,
198,
31,
10378,
8344,
378,
17910,
7,
312,
3712,
25835,
38,
270,
17,
13,
38,
270,
26257,
8,
220,
220,
220,
220,
220,
4731,
7,
312,
8,
198,
31,
10378,
8344,
378,
17910,
7,
312,
3712,
25835,
38,
270,
17,
13,
38,
270,
16438,
26257,
8,
4731,
7,
312,
8,
198
] | 2.561722 | 1,045 |
using DrWatson
@quickactivate :TimeProbeSeismic
close("all")
ee = (0, .8*25, .206*25, 0)
n, d, m, m0 = h5read(datadir("models", "overthrust_model.h5"), "n", "d", "m", "m0")
m0[:, 20:end] = imfilter(m0[:, 20:end] ,Kernel.gaussian(5));
n = Tuple(n)
d = Tuple(d)
vp_t = m'.^(-.5);
vp_0 = m0'.^(-.5);
inds = Dict(j=>i for (i,j)=enumerate([2^k for k=1:8]))
plt_dict = (cmap=:gist_ncar, vmin=1.5, vmax=6.0, extent=ee, aspect=:auto)
files = readdir(datadir("fwi_overthrust"))
dfts = [f for f=files if occursin("dft", f)]
probed = [f for f=files if occursin("ps", f)]
trinds = [200, 480, 680]
# True and initial model
figure(figsize=(12, 9))
subplot(2,1,1)
imshow(vp_t; plt_dict...)
# title("True")
xlabel("X (km)")
ylabel("Depth (km)")
vlines(x=[t*d[1]/1000 for t=trinds], colors=:k, ymin=0, ymax=ee[3])
subplot(2,1,2)
imshow(vp_0; plt_dict...)
# title("Initial")
xlabel("X (km)")
ylabel("Depth (km)")
tight_layout()
wsave(plotsdir("fwi_overthrust", "Init.png"), gcf())
# Load true
res = wload(datadir("fwi_overthrust", "fwi_std.bson"))
vp_std = reshape(res[:x], n)'.^(-.5)
ϕ_std = res[:ϕ_trace]
# DFT
ϕ_dft = Array{Any}(undef, 8)
vp_dft = Array{Any}(undef, 8)
figure(figsize=(12, 9))
subplot(3,3,1)
imshow(vp_std; plt_dict...)
title("FWI")
xlabel("X (km)")
ylabel("Depth (km)")
for f in dfts
res = wload(datadir("fwi_overthrust", f))
num = parse(Int, split(split(f, "_")[2], ".")[1][4:end])
vp_dft[inds[num]] = reshape(res[:x], n)'.^(-.5)
subplot(3, 3, inds[num]+1)
imshow(vp_dft[inds[num]]; plt_dict...)
title("OTDFT $(num)")
xlabel("X (km)")
ylabel("Depth (km)")
ϕ_dft[inds[num]] = res[:ϕ_trace]
end
tight_layout()
wsave(plotsdir("fwi_overthrust", "DFT_fwi.png"), gcf())
# probed
ϕ_ps = Array{Any}(undef, 8)
vp_ps = Array{Any}(undef, 8)
figure(figsize=(12, 9))
subplot(3,3,1)
imshow(vp_std; plt_dict...)
title("Standard")
xlabel("X (km)")
ylabel("Depth (km)")
for f in probed
res = wload(datadir("fwi_overthrust", f))
num = parse(Int, split(split(f, "_")[2], ".")[1][3:end])
vp_ps[inds[num]] = reshape(res[:x], n)'.^(-.5)
subplot(3, 3, inds[num]+1)
imshow(vp_ps[inds[num]]; plt_dict...)
title("PFWI $(num)")
xlabel("X (km)")
ylabel("Depth (km)")
ϕ_ps[inds[num]] = res[:ϕ_trace]
end
tight_layout()
wsave(plotsdir("fwi_overthrust", "probed_fwi.png"), gcf())
# Traces
depth = range(0, ee[3], length=n[2])
for t in trinds
fig, axs = subplots(nrows=2, ncols=4, figsize=(9, 5), sharex=true, sharey=true)
fig.subplots_adjust(wspace=0, hspace=0)
for i=1:8
axs[i].plot(vp_t[:, t], depth, label="True")
axs[i].plot(vp_std[:, t], depth, label="FWI")
axs[i].plot(vp_ps[i][:, t], depth, label="PFWI $(2^i)")
axs[i].plot(vp_dft[i][:, t], depth, label="OTDFT $(2^i)")
axs[i].set_ylim(depth[end], depth[1])
axs[i].legend(loc="lower left")
i%2 == 0 && axs[i].set_xlabel(L"$V_p$")
i < 3 && axs[i].set_ylabel("Depth (km)")
end
title("X=$((t-1)*25/1000) km")
# tight_layout()
wsave(plotsdir("fwi_overthrust", "vertical_trace_$(t).png"), gcf())
end
for t in trinds
fig, axs = subplots(nrows=1, ncols=3, figsize=(12, 9), sharey=true)
fig.subplots_adjust(wspace=0)
for (n,i)=enumerate([1, 4, 5])
axs[n].plot(vp_t[:, t], depth, label="True")
axs[n].plot(vp_std[:, t], depth, label="FWI")
axs[n].plot(vp_ps[i][:, t], depth, label="PFWI $(2^i)")
axs[n].plot(vp_dft[i][:, t], depth, label="OTDFT $(2^i)")
axs[n].set_ylim(depth[end], depth[1])
axs[n].legend(loc="lower left")
n==1 && axs[n].set_ylabel("Depth (km)")
n==2 && axs[n].set_xlabel(L"$V_p$")
n==2 && axs[n].set_title("X=$((t-1)*25/1000) km")
end
# tight_layout()
wsave(plotsdir("fwi_overthrust", "vertical_trace_$(t)_select.png"), gcf())
end
# Convergence
cols = ["b", "r", "y", "c", "g", "m", :lime, :indigo]
figure(figsize=(12, 9))
for i=1:8
plot(ϕ_ps[i]/ϕ_ps[i][1], color=cols[i], linestyle=:dashed, marker="o", label="PFWI $(2^i)")
end
plot(ϕ_std/ϕ_std[1], label="STD")
for i=1:8
plot(ϕ_dft[i]/ϕ_dft[i][1], color=cols[i], linestyle=:dashed, marker="^", label="OTDFT $(2^i)")
end
legend(loc="upper right", ncol=2)
xlabel("Iteration")
ylabel("Normalized objective")
wsave(plotsdir("fwi_overthrust", "convergence.png"), gcf())
# FWI plot for SEG abstract
figure(figsize=(12, 9))
subplot(3,3,1)
imshow(vp_t; plt_dict...)
title("True")
xlabel("X (km)")
ylabel("Depth (km)")
vlines(x=[t*d[1]/1000 for t=trinds], colors=:k, ymin=0, ymax=ee[3])
subplot(3,3,2)
imshow(vp_0; plt_dict...)
title("Initial")
xlabel("X (km)")
ylabel("Depth (km)")
subplot(3,3,3)
imshow(vp_std; plt_dict...)
title("FWI")
xlabel("X (km)")
ylabel("Depth (km)")
for (j, ps)=zip([4,5,6], [4, 16, 64])
i = inds[ps]
subplot(3, 3, j)
imshow(vp_ps[i]; plt_dict...)
title("PFWI $(ps)")
xlabel("X (km)")
ylabel("Depth (km)")
subplot(3, 3, j+3)
imshow(vp_dft[i]; plt_dict...)
title("OTDFT $(ps)")
xlabel("X (km)")
ylabel("Depth (km)")
end
tight_layout()
wsave(plotsdir("fwi_overthrust", "probed_vs_dft.png"), gcf())
| [
3500,
1583,
54,
13506,
198,
31,
24209,
39022,
1058,
7575,
2964,
1350,
4653,
1042,
291,
198,
198,
19836,
7203,
439,
4943,
198,
1453,
796,
357,
15,
11,
764,
23,
9,
1495,
11,
764,
22136,
9,
1495,
11,
657,
8,
198,
198,
77,
11,
288,
11,
285,
11,
285,
15,
796,
289,
20,
961,
7,
19608,
324,
343,
7203,
27530,
1600,
366,
2502,
400,
11469,
62,
19849,
13,
71,
20,
12340,
366,
77,
1600,
366,
67,
1600,
366,
76,
1600,
366,
76,
15,
4943,
198,
76,
15,
58,
45299,
1160,
25,
437,
60,
796,
545,
24455,
7,
76,
15,
58,
45299,
1160,
25,
437,
60,
837,
42,
7948,
13,
4908,
31562,
7,
20,
18125,
198,
77,
796,
309,
29291,
7,
77,
8,
198,
67,
796,
309,
29291,
7,
67,
8,
198,
36133,
62,
83,
796,
285,
4458,
61,
32590,
13,
20,
1776,
198,
36133,
62,
15,
796,
285,
15,
4458,
61,
32590,
13,
20,
1776,
198,
198,
521,
82,
796,
360,
713,
7,
73,
14804,
72,
329,
357,
72,
11,
73,
47505,
268,
6975,
378,
26933,
17,
61,
74,
329,
479,
28,
16,
25,
23,
60,
4008,
198,
198,
489,
83,
62,
11600,
796,
357,
66,
8899,
28,
25,
70,
396,
62,
77,
7718,
11,
410,
1084,
28,
16,
13,
20,
11,
410,
9806,
28,
21,
13,
15,
11,
6287,
28,
1453,
11,
4843,
28,
25,
23736,
8,
198,
198,
16624,
796,
1100,
15908,
7,
19608,
324,
343,
7203,
69,
37686,
62,
2502,
400,
11469,
48774,
198,
198,
67,
35594,
796,
685,
69,
329,
277,
28,
16624,
611,
8833,
259,
7203,
67,
701,
1600,
277,
15437,
198,
1676,
3077,
796,
685,
69,
329,
277,
28,
16624,
611,
8833,
259,
7203,
862,
1600,
277,
15437,
198,
198,
2213,
521,
82,
796,
685,
2167,
11,
23487,
11,
40554,
60,
198,
2,
6407,
290,
4238,
2746,
198,
26875,
7,
5647,
7857,
16193,
1065,
11,
860,
4008,
198,
7266,
29487,
7,
17,
11,
16,
11,
16,
8,
198,
320,
12860,
7,
36133,
62,
83,
26,
458,
83,
62,
11600,
23029,
198,
2,
3670,
7203,
17821,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
85,
6615,
7,
87,
41888,
83,
9,
67,
58,
16,
60,
14,
12825,
329,
256,
28,
2213,
521,
82,
4357,
7577,
28,
25,
74,
11,
331,
1084,
28,
15,
11,
331,
9806,
28,
1453,
58,
18,
12962,
198,
7266,
29487,
7,
17,
11,
16,
11,
17,
8,
198,
320,
12860,
7,
36133,
62,
15,
26,
458,
83,
62,
11600,
23029,
198,
2,
3670,
7203,
24243,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
33464,
62,
39786,
3419,
198,
18504,
1015,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
31768,
13,
11134,
12340,
308,
12993,
28955,
198,
198,
2,
8778,
2081,
198,
411,
796,
266,
2220,
7,
19608,
324,
343,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
69,
37686,
62,
19282,
13,
1443,
261,
48774,
198,
36133,
62,
19282,
796,
27179,
1758,
7,
411,
58,
25,
87,
4357,
299,
8,
4458,
61,
32590,
13,
20,
8,
198,
139,
243,
62,
19282,
796,
581,
58,
25,
139,
243,
62,
40546,
60,
198,
198,
2,
360,
9792,
220,
198,
139,
243,
62,
67,
701,
796,
15690,
90,
7149,
92,
7,
917,
891,
11,
807,
8,
198,
36133,
62,
67,
701,
796,
15690,
90,
7149,
92,
7,
917,
891,
11,
807,
8,
198,
26875,
7,
5647,
7857,
16193,
1065,
11,
860,
4008,
198,
7266,
29487,
7,
18,
11,
18,
11,
16,
8,
198,
320,
12860,
7,
36133,
62,
19282,
26,
458,
83,
62,
11600,
23029,
198,
7839,
7203,
24160,
40,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
1640,
277,
287,
288,
35594,
198,
220,
220,
220,
581,
796,
266,
2220,
7,
19608,
324,
343,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
277,
4008,
198,
220,
220,
220,
997,
796,
21136,
7,
5317,
11,
6626,
7,
35312,
7,
69,
11,
45434,
4943,
58,
17,
4357,
366,
19570,
58,
16,
7131,
19,
25,
437,
12962,
198,
220,
220,
220,
410,
79,
62,
67,
701,
58,
521,
82,
58,
22510,
11907,
796,
27179,
1758,
7,
411,
58,
25,
87,
4357,
299,
8,
4458,
61,
32590,
13,
20,
8,
198,
220,
220,
220,
850,
29487,
7,
18,
11,
513,
11,
773,
82,
58,
22510,
48688,
16,
8,
198,
220,
220,
220,
545,
12860,
7,
36133,
62,
67,
701,
58,
521,
82,
58,
22510,
60,
11208,
458,
83,
62,
11600,
23029,
198,
220,
220,
220,
3670,
7203,
2394,
8068,
51,
29568,
22510,
8,
4943,
198,
220,
220,
220,
2124,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
220,
220,
220,
331,
18242,
7203,
48791,
357,
13276,
8,
4943,
198,
220,
220,
220,
18074,
243,
62,
67,
701,
58,
521,
82,
58,
22510,
11907,
796,
581,
58,
25,
139,
243,
62,
40546,
60,
198,
437,
198,
33464,
62,
39786,
3419,
198,
18504,
1015,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
8068,
51,
62,
69,
37686,
13,
11134,
12340,
308,
12993,
28955,
198,
198,
2,
1861,
276,
198,
139,
243,
62,
862,
796,
15690,
90,
7149,
92,
7,
917,
891,
11,
807,
8,
198,
36133,
62,
862,
796,
15690,
90,
7149,
92,
7,
917,
891,
11,
807,
8,
198,
26875,
7,
5647,
7857,
16193,
1065,
11,
860,
4008,
198,
7266,
29487,
7,
18,
11,
18,
11,
16,
8,
198,
320,
12860,
7,
36133,
62,
19282,
26,
458,
83,
62,
11600,
23029,
198,
7839,
7203,
23615,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
1640,
277,
287,
1861,
276,
198,
220,
220,
220,
581,
796,
266,
2220,
7,
19608,
324,
343,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
277,
4008,
198,
220,
220,
220,
997,
796,
21136,
7,
5317,
11,
6626,
7,
35312,
7,
69,
11,
45434,
4943,
58,
17,
4357,
366,
19570,
58,
16,
7131,
18,
25,
437,
12962,
198,
220,
220,
220,
410,
79,
62,
862,
58,
521,
82,
58,
22510,
11907,
796,
27179,
1758,
7,
411,
58,
25,
87,
4357,
299,
8,
4458,
61,
32590,
13,
20,
8,
198,
220,
220,
220,
850,
29487,
7,
18,
11,
513,
11,
773,
82,
58,
22510,
48688,
16,
8,
198,
220,
220,
220,
545,
12860,
7,
36133,
62,
862,
58,
521,
82,
58,
22510,
60,
11208,
458,
83,
62,
11600,
23029,
198,
220,
220,
220,
3670,
7203,
47,
24160,
40,
29568,
22510,
8,
4943,
198,
220,
220,
220,
2124,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
220,
220,
220,
331,
18242,
7203,
48791,
357,
13276,
8,
4943,
198,
220,
220,
220,
18074,
243,
62,
862,
58,
521,
82,
58,
22510,
11907,
796,
581,
58,
25,
139,
243,
62,
40546,
60,
198,
437,
198,
33464,
62,
39786,
3419,
198,
18504,
1015,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
1676,
3077,
62,
69,
37686,
13,
11134,
12340,
308,
12993,
28955,
198,
2,
833,
2114,
198,
198,
18053,
796,
2837,
7,
15,
11,
304,
68,
58,
18,
4357,
4129,
28,
77,
58,
17,
12962,
198,
198,
1640,
256,
287,
491,
521,
82,
198,
220,
220,
220,
2336,
11,
7877,
82,
796,
850,
489,
1747,
7,
77,
8516,
28,
17,
11,
299,
4033,
82,
28,
19,
11,
2336,
7857,
16193,
24,
11,
642,
828,
2648,
87,
28,
7942,
11,
2648,
88,
28,
7942,
8,
198,
220,
220,
220,
2336,
13,
7266,
489,
1747,
62,
23032,
7,
86,
13200,
28,
15,
11,
289,
13200,
28,
15,
8,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
23,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
29487,
7,
36133,
62,
83,
58,
45299,
256,
4357,
6795,
11,
6167,
2625,
17821,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
29487,
7,
36133,
62,
19282,
58,
45299,
256,
4357,
6795,
11,
6167,
2625,
24160,
40,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
29487,
7,
36133,
62,
862,
58,
72,
7131,
45299,
256,
4357,
6795,
11,
6167,
2625,
47,
24160,
40,
29568,
17,
61,
72,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
29487,
7,
36133,
62,
67,
701,
58,
72,
7131,
45299,
256,
4357,
6795,
11,
6167,
2625,
2394,
8068,
51,
29568,
17,
61,
72,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
2617,
62,
88,
2475,
7,
18053,
58,
437,
4357,
6795,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
72,
4083,
1455,
437,
7,
17946,
2625,
21037,
1364,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
4,
17,
6624,
657,
11405,
7877,
82,
58,
72,
4083,
2617,
62,
87,
18242,
7,
43,
1,
3,
53,
62,
79,
3,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
1279,
513,
11405,
7877,
82,
58,
72,
4083,
2617,
62,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
3670,
7203,
55,
43641,
19510,
83,
12,
16,
27493,
1495,
14,
12825,
8,
10571,
4943,
198,
220,
220,
220,
1303,
5381,
62,
39786,
3419,
198,
220,
220,
220,
266,
21928,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
1851,
605,
62,
40546,
62,
3,
7,
83,
737,
11134,
12340,
308,
12993,
28955,
198,
437,
198,
198,
1640,
256,
287,
491,
521,
82,
198,
220,
220,
220,
2336,
11,
7877,
82,
796,
850,
489,
1747,
7,
77,
8516,
28,
16,
11,
299,
4033,
82,
28,
18,
11,
2336,
7857,
16193,
1065,
11,
860,
828,
2648,
88,
28,
7942,
8,
198,
220,
220,
220,
2336,
13,
7266,
489,
1747,
62,
23032,
7,
86,
13200,
28,
15,
8,
198,
220,
220,
220,
329,
357,
77,
11,
72,
47505,
268,
6975,
378,
26933,
16,
11,
604,
11,
642,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
29487,
7,
36133,
62,
83,
58,
45299,
256,
4357,
6795,
11,
6167,
2625,
17821,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
29487,
7,
36133,
62,
19282,
58,
45299,
256,
4357,
6795,
11,
6167,
2625,
24160,
40,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
29487,
7,
36133,
62,
862,
58,
72,
7131,
45299,
256,
4357,
6795,
11,
6167,
2625,
47,
24160,
40,
29568,
17,
61,
72,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
29487,
7,
36133,
62,
67,
701,
58,
72,
7131,
45299,
256,
4357,
6795,
11,
6167,
2625,
2394,
8068,
51,
29568,
17,
61,
72,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
2617,
62,
88,
2475,
7,
18053,
58,
437,
4357,
6795,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
7877,
82,
58,
77,
4083,
1455,
437,
7,
17946,
2625,
21037,
1364,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
299,
855,
16,
11405,
7877,
82,
58,
77,
4083,
2617,
62,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
299,
855,
17,
11405,
7877,
82,
58,
77,
4083,
2617,
62,
87,
18242,
7,
43,
1,
3,
53,
62,
79,
3,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
299,
855,
17,
11405,
7877,
82,
58,
77,
4083,
2617,
62,
7839,
7203,
55,
43641,
19510,
83,
12,
16,
27493,
1495,
14,
12825,
8,
10571,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1303,
5381,
62,
39786,
3419,
198,
220,
220,
220,
266,
21928,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
1851,
605,
62,
40546,
62,
3,
7,
83,
8,
62,
19738,
13,
11134,
12340,
308,
12993,
28955,
198,
437,
198,
198,
2,
35602,
12745,
198,
4033,
82,
796,
14631,
65,
1600,
366,
81,
1600,
366,
88,
1600,
366,
66,
1600,
366,
70,
1600,
366,
76,
1600,
1058,
27299,
11,
1058,
521,
14031,
60,
198,
198,
26875,
7,
5647,
7857,
16193,
1065,
11,
860,
4008,
198,
1640,
1312,
28,
16,
25,
23,
198,
220,
220,
220,
7110,
7,
139,
243,
62,
862,
58,
72,
60,
14,
139,
243,
62,
862,
58,
72,
7131,
16,
4357,
3124,
28,
4033,
82,
58,
72,
4357,
9493,
10992,
28,
25,
67,
5263,
11,
18364,
2625,
78,
1600,
6167,
2625,
47,
24160,
40,
29568,
17,
61,
72,
8,
4943,
198,
437,
198,
29487,
7,
139,
243,
62,
19282,
14,
139,
243,
62,
19282,
58,
16,
4357,
6167,
2625,
32147,
4943,
198,
1640,
1312,
28,
16,
25,
23,
198,
220,
220,
220,
7110,
7,
139,
243,
62,
67,
701,
58,
72,
60,
14,
139,
243,
62,
67,
701,
58,
72,
7131,
16,
4357,
3124,
28,
4033,
82,
58,
72,
4357,
9493,
10992,
28,
25,
67,
5263,
11,
18364,
2625,
61,
1600,
6167,
2625,
2394,
8068,
51,
29568,
17,
61,
72,
8,
4943,
198,
437,
198,
1455,
437,
7,
17946,
2625,
45828,
826,
1600,
299,
4033,
28,
17,
8,
198,
87,
18242,
7203,
29993,
341,
4943,
198,
2645,
9608,
7203,
26447,
1143,
9432,
4943,
198,
198,
18504,
1015,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
1102,
332,
12745,
13,
11134,
12340,
308,
12993,
28955,
628,
198,
2,
376,
36326,
7110,
329,
311,
7156,
12531,
198,
26875,
7,
5647,
7857,
16193,
1065,
11,
860,
4008,
198,
198,
7266,
29487,
7,
18,
11,
18,
11,
16,
8,
198,
320,
12860,
7,
36133,
62,
83,
26,
458,
83,
62,
11600,
23029,
198,
7839,
7203,
17821,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
85,
6615,
7,
87,
41888,
83,
9,
67,
58,
16,
60,
14,
12825,
329,
256,
28,
2213,
521,
82,
4357,
7577,
28,
25,
74,
11,
331,
1084,
28,
15,
11,
331,
9806,
28,
1453,
58,
18,
12962,
198,
198,
7266,
29487,
7,
18,
11,
18,
11,
17,
8,
198,
320,
12860,
7,
36133,
62,
15,
26,
458,
83,
62,
11600,
23029,
198,
7839,
7203,
24243,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
198,
7266,
29487,
7,
18,
11,
18,
11,
18,
8,
198,
320,
12860,
7,
36133,
62,
19282,
26,
458,
83,
62,
11600,
23029,
198,
7839,
7203,
24160,
40,
4943,
198,
87,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
2645,
9608,
7203,
48791,
357,
13276,
8,
4943,
198,
198,
1640,
357,
73,
11,
26692,
47505,
13344,
26933,
19,
11,
20,
11,
21,
4357,
685,
19,
11,
1467,
11,
5598,
12962,
198,
220,
220,
220,
1312,
796,
773,
82,
58,
862,
60,
198,
220,
220,
220,
850,
29487,
7,
18,
11,
513,
11,
474,
8,
198,
220,
220,
220,
545,
12860,
7,
36133,
62,
862,
58,
72,
11208,
458,
83,
62,
11600,
23029,
198,
220,
220,
220,
3670,
7203,
47,
24160,
40,
29568,
862,
8,
4943,
198,
220,
220,
220,
2124,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
220,
220,
220,
331,
18242,
7203,
48791,
357,
13276,
8,
4943,
628,
220,
220,
220,
850,
29487,
7,
18,
11,
513,
11,
474,
10,
18,
8,
198,
220,
220,
220,
545,
12860,
7,
36133,
62,
67,
701,
58,
72,
11208,
458,
83,
62,
11600,
23029,
198,
220,
220,
220,
3670,
7203,
2394,
8068,
51,
29568,
862,
8,
4943,
198,
220,
220,
220,
2124,
18242,
7203,
55,
357,
13276,
8,
4943,
198,
220,
220,
220,
331,
18242,
7203,
48791,
357,
13276,
8,
4943,
198,
437,
198,
33464,
62,
39786,
3419,
628,
198,
18504,
1015,
7,
489,
1747,
15908,
7203,
69,
37686,
62,
2502,
400,
11469,
1600,
366,
1676,
3077,
62,
14259,
62,
67,
701,
13,
11134,
12340,
308,
12993,
28955,
198
] | 1.946631 | 2,642 |
function standard_normal_gausshermite(n::Int)
ϵᵢ, wᵢ = gausshermite(n) # approximates exp(-x²)
ϵᵢ .*= sqrt(2.) # Normalize ϵᵢ and wᵢ nodes to approximate standard normal
wᵢ ./= sqrt(π)
return ϵᵢ, wᵢ
end
"""
```
gausshermite_expectation(f, μ, σ, n = 10)
gausshermite_expectation(f, μ, Σ, n = 10)
gausshermite_expectation(f, μ, Σ, ns)
```
calculates the expectation of a function of a Gaussian random variable/vector.
The first method evalulates ``\\mathbb{E}[f(X)]`` where ``X \\sim N(\\mu, \\sigma)``,
while the other two methods evaluate ``\\mathbb{E}[f(X)]`` where
``X \\sim \\mathcal{N}(\\mu, \\Sigma)`` and ``\\Sigma`` is diagonal.
The latter two methods differ in that the first assumes the same number of
quadrature points in every dimension while the second does not.
### Inputs
- `f::Function`: some function of a random variable. If `f(x) = x`, then
`gausshermite_expectation(f, μ, σ)` calculates the mean of ``N(\\mu, \\sigma)``
using 10-point Gauss-Hermite quadrature.
- `μ::Number` or `μ::AbstractVector`: mean of the Gaussian random variable/vector.
- `σ::Number`: standard deviation of the Gaussian random variable.
- `Σ::AbstractVector`: diagonal of the variance-covariance matrix of
the Gaussian random vector.
- `n::Int`: number of quadrature points to use
- `ns::AbstractVector{Int}` or `ns::NTuple{N, Int} where N`: number of quadrature points to use
in each dimension of the Gaussian random vector.
"""
function gausshermite_expectation(f::Function, μ::Number, σ::Number, n::Int = 10)
ϵᵢ, wᵢ = gausshermite(n)
ϵᵢ .*= sqrt(2.) # Normalize ϵᵢ and wᵢ nodes to approximate standard normal
# wᵢ ./= sqrt(π) # This step done later to reduce number of computations
if μ ≈ 0.
return sum([wᵢ[i] * f(ϵᵢ[i] * σ) for i in 1:n]) / sqrt(π)
else
return sum([wᵢ[i] * f(ϵᵢ[i] * σ + μ) for i in 1:n]) / sqrt(π)
end
end
function gausshermite_expectation(f::Function, μ::AbstractVector{S},
Σ::AbstractVector{<: Number}, n::Int = 10) where {S <: Number}
d = length(μ)
@assert length(Σ) == d "The length of μ and Σ must be the same."
ϵ, w = gausshermite(n)
ϵ .*= sqrt(2.) # Normalize ϵ and w nodes to approximate standard normal
# w ./= sqrt(π) # This step done later to reduce number of computations
# Evaluate over the tensor grid
feval = Array{S}(undef, (n for i in 1:d)...)
allCI = CartesianIndices(feval)
if all(μ .≈ 0.)
@simd for CI in allCI
feval[CI] = f([ϵ[i] for i in Tuple(CI)] .* Σ)
end
else
@simd for CI in allCI
feval[CI] = f([ϵ[i] for i in Tuple(CI)] .* Σ + μ)
end
end
for n_dim in 1:(d - 1)
# Iteratively integrate out each dimension, i.e. law of iterated expectations
iter = CartesianIndices(tuple(Tuple(1:n for i in 1:(d - n_dim))...,
Tuple(1:1 for i in 1:n_dim)...)) # Create CartesianIndices for all remaining dimensions
# ((1:n for i in 1:(d - n_dim + 1))..., (1 for i in 1:(n_dim - 1))...) creates a Tuple of 1:n for the dimensions
# that are not to be integrated out and uses 1s for the remaining dimensions. We want to use each dimension of feval
# from 1 to (d - n_dim) (inclusive). So on the first iteration, the tuple should be (1:n, 1:n).
# We then assign it to the dimensions of feval from 1 to (d - n_dim - 1) (inclusive) to avoid allocations
feval[iter] .= dropdims(sum(mapslices(fᵢ -> fᵢ .* w, (@view feval[((1:n for i in 1:(d - n_dim + 1))...,
(1 for i in 1:(n_dim - 1))...)...]),
dims = (d - n_dim) + 1), dims = (d - n_dim) + 1), dims = (d - n_dim) + 1)
end
# Handle final integration on its own
return sum(w .* (@view feval[:, (1 for i in 1:(d - 1))...])) / π^(d / 2)
end
function gausshermite_expectation(f::Function, μ::AbstractVector{S},
Σ::AbstractVector{<: Number}, ns::AbstractVector{Int}) where {S <: Number}
d = length(μ)
@assert length(Σ) == d "The length of μ and Σ must be the same."
ϵ = Dict{Int, Vector{S}}()
w = Dict{Int, Vector{S}}()
for i in 1:d
ϵ[i], w[i] = gausshermite(ns[i])
ϵ[i] .*= sqrt(2.) # Normalize ϵ and w nodes to approximate standard normal
# w[i] ./= sqrt(π) # This step done later to reduce number of computations
end
# Evaluate over the tensor grid
feval = Array{S}(undef, (n for n in ns)...)
allCI = CartesianIndices(feval)
if all(μ .≈ 0.)
@simd for CI in allCI
feval[CI] = f([ϵ[n_dim][gridᵢ] for (n_dim, gridᵢ) in enumerate(Tuple(CI))] .* Σ)
end
else
@simd for CI in allCI
feval[CI] = f([ϵ[n_dim][gridᵢ] for (n_dim, gridᵢ) in enumerate(Tuple(CI))] .* Σ + μ)
end
end
# Iteratively integrate out each dimension, i.e. law of iterated expectations
for n_dim in 1:(d - 1)
iter = CartesianIndices(tuple(Tuple(1:ns[i] for i in 1:(d - n_dim))...,
Tuple(1:1 for i in 1:n_dim)...))
feval[iter, 1] .= dropdims(sum(mapslices(fᵢ -> fᵢ .* w[d - n_dim + 1], (@view feval[((1:ns[i] for i in 1:(d - n_dim + 1))...,
(1 for i in 1:(n_dim - 1))...)...]),
dims = (d - n_dim) + 1), dims = (d - n_dim) + 1), dims = (d - n_dim) + 1)
end
# Handle final integration on its own
return sum(w[1] .* (@view feval[:, (1 for i in 1:(d - 1))...])) / π^(d / 2)
end
function gausshermite_expectation(f::Function, μ::AbstractVector{S},
Σ::AbstractVector{<: Number}, ns::NTuple{N, Int}) where {S<: Number, N}
d = length(μ)
@assert length(Σ) == d "The length of μ and Σ must be the same."
ϵ = Dict{Int, Vector{S}}()
w = Dict{Int, Vector{S}}()
for i in 1:d
ϵ[i], w[i] = gausshermite(ns[i])
ϵ[i] .*= sqrt(2.) # Normalize ϵ and w nodes to approximate standard normal
# w[i] ./= sqrt(π) # This step done later to reduce number of computations
end
# Evaluate over the tensor grid
feval = Array{S}(undef, (n for n in ns)...)
allCI = CartesianIndices(feval)
if all(μ .≈ 0.)
@simd for CI in allCI
feval[CI] = f([ϵ[n_dim][gridᵢ] for (n_dim, gridᵢ) in enumerate(Tuple(CI))] .* Σ)
end
else
@simd for CI in allCI
feval[CI] = f([ϵ[n_dim][gridᵢ] for (n_dim, gridᵢ) in enumerate(Tuple(CI))] .* Σ + μ)
end
end
# Iteratively integrate out each dimension, i.e. law of iterated expectations
for n_dim in 1:(d - 1)
iter = CartesianIndices(tuple(Tuple(1:ns[i] for i in 1:(d - n_dim))...,
Tuple(1:1 for i in 1:n_dim)...))
feval[iter, 1] .= dropdims(sum(mapslices(fᵢ -> fᵢ .* w[d - n_dim + 1], (@view feval[((1:ns[i] for i in 1:(d - n_dim + 1))...,
(1 for i in 1:(n_dim - 1))...)...]),
dims = (d - n_dim) + 1), dims = (d - n_dim) + 1), dims = (d - n_dim) + 1)
end
# Handle final integration on its own
return sum(w[1] .* (@view feval[:, (1 for i in 1:(d - 1))...])) / π^(d / 2)
end
| [
8818,
3210,
62,
11265,
62,
4908,
1046,
372,
32937,
7,
77,
3712,
5317,
8,
198,
220,
220,
220,
18074,
113,
39611,
95,
11,
266,
39611,
95,
796,
31986,
1046,
372,
32937,
7,
77,
8,
1303,
5561,
26748,
1033,
32590,
87,
31185,
8,
198,
220,
220,
220,
18074,
113,
39611,
95,
220,
220,
764,
9,
28,
19862,
17034,
7,
17,
2014,
220,
220,
220,
220,
220,
220,
220,
1303,
14435,
1096,
18074,
113,
39611,
95,
290,
266,
39611,
95,
13760,
284,
27665,
3210,
3487,
198,
220,
220,
220,
266,
39611,
95,
220,
220,
24457,
28,
19862,
17034,
7,
46582,
8,
628,
220,
220,
220,
1441,
18074,
113,
39611,
95,
11,
266,
39611,
95,
198,
437,
198,
198,
37811,
198,
15506,
63,
198,
4908,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
11,
18919,
11,
18074,
225,
11,
299,
796,
838,
8,
198,
4908,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
11,
18919,
11,
7377,
96,
11,
299,
796,
838,
8,
198,
4908,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
11,
18919,
11,
7377,
96,
11,
36545,
8,
198,
15506,
63,
198,
198,
9948,
3129,
689,
262,
17507,
286,
257,
2163,
286,
257,
12822,
31562,
4738,
7885,
14,
31364,
13,
198,
464,
717,
2446,
5418,
15968,
7559,
6852,
11018,
11848,
90,
36,
92,
58,
69,
7,
55,
15437,
15506,
810,
7559,
55,
26867,
14323,
399,
7,
6852,
30300,
11,
26867,
82,
13495,
8,
15506,
11,
198,
4514,
262,
584,
734,
5050,
13446,
7559,
6852,
11018,
11848,
90,
36,
92,
58,
69,
7,
55,
15437,
15506,
810,
198,
15506,
55,
26867,
14323,
26867,
11018,
9948,
90,
45,
92,
7,
6852,
30300,
11,
26867,
50,
13495,
8,
15506,
290,
7559,
6852,
50,
13495,
15506,
318,
40039,
13,
198,
464,
6846,
734,
5050,
13238,
287,
326,
262,
717,
18533,
262,
976,
1271,
286,
198,
421,
41909,
1300,
2173,
287,
790,
15793,
981,
262,
1218,
857,
407,
13,
198,
198,
21017,
23412,
82,
198,
12,
4600,
69,
3712,
22203,
63,
25,
617,
2163,
286,
257,
4738,
7885,
13,
1002,
4600,
69,
7,
87,
8,
796,
2124,
47671,
788,
198,
220,
220,
220,
4600,
4908,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
11,
18919,
11,
18074,
225,
8,
63,
43707,
262,
1612,
286,
7559,
45,
7,
6852,
30300,
11,
26867,
82,
13495,
8,
15506,
198,
220,
220,
220,
1262,
838,
12,
4122,
12822,
1046,
12,
48523,
578,
15094,
81,
1300,
13,
198,
12,
4600,
34703,
3712,
15057,
63,
393,
4600,
34703,
3712,
23839,
38469,
63,
25,
1612,
286,
262,
12822,
31562,
4738,
7885,
14,
31364,
13,
198,
12,
4600,
38392,
3712,
15057,
63,
25,
3210,
28833,
286,
262,
12822,
31562,
4738,
7885,
13,
198,
12,
4600,
138,
96,
3712,
23839,
38469,
63,
25,
40039,
286,
262,
24198,
12,
66,
709,
2743,
590,
17593,
286,
198,
220,
220,
220,
220,
262,
12822,
31562,
4738,
15879,
13,
198,
12,
4600,
77,
3712,
5317,
63,
25,
1271,
286,
15094,
81,
1300,
2173,
284,
779,
198,
12,
4600,
5907,
3712,
23839,
38469,
90,
5317,
92,
63,
393,
4600,
5907,
3712,
11251,
29291,
90,
45,
11,
2558,
92,
810,
399,
63,
25,
1271,
286,
15094,
81,
1300,
2173,
284,
779,
198,
220,
220,
220,
287,
1123,
15793,
286,
262,
12822,
31562,
4738,
15879,
13,
198,
37811,
198,
8818,
31986,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
3712,
22203,
11,
18919,
3712,
15057,
11,
18074,
225,
3712,
15057,
11,
299,
3712,
5317,
796,
838,
8,
198,
220,
220,
220,
18074,
113,
39611,
95,
11,
266,
39611,
95,
796,
31986,
1046,
372,
32937,
7,
77,
8,
198,
220,
220,
220,
18074,
113,
39611,
95,
220,
220,
764,
9,
28,
19862,
17034,
7,
17,
2014,
220,
1303,
14435,
1096,
18074,
113,
39611,
95,
290,
266,
39611,
95,
13760,
284,
27665,
3210,
3487,
198,
220,
220,
220,
1303,
266,
39611,
95,
220,
220,
24457,
28,
19862,
17034,
7,
46582,
8,
1303,
770,
2239,
1760,
1568,
284,
4646,
1271,
286,
2653,
602,
628,
220,
220,
220,
611,
18919,
15139,
230,
657,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2160,
26933,
86,
39611,
95,
58,
72,
60,
1635,
277,
7,
139,
113,
39611,
95,
58,
72,
60,
1635,
18074,
225,
8,
329,
1312,
287,
352,
25,
77,
12962,
1220,
19862,
17034,
7,
46582,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2160,
26933,
86,
39611,
95,
58,
72,
60,
1635,
277,
7,
139,
113,
39611,
95,
58,
72,
60,
1635,
18074,
225,
1343,
18919,
8,
329,
1312,
287,
352,
25,
77,
12962,
1220,
19862,
17034,
7,
46582,
8,
198,
220,
220,
220,
886,
198,
198,
437,
198,
198,
8818,
31986,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
3712,
22203,
11,
18919,
3712,
23839,
38469,
90,
50,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
96,
3712,
23839,
38469,
90,
27,
25,
7913,
5512,
299,
3712,
5317,
796,
838,
8,
810,
1391,
50,
1279,
25,
7913,
92,
628,
220,
220,
220,
288,
796,
4129,
7,
34703,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
138,
96,
8,
6624,
288,
366,
464,
4129,
286,
18919,
290,
7377,
96,
1276,
307,
262,
976,
526,
198,
220,
220,
220,
18074,
113,
11,
266,
796,
31986,
1046,
372,
32937,
7,
77,
8,
198,
220,
220,
220,
18074,
113,
220,
220,
764,
9,
28,
19862,
17034,
7,
17,
2014,
220,
1303,
14435,
1096,
18074,
113,
290,
266,
13760,
284,
27665,
3210,
3487,
198,
220,
220,
220,
1303,
266,
220,
220,
24457,
28,
19862,
17034,
7,
46582,
8,
1303,
770,
2239,
1760,
1568,
284,
4646,
1271,
286,
2653,
602,
628,
220,
220,
220,
1303,
26439,
4985,
625,
262,
11192,
273,
10706,
198,
220,
220,
220,
730,
2100,
796,
15690,
90,
50,
92,
7,
917,
891,
11,
357,
77,
329,
1312,
287,
352,
25,
67,
8,
23029,
198,
220,
220,
220,
477,
25690,
796,
13690,
35610,
5497,
1063,
7,
69,
18206,
8,
198,
220,
220,
220,
611,
477,
7,
34703,
764,
35705,
230,
657,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
72,
60,
329,
1312,
287,
309,
29291,
7,
25690,
15437,
764,
9,
7377,
96,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
72,
60,
329,
1312,
287,
309,
29291,
7,
25690,
15437,
764,
9,
7377,
96,
1343,
18919,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
299,
62,
27740,
287,
352,
37498,
67,
532,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
40806,
9404,
19386,
503,
1123,
15793,
11,
1312,
13,
68,
13,
1099,
286,
11629,
515,
9027,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
796,
13690,
35610,
5497,
1063,
7,
83,
29291,
7,
51,
29291,
7,
16,
25,
77,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
29291,
7,
16,
25,
16,
329,
1312,
287,
352,
25,
77,
62,
27740,
26513,
4008,
1303,
13610,
13690,
35610,
5497,
1063,
329,
477,
5637,
15225,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
14808,
16,
25,
77,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
1343,
352,
4008,
986,
11,
357,
16,
329,
1312,
287,
352,
37498,
77,
62,
27740,
532,
352,
4008,
23029,
8075,
257,
309,
29291,
286,
352,
25,
77,
329,
262,
15225,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
326,
389,
407,
284,
307,
11521,
503,
290,
3544,
352,
82,
329,
262,
5637,
15225,
13,
775,
765,
284,
779,
1123,
15793,
286,
730,
2100,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
422,
352,
284,
357,
67,
532,
299,
62,
27740,
8,
357,
259,
5731,
737,
1406,
319,
262,
717,
24415,
11,
262,
46545,
815,
307,
357,
16,
25,
77,
11,
352,
25,
77,
737,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
775,
788,
8333,
340,
284,
262,
15225,
286,
730,
2100,
422,
352,
284,
357,
67,
532,
299,
62,
27740,
532,
352,
8,
357,
259,
5731,
8,
284,
3368,
49157,
198,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
2676,
60,
764,
28,
4268,
67,
12078,
7,
16345,
7,
31803,
677,
274,
7,
69,
39611,
95,
4613,
277,
39611,
95,
764,
9,
266,
11,
4275,
1177,
730,
2100,
58,
19510,
16,
25,
77,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
1343,
352,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
16,
329,
1312,
287,
352,
37498,
77,
62,
27740,
532,
352,
4008,
23029,
22345,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
33141,
2457,
11812,
319,
663,
898,
198,
220,
220,
220,
1441,
2160,
7,
86,
764,
9,
4275,
1177,
730,
2100,
58,
45299,
357,
16,
329,
1312,
287,
352,
37498,
67,
532,
352,
4008,
22345,
4008,
1220,
18074,
222,
61,
7,
67,
1220,
362,
8,
198,
437,
198,
198,
8818,
31986,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
3712,
22203,
11,
18919,
3712,
23839,
38469,
90,
50,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
96,
3712,
23839,
38469,
90,
27,
25,
7913,
5512,
36545,
3712,
23839,
38469,
90,
5317,
30072,
810,
1391,
50,
1279,
25,
7913,
92,
628,
220,
220,
220,
288,
796,
4129,
7,
34703,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
138,
96,
8,
6624,
288,
366,
464,
4129,
286,
18919,
290,
7377,
96,
1276,
307,
262,
976,
526,
198,
220,
220,
220,
18074,
113,
796,
360,
713,
90,
5317,
11,
20650,
90,
50,
11709,
3419,
198,
220,
220,
220,
266,
796,
360,
713,
90,
5317,
11,
20650,
90,
50,
11709,
3419,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
67,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
113,
58,
72,
4357,
266,
58,
72,
60,
796,
31986,
1046,
372,
32937,
7,
5907,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
113,
58,
72,
60,
220,
220,
220,
220,
764,
9,
28,
19862,
17034,
7,
17,
2014,
220,
1303,
14435,
1096,
18074,
113,
290,
266,
13760,
284,
27665,
3210,
3487,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
266,
58,
72,
60,
220,
220,
24457,
28,
19862,
17034,
7,
46582,
8,
1303,
770,
2239,
1760,
1568,
284,
4646,
1271,
286,
2653,
602,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
26439,
4985,
625,
262,
11192,
273,
10706,
198,
220,
220,
220,
730,
2100,
796,
15690,
90,
50,
92,
7,
917,
891,
11,
357,
77,
329,
299,
287,
36545,
8,
23029,
198,
220,
220,
220,
477,
25690,
796,
13690,
35610,
5497,
1063,
7,
69,
18206,
8,
198,
220,
220,
220,
611,
477,
7,
34703,
764,
35705,
230,
657,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
77,
62,
27740,
7131,
25928,
39611,
95,
60,
329,
357,
77,
62,
27740,
11,
10706,
39611,
95,
8,
287,
27056,
378,
7,
51,
29291,
7,
25690,
4008,
60,
764,
9,
7377,
96,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
77,
62,
27740,
7131,
25928,
39611,
95,
60,
329,
357,
77,
62,
27740,
11,
10706,
39611,
95,
8,
287,
27056,
378,
7,
51,
29291,
7,
25690,
4008,
60,
764,
9,
7377,
96,
1343,
18919,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
40806,
9404,
19386,
503,
1123,
15793,
11,
1312,
13,
68,
13,
1099,
286,
11629,
515,
9027,
198,
220,
220,
220,
329,
299,
62,
27740,
287,
352,
37498,
67,
532,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
796,
13690,
35610,
5497,
1063,
7,
83,
29291,
7,
51,
29291,
7,
16,
25,
5907,
58,
72,
60,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
29291,
7,
16,
25,
16,
329,
1312,
287,
352,
25,
77,
62,
27740,
26513,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
2676,
11,
352,
60,
764,
28,
4268,
67,
12078,
7,
16345,
7,
31803,
677,
274,
7,
69,
39611,
95,
4613,
277,
39611,
95,
764,
9,
266,
58,
67,
532,
299,
62,
27740,
1343,
352,
4357,
4275,
1177,
730,
2100,
58,
19510,
16,
25,
5907,
58,
72,
60,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
1343,
352,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
16,
329,
1312,
287,
352,
37498,
77,
62,
27740,
532,
352,
4008,
23029,
22345,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
33141,
2457,
11812,
319,
663,
898,
198,
220,
220,
220,
1441,
2160,
7,
86,
58,
16,
60,
764,
9,
4275,
1177,
730,
2100,
58,
45299,
357,
16,
329,
1312,
287,
352,
37498,
67,
532,
352,
4008,
22345,
4008,
1220,
18074,
222,
61,
7,
67,
1220,
362,
8,
198,
437,
198,
198,
8818,
31986,
1046,
372,
32937,
62,
1069,
806,
341,
7,
69,
3712,
22203,
11,
18919,
3712,
23839,
38469,
90,
50,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
96,
3712,
23839,
38469,
90,
27,
25,
7913,
5512,
36545,
3712,
11251,
29291,
90,
45,
11,
2558,
30072,
810,
1391,
50,
27,
25,
7913,
11,
399,
92,
628,
220,
220,
220,
288,
796,
4129,
7,
34703,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
138,
96,
8,
6624,
288,
366,
464,
4129,
286,
18919,
290,
7377,
96,
1276,
307,
262,
976,
526,
198,
220,
220,
220,
18074,
113,
796,
360,
713,
90,
5317,
11,
20650,
90,
50,
11709,
3419,
198,
220,
220,
220,
266,
796,
360,
713,
90,
5317,
11,
20650,
90,
50,
11709,
3419,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
67,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
113,
58,
72,
4357,
266,
58,
72,
60,
796,
31986,
1046,
372,
32937,
7,
5907,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
18074,
113,
58,
72,
60,
220,
220,
220,
220,
764,
9,
28,
19862,
17034,
7,
17,
2014,
220,
1303,
14435,
1096,
18074,
113,
290,
266,
13760,
284,
27665,
3210,
3487,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
266,
58,
72,
60,
220,
220,
24457,
28,
19862,
17034,
7,
46582,
8,
1303,
770,
2239,
1760,
1568,
284,
4646,
1271,
286,
2653,
602,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
26439,
4985,
625,
262,
11192,
273,
10706,
198,
220,
220,
220,
730,
2100,
796,
15690,
90,
50,
92,
7,
917,
891,
11,
357,
77,
329,
299,
287,
36545,
8,
23029,
198,
220,
220,
220,
477,
25690,
796,
13690,
35610,
5497,
1063,
7,
69,
18206,
8,
198,
220,
220,
220,
611,
477,
7,
34703,
764,
35705,
230,
657,
2014,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
77,
62,
27740,
7131,
25928,
39611,
95,
60,
329,
357,
77,
62,
27740,
11,
10706,
39611,
95,
8,
287,
27056,
378,
7,
51,
29291,
7,
25690,
4008,
60,
764,
9,
7377,
96,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
14323,
67,
329,
14514,
287,
477,
25690,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
25690,
60,
796,
277,
26933,
139,
113,
58,
77,
62,
27740,
7131,
25928,
39611,
95,
60,
329,
357,
77,
62,
27740,
11,
10706,
39611,
95,
8,
287,
27056,
378,
7,
51,
29291,
7,
25690,
4008,
60,
764,
9,
7377,
96,
1343,
18919,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
40806,
9404,
19386,
503,
1123,
15793,
11,
1312,
13,
68,
13,
1099,
286,
11629,
515,
9027,
198,
220,
220,
220,
329,
299,
62,
27740,
287,
352,
37498,
67,
532,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11629,
796,
13690,
35610,
5497,
1063,
7,
83,
29291,
7,
51,
29291,
7,
16,
25,
5907,
58,
72,
60,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
309,
29291,
7,
16,
25,
16,
329,
1312,
287,
352,
25,
77,
62,
27740,
26513,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
730,
2100,
58,
2676,
11,
352,
60,
764,
28,
4268,
67,
12078,
7,
16345,
7,
31803,
677,
274,
7,
69,
39611,
95,
4613,
277,
39611,
95,
764,
9,
266,
58,
67,
532,
299,
62,
27740,
1343,
352,
4357,
4275,
1177,
730,
2100,
58,
19510,
16,
25,
5907,
58,
72,
60,
329,
1312,
287,
352,
37498,
67,
532,
299,
62,
27740,
1343,
352,
4008,
986,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
16,
329,
1312,
287,
352,
37498,
77,
62,
27740,
532,
352,
4008,
23029,
22345,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
828,
5391,
82,
796,
357,
67,
532,
299,
62,
27740,
8,
1343,
352,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
33141,
2457,
11812,
319,
663,
898,
198,
220,
220,
220,
1441,
2160,
7,
86,
58,
16,
60,
764,
9,
4275,
1177,
730,
2100,
58,
45299,
357,
16,
329,
1312,
287,
352,
37498,
67,
532,
352,
4008,
22345,
4008,
1220,
18074,
222,
61,
7,
67,
1220,
362,
8,
198,
437,
198
] | 2.048098 | 3,680 |
using SpecialFunctions, RecursiveArrayTools, DifferentialEquations, Plots
using ConservationLawsParticles
# model
V1(t, x) = 1 + sin(x)/2
V2(t, x) = -1 - cos(x)/2
Wₐ′(t,x) = sign(x) / (abs(x) + 1) + x^3/20
Wᵣ(t, x) = 1 / (abs(x) + 1)
mob1(ρ, σ) = max(1 - ρ - σ/2, 0)
mob2(ρ, σ) = max(1 - ρ/2 - σ, 0)
attr = SampledInteraction(Wₐ′)
rep = IntegratedInteraction(Wᵣ)
model = ParabolicModel(
(V1, V2),
((attr, rep), (rep, attr)),
(mob1, mob2),
(SimpleDiffusion(1/16), SimpleDiffusion(1/8)))
mmodel = ParabolicModel(
(V1, V2),
((attr, rep), (rep, attr)),
(mob1, mob2),
(MinDiffusion(1/16), MinDiffusion(1/8)))
# initial condition
n = 80
x0 = ArrayPartition(
vcat(range(-5, -3, length=n÷2), range(-2, -1, length=n÷2)),
vcat(range(1, 2, length=n÷2), range(2.5, 3, length=n÷4), range(3.5, 4, length=n÷4)))
# time span
tspan = (0., 12.0)
# ODE system for the particles
prob = ODEProblem(abstract_velocities_gen!, x0, tspan, model)
mprob = ODEProblem(abstract_velocities_gen!, x0, tspan, mmodel)
# solve it
abstol = reltol = 1e-7
@time sol = solve(prob, BS5(); abstol=abstol, reltol=reltol);
@time msol = solve(mprob, BS5(); abstol=abstol, reltol=reltol);
# plot the particle trajectories
plot(legend=false, title="Trajectories", xlabel="time", ylabel="position")
plot!(sol, vars=1:1:n; color=1)
plot!(sol, vars=n+1:1:2n; color=2)
plot!(msol, vars=1:1:n; color=1, ls=:dot)
plot!(msol, vars=n+1:1:2n; color=2, ls=:dot)
savefig("multi-spec-2.png")
# plot an animation of the density
anim = @animate for t in range(tspan...; length=100)
plot(title="Density", xlabel="position", ylabel="density",
xlims=(-6,5), ylims=(0,1), legend=false)
densityplot!(sol(t).x[1]; color=1)
densityplot!(sol(t).x[2]; color=2)
densityplot!(msol(t).x[1]; color=1, ls=:dot)
densityplot!(msol(t).x[2]; color=2, ls=:dot)
end
gif(anim, "multi-spec-2.gif")
| [
3500,
6093,
24629,
2733,
11,
3311,
30753,
19182,
33637,
11,
20615,
498,
23588,
602,
11,
1345,
1747,
198,
3500,
23702,
43,
8356,
7841,
2983,
198,
198,
2,
2746,
198,
53,
16,
7,
83,
11,
2124,
8,
796,
352,
1343,
7813,
7,
87,
20679,
17,
198,
53,
17,
7,
83,
11,
2124,
8,
796,
532,
16,
532,
8615,
7,
87,
20679,
17,
198,
54,
158,
224,
238,
17478,
7,
83,
11,
87,
8,
796,
1051,
7,
87,
8,
1220,
357,
8937,
7,
87,
8,
1343,
352,
8,
1343,
2124,
61,
18,
14,
1238,
198,
54,
39611,
96,
7,
83,
11,
2124,
8,
796,
352,
1220,
357,
8937,
7,
87,
8,
1343,
352,
8,
198,
39949,
16,
7,
33643,
11,
18074,
225,
8,
796,
3509,
7,
16,
532,
18074,
223,
532,
18074,
225,
14,
17,
11,
657,
8,
198,
39949,
17,
7,
33643,
11,
18074,
225,
8,
796,
3509,
7,
16,
532,
18074,
223,
14,
17,
532,
18074,
225,
11,
657,
8,
198,
35226,
796,
3409,
10137,
9492,
2673,
7,
54,
158,
224,
238,
17478,
8,
198,
7856,
796,
35432,
9492,
2673,
7,
54,
39611,
96,
8,
198,
198,
19849,
796,
2547,
29304,
17633,
7,
198,
220,
220,
220,
357,
53,
16,
11,
569,
17,
828,
198,
220,
220,
220,
14808,
35226,
11,
1128,
828,
357,
7856,
11,
708,
81,
36911,
198,
220,
220,
220,
357,
39949,
16,
11,
7251,
17,
828,
198,
220,
220,
220,
357,
26437,
28813,
4241,
7,
16,
14,
1433,
828,
17427,
28813,
4241,
7,
16,
14,
23,
22305,
198,
198,
3020,
375,
417,
796,
2547,
29304,
17633,
7,
198,
220,
220,
220,
357,
53,
16,
11,
569,
17,
828,
198,
220,
220,
220,
14808,
35226,
11,
1128,
828,
357,
7856,
11,
708,
81,
36911,
198,
220,
220,
220,
357,
39949,
16,
11,
7251,
17,
828,
198,
220,
220,
220,
357,
9452,
28813,
4241,
7,
16,
14,
1433,
828,
1855,
28813,
4241,
7,
16,
14,
23,
22305,
198,
198,
2,
4238,
4006,
198,
77,
796,
4019,
198,
87,
15,
796,
15690,
7841,
653,
7,
198,
220,
220,
220,
410,
9246,
7,
9521,
32590,
20,
11,
532,
18,
11,
4129,
28,
77,
127,
115,
17,
828,
2837,
32590,
17,
11,
532,
16,
11,
4129,
28,
77,
127,
115,
17,
36911,
198,
220,
220,
220,
410,
9246,
7,
9521,
7,
16,
11,
362,
11,
4129,
28,
77,
127,
115,
17,
828,
2837,
7,
17,
13,
20,
11,
513,
11,
4129,
28,
77,
127,
115,
19,
828,
2837,
7,
18,
13,
20,
11,
604,
11,
4129,
28,
77,
127,
115,
19,
22305,
198,
198,
2,
640,
11506,
198,
912,
6839,
796,
357,
15,
1539,
1105,
13,
15,
8,
198,
198,
2,
440,
7206,
1080,
329,
262,
13166,
198,
1676,
65,
796,
440,
7206,
40781,
7,
397,
8709,
62,
626,
420,
871,
62,
5235,
28265,
2124,
15,
11,
256,
12626,
11,
2746,
8,
198,
76,
1676,
65,
796,
440,
7206,
40781,
7,
397,
8709,
62,
626,
420,
871,
62,
5235,
28265,
2124,
15,
11,
256,
12626,
11,
285,
19849,
8,
198,
198,
2,
8494,
340,
198,
397,
301,
349,
796,
823,
83,
349,
796,
352,
68,
12,
22,
198,
31,
2435,
1540,
796,
8494,
7,
1676,
65,
11,
24218,
20,
9783,
16552,
349,
28,
397,
301,
349,
11,
823,
83,
349,
28,
2411,
83,
349,
1776,
198,
31,
2435,
13845,
349,
796,
8494,
7,
76,
1676,
65,
11,
24218,
20,
9783,
16552,
349,
28,
397,
301,
349,
11,
823,
83,
349,
28,
2411,
83,
349,
1776,
198,
198,
2,
7110,
262,
18758,
20134,
1749,
198,
29487,
7,
1455,
437,
28,
9562,
11,
3670,
2625,
15721,
752,
1749,
1600,
2124,
18242,
2625,
2435,
1600,
331,
18242,
2625,
9150,
4943,
198,
29487,
0,
7,
34453,
11,
410,
945,
28,
16,
25,
16,
25,
77,
26,
3124,
28,
16,
8,
198,
29487,
0,
7,
34453,
11,
410,
945,
28,
77,
10,
16,
25,
16,
25,
17,
77,
26,
3124,
28,
17,
8,
198,
29487,
0,
7,
907,
349,
11,
410,
945,
28,
16,
25,
16,
25,
77,
26,
3124,
28,
16,
11,
43979,
28,
25,
26518,
8,
198,
29487,
0,
7,
907,
349,
11,
410,
945,
28,
77,
10,
16,
25,
16,
25,
17,
77,
26,
3124,
28,
17,
11,
43979,
28,
25,
26518,
8,
198,
21928,
5647,
7203,
41684,
12,
16684,
12,
17,
13,
11134,
4943,
198,
198,
2,
7110,
281,
11034,
286,
262,
12109,
198,
11227,
796,
2488,
45685,
329,
256,
287,
2837,
7,
912,
6839,
986,
26,
4129,
28,
3064,
8,
198,
220,
220,
220,
7110,
7,
7839,
2625,
35,
6377,
1600,
2124,
18242,
2625,
9150,
1600,
331,
18242,
2625,
43337,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
2475,
82,
16193,
12,
21,
11,
20,
828,
331,
2475,
82,
16193,
15,
11,
16,
828,
8177,
28,
9562,
8,
198,
220,
220,
220,
12109,
29487,
0,
7,
34453,
7,
83,
737,
87,
58,
16,
11208,
3124,
28,
16,
8,
198,
220,
220,
220,
12109,
29487,
0,
7,
34453,
7,
83,
737,
87,
58,
17,
11208,
3124,
28,
17,
8,
198,
220,
220,
220,
12109,
29487,
0,
7,
907,
349,
7,
83,
737,
87,
58,
16,
11208,
3124,
28,
16,
11,
43979,
28,
25,
26518,
8,
198,
220,
220,
220,
12109,
29487,
0,
7,
907,
349,
7,
83,
737,
87,
58,
17,
11208,
3124,
28,
17,
11,
43979,
28,
25,
26518,
8,
198,
437,
198,
27908,
7,
11227,
11,
366,
41684,
12,
16684,
12,
17,
13,
27908,
4943,
198
] | 2.109131 | 898 |
module ICNBenchmarks
# usings
using BenchmarkTools
using CompositionalNetworks
using ConstraintDomains
using Constraints
using CSV
using DataFrames
using DataVoyager
using Dictionaries
using Distributed
using DrWatson
using JSON
using Statistics
using StatsBase
using Tables
#using SharedArrays
# imports
import Constraints: make_error
# constants
export ALL_PARAMETERS
export BENCHED_CONSTRAINTS
# others
export analyse_composition
export analyze_icn
export compositions_benchmark
export icn_benchmark
export search_space
export visualize_compositions
export visualize_icn
# includes
include("constants.jl")
include("search_space.jl")
include("extra_constraints.jl")
include("icn.jl")
include("composition.jl")
include("analyze.jl")
end
| [
21412,
12460,
45,
44199,
14306,
198,
198,
2,
514,
654,
198,
3500,
25187,
4102,
33637,
198,
3500,
29936,
1859,
7934,
5225,
198,
3500,
1482,
2536,
2913,
24510,
1299,
198,
3500,
1482,
2536,
6003,
198,
3500,
44189,
198,
3500,
6060,
35439,
198,
3500,
6060,
53,
726,
3536,
198,
3500,
360,
2867,
3166,
198,
3500,
4307,
6169,
198,
3500,
1583,
54,
13506,
198,
3500,
19449,
198,
3500,
14370,
198,
3500,
20595,
14881,
198,
3500,
33220,
198,
2,
3500,
39403,
3163,
20477,
198,
198,
2,
17944,
198,
11748,
1482,
2536,
6003,
25,
787,
62,
18224,
198,
198,
2,
38491,
198,
39344,
11096,
62,
27082,
2390,
2767,
4877,
198,
39344,
44849,
3398,
1961,
62,
10943,
2257,
3861,
1268,
4694,
198,
198,
2,
1854,
198,
39344,
39552,
62,
785,
9150,
198,
39344,
16602,
62,
291,
77,
198,
39344,
33543,
62,
26968,
4102,
198,
39344,
14158,
77,
62,
26968,
4102,
198,
39344,
2989,
62,
13200,
198,
39344,
38350,
62,
785,
1930,
1756,
198,
39344,
38350,
62,
291,
77,
198,
198,
2,
3407,
198,
17256,
7203,
9979,
1187,
13,
20362,
4943,
198,
17256,
7203,
12947,
62,
13200,
13,
20362,
4943,
198,
17256,
7203,
26086,
62,
1102,
2536,
6003,
13,
20362,
4943,
198,
17256,
7203,
291,
77,
13,
20362,
4943,
198,
17256,
7203,
785,
9150,
13,
20362,
4943,
198,
17256,
7203,
38200,
2736,
13,
20362,
4943,
198,
198,
437,
198
] | 3.351351 | 222 |
## ExoplanetsSysSim/src/star.jl
## (c) 2015 Eric B. Ford
#using Distributions
@compat abstract type StarAbstract end # Check does using StarAbstract cause a significant performance hit
immutable Star <: StarAbstract
radius::Float64
mass::Float64
flux::Float64 # relevant once have multiple stars in one target
ld::LimbDarkeningParamAbstract # TODO SCI DETAIL: add limb darkening param?
id::Int64 # id for looking up properties in stellar catalog
end
#typealias SingleStar Star
SingleStar = Star
immutable BinaryStar <: StarAbstract
primary::Star
secondary::Star
orbit::Orbit
end
immutable MultipleStar <: StarAbstract # Will we want to handle triple, quad systems?
component::Vector{StarAbstract}
orbit::Vector{Orbit}
end
flux(s::Star) = s.flux # Demo of how to specify function behavior that depends on the derived type
flux(s::BinaryStar) = s.primary.flux + s.secondary.flux
flux(s::MultipleStar) = sum( flux, s.component)
mass(s::Star) = s.mass
mass(s::BinaryStar) = s.primary.mass + s.secondary.mass
mass(s::MultipleStar) = sum( mass, s.component)::Float64
function generate_stars(sim_param::SimParam)
generate_star = get_function(sim_param,"generate_star")
num_target_stars = get_int(sim_param,"num_targets_sim_pass_one")
star_list = Array{StarAbstract}(num_target_stars)
for i in 1:num_target_stars
s = generate_star(sim_param)
star_list[i] = s
#star_list[i] = generate_star(sim_param)
end
return star_list
end
function generate_star_dumb(sim_param::SimParam)
r = rand(Uniform(0.8,1.3))::Float64
m = rand(Normal(r,0.1))::Float64
while m<0.0
m = rand(Normal(r,0.1))::Float64
end
f = rand(Normal(1.0,0.1))::Float64
while f<0.0
f = 1.0+0.1*randn()
end
ld = LimbDarkeningParamQuadratic(0.4603,0.2291) # TODO: Once we implement limb darkening
return SingleStar(r,m,f,ld,0)
#return SingleStar(r,m,f,0)
end
function test_star_constructors(sim_param::SimParam)
star_tmp = generate_star_dumb(sim_param)
f1 = flux(star_tmp)
f2 = flux(BinaryStar(star_tmp,star_tmp,Orbit(10.0,0.0,0.0,0.0,0.0,0.0)))
f4 = flux(MultipleStar([star_tmp for i in 1:4], [Orbit(10.0,0.0,0.0,0.0,0.0,0.0) for i in 1:4]) )
# println("# Fluxes: ", f1, " ", f2, " ", f4)
star_list = generate_stars(sim_param)
return true
end
| [
2235,
1475,
46853,
1039,
44387,
8890,
14,
10677,
14,
7364,
13,
20362,
198,
2235,
357,
66,
8,
1853,
7651,
347,
13,
8092,
198,
198,
2,
3500,
46567,
507,
198,
198,
31,
5589,
265,
12531,
2099,
2907,
23839,
886,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6822,
857,
1262,
2907,
23839,
2728,
257,
2383,
2854,
2277,
198,
198,
8608,
18187,
2907,
1279,
25,
2907,
23839,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
16874,
3712,
43879,
2414,
198,
220,
2347,
3712,
43879,
2414,
198,
220,
28462,
3712,
43879,
2414,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
5981,
1752,
423,
3294,
5788,
287,
530,
2496,
198,
220,
300,
67,
3712,
43,
14107,
17367,
3101,
22973,
23839,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
6374,
40,
360,
20892,
4146,
25,
751,
25035,
3223,
3101,
5772,
30,
198,
220,
4686,
3712,
5317,
2414,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
4686,
329,
2045,
510,
6608,
287,
25041,
18388,
198,
198,
437,
198,
2,
4906,
26011,
14206,
8248,
2907,
198,
28008,
8248,
796,
2907,
198,
198,
8608,
18187,
45755,
8248,
1279,
25,
2907,
23839,
198,
220,
4165,
3712,
8248,
198,
220,
9233,
3712,
8248,
198,
220,
13066,
3712,
5574,
2545,
198,
437,
198,
198,
8608,
18187,
20401,
8248,
1279,
25,
2907,
23839,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2561,
356,
765,
284,
5412,
15055,
11,
15094,
3341,
30,
198,
220,
7515,
3712,
38469,
90,
8248,
23839,
92,
198,
220,
13066,
3712,
38469,
90,
5574,
2545,
92,
198,
437,
198,
198,
69,
22564,
7,
82,
3712,
8248,
8,
796,
264,
13,
69,
22564,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
34588,
286,
703,
284,
11986,
2163,
4069,
326,
8338,
319,
262,
10944,
2099,
198,
69,
22564,
7,
82,
3712,
33,
3219,
8248,
8,
796,
264,
13,
39754,
13,
69,
22564,
1343,
264,
13,
38238,
13,
69,
22564,
198,
69,
22564,
7,
82,
3712,
31217,
8248,
8,
796,
2160,
7,
28462,
11,
264,
13,
42895,
8,
628,
198,
22208,
7,
82,
3712,
8248,
8,
796,
264,
13,
22208,
198,
22208,
7,
82,
3712,
33,
3219,
8248,
8,
796,
264,
13,
39754,
13,
22208,
1343,
264,
13,
38238,
13,
22208,
198,
22208,
7,
82,
3712,
31217,
8248,
8,
796,
2160,
7,
2347,
11,
264,
13,
42895,
2599,
25,
43879,
2414,
198,
198,
8818,
7716,
62,
30783,
7,
14323,
62,
17143,
3712,
8890,
22973,
8,
198,
220,
220,
7716,
62,
7364,
796,
651,
62,
8818,
7,
14323,
62,
17143,
553,
8612,
378,
62,
7364,
4943,
198,
220,
220,
997,
62,
16793,
62,
30783,
796,
651,
62,
600,
7,
14323,
62,
17143,
553,
22510,
62,
83,
853,
1039,
62,
14323,
62,
6603,
62,
505,
4943,
198,
220,
220,
3491,
62,
4868,
796,
15690,
90,
8248,
23839,
92,
7,
22510,
62,
16793,
62,
30783,
8,
198,
220,
220,
329,
1312,
287,
352,
25,
22510,
62,
16793,
62,
30783,
198,
220,
220,
220,
220,
264,
796,
220,
7716,
62,
7364,
7,
14323,
62,
17143,
8,
198,
220,
220,
220,
220,
3491,
62,
4868,
58,
72,
60,
796,
264,
198,
220,
220,
220,
220,
1303,
7364,
62,
4868,
58,
72,
60,
796,
7716,
62,
7364,
7,
14323,
62,
17143,
8,
198,
220,
220,
886,
198,
220,
1441,
3491,
62,
4868,
198,
437,
198,
198,
8818,
7716,
62,
7364,
62,
67,
2178,
7,
14323,
62,
17143,
3712,
8890,
22973,
8,
220,
198,
220,
374,
796,
43720,
7,
3118,
6933,
7,
15,
13,
23,
11,
16,
13,
18,
8,
2599,
25,
43879,
2414,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
285,
796,
43720,
7,
26447,
7,
81,
11,
15,
13,
16,
8,
2599,
25,
43879,
2414,
198,
220,
981,
285,
27,
15,
13,
15,
198,
220,
220,
220,
285,
796,
43720,
7,
26447,
7,
81,
11,
15,
13,
16,
8,
2599,
25,
43879,
2414,
198,
220,
886,
198,
220,
277,
796,
43720,
7,
26447,
7,
16,
13,
15,
11,
15,
13,
16,
8,
2599,
25,
43879,
2414,
198,
220,
981,
277,
27,
15,
13,
15,
198,
220,
220,
220,
277,
796,
352,
13,
15,
10,
15,
13,
16,
9,
25192,
77,
3419,
198,
220,
886,
198,
220,
300,
67,
796,
7576,
65,
17367,
3101,
22973,
4507,
41909,
1512,
7,
15,
13,
34716,
18,
11,
15,
13,
1828,
6420,
8,
220,
220,
1303,
16926,
46,
25,
4874,
356,
3494,
25035,
3223,
3101,
198,
220,
1441,
14206,
8248,
7,
81,
11,
76,
11,
69,
11,
335,
11,
15,
8,
220,
198,
220,
1303,
7783,
14206,
8248,
7,
81,
11,
76,
11,
69,
11,
15,
8,
220,
198,
437,
628,
198,
8818,
1332,
62,
7364,
62,
41571,
669,
7,
14323,
62,
17143,
3712,
8890,
22973,
8,
198,
220,
3491,
62,
22065,
796,
7716,
62,
7364,
62,
67,
2178,
7,
14323,
62,
17143,
8,
198,
220,
277,
16,
796,
28462,
7,
7364,
62,
22065,
8,
198,
220,
277,
17,
796,
28462,
7,
33,
3219,
8248,
7,
7364,
62,
22065,
11,
7364,
62,
22065,
11,
5574,
2545,
7,
940,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
22305,
198,
220,
277,
19,
796,
28462,
7,
31217,
8248,
26933,
7364,
62,
22065,
329,
1312,
287,
352,
25,
19,
4357,
685,
5574,
2545,
7,
940,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
11,
15,
13,
15,
8,
329,
1312,
287,
352,
25,
19,
12962,
1267,
198,
220,
1303,
44872,
7203,
2,
1610,
2821,
274,
25,
33172,
277,
16,
11,
366,
33172,
277,
17,
11,
366,
33172,
277,
19,
8,
198,
220,
3491,
62,
4868,
796,
7716,
62,
30783,
7,
14323,
62,
17143,
8,
198,
220,
1441,
2081,
198,
437,
628
] | 2.362849 | 1,039 |
using Test, LinearMaps, LinearAlgebra
@testset "function maps" begin
N = 100
function myft(v::AbstractVector)
# not so fast fourier transform
N = length(v)
w = zeros(complex(eltype(v)), N)
for k = 1:N
kappa = (2*(k-1)/N)*pi
for n = 1:N
w[k] += v[n]*exp(kappa*(n-1)*im)
end
end
return w
end
MyFT = @inferred LinearMap{ComplexF64}(myft, N) / sqrt(N)
U = Matrix(MyFT) # will be a unitary matrix
@test @inferred U'U ≈ Matrix{eltype(U)}(I, N, N)
CS = @inferred LinearMap(cumsum, 2)
@test size(CS) == (2, 2)
@test @inferred !issymmetric(CS)
@test @inferred !ishermitian(CS)
@test @inferred !isposdef(CS)
@test @inferred !(LinearMaps.ismutating(CS))
@test @inferred Matrix(CS) == [1. 0.; 1. 1.]
@test @inferred Array(CS) == [1. 0.; 1. 1.]
CS = @inferred LinearMap(cumsum, 10; ismutating=false)
v = rand(10)
cv = cumsum(v)
@test CS * v == cv
@test *(CS, v) == cv
@test_throws ErrorException CS' * v
CS = @inferred LinearMap(cumsum, x -> reverse(cumsum(reverse(x))), 10; ismutating=false)
cv = cumsum(v)
@test @inferred CS * v == cv
@test @inferred *(CS, v) == cv
@test @inferred CS' * v == reverse!(cumsum(reverse(v)))
@test @inferred mul!(similar(v), transpose(CS), v) == reverse!(cumsum(reverse(v)))
CS! = @inferred LinearMap(cumsum!, 10; ismutating=true)
@test @inferred LinearMaps.ismutating(CS!)
@test @inferred CS! * v == cv
@test @inferred *(CS!, v) == cv
@test @inferred mul!(similar(v), CS!, v) == cv
@test_throws ErrorException CS!'v
@test_throws ErrorException transpose(CS!) * v
CS! = @inferred LinearMap{ComplexF64}(cumsum!, 10; ismutating=true)
v = rand(ComplexF64, 10)
cv = cumsum(v)
@test @inferred LinearMaps.ismutating(CS!)
@test @inferred CS! * v == cv
@test @inferred *(CS!, v) == cv
@test @inferred mul!(similar(v), CS!, v) == cv
@test_throws ErrorException CS!'v
@test_throws ErrorException adjoint(CS!) * v
CS! = LinearMap{ComplexF64}(cumsum!, (y, x) -> (copyto!(y, x); reverse!(y); cumsum!(y, y)), 10; ismutating=true)
@test @inferred LinearMaps.ismutating(CS!)
@test @inferred CS! * v == cv
@test @inferred *(CS!, v) == cv
@test @inferred mul!(similar(v), CS!, v) == cv
@test @inferred CS' * v == reverse!(cumsum(reverse(v)))
@test @inferred mul!(similar(v), transpose(CS), v) == reverse!(cumsum(reverse(v)))
@test @inferred mul!(similar(v), adjoint(CS), v) == reverse!(cumsum(reverse(v)))
# Test fallback methods:
L = @inferred LinearMap(x -> x, x -> x, 10)
v = randn(10)
@test @inferred (2 * L)' * v ≈ 2 * v
@test @inferred transpose(2 * L) * v ≈ 2 * v
L = @inferred LinearMap{ComplexF64}(x -> x, x -> x, 10)
v = rand(ComplexF64, 10)
@test @inferred (2 * L)' * v ≈ 2 * v
@test @inferred transpose(2 * L) * v ≈ 2 * v
end
| [
3500,
6208,
11,
44800,
47010,
11,
44800,
2348,
29230,
198,
198,
31,
9288,
2617,
366,
8818,
8739,
1,
2221,
198,
220,
220,
220,
399,
796,
1802,
198,
220,
220,
220,
2163,
616,
701,
7,
85,
3712,
23839,
38469,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
407,
523,
3049,
46287,
5277,
6121,
198,
220,
220,
220,
220,
220,
220,
220,
399,
796,
4129,
7,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
1976,
27498,
7,
41887,
7,
417,
4906,
7,
85,
36911,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
45,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
479,
20975,
796,
357,
17,
9,
7,
74,
12,
16,
20679,
45,
27493,
14415,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
299,
796,
352,
25,
45,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
58,
74,
60,
15853,
410,
58,
77,
60,
9,
11201,
7,
74,
20975,
9,
7,
77,
12,
16,
27493,
320,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
266,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2011,
9792,
796,
2488,
259,
18186,
44800,
13912,
90,
5377,
11141,
37,
2414,
92,
7,
1820,
701,
11,
399,
8,
1220,
19862,
17034,
7,
45,
8,
198,
220,
220,
220,
471,
796,
24936,
7,
3666,
9792,
8,
1303,
481,
307,
257,
4326,
560,
17593,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
471,
6,
52,
15139,
230,
24936,
90,
417,
4906,
7,
52,
38165,
7,
40,
11,
399,
11,
399,
8,
628,
220,
220,
220,
9429,
796,
2488,
259,
18186,
44800,
13912,
7,
66,
5700,
388,
11,
362,
8,
198,
220,
220,
220,
2488,
9288,
2546,
7,
7902,
8,
6624,
357,
17,
11,
362,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
5145,
747,
26621,
19482,
7,
7902,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
5145,
4828,
2781,
666,
7,
7902,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
5145,
271,
1930,
4299,
7,
7902,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
5145,
7,
14993,
451,
47010,
13,
1042,
315,
803,
7,
7902,
4008,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
24936,
7,
7902,
8,
6624,
685,
16,
13,
657,
15089,
352,
13,
352,
8183,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
15690,
7,
7902,
8,
6624,
685,
16,
13,
657,
15089,
352,
13,
352,
8183,
198,
220,
220,
220,
9429,
796,
2488,
259,
18186,
44800,
13912,
7,
66,
5700,
388,
11,
838,
26,
318,
21973,
803,
28,
9562,
8,
198,
220,
220,
220,
410,
796,
43720,
7,
940,
8,
198,
220,
220,
220,
269,
85,
796,
269,
5700,
388,
7,
85,
8,
198,
220,
220,
220,
2488,
9288,
9429,
1635,
410,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
1635,
7,
7902,
11,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
9429,
6,
1635,
410,
198,
220,
220,
220,
9429,
796,
2488,
259,
18186,
44800,
13912,
7,
66,
5700,
388,
11,
2124,
4613,
9575,
7,
66,
5700,
388,
7,
50188,
7,
87,
4008,
828,
838,
26,
318,
21973,
803,
28,
9562,
8,
198,
220,
220,
220,
269,
85,
796,
269,
5700,
388,
7,
85,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
1635,
410,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1635,
7,
7902,
11,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
6,
1635,
410,
6624,
9575,
0,
7,
66,
5700,
388,
7,
50188,
7,
85,
22305,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
1007,
3455,
7,
7902,
828,
410,
8,
6624,
9575,
0,
7,
66,
5700,
388,
7,
50188,
7,
85,
22305,
628,
220,
220,
220,
9429,
0,
796,
2488,
259,
18186,
44800,
13912,
7,
66,
5700,
388,
28265,
838,
26,
318,
21973,
803,
28,
7942,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
44800,
47010,
13,
1042,
315,
803,
7,
7902,
8133,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
0,
1635,
410,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1635,
7,
7902,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
9429,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
9429,
13679,
85,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
1007,
3455,
7,
7902,
8133,
1635,
410,
628,
220,
220,
220,
9429,
0,
796,
2488,
259,
18186,
44800,
13912,
90,
5377,
11141,
37,
2414,
92,
7,
66,
5700,
388,
28265,
838,
26,
318,
21973,
803,
28,
7942,
8,
198,
220,
220,
220,
410,
796,
43720,
7,
5377,
11141,
37,
2414,
11,
838,
8,
198,
220,
220,
220,
269,
85,
796,
269,
5700,
388,
7,
85,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
44800,
47010,
13,
1042,
315,
803,
7,
7902,
8133,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
0,
1635,
410,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1635,
7,
7902,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
9429,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
9429,
13679,
85,
198,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
9224,
1563,
7,
7902,
8133,
1635,
410,
198,
220,
220,
220,
9429,
0,
796,
44800,
13912,
90,
5377,
11141,
37,
2414,
92,
7,
66,
5700,
388,
28265,
357,
88,
11,
2124,
8,
4613,
357,
30073,
1462,
0,
7,
88,
11,
2124,
1776,
9575,
0,
7,
88,
1776,
269,
5700,
388,
0,
7,
88,
11,
331,
36911,
838,
26,
318,
21973,
803,
28,
7942,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
44800,
47010,
13,
1042,
315,
803,
7,
7902,
8133,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
0,
1635,
410,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1635,
7,
7902,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
9429,
28265,
410,
8,
6624,
269,
85,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
9429,
6,
1635,
410,
6624,
9575,
0,
7,
66,
5700,
388,
7,
50188,
7,
85,
22305,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
1007,
3455,
7,
7902,
828,
410,
8,
6624,
9575,
0,
7,
66,
5700,
388,
7,
50188,
7,
85,
22305,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
35971,
0,
7,
38610,
7,
85,
828,
9224,
1563,
7,
7902,
828,
410,
8,
6624,
9575,
0,
7,
66,
5700,
388,
7,
50188,
7,
85,
22305,
628,
220,
220,
220,
1303,
6208,
2121,
1891,
5050,
25,
198,
220,
220,
220,
406,
796,
2488,
259,
18186,
44800,
13912,
7,
87,
4613,
2124,
11,
2124,
4613,
2124,
11,
838,
8,
198,
220,
220,
220,
410,
796,
43720,
77,
7,
940,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
357,
17,
1635,
406,
33047,
1635,
410,
15139,
230,
362,
1635,
410,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1007,
3455,
7,
17,
1635,
406,
8,
1635,
410,
15139,
230,
362,
1635,
410,
198,
220,
220,
220,
406,
796,
2488,
259,
18186,
44800,
13912,
90,
5377,
11141,
37,
2414,
92,
7,
87,
4613,
2124,
11,
2124,
4613,
2124,
11,
838,
8,
198,
220,
220,
220,
410,
796,
43720,
7,
5377,
11141,
37,
2414,
11,
838,
8,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
357,
17,
1635,
406,
33047,
1635,
410,
15139,
230,
362,
1635,
410,
198,
220,
220,
220,
2488,
9288,
2488,
259,
18186,
1007,
3455,
7,
17,
1635,
406,
8,
1635,
410,
15139,
230,
362,
1635,
410,
198,
437,
198
] | 2.156295 | 1,382 |
using jInv.Mesh;
using FactoredEikonalFastMarching;
using Printf
#using PyPlot
#close("all")
include("runAccuracyExperiment.jl");
include("getWorkUnit.jl");
"""
A function for running the experiments in the paper:
Eran Treister and Eldad Haber, A fast marching algorithm for the factored eikonal equation, Journal of Computational Physics, 324, 210-225, 2016.
To acctually run the experiments in the paper: increase numOfRefinements
"""
function runPaperExperiments(numOfRefinements)
println("******************** 2D experiments ***************************");
I = [4,8];
n = zeros(Int64,2);
h0 = [0.05,0.05];
WU = zeros(numOfRefinements)
for k = 1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
WU[k] = GetWorkunitForLoop(n,h);
end
println("******************** Gradient Slowness ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
h0 = [0.05,0.05];
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
(kappaSquared,src,T_exact) = getAnalyticalConstGrad2D(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
println("******************** Gradient Velocity ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
h0 = [0.05,0.05];
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
(kappaSquared,src,T_exact) = getAnalyticalConstGradInv2D(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
println("******************** Gaussian factor ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
h0 = [0.05,0.05];
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
(kappaSquared,src,T_exact) = getSmoothGaussianMedium(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
println("*******************************************************************************")
println("*******************************************************************************")
println("************************* 3-D EXPERIMENTS *************************************")
println("*******************************************************************************")
println("*******************************************************************************")
##########################################################################################
##########################################################################################
# 3D experiments:
##########################################################################################
I = [1.6,1.6,0.8];
n = zeros(Int64,3);
h0 = [0.1,0.1,0.1];
WU = zeros(numOfRefinements)
for k = 1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
n[3] = round(Int64,(I[3]/h[3])+1);
WU[k] = GetWorkunitForLoop(n,h);
end
println("******************** Gradient Slowness ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
n[3] = round(Int64,(I[3]/h[3])+1);
(kappaSquared,src,T_exact) = getAnalyticalConstGrad3D(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
println("******************** Gradient Velocity ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
n[3] = round(Int64,(I[3]/h[3])+1);
(kappaSquared,src,T_exact) = getAnalyticalConstGradInv3D(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
println("******************** Gaussian factor ***************************");
println("h\t\tn\t\terror(1st)[max,l2]\ttime(1st)\terror(2nd)[max,l2]\ttime(2nd)")
for k=1:numOfRefinements
h = (0.5^k)*h0;
n[1] = round(Int64,(I[1]/h[1])+1);
n[2] = round(Int64,(I[2]/h[2])+1);
n[3] = round(Int64,(I[3]/h[3])+1);
(kappaSquared,src,T_exact) = getSmoothGaussianMedium(n,h);
runExperimentAndWriteResults(kappaSquared,h,src,n,T_exact,WU[k]);
end
return;
end
############################################################################################
runPaperExperiments(2);
| [
198,
3500,
474,
19904,
13,
37031,
26,
198,
3500,
19020,
1850,
36,
1134,
20996,
22968,
16192,
278,
26,
198,
3500,
12578,
69,
198,
198,
2,
3500,
9485,
43328,
198,
2,
19836,
7203,
439,
4943,
198,
198,
17256,
7203,
5143,
17320,
23843,
20468,
3681,
13,
20362,
15341,
198,
17256,
7203,
1136,
12468,
26453,
13,
20362,
15341,
198,
198,
37811,
198,
32,
2163,
329,
2491,
262,
10256,
287,
262,
3348,
25,
220,
198,
36,
2596,
4700,
1694,
290,
19208,
324,
19654,
263,
11,
317,
3049,
26409,
11862,
329,
262,
1109,
1850,
304,
1134,
20996,
16022,
11,
4913,
286,
22476,
864,
23123,
11,
38595,
11,
20064,
12,
18182,
11,
1584,
13,
198,
2514,
936,
310,
935,
1057,
262,
10256,
287,
262,
3348,
25,
2620,
997,
5189,
8134,
259,
3196,
198,
37811,
198,
8818,
1057,
42950,
20468,
6800,
7,
22510,
5189,
8134,
259,
3196,
8,
198,
35235,
7203,
8412,
2466,
362,
35,
10256,
220,
8412,
4557,
8162,
15341,
198,
198,
40,
796,
685,
19,
11,
23,
11208,
198,
77,
796,
1976,
27498,
7,
5317,
2414,
11,
17,
1776,
198,
198,
71,
15,
796,
685,
15,
13,
2713,
11,
15,
13,
2713,
11208,
198,
54,
52,
796,
1976,
27498,
7,
22510,
5189,
8134,
259,
3196,
8,
198,
1640,
479,
796,
352,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
54,
52,
58,
74,
60,
796,
3497,
12468,
20850,
1890,
39516,
7,
77,
11,
71,
1776,
198,
437,
198,
198,
35235,
7203,
8412,
2466,
17701,
1153,
3454,
593,
408,
220,
8412,
4557,
8162,
15341,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
628,
198,
201,
198,
71,
15,
796,
685,
15,
13,
2713,
11,
15,
13,
2713,
11208,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
37702,
22869,
34184,
42731,
17,
35,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
198,
198,
35235,
7203,
8412,
2466,
17701,
1153,
43137,
220,
8412,
4557,
8162,
15341,
198,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
198,
71,
15,
796,
685,
15,
13,
2713,
11,
15,
13,
2713,
11208,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
37702,
22869,
34184,
42731,
19904,
17,
35,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
628,
198,
198,
35235,
7203,
8412,
2466,
12822,
31562,
5766,
220,
8412,
4557,
8162,
15341,
198,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
198,
71,
15,
796,
685,
15,
13,
2713,
11,
15,
13,
2713,
11208,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
7556,
5226,
35389,
31562,
31205,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
198,
198,
35235,
7203,
17174,
17174,
46068,
8162,
4943,
198,
35235,
7203,
17174,
17174,
46068,
8162,
4943,
198,
35235,
7203,
8412,
4557,
9,
513,
12,
35,
7788,
18973,
3955,
15365,
41906,
35625,
4943,
198,
35235,
7203,
17174,
17174,
46068,
8162,
4943,
198,
35235,
7203,
17174,
17174,
46068,
8162,
4943,
198,
198,
29113,
29113,
14468,
7804,
2235,
198,
29113,
29113,
14468,
7804,
2235,
198,
2,
513,
35,
10256,
25,
198,
29113,
29113,
14468,
7804,
2235,
198,
198,
40,
796,
685,
16,
13,
21,
11,
16,
13,
21,
11,
15,
13,
23,
11208,
198,
77,
796,
1976,
27498,
7,
5317,
2414,
11,
18,
1776,
198,
198,
71,
15,
796,
685,
15,
13,
16,
11,
15,
13,
16,
11,
15,
13,
16,
11208,
198,
54,
52,
796,
1976,
27498,
7,
22510,
5189,
8134,
259,
3196,
8,
198,
1640,
479,
796,
352,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
77,
58,
18,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
18,
60,
14,
71,
58,
18,
12962,
10,
16,
1776,
198,
197,
54,
52,
58,
74,
60,
796,
3497,
12468,
20850,
1890,
39516,
7,
77,
11,
71,
1776,
198,
437,
198,
198,
35235,
7203,
8412,
2466,
17701,
1153,
3454,
593,
408,
220,
8412,
4557,
8162,
15341,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
198,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
77,
58,
18,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
18,
60,
14,
71,
58,
18,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
37702,
22869,
34184,
42731,
18,
35,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
198,
198,
35235,
7203,
8412,
2466,
17701,
1153,
43137,
220,
8412,
4557,
8162,
15341,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
77,
58,
18,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
18,
60,
14,
71,
58,
18,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
37702,
22869,
34184,
42731,
19904,
18,
35,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
198,
198,
35235,
7203,
8412,
2466,
12822,
31562,
5766,
220,
8412,
4557,
8162,
15341,
198,
35235,
7203,
71,
59,
83,
59,
34106,
59,
83,
59,
14007,
7,
16,
301,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
16,
301,
19415,
14007,
7,
17,
358,
38381,
9806,
11,
75,
17,
60,
59,
926,
524,
7,
17,
358,
8,
4943,
198,
1640,
479,
28,
16,
25,
22510,
5189,
8134,
259,
3196,
198,
197,
71,
796,
357,
15,
13,
20,
61,
74,
27493,
71,
15,
26,
198,
197,
77,
58,
16,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
16,
60,
14,
71,
58,
16,
12962,
10,
16,
1776,
198,
197,
77,
58,
17,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
17,
60,
14,
71,
58,
17,
12962,
10,
16,
1776,
198,
197,
77,
58,
18,
60,
796,
2835,
7,
5317,
2414,
11,
7,
40,
58,
18,
60,
14,
71,
58,
18,
12962,
10,
16,
1776,
198,
197,
7,
74,
20975,
22266,
1144,
11,
10677,
11,
51,
62,
1069,
529,
8,
796,
651,
7556,
5226,
35389,
31562,
31205,
7,
77,
11,
71,
1776,
198,
197,
5143,
20468,
3681,
1870,
16594,
25468,
7,
74,
20975,
22266,
1144,
11,
71,
11,
10677,
11,
77,
11,
51,
62,
1069,
529,
11,
54,
52,
58,
74,
36563,
198,
437,
198,
7783,
26,
198,
437,
198,
29113,
29113,
14468,
7804,
4242,
198,
198,
5143,
42950,
20468,
6800,
7,
17,
1776,
198
] | 2.453619 | 1,865 |
module MaxHelpingHandHeatWaveNoColorGrade
using ..Ahorn, Maple
@mapdef Effect "MaxHelpingHand/HeatWaveNoColorGrade" HeatWaveNoColorGrade(only::String="*", exclude::String="", controlColorGradeWhenActive::Bool=false)
placements = HeatWaveNoColorGrade
function Ahorn.canFgBg(effect::HeatWaveNoColorGrade)
return true, true
end
end
| [
171,
119,
123,
21412,
5436,
12621,
13886,
12885,
39596,
39709,
2949,
10258,
42233,
198,
198,
3500,
11485,
10910,
1211,
11,
21249,
198,
198,
31,
8899,
4299,
7896,
366,
11518,
12621,
13886,
12885,
14,
39596,
39709,
2949,
10258,
42233,
1,
12308,
39709,
2949,
10258,
42233,
7,
8807,
3712,
10100,
2625,
9,
1600,
19607,
3712,
10100,
2625,
1600,
1630,
10258,
42233,
2215,
13739,
3712,
33,
970,
28,
9562,
8,
198,
198,
489,
28613,
796,
12308,
39709,
2949,
10258,
42233,
198,
198,
8818,
7900,
1211,
13,
5171,
37,
70,
33,
70,
7,
10760,
3712,
39596,
39709,
2949,
10258,
42233,
8,
198,
220,
220,
220,
1441,
2081,
11,
2081,
198,
437,
198,
198,
437,
198
] | 3.054054 | 111 |
import LsqFit
# #############################################################################
#Moving average filtering
#Apply filter
function movavgfilt{T}(y::Array{T,1},N::Int64)
#Usage:
# ys = movavgfilt(y,N)
# y Signal to be smoothed
# N Size of window
# ys Smoothed output
#Initiate
ys::Array{Float64,1} = Array(Float64,length(y))
#Compute mean
for i=1:length(y)
s::Int64 = minimum([floor((N-1)/2),i-1,length(y)-i])
ys[i] = sum(y[i-s:i+s])/(2*s+1)
end
return ys
end
# #############################################################################
#Savitzsky-Golay filtering
#Get coefficients
function sgolaycoeff{T<:Real}(z::Array{T,1},deg::Int64,diff::Int64=0)
#Usage:
# C = sgolaycoeff(z,deg)
# C = sgolaycoeff(z,deg,diff)
# z Fitting window (eg: [-5:5])
# deg Degree of polynomial for fit
# diff Number of differentiations (must be <= deg, default 0 for
# smoothing)
# C Matrix for transforming window values to polynomial coefficients,
# where (i,j)th entry is the multiplier to the jth value for the
# (i-1) order term in the fitting polynomial.
#Check input
assert(diff <= deg)
#Solve normal equations
J::Array{T,2} = broadcast(^,z,transpose(0:deg))
Jt::Array{T,2} = transpose(J)
C::Array{Float64,2} = inv(Jt*J)*Jt
#Get coefficients for derivatives
for i = 1:diff
C = broadcast(*,[1:size(C,1)-1],C[2:end,:])
end
return C
end
#Apply filter
function sgolayfilt{T<:Real}(y::Array{T,1},N::Int64;deg::Int64=2,diff::Int64=0,multi::Int64=1)
#Usage:
# ys = sgolayfilt(y,N)
# ys = sgolayfilt(x,y,N)
# ys = sgolayfilt(..., deg=deg)
# ys = sgolayfilt(..., diff=diff)
# ys = sgolayfilt(..., multi=multi)
# y Signal to be smoothed
# N Size of window
# x Distribution of signal events (default [1:length(y)] for uniform)
# deg Degree of polynomial for fit
# diff Number of differentiations (must be <= deg, default 0 for
# smoothing)
# multi Number of times to filter
# ys Smoothed signal
#Check input
if diff > deg
error("Differential order cannot exceed polynomial fit degree.")
end
m::Int64 = div(N-1,2)
if 2*m+1 <= deg
error("Fitting window N = $N is too small for polynomial fit of degree $deg.")
end
if multi < 1
error("Number of times to filter must be at least 1.")
end
#Initiate
C::Array{Float64,2} = sgolaycoeff([-m:m],deg,diff)
ys::Array{Float64,1} = Array(Float64,length(y))
#Starting
a::Array{Float64,1} = C*y[1:2m+1]
for i=1:m
ys[i] = sum(a.*(i-m-1).^[0:length(a)-1])
end
#Middle
C1::Array{Float64,1} = C[1,:][:]
for i=m+1:length(y)-m
ys[i] = dot(C1,y[i-m:i+m])
end
#Ending
a = C*y[end-2m:end]
for i=length(y)-m+1:length(y)
ys[i] = sum(a.*(i-length(y)+m).^[0:length(a)-1])
end
if multi == 1
return ys
else
return sgolayfilt(ys,N,deg=deg,diff=0,multi=multi-1)
end
end
function sgolayfilt{T<:Real}(x::Array{T,1},y::Array{T,1},N::Int64;deg::Int64=2,diff::Int64=0)
#Check input
if diff > deg
error("Differential order cannot exceed polynomial fit degree.")
end
m::Int64 = div(N-1,2)
if 2*m+1 <= deg
error("Fitting window N = $N is too small for polynomial fit of degree $deg.")
end
if multi < 1
error("Number of times to filter must be at least 1.")
end
#Initiate
ys::Array{Float64,1} = Array(Float64,length(y))
#Starting
C::Array{Float64,2} = sgolaycoeff(x[1:2m+1],deg,diff)
a::Array{Float64,1} = C*y[1:2m+1]
for i=1:m
ys[i] = sum(a.*x[i].^[0:length(a)-1])
end
#Middle
for i=m+1:length(y)-m
C = sgolaycoeff(x[i-m:i+m],deg,diff)
a = C*y[i-m:i+m]
ys[i] = sum(a.*x[i].^[0:length(a)-1])
end
#Ending
C = sgolaycoeff(x[end-2*m:end],deg,diff)
a = C*y[end-2*m:end]
for i=length(y)-m+1:length(y)
ys[i] = sum(a.*x[i].^[0:length(a)-1])
end
if multi == 1
return ys
else
return sgolayfilt(ys,N,deg=deg,diff=0,multi=multi-1)
end
end
# #############################################################################
#Robust Local Weighted Scatter-plot Smooth
function robust_lowess{T}(y::Array{T,1},N::Int64;deg::Int64=1,robust::Bool=true)
#Initiate
ys::Array{Float64,1} = Array(Float64,length(y))
w::Array{Float64,1} = Array(Float64,N)
s::Int64 = floor((N-1)/2)
#Modelling function
f(x::Array,p::Array{Float64,1}) = sum(broadcast(^,x,transpose([0:length(p)-1]))*p,2)
f(x::Int64,p::Array{Float64,1}) = sum(p.*x.^[0:length(p)-1])
#Conduct regression
for i=1:length(y)
#Get regression region
if s > i-1
range::Array{Int64,1} = [1:N]
elseif s > length(y)-i
range = [(length(y)-N+1):length(y)]
else
range = [(i-s):(i+s)]
end
#Compute local weights
w = (1-(abs(range-i)/maximum(abs(range-i))).^3).^3
#Conduct fit
if length(range) == 1
#Fit is always exact
ys[i] = y[i]
else
p0::Array{Float64,1} = zeros(Float64,minimum([deg+1,length(range)-1]))
fit = LsqFit.curve_fit(f,range-i,y[range],w,p0)
ys[i] = fit.param[1]
end
end
if !robust; return ys; end
for iter=1:5
#Find outliers
resid::Array{Float64,1} = ys-y
madev6::Float64 = 6*median(abs(resid))
inliers::Array{Bool,1} = (abs(resid) .< madev6)
#Compute Robust weights
rw::Array{Float64,1} = zeros(Float64,length(y))
rw[inliers] = (1-(resid/madev6).^2).^2
#Conduct regression
for i=1:length(y)
#Get regression region
if s > i-1
range::Array{Int64,1} = [1:N]
elseif s > length(y)-i
range = [(length(y)-N+1):length(y)]
else
range = [(i-s):(i+s)]
end
#Compute local weights
w = (1-(abs(range-i)/maximum(abs(range-i))).^3).^3
#Conduct fit
if length(range) == 1
#Fit is always exact
ys[i] = y[i]
else
p0::Array{Float64,1} = zeros(Float64,minimum([deg+1,length(range)-1]))
fit = LsqFit.curve_fit(f,range-i,y[range],w.*rw[range],p0)
ys[i] = fit.param[1]
end
end
end
return ys
end | [
11748,
406,
31166,
31805,
198,
198,
2,
1303,
29113,
29113,
7804,
4242,
198,
2,
33622,
2811,
25431,
198,
198,
2,
44836,
8106,
198,
8818,
1409,
615,
70,
69,
2326,
90,
51,
92,
7,
88,
3712,
19182,
90,
51,
11,
16,
5512,
45,
3712,
5317,
2414,
8,
198,
220,
220,
220,
1303,
28350,
25,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
1409,
615,
70,
69,
2326,
7,
88,
11,
45,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
331,
220,
220,
220,
220,
220,
220,
26484,
284,
307,
32746,
704,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
399,
220,
220,
220,
220,
220,
220,
12849,
286,
4324,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
331,
82,
220,
220,
220,
220,
220,
2439,
1025,
704,
5072,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
818,
8846,
378,
198,
220,
220,
220,
331,
82,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
15690,
7,
43879,
2414,
11,
13664,
7,
88,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
7293,
1133,
1612,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
264,
3712,
5317,
2414,
796,
5288,
26933,
28300,
19510,
45,
12,
16,
20679,
17,
828,
72,
12,
16,
11,
13664,
7,
88,
13219,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
88,
58,
72,
12,
82,
25,
72,
10,
82,
12962,
29006,
17,
9,
82,
10,
16,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
331,
82,
198,
437,
198,
198,
2,
1303,
29113,
29113,
7804,
4242,
198,
2,
47362,
4224,
15688,
12,
38,
349,
323,
25431,
198,
198,
2,
3855,
44036,
198,
8818,
264,
70,
349,
323,
1073,
14822,
90,
51,
27,
25,
15633,
92,
7,
89,
3712,
19182,
90,
51,
11,
16,
5512,
13500,
3712,
5317,
2414,
11,
26069,
3712,
5317,
2414,
28,
15,
8,
198,
220,
220,
220,
1303,
28350,
25,
220,
198,
220,
220,
220,
1303,
220,
220,
327,
796,
264,
70,
349,
323,
1073,
14822,
7,
89,
11,
13500,
8,
198,
220,
220,
220,
1303,
220,
220,
327,
796,
264,
70,
349,
323,
1073,
14822,
7,
89,
11,
13500,
11,
26069,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
1976,
220,
220,
220,
220,
220,
220,
376,
2535,
4324,
357,
1533,
25,
25915,
20,
25,
20,
12962,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
3396,
220,
220,
220,
220,
34486,
286,
745,
6213,
49070,
329,
4197,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
814,
220,
220,
220,
7913,
286,
1180,
40356,
357,
27238,
307,
19841,
3396,
11,
4277,
657,
329,
220,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32746,
722,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
327,
220,
220,
220,
220,
220,
220,
24936,
329,
25449,
4324,
3815,
284,
745,
6213,
49070,
44036,
11,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
810,
357,
72,
11,
73,
8,
400,
5726,
318,
262,
33090,
284,
262,
474,
400,
1988,
329,
262,
220,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
72,
12,
16,
8,
1502,
3381,
287,
262,
15830,
745,
6213,
49070,
13,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
9787,
5128,
198,
220,
220,
220,
6818,
7,
26069,
19841,
3396,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
50,
6442,
3487,
27490,
198,
220,
220,
220,
449,
3712,
19182,
90,
51,
11,
17,
92,
796,
7025,
7,
61,
11,
89,
11,
7645,
3455,
7,
15,
25,
13500,
4008,
198,
220,
220,
220,
449,
83,
3712,
19182,
90,
51,
11,
17,
92,
796,
1007,
3455,
7,
41,
8,
198,
220,
220,
220,
327,
3712,
19182,
90,
43879,
2414,
11,
17,
92,
796,
800,
7,
41,
83,
9,
41,
27493,
41,
83,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
3855,
44036,
329,
28486,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
26069,
198,
220,
220,
220,
220,
220,
220,
220,
327,
796,
7025,
46491,
17414,
16,
25,
7857,
7,
34,
11,
16,
13219,
16,
4357,
34,
58,
17,
25,
437,
11,
25,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
327,
198,
437,
198,
198,
2,
44836,
8106,
198,
8818,
264,
70,
349,
323,
69,
2326,
90,
51,
27,
25,
15633,
92,
7,
88,
3712,
19182,
90,
51,
11,
16,
5512,
45,
3712,
5317,
2414,
26,
13500,
3712,
5317,
2414,
28,
17,
11,
26069,
3712,
5317,
2414,
28,
15,
11,
41684,
3712,
5317,
2414,
28,
16,
8,
198,
220,
220,
220,
1303,
28350,
25,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
264,
70,
349,
323,
69,
2326,
7,
88,
11,
45,
8,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
264,
70,
349,
323,
69,
2326,
7,
87,
11,
88,
11,
45,
8,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
264,
70,
349,
323,
69,
2326,
7,
986,
11,
3396,
28,
13500,
8,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
264,
70,
349,
323,
69,
2326,
7,
986,
11,
814,
28,
26069,
8,
198,
220,
220,
220,
1303,
220,
220,
331,
82,
796,
264,
70,
349,
323,
69,
2326,
7,
986,
11,
5021,
28,
41684,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
331,
220,
220,
220,
220,
220,
220,
26484,
284,
307,
32746,
704,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
399,
220,
220,
220,
220,
220,
220,
12849,
286,
4324,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
2124,
220,
220,
220,
220,
220,
220,
27484,
286,
6737,
2995,
357,
12286,
685,
16,
25,
13664,
7,
88,
15437,
329,
8187,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
3396,
220,
220,
220,
220,
34486,
286,
745,
6213,
49070,
329,
4197,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
814,
220,
220,
220,
7913,
286,
1180,
40356,
357,
27238,
307,
19841,
3396,
11,
4277,
657,
329,
220,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
32746,
722,
8,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
5021,
220,
220,
7913,
286,
1661,
284,
8106,
198,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
331,
82,
220,
220,
220,
220,
220,
2439,
1025,
704,
6737,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
9787,
5128,
198,
220,
220,
220,
611,
814,
1875,
3396,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
40341,
498,
1502,
2314,
7074,
745,
6213,
49070,
4197,
4922,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
285,
3712,
5317,
2414,
796,
2659,
7,
45,
12,
16,
11,
17,
8,
198,
220,
220,
220,
611,
362,
9,
76,
10,
16,
19841,
3396,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
37,
2535,
4324,
399,
796,
720,
45,
318,
1165,
1402,
329,
745,
6213,
49070,
4197,
286,
4922,
720,
13500,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
5021,
1279,
352,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
15057,
286,
1661,
284,
8106,
1276,
307,
379,
1551,
352,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
818,
8846,
378,
198,
220,
220,
220,
327,
3712,
19182,
90,
43879,
2414,
11,
17,
92,
796,
264,
70,
349,
323,
1073,
14822,
26933,
12,
76,
25,
76,
4357,
13500,
11,
26069,
8,
198,
220,
220,
220,
331,
82,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
15690,
7,
43879,
2414,
11,
13664,
7,
88,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
22851,
198,
220,
220,
220,
257,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
327,
9,
88,
58,
16,
25,
17,
76,
10,
16,
60,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
76,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
64,
15885,
7,
72,
12,
76,
12,
16,
737,
61,
58,
15,
25,
13664,
7,
64,
13219,
16,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
34621,
198,
220,
220,
220,
327,
16,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
327,
58,
16,
11,
25,
7131,
47715,
198,
220,
220,
220,
329,
1312,
28,
76,
10,
16,
25,
13664,
7,
88,
13219,
76,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
16605,
7,
34,
16,
11,
88,
58,
72,
12,
76,
25,
72,
10,
76,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
12915,
278,
198,
220,
220,
220,
257,
796,
327,
9,
88,
58,
437,
12,
17,
76,
25,
437,
60,
198,
220,
220,
220,
329,
1312,
28,
13664,
7,
88,
13219,
76,
10,
16,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
64,
15885,
7,
72,
12,
13664,
7,
88,
47762,
76,
737,
61,
58,
15,
25,
13664,
7,
64,
13219,
16,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
5021,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
331,
82,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
264,
70,
349,
323,
69,
2326,
7,
893,
11,
45,
11,
13500,
28,
13500,
11,
26069,
28,
15,
11,
41684,
28,
41684,
12,
16,
8,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
264,
70,
349,
323,
69,
2326,
90,
51,
27,
25,
15633,
92,
7,
87,
3712,
19182,
90,
51,
11,
16,
5512,
88,
3712,
19182,
90,
51,
11,
16,
5512,
45,
3712,
5317,
2414,
26,
13500,
3712,
5317,
2414,
28,
17,
11,
26069,
3712,
5317,
2414,
28,
15,
8,
198,
220,
220,
220,
1303,
9787,
5128,
198,
220,
220,
220,
611,
814,
1875,
3396,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
40341,
498,
1502,
2314,
7074,
745,
6213,
49070,
4197,
4922,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
285,
3712,
5317,
2414,
796,
2659,
7,
45,
12,
16,
11,
17,
8,
198,
220,
220,
220,
611,
362,
9,
76,
10,
16,
19841,
3396,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
37,
2535,
4324,
399,
796,
720,
45,
318,
1165,
1402,
329,
745,
6213,
49070,
4197,
286,
4922,
720,
13500,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
5021,
1279,
352,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
15057,
286,
1661,
284,
8106,
1276,
307,
379,
1551,
352,
19570,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
818,
8846,
378,
198,
220,
220,
220,
331,
82,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
15690,
7,
43879,
2414,
11,
13664,
7,
88,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
22851,
198,
220,
220,
220,
327,
3712,
19182,
90,
43879,
2414,
11,
17,
92,
796,
264,
70,
349,
323,
1073,
14822,
7,
87,
58,
16,
25,
17,
76,
10,
16,
4357,
13500,
11,
26069,
8,
198,
220,
220,
220,
257,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
327,
9,
88,
58,
16,
25,
17,
76,
10,
16,
60,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
76,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
64,
15885,
87,
58,
72,
4083,
61,
58,
15,
25,
13664,
7,
64,
13219,
16,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
34621,
198,
220,
220,
220,
329,
1312,
28,
76,
10,
16,
25,
13664,
7,
88,
13219,
76,
198,
220,
220,
220,
220,
220,
220,
220,
327,
796,
264,
70,
349,
323,
1073,
14822,
7,
87,
58,
72,
12,
76,
25,
72,
10,
76,
4357,
13500,
11,
26069,
8,
198,
220,
220,
220,
220,
220,
220,
220,
257,
796,
327,
9,
88,
58,
72,
12,
76,
25,
72,
10,
76,
60,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
64,
15885,
87,
58,
72,
4083,
61,
58,
15,
25,
13664,
7,
64,
13219,
16,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
12915,
278,
198,
220,
220,
220,
327,
796,
264,
70,
349,
323,
1073,
14822,
7,
87,
58,
437,
12,
17,
9,
76,
25,
437,
4357,
13500,
11,
26069,
8,
198,
220,
220,
220,
257,
796,
327,
9,
88,
58,
437,
12,
17,
9,
76,
25,
437,
60,
198,
220,
220,
220,
329,
1312,
28,
13664,
7,
88,
13219,
76,
10,
16,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
2160,
7,
64,
15885,
87,
58,
72,
4083,
61,
58,
15,
25,
13664,
7,
64,
13219,
16,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
5021,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
331,
82,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
264,
70,
349,
323,
69,
2326,
7,
893,
11,
45,
11,
13500,
28,
13500,
11,
26069,
28,
15,
11,
41684,
28,
41684,
12,
16,
8,
198,
220,
220,
220,
886,
198,
437,
628,
198,
2,
1303,
29113,
29113,
7804,
4242,
198,
2,
14350,
436,
10714,
14331,
276,
1446,
1436,
12,
29487,
37002,
198,
8818,
12373,
62,
9319,
408,
90,
51,
92,
7,
88,
3712,
19182,
90,
51,
11,
16,
5512,
45,
3712,
5317,
2414,
26,
13500,
3712,
5317,
2414,
28,
16,
11,
22609,
436,
3712,
33,
970,
28,
7942,
8,
198,
220,
220,
220,
1303,
818,
8846,
378,
198,
220,
220,
220,
331,
82,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
15690,
7,
43879,
2414,
11,
13664,
7,
88,
4008,
198,
220,
220,
220,
266,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
15690,
7,
43879,
2414,
11,
45,
8,
198,
220,
220,
220,
264,
3712,
5317,
2414,
796,
4314,
19510,
45,
12,
16,
20679,
17,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
5841,
9417,
2163,
198,
220,
220,
220,
277,
7,
87,
3712,
19182,
11,
79,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
796,
2160,
7,
36654,
2701,
7,
61,
11,
87,
11,
7645,
3455,
26933,
15,
25,
13664,
7,
79,
13219,
16,
60,
4008,
9,
79,
11,
17,
8,
198,
220,
220,
220,
277,
7,
87,
3712,
5317,
2414,
11,
79,
3712,
19182,
90,
43879,
2414,
11,
16,
30072,
796,
2160,
7,
79,
15885,
87,
13,
61,
58,
15,
25,
13664,
7,
79,
13219,
16,
12962,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
34,
12920,
20683,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
3855,
20683,
3814,
198,
220,
220,
220,
220,
220,
220,
220,
611,
264,
1875,
1312,
12,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
3712,
19182,
90,
5317,
2414,
11,
16,
92,
796,
685,
16,
25,
45,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
264,
1875,
4129,
7,
88,
13219,
72,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
796,
47527,
13664,
7,
88,
13219,
45,
10,
16,
2599,
13664,
7,
88,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
796,
47527,
72,
12,
82,
2599,
7,
72,
10,
82,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7293,
1133,
1957,
19590,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
357,
16,
30420,
8937,
7,
9521,
12,
72,
20679,
47033,
7,
8937,
7,
9521,
12,
72,
4008,
737,
61,
18,
737,
61,
18,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
34,
12920,
4197,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
7,
9521,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
31805,
318,
1464,
2748,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
331,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
15,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
1976,
27498,
7,
43879,
2414,
11,
39504,
26933,
13500,
10,
16,
11,
13664,
7,
9521,
13219,
16,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4197,
796,
406,
31166,
31805,
13,
22019,
303,
62,
11147,
7,
69,
11,
9521,
12,
72,
11,
88,
58,
9521,
4357,
86,
11,
79,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
4197,
13,
17143,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
5145,
22609,
436,
26,
1441,
331,
82,
26,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
329,
11629,
28,
16,
25,
20,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16742,
41528,
3183,
198,
220,
220,
220,
220,
220,
220,
220,
15384,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
331,
82,
12,
88,
198,
220,
220,
220,
220,
220,
220,
220,
925,
85,
21,
3712,
43879,
2414,
796,
718,
9,
1150,
666,
7,
8937,
7,
411,
312,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
287,
75,
3183,
3712,
19182,
90,
33,
970,
11,
16,
92,
796,
357,
8937,
7,
411,
312,
8,
764,
27,
925,
85,
21,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
7293,
1133,
3851,
436,
19590,
198,
220,
220,
220,
220,
220,
220,
220,
374,
86,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
1976,
27498,
7,
43879,
2414,
11,
13664,
7,
88,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
374,
86,
58,
259,
75,
3183,
60,
796,
357,
16,
30420,
411,
312,
14,
9727,
85,
21,
737,
61,
17,
737,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
34,
12920,
20683,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
28,
16,
25,
13664,
7,
88,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
3855,
20683,
3814,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
264,
1875,
1312,
12,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
3712,
19182,
90,
5317,
2414,
11,
16,
92,
796,
685,
16,
25,
45,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
264,
1875,
4129,
7,
88,
13219,
72,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
796,
47527,
13664,
7,
88,
13219,
45,
10,
16,
2599,
13664,
7,
88,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2837,
796,
47527,
72,
12,
82,
2599,
7,
72,
10,
82,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
7293,
1133,
1957,
19590,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
266,
796,
357,
16,
30420,
8937,
7,
9521,
12,
72,
20679,
47033,
7,
8937,
7,
9521,
12,
72,
4008,
737,
61,
18,
737,
61,
18,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
34,
12920,
4197,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
7,
9521,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
31805,
318,
1464,
2748,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
331,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
15,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
796,
1976,
27498,
7,
43879,
2414,
11,
39504,
26933,
13500,
10,
16,
11,
13664,
7,
9521,
13219,
16,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4197,
796,
406,
31166,
31805,
13,
22019,
303,
62,
11147,
7,
69,
11,
9521,
12,
72,
11,
88,
58,
9521,
4357,
86,
15885,
31653,
58,
9521,
4357,
79,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
82,
58,
72,
60,
796,
4197,
13,
17143,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
331,
82,
198,
437
] | 1.867383 | 3,725 |
##############################
# Mapping functions on Dicts #
##############################
function mapvals!(f, d)
for (k,v) in d
d[k] = f(v)
end
return d
end
mapvals(f, d) = Dict(zip(collect(keys(d)), map(f, collect(values(d)))))
mapkeys(f, d) = Dict(zip(map(f, collect(keys(d))), collect(values(d))))
mapkv(f, d) = Dict(map(f, collect(d)))
#############
# Filtering #
#############
Base.filter!(f::Function, kt::Ket) = (filter!(f, dict(kt)); return kt)
Base.filter!(f::Function, br::Bra) = (filter!((k,v)->f(k,v'), dict(br)); return br)
Base.filter!(f::Function, op::OpSum) = (filter!(f, dict(op)); return op)
Base.filter!(f::Function, opc::DualOpSum) = (filter!((k,v)->f(k',v'), dict(opc)); return opc)
Base.filter(f::Function, kt::Ket) = similar(kt, filter(f, dict(kt)))
Base.filter(f::Function, br::Bra) = similar(br, filter((k,v)->f(k,v'), dict(br)))
Base.filter(f::Function, op::OpSum) = similar(op, filter(f, dict(op)))
Base.filter(f::Function, opc::DualOpSum) = similar(opc, filter((k,v)->f(k',v'), dict(opc)))
Base.filter(f::Function, op::OuterProduct) = filter(f, convert(OpSum, op))
########################
# mapcoeffs!/mapcoeffs #
########################
mapcoeffs!(f::Union(Function,DataType), k::Ket) = (mapvals!(f, dict(k)); return k)
mapcoeffs!(f::Union(Function,DataType), b::Bra) = (mapvals!(v->f(v')', dict(b)); return b)
mapcoeffs!(f::Union(Function,DataType), op::OpSum) = (mapvals!(f, dict(op)); return op)
mapcoeffs!(f::Union(Function,DataType), opc::DualOpSum) = (mapvals!(v->f(v')', dict(opc)); return opc)
mapcoeffs(f::Union(Function,DataType), kt::Ket) = similar(kt, mapvals(f, dict(kt)))
mapcoeffs(f::Union(Function,DataType), br::Bra) = similar(br, mapvals(v->f(v')', dict(br)))
mapcoeffs(f::Union(Function,DataType), op::OpSum) = similar(op, mapvals(f, dict(op)))
mapcoeffs(f::Union(Function,DataType), opc::DualOpSum) = similar(opc, mapvals(v->f(v')', dict(opc)))
mapcoeffs(f::Union(Function,DataType), op::OuterProduct) = mapcoeffs(f, convert(OpSum, op))
########################
# maplabels!/maplabels #
########################
maplabels(f::Union(Function,DataType), s::DiracState) = similar(s, mapkeys(f, dict(s)))
maplabels(f::Union(Function,DataType), op::OpSum) = similar(op, mapkeys(f, dict(op)))
maplabels(f::Union(Function,DataType), opc::DualOpSum) = OpSum(ptype(opc), mapkeys(label->f(label'), dict(op)))
maplabels(f::Union(Function,DataType), op::OuterProduct) = maplabels(f, convert(OpSum, op))
#######
# map #
#######
Base.map(f::Union(Function,DataType), obj::AbstractDirac) = similar(obj, mapkv(kv->f(kv[1], kv[2]), dict(obj)))
Base.map(f::Union(Function,DataType), br::Bra) = similar(br, mapkv(kv->br_tup(f(kv[1], kv[2]')), dict(d)))
Base.map(f::Union(Function,DataType), opc::DualOpSum) = OpSum(ptype(opc), mapkv(kv->f(kv[1]', kv[2]'), dict(d)))
Base.map(f::Union(Function,DataType), op::OuterProduct) = map(f, convert(OpSum, op))
br_tup(tup) = (tup[1], tup[2]')
export maplabels!,
mapcoeffs!,
maplabels,
mapcoeffs | [
14468,
7804,
4242,
2235,
198,
2,
337,
5912,
5499,
319,
360,
14137,
1303,
198,
14468,
7804,
4242,
2235,
198,
8818,
3975,
12786,
0,
7,
69,
11,
288,
8,
198,
220,
220,
220,
329,
357,
74,
11,
85,
8,
287,
288,
198,
220,
220,
220,
220,
220,
220,
220,
288,
58,
74,
60,
796,
277,
7,
85,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
288,
198,
437,
198,
8899,
12786,
7,
69,
11,
288,
8,
796,
360,
713,
7,
13344,
7,
33327,
7,
13083,
7,
67,
36911,
3975,
7,
69,
11,
2824,
7,
27160,
7,
67,
4008,
22305,
198,
198,
8899,
13083,
7,
69,
11,
288,
8,
796,
360,
713,
7,
13344,
7,
8899,
7,
69,
11,
2824,
7,
13083,
7,
67,
4008,
828,
2824,
7,
27160,
7,
67,
35514,
198,
8899,
74,
85,
7,
69,
11,
288,
8,
796,
360,
713,
7,
8899,
7,
69,
11,
2824,
7,
67,
22305,
198,
198,
7804,
4242,
2,
198,
2,
7066,
20212,
1303,
198,
7804,
4242,
2,
198,
14881,
13,
24455,
0,
7,
69,
3712,
22203,
11,
479,
83,
3712,
42,
316,
8,
796,
357,
24455,
0,
7,
69,
11,
8633,
7,
21841,
18125,
1441,
479,
83,
8,
198,
14881,
13,
24455,
0,
7,
69,
3712,
22203,
11,
865,
3712,
42333,
8,
796,
357,
24455,
0,
19510,
74,
11,
85,
8,
3784,
69,
7,
74,
11,
85,
33809,
8633,
7,
1671,
18125,
1441,
865,
8,
198,
14881,
13,
24455,
0,
7,
69,
3712,
22203,
11,
1034,
3712,
18257,
13065,
8,
796,
357,
24455,
0,
7,
69,
11,
8633,
7,
404,
18125,
1441,
1034,
8,
198,
14881,
13,
24455,
0,
7,
69,
3712,
22203,
11,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
357,
24455,
0,
19510,
74,
11,
85,
8,
3784,
69,
7,
74,
3256,
85,
33809,
8633,
7,
404,
66,
18125,
1441,
1034,
66,
8,
198,
198,
14881,
13,
24455,
7,
69,
3712,
22203,
11,
479,
83,
3712,
42,
316,
8,
796,
2092,
7,
21841,
11,
8106,
7,
69,
11,
8633,
7,
21841,
22305,
198,
14881,
13,
24455,
7,
69,
3712,
22203,
11,
865,
3712,
42333,
8,
796,
2092,
7,
1671,
11,
8106,
19510,
74,
11,
85,
8,
3784,
69,
7,
74,
11,
85,
33809,
8633,
7,
1671,
22305,
198,
14881,
13,
24455,
7,
69,
3712,
22203,
11,
1034,
3712,
18257,
13065,
8,
796,
2092,
7,
404,
11,
8106,
7,
69,
11,
8633,
7,
404,
22305,
198,
14881,
13,
24455,
7,
69,
3712,
22203,
11,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
2092,
7,
404,
66,
11,
8106,
19510,
74,
11,
85,
8,
3784,
69,
7,
74,
3256,
85,
33809,
8633,
7,
404,
66,
22305,
198,
14881,
13,
24455,
7,
69,
3712,
22203,
11,
1034,
3712,
7975,
263,
15667,
8,
796,
8106,
7,
69,
11,
10385,
7,
18257,
13065,
11,
1034,
4008,
198,
198,
14468,
7804,
198,
2,
3975,
1073,
14822,
82,
48443,
8899,
1073,
14822,
82,
1303,
198,
14468,
7804,
198,
8899,
1073,
14822,
82,
0,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
479,
3712,
42,
316,
8,
796,
357,
8899,
12786,
0,
7,
69,
11,
8633,
7,
74,
18125,
1441,
479,
8,
198,
8899,
1073,
14822,
82,
0,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
275,
3712,
42333,
8,
796,
357,
8899,
12786,
0,
7,
85,
3784,
69,
7,
85,
11537,
3256,
8633,
7,
65,
18125,
1441,
275,
8,
198,
8899,
1073,
14822,
82,
0,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
18257,
13065,
8,
796,
357,
8899,
12786,
0,
7,
69,
11,
8633,
7,
404,
18125,
1441,
1034,
8,
198,
8899,
1073,
14822,
82,
0,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
357,
8899,
12786,
0,
7,
85,
3784,
69,
7,
85,
11537,
3256,
8633,
7,
404,
66,
18125,
1441,
1034,
66,
8,
198,
198,
8899,
1073,
14822,
82,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
479,
83,
3712,
42,
316,
8,
796,
2092,
7,
21841,
11,
3975,
12786,
7,
69,
11,
8633,
7,
21841,
22305,
198,
8899,
1073,
14822,
82,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
865,
3712,
42333,
8,
796,
2092,
7,
1671,
11,
3975,
12786,
7,
85,
3784,
69,
7,
85,
11537,
3256,
8633,
7,
1671,
22305,
198,
8899,
1073,
14822,
82,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
18257,
13065,
8,
796,
2092,
7,
404,
11,
3975,
12786,
7,
69,
11,
8633,
7,
404,
22305,
198,
8899,
1073,
14822,
82,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
2092,
7,
404,
66,
11,
3975,
12786,
7,
85,
3784,
69,
7,
85,
11537,
3256,
8633,
7,
404,
66,
22305,
198,
8899,
1073,
14822,
82,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
7975,
263,
15667,
8,
796,
3975,
1073,
14822,
82,
7,
69,
11,
10385,
7,
18257,
13065,
11,
1034,
4008,
198,
198,
14468,
7804,
198,
2,
17266,
489,
397,
1424,
48443,
2611,
489,
397,
1424,
1303,
198,
14468,
7804,
198,
2611,
489,
397,
1424,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
264,
3712,
35277,
330,
9012,
8,
796,
2092,
7,
82,
11,
3975,
13083,
7,
69,
11,
8633,
7,
82,
22305,
198,
2611,
489,
397,
1424,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
18257,
13065,
8,
796,
2092,
7,
404,
11,
3975,
13083,
7,
69,
11,
8633,
7,
404,
22305,
198,
2611,
489,
397,
1424,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
8670,
13065,
7,
457,
2981,
7,
404,
66,
828,
3975,
13083,
7,
18242,
3784,
69,
7,
18242,
33809,
8633,
7,
404,
22305,
198,
2611,
489,
397,
1424,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
7975,
263,
15667,
8,
796,
17266,
489,
397,
1424,
7,
69,
11,
10385,
7,
18257,
13065,
11,
1034,
4008,
198,
198,
4242,
21017,
198,
2,
3975,
1303,
198,
4242,
21017,
198,
14881,
13,
8899,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
26181,
3712,
23839,
35277,
330,
8,
796,
2092,
7,
26801,
11,
3975,
74,
85,
7,
74,
85,
3784,
69,
7,
74,
85,
58,
16,
4357,
479,
85,
58,
17,
46570,
8633,
7,
26801,
22305,
198,
14881,
13,
8899,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
865,
3712,
42333,
8,
796,
2092,
7,
1671,
11,
3975,
74,
85,
7,
74,
85,
3784,
1671,
62,
83,
929,
7,
69,
7,
74,
85,
58,
16,
4357,
479,
85,
58,
17,
60,
11537,
828,
8633,
7,
67,
22305,
198,
14881,
13,
8899,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
66,
3712,
36248,
18257,
13065,
8,
796,
8670,
13065,
7,
457,
2981,
7,
404,
66,
828,
3975,
74,
85,
7,
74,
85,
3784,
69,
7,
74,
85,
58,
16,
60,
3256,
479,
85,
58,
17,
60,
33809,
8633,
7,
67,
22305,
198,
14881,
13,
8899,
7,
69,
3712,
38176,
7,
22203,
11,
6601,
6030,
828,
1034,
3712,
7975,
263,
15667,
8,
796,
3975,
7,
69,
11,
10385,
7,
18257,
13065,
11,
1034,
4008,
198,
198,
1671,
62,
83,
929,
7,
83,
929,
8,
796,
357,
83,
929,
58,
16,
4357,
256,
929,
58,
17,
60,
11537,
198,
198,
39344,
17266,
489,
397,
1424,
28265,
198,
220,
220,
220,
3975,
1073,
14822,
82,
28265,
198,
220,
220,
220,
17266,
489,
397,
1424,
11,
198,
220,
220,
220,
3975,
1073,
14822,
82
] | 2.400319 | 1,254 |
abstract type AngularQuadrature end
abstract type UnstructuredMesh_2D end
abstract type LinearUnstructuredMesh_2D <: UnstructuredMesh_2D end
abstract type QuadraticUnstructuredMesh_2D <: UnstructuredMesh_2D end
| [
397,
8709,
2099,
28147,
4507,
41909,
1300,
886,
198,
397,
8709,
2099,
791,
7249,
1522,
37031,
62,
17,
35,
886,
198,
397,
8709,
2099,
44800,
3118,
7249,
1522,
37031,
62,
17,
35,
1279,
25,
791,
7249,
1522,
37031,
62,
17,
35,
886,
198,
397,
8709,
2099,
20648,
81,
1512,
3118,
7249,
1522,
37031,
62,
17,
35,
1279,
25,
791,
7249,
1522,
37031,
62,
17,
35,
886,
198
] | 3.149254 | 67 |
module Sparse
using SparseArrays
"""
Allocates a block sparse matrix that stores nnz non-zero entries.
The matrix contains only zeros after allocation.
Input:
rows: A vector describing the number of elements in each block row the
block matrix has.
columns: A vector describing the number of elements in each block column the
block matrix has.
Output:
Z: Sparse matrix (all zeros)
Example:
>> Z = block_matrix([2, 3],[2, 3])
>> size(Z)
ans =
5 5
"""
function block_matrix(rows::AbstractArray, columns::AbstractArray)
m = sum(rows);
n = sum(columns);
Z = spzeros(m,n);
return Z
end
"""
Z = block_matrix_insert(B,rows,columns,block)
Inserts a submatrix into a block matrix at block position (i,j)
Input:
B: Block matrix (see block_matrix.m for a description).
rows: Number of elements in each block row of the block matrix.
columns: Number of elements in each block row of the block matrix.
i,j: Block indices denoting where the submatrix should be placed.
block: The submatrix to insert into the block matrix.
The size of the submatrix must match the number given in rows(i)
and columns(j).
Example:
>> Z = block_matrix([2, 3],[2, 3])
>> B = block_matrix_insert(Z,[2, 3],[2, 3],1,2,ones(2,3))
>> B
B =
(1,3) 1
(2,3) 1
(1,4) 1
(2,4) 1
(1,5) 1
(2,5) 1
>> full(B)
ans =
0 0 1 1 1
0 0 1 1 1
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
"""
function block_matrix_insert(B::AbstractArray,
rows::AbstractArray,
columns::AbstractArray,
i::Int64,
j::Int64,
block::AbstractArray)
@assert(i <= length(rows), "Index out of bounds.")
@assert(j <= length(columns), "Index out of bounds.")
@assert(size(block,1) == rows[i], "Dimension mismatch")
@assert(size(block,2) == columns[j],"Dimension mismatch")
r = vcat([1],rows)
c = vcat([1],columns)
row_offset = sum(r[1:i])
col_offset = sum(c[1:j])
B[row_offset:row_offset+r[i+1]-1,col_offset:col_offset+c[j+1]-1] = block
return B
end
function block_matrix_2x2(a11::AbstractArray,
a12::AbstractArray,
a21::AbstractArray,
a22::AbstractArray)
m1 = size(a11, 1)
n1 = size(a11, 2)
m2 = size(a22, 1)
n2 = size(a22, 2)
@assert size(a12, 1) == size(a11, 1)
@assert size(a12, 2) == size(a22, 2)
@assert size(a21, 1) == size(a22, 1)
@assert size(a21, 2) == size(a11, 2)
rows = [m1, m2]
cols = [n1, n2]
A = block_matrix(rows, cols)
A = block_matrix_insert(A, rows, cols, 1, 1, a11)
A = block_matrix_insert(A, rows, cols, 1, 2, a12)
A = block_matrix_insert(A, rows, cols, 2, 1, a21)
A = block_matrix_insert(A, rows, cols, 2, 2, a22)
return A
end
function diag_block_matrix_2x2(a11::AbstractArray,
a22::AbstractArray)
m1 = size(a11, 1)
n1 = size(a11, 2)
m2 = size(a22, 1)
n2 = size(a22, 2)
rows = [m1, m2]
cols = [n1, n2]
A = block_matrix(rows, cols)
A = block_matrix_insert(A, rows, cols, 1, 1, a11)
A = block_matrix_insert(A, rows, cols, 2, 2, a22)
return A
end
end
| [
21412,
1338,
17208,
198,
3500,
1338,
17208,
3163,
20477,
628,
198,
37811,
198,
1439,
420,
689,
257,
2512,
29877,
17593,
326,
7000,
299,
27305,
1729,
12,
22570,
12784,
13,
220,
198,
383,
17593,
4909,
691,
1976,
27498,
706,
20157,
13,
628,
23412,
25,
198,
220,
220,
220,
15274,
25,
317,
15879,
12059,
262,
1271,
286,
4847,
287,
1123,
2512,
5752,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
17593,
468,
13,
198,
15180,
25,
317,
15879,
12059,
262,
1271,
286,
4847,
287,
1123,
2512,
5721,
262,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
17593,
468,
13,
628,
25235,
25,
198,
220,
220,
220,
220,
220,
220,
1168,
25,
1338,
17208,
17593,
357,
439,
1976,
27498,
8,
628,
17934,
25,
220,
220,
198,
9609,
1168,
796,
2512,
62,
6759,
8609,
26933,
17,
11,
513,
38430,
17,
11,
513,
12962,
198,
9609,
2546,
7,
57,
8,
198,
220,
198,
9093,
796,
198,
220,
198,
220,
220,
220,
220,
220,
642,
220,
220,
220,
220,
642,
198,
37811,
198,
8818,
2512,
62,
6759,
8609,
7,
8516,
3712,
23839,
19182,
11,
15180,
3712,
23839,
19182,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
796,
2160,
7,
8516,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
299,
796,
2160,
7,
28665,
82,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1168,
796,
599,
9107,
418,
7,
76,
11,
77,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1168,
198,
437,
628,
198,
37811,
198,
1168,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
33,
11,
8516,
11,
28665,
82,
11,
9967,
8,
198,
35835,
82,
257,
850,
6759,
8609,
656,
257,
2512,
17593,
379,
2512,
2292,
357,
72,
11,
73,
8,
628,
23412,
25,
198,
220,
220,
220,
220,
220,
220,
347,
25,
9726,
17593,
357,
3826,
2512,
62,
6759,
8609,
13,
76,
329,
257,
6764,
737,
198,
220,
220,
220,
15274,
25,
7913,
286,
4847,
287,
1123,
2512,
5752,
286,
262,
2512,
17593,
13,
198,
15180,
25,
7913,
286,
4847,
287,
1123,
2512,
5752,
286,
262,
2512,
17593,
13,
198,
220,
220,
220,
220,
1312,
11,
73,
25,
9726,
36525,
2853,
10720,
810,
262,
850,
6759,
8609,
815,
307,
4624,
13,
198,
220,
220,
2512,
25,
383,
850,
6759,
8609,
284,
7550,
656,
262,
2512,
17593,
13,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
383,
2546,
286,
262,
850,
6759,
8609,
1276,
2872,
262,
1271,
1813,
287,
15274,
7,
72,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
290,
15180,
7,
73,
737,
628,
17934,
25,
198,
9609,
1168,
796,
2512,
62,
6759,
8609,
26933,
17,
11,
513,
38430,
17,
11,
513,
12962,
198,
9609,
347,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
57,
17414,
17,
11,
513,
38430,
17,
11,
513,
4357,
16,
11,
17,
11,
1952,
7,
17,
11,
18,
4008,
198,
9609,
347,
198,
220,
198,
347,
796,
198,
220,
198,
220,
220,
220,
357,
16,
11,
18,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
357,
17,
11,
18,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
357,
16,
11,
19,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
357,
17,
11,
19,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
357,
16,
11,
20,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
220,
220,
220,
357,
17,
11,
20,
8,
220,
220,
220,
220,
220,
220,
220,
352,
198,
4211,
1336,
7,
33,
8,
198,
198,
504,
796,
628,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
352,
220,
220,
220,
220,
352,
220,
220,
220,
220,
352,
198,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
352,
220,
220,
220,
220,
352,
220,
220,
220,
220,
352,
198,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
198,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
198,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
220,
220,
220,
220,
657,
198,
37811,
198,
8818,
2512,
62,
6759,
8609,
62,
28463,
7,
33,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15274,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15180,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
3712,
5317,
2414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
474,
3712,
5317,
2414,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2512,
3712,
23839,
19182,
8,
628,
198,
198,
31,
30493,
7,
72,
19841,
4129,
7,
8516,
828,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
15732,
503,
286,
22303,
19570,
198,
31,
30493,
7,
73,
19841,
4129,
7,
28665,
82,
828,
220,
220,
220,
220,
220,
220,
366,
15732,
503,
286,
22303,
19570,
198,
31,
30493,
7,
7857,
7,
9967,
11,
16,
8,
6624,
15274,
58,
72,
4357,
220,
220,
366,
29271,
3004,
46318,
4943,
198,
31,
30493,
7,
7857,
7,
9967,
11,
17,
8,
6624,
15180,
58,
73,
17241,
29271,
3004,
46318,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
374,
796,
410,
9246,
26933,
16,
4357,
8516,
8,
198,
220,
220,
220,
220,
220,
220,
220,
269,
796,
410,
9246,
26933,
16,
4357,
28665,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5752,
62,
28968,
796,
2160,
7,
81,
58,
16,
25,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
951,
62,
28968,
796,
2160,
7,
66,
58,
16,
25,
73,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
347,
58,
808,
62,
28968,
25,
808,
62,
28968,
10,
81,
58,
72,
10,
16,
45297,
16,
11,
4033,
62,
28968,
25,
4033,
62,
28968,
10,
66,
58,
73,
10,
16,
45297,
16,
60,
796,
2512,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
347,
198,
437,
628,
198,
8818,
2512,
62,
6759,
8609,
62,
17,
87,
17,
7,
64,
1157,
3712,
23839,
19182,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
1065,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
2481,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
1828,
3712,
23839,
19182,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
16,
796,
2546,
7,
64,
1157,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
16,
796,
2546,
7,
64,
1157,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
17,
796,
2546,
7,
64,
1828,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
17,
796,
2546,
7,
64,
1828,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
2546,
7,
64,
1065,
11,
352,
8,
6624,
2546,
7,
64,
1157,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
2546,
7,
64,
1065,
11,
362,
8,
6624,
2546,
7,
64,
1828,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
2546,
7,
64,
2481,
11,
352,
8,
6624,
2546,
7,
64,
1828,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
2546,
7,
64,
2481,
11,
362,
8,
6624,
2546,
7,
64,
1157,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15274,
796,
685,
76,
16,
11,
285,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
951,
82,
796,
685,
77,
16,
11,
299,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
7,
8516,
11,
951,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
352,
11,
352,
11,
257,
1157,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
352,
11,
362,
11,
257,
1065,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
362,
11,
352,
11,
257,
2481,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
362,
11,
362,
11,
257,
1828,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
317,
198,
437,
198,
198,
8818,
2566,
363,
62,
9967,
62,
6759,
8609,
62,
17,
87,
17,
7,
64,
1157,
3712,
23839,
19182,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
1828,
3712,
23839,
19182,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
16,
796,
2546,
7,
64,
1157,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
16,
796,
2546,
7,
64,
1157,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
17,
796,
2546,
7,
64,
1828,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
17,
796,
2546,
7,
64,
1828,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15274,
796,
685,
76,
16,
11,
285,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
951,
82,
796,
685,
77,
16,
11,
299,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
7,
8516,
11,
951,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
352,
11,
352,
11,
257,
1157,
8,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
2512,
62,
6759,
8609,
62,
28463,
7,
32,
11,
15274,
11,
951,
82,
11,
362,
11,
362,
11,
257,
1828,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
317,
198,
437,
198,
198,
437,
198
] | 1.924379 | 1,891 |
const CPC = Ptr{Cvoid}
const CPCType = Cstring
abstract type AbstractPC{T} end
mutable struct PC{T} <: AbstractPC{T}
ptr::Ptr{Cvoid}
end
scalartype(::AbstractPC{T}) where {T} = T
@for_libpetsc begin
function PC{$PetscScalar}(comm::MPI.Comm)
pc = PC{$PetscScalar}(C_NULL)
@chk ccall((:PCCreate, $libpetsc), PetscErrorCode, (MPI.MPI_Comm, Ptr{CPC}), comm, pc)
finalizer(destroy, pc)
return pc
end
function PC(ksp::KSP{$PetscScalar})
pc = PC{$PetscScalar}(C_NULL)
@chk ccall((:KSPGetPC, $libpetsc), PetscErrorCode, (CKSP, Ptr{CPC}), ksp, pc)
incref(pc) # need to manually increment the reference counter
finalizer(destroy, pc)
return pc
end
function destroy(pc::AbstractPC{$PetscScalar})
finalized($petsclib) ||
@chk ccall((:PCDestroy, $libpetsc), PetscErrorCode, (Ptr{CPC},), pc)
return nothing
end
function settype!(pc::AbstractPC{$PetscScalar}, pctype::String)
@chk ccall((:PCSetType, $libpetsc), PetscErrorCode, (CPC, Cstring), pc, pctype)
return nothing
end
function setpc!(ksp::KSP{$PetscScalar}, pc::AbstractPC{$PetscScalar})
@chk ccall((:KSPSetPC, $libpetsc), PetscErrorCode, (CKSP, CPC), ksp, pc)
return nothing
end
function gettype(pc::AbstractPC{$PetscScalar})
t_r = Ref{CPCType}()
@chk ccall((:PCGetType, $libpetsc), PetscErrorCode, (CPC, Ptr{CPCType}), pc, t_r)
return unsafe_string(t_r[])
end
function view(pc::AbstractPC{$PetscScalar}, viewer::AbstractViewer{$PetscLib}=ViewerStdout($petsclib, getcomm(pc)))
@chk ccall((:PCView, $libpetsc), PetscErrorCode,
(CPC, CPetscViewer),
pc, viewer);
return nothing
end
end
Base.show(io::IO, pc::AbstractPC) = _show(io, pc)
| [
198,
9979,
41190,
796,
350,
2213,
90,
34,
19382,
92,
198,
9979,
16932,
4177,
2981,
796,
327,
8841,
198,
198,
397,
8709,
2099,
27741,
5662,
90,
51,
92,
886,
198,
198,
76,
18187,
2878,
4217,
90,
51,
92,
1279,
25,
27741,
5662,
90,
51,
92,
198,
220,
220,
220,
50116,
3712,
46745,
90,
34,
19382,
92,
198,
437,
198,
198,
1416,
282,
433,
2981,
7,
3712,
23839,
5662,
90,
51,
30072,
810,
1391,
51,
92,
796,
309,
198,
198,
31,
1640,
62,
8019,
79,
1039,
66,
2221,
628,
220,
220,
220,
2163,
4217,
90,
3,
47,
1039,
66,
3351,
282,
283,
92,
7,
9503,
3712,
7378,
40,
13,
6935,
8,
198,
220,
220,
220,
220,
220,
220,
220,
40653,
796,
4217,
90,
3,
47,
1039,
66,
3351,
282,
283,
92,
7,
34,
62,
33991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
47,
4093,
260,
378,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
7378,
40,
13,
7378,
40,
62,
6935,
11,
350,
2213,
90,
34,
5662,
92,
828,
725,
11,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2457,
7509,
7,
41659,
11,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
40653,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
4217,
7,
591,
79,
3712,
42,
4303,
90,
3,
47,
1039,
66,
3351,
282,
283,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
40653,
796,
4217,
90,
3,
47,
1039,
66,
3351,
282,
283,
92,
7,
34,
62,
33991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
42,
4303,
3855,
5662,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
34,
42,
4303,
11,
350,
2213,
90,
34,
5662,
92,
828,
479,
2777,
11,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1253,
69,
7,
14751,
8,
1303,
761,
284,
14500,
18703,
262,
4941,
3753,
198,
220,
220,
220,
220,
220,
220,
220,
2457,
7509,
7,
41659,
11,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
40653,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
4117,
7,
14751,
3712,
23839,
5662,
90,
3,
47,
1039,
66,
3351,
282,
283,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
32013,
16763,
79,
1039,
565,
571,
8,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
5662,
49174,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
46745,
90,
34,
5662,
5512,
828,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2147,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
900,
4906,
0,
7,
14751,
3712,
23839,
5662,
90,
3,
47,
1039,
66,
3351,
282,
283,
5512,
279,
310,
2981,
3712,
10100,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
5662,
7248,
6030,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
34,
5662,
11,
327,
8841,
828,
40653,
11,
279,
310,
2981,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2147,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
900,
14751,
0,
7,
591,
79,
3712,
42,
4303,
90,
3,
47,
1039,
66,
3351,
282,
283,
5512,
40653,
3712,
23839,
5662,
90,
3,
47,
1039,
66,
3351,
282,
283,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
27015,
3705,
316,
5662,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
34,
42,
4303,
11,
41190,
828,
479,
2777,
11,
40653,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2147,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
651,
4906,
7,
14751,
3712,
23839,
5662,
90,
3,
47,
1039,
66,
3351,
282,
283,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
256,
62,
81,
796,
6524,
90,
8697,
4177,
2981,
92,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
5662,
3855,
6030,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
357,
34,
5662,
11,
350,
2213,
90,
8697,
4177,
2981,
92,
828,
220,
40653,
11,
256,
62,
81,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
21596,
62,
8841,
7,
83,
62,
81,
58,
12962,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
1570,
7,
14751,
3712,
23839,
5662,
90,
3,
47,
1039,
66,
3351,
282,
283,
5512,
19091,
3712,
23839,
7680,
263,
90,
3,
47,
1039,
66,
25835,
92,
28,
7680,
263,
1273,
67,
448,
16763,
79,
1039,
565,
571,
11,
651,
9503,
7,
14751,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
354,
74,
269,
13345,
19510,
25,
5662,
7680,
11,
720,
8019,
79,
1039,
66,
828,
43578,
66,
12331,
10669,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
34,
5662,
11,
16932,
1039,
66,
7680,
263,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
40653,
11,
19091,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2147,
198,
220,
220,
220,
886,
198,
198,
437,
628,
198,
14881,
13,
12860,
7,
952,
3712,
9399,
11,
40653,
3712,
23839,
5662,
8,
796,
4808,
12860,
7,
952,
11,
40653,
8,
198
] | 2.035088 | 912 |
using Test
using SafeTestsets
@safetestset "Reference shapes tests" begin include("referenceshapes_test.jl") end
@safetestset "Domain tests" begin include("domain_test.jl") end
| [
3500,
6208,
198,
3500,
19978,
51,
3558,
1039,
198,
198,
31,
49585,
316,
395,
2617,
366,
26687,
15268,
5254,
1,
2221,
2291,
7203,
5420,
4972,
71,
7916,
62,
9288,
13,
20362,
4943,
886,
198,
198,
31,
49585,
316,
395,
2617,
366,
43961,
5254,
1,
2221,
2291,
7203,
27830,
62,
9288,
13,
20362,
4943,
886,
198
] | 3.254545 | 55 |
using Mimi
_default_years = 2000:2100
_default_regions = [:A, :B]
function run_getindex(; years = collect(_default_years), regions = _default_regions)
# Test with one scalar parameter, one 1-D timestep array, and one 2-D timestep array
types = [Mimi.ScalarModelParameter{Float64}, _get_timesteparray_type(years, 1), _get_timesteparray_type(years, 2)]
names = [:d1, :d2, :d3]
values = [
types[1](4.),
types[2](Array{Union{Missing, Float64}, 1}(rand(length(years)))),
types[3](Array{Union{Missing, Float64}, 2}(rand(length(years), length(regions))))
]
datum = NamedTuple{(names...,), Tuple{types...,}}(values)
clock = _get_clock(years)
while ! Mimi.finished(clock)
ts = Mimi.timestep(clock)
_run_timestep(datum, ts)
Mimi.advance(clock)
end
end
function _run_timestep(datum::NamedTuple, ts)
datum.d1
datum.d2[ts]
datum.d3[ts, :]
nothing
end
function _get_timesteparray_type(years, num_dims, dtype=Float64)
if Mimi.isuniform(years)
first, stepsize = Mimi.first_and_step(years)
last = years[last]
T = Mimi.TimestepArray{Mimi.FixedTimestep{first, stepsize, last}, Union{dtype, Missing}, num_dims}
else
T = Mimi.TimestepArray{Mimi.VariableTimestep{(years...,)}, Union{dtype, Missing}, num_dims}
end
return T
end
function _get_clock(years)
if Mimi.isuniform(years)
last = years[end]
first, stepsize = Mimi.first_and_step(years)
return Mimi.Clock{Mimi.FixedTimestep}(first, stepsize, last)
else
last_index = findfirst(isequal(last), years)
times = (years[1:last_index]...,)
return Mimi.Clock{Mimi.VariableTimestep}(times)
end
end | [
3500,
337,
25236,
198,
198,
62,
12286,
62,
19002,
796,
4751,
25,
2481,
405,
198,
62,
12286,
62,
2301,
507,
796,
685,
25,
32,
11,
1058,
33,
60,
198,
198,
8818,
1057,
62,
1136,
9630,
7,
26,
812,
796,
2824,
28264,
12286,
62,
19002,
828,
7652,
796,
4808,
12286,
62,
2301,
507,
8,
198,
220,
220,
220,
1303,
6208,
351,
530,
16578,
283,
11507,
11,
530,
352,
12,
35,
4628,
395,
538,
7177,
11,
290,
530,
362,
12,
35,
4628,
395,
538,
7177,
198,
220,
220,
220,
3858,
796,
685,
44,
25236,
13,
3351,
282,
283,
17633,
36301,
90,
43879,
2414,
5512,
4808,
1136,
62,
16514,
395,
538,
18747,
62,
4906,
7,
19002,
11,
352,
828,
4808,
1136,
62,
16514,
395,
538,
18747,
62,
4906,
7,
19002,
11,
362,
15437,
628,
220,
220,
220,
3891,
796,
685,
25,
67,
16,
11,
1058,
67,
17,
11,
1058,
67,
18,
60,
198,
220,
220,
220,
3815,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
3858,
58,
16,
16151,
19,
12179,
198,
220,
220,
220,
220,
220,
220,
220,
3858,
58,
17,
16151,
19182,
90,
38176,
90,
43730,
11,
48436,
2414,
5512,
352,
92,
7,
25192,
7,
13664,
7,
19002,
22305,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3858,
58,
18,
16151,
19182,
90,
38176,
90,
43730,
11,
48436,
2414,
5512,
362,
92,
7,
25192,
7,
13664,
7,
19002,
828,
4129,
7,
2301,
507,
35514,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
628,
220,
220,
220,
4818,
388,
796,
34441,
51,
29291,
90,
7,
14933,
986,
11,
828,
309,
29291,
90,
19199,
986,
11,
11709,
7,
27160,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
8801,
796,
4808,
1136,
62,
15750,
7,
19002,
8,
628,
220,
220,
220,
981,
5145,
337,
25236,
13,
43952,
7,
15750,
8,
198,
220,
220,
220,
220,
220,
220,
220,
40379,
796,
337,
25236,
13,
16514,
395,
538,
7,
15750,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5143,
62,
16514,
395,
538,
7,
19608,
388,
11,
40379,
8,
198,
220,
220,
220,
220,
220,
220,
220,
337,
25236,
13,
324,
19259,
7,
15750,
8,
198,
220,
220,
220,
886,
220,
198,
437,
220,
198,
198,
8818,
4808,
5143,
62,
16514,
395,
538,
7,
19608,
388,
3712,
45,
2434,
51,
29291,
11,
40379,
8,
198,
220,
220,
220,
4818,
388,
13,
67,
16,
198,
220,
220,
220,
4818,
388,
13,
67,
17,
58,
912,
60,
198,
220,
220,
220,
4818,
388,
13,
67,
18,
58,
912,
11,
1058,
60,
198,
220,
220,
220,
2147,
198,
437,
220,
198,
198,
8818,
4808,
1136,
62,
16514,
395,
538,
18747,
62,
4906,
7,
19002,
11,
997,
62,
67,
12078,
11,
288,
4906,
28,
43879,
2414,
8,
198,
220,
220,
220,
611,
337,
25236,
13,
271,
403,
6933,
7,
19002,
8,
198,
220,
220,
220,
220,
220,
220,
220,
717,
11,
4831,
1096,
796,
337,
25236,
13,
11085,
62,
392,
62,
9662,
7,
19002,
8,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
812,
58,
12957,
60,
198,
220,
220,
220,
220,
220,
220,
220,
309,
796,
337,
25236,
13,
14967,
395,
538,
19182,
90,
44,
25236,
13,
13715,
14967,
395,
538,
90,
11085,
11,
4831,
1096,
11,
938,
5512,
4479,
90,
67,
4906,
11,
25639,
5512,
997,
62,
67,
12078,
92,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
309,
796,
337,
25236,
13,
14967,
395,
538,
19182,
90,
44,
25236,
13,
43015,
14967,
395,
538,
90,
7,
19002,
986,
35751,
5512,
4479,
90,
67,
4906,
11,
25639,
5512,
997,
62,
67,
12078,
92,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
309,
198,
437,
220,
198,
198,
8818,
4808,
1136,
62,
15750,
7,
19002,
8,
198,
220,
220,
220,
611,
337,
25236,
13,
271,
403,
6933,
7,
19002,
8,
198,
220,
220,
220,
220,
220,
220,
220,
938,
796,
812,
58,
437,
60,
198,
220,
220,
220,
220,
220,
220,
220,
717,
11,
4831,
1096,
796,
337,
25236,
13,
11085,
62,
392,
62,
9662,
7,
19002,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
337,
25236,
13,
44758,
90,
44,
25236,
13,
13715,
14967,
395,
538,
92,
7,
11085,
11,
4831,
1096,
11,
938,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
938,
62,
9630,
796,
1064,
11085,
7,
786,
13255,
7,
12957,
828,
812,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1661,
796,
357,
19002,
58,
16,
25,
12957,
62,
9630,
60,
986,
35751,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
337,
25236,
13,
44758,
90,
44,
25236,
13,
43015,
14967,
395,
538,
92,
7,
22355,
8,
198,
220,
220,
220,
886,
198,
437
] | 2.223634 | 787 |
using ASTInterface
using Test
@testset "ASTInterface.jl" begin
# Write your tests here.
end
| [
3500,
29273,
39317,
201,
198,
3500,
6208,
201,
198,
201,
198,
31,
9288,
2617,
366,
11262,
39317,
13,
20362,
1,
2221,
201,
198,
220,
220,
220,
1303,
19430,
534,
5254,
994,
13,
201,
198,
437,
201,
198
] | 2.783784 | 37 |
Random.seed!(43)
X = randn(100, 20)
Xup = rand(25, 20)
l = size(Xup, 1) + 1
Xprim = vcat(X, Xup)[l:end,:]
@testset "data updat" begin
@test dataupdat(X, Xup) ≈ Xprim
end
@testset "moment updates" begin
x = ones(6, 2)
y = 2*ones(2,2)
M3 = moment(x, 3)
M4 = moment(x, 4)
M3up = momentupdat(M3, x, y)
@testset "simple test" begin
Mup = moment(dataupdat(x,y),3)
@test Array(Mup) ≈ Array(M3up)
x0 = Array{Float64}(undef, (0,0))
y0 = Array{Float64}(undef, (0,0))
@test M3 == momentupdat(M3, x0, y0)
end
@testset "moment array" begin
Ma = momentarray(x, 4, 2)
@test Array(Ma[3]) ≈ Array(M3)
@test Array(Ma[4]) ≈ Array(M4)
MM = momentupdat(Ma, x, y)
@test Array(M3up) ≈Array(MM[3])
end
end
@testset "moment exceptions" begin
x = ones(10,4);
y = 2*ones(5,3);
m = moment(x, 3);
@test_throws DimensionMismatch momentupdat(m, x, y)
y = 2*ones(5,4)
@test_throws DimensionMismatch momentupdat(m, x[:, 1:3], y)
y = 2*ones(15,4)
@test_throws BoundsError momentupdat(m, x, y)
end
@testset "moments to cumulants" begin
m1 = moment(X, 1)
m2 = moment(X, 2)
m3 = moment(X, 3)
m4 = moment(X, 4)
m5 = moment(X, 5)
c = cumulants(X, 5)
m2c = [m1, m2, m3, m4, m5]
@testset "moms2cums!" begin
moms2cums!(m2c)
@test Array(c[1]) ≈ Array(m2c[1])
@test Array(c[2]) ≈ Array(m2c[2])
@test Array(c[3]) ≈ Array(m2c[3])
@test Array(c[4]) ≈ Array(m2c[4])
@test Array(c[5]) ≈ Array(m2c[5])
end
@testset "cums2moms" begin
mm = cums2moms(c);
@test Array(mm[1]) ≈ Array(m1)
@test Array(mm[2]) ≈ Array(m2)
@test Array(mm[3]) ≈ Array(m3)
@test Array(mm[4]) ≈ Array(m4)
@test Array(mm[5]) ≈ Array(m5)
end
end
@testset "simple cumulants update" begin
x = ones(10, 3)
y = 2*ones(2,3)
s = DataMoments(x, 6, 2)
c2 = cumulantsupdate!(s, y)
xx = dataupdat(x,y)
c3 = cumulants(xx, 6)
@test Array(c2[1]) ≈ Array(c3[1])
@test Array(c2[2]) ≈ Array(c3[2])
@test Array(c2[3]) ≈ Array(c3[3])
@test Array(c2[4]) ≈ Array(c3[4])
@test Array(c2[5]) ≈ Array(c3[5])
@test Array(c2[6]) ≈ Array(c3[6])
end
@testset "cumulants updates larger data" begin
c = cumulants(X)
Xp = dataupdat(X, Xup)
s = DataMoments(X, 4, 4)
C = cumulantsupdate!(s, Xup)
@test s.X ≈ Xp
@test s.b == 4
@test s.d == 4
@test Array(s.M[4]) ≈ Array(moment(Xp, 4))
CC = cumulants(Xp, 4)
@test Array(C[3]) ≈ Array(CC[3])
@test Array(C[4]) ≈ Array(CC[4])
end
@testset "multiprocessing cumulants update" begin
addprocs(2)
eval(Expr(:toplevel, :(@everywhere using CumulantsUpdates)))
Xp = dataupdat(X, Xup)
s = DataMoments(X, 4, 4)
C = cumulantsupdate!(s, Xup)
@test s.X ≈ Xp
@test s.b == 4
@test s.d == 4
@test Array(s.M[4]) ≈ Array(moment(Xp, 4))
CC = cumulants(Xp, 4)
@test Array(C[3]) ≈ Array(CC[3])
@test Array(C[4]) ≈ Array(CC[4])
end
@testset "cumulants update exceptions" begin
x = ones(10,4);
y = 2*ones(5,3);
s = DataMoments(x, 4, 2)
@test_throws DimensionMismatch cumulantsupdate!(s, y)
y = 2*ones(15,4)
@test_throws BoundsError cumulantsupdate!(s, y)
s1 = DataMoments(x[:, 1:3], 4, 2)
y = 2*ones(5,4)
@test_throws UndefVarError cumulantsupdat(s1, y)
end
println(VERSION)
if VERSION <= v"1.6.1"
@testset "save and load" begin
x = ones(10,4);
s = DataMoments(x, 4, 2)
@test savedm(s, "/tmp/cumdata.jld2") == nothing
#println(load("/tmp/cumdata.jld2"))
s1 = loaddm("/tmp/cumdata.jld2")
@test s1.X == s.X
@test s1.d == s.d
@test s1.b == s.b
@test Array(s1.M[4]) == Array(s.M[4])
end
end
| [
29531,
13,
28826,
0,
7,
3559,
8,
198,
198,
55,
796,
43720,
77,
7,
3064,
11,
1160,
8,
198,
55,
929,
796,
43720,
7,
1495,
11,
1160,
8,
198,
75,
796,
2546,
7,
55,
929,
11,
352,
8,
1343,
352,
198,
55,
19795,
796,
410,
9246,
7,
55,
11,
1395,
929,
38381,
75,
25,
437,
11,
47715,
198,
31,
9288,
2617,
366,
7890,
2325,
265,
1,
2221,
198,
220,
2488,
9288,
4818,
559,
79,
19608,
7,
55,
11,
1395,
929,
8,
15139,
230,
1395,
19795,
198,
437,
628,
198,
31,
9288,
2617,
366,
32542,
298,
5992,
1,
2221,
198,
220,
2124,
796,
3392,
7,
21,
11,
362,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
17,
11,
17,
8,
198,
220,
337,
18,
796,
2589,
7,
87,
11,
513,
8,
198,
220,
337,
19,
796,
2589,
7,
87,
11,
604,
8,
198,
220,
337,
18,
929,
796,
2589,
929,
19608,
7,
44,
18,
11,
2124,
11,
331,
8,
198,
220,
2488,
9288,
2617,
366,
36439,
1332,
1,
2221,
198,
220,
220,
220,
337,
929,
796,
2589,
7,
19608,
559,
79,
19608,
7,
87,
11,
88,
828,
18,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
44,
929,
8,
15139,
230,
15690,
7,
44,
18,
929,
8,
198,
220,
220,
220,
2124,
15,
796,
15690,
90,
43879,
2414,
92,
7,
917,
891,
11,
357,
15,
11,
15,
4008,
198,
220,
220,
220,
331,
15,
796,
15690,
90,
43879,
2414,
92,
7,
917,
891,
11,
357,
15,
11,
15,
4008,
198,
220,
220,
220,
2488,
9288,
337,
18,
6624,
2589,
929,
19608,
7,
44,
18,
11,
2124,
15,
11,
331,
15,
8,
198,
220,
886,
198,
220,
2488,
9288,
2617,
366,
32542,
298,
7177,
1,
2221,
198,
220,
220,
220,
6669,
796,
2589,
18747,
7,
87,
11,
604,
11,
362,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
21467,
58,
18,
12962,
15139,
230,
15690,
7,
44,
18,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
21467,
58,
19,
12962,
15139,
230,
15690,
7,
44,
19,
8,
198,
220,
220,
220,
20806,
796,
2589,
929,
19608,
7,
21467,
11,
2124,
11,
331,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
44,
18,
929,
8,
15139,
230,
19182,
7,
12038,
58,
18,
12962,
198,
220,
886,
198,
437,
198,
198,
31,
9288,
2617,
366,
32542,
298,
13269,
1,
2221,
198,
220,
2124,
796,
3392,
7,
940,
11,
19,
1776,
198,
220,
331,
796,
362,
9,
1952,
7,
20,
11,
18,
1776,
198,
220,
285,
796,
2589,
7,
87,
11,
513,
1776,
198,
220,
2488,
9288,
62,
400,
8516,
34024,
44,
1042,
963,
2589,
929,
19608,
7,
76,
11,
2124,
11,
331,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
20,
11,
19,
8,
198,
220,
2488,
9288,
62,
400,
8516,
34024,
44,
1042,
963,
2589,
929,
19608,
7,
76,
11,
2124,
58,
45299,
352,
25,
18,
4357,
331,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
1314,
11,
19,
8,
198,
220,
2488,
9288,
62,
400,
8516,
347,
3733,
12331,
2589,
929,
19608,
7,
76,
11,
2124,
11,
331,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
32542,
658,
284,
10973,
377,
1187,
1,
2221,
198,
220,
285,
16,
796,
2589,
7,
55,
11,
352,
8,
198,
220,
285,
17,
796,
2589,
7,
55,
11,
362,
8,
198,
220,
285,
18,
796,
2589,
7,
55,
11,
513,
8,
198,
220,
285,
19,
796,
2589,
7,
55,
11,
604,
8,
198,
220,
285,
20,
796,
2589,
7,
55,
11,
642,
8,
198,
220,
269,
796,
10973,
377,
1187,
7,
55,
11,
642,
8,
198,
220,
285,
17,
66,
796,
685,
76,
16,
11,
285,
17,
11,
285,
18,
11,
285,
19,
11,
285,
20,
60,
198,
220,
2488,
9288,
2617,
366,
76,
3150,
17,
66,
5700,
2474,
2221,
198,
220,
220,
220,
34015,
17,
66,
5700,
0,
7,
76,
17,
66,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
66,
58,
16,
12962,
15139,
230,
15690,
7,
76,
17,
66,
58,
16,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
66,
58,
17,
12962,
15139,
230,
15690,
7,
76,
17,
66,
58,
17,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
66,
58,
18,
12962,
15139,
230,
15690,
7,
76,
17,
66,
58,
18,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
66,
58,
19,
12962,
15139,
230,
15690,
7,
76,
17,
66,
58,
19,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
66,
58,
20,
12962,
15139,
230,
15690,
7,
76,
17,
66,
58,
20,
12962,
198,
220,
886,
198,
220,
2488,
9288,
2617,
366,
66,
5700,
17,
76,
3150,
1,
2221,
198,
220,
220,
220,
8085,
796,
269,
5700,
17,
76,
3150,
7,
66,
1776,
198,
220,
220,
220,
2488,
9288,
15690,
7,
3020,
58,
16,
12962,
15139,
230,
15690,
7,
76,
16,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
3020,
58,
17,
12962,
15139,
230,
15690,
7,
76,
17,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
3020,
58,
18,
12962,
15139,
230,
15690,
7,
76,
18,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
3020,
58,
19,
12962,
15139,
230,
15690,
7,
76,
19,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
3020,
58,
20,
12962,
15139,
230,
15690,
7,
76,
20,
8,
198,
220,
886,
198,
437,
198,
198,
31,
9288,
2617,
366,
36439,
10973,
377,
1187,
4296,
1,
2221,
198,
220,
2124,
796,
3392,
7,
940,
11,
513,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
17,
11,
18,
8,
198,
220,
264,
796,
6060,
29252,
658,
7,
87,
11,
718,
11,
362,
8,
198,
220,
269,
17,
796,
10973,
377,
1187,
19119,
0,
7,
82,
11,
331,
8,
198,
220,
31383,
796,
4818,
559,
79,
19608,
7,
87,
11,
88,
8,
198,
220,
269,
18,
796,
10973,
377,
1187,
7,
5324,
11,
718,
8,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
16,
12962,
15139,
230,
15690,
7,
66,
18,
58,
16,
12962,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
17,
12962,
15139,
230,
15690,
7,
66,
18,
58,
17,
12962,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
18,
12962,
15139,
230,
15690,
7,
66,
18,
58,
18,
12962,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
19,
12962,
15139,
230,
15690,
7,
66,
18,
58,
19,
12962,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
20,
12962,
15139,
230,
15690,
7,
66,
18,
58,
20,
12962,
198,
220,
2488,
9288,
15690,
7,
66,
17,
58,
21,
12962,
15139,
230,
15690,
7,
66,
18,
58,
21,
12962,
198,
437,
628,
198,
31,
9288,
2617,
366,
36340,
377,
1187,
5992,
4025,
1366,
1,
2221,
198,
220,
220,
220,
269,
796,
10973,
377,
1187,
7,
55,
8,
198,
220,
220,
220,
1395,
79,
796,
4818,
559,
79,
19608,
7,
55,
11,
1395,
929,
8,
198,
220,
220,
220,
264,
796,
6060,
29252,
658,
7,
55,
11,
604,
11,
604,
8,
198,
220,
220,
220,
327,
796,
10973,
377,
1187,
19119,
0,
7,
82,
11,
1395,
929,
8,
198,
220,
220,
220,
2488,
9288,
264,
13,
55,
15139,
230,
1395,
79,
198,
220,
220,
220,
2488,
9288,
264,
13,
65,
6624,
604,
198,
220,
220,
220,
2488,
9288,
264,
13,
67,
6624,
604,
198,
220,
220,
220,
2488,
9288,
15690,
7,
82,
13,
44,
58,
19,
12962,
15139,
230,
15690,
7,
32542,
298,
7,
55,
79,
11,
604,
4008,
198,
220,
220,
220,
12624,
796,
10973,
377,
1187,
7,
55,
79,
11,
604,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
34,
58,
18,
12962,
15139,
230,
15690,
7,
4093,
58,
18,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
34,
58,
19,
12962,
15139,
230,
15690,
7,
4093,
58,
19,
12962,
198,
437,
628,
198,
31,
9288,
2617,
366,
16680,
541,
305,
919,
278,
10973,
377,
1187,
4296,
1,
2221,
198,
220,
751,
1676,
6359,
7,
17,
8,
198,
220,
5418,
7,
3109,
1050,
7,
25,
83,
643,
626,
11,
36147,
31,
16833,
3003,
1262,
27843,
377,
1187,
4933,
19581,
22305,
198,
220,
220,
220,
1395,
79,
796,
4818,
559,
79,
19608,
7,
55,
11,
1395,
929,
8,
198,
220,
220,
220,
264,
796,
6060,
29252,
658,
7,
55,
11,
604,
11,
604,
8,
198,
220,
220,
220,
327,
796,
10973,
377,
1187,
19119,
0,
7,
82,
11,
1395,
929,
8,
198,
220,
220,
220,
2488,
9288,
264,
13,
55,
15139,
230,
1395,
79,
198,
220,
220,
220,
2488,
9288,
264,
13,
65,
6624,
604,
198,
220,
220,
220,
2488,
9288,
264,
13,
67,
6624,
604,
198,
220,
220,
220,
2488,
9288,
15690,
7,
82,
13,
44,
58,
19,
12962,
15139,
230,
15690,
7,
32542,
298,
7,
55,
79,
11,
604,
4008,
198,
220,
220,
220,
12624,
796,
10973,
377,
1187,
7,
55,
79,
11,
604,
8,
198,
220,
220,
220,
2488,
9288,
15690,
7,
34,
58,
18,
12962,
15139,
230,
15690,
7,
4093,
58,
18,
12962,
198,
220,
220,
220,
2488,
9288,
15690,
7,
34,
58,
19,
12962,
15139,
230,
15690,
7,
4093,
58,
19,
12962,
198,
437,
198,
198,
31,
9288,
2617,
366,
36340,
377,
1187,
4296,
13269,
1,
2221,
198,
220,
2124,
796,
3392,
7,
940,
11,
19,
1776,
198,
220,
331,
796,
362,
9,
1952,
7,
20,
11,
18,
1776,
198,
220,
264,
796,
6060,
29252,
658,
7,
87,
11,
604,
11,
362,
8,
198,
220,
2488,
9288,
62,
400,
8516,
34024,
44,
1042,
963,
10973,
377,
1187,
19119,
0,
7,
82,
11,
331,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
1314,
11,
19,
8,
198,
220,
2488,
9288,
62,
400,
8516,
347,
3733,
12331,
10973,
377,
1187,
19119,
0,
7,
82,
11,
331,
8,
198,
220,
264,
16,
796,
6060,
29252,
658,
7,
87,
58,
45299,
352,
25,
18,
4357,
604,
11,
362,
8,
198,
220,
331,
796,
362,
9,
1952,
7,
20,
11,
19,
8,
198,
220,
2488,
9288,
62,
400,
8516,
13794,
891,
19852,
12331,
10973,
377,
1187,
929,
19608,
7,
82,
16,
11,
331,
8,
198,
437,
198,
198,
35235,
7,
43717,
8,
198,
361,
44156,
2849,
19841,
410,
1,
16,
13,
21,
13,
16,
1,
198,
220,
2488,
9288,
2617,
366,
21928,
290,
3440,
1,
2221,
198,
220,
220,
220,
2124,
796,
3392,
7,
940,
11,
19,
1776,
198,
220,
220,
220,
264,
796,
6060,
29252,
658,
7,
87,
11,
604,
11,
362,
8,
198,
220,
220,
220,
2488,
9288,
7448,
76,
7,
82,
11,
12813,
22065,
14,
36340,
7890,
13,
73,
335,
17,
4943,
6624,
2147,
198,
220,
220,
220,
1303,
35235,
7,
2220,
7203,
14,
22065,
14,
36340,
7890,
13,
73,
335,
17,
48774,
198,
220,
220,
220,
264,
16,
796,
3440,
36020,
7203,
14,
22065,
14,
36340,
7890,
13,
73,
335,
17,
4943,
198,
220,
220,
220,
2488,
9288,
264,
16,
13,
55,
6624,
264,
13,
55,
198,
220,
220,
220,
2488,
9288,
264,
16,
13,
67,
6624,
264,
13,
67,
198,
220,
220,
220,
2488,
9288,
264,
16,
13,
65,
6624,
264,
13,
65,
198,
220,
220,
220,
2488,
9288,
15690,
7,
82,
16,
13,
44,
58,
19,
12962,
6624,
15690,
7,
82,
13,
44,
58,
19,
12962,
198,
220,
886,
198,
437,
198
] | 1.950484 | 1,858 |
# Copyright (c) 2019 Guido Kraemer
# Copyright (c) 2019 Simon Castano
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
TxOut
Each output spends a certain number of satoshis, placing them under control of
anyone who can satisfy the provided pubkey script.
A `TxOut` is composed of
- `value::UInt64`, number of satoshis to spend. May be zero; the sum of all
outputs may not exceed the sum of satoshis previously spent to the outpoints
provided in the input section. (Exception: coinbase transactions spend the
block subsidy and collected transaction fees.)
- `scriptpubkey::Script` which defines the conditions which must be
satisfied to spend this output.
"""
struct TxOut
value :: UInt64
scriptpubkey :: Script
end
"""
TxOut(io::IOBuffer)
Parse an `IOBuffer` to a `TxOut`
"""
function TxOut(io::IOBuffer)
value = read(io, UInt64)
scriptpubkey = Script(io)
TxOut(value, scriptpubkey)
end
function Base.show(io::IO, output::TxOut)
println(io, "Transaction output: ₿" * string(output.value/100000000))
println(io, "ScriptPubKey:")
println(io, output.scriptpubkey)
end
"""
serialize(tx::TxOut) -> Vector{UInt8}
Returns the byte serialization of the transaction output
"""
function serialize(tx::TxOut)
result = bytes(tx.value, len=8, little_endian=true)
append!(result, serialize(tx.scriptpubkey))
return result
end
| [
2,
15069,
357,
66,
8,
13130,
1962,
17305,
21553,
24677,
198,
2,
15069,
357,
66,
8,
13130,
11288,
5833,
5733,
198,
2,
4307,
6169,
739,
262,
17168,
3788,
5964,
11,
766,
262,
19249,
198,
2,
2393,
27975,
45761,
393,
2638,
1378,
2503,
13,
44813,
1668,
13,
2398,
14,
677,
4541,
14,
2781,
12,
43085,
13,
10121,
13,
198,
198,
37811,
198,
220,
220,
220,
309,
87,
7975,
198,
198,
10871,
5072,
16887,
257,
1728,
1271,
286,
3332,
3768,
271,
11,
12560,
606,
739,
1630,
286,
198,
1092,
505,
508,
460,
15959,
262,
2810,
2240,
2539,
4226,
13,
198,
32,
4600,
46047,
7975,
63,
318,
13160,
286,
198,
12,
4600,
8367,
3712,
52,
5317,
2414,
47671,
1271,
286,
3332,
3768,
271,
284,
4341,
13,
1737,
307,
6632,
26,
262,
2160,
286,
477,
198,
22915,
82,
743,
407,
7074,
262,
2160,
286,
3332,
3768,
271,
4271,
3377,
284,
262,
503,
13033,
198,
41279,
287,
262,
5128,
2665,
13,
357,
16922,
25,
10752,
8692,
8945,
4341,
262,
198,
9967,
28646,
290,
7723,
8611,
6642,
2014,
198,
12,
4600,
12048,
12984,
2539,
3712,
7391,
63,
543,
15738,
262,
3403,
543,
1276,
307,
198,
82,
17403,
798,
284,
4341,
428,
5072,
13,
198,
198,
37811,
198,
7249,
309,
87,
7975,
198,
220,
220,
220,
1988,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7904,
471,
5317,
2414,
198,
220,
220,
220,
4226,
12984,
2539,
220,
220,
220,
7904,
12327,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
309,
87,
7975,
7,
952,
3712,
9399,
28632,
8,
198,
198,
10044,
325,
281,
4600,
9399,
28632,
63,
284,
257,
4600,
46047,
7975,
63,
198,
37811,
198,
8818,
309,
87,
7975,
7,
952,
3712,
9399,
28632,
8,
198,
220,
220,
220,
1988,
796,
1100,
7,
952,
11,
471,
5317,
2414,
8,
198,
220,
220,
220,
4226,
12984,
2539,
796,
12327,
7,
952,
8,
628,
220,
220,
220,
309,
87,
7975,
7,
8367,
11,
4226,
12984,
2539,
8,
198,
437,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
5072,
3712,
46047,
7975,
8,
198,
220,
220,
220,
44872,
7,
952,
11,
366,
48720,
5072,
25,
2343,
224,
123,
1,
1635,
4731,
7,
22915,
13,
8367,
14,
16,
8269,
4008,
198,
220,
220,
220,
44872,
7,
952,
11,
366,
7391,
14876,
9218,
25,
4943,
198,
220,
220,
220,
44872,
7,
952,
11,
5072,
13,
12048,
12984,
2539,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
11389,
1096,
7,
17602,
3712,
46047,
7975,
8,
4613,
20650,
90,
52,
5317,
23,
92,
198,
198,
35561,
262,
18022,
11389,
1634,
286,
262,
8611,
5072,
198,
37811,
198,
8818,
11389,
1096,
7,
17602,
3712,
46047,
7975,
8,
198,
220,
220,
220,
1255,
796,
9881,
7,
17602,
13,
8367,
11,
18896,
28,
23,
11,
1310,
62,
437,
666,
28,
7942,
8,
198,
220,
220,
220,
24443,
0,
7,
20274,
11,
11389,
1096,
7,
17602,
13,
12048,
12984,
2539,
4008,
198,
220,
220,
220,
1441,
1255,
198,
437,
198
] | 3.01833 | 491 |
∑ = sum
using StatsFuns:logistic
sigmoid = logistic
using CSV:File
using DataFrames
using Printf:@sprintf
# DataTypes
using LinearAlgebra:Transpose
Numeric = Union{Int64,Float64}
NumericV = Union{Array{Int64,1},Array{Float64,1}}
NumericM = Union{Array{Int64,2},Array{Float64,2},Transpose{Float64,Array{Float64,2}},Transpose{Int64,Array{Int64,2}}}
arrayNumericV = Union{Array{Array{Int64,1},1},Array{Array{Float64,1},1}}
TupleNumericM = Tuple{NumericM, NumericM};
function maskBiasUnits(array::NumericV)::NumericV
mask = ones(size(array));
mask[1,1] = 0;
maskedArray = array.*mask;
end
function maskBiasUnits(array::NumericM)::NumericM
mask = ones(size(array));
mask[:,1] .= 0;
maskedArray = array.*mask;
end
function powerElements(array::Union{NumericV,NumericM}, power::Int)::NumericM
# function defined to be broadcasted to elements of a tuple
array = array.^power
end
function getLabels(y::NumericV)::NumericV
labels = collect(BitSet(y));
sort!(labels)
end
function sortArrayByCol(array::Array{Any,2}, col::Int)
array = DataFrame(array);
sort!(array, col)
array = Matrix(array)
end
function getLayersQ(all_θ)::Int
θ_matricesQ = length(collect(all_θ));
layersQ = θ_matricesQ+1;
end
function nnClasificationFeedForward(all_θ, X, y, labels, layersQ::Int=getLayersQ(all_θ))
labelsQ = length(labels);
hx_and_indices = reshape([],0,labelsQ+1);
for lb in labels
ly = 1;
lb_idx = findall(==(lb), y)
a_ly = X[lb_idx,:];
ly += 1;
while ly ≤ layersQ
# add bias units to a_ly_lb
a_ly = [ones(size(a_ly)[1],1) a_ly];
a_previous_ly = a_ly;
θ_previous_ly = all_θ[ly-1];
z_ly = a_previous_ly*θ_previous_ly';
a_ly = sigmoid.(z_ly);
ly += 1;
end
ly = 1;
hx_lb = a_ly;
hx_and_indices_lb = hcat(hx_lb, lb_idx);
hx_and_indices = vcat(hx_and_indices, hx_and_indices_lb);
end
hx_and_indices = sortArrayByCol(hx_and_indices, labelsQ+1);
hx = hx_and_indices[:,1:labelsQ];
end
function nnCostClasification(all_θ::TupleNumericM, hx, y::NumericV, labels::NumericV, λ::Numeric)::Numeric
J = 0;
for lb in labels
lb_idx = findall(==(lb), y)
hx_lb = hx[lb_idx,:];
y_lb = vec(zeros(size(labels))); y_lb[lb] = 1;
J += ∑(-((log.(hx_lb))*y_lb)-(log.(1 .- hx_lb)*(1 .- y_lb)));
end
casesQ = size(hx)[1];
J = (1/casesQ)*J;
# add regularization cost
J += (λ/(2*casesQ))* ∑(∑.(powerElements.(maskBiasUnits.(all_θ),2)));
end
function calcSigmoidDerivate(z::Numeric)::Numeric
sigmoid(z)*(1-sigmoid(z));
end
function calcSigmoidDerivate(z::NumericM)::NumericM
sigmoid.(z).*(1 .- sigmoid.(z));
end
calcSigmoidGradient = calcSigmoidDerivate;
function calcNiceInitϵ(layerInputsQ::Int, layerOutputsQ::Int)::Numeric
initϵ = √6/√(layerInputsQ+layerOutputsQ)
end
function genRandomInitialθ(layerInputsQ::Int, layerOutputsQ::Int, initϵ::Numeric=calcNiceInitϵ(layerInputsQ,layerOutputsQ))::NumericM
initϵInt = floor(initϵ*100);
randInitialθ = rand(-initϵInt:initϵInt,layerOutputsQ,layerInputsQ+1);
randInitialθ = randInitialθ./100;
end
function substractElements(sub_array::Array{Any,1},vector::NumericV)
sub_array .- vectors
end
function gen_initial_z(all_θ, labelsQ::Int)
initial_z_singleLy = [];
for θ in all_θ
initial_z_singleLy = [initial_z_singleLy, ones(size(θ))];
end
initial_z_singleLy[1]=initial_z_singleLy[1][2];
initial_z = [];
for lb in labelsQ
initial_z = [initial_z, initial_z_singleLy];
end
initial_z = initial_z[2]
end
function nnClasificationBackPropagation(hx, all_θ, layersQ::Int, y, labels)
# calculate the gradients -i.e. partial derivates with respect to θ- of the cost (J)
nodesQ = labelsQ = length(labels);
casesQ = size(hx)[1];
ly = layersQ;
idx_v = collect(1:labelsQ);
outputLayer = map(idx -> (vec(hx[:,idx])), idx_v); #Matrix of subarrays where each of them correspond to each row of hx'
δ_ly = map(idx -> allCasesOutputLayer[idx] .- y, idx_v);
ly -= 1;
while ly ≥ 2
δ_previous_ly = δ_ly;
θ_ly = all_θ[ly];
z_ly =
end
#parameters
# csv files -> DataFrames -> arrays
X = Matrix{Float64}(File("./X.csv", header=false)
|> DataFrame);
y = vec(Matrix(File("./y.csv", header=false) |> DataFrame));
θ1 = Matrix{Float64}(File("./theta1.csv", header=false)
|> DataFrame);
θ2 = Matrix{Float64}(File("./theta2.csv", header=false) |> DataFrame);
λ = 1;
#implementation
all_θ = (θ1, θ2);
labels = getLabels(y);
layersQ = getLayersQ(all_θ);
hx = nnClasificationFeedForward(all_θ, X, y, labels, layersQ);
J = nnCostClasification(all_θ, hx, y, labels, λ);
allCasesδ_ly = nnClasificationBackPropagation(hx, layersQ, y, labels); | [
24861,
239,
796,
2160,
198,
3500,
20595,
37,
13271,
25,
6404,
2569,
198,
82,
17225,
1868,
796,
2604,
2569,
198,
3500,
44189,
25,
8979,
198,
3500,
6060,
35439,
198,
3500,
12578,
69,
25,
31,
82,
37435,
198,
198,
2,
6060,
31431,
198,
3500,
44800,
2348,
29230,
25,
8291,
3455,
198,
45,
39223,
796,
4479,
90,
5317,
2414,
11,
43879,
2414,
92,
198,
45,
39223,
53,
796,
4479,
90,
19182,
90,
5317,
2414,
11,
16,
5512,
19182,
90,
43879,
2414,
11,
16,
11709,
198,
45,
39223,
44,
796,
4479,
90,
19182,
90,
5317,
2414,
11,
17,
5512,
19182,
90,
43879,
2414,
11,
17,
5512,
8291,
3455,
90,
43879,
2414,
11,
19182,
90,
43879,
2414,
11,
17,
92,
5512,
8291,
3455,
90,
5317,
2414,
11,
19182,
90,
5317,
2414,
11,
17,
42535,
198,
18747,
45,
39223,
53,
796,
4479,
90,
19182,
90,
19182,
90,
5317,
2414,
11,
16,
5512,
16,
5512,
19182,
90,
19182,
90,
43879,
2414,
11,
16,
5512,
16,
11709,
198,
51,
29291,
45,
39223,
44,
796,
309,
29291,
90,
45,
39223,
44,
11,
399,
39223,
44,
19629,
628,
198,
8818,
9335,
33,
4448,
3118,
896,
7,
18747,
3712,
45,
39223,
53,
2599,
25,
45,
39223,
53,
198,
220,
220,
220,
9335,
796,
3392,
7,
7857,
7,
18747,
18125,
198,
220,
220,
220,
9335,
58,
16,
11,
16,
60,
796,
657,
26,
198,
220,
220,
220,
29229,
19182,
796,
7177,
15885,
27932,
26,
198,
437,
198,
198,
8818,
9335,
33,
4448,
3118,
896,
7,
18747,
3712,
45,
39223,
44,
2599,
25,
45,
39223,
44,
198,
220,
220,
220,
9335,
796,
3392,
7,
7857,
7,
18747,
18125,
198,
220,
220,
220,
9335,
58,
45299,
16,
60,
764,
28,
657,
26,
198,
220,
220,
220,
29229,
19182,
796,
7177,
15885,
27932,
26,
198,
437,
628,
198,
8818,
1176,
36,
3639,
7,
18747,
3712,
38176,
90,
45,
39223,
53,
11,
45,
39223,
44,
5512,
1176,
3712,
5317,
2599,
25,
45,
39223,
44,
198,
220,
220,
220,
1303,
2163,
5447,
284,
307,
7025,
276,
284,
4847,
286,
257,
46545,
198,
220,
220,
220,
7177,
796,
7177,
13,
61,
6477,
198,
437,
628,
198,
8818,
651,
17822,
1424,
7,
88,
3712,
45,
39223,
53,
2599,
25,
45,
39223,
53,
198,
220,
220,
220,
14722,
796,
2824,
7,
13128,
7248,
7,
88,
18125,
198,
220,
220,
220,
3297,
0,
7,
23912,
1424,
8,
198,
437,
628,
198,
8818,
3297,
19182,
3886,
5216,
7,
18747,
3712,
19182,
90,
7149,
11,
17,
5512,
951,
3712,
5317,
8,
198,
220,
220,
220,
7177,
796,
6060,
19778,
7,
18747,
1776,
198,
220,
220,
220,
3297,
0,
7,
18747,
11,
951,
8,
198,
220,
220,
220,
7177,
796,
24936,
7,
18747,
8,
198,
437,
198,
198,
8818,
651,
43,
6962,
48,
7,
439,
62,
138,
116,
2599,
25,
5317,
198,
220,
220,
220,
7377,
116,
62,
6759,
45977,
48,
796,
4129,
7,
33327,
7,
439,
62,
138,
116,
18125,
198,
220,
220,
220,
11685,
48,
796,
7377,
116,
62,
6759,
45977,
48,
10,
16,
26,
198,
437,
628,
198,
8818,
299,
77,
2601,
292,
2649,
18332,
39746,
7,
439,
62,
138,
116,
11,
1395,
11,
331,
11,
14722,
11,
11685,
48,
3712,
5317,
28,
1136,
43,
6962,
48,
7,
439,
62,
138,
116,
4008,
198,
220,
220,
220,
14722,
48,
796,
4129,
7,
23912,
1424,
1776,
198,
220,
220,
220,
289,
87,
62,
392,
62,
521,
1063,
796,
27179,
1758,
26933,
4357,
15,
11,
23912,
1424,
48,
10,
16,
1776,
198,
220,
220,
220,
329,
18360,
287,
14722,
198,
220,
220,
220,
220,
220,
220,
220,
22404,
796,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
18360,
62,
312,
87,
796,
1064,
439,
7,
855,
7,
23160,
828,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
257,
62,
306,
796,
1395,
58,
23160,
62,
312,
87,
11,
25,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
22404,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
981,
22404,
41305,
11685,
48,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
751,
10690,
4991,
284,
257,
62,
306,
62,
23160,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
62,
306,
796,
685,
1952,
7,
7857,
7,
64,
62,
306,
38381,
16,
4357,
16,
8,
257,
62,
306,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
62,
3866,
1442,
62,
306,
796,
257,
62,
306,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
116,
62,
3866,
1442,
62,
306,
796,
477,
62,
138,
116,
58,
306,
12,
16,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
306,
796,
257,
62,
3866,
1442,
62,
306,
9,
138,
116,
62,
3866,
1442,
62,
306,
17020,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
257,
62,
306,
796,
264,
17225,
1868,
12195,
89,
62,
306,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
22404,
15853,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
22404,
796,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
62,
23160,
796,
257,
62,
306,
26,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
62,
392,
62,
521,
1063,
62,
23160,
796,
289,
9246,
7,
71,
87,
62,
23160,
11,
18360,
62,
312,
87,
1776,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
62,
392,
62,
521,
1063,
796,
410,
9246,
7,
71,
87,
62,
392,
62,
521,
1063,
11,
289,
87,
62,
392,
62,
521,
1063,
62,
23160,
1776,
198,
220,
220,
220,
886,
198,
220,
220,
220,
289,
87,
62,
392,
62,
521,
1063,
796,
3297,
19182,
3886,
5216,
7,
71,
87,
62,
392,
62,
521,
1063,
11,
14722,
48,
10,
16,
1776,
198,
220,
220,
220,
289,
87,
796,
289,
87,
62,
392,
62,
521,
1063,
58,
45299,
16,
25,
23912,
1424,
48,
11208,
198,
437,
628,
198,
8818,
299,
77,
13729,
2601,
292,
2649,
7,
439,
62,
138,
116,
3712,
51,
29291,
45,
39223,
44,
11,
289,
87,
11,
331,
3712,
45,
39223,
53,
11,
14722,
3712,
45,
39223,
53,
11,
7377,
119,
3712,
45,
39223,
2599,
25,
45,
39223,
198,
220,
220,
220,
449,
796,
657,
26,
198,
220,
220,
220,
329,
18360,
287,
14722,
198,
220,
220,
220,
220,
220,
220,
220,
18360,
62,
312,
87,
796,
1064,
439,
7,
855,
7,
23160,
828,
331,
8,
198,
220,
220,
220,
220,
220,
220,
220,
289,
87,
62,
23160,
796,
289,
87,
58,
23160,
62,
312,
87,
11,
25,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
23160,
796,
43030,
7,
9107,
418,
7,
7857,
7,
23912,
1424,
4008,
1776,
331,
62,
23160,
58,
23160,
60,
796,
352,
26,
198,
220,
220,
220,
220,
220,
220,
220,
449,
15853,
18872,
239,
32590,
19510,
6404,
12195,
71,
87,
62,
23160,
4008,
9,
88,
62,
23160,
13219,
7,
6404,
12195,
16,
764,
12,
289,
87,
62,
23160,
27493,
7,
16,
764,
12,
331,
62,
23160,
4008,
1776,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2663,
48,
796,
2546,
7,
71,
87,
38381,
16,
11208,
198,
220,
220,
220,
449,
796,
357,
16,
14,
33964,
48,
27493,
41,
26,
198,
220,
220,
220,
1303,
751,
3218,
1634,
1575,
198,
220,
220,
220,
449,
15853,
357,
39377,
29006,
17,
9,
33964,
48,
4008,
9,
18872,
239,
7,
24861,
239,
12195,
6477,
36,
3639,
12195,
27932,
33,
4448,
3118,
896,
12195,
439,
62,
138,
116,
828,
17,
4008,
1776,
198,
437,
628,
198,
8818,
42302,
50,
17225,
1868,
28532,
452,
378,
7,
89,
3712,
45,
39223,
2599,
25,
45,
39223,
198,
220,
220,
220,
264,
17225,
1868,
7,
89,
27493,
7,
16,
12,
82,
17225,
1868,
7,
89,
18125,
198,
437,
198,
198,
8818,
42302,
50,
17225,
1868,
28532,
452,
378,
7,
89,
3712,
45,
39223,
44,
2599,
25,
45,
39223,
44,
198,
220,
220,
220,
264,
17225,
1868,
12195,
89,
737,
9,
7,
16,
764,
12,
264,
17225,
1868,
12195,
89,
18125,
198,
437,
198,
198,
9948,
66,
50,
17225,
1868,
42731,
1153,
796,
42302,
50,
17225,
1868,
28532,
452,
378,
26,
628,
198,
8818,
42302,
35284,
31768,
139,
113,
7,
29289,
20560,
82,
48,
3712,
5317,
11,
7679,
26410,
82,
48,
3712,
5317,
2599,
25,
45,
39223,
198,
220,
220,
220,
2315,
139,
113,
796,
18872,
248,
21,
14,
24861,
248,
7,
29289,
20560,
82,
48,
10,
29289,
26410,
82,
48,
8,
198,
437,
628,
198,
8818,
2429,
29531,
24243,
138,
116,
7,
29289,
20560,
82,
48,
3712,
5317,
11,
7679,
26410,
82,
48,
3712,
5317,
11,
2315,
139,
113,
3712,
45,
39223,
28,
9948,
66,
35284,
31768,
139,
113,
7,
29289,
20560,
82,
48,
11,
29289,
26410,
82,
48,
8,
2599,
25,
45,
39223,
44,
198,
220,
220,
220,
2315,
139,
113,
5317,
796,
4314,
7,
15003,
139,
113,
9,
3064,
1776,
198,
220,
220,
220,
43720,
24243,
138,
116,
796,
43720,
32590,
15003,
139,
113,
5317,
25,
15003,
139,
113,
5317,
11,
29289,
26410,
82,
48,
11,
29289,
20560,
82,
48,
10,
16,
1776,
198,
220,
220,
220,
43720,
24243,
138,
116,
796,
43720,
24243,
138,
116,
19571,
3064,
26,
198,
437,
198,
198,
8818,
3293,
974,
36,
3639,
7,
7266,
62,
18747,
3712,
19182,
90,
7149,
11,
16,
5512,
31364,
3712,
45,
39223,
53,
8,
198,
220,
220,
220,
850,
62,
18747,
764,
12,
30104,
198,
437,
628,
198,
8818,
2429,
62,
36733,
62,
89,
7,
439,
62,
138,
116,
11,
14722,
48,
3712,
5317,
8,
198,
220,
220,
220,
4238,
62,
89,
62,
29762,
31633,
796,
25787,
198,
220,
220,
220,
329,
7377,
116,
287,
477,
62,
138,
116,
198,
220,
220,
220,
220,
220,
220,
220,
4238,
62,
89,
62,
29762,
31633,
796,
685,
36733,
62,
89,
62,
29762,
31633,
11,
3392,
7,
7857,
7,
138,
116,
4008,
11208,
198,
220,
220,
220,
886,
198,
220,
220,
220,
4238,
62,
89,
62,
29762,
31633,
58,
16,
22241,
36733,
62,
89,
62,
29762,
31633,
58,
16,
7131,
17,
11208,
198,
220,
220,
220,
220,
198,
220,
220,
220,
4238,
62,
89,
796,
25787,
198,
220,
220,
220,
329,
18360,
287,
14722,
48,
198,
220,
220,
220,
220,
220,
220,
220,
4238,
62,
89,
796,
685,
36733,
62,
89,
11,
4238,
62,
89,
62,
29762,
31633,
11208,
198,
220,
220,
220,
886,
198,
220,
220,
220,
4238,
62,
89,
796,
4238,
62,
89,
58,
17,
60,
198,
437,
628,
198,
8818,
299,
77,
2601,
292,
2649,
7282,
24331,
363,
341,
7,
71,
87,
11,
477,
62,
138,
116,
11,
11685,
48,
3712,
5317,
11,
331,
11,
14722,
8,
198,
220,
220,
220,
1303,
15284,
262,
3915,
2334,
532,
72,
13,
68,
13,
13027,
16124,
689,
351,
2461,
284,
7377,
116,
12,
286,
262,
1575,
357,
41,
8,
198,
220,
220,
220,
13760,
48,
796,
14722,
48,
796,
4129,
7,
23912,
1424,
1776,
198,
220,
220,
220,
2663,
48,
796,
2546,
7,
71,
87,
38381,
16,
11208,
198,
220,
220,
220,
22404,
796,
11685,
48,
26,
198,
220,
220,
220,
4686,
87,
62,
85,
796,
2824,
7,
16,
25,
23912,
1424,
48,
1776,
198,
220,
220,
220,
5072,
49925,
796,
3975,
7,
312,
87,
4613,
357,
35138,
7,
71,
87,
58,
45299,
312,
87,
12962,
828,
4686,
87,
62,
85,
1776,
1303,
46912,
286,
850,
3258,
592,
810,
1123,
286,
606,
6053,
284,
1123,
5752,
286,
289,
87,
6,
198,
220,
220,
220,
7377,
112,
62,
306,
796,
220,
3975,
7,
312,
87,
4613,
477,
34,
1386,
26410,
49925,
58,
312,
87,
60,
764,
12,
331,
11,
4686,
87,
62,
85,
1776,
198,
220,
220,
220,
22404,
48185,
352,
26,
198,
220,
220,
220,
981,
22404,
26870,
362,
198,
220,
220,
220,
220,
220,
220,
220,
7377,
112,
62,
3866,
1442,
62,
306,
796,
7377,
112,
62,
306,
26,
198,
220,
220,
220,
220,
220,
220,
220,
7377,
116,
62,
306,
796,
477,
62,
138,
116,
58,
306,
11208,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
306,
796,
220,
628,
198,
198,
437,
628,
628,
198,
2,
17143,
7307,
198,
2,
269,
21370,
3696,
4613,
6060,
35439,
4613,
26515,
198,
55,
796,
220,
24936,
90,
43879,
2414,
92,
7,
8979,
7,
1911,
14,
55,
13,
40664,
1600,
13639,
28,
9562,
8,
198,
220,
220,
220,
930,
29,
6060,
19778,
1776,
198,
88,
796,
43030,
7,
46912,
7,
8979,
7,
1911,
14,
88,
13,
40664,
1600,
13639,
28,
9562,
8,
930,
29,
6060,
19778,
18125,
198,
138,
116,
16,
796,
24936,
90,
43879,
2414,
92,
7,
8979,
7,
1911,
14,
1169,
8326,
16,
13,
40664,
1600,
13639,
28,
9562,
8,
198,
220,
220,
220,
930,
29,
6060,
19778,
1776,
198,
138,
116,
17,
796,
24936,
90,
43879,
2414,
92,
7,
8979,
7,
1911,
14,
1169,
8326,
17,
13,
40664,
1600,
13639,
28,
9562,
8,
930,
29,
6060,
19778,
1776,
198,
39377,
796,
352,
26,
198,
198,
2,
320,
32851,
198,
439,
62,
138,
116,
796,
357,
138,
116,
16,
11,
7377,
116,
17,
1776,
198,
23912,
1424,
796,
651,
17822,
1424,
7,
88,
1776,
198,
75,
6962,
48,
796,
651,
43,
6962,
48,
7,
439,
62,
138,
116,
1776,
198,
71,
87,
796,
299,
77,
2601,
292,
2649,
18332,
39746,
7,
439,
62,
138,
116,
11,
1395,
11,
331,
11,
14722,
11,
11685,
48,
1776,
198,
41,
796,
299,
77,
13729,
2601,
292,
2649,
7,
439,
62,
138,
116,
11,
289,
87,
11,
331,
11,
14722,
11,
7377,
119,
1776,
198,
439,
34,
1386,
138,
112,
62,
306,
796,
299,
77,
2601,
292,
2649,
7282,
24331,
363,
341,
7,
71,
87,
11,
11685,
48,
11,
331,
11,
14722,
1776
] | 2.142043 | 2,281 |
xlocations(ex) = Expr(:call, :($YaoLocations.Locations), ex)
xctrl_locations(ex) = Expr(:call, :($YaoLocations.CtrlLocations), ex)
"""
@gate <locs> => <gate>
Syntax sugar for `apply(gate, locs)`, must be used inside `@device`.
See also [`@device`](@ref).
!!! tips
You don't have to write `@gate` in most cases inside `@device`.
But in case there is ambuigity, you can annotate the expression
with `@gate` explicitly.
"""
macro gate(ex::Expr)
@match ex begin
:($locs => $gate) => esc(xcall(GlobalRef(Intrinsics, :apply), gate, xlocations(locs)))
_ => error("syntax: invalid syntax, expect @gate <locs> => <gate>")
end
end
"""
@ctrl <ctrl_locs> <locs> => <gate>
Syntax sugar for `apply(gate, locs, ctrl_locs)`, must be used inside `@device`.
See also [`@device`](@ref).
"""
macro ctrl(ctrl_locs, ex::Expr)
@match ex begin
:($locs => $gate) => esc(
xcall(GlobalRef(Intrinsics, :apply), gate, xlocations(locs), xctrl_locations(ctrl_locs)),
)
_ => error("syntax: invalid syntax, expect @ctrl <ctrl_locs> <locs> => <gate>")
end
end
"""
@measure locs
Syntax sugar for `measure(locs)`.
"""
macro measure(locs)
esc(xcall(GlobalRef(Intrinsics, :measure), xlocations(locs)))
end
"""
@barrier locs
Syntax sugar for `barrier(locs)`.
"""
macro barrier(locs)
esc(xcall(GlobalRef(Intrinsics, :barrier), xlocations(locs)))
end
"""
@device <function def>
Annotate a Julia function as YaoLang device kernel.
"""
macro device(ex)
esc(device_m(__module__, ex))
end
"""
routine_stub(routine, args...)
A function to store the raw `CodeInfo` of defined routines
to support multiple dispatch. We don't directly define `main`
`gate`, `ctrl` etc. because we can't support multiple dispatch
on them directly.
"""
function routine_stub end
function device_m(mod::Module, ex)
is_function(ex) || error("expect a function definition")
jlfn = JLFunction(ex)
isnothing(jlfn.kwargs) || error("kwargs is not supported")
return codegen_routine(jlfn)
end
function codegen_routine(jlfn::JLFunction)
typename =
isnothing(jlfn.name) ? gensym(:routine) :
Meta.isexpr(jlfn.name, :(::)) ? jlfn.name.args[end] : Symbol("#", jlfn.name, "#")
return quote
$(codegen_routine_type(jlfn, typename))
$(codegen_device(jlfn, typename))
$(codegen_inference_limit_heuristics(jlfn, typename))
$(codegen_routine_stub(jlfn, typename))
$(codegen_binding(jlfn, typename))
end
end
function codegen_routine_type(def::JLFunction, typename)
def.name isa Symbol || isnothing(def.name) || return
name = isnothing(def.name) ? typename : def.name
jlstruct =
JLStruct(; name = typename, supertype = :($YaoCompiler.GenericRoutine{$(QuoteNode(name))}))
return codegen_ast(jlstruct)
end
function codegen_binding(def::JLFunction, typename)
Meta.isexpr(def.name, :(::)) && return
if isnothing(def.name)
return :(Core.@__doc__ $typename())
else
return :(Core.@__doc__ const $(def.name) = $typename())
end
end
function codegen_device(def::JLFunction, typename)
self = gensym(:self)
args = name_only.(def.args)
jlfn = JLFunction(;
name = :($self::$typename),
args = def.args,
whereparams = def.whereparams,
rettype = def.rettype,
line = def.line,
body = quote
$YaoCompiler.Operation($self, $(xtuple(args...)))
end,
)
return codegen_ast(jlfn)
end
function inference_limit_heuristics end
function codegen_inference_limit_heuristics(def::JLFunction, typename)
self = gensym(:self)
args = name_only.(def.args)
jlfn = JLFunction(;
name = :($YaoCompiler.inference_limit_heuristics),
args = [:($self::$typename), def.args...],
whereparams = def.whereparams,
rettype = def.rettype,
line = def.line,
body = quote
$YaoCompiler.Operation($self, $(xtuple(args...)))
end,
)
return codegen_ast(jlfn)
end
function codegen_routine_stub(def::JLFunction, typename)
self = @match def.name begin
:($name::$type) => name
:(::$type) => gensym(:self)
_ => gensym(:self)
end
jlfn = JLFunction(;
name = :($YaoCompiler.routine_stub),
args = [:($self::$typename), def.args...],
whereparams = def.whereparams,
rettype = def.rettype,
line = def.line,
body = transpile_gate_syntax(transpile_intrinsic(def.body)),
)
return codegen_ast(jlfn)
end
function is_syntax_macro(ex)
@match ex begin
Symbol("@gate") => true
Symbol("@ctrl") => true
Symbol("@measure") => true
Symbol("@barrier") => true
Expr(:., :YaoCompiler, QuoteNode(name)) => is_syntax_macro(name)
Expr(:., YaoCompiler, QuoteNode(name)) => is_syntax_macro(name)
GlobalRef(YaoCompiler, name) => is_syntax_macro(name)
_ => false
end
end
# NOTE: locs => gate is only a syntax sugar for gate(gate, locs)
function transpile_intrinsic(ex)
@match ex begin
Expr(:call, :apply, gate, locs) =>
xcall(GlobalRef(Intrinsics, :apply), gate, xlocations(locs))
Expr(:call, :apply, gate, locs, ctrl) =>
xcall(GlobalRef(Intrinsics, :apply), gate, xlocations(locs), xctrl_locations(ctrl))
Expr(:call, :measure, locs) => xcall(GlobalRef(Intrinsics, :measure), xlocations(locs))
Expr(:call, :barrier, locs) => xcall(GlobalRef(Intrinsics, :barrier), xlocations(locs))
Expr(:call, :expect, locs) => xcall(GlobalRef(Intrinsics, :expect), xlocations(locs))
# check misused keyword error
Expr(:call, :apply, _...) => error("syntax: apply is a preserved intrinsic function")
Expr(:call, :measure, _...) => error("syntax: apply is a preserved intrinsic function")
Expr(:call, :barrier, _...) => error("syntax: apply is a preserved intrinsic function")
Expr(:call, :expect, _...) => error("syntax: apply is a preserved intrinsic function")
Expr(head, args...) => Expr(head, map(transpile_intrinsic, args)...)
_ => ex
end
end
function transpile_gate_syntax(ex)
@match ex begin
# this only treat => syntax in block/let/if/for etc. as gate stmt
:($locs => $gate) => xcall(GlobalRef(Intrinsics, :apply), gate, xlocations(locs))
# this will appear in anonymous function definition
# TODO: disambuigity this and function contains only single line
# @device function circuit(theta, phi)
# 1 => X
# end
# Expr(:block, stmt1, line::LineNumberNode, stmt2) => ex
Expr(:macrocall, Symbol("@device"), _...) => error("syntax: cannot have nested @device")
Expr(:macrocall, name, args...) => begin
if is_syntax_macro(name)
return ex
else
# we force top scope locs=>gate to be treated as gate stmt inside
# all @device region including non-YaoCompiler macros to make things
# like @inbounds etc. work
return Expr(:macrocall, name, map(transpile_gate_syntax, args)...)
end
end
# we only white list other syntax here to be safe
Expr(:block, args...) ||
Expr(:if, args...) ||
Expr(:elseif, args...) ||
Expr(:let, args...) ||
Expr(:for, args...) ||
Expr(:try, args...) => Expr(ex.head, map(transpile_gate_syntax, args)...)
Expr(:function, call, body) => Expr(:function, call, transpile_gate_syntax(body))
_ => ex
end
end
@generated function Intrinsics.apply(::AbstractRegister, op::Operation{P,Args}) where {P,Args}
ci, nargs = obtain_codeinfo(op)
new = NewCodeInfo(ci)
register = insert!(new.slots, 2, Symbol("#register#"))
device = insert!(new.slots, 3, Symbol("#op#"))
unpack_device!(new, device, nargs)
for (v, stmt) in new
@switch stmt begin
@case Expr(:call, GlobalRef(&Intrinsics, name), args...)
new[v] = xcall(GlobalRef(Intrinsics, name), register, args...)
@case Expr(:(=), slot, Expr(:call, GlobalRef(&Intrinsics, name), args...))
new[v] = Expr(:(=), slot, Expr(:call, GlobalRef(Intrinsics, name), register, args...))
@case _
nothing
end
end
code_info = finish(new)
if code_info.method_for_inference_limit_heuristics === nothing
method = first(methods(inference_limit_heuristics, Tuple{P,Args.parameters...}))
code_info.method_for_inference_limit_heuristics = method
end
return code_info
end
function _update_slot_stmt(f, new, v, stmt)
@switch stmt begin
@case Expr(:call, _...)
new[v] = f(stmt)
@case Expr(:(=), slot, rhs)
new[v] = Expr(:(=), slot, f(rhs))
@case _
nothing
end
end
@generated function Intrinsics.apply(
::AbstractRegister,
op::Operation{P,Args},
::Locations,
) where {P,Args}
ci, nargs = obtain_codeinfo(op)
new = NewCodeInfo(ci)
register = insert!(new.slots, 2, Symbol("#register#"))
device = insert!(new.slots, 3, Symbol("#op#"))
glob_locs = insert!(new.slots, 4, Symbol("#locs#"))
unpack_device!(new, device, nargs)
for (v, stmt) in new
_update_slot_stmt(new, v, stmt) do stmt
@switch stmt begin
@case Expr(:call, GlobalRef(&Intrinsics, :apply), gate, locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :apply), register, gate, new_locs)
@case Expr(:call, GlobalRef(&Intrinsics, :apply), gate, locs, ctrl)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
new_ctrl = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, ctrl))
return xcall(GlobalRef(Intrinsics, :apply), register, gate, new_locs, new_ctrl)
@case Expr(:call, GlobalRef(&Intrinsics, :measure), locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :measure), register, new_locs)
@case Expr(:call, GlobalRef(&Intrinsics, :barrier), locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :barrier), register, new_locs)
@case Expr(:call, GlobalRef(&Intrinsics, :expect), locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :expect), register, new_locs)
@case _
return stmt
end
end
end
code_info = finish(new)
if code_info.method_for_inference_limit_heuristics === nothing
method = first(methods(inference_limit_heuristics, Tuple{P,Args.parameters...}))
code_info.method_for_inference_limit_heuristics = method
end
return code_info
end
@generated function Intrinsics.apply(
::AbstractRegister,
op::Operation{P,Args},
::Locations,
::CtrlLocations,
) where {P,Args}
ci, nargs = obtain_codeinfo(op)
new = NewCodeInfo(ci)
register = insert!(new.slots, 2, Symbol("#register#"))
device = insert!(new.slots, 3, Symbol("#op#"))
glob_locs = insert!(new.slots, 4, Symbol("#locs#"))
glob_ctrl = insert!(new.slots, 5, Symbol("#ctrl#"))
unpack_device!(new, device, nargs)
for (v, stmt) in new
_update_slot_stmt(new, v, stmt) do stmt
@switch stmt begin
@case Expr(:call, GlobalRef(&Intrinsics, :apply), gate, locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :apply), register, gate, new_locs, glob_ctrl)
@case Expr(:call, GlobalRef(&Intrinsics, :apply), gate, locs, ctrl)
new_locs = push!(new, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
new_ctrl = push!(new, xcall(GlobalRef(Base, :getindex), glob_locs, ctrl))
new_ctrl =
push!(new, xcall(GlobalRef(YaoLocations, :merge_locations), new_ctrl, glob_ctrl))
return xcall(GlobalRef(Intrinsics, :apply), register, gate, new_locs, new_ctrl)
@case Expr(:call, GlobalRef(&Intrinsics, :measure), locs)
return :(error("cannot apply quantum control on measurement"))
@case Expr(:call, GlobalRef(&Intrinsics, :barrier), locs)
new_locs = insert!(new, v, xcall(GlobalRef(Base, :getindex), glob_locs, locs))
return xcall(GlobalRef(Intrinsics, :barrier), register, new_locs)
@case Expr(:call, GlobalRef(&Intrinsics, :expect), locs)
return :(error("cannot apply quantum control on measurement (expectation)"))
@case _
return stmt
end
end
end
code_info = finish(new)
if code_info.method_for_inference_limit_heuristics === nothing
method = first(methods(inference_limit_heuristics, Tuple{P,Args.parameters...}))
code_info.method_for_inference_limit_heuristics = method
end
return code_info
end
function obtain_codeinfo(::Type{Operation{P,Args}}) where {P,Args}
nargs = length(Args.parameters)
tt = Tuple{P,Args.parameters...}
ms = methods(routine_stub, tt)
@assert length(ms) == 1
method = first(ms)
method_args = Tuple{typeof(routine_stub),tt.parameters...}
mi = Core.Compiler.specialize_method(method, method_args, Core.svec())
ci = Core.Compiler.retrieve_code_info(mi)
name = routine_name(P)
linetable = Any[]
for lineinfo in ci.linetable
push!(
linetable,
Core.LineInfoNode(
lineinfo.module,
name,
lineinfo.file,
lineinfo.line,
lineinfo.inlined_at,
),
)
end
ci.linetable = linetable
ci.edges = Core.MethodInstance[mi]
return ci, nargs
end
function unpack_device!(new::NewCodeInfo, op::NewSlotNumber, nargs::Int)
# %parent = op.parent
parent = push!(new, Expr(:call, GlobalRef(Base, :getfield), op, QuoteNode(:parent)))
if nargs > 0
# %args = op.args
args = push!(new, Expr(:call, GlobalRef(Base, :getfield), op, QuoteNode(:args)))
end
# %self = %parent
push!(new, Expr(:(=), SlotNumber(2), parent))
for k in 1:nargs
push!(new, Expr(:(=), SlotNumber(k + 2), xcall(GlobalRef(Base, :getindex), args, k)))
end
return new
end
| [
87,
17946,
602,
7,
1069,
8,
796,
1475,
1050,
7,
25,
13345,
11,
1058,
16763,
56,
5488,
43,
20968,
13,
43,
20968,
828,
409,
8,
198,
87,
44755,
62,
17946,
602,
7,
1069,
8,
796,
1475,
1050,
7,
25,
13345,
11,
1058,
16763,
56,
5488,
43,
20968,
13,
40069,
43,
20968,
828,
409,
8,
198,
198,
37811,
198,
220,
220,
220,
2488,
10494,
1279,
17946,
82,
29,
5218,
1279,
10494,
29,
198,
198,
13940,
41641,
7543,
329,
4600,
39014,
7,
10494,
11,
1179,
82,
8,
47671,
1276,
307,
973,
2641,
4600,
31,
25202,
44646,
198,
6214,
635,
685,
63,
31,
25202,
63,
16151,
31,
5420,
737,
198,
198,
10185,
9040,
198,
220,
220,
220,
921,
836,
470,
423,
284,
3551,
4600,
31,
10494,
63,
287,
749,
2663,
2641,
4600,
31,
25202,
44646,
198,
220,
220,
220,
887,
287,
1339,
612,
318,
4915,
84,
328,
414,
11,
345,
460,
24708,
378,
262,
5408,
198,
220,
220,
220,
351,
4600,
31,
10494,
63,
11777,
13,
198,
37811,
198,
20285,
305,
8946,
7,
1069,
3712,
3109,
1050,
8,
198,
220,
220,
220,
2488,
15699,
409,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
17946,
82,
5218,
720,
10494,
8,
5218,
3671,
7,
87,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
2124,
17946,
602,
7,
17946,
82,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
4049,
7203,
1837,
41641,
25,
12515,
15582,
11,
1607,
2488,
10494,
1279,
17946,
82,
29,
5218,
1279,
10494,
29,
4943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2488,
44755,
1279,
44755,
62,
17946,
82,
29,
1279,
17946,
82,
29,
5218,
1279,
10494,
29,
198,
198,
13940,
41641,
7543,
329,
4600,
39014,
7,
10494,
11,
1179,
82,
11,
269,
14859,
62,
17946,
82,
8,
47671,
1276,
307,
973,
2641,
4600,
31,
25202,
44646,
198,
6214,
635,
685,
63,
31,
25202,
63,
16151,
31,
5420,
737,
198,
37811,
198,
20285,
305,
269,
14859,
7,
44755,
62,
17946,
82,
11,
409,
3712,
3109,
1050,
8,
198,
220,
220,
220,
2488,
15699,
409,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
17946,
82,
5218,
720,
10494,
8,
5218,
3671,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
2124,
17946,
602,
7,
17946,
82,
828,
2124,
44755,
62,
17946,
602,
7,
44755,
62,
17946,
82,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
4049,
7203,
1837,
41641,
25,
12515,
15582,
11,
1607,
2488,
44755,
1279,
44755,
62,
17946,
82,
29,
1279,
17946,
82,
29,
5218,
1279,
10494,
29,
4943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2488,
1326,
5015,
1179,
82,
198,
198,
13940,
41641,
7543,
329,
4600,
1326,
5015,
7,
17946,
82,
8,
44646,
198,
37811,
198,
20285,
305,
3953,
7,
17946,
82,
8,
198,
220,
220,
220,
3671,
7,
87,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
1326,
5015,
828,
2124,
17946,
602,
7,
17946,
82,
22305,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2488,
5657,
5277,
1179,
82,
198,
198,
13940,
41641,
7543,
329,
4600,
5657,
5277,
7,
17946,
82,
8,
44646,
198,
37811,
198,
20285,
305,
13054,
7,
17946,
82,
8,
198,
220,
220,
220,
3671,
7,
87,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
2124,
17946,
602,
7,
17946,
82,
22305,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2488,
25202,
1279,
8818,
825,
29,
198,
198,
2025,
1662,
378,
257,
22300,
2163,
355,
37826,
43,
648,
3335,
9720,
13,
198,
37811,
198,
20285,
305,
3335,
7,
1069,
8,
198,
220,
220,
220,
3671,
7,
25202,
62,
76,
7,
834,
21412,
834,
11,
409,
4008,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
8027,
62,
301,
549,
7,
81,
28399,
11,
26498,
23029,
198,
198,
32,
2163,
284,
3650,
262,
8246,
4600,
10669,
12360,
63,
286,
5447,
31878,
198,
1462,
1104,
3294,
27965,
13,
775,
836,
470,
3264,
8160,
4600,
12417,
63,
198,
63,
10494,
47671,
4600,
44755,
63,
3503,
13,
780,
356,
460,
470,
1104,
3294,
27965,
198,
261,
606,
3264,
13,
198,
37811,
198,
8818,
8027,
62,
301,
549,
886,
198,
198,
8818,
3335,
62,
76,
7,
4666,
3712,
26796,
11,
409,
8,
198,
220,
220,
220,
318,
62,
8818,
7,
1069,
8,
8614,
4049,
7203,
1069,
806,
257,
2163,
6770,
4943,
198,
220,
220,
220,
474,
1652,
77,
796,
449,
43,
22203,
7,
1069,
8,
198,
220,
220,
220,
318,
22366,
7,
73,
1652,
77,
13,
46265,
22046,
8,
8614,
4049,
7203,
46265,
22046,
318,
407,
4855,
4943,
628,
220,
220,
220,
1441,
2438,
5235,
62,
81,
28399,
7,
73,
1652,
77,
8,
198,
437,
198,
198,
8818,
2438,
5235,
62,
81,
28399,
7,
73,
1652,
77,
3712,
41,
43,
22203,
8,
198,
220,
220,
220,
2170,
12453,
796,
198,
220,
220,
220,
220,
220,
220,
220,
318,
22366,
7,
73,
1652,
77,
13,
3672,
8,
5633,
308,
641,
4948,
7,
25,
81,
28399,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
30277,
13,
786,
87,
1050,
7,
73,
1652,
77,
13,
3672,
11,
36147,
3712,
4008,
5633,
474,
1652,
77,
13,
3672,
13,
22046,
58,
437,
60,
1058,
38357,
7203,
2,
1600,
474,
1652,
77,
13,
3672,
11,
25113,
4943,
628,
220,
220,
220,
1441,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
8189,
5235,
62,
81,
28399,
62,
4906,
7,
73,
1652,
77,
11,
2170,
12453,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
8189,
5235,
62,
25202,
7,
73,
1652,
77,
11,
2170,
12453,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
8189,
5235,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
7,
73,
1652,
77,
11,
2170,
12453,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
8189,
5235,
62,
81,
28399,
62,
301,
549,
7,
73,
1652,
77,
11,
2170,
12453,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
8189,
5235,
62,
30786,
7,
73,
1652,
77,
11,
2170,
12453,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
2438,
5235,
62,
81,
28399,
62,
4906,
7,
4299,
3712,
41,
43,
22203,
11,
2170,
12453,
8,
198,
220,
220,
220,
825,
13,
3672,
318,
64,
38357,
8614,
318,
22366,
7,
4299,
13,
3672,
8,
8614,
1441,
198,
220,
220,
220,
1438,
796,
318,
22366,
7,
4299,
13,
3672,
8,
5633,
2170,
12453,
1058,
825,
13,
3672,
628,
220,
220,
220,
474,
75,
7249,
796,
198,
220,
220,
220,
220,
220,
220,
220,
449,
43,
44909,
7,
26,
1438,
796,
2170,
12453,
11,
2208,
4906,
796,
1058,
16763,
56,
5488,
7293,
5329,
13,
46189,
49,
28399,
90,
3,
7,
25178,
19667,
7,
3672,
4008,
92,
4008,
198,
220,
220,
220,
1441,
2438,
5235,
62,
459,
7,
20362,
7249,
8,
198,
437,
198,
198,
8818,
2438,
5235,
62,
30786,
7,
4299,
3712,
41,
43,
22203,
11,
2170,
12453,
8,
198,
220,
220,
220,
30277,
13,
786,
87,
1050,
7,
4299,
13,
3672,
11,
36147,
3712,
4008,
11405,
1441,
628,
220,
220,
220,
611,
318,
22366,
7,
4299,
13,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
36147,
14055,
13,
31,
834,
15390,
834,
720,
774,
3617,
480,
28955,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
36147,
14055,
13,
31,
834,
15390,
834,
1500,
29568,
4299,
13,
3672,
8,
796,
720,
774,
3617,
480,
28955,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
2438,
5235,
62,
25202,
7,
4299,
3712,
41,
43,
22203,
11,
2170,
12453,
8,
198,
220,
220,
220,
2116,
796,
308,
641,
4948,
7,
25,
944,
8,
198,
220,
220,
220,
26498,
796,
1438,
62,
8807,
12195,
4299,
13,
22046,
8,
628,
220,
220,
220,
474,
1652,
77,
796,
449,
43,
22203,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
1058,
16763,
944,
3712,
3,
774,
3617,
480,
828,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
825,
13,
22046,
11,
198,
220,
220,
220,
220,
220,
220,
220,
810,
37266,
796,
825,
13,
3003,
37266,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1005,
4906,
796,
825,
13,
1186,
4906,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
825,
13,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1767,
796,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
56,
5488,
7293,
5329,
13,
32180,
16763,
944,
11,
29568,
742,
29291,
7,
22046,
986,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
886,
11,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1441,
2438,
5235,
62,
459,
7,
73,
1652,
77,
8,
198,
437,
198,
198,
8818,
32278,
62,
32374,
62,
258,
333,
3969,
886,
198,
198,
8818,
2438,
5235,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
7,
4299,
3712,
41,
43,
22203,
11,
2170,
12453,
8,
198,
220,
220,
220,
2116,
796,
308,
641,
4948,
7,
25,
944,
8,
198,
220,
220,
220,
26498,
796,
1438,
62,
8807,
12195,
4299,
13,
22046,
8,
628,
220,
220,
220,
474,
1652,
77,
796,
449,
43,
22203,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
1058,
16763,
56,
5488,
7293,
5329,
13,
259,
4288,
62,
32374,
62,
258,
333,
3969,
828,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
685,
25,
16763,
944,
3712,
3,
774,
3617,
480,
828,
825,
13,
22046,
986,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
810,
37266,
796,
825,
13,
3003,
37266,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1005,
4906,
796,
825,
13,
1186,
4906,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
825,
13,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1767,
796,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
720,
56,
5488,
7293,
5329,
13,
32180,
16763,
944,
11,
29568,
742,
29291,
7,
22046,
986,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
886,
11,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
1441,
2438,
5235,
62,
459,
7,
73,
1652,
77,
8,
198,
437,
198,
198,
8818,
2438,
5235,
62,
81,
28399,
62,
301,
549,
7,
4299,
3712,
41,
43,
22203,
11,
2170,
12453,
8,
198,
220,
220,
220,
2116,
796,
2488,
15699,
825,
13,
3672,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
3672,
3712,
3,
4906,
8,
5218,
1438,
198,
220,
220,
220,
220,
220,
220,
220,
36147,
3712,
3,
4906,
8,
5218,
308,
641,
4948,
7,
25,
944,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
308,
641,
4948,
7,
25,
944,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
474,
1652,
77,
796,
449,
43,
22203,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
1438,
796,
1058,
16763,
56,
5488,
7293,
5329,
13,
81,
28399,
62,
301,
549,
828,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
685,
25,
16763,
944,
3712,
3,
774,
3617,
480,
828,
825,
13,
22046,
986,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
810,
37266,
796,
825,
13,
3003,
37266,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1005,
4906,
796,
825,
13,
1186,
4906,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1627,
796,
825,
13,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1767,
796,
1007,
79,
576,
62,
10494,
62,
1837,
41641,
7,
7645,
79,
576,
62,
600,
81,
1040,
291,
7,
4299,
13,
2618,
36911,
198,
220,
220,
220,
1267,
628,
220,
220,
220,
1441,
2438,
5235,
62,
459,
7,
73,
1652,
77,
8,
198,
437,
198,
198,
8818,
318,
62,
1837,
41641,
62,
20285,
305,
7,
1069,
8,
198,
220,
220,
220,
2488,
15699,
409,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
38357,
7203,
31,
10494,
4943,
5218,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
38357,
7203,
31,
44755,
4943,
5218,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
38357,
7203,
31,
1326,
5015,
4943,
5218,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
38357,
7203,
31,
5657,
5277,
4943,
5218,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
1539,
1058,
56,
5488,
7293,
5329,
11,
19879,
19667,
7,
3672,
4008,
5218,
318,
62,
1837,
41641,
62,
20285,
305,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
1539,
37826,
7293,
5329,
11,
19879,
19667,
7,
3672,
4008,
5218,
318,
62,
1837,
41641,
62,
20285,
305,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
8060,
8134,
7,
56,
5488,
7293,
5329,
11,
1438,
8,
5218,
318,
62,
1837,
41641,
62,
20285,
305,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
3991,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
24550,
25,
1179,
82,
5218,
8946,
318,
691,
257,
15582,
7543,
329,
8946,
7,
10494,
11,
1179,
82,
8,
198,
8818,
1007,
79,
576,
62,
600,
81,
1040,
291,
7,
1069,
8,
198,
220,
220,
220,
2488,
15699,
409,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
39014,
11,
8946,
11,
1179,
82,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
2124,
17946,
602,
7,
17946,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
39014,
11,
8946,
11,
1179,
82,
11,
269,
14859,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
2124,
17946,
602,
7,
17946,
82,
828,
2124,
44755,
62,
17946,
602,
7,
44755,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
1326,
5015,
11,
1179,
82,
8,
5218,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
1326,
5015,
828,
2124,
17946,
602,
7,
17946,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
5657,
5277,
11,
1179,
82,
8,
5218,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
2124,
17946,
602,
7,
17946,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
1069,
806,
11,
1179,
82,
8,
5218,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
1069,
806,
828,
2124,
17946,
602,
7,
17946,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2198,
2984,
1484,
21179,
4049,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
39014,
11,
4808,
23029,
5218,
4049,
7203,
1837,
41641,
25,
4174,
318,
257,
17232,
28327,
2163,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
1326,
5015,
11,
4808,
23029,
5218,
4049,
7203,
1837,
41641,
25,
4174,
318,
257,
17232,
28327,
2163,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
5657,
5277,
11,
4808,
23029,
5218,
4049,
7203,
1837,
41641,
25,
4174,
318,
257,
17232,
28327,
2163,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
13345,
11,
1058,
1069,
806,
11,
4808,
23029,
5218,
4049,
7203,
1837,
41641,
25,
4174,
318,
257,
17232,
28327,
2163,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
2256,
11,
26498,
23029,
5218,
1475,
1050,
7,
2256,
11,
3975,
7,
7645,
79,
576,
62,
600,
81,
1040,
291,
11,
26498,
8,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
409,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
1007,
79,
576,
62,
10494,
62,
1837,
41641,
7,
1069,
8,
198,
220,
220,
220,
2488,
15699,
409,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
428,
691,
2190,
5218,
15582,
287,
2512,
14,
1616,
14,
361,
14,
1640,
3503,
13,
355,
8946,
336,
16762,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
17946,
82,
5218,
720,
10494,
8,
5218,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
2124,
17946,
602,
7,
17946,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
428,
481,
1656,
287,
11614,
2163,
6770,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
25,
595,
4131,
84,
328,
414,
428,
290,
2163,
4909,
691,
2060,
1627,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2488,
25202,
2163,
10349,
7,
1169,
8326,
11,
872,
72,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
352,
5218,
1395,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1475,
1050,
7,
25,
9967,
11,
336,
16762,
16,
11,
1627,
3712,
13949,
15057,
19667,
11,
336,
16762,
17,
8,
5218,
409,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
20285,
12204,
439,
11,
38357,
7203,
31,
25202,
12340,
4808,
23029,
5218,
4049,
7203,
1837,
41641,
25,
2314,
423,
28376,
2488,
25202,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
20285,
12204,
439,
11,
1438,
11,
26498,
23029,
5218,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
62,
1837,
41641,
62,
20285,
305,
7,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
409,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
356,
2700,
1353,
8354,
1179,
82,
14804,
10494,
284,
307,
5716,
355,
8946,
336,
16762,
2641,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
477,
2488,
25202,
3814,
1390,
1729,
12,
56,
5488,
7293,
5329,
34749,
284,
787,
1243,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
588,
2488,
259,
65,
3733,
3503,
13,
670,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
1475,
1050,
7,
25,
20285,
12204,
439,
11,
1438,
11,
3975,
7,
7645,
79,
576,
62,
10494,
62,
1837,
41641,
11,
26498,
8,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
356,
691,
2330,
1351,
584,
15582,
994,
284,
307,
3338,
198,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
9967,
11,
26498,
23029,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
361,
11,
26498,
23029,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
17772,
361,
11,
26498,
23029,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
1616,
11,
26498,
23029,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
1640,
11,
26498,
23029,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
28311,
11,
26498,
23029,
5218,
1475,
1050,
7,
1069,
13,
2256,
11,
3975,
7,
7645,
79,
576,
62,
10494,
62,
1837,
41641,
11,
26498,
8,
23029,
628,
220,
220,
220,
220,
220,
220,
220,
1475,
1050,
7,
25,
8818,
11,
869,
11,
1767,
8,
5218,
1475,
1050,
7,
25,
8818,
11,
869,
11,
1007,
79,
576,
62,
10494,
62,
1837,
41641,
7,
2618,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
409,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
27568,
2163,
2558,
81,
1040,
873,
13,
39014,
7,
3712,
23839,
38804,
11,
1034,
3712,
32180,
90,
47,
11,
42035,
30072,
810,
1391,
47,
11,
42035,
92,
198,
220,
220,
220,
269,
72,
11,
299,
22046,
796,
7330,
62,
8189,
10951,
7,
404,
8,
198,
220,
220,
220,
649,
796,
968,
10669,
12360,
7,
979,
8,
198,
220,
220,
220,
7881,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
362,
11,
38357,
7203,
2,
30238,
2,
48774,
198,
220,
220,
220,
3335,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
513,
11,
38357,
7203,
2,
404,
2,
48774,
198,
220,
220,
220,
555,
8002,
62,
25202,
0,
7,
3605,
11,
3335,
11,
299,
22046,
8,
198,
220,
220,
220,
329,
357,
85,
11,
336,
16762,
8,
287,
649,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
31943,
336,
16762,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1438,
828,
26498,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
58,
85,
60,
796,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1438,
828,
7881,
11,
26498,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
37498,
28,
828,
10852,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1438,
828,
26498,
986,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
58,
85,
60,
796,
1475,
1050,
7,
37498,
28,
828,
10852,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
5317,
81,
1040,
873,
11,
1438,
828,
7881,
11,
26498,
986,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
4808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2438,
62,
10951,
796,
5461,
7,
3605,
8,
198,
220,
220,
220,
611,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
24844,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
2446,
796,
717,
7,
24396,
82,
7,
259,
4288,
62,
32374,
62,
258,
333,
3969,
11,
309,
29291,
90,
47,
11,
42035,
13,
17143,
7307,
986,
92,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
796,
2446,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2438,
62,
10951,
198,
437,
198,
198,
8818,
4808,
19119,
62,
43384,
62,
301,
16762,
7,
69,
11,
649,
11,
410,
11,
336,
16762,
8,
198,
220,
220,
220,
2488,
31943,
336,
16762,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
4808,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
649,
58,
85,
60,
796,
277,
7,
301,
16762,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
37498,
28,
828,
10852,
11,
9529,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
649,
58,
85,
60,
796,
1475,
1050,
7,
37498,
28,
828,
10852,
11,
277,
7,
81,
11994,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
4808,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
27568,
2163,
2558,
81,
1040,
873,
13,
39014,
7,
198,
220,
220,
220,
7904,
23839,
38804,
11,
198,
220,
220,
220,
1034,
3712,
32180,
90,
47,
11,
42035,
5512,
198,
220,
220,
220,
7904,
43,
20968,
11,
198,
8,
810,
1391,
47,
11,
42035,
92,
198,
220,
220,
220,
269,
72,
11,
299,
22046,
796,
7330,
62,
8189,
10951,
7,
404,
8,
198,
220,
220,
220,
649,
796,
968,
10669,
12360,
7,
979,
8,
198,
220,
220,
220,
7881,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
362,
11,
38357,
7203,
2,
30238,
2,
48774,
198,
220,
220,
220,
3335,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
513,
11,
38357,
7203,
2,
404,
2,
48774,
198,
220,
220,
220,
15095,
62,
17946,
82,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
604,
11,
38357,
7203,
2,
17946,
82,
2,
48774,
198,
220,
220,
220,
555,
8002,
62,
25202,
0,
7,
3605,
11,
3335,
11,
299,
22046,
8,
628,
220,
220,
220,
329,
357,
85,
11,
336,
16762,
8,
287,
649,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
19119,
62,
43384,
62,
301,
16762,
7,
3605,
11,
410,
11,
336,
16762,
8,
466,
336,
16762,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
31943,
336,
16762,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
7881,
11,
8946,
11,
649,
62,
17946,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
1179,
82,
11,
269,
14859,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
44755,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
269,
14859,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
7881,
11,
8946,
11,
649,
62,
17946,
82,
11,
649,
62,
44755,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
1326,
5015,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
1326,
5015,
828,
7881,
11,
649,
62,
17946,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
7881,
11,
649,
62,
17946,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
1069,
806,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
1069,
806,
828,
7881,
11,
649,
62,
17946,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
4808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
336,
16762,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2438,
62,
10951,
796,
5461,
7,
3605,
8,
198,
220,
220,
220,
611,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
24844,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
2446,
796,
717,
7,
24396,
82,
7,
259,
4288,
62,
32374,
62,
258,
333,
3969,
11,
309,
29291,
90,
47,
11,
42035,
13,
17143,
7307,
986,
92,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
796,
2446,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2438,
62,
10951,
198,
437,
198,
198,
31,
27568,
2163,
2558,
81,
1040,
873,
13,
39014,
7,
198,
220,
220,
220,
7904,
23839,
38804,
11,
198,
220,
220,
220,
1034,
3712,
32180,
90,
47,
11,
42035,
5512,
198,
220,
220,
220,
7904,
43,
20968,
11,
198,
220,
220,
220,
7904,
40069,
43,
20968,
11,
198,
8,
810,
1391,
47,
11,
42035,
92,
198,
220,
220,
220,
269,
72,
11,
299,
22046,
796,
7330,
62,
8189,
10951,
7,
404,
8,
198,
220,
220,
220,
649,
796,
968,
10669,
12360,
7,
979,
8,
198,
220,
220,
220,
7881,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
362,
11,
38357,
7203,
2,
30238,
2,
48774,
198,
220,
220,
220,
3335,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
513,
11,
38357,
7203,
2,
404,
2,
48774,
198,
220,
220,
220,
15095,
62,
17946,
82,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
604,
11,
38357,
7203,
2,
17946,
82,
2,
48774,
198,
220,
220,
220,
15095,
62,
44755,
796,
7550,
0,
7,
3605,
13,
6649,
1747,
11,
642,
11,
38357,
7203,
2,
44755,
2,
48774,
198,
220,
220,
220,
555,
8002,
62,
25202,
0,
7,
3605,
11,
3335,
11,
299,
22046,
8,
628,
220,
220,
220,
329,
357,
85,
11,
336,
16762,
8,
287,
649,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
19119,
62,
43384,
62,
301,
16762,
7,
3605,
11,
410,
11,
336,
16762,
8,
466,
336,
16762,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
31943,
336,
16762,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
7881,
11,
8946,
11,
649,
62,
17946,
82,
11,
15095,
62,
44755,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
8946,
11,
1179,
82,
11,
269,
14859,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
4574,
0,
7,
3605,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
44755,
796,
4574,
0,
7,
3605,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
269,
14859,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
44755,
796,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
3605,
11,
2124,
13345,
7,
22289,
8134,
7,
56,
5488,
43,
20968,
11,
1058,
647,
469,
62,
17946,
602,
828,
649,
62,
44755,
11,
15095,
62,
44755,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
39014,
828,
7881,
11,
8946,
11,
649,
62,
17946,
82,
11,
649,
62,
44755,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
1326,
5015,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36147,
18224,
7203,
66,
34574,
4174,
14821,
1630,
319,
15558,
48774,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
62,
17946,
82,
796,
7550,
0,
7,
3605,
11,
410,
11,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
15095,
62,
17946,
82,
11,
1179,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2124,
13345,
7,
22289,
8134,
7,
5317,
81,
1040,
873,
11,
1058,
5657,
5277,
828,
7881,
11,
649,
62,
17946,
82,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
39434,
5317,
81,
1040,
873,
11,
1058,
1069,
806,
828,
1179,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
36147,
18224,
7203,
66,
34574,
4174,
14821,
1630,
319,
15558,
357,
1069,
806,
341,
16725,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
7442,
4808,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
336,
16762,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2438,
62,
10951,
796,
5461,
7,
3605,
8,
198,
220,
220,
220,
611,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
24844,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
2446,
796,
717,
7,
24396,
82,
7,
259,
4288,
62,
32374,
62,
258,
333,
3969,
11,
309,
29291,
90,
47,
11,
42035,
13,
17143,
7307,
986,
92,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2438,
62,
10951,
13,
24396,
62,
1640,
62,
259,
4288,
62,
32374,
62,
258,
333,
3969,
796,
2446,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2438,
62,
10951,
198,
437,
628,
198,
8818,
7330,
62,
8189,
10951,
7,
3712,
6030,
90,
32180,
90,
47,
11,
42035,
11709,
8,
810,
1391,
47,
11,
42035,
92,
198,
220,
220,
220,
299,
22046,
796,
4129,
7,
42035,
13,
17143,
7307,
8,
198,
220,
220,
220,
256,
83,
796,
309,
29291,
90,
47,
11,
42035,
13,
17143,
7307,
986,
92,
198,
220,
220,
220,
13845,
796,
5050,
7,
81,
28399,
62,
301,
549,
11,
256,
83,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
907,
8,
6624,
352,
198,
220,
220,
220,
2446,
796,
717,
7,
907,
8,
198,
220,
220,
220,
2446,
62,
22046,
796,
309,
29291,
90,
4906,
1659,
7,
81,
28399,
62,
301,
549,
828,
926,
13,
17143,
7307,
986,
92,
198,
220,
220,
220,
21504,
796,
7231,
13,
7293,
5329,
13,
20887,
1096,
62,
24396,
7,
24396,
11,
2446,
62,
22046,
11,
7231,
13,
82,
35138,
28955,
198,
220,
220,
220,
269,
72,
796,
7231,
13,
7293,
5329,
13,
1186,
30227,
62,
8189,
62,
10951,
7,
11632,
8,
628,
220,
220,
220,
1438,
796,
8027,
62,
3672,
7,
47,
8,
198,
220,
220,
220,
9493,
316,
540,
796,
4377,
21737,
198,
220,
220,
220,
329,
1627,
10951,
287,
269,
72,
13,
2815,
316,
540,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9493,
316,
540,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7231,
13,
13949,
12360,
19667,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
10951,
13,
21412,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1438,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
10951,
13,
7753,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
10951,
13,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1627,
10951,
13,
259,
10837,
62,
265,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10612,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
886,
198,
220,
220,
220,
269,
72,
13,
2815,
316,
540,
796,
9493,
316,
540,
198,
220,
220,
220,
269,
72,
13,
276,
3212,
796,
7231,
13,
17410,
33384,
58,
11632,
60,
198,
220,
220,
220,
1441,
269,
72,
11,
299,
22046,
198,
437,
198,
198,
8818,
555,
8002,
62,
25202,
0,
7,
3605,
3712,
3791,
10669,
12360,
11,
1034,
3712,
3791,
38963,
15057,
11,
299,
22046,
3712,
5317,
8,
198,
220,
220,
220,
1303,
4064,
8000,
796,
1034,
13,
8000,
198,
220,
220,
220,
2560,
796,
4574,
0,
7,
3605,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
14881,
11,
1058,
1136,
3245,
828,
1034,
11,
19879,
19667,
7,
25,
8000,
22305,
628,
220,
220,
220,
611,
299,
22046,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4064,
22046,
796,
1034,
13,
22046,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
4574,
0,
7,
3605,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
14881,
11,
1058,
1136,
3245,
828,
1034,
11,
19879,
19667,
7,
25,
22046,
22305,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
4064,
944,
796,
4064,
8000,
198,
220,
220,
220,
4574,
0,
7,
3605,
11,
1475,
1050,
7,
37498,
28,
828,
32026,
15057,
7,
17,
828,
2560,
4008,
628,
220,
220,
220,
329,
479,
287,
352,
25,
77,
22046,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
3605,
11,
1475,
1050,
7,
37498,
28,
828,
32026,
15057,
7,
74,
1343,
362,
828,
2124,
13345,
7,
22289,
8134,
7,
14881,
11,
1058,
1136,
9630,
828,
26498,
11,
479,
22305,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
649,
198,
437,
198
] | 2.192574 | 6,787 |
module EquivalentCircuits
export circuitevolution
export parameteroptimisation
export loadpopulation
export Circuit, EquivalentCircuit
using Random, Combinatorics, GeneralizedGenerated, DelimitedFiles, Distributions, Optim
import Base: isless, length
include("Circuits.jl")
include("CircuitFunction.jl")
include("EvolutionOperators.jl")
include("ObjectiveFunction.jl")
include("OptimizeParameters.jl")
include("SimulateImpedance.jl")
include("CircuitSimplification.jl")
include("CircuitLibrary.jl")
include("RedundancyTesting.jl")
include("CircuitEvolution.jl")
end
| [
21412,
7889,
29540,
31560,
15379,
628,
220,
220,
220,
10784,
2498,
84,
578,
85,
2122,
198,
220,
220,
220,
10784,
11507,
40085,
5612,
198,
220,
220,
220,
10784,
3440,
39748,
198,
220,
220,
220,
10784,
13588,
11,
7889,
29540,
31560,
5013,
198,
220,
220,
220,
1262,
14534,
11,
955,
8800,
1352,
873,
11,
3611,
1143,
8645,
515,
11,
4216,
320,
863,
25876,
11,
46567,
507,
11,
30011,
198,
220,
220,
220,
1330,
7308,
25,
318,
1203,
11,
4129,
628,
220,
220,
220,
2291,
7203,
31560,
15379,
13,
20362,
4943,
220,
198,
220,
220,
220,
2291,
7203,
31560,
5013,
22203,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
15200,
2122,
18843,
2024,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
10267,
425,
22203,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
27871,
48439,
48944,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
8890,
5039,
26950,
276,
590,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
31560,
5013,
8890,
489,
2649,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
31560,
5013,
23377,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
7738,
917,
3883,
44154,
13,
20362,
4943,
198,
220,
220,
220,
2291,
7203,
31560,
5013,
15200,
2122,
13,
20362,
4943,
198,
198,
437,
198
] | 3.033493 | 209 |
# Ported to Julia by Andy Ferris, 2016, and re-released under an MIT license.
#/**
# * Copyright (c) Charles Karney (2008-2015) <charles@karney.com> and licensed
# * under the MIT/X11 License. For more information, see
# * http://geographiclib.sourceforge.net/
# **********************************************************************/
"""
(x, y, gamma, k) = polarst_fwd(northpole::Bool, k0::Float64, tm::TransverseMercator, lat, lon)
Perform polar-stereographic projection of `lat` and `lon` with respect to north
or south pole `northpole` and horizontal scaling `k0` (`= 0.994` for UPS).
`γ` and `k` are the local convergence and scaling factors, respectively.
"""
function polarst_fwd(northp::Bool, k0::Float64, tm::TransverseMercator, lat, lon) # k0 is scale factor...
lat = LatFix(lat) * (northp ? 1 : -1)
tau = tand(lat)
secphi = hypot(1.0, tau)
taup = taupf(tau, tm.e2) # TODO revert to C++ es here?
rho = hypot(1.0, taup) + abs(taup)
rho = (taup >= 0 ? (lat != 90 ? 1/rho : 0.0) : rho)
rho *= 2 * k0 * tm.a / tm.c
k = (lat != 90 ? (rho / tm.a) * secphi * sqrt(tm.e2m + tm.e2 / (secphi*secphi)) : k0)
x = sind(lon)
y = cosd(lon)
x *= rho
y *= (northp ? -rho : rho)
gamma = AngNormalize(northp ? lon : -lon)
return (x, y, gamma, k)
end
"""
(lat, lon, gamma, k) = polarst_inv(northp::Bool, k0::Float64, tm::TransverseMercator, x, y)
Invert polar-stereographic projection of `x` and `y` with respect to north
or south pole `northpole` and horizontal scaling `k0` (`= 0.994` for UPS).
`γ` and `k` are the local convergence and scaling factors, respectively.
"""
function polarst_inv(northp::Bool, k0::Float64, tm::TransverseMercator, x, y) # k0 is scale factor...
rho = hypot(x, y)
t = (rho > 0 ? rho / (2 * k0 * tm.a / tm.c) : eps(Float64)*eps(Float64))
taup = (1 / t - t) / 2
tau = tauf(taup, tm.e2) # TODO revert to C++ es here?
secphi = hypot(1.0, tau)
k = (rho > 0 ? (rho / tm.a) * secphi * sqrt(tm.e2m + tm.e2 / (secphi*secphi)) : k0)
lat = (northp ? 1 : -1) * atand(tau)
lon = atan2(x, northp ? -y : y ) * 180/pi
gamma = AngNormalize(northp ? lon : -lon)
return (lat, lon, gamma, k)
end
| [
2,
4347,
276,
284,
22300,
416,
12382,
12880,
2442,
11,
1584,
11,
290,
302,
12,
30147,
739,
281,
17168,
5964,
13,
198,
2,
35343,
198,
2,
1635,
15069,
357,
66,
8,
7516,
9375,
1681,
357,
11528,
12,
4626,
8,
1279,
10641,
829,
31,
21070,
1681,
13,
785,
29,
290,
11971,
198,
2,
1635,
739,
262,
17168,
14,
55,
1157,
13789,
13,
220,
1114,
517,
1321,
11,
766,
198,
2,
1635,
2638,
1378,
469,
6826,
8019,
13,
10459,
30293,
13,
3262,
14,
198,
2,
41906,
17174,
2466,
1174,
14,
198,
198,
37811,
198,
220,
220,
220,
357,
87,
11,
331,
11,
34236,
11,
479,
8,
796,
13559,
301,
62,
69,
16993,
7,
43588,
36869,
3712,
33,
970,
11,
479,
15,
3712,
43879,
2414,
11,
256,
76,
3712,
8291,
4399,
42981,
1352,
11,
3042,
11,
300,
261,
8,
198,
198,
5990,
687,
13559,
12,
301,
567,
6826,
20128,
286,
4600,
15460,
63,
290,
4600,
14995,
63,
351,
2461,
284,
5093,
198,
273,
5366,
16825,
4600,
43588,
36869,
63,
290,
16021,
20796,
4600,
74,
15,
63,
357,
63,
28,
657,
13,
42691,
63,
329,
33513,
737,
198,
63,
42063,
63,
290,
4600,
74,
63,
389,
262,
1957,
40826,
290,
20796,
5087,
11,
8148,
13,
198,
37811,
198,
8818,
13559,
301,
62,
69,
16993,
7,
43588,
79,
3712,
33,
970,
11,
479,
15,
3712,
43879,
2414,
11,
256,
76,
3712,
8291,
4399,
42981,
1352,
11,
3042,
11,
300,
261,
8,
1303,
479,
15,
318,
5046,
5766,
986,
198,
220,
220,
220,
3042,
796,
5476,
22743,
7,
15460,
8,
1635,
357,
43588,
79,
5633,
352,
1058,
532,
16,
8,
628,
220,
220,
220,
256,
559,
796,
256,
392,
7,
15460,
8,
198,
220,
220,
220,
792,
34846,
796,
8813,
7,
16,
13,
15,
11,
256,
559,
8,
198,
220,
220,
220,
256,
559,
79,
796,
256,
559,
79,
69,
7,
83,
559,
11,
256,
76,
13,
68,
17,
8,
1303,
16926,
46,
34052,
284,
327,
4880,
1658,
994,
30,
198,
220,
220,
220,
374,
8873,
796,
8813,
7,
16,
13,
15,
11,
256,
559,
79,
8,
1343,
2352,
7,
83,
559,
79,
8,
198,
220,
220,
220,
374,
8873,
796,
357,
83,
559,
79,
18189,
657,
5633,
357,
15460,
14512,
4101,
5633,
352,
14,
81,
8873,
1058,
657,
13,
15,
8,
1058,
374,
8873,
8,
198,
220,
220,
220,
374,
8873,
1635,
28,
362,
1635,
479,
15,
1635,
256,
76,
13,
64,
1220,
256,
76,
13,
66,
198,
220,
220,
220,
479,
796,
357,
15460,
14512,
4101,
5633,
357,
81,
8873,
1220,
256,
76,
13,
64,
8,
1635,
792,
34846,
1635,
19862,
17034,
7,
17209,
13,
68,
17,
76,
1343,
256,
76,
13,
68,
17,
1220,
357,
2363,
34846,
9,
2363,
34846,
4008,
1058,
479,
15,
8,
198,
220,
220,
220,
2124,
796,
264,
521,
7,
14995,
8,
198,
220,
220,
220,
331,
796,
8615,
67,
7,
14995,
8,
198,
220,
220,
220,
2124,
1635,
28,
374,
8873,
198,
220,
220,
220,
331,
1635,
28,
357,
43588,
79,
5633,
532,
81,
8873,
1058,
374,
8873,
8,
198,
220,
220,
220,
34236,
796,
2895,
26447,
1096,
7,
43588,
79,
5633,
300,
261,
1058,
532,
14995,
8,
628,
220,
220,
220,
1441,
357,
87,
11,
331,
11,
34236,
11,
479,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
357,
15460,
11,
300,
261,
11,
34236,
11,
479,
8,
796,
13559,
301,
62,
16340,
7,
43588,
79,
3712,
33,
970,
11,
479,
15,
3712,
43879,
2414,
11,
256,
76,
3712,
8291,
4399,
42981,
1352,
11,
2124,
11,
331,
8,
198,
198,
818,
1851,
13559,
12,
301,
567,
6826,
20128,
286,
4600,
87,
63,
290,
4600,
88,
63,
351,
2461,
284,
5093,
198,
273,
5366,
16825,
4600,
43588,
36869,
63,
290,
16021,
20796,
4600,
74,
15,
63,
357,
63,
28,
657,
13,
42691,
63,
329,
33513,
737,
198,
63,
42063,
63,
290,
4600,
74,
63,
389,
262,
1957,
40826,
290,
20796,
5087,
11,
8148,
13,
198,
37811,
198,
8818,
13559,
301,
62,
16340,
7,
43588,
79,
3712,
33,
970,
11,
479,
15,
3712,
43879,
2414,
11,
256,
76,
3712,
8291,
4399,
42981,
1352,
11,
2124,
11,
331,
8,
1303,
479,
15,
318,
5046,
5766,
986,
198,
220,
220,
220,
374,
8873,
796,
8813,
7,
87,
11,
331,
8,
198,
220,
220,
220,
256,
796,
357,
81,
8873,
1875,
657,
5633,
374,
8873,
1220,
357,
17,
1635,
479,
15,
1635,
256,
76,
13,
64,
1220,
256,
76,
13,
66,
8,
1058,
304,
862,
7,
43879,
2414,
27493,
25386,
7,
43879,
2414,
4008,
198,
220,
220,
220,
256,
559,
79,
796,
357,
16,
1220,
256,
532,
256,
8,
1220,
362,
198,
220,
220,
220,
256,
559,
796,
256,
559,
69,
7,
83,
559,
79,
11,
256,
76,
13,
68,
17,
8,
1303,
16926,
46,
34052,
284,
327,
4880,
1658,
994,
30,
198,
220,
220,
220,
792,
34846,
796,
8813,
7,
16,
13,
15,
11,
256,
559,
8,
198,
220,
220,
220,
479,
796,
357,
81,
8873,
1875,
657,
5633,
357,
81,
8873,
1220,
256,
76,
13,
64,
8,
1635,
792,
34846,
1635,
19862,
17034,
7,
17209,
13,
68,
17,
76,
1343,
256,
76,
13,
68,
17,
1220,
357,
2363,
34846,
9,
2363,
34846,
4008,
1058,
479,
15,
8,
198,
220,
220,
220,
3042,
796,
357,
43588,
79,
5633,
352,
1058,
532,
16,
8,
1635,
379,
392,
7,
83,
559,
8,
198,
220,
220,
220,
300,
261,
796,
379,
272,
17,
7,
87,
11,
5093,
79,
5633,
532,
88,
1058,
331,
1267,
1635,
11546,
14,
14415,
198,
220,
220,
220,
34236,
796,
2895,
26447,
1096,
7,
43588,
79,
5633,
300,
261,
1058,
532,
14995,
8,
628,
220,
220,
220,
1441,
357,
15460,
11,
300,
261,
11,
34236,
11,
479,
8,
198,
437,
198
] | 2.341463 | 943 |
module MarkerFile
using ..LIKWID: LibLikwid
"""
Reads in the result file of an application run instrumented by the LIKWID Marker API.
*Note:* julia must have been started under `likwid-perfctr ... -m`.
"""
function read(fp::AbstractString)
ret = LibLikwid.perfmon_readMarkerFile(fp)
return ret ≥ 0
end
"""
Return the number of regions in an application run.
"""
numregions() = Int(LibLikwid.perfmon_getNumberOfRegions())
"""
Return the region tag for the region identified by `ridx`.
"""
regiontag(ridx) = unsafe_string(LibLikwid.perfmon_getTagOfRegion(ridx))
"""
Return the group id for the region identified by `ridx`.
"""
regiongroup(ridx) = Int(LibLikwid.perfmon_getGroupOfRegion(ridx))
"""
Return the number of events of the region identified by `ridx`.
"""
regionevents(ridx) = Int(LibLikwid.perfmon_getEventsOfRegion(ridx))
"""
Return the number of metrics of the region identified by `ridx`.
"""
regionmetrics(ridx) = Int(LibLikwid.perfmon_getMetricsOfRegion(ridx))
"""
Return the number of threads of the region identified by `ridx`.
"""
regionthreads(ridx) = Int(LibLikwid.perfmon_getThreadsOfRegion(ridx))
"""
Return the accumulated measurement time for the region identified by `rid` and the thread index `tidx`.
"""
regiontime(ridx, tidx) = LibLikwid.perfmon_getTimeOfRegion(ridx, tidx)
"""
Return the call count for the region identified by `rid` and the thread index `tidx`.
"""
regioncount(ridx, tidx) = LibLikwid.perfmon_getCountOfRegion(ridx, tidx)
"""
Return the call count for the region identified by `ridx`, the event index `eidx` and the thread index `tidx`.
"""
regionresult(ridx, eidx, tidx) = LibLikwid.perfmon_getResultOfRegionThread(ridx, eidx, tidx)
"""
Return the call count for the region identified by `ridx`, the metric index `midx` and the thread index `tidx`.
"""
regionmetric(ridx, midx, tidx) = LibLikwid.perfmon_getMetricOfRegionThread(ridx, midx, tidx)
end # module
| [
21412,
2940,
263,
8979,
198,
198,
3500,
11485,
43,
18694,
54,
2389,
25,
7980,
43,
1134,
28029,
198,
198,
37811,
198,
5569,
82,
287,
262,
1255,
2393,
286,
281,
3586,
1057,
8875,
276,
416,
262,
406,
18694,
54,
2389,
2940,
263,
7824,
13,
198,
198,
9,
6425,
25,
9,
474,
43640,
1276,
423,
587,
2067,
739,
4600,
46965,
28029,
12,
525,
69,
24087,
2644,
532,
76,
44646,
198,
37811,
198,
8818,
1100,
7,
46428,
3712,
23839,
10100,
8,
198,
220,
220,
220,
1005,
796,
7980,
43,
1134,
28029,
13,
525,
69,
2144,
62,
961,
9704,
263,
8979,
7,
46428,
8,
198,
220,
220,
220,
1441,
1005,
26870,
657,
198,
437,
198,
198,
37811,
198,
13615,
262,
1271,
286,
7652,
287,
281,
3586,
1057,
13,
198,
37811,
198,
22510,
2301,
507,
3419,
796,
2558,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
15057,
5189,
8081,
507,
28955,
198,
198,
37811,
198,
13615,
262,
3814,
7621,
329,
262,
3814,
5174,
416,
4600,
6058,
87,
44646,
198,
37811,
198,
36996,
12985,
7,
6058,
87,
8,
796,
21596,
62,
8841,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
24835,
5189,
47371,
7,
6058,
87,
4008,
198,
198,
37811,
198,
13615,
262,
1448,
4686,
329,
262,
3814,
5174,
416,
4600,
6058,
87,
44646,
198,
37811,
198,
36996,
8094,
7,
6058,
87,
8,
796,
2558,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
13247,
5189,
47371,
7,
6058,
87,
4008,
198,
198,
37811,
198,
13615,
262,
1271,
286,
2995,
286,
262,
3814,
5174,
416,
4600,
6058,
87,
44646,
198,
37811,
198,
36996,
31534,
7,
6058,
87,
8,
796,
2558,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
37103,
5189,
47371,
7,
6058,
87,
4008,
198,
198,
37811,
198,
13615,
262,
1271,
286,
20731,
286,
262,
3814,
5174,
416,
4600,
6058,
87,
44646,
198,
37811,
198,
36996,
4164,
10466,
7,
6058,
87,
8,
796,
2558,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
9171,
10466,
5189,
47371,
7,
6058,
87,
4008,
198,
198,
37811,
198,
13615,
262,
1271,
286,
14390,
286,
262,
3814,
5174,
416,
4600,
6058,
87,
44646,
198,
37811,
198,
36996,
16663,
82,
7,
6058,
87,
8,
796,
2558,
7,
25835,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
16818,
82,
5189,
47371,
7,
6058,
87,
4008,
198,
198,
37811,
198,
13615,
262,
22425,
15558,
640,
329,
262,
3814,
5174,
416,
4600,
6058,
63,
290,
262,
4704,
6376,
4600,
83,
312,
87,
44646,
198,
37811,
198,
36996,
2435,
7,
6058,
87,
11,
29770,
87,
8,
796,
7980,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
7575,
5189,
47371,
7,
6058,
87,
11,
29770,
87,
8,
198,
198,
37811,
198,
13615,
262,
869,
954,
329,
262,
3814,
5174,
416,
4600,
6058,
63,
290,
262,
4704,
6376,
4600,
83,
312,
87,
44646,
198,
37811,
198,
36996,
9127,
7,
6058,
87,
11,
29770,
87,
8,
796,
7980,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
12332,
5189,
47371,
7,
6058,
87,
11,
29770,
87,
8,
198,
198,
37811,
198,
13615,
262,
869,
954,
329,
262,
3814,
5174,
416,
4600,
6058,
87,
47671,
262,
1785,
6376,
4600,
68,
312,
87,
63,
290,
262,
4704,
6376,
4600,
83,
312,
87,
44646,
198,
37811,
198,
36996,
20274,
7,
6058,
87,
11,
304,
312,
87,
11,
29770,
87,
8,
796,
7980,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
23004,
5189,
47371,
16818,
7,
6058,
87,
11,
304,
312,
87,
11,
29770,
87,
8,
198,
198,
37811,
198,
13615,
262,
869,
954,
329,
262,
3814,
5174,
416,
4600,
6058,
87,
47671,
262,
18663,
6376,
4600,
13602,
87,
63,
290,
262,
4704,
6376,
4600,
83,
312,
87,
44646,
198,
37811,
198,
36996,
4164,
1173,
7,
6058,
87,
11,
3095,
87,
11,
29770,
87,
8,
796,
7980,
43,
1134,
28029,
13,
525,
69,
2144,
62,
1136,
9171,
1173,
5189,
47371,
16818,
7,
6058,
87,
11,
3095,
87,
11,
29770,
87,
8,
198,
198,
437,
1303,
8265,
198
] | 2.910876 | 662 |
using Test
using MaxEntropyGraphs
include("./models.jl")
| [
3500,
6208,
198,
3500,
5436,
14539,
28338,
37065,
82,
198,
198,
17256,
7,
1911,
14,
27530,
13,
20362,
4943,
628
] | 2.95 | 20 |
using PrettyTables
function get_fermi()
rex = r"@@@ Average Fock Time:\s([0-9]*\.?[0-9]*)"
fpath = joinpath(@__DIR__, "fermi/output.dat")
timings = zeros(22)
i = 1
for l = eachline(fpath)
m = match(rex, l)
if m !== nothing
timings[i] = m.captures[1] |> String |> x->parse(Float64,x)
i += 1
end
end
@assert i == 23 # meaning that 22 entries were found
return timings
end
function get_psi4()
Frex = r"HF:\sForm\sF\s+:.+?([0-9]*\.?[0-9]*)w\s+([0-9]+)\scalls"
Grex = r"HF:\sForm\sG\s+:.+?([0-9]*\.?[0-9]*)w\s+([0-9]+)\scalls"
cd(joinpath(@__DIR__, "psi4"))
timings = zeros(22)
# For each molecule
for i = eachindex(timings)
Ncalls = []
Ft = []
Gt = []
for l = eachline("S$i/timer.dat")
Fm = match(Frex, l)
Gm = match(Grex, l)
if Fm !== nothing
t = Fm.captures[1] |> String |> x->parse(Float64,x)
N = Fm.captures[2] |> String |> x->parse(Int,x)
push!(Ncalls, N)
push!(Ft, t)
end
if Gm !== nothing
t = Gm.captures[1] |> String |> x->parse(Float64,x)
N = Gm.captures[2] |> String |> x->parse(Int,x)
push!(Ncalls, N)
push!(Gt, t)
end
end
# Make sure all data is consistent
@assert all(Ncalls .== Ncalls[1])
@assert all(Ft .== Ft[1])
@assert all(Gt .== Gt[1])
# Compute timing
timings[i] = (Ft[1] + Gt[1]) / Ncalls[1]
end
cd("..")
return timings
end
if abspath(PROGRAM_FILE) == @__FILE__
fermi = get_fermi()
psi4 = get_psi4()
@pt :header = ["Fermi", "Psi4"] [fermi psi4]
end
| [
3500,
20090,
51,
2977,
198,
198,
8818,
651,
62,
2232,
11632,
3419,
198,
220,
220,
220,
302,
87,
796,
374,
1,
12404,
31,
13475,
376,
735,
3862,
7479,
82,
26933,
15,
12,
24,
60,
9,
17405,
30,
58,
15,
12,
24,
60,
9,
16725,
198,
220,
220,
220,
277,
6978,
796,
4654,
6978,
7,
31,
834,
34720,
834,
11,
366,
2232,
11632,
14,
22915,
13,
19608,
4943,
198,
220,
220,
220,
4628,
654,
796,
1976,
27498,
7,
1828,
8,
198,
220,
220,
220,
1312,
796,
352,
198,
220,
220,
220,
329,
300,
796,
1123,
1370,
7,
69,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
285,
796,
2872,
7,
21510,
11,
300,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
285,
5145,
855,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4628,
654,
58,
72,
60,
796,
285,
13,
27144,
942,
58,
16,
60,
930,
29,
10903,
930,
29,
2124,
3784,
29572,
7,
43879,
2414,
11,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
30493,
1312,
6624,
2242,
1303,
3616,
326,
2534,
12784,
547,
1043,
628,
220,
220,
220,
1441,
4628,
654,
198,
437,
198,
198,
8818,
651,
62,
862,
72,
19,
3419,
198,
220,
220,
220,
4848,
87,
796,
374,
1,
29567,
7479,
82,
8479,
59,
82,
37,
59,
82,
10,
25,
13,
10,
30,
26933,
15,
12,
24,
60,
9,
17405,
30,
58,
15,
12,
24,
60,
28104,
86,
59,
82,
10,
26933,
15,
12,
24,
48688,
19415,
1416,
5691,
1,
198,
220,
220,
220,
11955,
87,
796,
374,
1,
29567,
7479,
82,
8479,
59,
82,
38,
59,
82,
10,
25,
13,
10,
30,
26933,
15,
12,
24,
60,
9,
17405,
30,
58,
15,
12,
24,
60,
28104,
86,
59,
82,
10,
26933,
15,
12,
24,
48688,
19415,
1416,
5691,
1,
198,
220,
220,
220,
22927,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
862,
72,
19,
48774,
220,
628,
220,
220,
220,
4628,
654,
796,
1976,
27498,
7,
1828,
8,
628,
220,
220,
220,
1303,
1114,
1123,
27756,
198,
220,
220,
220,
329,
1312,
796,
1123,
9630,
7,
16514,
654,
8,
198,
220,
220,
220,
220,
220,
220,
220,
399,
66,
5691,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
45231,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
402,
83,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
300,
796,
1123,
1370,
7203,
50,
3,
72,
14,
45016,
13,
19608,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
376,
76,
796,
2872,
7,
20366,
87,
11,
300,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
402,
76,
796,
2872,
7,
38,
21510,
11,
300,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
376,
76,
5145,
855,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
376,
76,
13,
27144,
942,
58,
16,
60,
930,
29,
10903,
930,
29,
2124,
3784,
29572,
7,
43879,
2414,
11,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
399,
796,
376,
76,
13,
27144,
942,
58,
17,
60,
930,
29,
10903,
930,
29,
2124,
3784,
29572,
7,
5317,
11,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
45,
66,
5691,
11,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
37,
83,
11,
256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
402,
76,
5145,
855,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
402,
76,
13,
27144,
942,
58,
16,
60,
930,
29,
10903,
930,
29,
2124,
3784,
29572,
7,
43879,
2414,
11,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
399,
796,
402,
76,
13,
27144,
942,
58,
17,
60,
930,
29,
10903,
930,
29,
2124,
3784,
29572,
7,
5317,
11,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
45,
66,
5691,
11,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
38,
83,
11,
256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
6889,
1654,
477,
1366,
318,
6414,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
477,
7,
45,
66,
5691,
764,
855,
399,
66,
5691,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
477,
7,
37,
83,
764,
855,
45231,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
477,
7,
38,
83,
764,
855,
402,
83,
58,
16,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
3082,
1133,
10576,
198,
220,
220,
220,
220,
220,
220,
220,
4628,
654,
58,
72,
60,
796,
357,
37,
83,
58,
16,
60,
1343,
402,
83,
58,
16,
12962,
1220,
399,
66,
5691,
58,
16,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
22927,
7203,
492,
4943,
198,
220,
220,
220,
1441,
4628,
654,
198,
437,
198,
198,
361,
2352,
6978,
7,
4805,
7730,
24115,
62,
25664,
8,
6624,
2488,
834,
25664,
834,
198,
220,
220,
220,
277,
7780,
72,
796,
651,
62,
2232,
11632,
3419,
198,
220,
220,
220,
46231,
19,
796,
651,
62,
862,
72,
19,
3419,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
457,
1058,
25677,
796,
14631,
37,
7780,
72,
1600,
366,
12016,
72,
19,
8973,
685,
2232,
11632,
46231,
19,
60,
198,
437,
198
] | 1.739845 | 1,034 |
# Add dependencies
using Pkg
Pkg.add(Pkg.PackageSpec(;name="Git", version="1.2.1"))
Pkg.add(Pkg.PackageSpec(;name="TOML", version="1.0.0"))
using TOML
using Git
# Extract the version number to be updated
VERSION = ""
if length(ARGS) > 0
VERSION = ARGS[1]
end
GITHUB_REPOSITORY = ENV["GITHUB_REPOSITORY"]
TOKEN = ""
URL = ""
if haskey(ENV, "GITHUB_TOKEN")
TOKEN = ENV["GITHUB_TOKEN"]
URL = "https://x-access-token:$(TOKEN)@github.com/$(GITHUB_REPOSITORY).git"
end
# Read the Project.toml file in the package
fname = "Project.toml";
dict_project = TOML.parsefile(fname)
# If no version is given, use the version number in the Project.toml
if isempty(VERSION)
VERSION = dict_project["version"]
else
# Santity
VERSION = split(VERSION, "-")[1]
VERSION = replace(VERSION, "v" => "")
VERSION = replace(VERSION, "V" => "")
# Update the version number in the Project.toml
if dict_project["version"] != VERSION
dict_project["version"] = VERSION
open(fname, "w") do io
TOML.print(io, dict_project)
end
# Commit the new Project.toml
run(`$(git()) add Project.toml`)
run(`$(git()) commit -m "Update version to v$(VERSION)"`)
run(`$(git()) restore .`)
if isempty(URL)
run(`$(git()) push`)
else
run(`$(git()) push $(URL)`)
end
end
end
# Set output
run(`echo "::set-output name=version::$(VERSION)"`) | [
2,
3060,
20086,
198,
3500,
350,
10025,
198,
47,
10025,
13,
2860,
7,
47,
10025,
13,
27813,
22882,
7,
26,
3672,
2625,
38,
270,
1600,
2196,
2625,
16,
13,
17,
13,
16,
48774,
198,
47,
10025,
13,
2860,
7,
47,
10025,
13,
27813,
22882,
7,
26,
3672,
2625,
51,
2662,
43,
1600,
2196,
2625,
16,
13,
15,
13,
15,
48774,
198,
3500,
41526,
43,
198,
3500,
15151,
198,
198,
2,
29677,
262,
2196,
1271,
284,
307,
6153,
198,
43717,
796,
13538,
198,
361,
4129,
7,
1503,
14313,
8,
1875,
657,
198,
220,
220,
220,
44156,
2849,
796,
5923,
14313,
58,
16,
60,
198,
437,
198,
198,
38,
10554,
10526,
62,
35316,
2640,
2043,
15513,
796,
12964,
53,
14692,
38,
10554,
10526,
62,
35316,
2640,
2043,
15513,
8973,
198,
10468,
43959,
796,
13538,
198,
21886,
796,
13538,
198,
361,
468,
2539,
7,
1677,
53,
11,
366,
38,
10554,
10526,
62,
10468,
43959,
4943,
198,
220,
220,
220,
5390,
43959,
796,
12964,
53,
14692,
38,
10554,
10526,
62,
10468,
43959,
8973,
198,
220,
220,
220,
10289,
796,
366,
5450,
1378,
87,
12,
15526,
12,
30001,
25,
3,
7,
10468,
43959,
8,
31,
12567,
13,
785,
32624,
7,
38,
10554,
10526,
62,
35316,
2640,
2043,
15513,
737,
18300,
1,
198,
437,
198,
198,
2,
4149,
262,
4935,
13,
39532,
75,
2393,
287,
262,
5301,
198,
69,
3672,
796,
366,
16775,
13,
39532,
75,
8172,
198,
11600,
62,
16302,
796,
41526,
43,
13,
29572,
7753,
7,
69,
3672,
8,
198,
198,
2,
1002,
645,
2196,
318,
1813,
11,
779,
262,
2196,
1271,
287,
262,
4935,
13,
39532,
75,
198,
361,
318,
28920,
7,
43717,
8,
198,
220,
220,
220,
44156,
2849,
796,
8633,
62,
16302,
14692,
9641,
8973,
198,
17772,
198,
220,
220,
220,
1303,
10844,
414,
198,
220,
220,
220,
44156,
2849,
796,
6626,
7,
43717,
11,
27444,
4943,
58,
16,
60,
198,
220,
220,
220,
44156,
2849,
796,
6330,
7,
43717,
11,
366,
85,
1,
5218,
366,
4943,
198,
220,
220,
220,
44156,
2849,
796,
6330,
7,
43717,
11,
366,
53,
1,
5218,
366,
4943,
628,
220,
220,
220,
1303,
10133,
262,
2196,
1271,
287,
262,
4935,
13,
39532,
75,
198,
220,
220,
220,
611,
8633,
62,
16302,
14692,
9641,
8973,
14512,
44156,
2849,
198,
220,
220,
220,
220,
220,
220,
220,
8633,
62,
16302,
14692,
9641,
8973,
796,
44156,
2849,
198,
220,
220,
220,
220,
220,
220,
220,
1280,
7,
69,
3672,
11,
366,
86,
4943,
466,
33245,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41526,
43,
13,
4798,
7,
952,
11,
8633,
62,
16302,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
35910,
262,
649,
4935,
13,
39532,
75,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
7,
63,
3,
7,
18300,
28955,
751,
4935,
13,
39532,
75,
63,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
7,
63,
3,
7,
18300,
28955,
4589,
532,
76,
366,
10260,
2196,
284,
410,
3,
7,
43717,
16725,
63,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1057,
7,
63,
3,
7,
18300,
28955,
11169,
764,
63,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
28920,
7,
21886,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1057,
7,
63,
3,
7,
18300,
28955,
4574,
63,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1057,
7,
63,
3,
7,
18300,
28955,
4574,
29568,
21886,
8,
63,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
5345,
5072,
198,
5143,
7,
63,
30328,
366,
3712,
2617,
12,
22915,
1438,
28,
9641,
3712,
3,
7,
43717,
16725,
63,
8
] | 2.281447 | 636 |
module TestPreservingFuncs
using Base.Test
using DataArrays
using DataFrames
using Dates
using TimeData
println("Running type preserving function tests")
allTypes = (:Timedata, :Timenum, :Timematr)
################
## hcat tests ##
################
tm = Timematr(rand(2, 3))
hcat(tm[:, 1], tm[:, 2], tm[:, 3])
td = Timedata(rand(2, 3))
hcat(td[:, 1], td[:, 2])
hcat(td[:, 1], td[:, 2], td[:, 1])
hcat(tm[:, 1], tm[:, 2], tm[:, 1])
@test_throws ErrorException hcat(tm[:, 1], td[:, 2])
@test_throws ErrorException hcat(tm[:, 1], tm[:, 2], td[:, 2])
################
## vcat tests ##
################
## test information retrieval functions
for t in allTypes
eval(quote
## unequal column names
td = $(t)(rand(10, 2))
td2 = $(t)(rand(10,2), [:a, :b])
@test_throws ErrorException vcat(td, td2)
## unequal indices
td = $(t)(rand(10,2), [:a, :b])
td2 = $(t)(rand(10,2), [:a, :b],
[Date(2010,1,1):Date(2010,1,10)])
@test_throws ErrorException vcat(td, td2)
## vcat
df = DataFrame()
df[:a] = @data([0.4, 0.3])
df[:b] = @data([0.3, 0.8])
dats1 = [Date(2014,1,1):Date(2014,1,2)]
dats2 = [Date(2014,1,3):Date(2014,1,4)]
td = $(t)(df, dats1)
td2 = $(t)(df, dats2)
td3 = $(t)(vcat(df, df), [dats1, dats2])
td4 = $(t)(vcat(df, df, df), [dats1, dats2, dats1])
## multiple arguments
@test isequal(vcat(td, td2), td3)
@test isequal(vcat(td, td2, td), td4)
## throw error for unequal types
td = Timedata(rand(4, 3))
tm = Timematr(rand(4, 3))
@test_throws ErrorException vcat(tm, td)
@test_throws ErrorException vcat(tm, td, td)
end)
end
##################
## flipud tests ##
##################
for t in allTypes
eval(quote
nams = [:a, :b]
vals = [0.2 0.4; 0.6 0.8]
df = composeDataFrame(vals, nams)
df2 = composeDataFrame(flipud(vals), nams)
td = $(t)(df)
expFlipped = $(t)(df2, flipud(idx(td)))
@test flipud(td) == expFlipped
@test isequal(expFlipped, flipud(td))
@test flipud(flipud(td)) == td
@test isequal(flipud(flipud(td)), td)
end)
end
##########
## narm ##
##########
df = DataFrame()
df[:a] = @data([3, NA])
df[:b] = @data([4, NA])
td = Timedata(df)
tn = Timenum(df)
tm = Timematr(rand(2, 3))
td = Timedata(df)
dfShort = DataFrame()
dfShort[:a] = @data([3])
dfShort[:b] = @data([4])
tdShort = Timedata(dfShort)
tnShort = Timenum(dfShort)
tm = Timematr(rand(2, 3))
@test narm(td) == tdShort
@test narm(tn) == tnShort
@test narm(tm) == tm
########################
## asTd / asTm / asTn ##
########################
## test isaRowVector
@test isaRowVector([1 2 3])
@test !isaRowVector([1, 2, 3])
kk = Array(Float64, 1, 1)
@test isaRowVector(kk)
@test !isaRowVector([1])
@test_throws ErrorException isaRowVector(1)
## test asArrayOfEqualDimensions
td = Timedata(rand(2, 2))
@test asArrayOfEqualDimensions([1 2], td) == [1 2; 1 2]
@test asArrayOfEqualDimensions([1, 2], td) == [1 1; 2 2]
kk = Array(Int, 1, 1)
kk[1] = 1
@test asArrayOfEqualDimensions([1], td[1, 1]) == kk
@test asArrayOfEqualDimensions(1, td[1, 1]) == kk
@test asArrayOfEqualDimensions(1, td) == [1 1; 1 1]
@test_throws ErrorException asArrayOfEqualDimensions([3 4; 5 6], td[1, 1])
df = DataFrame(x1 = [1, 2], x2 = [1, 2])
@test TimeData.asTd([1, 2], td) == TimeData.Timedata(df)
df = DataFrame(x1 = [1, 1], x2 = [2, 2])
@test TimeData.asTd([1 2], td) == TimeData.Timedata(df)
end
| [
21412,
6208,
25460,
14344,
24629,
6359,
198,
198,
3500,
7308,
13,
14402,
198,
3500,
6060,
3163,
20477,
198,
3500,
6060,
35439,
198,
3500,
44712,
198,
198,
3500,
3862,
6601,
198,
198,
35235,
7203,
28768,
2099,
23934,
2163,
5254,
4943,
198,
198,
439,
31431,
796,
357,
25,
14967,
276,
1045,
11,
1058,
14967,
44709,
11,
1058,
14967,
368,
265,
81,
8,
198,
198,
14468,
198,
2235,
289,
9246,
5254,
22492,
198,
14468,
198,
198,
17209,
796,
5045,
368,
265,
81,
7,
25192,
7,
17,
11,
513,
4008,
198,
71,
9246,
7,
17209,
58,
45299,
352,
4357,
256,
76,
58,
45299,
362,
4357,
256,
76,
58,
45299,
513,
12962,
198,
198,
8671,
796,
5045,
276,
1045,
7,
25192,
7,
17,
11,
513,
4008,
198,
71,
9246,
7,
8671,
58,
45299,
352,
4357,
41560,
58,
45299,
362,
12962,
198,
71,
9246,
7,
8671,
58,
45299,
352,
4357,
41560,
58,
45299,
362,
4357,
41560,
58,
45299,
352,
12962,
198,
71,
9246,
7,
17209,
58,
45299,
352,
4357,
256,
76,
58,
45299,
362,
4357,
256,
76,
58,
45299,
352,
12962,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
289,
9246,
7,
17209,
58,
45299,
352,
4357,
41560,
58,
45299,
362,
12962,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
289,
9246,
7,
17209,
58,
45299,
352,
4357,
256,
76,
58,
45299,
362,
4357,
41560,
58,
45299,
362,
12962,
198,
198,
14468,
198,
2235,
410,
9246,
5254,
22492,
198,
14468,
198,
198,
2235,
1332,
1321,
45069,
5499,
198,
1640,
256,
287,
477,
31431,
198,
220,
220,
220,
5418,
7,
22708,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
37334,
5721,
3891,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
796,
29568,
83,
5769,
25192,
7,
940,
11,
362,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
17,
796,
29568,
83,
5769,
25192,
7,
940,
11,
17,
828,
685,
25,
64,
11,
1058,
65,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
410,
9246,
7,
8671,
11,
41560,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
37334,
36525,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
796,
29568,
83,
5769,
25192,
7,
940,
11,
17,
828,
685,
25,
64,
11,
1058,
65,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
17,
796,
29568,
83,
5769,
25192,
7,
940,
11,
17,
828,
685,
25,
64,
11,
1058,
65,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
10430,
7,
10333,
11,
16,
11,
16,
2599,
10430,
7,
10333,
11,
16,
11,
940,
8,
12962,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
410,
9246,
7,
8671,
11,
41560,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
410,
9246,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
6060,
19778,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
58,
25,
64,
60,
796,
2488,
7890,
26933,
15,
13,
19,
11,
657,
13,
18,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
58,
25,
65,
60,
796,
2488,
7890,
26933,
15,
13,
18,
11,
657,
13,
23,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
288,
1381,
16,
796,
685,
10430,
7,
4967,
11,
16,
11,
16,
2599,
10430,
7,
4967,
11,
16,
11,
17,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
288,
1381,
17,
796,
685,
10430,
7,
4967,
11,
16,
11,
18,
2599,
10430,
7,
4967,
11,
16,
11,
19,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
796,
29568,
83,
5769,
7568,
11,
288,
1381,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
17,
796,
29568,
83,
5769,
7568,
11,
288,
1381,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
18,
796,
29568,
83,
5769,
85,
9246,
7,
7568,
11,
47764,
828,
685,
67,
1381,
16,
11,
288,
1381,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
19,
796,
29568,
83,
5769,
85,
9246,
7,
7568,
11,
47764,
11,
47764,
828,
685,
67,
1381,
16,
11,
288,
1381,
17,
11,
288,
1381,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
3294,
7159,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
40496,
7,
85,
9246,
7,
8671,
11,
41560,
17,
828,
41560,
18,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
40496,
7,
85,
9246,
7,
8671,
11,
41560,
17,
11,
41560,
828,
41560,
19,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
22492,
3714,
4049,
329,
37334,
3858,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
796,
5045,
276,
1045,
7,
25192,
7,
19,
11,
513,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
256,
76,
796,
5045,
368,
265,
81,
7,
25192,
7,
19,
11,
513,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
410,
9246,
7,
17209,
11,
41560,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
400,
8516,
13047,
16922,
410,
9246,
7,
17209,
11,
41560,
11,
41560,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
886,
8,
198,
437,
198,
198,
14468,
2235,
198,
2235,
14283,
463,
5254,
22492,
198,
14468,
2235,
198,
198,
1640,
256,
287,
477,
31431,
198,
220,
220,
220,
5418,
7,
22708,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
299,
4105,
796,
685,
25,
64,
11,
1058,
65,
60,
198,
220,
220,
220,
220,
220,
220,
220,
410,
874,
796,
685,
15,
13,
17,
657,
13,
19,
26,
657,
13,
21,
657,
13,
23,
60,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
796,
36664,
6601,
19778,
7,
12786,
11,
299,
4105,
8,
198,
220,
220,
220,
220,
220,
220,
220,
47764,
17,
796,
36664,
6601,
19778,
7,
2704,
541,
463,
7,
12786,
828,
299,
4105,
8,
198,
220,
220,
220,
220,
220,
220,
220,
41560,
796,
29568,
83,
5769,
7568,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1033,
7414,
3949,
796,
29568,
83,
5769,
7568,
17,
11,
14283,
463,
7,
312,
87,
7,
8671,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
14283,
463,
7,
8671,
8,
6624,
1033,
7414,
3949,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
40496,
7,
11201,
7414,
3949,
11,
14283,
463,
7,
8671,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
14283,
463,
7,
2704,
541,
463,
7,
8671,
4008,
6624,
41560,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
318,
40496,
7,
2704,
541,
463,
7,
2704,
541,
463,
7,
8671,
36911,
41560,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
886,
8,
198,
437,
198,
198,
7804,
2235,
198,
2235,
299,
1670,
22492,
198,
7804,
2235,
198,
198,
7568,
796,
6060,
19778,
3419,
198,
7568,
58,
25,
64,
60,
796,
2488,
7890,
26933,
18,
11,
11746,
12962,
198,
7568,
58,
25,
65,
60,
796,
2488,
7890,
26933,
19,
11,
11746,
12962,
198,
8671,
796,
5045,
276,
1045,
7,
7568,
8,
198,
34106,
796,
5045,
44709,
7,
7568,
8,
198,
17209,
796,
5045,
368,
265,
81,
7,
25192,
7,
17,
11,
513,
4008,
198,
198,
8671,
796,
5045,
276,
1045,
7,
7568,
8,
198,
7568,
16438,
796,
6060,
19778,
3419,
198,
7568,
16438,
58,
25,
64,
60,
796,
2488,
7890,
26933,
18,
12962,
198,
7568,
16438,
58,
25,
65,
60,
796,
2488,
7890,
26933,
19,
12962,
198,
8671,
16438,
796,
5045,
276,
1045,
7,
7568,
16438,
8,
198,
34106,
16438,
796,
5045,
44709,
7,
7568,
16438,
8,
198,
17209,
796,
5045,
368,
265,
81,
7,
25192,
7,
17,
11,
513,
4008,
198,
198,
31,
9288,
299,
1670,
7,
8671,
8,
6624,
41560,
16438,
198,
31,
9288,
299,
1670,
7,
34106,
8,
6624,
256,
77,
16438,
198,
31,
9288,
299,
1670,
7,
17209,
8,
6624,
256,
76,
628,
198,
14468,
7804,
198,
2235,
355,
51,
67,
1220,
355,
51,
76,
1220,
355,
51,
77,
22492,
198,
14468,
7804,
198,
198,
2235,
1332,
318,
64,
25166,
38469,
198,
31,
9288,
318,
64,
25166,
38469,
26933,
16,
362,
513,
12962,
198,
31,
9288,
5145,
9160,
25166,
38469,
26933,
16,
11,
362,
11,
513,
12962,
198,
198,
28747,
796,
15690,
7,
43879,
2414,
11,
352,
11,
352,
8,
198,
31,
9288,
318,
64,
25166,
38469,
7,
28747,
8,
198,
198,
31,
9288,
5145,
9160,
25166,
38469,
26933,
16,
12962,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
318,
64,
25166,
38469,
7,
16,
8,
198,
198,
2235,
1332,
355,
19182,
5189,
36,
13255,
29271,
5736,
198,
8671,
796,
5045,
276,
1045,
7,
25192,
7,
17,
11,
362,
4008,
198,
31,
9288,
355,
19182,
5189,
36,
13255,
29271,
5736,
26933,
16,
362,
4357,
41560,
8,
6624,
685,
16,
362,
26,
352,
362,
60,
198,
31,
9288,
355,
19182,
5189,
36,
13255,
29271,
5736,
26933,
16,
11,
362,
4357,
41560,
8,
6624,
685,
16,
352,
26,
362,
362,
60,
198,
198,
28747,
796,
15690,
7,
5317,
11,
352,
11,
352,
8,
198,
28747,
58,
16,
60,
796,
352,
198,
31,
9288,
355,
19182,
5189,
36,
13255,
29271,
5736,
26933,
16,
4357,
41560,
58,
16,
11,
352,
12962,
6624,
479,
74,
198,
31,
9288,
355,
19182,
5189,
36,
13255,
29271,
5736,
7,
16,
11,
41560,
58,
16,
11,
352,
12962,
6624,
479,
74,
198,
31,
9288,
355,
19182,
5189,
36,
13255,
29271,
5736,
7,
16,
11,
41560,
8,
6624,
685,
16,
352,
26,
352,
352,
60,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
355,
19182,
5189,
36,
13255,
29271,
5736,
26933,
18,
604,
26,
642,
718,
4357,
41560,
58,
16,
11,
352,
12962,
198,
198,
7568,
796,
6060,
19778,
7,
87,
16,
796,
685,
16,
11,
362,
4357,
2124,
17,
796,
685,
16,
11,
362,
12962,
198,
31,
9288,
3862,
6601,
13,
292,
51,
67,
26933,
16,
11,
362,
4357,
41560,
8,
6624,
3862,
6601,
13,
14967,
276,
1045,
7,
7568,
8,
198,
198,
7568,
796,
6060,
19778,
7,
87,
16,
796,
685,
16,
11,
352,
4357,
2124,
17,
796,
685,
17,
11,
362,
12962,
198,
31,
9288,
3862,
6601,
13,
292,
51,
67,
26933,
16,
362,
4357,
41560,
8,
6624,
3862,
6601,
13,
14967,
276,
1045,
7,
7568,
8,
628,
198,
437,
198
] | 2.050251 | 1,791 |
using Statistics
import Base.Meta: isexpr
"""
ret = @freshexec [setup_ex] ex
Runs `ex` in an external process and gets back the final result (, which is supposed to be
such a simple Julia object that we can restore it from its string representation).
Running in external process can be useful for testing JET analysis, because:
- the first time analysis is not affected by native code cache and JET's global report cache
- we can do something that might break a Julia process without wondering it breaks the
original test process later on
The optional positional argument `setup_ex` runs before each execution of `ex` and defaults
to `JET_LOAD_EX`, which just loads JET into the process.
"""
macro freshexec(args...)
args = map(a->Expr(:quote,a), args)
return Expr(:escape, Expr(:call, GlobalRef(@__MODULE__, :freshexec), __module__, args...))
end
freshexec(mod, ex) = freshexec(mod, JET_LOAD_EX, ex)
freshexec(args...) = _freshexec(args..., collect_last_result)
function collect_last_result(exs)
lines = string.(exs)
lines[end] = "ret = $(lines[end])"
return join(lines, '\n')
end
"""
stats = @benchmark_freshexec [setup_ex] ex
Runs `ex` in an external process and collects execution statistics from [`@timed`](@ref).
This is particularly useful for testing the performance of first-time analysis, where
the native code cache and JET's global report cache have no effect for its performance.
The optional positional argument `setup_ex` runs before each execution of `ex` and its
execution statistis are not included in the benchmark result; it defaults to
`JET_WARMUP_EX`, which loads JET and runs a warm up analysis `@profile identity(nothing)`.
"""
macro benchmark_freshexec(args...)
args = map(a->Expr(:quote,a), args)
return Expr(:escape, Expr(:call, GlobalRef(@__MODULE__, :benchmark_freshexec), __module__, args...))
end
benchmark_freshexec(mod, ex) = benchmark_freshexec(mod, JET_WARMUP_EX, ex)
benchmark_freshexec(args...) = _freshexec(args..., collect_statistics)
function collect_statistics(exs)
return """
ret = @timed begin
$(join(exs, '\n'))
nothing # ensure `stats` can be parsed
end
"""
end
"""
stats = @nbenchmark_freshexec [ntimes = 5] [setup_ex] ex
Runs `ex` in an external process multiple times (which can be configured by the optional
keyword argument `ntimes`), and collects execution statistics from [`@timed`](@ref).
The statistics are generated by taking the `mean` of all the trials.
This is particularly useful for benchmarking the performance of first-time analysis, where
the native code cache and JET's global report cache have no effect for its performance.
The optional positional argument `setup_ex` runs before each execution of `ex` and its
execution statistis are not included in the benchmark result; it defaults to
`JET_WARMUP_EX`, which loads JET and runs a warm up analysis `@profile identity(nothing)`.
"""
macro nbenchmark_freshexec(args...)
isn(x) = isexpr(x, :(=)) && first(x.args) === :ntimes
i = findfirst(isn, args)
ntimes = i === nothing ? 5 : Expr(:quote, last(args[i].args))
args = map(a->Expr(:quote,a), filter(!isn, args))
return Expr(:escape, Expr(:call, GlobalRef(@__MODULE__, :nbenchmark_freshexec), ntimes, __module__, args...))
end
nbenchmark_freshexec(ntimes, mod, ex) = nbenchmark_freshexec(ntimes, mod, JET_WARMUP_EX, ex)
function nbenchmark_freshexec(ntimes, args...)
stats = [_freshexec(args..., collect_statistics) for _ in 1:ntimes]
return (; time = mean(getproperty.(stats, :time)),
bytes = mean(getproperty.(stats, :bytes)),
gctime = mean(getproperty.(stats, :gctime)),
)
end
function _freshexec(mod, setup_ex, ex, exs2script)
# we need to flatten block expression into a toplevel expression to correctly handle
# e.g. macro expansions
setup_exs = isexpr(setup_ex, :block) ? setup_ex.args : [setup_ex]
setup_script = join(string.(setup_exs), '\n')
exs = isexpr(ex, :block) ? ex.args : [ex]
script = exs2script(exs)
prog = """
old = stdout
rw, wr = redirect_stdout()
$(setup_script)
$(script)
redirect_stdout(old)
close(rw); close(wr)
println(stdout, repr(ret))
"""
cmd = Cmd([JULIA_BIN, "-e", prog])
io = IOBuffer()
run(pipeline(cmd; stdout = io))
return Core.eval(mod, Meta.parse(String(take!(io))))
end
const JET_LOAD_EX = :(using JET)
const JET_WARMUP_EX = quote
using JET
@profile_call identity(nothing) # warm-up for JET analysis
end
const JULIA_BIN = normpath(Sys.BINDIR, "julia")
| [
3500,
14370,
198,
11748,
7308,
13,
48526,
25,
318,
31937,
198,
198,
37811,
198,
220,
220,
220,
1005,
796,
2488,
69,
411,
33095,
721,
685,
40406,
62,
1069,
60,
409,
198,
198,
10987,
82,
4600,
1069,
63,
287,
281,
7097,
1429,
290,
3011,
736,
262,
2457,
1255,
357,
11,
543,
318,
4385,
284,
307,
198,
220,
884,
257,
2829,
22300,
2134,
326,
356,
460,
11169,
340,
422,
663,
4731,
10552,
737,
198,
28768,
220,
287,
7097,
1429,
460,
307,
4465,
329,
4856,
449,
2767,
3781,
11,
780,
25,
198,
12,
262,
717,
640,
3781,
318,
407,
5676,
416,
6868,
2438,
12940,
290,
449,
2767,
338,
3298,
989,
12940,
198,
12,
356,
460,
466,
1223,
326,
1244,
2270,
257,
22300,
1429,
1231,
11263,
340,
9457,
262,
198,
220,
2656,
1332,
1429,
1568,
319,
198,
464,
11902,
45203,
4578,
4600,
40406,
62,
1069,
63,
4539,
878,
1123,
9706,
286,
4600,
1069,
63,
290,
26235,
198,
220,
284,
4600,
41,
2767,
62,
35613,
62,
6369,
47671,
543,
655,
15989,
449,
2767,
656,
262,
1429,
13,
198,
37811,
198,
20285,
305,
34093,
33095,
721,
7,
22046,
23029,
198,
220,
220,
220,
26498,
796,
3975,
7,
64,
3784,
3109,
1050,
7,
25,
22708,
11,
64,
828,
26498,
8,
198,
220,
220,
220,
1441,
1475,
1050,
7,
25,
41915,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
31,
834,
33365,
24212,
834,
11,
1058,
69,
411,
33095,
721,
828,
11593,
21412,
834,
11,
26498,
986,
4008,
198,
437,
198,
69,
411,
33095,
721,
7,
4666,
11,
409,
8,
796,
34093,
33095,
721,
7,
4666,
11,
449,
2767,
62,
35613,
62,
6369,
11,
409,
8,
198,
69,
411,
33095,
721,
7,
22046,
23029,
796,
4808,
69,
411,
33095,
721,
7,
22046,
986,
11,
2824,
62,
12957,
62,
20274,
8,
198,
198,
8818,
2824,
62,
12957,
62,
20274,
7,
1069,
82,
8,
198,
220,
220,
220,
3951,
796,
4731,
12195,
1069,
82,
8,
198,
220,
220,
220,
3951,
58,
437,
60,
796,
366,
1186,
796,
29568,
6615,
58,
437,
12962,
1,
198,
220,
220,
220,
1441,
4654,
7,
6615,
11,
705,
59,
77,
11537,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
9756,
796,
2488,
26968,
4102,
62,
69,
411,
33095,
721,
685,
40406,
62,
1069,
60,
409,
198,
198,
10987,
82,
4600,
1069,
63,
287,
281,
7097,
1429,
290,
26609,
9706,
7869,
422,
685,
63,
31,
16514,
276,
63,
16151,
31,
5420,
737,
198,
1212,
318,
3573,
4465,
329,
4856,
262,
2854,
286,
717,
12,
2435,
3781,
11,
810,
198,
220,
262,
6868,
2438,
12940,
290,
449,
2767,
338,
3298,
989,
12940,
423,
645,
1245,
329,
663,
2854,
13,
198,
464,
11902,
45203,
4578,
4600,
40406,
62,
1069,
63,
4539,
878,
1123,
9706,
286,
4600,
1069,
63,
290,
663,
198,
220,
9706,
10118,
271,
389,
407,
3017,
287,
262,
18335,
1255,
26,
340,
26235,
284,
198,
220,
4600,
41,
2767,
62,
16279,
44,
8577,
62,
6369,
47671,
543,
15989,
449,
2767,
290,
4539,
257,
5814,
510,
3781,
4600,
31,
13317,
5369,
7,
22366,
8,
44646,
198,
37811,
198,
20285,
305,
18335,
62,
69,
411,
33095,
721,
7,
22046,
23029,
198,
220,
220,
220,
26498,
796,
3975,
7,
64,
3784,
3109,
1050,
7,
25,
22708,
11,
64,
828,
26498,
8,
198,
220,
220,
220,
1441,
1475,
1050,
7,
25,
41915,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
31,
834,
33365,
24212,
834,
11,
1058,
26968,
4102,
62,
69,
411,
33095,
721,
828,
11593,
21412,
834,
11,
26498,
986,
4008,
198,
437,
198,
26968,
4102,
62,
69,
411,
33095,
721,
7,
4666,
11,
409,
8,
796,
18335,
62,
69,
411,
33095,
721,
7,
4666,
11,
449,
2767,
62,
16279,
44,
8577,
62,
6369,
11,
409,
8,
198,
26968,
4102,
62,
69,
411,
33095,
721,
7,
22046,
23029,
796,
4808,
69,
411,
33095,
721,
7,
22046,
986,
11,
2824,
62,
14269,
3969,
8,
198,
198,
8818,
2824,
62,
14269,
3969,
7,
1069,
82,
8,
198,
220,
220,
220,
1441,
37227,
198,
220,
220,
220,
1005,
796,
2488,
16514,
276,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
29568,
22179,
7,
1069,
82,
11,
705,
59,
77,
6,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2147,
1303,
4155,
4600,
34242,
63,
460,
307,
44267,
198,
220,
220,
220,
886,
198,
220,
220,
220,
37227,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
9756,
796,
2488,
77,
26968,
4102,
62,
69,
411,
33095,
721,
685,
429,
999,
796,
642,
60,
685,
40406,
62,
1069,
60,
409,
198,
198,
10987,
82,
4600,
1069,
63,
287,
281,
7097,
1429,
3294,
1661,
357,
4758,
460,
307,
17839,
416,
262,
11902,
198,
220,
21179,
4578,
4600,
429,
999,
63,
828,
290,
26609,
9706,
7869,
422,
685,
63,
31,
16514,
276,
63,
16151,
31,
5420,
737,
198,
220,
383,
7869,
389,
7560,
416,
2263,
262,
4600,
32604,
63,
286,
477,
262,
9867,
13,
198,
1212,
318,
3573,
4465,
329,
18335,
278,
262,
2854,
286,
717,
12,
2435,
3781,
11,
810,
198,
220,
262,
6868,
2438,
12940,
290,
449,
2767,
338,
3298,
989,
12940,
423,
645,
1245,
329,
663,
2854,
13,
198,
464,
11902,
45203,
4578,
4600,
40406,
62,
1069,
63,
4539,
878,
1123,
9706,
286,
4600,
1069,
63,
290,
663,
198,
220,
9706,
10118,
271,
389,
407,
3017,
287,
262,
18335,
1255,
26,
340,
26235,
284,
198,
220,
4600,
41,
2767,
62,
16279,
44,
8577,
62,
6369,
47671,
543,
15989,
449,
2767,
290,
4539,
257,
5814,
510,
3781,
4600,
31,
13317,
5369,
7,
22366,
8,
44646,
198,
37811,
198,
20285,
305,
299,
26968,
4102,
62,
69,
411,
33095,
721,
7,
22046,
23029,
198,
220,
220,
220,
2125,
7,
87,
8,
796,
318,
31937,
7,
87,
11,
36147,
28,
4008,
11405,
717,
7,
87,
13,
22046,
8,
24844,
1058,
429,
999,
198,
220,
220,
220,
1312,
796,
1064,
11085,
7,
271,
77,
11,
26498,
8,
198,
220,
220,
220,
299,
22355,
796,
1312,
24844,
2147,
5633,
642,
1058,
1475,
1050,
7,
25,
22708,
11,
938,
7,
22046,
58,
72,
4083,
22046,
4008,
198,
220,
220,
220,
26498,
796,
3975,
7,
64,
3784,
3109,
1050,
7,
25,
22708,
11,
64,
828,
8106,
7,
0,
271,
77,
11,
26498,
4008,
198,
220,
220,
220,
1441,
1475,
1050,
7,
25,
41915,
11,
1475,
1050,
7,
25,
13345,
11,
8060,
8134,
7,
31,
834,
33365,
24212,
834,
11,
1058,
77,
26968,
4102,
62,
69,
411,
33095,
721,
828,
299,
22355,
11,
11593,
21412,
834,
11,
26498,
986,
4008,
198,
437,
198,
77,
26968,
4102,
62,
69,
411,
33095,
721,
7,
429,
999,
11,
953,
11,
409,
8,
796,
299,
26968,
4102,
62,
69,
411,
33095,
721,
7,
429,
999,
11,
953,
11,
449,
2767,
62,
16279,
44,
8577,
62,
6369,
11,
409,
8,
198,
8818,
299,
26968,
4102,
62,
69,
411,
33095,
721,
7,
429,
999,
11,
26498,
23029,
198,
220,
220,
220,
9756,
796,
685,
62,
69,
411,
33095,
721,
7,
22046,
986,
11,
2824,
62,
14269,
3969,
8,
329,
4808,
287,
352,
25,
429,
999,
60,
198,
220,
220,
220,
1441,
357,
26,
640,
220,
220,
796,
1612,
7,
1136,
26745,
12195,
34242,
11,
1058,
2435,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9881,
220,
796,
1612,
7,
1136,
26745,
12195,
34242,
11,
1058,
33661,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
310,
524,
796,
1612,
7,
1136,
26745,
12195,
34242,
11,
1058,
70,
310,
524,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
437,
198,
198,
8818,
4808,
69,
411,
33095,
721,
7,
4666,
11,
9058,
62,
1069,
11,
409,
11,
409,
82,
17,
12048,
8,
198,
220,
220,
220,
1303,
356,
761,
284,
27172,
268,
2512,
5408,
656,
257,
284,
1154,
626,
5408,
284,
9380,
5412,
198,
220,
220,
220,
1303,
304,
13,
70,
13,
15021,
36383,
198,
220,
220,
220,
9058,
62,
1069,
82,
796,
318,
31937,
7,
40406,
62,
1069,
11,
1058,
9967,
8,
5633,
9058,
62,
1069,
13,
22046,
1058,
685,
40406,
62,
1069,
60,
198,
220,
220,
220,
9058,
62,
12048,
796,
4654,
7,
8841,
12195,
40406,
62,
1069,
82,
828,
705,
59,
77,
11537,
198,
220,
220,
220,
409,
82,
796,
318,
31937,
7,
1069,
11,
1058,
9967,
8,
5633,
409,
13,
22046,
1058,
685,
1069,
60,
198,
220,
220,
220,
4226,
796,
409,
82,
17,
12048,
7,
1069,
82,
8,
628,
220,
220,
220,
1172,
796,
37227,
198,
220,
220,
220,
1468,
796,
14367,
448,
198,
220,
220,
220,
374,
86,
11,
1319,
796,
18941,
62,
19282,
448,
3419,
198,
220,
220,
220,
29568,
40406,
62,
12048,
8,
198,
220,
220,
220,
29568,
12048,
8,
198,
220,
220,
220,
18941,
62,
19282,
448,
7,
727,
8,
198,
220,
220,
220,
1969,
7,
31653,
1776,
1969,
7,
18351,
8,
198,
220,
220,
220,
44872,
7,
19282,
448,
11,
41575,
7,
1186,
4008,
198,
220,
220,
220,
37227,
628,
220,
220,
220,
23991,
796,
327,
9132,
26933,
41,
6239,
3539,
62,
33,
1268,
11,
27444,
68,
1600,
1172,
12962,
198,
220,
220,
220,
33245,
796,
314,
9864,
13712,
3419,
198,
220,
220,
220,
1057,
7,
79,
541,
4470,
7,
28758,
26,
14367,
448,
796,
33245,
4008,
628,
220,
220,
220,
1441,
7231,
13,
18206,
7,
4666,
11,
30277,
13,
29572,
7,
10100,
7,
20657,
0,
7,
952,
35514,
198,
437,
198,
198,
9979,
449,
2767,
62,
35613,
62,
6369,
796,
36147,
3500,
449,
2767,
8,
198,
9979,
449,
2767,
62,
16279,
44,
8577,
62,
6369,
796,
9577,
198,
220,
220,
220,
1262,
449,
2767,
198,
220,
220,
220,
2488,
13317,
62,
13345,
5369,
7,
22366,
8,
1303,
5814,
12,
929,
329,
449,
2767,
3781,
198,
437,
198,
9979,
49349,
3539,
62,
33,
1268,
796,
2593,
6978,
7,
44387,
13,
33,
12115,
4663,
11,
366,
73,
43640,
4943,
198
] | 2.833742 | 1,630 |
@test_throws ArgumentError OrbitalIndex(-1, -2)
@test_throws ArgumentError OrbitalIndex(3, -1)
@test_throws ArgumentError OrbitalIndex(3, 5)
@testset ">> Operators" begin
@test OrbitalIndex(0, 0) == OrbitalIndex(0, 0)
@test OrbitalIndex(2, 1) == OrbitalIndex(2, 1)
@test OrbitalIndex(2, 1) != OrbitalIndex(2, 0)
@test OrbitalIndex(2, 1) ≠ OrbitalIndex(2, 0)
@test OrbitalIndex(2, 1) > OrbitalIndex(2, 0)
@test OrbitalIndex(2, 1) > OrbitalIndex(1, 0)
@test OrbitalIndex(2, 1) < OrbitalIndex(3, 0)
end
@testset ">> Linear indexing for first numbers" begin
index = 1
for n in 0:100
for l in 0:n
orb = OrbitalIndex(n, l)
@test convert(Integer, orb) == index
@test convert(OrbitalIndex, convert(Integer, orb)) == orb
index += 1
end
end
end
@testset ">> conversions for n=$n" for n in rand(0:1000000, 5)
@testset ">> conversions for l=$l" for l in rand(0:n, 5)
orb = OrbitalIndex(n, l)
back = convert(OrbitalIndex, convert(Integer, orb))
@test typeof(back) === typeof(orb)
@test back == orb
end
end
@testset ">> String indexing" begin
@test nl"2, 2" == OrbitalIndex(2, 2)
@test nl"3, 2" == OrbitalIndex(3, 2)
end
@testset ">> Printing" begin
buffer = IOBuffer()
print(buffer, nl"12, 4")
seekstart(buffer)
@test readstring(buffer) == "n=12, l=4"
end
@testset ">> looping by 1" begin
index = 3
for u in nl"1,1":nl"5, 2"
@test convert(Integer, u) == index
index += 1
end
@test convert(Integer, nl"5, 3") == index
end
@testset ">> looping by (n, 0)" begin
n = 1
index = 0
for u in nl"1,1":nl"2, 0":nl"5, 2"
@test u.l == 1
@test u.n == n
index = convert(Integer, u)
n += 2
end
@test index == convert(Integer, nl"5, 1")
end
@testset ">> looping by (n, l)" begin
expected = [OrbitalIndex(1, 1), OrbitalIndex(4, 3), OrbitalIndex(7, 5)]
actual = [u for u in nl"1,1":nl"3, 2":nl"9, 2"]
@test expected == actual
end
| [
31,
9288,
62,
400,
8516,
45751,
12331,
45453,
15732,
32590,
16,
11,
532,
17,
8,
198,
31,
9288,
62,
400,
8516,
45751,
12331,
45453,
15732,
7,
18,
11,
532,
16,
8,
198,
31,
9288,
62,
400,
8516,
45751,
12331,
45453,
15732,
7,
18,
11,
642,
8,
198,
198,
31,
9288,
2617,
366,
4211,
6564,
2024,
1,
2221,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
15,
11,
657,
8,
6624,
45453,
15732,
7,
15,
11,
657,
8,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
6624,
45453,
15732,
7,
17,
11,
352,
8,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
14512,
45453,
15732,
7,
17,
11,
657,
8,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
15139,
254,
45453,
15732,
7,
17,
11,
657,
8,
628,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
1875,
45453,
15732,
7,
17,
11,
657,
8,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
1875,
45453,
15732,
7,
16,
11,
657,
8,
198,
220,
220,
220,
2488,
9288,
45453,
15732,
7,
17,
11,
352,
8,
1279,
45453,
15732,
7,
18,
11,
657,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
44800,
6376,
278,
329,
717,
3146,
1,
2221,
198,
220,
220,
220,
6376,
796,
352,
198,
220,
220,
220,
329,
299,
287,
657,
25,
3064,
198,
220,
220,
220,
220,
220,
220,
220,
329,
300,
287,
657,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15769,
796,
45453,
15732,
7,
77,
11,
300,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
10385,
7,
46541,
11,
15769,
8,
6624,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
10385,
7,
5574,
65,
1287,
15732,
11,
10385,
7,
46541,
11,
15769,
4008,
6624,
15769,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6376,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
32626,
329,
299,
43641,
77,
1,
329,
299,
287,
43720,
7,
15,
25,
16,
10535,
11,
642,
8,
198,
220,
220,
220,
2488,
9288,
2617,
366,
4211,
32626,
329,
300,
43641,
75,
1,
329,
300,
287,
43720,
7,
15,
25,
77,
11,
642,
8,
198,
220,
220,
220,
220,
220,
220,
220,
15769,
796,
45453,
15732,
7,
77,
11,
300,
8,
198,
220,
220,
220,
220,
220,
220,
220,
736,
220,
796,
10385,
7,
5574,
65,
1287,
15732,
11,
10385,
7,
46541,
11,
15769,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2099,
1659,
7,
1891,
8,
24844,
2099,
1659,
7,
27688,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
736,
6624,
15769,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
10903,
6376,
278,
1,
2221,
198,
220,
220,
220,
2488,
9288,
299,
75,
1,
17,
11,
362,
1,
6624,
45453,
15732,
7,
17,
11,
362,
8,
198,
197,
31,
9288,
299,
75,
1,
18,
11,
362,
1,
6624,
45453,
15732,
7,
18,
11,
362,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
44118,
1,
2221,
198,
197,
22252,
796,
314,
9864,
13712,
3419,
198,
197,
4798,
7,
22252,
11,
299,
75,
1,
1065,
11,
604,
4943,
198,
197,
36163,
9688,
7,
22252,
8,
198,
197,
31,
9288,
1100,
8841,
7,
22252,
8,
6624,
366,
77,
28,
1065,
11,
300,
28,
19,
1,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
9052,
278,
416,
352,
1,
2221,
198,
220,
220,
220,
6376,
796,
513,
198,
220,
220,
220,
329,
334,
287,
299,
75,
1,
16,
11,
16,
1298,
21283,
1,
20,
11,
362,
1,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
10385,
7,
46541,
11,
334,
8,
6624,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
15853,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
10385,
7,
46541,
11,
299,
75,
1,
20,
11,
513,
4943,
6624,
6376,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
9052,
278,
416,
357,
77,
11,
657,
16725,
2221,
198,
220,
220,
220,
299,
796,
352,
198,
220,
220,
220,
6376,
796,
657,
198,
220,
220,
220,
329,
334,
287,
299,
75,
1,
16,
11,
16,
1298,
21283,
1,
17,
11,
657,
1298,
21283,
1,
20,
11,
362,
1,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
334,
13,
75,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
334,
13,
77,
6624,
299,
198,
220,
220,
220,
220,
220,
220,
220,
6376,
796,
10385,
7,
46541,
11,
334,
8,
198,
220,
220,
220,
220,
220,
220,
220,
299,
15853,
362,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
6376,
6624,
10385,
7,
46541,
11,
299,
75,
1,
20,
11,
352,
4943,
198,
437,
198,
198,
31,
9288,
2617,
366,
4211,
9052,
278,
416,
357,
77,
11,
300,
16725,
2221,
198,
220,
220,
220,
2938,
796,
685,
5574,
65,
1287,
15732,
7,
16,
11,
352,
828,
45453,
15732,
7,
19,
11,
513,
828,
45453,
15732,
7,
22,
11,
642,
15437,
198,
220,
220,
220,
4036,
796,
685,
84,
329,
334,
287,
299,
75,
1,
16,
11,
16,
1298,
21283,
1,
18,
11,
362,
1298,
21283,
1,
24,
11,
362,
8973,
198,
220,
220,
220,
2488,
9288,
2938,
6624,
4036,
198,
437,
198
] | 2.227273 | 924 |
module TestCompositeSimple
using Test
using Mimi
import Mimi:
ComponentId, ComponentPath, ComponentDef, AbstractComponentDef,
CompositeComponentDef, ModelDef, build, time_labels, compdef, find_comp,
import_params!
@defcomp Comp1 begin
par_1_1 = Parameter(index=[time]) # external input
var_1_1 = Variable(index=[time]) # computed
foo = Parameter()
function run_timestep(p, v, d, t)
v.var_1_1[t] = p.par_1_1[t]
end
end
@defcomp Comp2 begin
par_2_1 = Parameter(index=[time]) # connected to Comp1.var_1_1
var_2_1 = Variable(index=[time]) # computed
foo = Parameter()
function run_timestep(p, v, d, t)
v.var_2_1[t] = p.par_2_1[t] + p.foo
end
end
@defcomposite A begin
Component(Comp1)
Component(Comp2)
foo1 = Parameter(Comp1.foo)
foo2 = Parameter(Comp2.foo, default=100)
connect(Comp2.par_2_1, Comp1.var_1_1)
end
@defcomposite Top begin
Component(A)
fooA1 = Parameter(A.foo1)
fooA2 = Parameter(A.foo2)
end
m = Model()
set_dimension!(m, :time, 2005:2020)
add_comp!(m, Top)
update_param!(m, :Top, :fooA1, 10)
update_param!(m, :Top, :par_1_1, 1:16) # unshared
run(m)
m = Model()
set_dimension!(m, :time, 2005:2020)
add_comp!(m, Top)
update_param!(m, :Top, :fooA1, 10)
@test_throws ErrorException add_shared_param!(m, :par_1_1, 1:16) # need to give indices
add_shared_param!(m, :par_1_1, 1:16, dims = [:time]) # shared
connect_param!(m, :Top, :par_1_1, :par_1_1)
run(m)
end
| [
21412,
6208,
5377,
1930,
578,
26437,
198,
198,
3500,
6208,
198,
3500,
337,
25236,
198,
198,
11748,
337,
25236,
25,
198,
220,
220,
220,
35100,
7390,
11,
35100,
15235,
11,
35100,
7469,
11,
27741,
21950,
7469,
11,
198,
220,
220,
220,
49355,
21950,
7469,
11,
9104,
7469,
11,
1382,
11,
640,
62,
23912,
1424,
11,
552,
4299,
11,
1064,
62,
5589,
11,
198,
220,
220,
220,
1330,
62,
37266,
0,
198,
198,
31,
4299,
5589,
3082,
16,
2221,
198,
220,
220,
220,
1582,
62,
16,
62,
16,
796,
25139,
2357,
7,
9630,
41888,
2435,
12962,
220,
220,
220,
220,
220,
1303,
7097,
5128,
198,
220,
220,
220,
1401,
62,
16,
62,
16,
796,
35748,
7,
9630,
41888,
2435,
12962,
220,
220,
220,
220,
220,
220,
1303,
29231,
198,
220,
220,
220,
22944,
796,
25139,
2357,
3419,
628,
220,
220,
220,
2163,
1057,
62,
16514,
395,
538,
7,
79,
11,
410,
11,
288,
11,
256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
410,
13,
7785,
62,
16,
62,
16,
58,
83,
60,
796,
279,
13,
1845,
62,
16,
62,
16,
58,
83,
60,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
4299,
5589,
3082,
17,
2221,
198,
220,
220,
220,
1582,
62,
17,
62,
16,
796,
25139,
2357,
7,
9630,
41888,
2435,
12962,
220,
220,
220,
220,
220,
1303,
5884,
284,
3082,
16,
13,
7785,
62,
16,
62,
16,
198,
220,
220,
220,
1401,
62,
17,
62,
16,
796,
35748,
7,
9630,
41888,
2435,
12962,
220,
220,
220,
220,
220,
220,
1303,
29231,
198,
220,
220,
220,
22944,
796,
25139,
2357,
3419,
628,
220,
220,
220,
2163,
1057,
62,
16514,
395,
538,
7,
79,
11,
410,
11,
288,
11,
256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
410,
13,
7785,
62,
17,
62,
16,
58,
83,
60,
796,
279,
13,
1845,
62,
17,
62,
16,
58,
83,
60,
1343,
279,
13,
21943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
4299,
785,
1930,
578,
317,
2221,
198,
220,
220,
220,
35100,
7,
7293,
16,
8,
198,
220,
220,
220,
35100,
7,
7293,
17,
8,
628,
220,
220,
220,
22944,
16,
796,
25139,
2357,
7,
7293,
16,
13,
21943,
8,
198,
220,
220,
220,
22944,
17,
796,
25139,
2357,
7,
7293,
17,
13,
21943,
11,
4277,
28,
3064,
8,
628,
220,
220,
220,
2018,
7,
7293,
17,
13,
1845,
62,
17,
62,
16,
11,
3082,
16,
13,
7785,
62,
16,
62,
16,
8,
198,
437,
198,
198,
31,
4299,
785,
1930,
578,
5849,
2221,
198,
220,
220,
220,
35100,
7,
32,
8,
628,
220,
220,
220,
22944,
32,
16,
796,
25139,
2357,
7,
32,
13,
21943,
16,
8,
198,
220,
220,
220,
22944,
32,
17,
796,
25139,
2357,
7,
32,
13,
21943,
17,
8,
198,
437,
198,
198,
76,
796,
9104,
3419,
198,
2617,
62,
46156,
0,
7,
76,
11,
1058,
2435,
11,
5075,
25,
42334,
8,
198,
2860,
62,
5589,
0,
7,
76,
11,
5849,
8,
198,
19119,
62,
17143,
0,
7,
76,
11,
1058,
9126,
11,
1058,
21943,
32,
16,
11,
838,
8,
198,
19119,
62,
17143,
0,
7,
76,
11,
1058,
9126,
11,
1058,
1845,
62,
16,
62,
16,
11,
352,
25,
1433,
8,
1303,
555,
28710,
198,
5143,
7,
76,
8,
198,
198,
76,
796,
9104,
3419,
198,
2617,
62,
46156,
0,
7,
76,
11,
1058,
2435,
11,
5075,
25,
42334,
8,
198,
2860,
62,
5589,
0,
7,
76,
11,
5849,
8,
198,
19119,
62,
17143,
0,
7,
76,
11,
1058,
9126,
11,
1058,
21943,
32,
16,
11,
838,
8,
198,
31,
9288,
62,
400,
8516,
13047,
16922,
751,
62,
28710,
62,
17143,
0,
7,
76,
11,
1058,
1845,
62,
16,
62,
16,
11,
352,
25,
1433,
8,
1303,
761,
284,
1577,
36525,
198,
2860,
62,
28710,
62,
17143,
0,
7,
76,
11,
1058,
1845,
62,
16,
62,
16,
11,
352,
25,
1433,
11,
5391,
82,
796,
685,
25,
2435,
12962,
1303,
4888,
198,
8443,
62,
17143,
0,
7,
76,
11,
1058,
9126,
11,
1058,
1845,
62,
16,
62,
16,
11,
1058,
1845,
62,
16,
62,
16,
8,
198,
5143,
7,
76,
8,
198,
198,
437,
198
] | 2.186317 | 687 |
include("Tanh.jl")
include("jacobian.jl")
using Base.Test
X = map(Float32, randn(5, 3))
l = Tanh{Float32}()
# Test grad. wrt. input X
Dfwd = jacobian_fwd(l, X)
Dbwd = jacobian_bwd(l, X)
@test_approx_eq Dfwd Dbwd
| [
17256,
7203,
45557,
71,
13,
20362,
4943,
198,
17256,
7203,
30482,
672,
666,
13,
20362,
4943,
198,
3500,
7308,
13,
14402,
198,
198,
55,
796,
3975,
7,
43879,
2624,
11,
43720,
77,
7,
20,
11,
513,
4008,
198,
75,
796,
11818,
71,
90,
43879,
2624,
92,
3419,
198,
198,
2,
6208,
3915,
13,
1319,
83,
13,
5128,
1395,
198,
35,
69,
16993,
796,
474,
330,
672,
666,
62,
69,
16993,
7,
75,
11,
1395,
8,
198,
43832,
16993,
796,
474,
330,
672,
666,
62,
65,
16993,
7,
75,
11,
1395,
8,
198,
198,
31,
9288,
62,
1324,
13907,
62,
27363,
360,
69,
16993,
360,
65,
16993,
198
] | 2.009346 | 107 |
import POMDPs.initialstate
const IVec8 = SVector{8, Int}
@with_kw struct AODiscreteVDPTagPOMDP <: POMDP{TagState, TagAction, IVec8}
cpomdp::VDPTagPOMDP = VDPTagPOMDP()
angles::Array{Float64, 1} = range(0, stop=2*pi, length=11)[1:end-1]
binsize::Float64 = 0.5
end
AODiscreteVDPTagPOMDP(p::VDPTagPOMDP, n_angles::Int, binsize::Float64) = AODiscreteVDPTagPOMDP(p, range(0, stop=2*pi, length=n_angles+1)[1:end-1], binsize)
@with_kw struct ADiscreteVDPTagPOMDP <: POMDP{TagState, TagAction, Vec8}
cpomdp::VDPTagPOMDP = VDPTagPOMDP()
angles::Array{Float64, 1} = range(0, stop=2*pi, length=11)[1:end-1]
end
ADiscreteVDPTagPOMDP(p::VDPTagPOMDP, n_angles::Int) = ADiscreteVDPTagPOMDP(p, range(0, stop=2*pi, length=n_angles+1)[1:end-1])
const DiscreteVDPTagProblem = Union{AODiscreteVDPTagPOMDP, ADiscreteVDPTagPOMDP}
cproblem(p::DiscreteVDPTagProblem) = p.cpomdp::VDPTagPOMDP
mdp(p::DiscreteVDPTagProblem) = mdp(cproblem(p))::VDPTagMDP
convert_s(::Type{T}, x::T, p) where T = x
convert_a(::Type{T}, x::T, p) where T = x
convert_o(::Type{T}, x::T, p) where T = x
# observation
function convert_o(::Type{IVec8}, o::Vec8, p::AODiscreteVDPTagPOMDP)
return floor.(Int, (o./p.binsize)::Vec8)::IVec8
end
# convert_o(::Type{Vec8}, o::Int, p::DiscreteVDPTagProblem) = (o-0.5)*2*pi/p.n_obs_angles
n_states(p::DiscreteVDPTagProblem) = Inf
n_actions(p::DiscreteVDPTagProblem) = 2*length(p.angles)
POMDPs.discount(p::DiscreteVDPTagProblem) = discount(cproblem(p))
POMDPs.isterminal(p::DiscreteVDPTagProblem, s::TagState) = mdp(p).tag_terminate && norm(s.agent-s.target) < mdp(p).tag_radius
POMDPs.actions(p::DiscreteVDPTagProblem) = [TagAction(look, angle) for look in [false, true] for angle in p.angles]
POMDPs.actionindex(p::DiscreteVDPTagProblem, a::TagAction) = a.look * length(p.angles) + findfirst(x->x==a.angle, p.angles)
POMDPs.transition(p::DiscreteVDPTagProblem, s::TagState, a::TagAction) = transition(cproblem(p), s, a)
POMDPs.initialstate(p::DiscreteVDPTagProblem) = VDPInitDist()
POMDPs.reward(p::DiscreteVDPTagProblem, s::TagState, a::TagAction, sp::TagState) = reward(cproblem(p), s, a, sp)
POMDPs.observation(p::ADiscreteVDPTagPOMDP, a::TagAction, sp::TagState) = observation(cproblem(p), a, sp)
struct DiscreteBeamDist
beam_dist::BeamDist
pomdp::POMDP
end
POMDPs.observation(p::AODiscreteVDPTagPOMDP, a::TagAction, sp::TagState) = DiscreteBeamDist(observation(cproblem(p), a, sp), p)
rand(rng::AbstractRNG, d::DiscreteBeamDist) = convert_o(IVec8, rand(rng, d.beam_dist), d.pomdp)
function POMDPs.pdf(d::DiscreteBeamDist, o::IVec8)
p = 1.0
lower = o .* d.pomdp.binsize
upper = (o .+ 1) .* d.pomdp.binsize
d = d.beam_dist
for i in 1:length(o)
if i == d.abeam
p *= cdf(d.an, upper[i]) - cdf(d.an, lower[i])
else
p *= cdf(d.n, upper[i]) - cdf(d.n, lower[i])
end
end
return p
end | [
11748,
350,
2662,
6322,
82,
13,
36733,
5219,
198,
9979,
8363,
721,
23,
796,
20546,
9250,
90,
23,
11,
2558,
92,
198,
198,
31,
4480,
62,
46265,
2878,
317,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
1279,
25,
350,
2662,
6322,
90,
24835,
9012,
11,
17467,
12502,
11,
8363,
721,
23,
92,
198,
220,
220,
220,
31396,
296,
26059,
3712,
53,
6322,
24835,
47,
2662,
6322,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
569,
6322,
24835,
47,
2662,
6322,
3419,
198,
220,
220,
220,
18333,
3712,
19182,
90,
43879,
2414,
11,
352,
92,
220,
220,
220,
220,
220,
220,
796,
2837,
7,
15,
11,
2245,
28,
17,
9,
14415,
11,
4129,
28,
1157,
38381,
16,
25,
437,
12,
16,
60,
198,
220,
220,
220,
41701,
1096,
3712,
43879,
2414,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
657,
13,
20,
198,
437,
198,
32,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
7,
79,
3712,
53,
6322,
24835,
47,
2662,
6322,
11,
299,
62,
27787,
3712,
5317,
11,
41701,
1096,
3712,
43879,
2414,
8,
796,
317,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
7,
79,
11,
2837,
7,
15,
11,
2245,
28,
17,
9,
14415,
11,
4129,
28,
77,
62,
27787,
10,
16,
38381,
16,
25,
437,
12,
16,
4357,
41701,
1096,
8,
198,
198,
31,
4480,
62,
46265,
2878,
5984,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
1279,
25,
350,
2662,
6322,
90,
24835,
9012,
11,
17467,
12502,
11,
38692,
23,
92,
198,
220,
220,
220,
31396,
296,
26059,
3712,
53,
6322,
24835,
47,
2662,
6322,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
569,
6322,
24835,
47,
2662,
6322,
3419,
198,
220,
220,
220,
18333,
3712,
19182,
90,
43879,
2414,
11,
352,
92,
220,
220,
220,
220,
220,
220,
796,
2837,
7,
15,
11,
2245,
28,
17,
9,
14415,
11,
4129,
28,
1157,
38381,
16,
25,
437,
12,
16,
60,
198,
437,
198,
2885,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
7,
79,
3712,
53,
6322,
24835,
47,
2662,
6322,
11,
299,
62,
27787,
3712,
5317,
8,
796,
5984,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
7,
79,
11,
2837,
7,
15,
11,
2245,
28,
17,
9,
14415,
11,
4129,
28,
77,
62,
27787,
10,
16,
38381,
16,
25,
437,
12,
16,
12962,
198,
198,
9979,
8444,
8374,
53,
6322,
24835,
40781,
796,
4479,
90,
32,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
11,
5984,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
92,
198,
198,
66,
45573,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
279,
13,
13155,
296,
26059,
3712,
53,
6322,
24835,
47,
2662,
6322,
198,
9132,
79,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
285,
26059,
7,
66,
45573,
7,
79,
8,
2599,
25,
53,
6322,
24835,
44,
6322,
198,
198,
1102,
1851,
62,
82,
7,
3712,
6030,
90,
51,
5512,
2124,
3712,
51,
11,
279,
8,
810,
309,
796,
2124,
198,
1102,
1851,
62,
64,
7,
3712,
6030,
90,
51,
5512,
2124,
3712,
51,
11,
279,
8,
810,
309,
796,
2124,
198,
1102,
1851,
62,
78,
7,
3712,
6030,
90,
51,
5512,
2124,
3712,
51,
11,
279,
8,
810,
309,
796,
2124,
198,
198,
2,
13432,
198,
8818,
10385,
62,
78,
7,
3712,
6030,
90,
3824,
721,
23,
5512,
267,
3712,
53,
721,
23,
11,
279,
3712,
32,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
8,
198,
220,
220,
220,
1441,
4314,
12195,
5317,
11,
357,
78,
19571,
79,
13,
65,
1040,
1096,
2599,
25,
53,
721,
23,
2599,
25,
3824,
721,
23,
198,
437,
198,
2,
10385,
62,
78,
7,
3712,
6030,
90,
53,
721,
23,
5512,
267,
3712,
5317,
11,
279,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
357,
78,
12,
15,
13,
20,
27493,
17,
9,
14415,
14,
79,
13,
77,
62,
8158,
62,
27787,
198,
198,
77,
62,
27219,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
4806,
198,
77,
62,
4658,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
362,
9,
13664,
7,
79,
13,
27787,
8,
198,
47,
2662,
6322,
82,
13,
15410,
608,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
9780,
7,
66,
45573,
7,
79,
4008,
198,
47,
2662,
6322,
82,
13,
1694,
1084,
282,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
11,
264,
3712,
24835,
9012,
8,
796,
285,
26059,
7,
79,
737,
12985,
62,
23705,
378,
11405,
2593,
7,
82,
13,
25781,
12,
82,
13,
16793,
8,
1279,
285,
26059,
7,
79,
737,
12985,
62,
42172,
198,
47,
2662,
6322,
82,
13,
4658,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
685,
24835,
12502,
7,
5460,
11,
9848,
8,
329,
804,
287,
685,
9562,
11,
2081,
60,
329,
9848,
287,
279,
13,
27787,
60,
198,
47,
2662,
6322,
82,
13,
2673,
9630,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
11,
257,
3712,
24835,
12502,
8,
796,
257,
13,
5460,
1635,
4129,
7,
79,
13,
27787,
8,
1343,
1064,
11085,
7,
87,
3784,
87,
855,
64,
13,
9248,
11,
279,
13,
27787,
8,
198,
198,
47,
2662,
6322,
82,
13,
7645,
653,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
11,
264,
3712,
24835,
9012,
11,
257,
3712,
24835,
12502,
8,
796,
6801,
7,
66,
45573,
7,
79,
828,
264,
11,
257,
8,
198,
47,
2662,
6322,
82,
13,
36733,
5219,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
8,
796,
569,
6322,
31768,
20344,
3419,
198,
47,
2662,
6322,
82,
13,
260,
904,
7,
79,
3712,
15642,
8374,
53,
6322,
24835,
40781,
11,
264,
3712,
24835,
9012,
11,
257,
3712,
24835,
12502,
11,
599,
3712,
24835,
9012,
8,
796,
6721,
7,
66,
45573,
7,
79,
828,
264,
11,
257,
11,
599,
8,
198,
198,
47,
2662,
6322,
82,
13,
672,
3168,
341,
7,
79,
3712,
2885,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
11,
257,
3712,
24835,
12502,
11,
599,
3712,
24835,
9012,
8,
796,
13432,
7,
66,
45573,
7,
79,
828,
257,
11,
599,
8,
198,
198,
7249,
8444,
8374,
3856,
321,
20344,
198,
220,
220,
220,
15584,
62,
17080,
3712,
3856,
321,
20344,
198,
220,
220,
220,
279,
296,
26059,
3712,
47,
2662,
6322,
198,
437,
198,
198,
47,
2662,
6322,
82,
13,
672,
3168,
341,
7,
79,
3712,
32,
3727,
2304,
8374,
53,
6322,
24835,
47,
2662,
6322,
11,
257,
3712,
24835,
12502,
11,
599,
3712,
24835,
9012,
8,
796,
8444,
8374,
3856,
321,
20344,
7,
672,
3168,
341,
7,
66,
45573,
7,
79,
828,
257,
11,
599,
828,
279,
8,
198,
25192,
7,
81,
782,
3712,
23839,
49,
10503,
11,
288,
3712,
15642,
8374,
3856,
321,
20344,
8,
796,
10385,
62,
78,
7,
3824,
721,
23,
11,
43720,
7,
81,
782,
11,
288,
13,
40045,
62,
17080,
828,
288,
13,
79,
296,
26059,
8,
198,
198,
8818,
350,
2662,
6322,
82,
13,
12315,
7,
67,
3712,
15642,
8374,
3856,
321,
20344,
11,
267,
3712,
3824,
721,
23,
8,
198,
220,
220,
220,
279,
796,
352,
13,
15,
198,
220,
220,
220,
2793,
796,
267,
764,
9,
288,
13,
79,
296,
26059,
13,
65,
1040,
1096,
198,
220,
220,
220,
6727,
796,
357,
78,
764,
10,
352,
8,
764,
9,
288,
13,
79,
296,
26059,
13,
65,
1040,
1096,
198,
220,
220,
220,
288,
796,
288,
13,
40045,
62,
17080,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
13664,
7,
78,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
288,
13,
11231,
321,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
1635,
28,
269,
7568,
7,
67,
13,
272,
11,
6727,
58,
72,
12962,
532,
269,
7568,
7,
67,
13,
272,
11,
2793,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
1635,
28,
269,
7568,
7,
67,
13,
77,
11,
6727,
58,
72,
12962,
532,
269,
7568,
7,
67,
13,
77,
11,
2793,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
279,
198,
437
] | 2.124188 | 1,385 |
module REPLMode
import Pkg3
using Pkg3.Types
using Pkg3.Display
using Pkg3.Operations
import Base: LineEdit, REPL, REPLCompletions
import Base.Random: UUID
using Base.Markdown
const cmds = Dict(
"help" => :help,
"?" => :help,
"status" => :status,
"st" => :status,
"." => :status,
"search" => :search,
"find" => :search,
"/" => :search,
"add" => :add,
"install" => :add,
"+" => :add,
"rm" => :rm,
"remove" => :rm,
"uninstall" => :rm,
"-" => :rm,
"up" => :up,
"update" => :up,
"upgrade" => :up,
"test" => :test,
"gc" => :gc,
"fsck" => :fsck,
"preview" => :preview,
)
const opts = Dict(
"env" => :env,
"project" => :project,
"p" => :project,
"manifest" => :manifest,
"m" => :manifest,
"major" => :major,
"minor" => :minor,
"patch" => :patch,
"fixed" => :fixed,
"coverage" => :coverage,
)
function parse_option(word::AbstractString)
m = match(r"^(?: -([a-z]) | --([a-z]{2,})(?:\s*=\s*(\S*))? )$"ix, word)
m == nothing && cmderror("invalid option: ", repr(word))
k = m.captures[1] != nothing ? m.captures[1] : m.captures[2]
haskey(opts, k) || cmderror("invalid option: ", repr(word))
m.captures[3] == nothing ?
(:opt, opts[k]) : (:opt, opts[k], String(m.captures[3]))
end
let uuid = raw"(?i)[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}(?-i)",
name = raw"(\w+)(?:\.jl)?"
global name_re = Regex("^$name\$")
global uuid_re = Regex("^$uuid\$")
global name_uuid_re = Regex("^$name\\s*=\\s*($uuid)\$")
end
const lex_re = r"^[\?\./\+\-] | [^@\s]+\s*=\s*[^@\s]+ | @\s*[^@\s]* | [^@\s]+"x
function tokenize(cmd::String)::Vector{Tuple{Symbol,Vararg{Any}}}
tokens = Tuple{Symbol,Vararg{Any}}[]
# TODO: handle string-quoted values, e.g. path names
words = map(m->m.match, eachmatch(lex_re, cmd))
help_mode = false
while !isempty(words)
word = shift!(words)
if word[1] == '-' && length(word) > 1
push!(tokens, parse_option(word))
else
word in keys(cmds) || cmderror("invalid command: ", repr(word))
push!(tokens, (:cmd, cmds[word]))
help_mode || cmds[word] != :help && break
help_mode = true
end
end
if isempty(tokens) || tokens[end][1] != :cmd
cmderror("no package command given")
end
while !isempty(words)
word = shift!(words)
if word[1] == '-'
push!(tokens, parse_option(word))
elseif word[1] == '@'
push!(tokens, (:ver, VersionRange(strip(word[2:end]))))
elseif ismatch(uuid_re, word)
push!(tokens, (:pkg, UUID(word)))
elseif ismatch(name_re, word)
push!(tokens, (:pkg, String(match(name_re, word).captures[1])))
elseif ismatch(name_uuid_re, word)
m = match(name_uuid_re, word)
push!(tokens, (:pkg, String(m.captures[1]), UUID(m.captures[2])))
else
cmderror("invalid argument: ", repr(word))
end
end
return tokens
end
function do_cmd(repl::Base.REPL.AbstractREPL, input::String)
try
tokens = tokenize(input)
local env_opt::Union{String,Void} = get(ENV, "JULIA_ENV", nothing)
env = EnvCache(env_opt)
do_cmd!(env, tokens, repl)
catch err
if err isa CommandError
Base.display_error(repl.t.err_stream, ErrorException(err.msg), Ptr{Void}[])
else
Base.display_error(repl.t.err_stream, err, Base.catch_backtrace())
end
end
end
function do_cmd!(env, tokens, repl)
local cmd::Symbol
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :cmd
cmd = token[2]
break
elseif token[1] == :opt
if token[2] == :env
length(token) == 3 ||
cmderror("the `--env` option requires a value")
env_opt = token[3]
else
cmderror("unrecognized option: `--$(token[2])`")
end
else
cmderror("misplaced token: ", token)
end
end
cmd == :help ? do_help!(env, tokens, repl) :
cmd == :preview ? do_preview!(env, tokens, repl) :
cmd == :rm ? do_rm!(env, tokens) :
cmd == :add ? do_add!(env, tokens) :
cmd == :up ? do_up!(env, tokens) :
cmd == :status ? do_status!(env, tokens) :
cmd == :test ? do_test!(env, tokens) :
cmderror("`$cmd` command not yet implemented")
end
function do_preview!(env, tokens, repl)
isempty(tokens) && cmderror("`preview` needs a command")
env.preview[] = true
word = tokens[1][2]
word in keys(cmds) || cmderror("invalid command: ", repr(word))
tokens[1] = (:cmd, cmds[word])
do_cmd!(env, tokens, repl)
end
const help = Base.Markdown.parse("""
**Synopsis**
pkg> [--env=...] cmd [opts] [args]
**Environment**
The `--env` meta option determines which project environment to manipulate. By
default, this looks for a git repo in the parents directories of the current
working directory, and if it finds one, it uses that as an environment. Otherwise,
it uses a named environment (typically found in `~/.julia/environments`) looking
for environments named `v$(VERSION.major).$(VERSION.minor).$(VERSION.patch)`,
`v$(VERSION.major).$(VERSION.minor)`, `v$(VERSION.major)` or `default` in order.
**Commands**
What action you want the package manager to take:
`help`: show this message
`status`: summarize contents of and changes to environment
`add`: add packages to project
`rm`: remove packages from project or manifest
`up`: update packages in manifest
`preview`: previews a subsequent command without affecting the current state
`test`: run tests for packages
""")
const helps = Dict(
:help => md"""
help
Display this message.
help cmd ...
Display usage information for commands listed.
Available commands: `help`, `status`, `add`, `rm`, `up`
""", :status => md"""
status
status [-p|--project]
status [-m|--manifest]
Show the status of the current environment. By default, the full contents of
the project file is summarized, showing what version each package is on and
how it has changed since the last git commit (if in a git repo), as well as
any changes to manifest packages not already listed. In `--project` mode, the
status of the project file is summarized. In `--project` mode, the status of
the project file is summarized.
""", :add => md"""
add pkg[=uuid] [@version] ...
Add package `pkg` to the current project file. If `pkg` could refer to
multiple different packages, specifying `uuid` allows you to disambiguate.
`@version` optionally allows specifying which versions of packages. Versions
may be specified by `@1`, `@1.2`, `@1.2.3`, allowing any version with a prefix
that matches, or ranges thereof, such as `@1.2-3.4.5`.
""", :rm => md"""
rm [-p|--project] pkg[=uuid] ...
Remove package `pkg` from the project file. Since the name `pkg` can only
refer to one package in a project this is unambiguous, but you can specify
a `uuid` anyway, and the command is ignored, with a warning if package name
and UUID do not mactch. When a package is removed from the project file, it
may still remain in the manifest if it is required by some other package in
the project. Project mode operation is the default, so passing `-p` or
`--project` is optional unless it is preceded by the `-m` or `--manifest`
options at some earlier point.
rm [-m|--manifest] pkg[=uuid] ...
Remove package `pkg` from the manifest file. If the name `pkg` refers to
multiple packages in the manifest, `uuid` disambiguates it. Removing a package
from the manifest forces the removal of all packages that depend on it, as well
as any no-longer-necessary manifest packages due to project package removals.
""", :up => md"""
up [-p|project] [opts] pkg[=uuid] [@version] ...
up [-m|manifest] [opts] pkg[=uuid] [@version] ...
opts: --major | --minor | --patch | --fixed
Update the indicated package within the constraints of the indicated version
specifications. Versions may be specified by `@1`, `@1.2`, `@1.2.3`, allowing
any version with a prefix that matches, or ranges thereof, such as `@1.2-3.4.5`.
In `--project` mode, package specifications only match project packages, while
in `manifest` mode they match any manifest package. Bound level options force
the following packages to be upgraded only within the current major, minor,
patch version; if the `--fixed` upgrade level is given, then the following
packages will not be upgraded at all.
""", :preview => md"""
preview cmd
Runs the command `cmd` in preview mode. This is defined such that no side effects
will take place i.e. no packages are downloaded and neither the project nor manifest
is modified.
""", :test => md"""
test [opts] pkg[=uuid] ...
opts: --coverage
Run the tests for package `pkg`. This is done by running the file `test/runtests.jl`
in the package directory. The option `--coverage` can be used to run the tests with
coverage enabled.
""",
)
function do_help!(
env::EnvCache,
tokens::Vector{Tuple{Symbol,Vararg{Any}}},
repl::Base.REPL.AbstractREPL,
)
disp = Base.REPL.REPLDisplay(repl)
if isempty(tokens)
Base.display(disp, help)
return
end
help_md = md""
for token in tokens
if token[1] == :cmd
if haskey(helps, token[2])
isempty(help_md.content) ||
push!(help_md.content, md"---")
push!(help_md.content, helps[token[2]].content)
else
cmderror("Sorry, I don't have any help for the `$(token[2])` command.")
end
else
error("This should not happen")
end
end
Base.display(disp, help_md)
end
function do_rm!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
# tokens: package names and/or uuids
mode = :project
pkgs = PackageSpec[]
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :pkg
push!(pkgs, PackageSpec(token[2:end]...))
pkgs[end].mode = mode
elseif token[1] == :ver
cmderror("`rm` does not take version specs")
elseif token[1] == :opt
if token[2] in (:project, :manifest)
length(token) == 2 ||
cmderror("the --$(token[2]) option does not take an argument")
mode = token[2]
else
cmderror("invalid option for `rm`: --$(token[2])")
end
end
end
isempty(pkgs) &&
cmderror("`rm` – list packages to remove")
Pkg3.API.rm(env, pkgs)
end
function do_add!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
# tokens: package names and/or uuids, optionally followed by version specs
isempty(tokens) &&
cmderror("`add` – list packages to add")
tokens[1][1] == :ver &&
cmderror("package name/uuid must precede version spec `@$(tokens[1][2])`")
pkgs = PackageSpec[]
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :pkg
push!(pkgs, PackageSpec(token[2:end]...))
elseif token[1] == :ver
pkgs[end].version = VersionSpec(token[2])
isempty(tokens) || tokens[1][1] == :pkg ||
cmderror("package name/uuid must precede version spec `@$(tokens[1][2])`")
elseif token[1] == :opt
cmderror("`add` doesn't take options: --$(join(token[2:end], '='))")
end
end
Pkg3.API.add(env, pkgs)
end
function do_up!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
# tokens:
# - upgrade levels as options: --[fixed|patch|minor|major]
# - package names and/or uuids, optionally followed by version specs
mode = :project
pkgs = PackageSpec[]
level = UpgradeLevel(:major)
last_token_type = :cmd
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :pkg
push!(pkgs, PackageSpec(token[2:end]..., level))
pkgs[end].mode = mode
elseif token[1] == :ver
pkgs[end].version = VersionSpec(token[2])
last_token_type == :pkg ||
cmderror("package name/uuid must precede version spec `@$(token[2])`")
elseif token[1] == :opt
if token[2] in (:project, :manifest)
length(token) == 2 ||
cmderror("the --$(token[2]) option does not take an argument")
mode = token[2]
elseif token[2] in (:major, :minor, :patch, :fixed)
length(token) == 2 ||
cmderror("the --$(token[2]) option does not take an argument")
level = UpgradeLevel(token[2])
else
cmderror("invalid option for `up`: --$(token[2])")
end
end
last_token_type = token[1]
end
Pkg3.API.up(env, pkgs; level=level, mode=mode)
end
function do_status!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
mode = :combined
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :opt
if token[2] in (:project, :manifest)
length(token) == 2 ||
cmderror("the --$(token[2]) option does not take an argument")
mode = token[2]
else
cmderror("invalid option for `status`: --$(token[2])")
end
else
cmderror("`status` does not take arguments")
end
end
Pkg3.Display.status(env, mode)
end
# TODO , test recursive dependencies as on option.
function do_test!(env::EnvCache, tokens::Vector{Tuple{Symbol,Vararg{Any}}})
pkgs = PackageSpec[]
coverage = false
while !isempty(tokens)
token = shift!(tokens)
if token[1] == :pkg
if length(token) == 2
pkg = PackageSpec(token[2])
pkg.mode = :manifest
push!(pkgs, pkg)
else
cmderror("`test` only takes a set of packages to test")
end
elseif token[1] == :opt
if token[2] == :coverage
coverage = true
else
cmderror("invalid option for `test`: --$(token[2])")
end
else
# TODO: Better error message
cmderror("invalid usage for `test`")
end
end
isempty(pkgs) && cmderror("`test` takes a set of packages")
Pkg3.API.test(env, pkgs; coverage = coverage)
end
function create_mode(repl, main)
pkg_mode = LineEdit.Prompt("pkg> ";
prompt_prefix = Base.text_colors[:blue],
prompt_suffix = "",
sticky = true)
if VERSION >= v"0.7.0-DEV.1747"
pkg_mode.repl = repl
end
hp = main.hist
hp.mode_mapping[:pkg] = pkg_mode
pkg_mode.hist = hp
search_prompt, skeymap = LineEdit.setup_search_keymap(hp)
prefix_prompt, prefix_keymap = LineEdit.setup_prefix_keymap(hp, pkg_mode)
pkg_mode.on_done = (s, buf, ok) -> begin
ok || return REPL.transition(s, :abort)
input = String(take!(buf))
REPL.reset(repl)
do_cmd(repl, input)
REPL.prepare_next(repl)
REPL.reset_state(s)
s.current_mode.sticky || REPL.transition(s, main)
end
mk = REPL.mode_keymap(main)
# ^C should not exit prompt
delete!(mk, "^C")
b = Dict{Any,Any}[
skeymap, mk, prefix_keymap, LineEdit.history_keymap,
LineEdit.default_keymap, LineEdit.escape_defaults
]
pkg_mode.keymap_dict = LineEdit.keymap(b)
return pkg_mode
end
function repl_init(repl)
main_mode = repl.interface.modes[1]
pkg_mode = create_mode(repl, main_mode)
push!(repl.interface.modes, pkg_mode)
keymap = Dict{Any,Any}(
']' => function (s,args...)
if isempty(s) || position(LineEdit.buffer(s)) == 0
buf = copy(LineEdit.buffer(s))
LineEdit.transition(s, pkg_mode) do
LineEdit.state(s, pkg_mode).input_buffer = buf
end
else
LineEdit.edit_insert(s, ']')
end
end
)
main_mode.keymap_dict = LineEdit.keymap_merge(main_mode.keymap_dict, keymap)
return
end
end
| [
21412,
45285,
19076,
198,
198,
11748,
350,
10025,
18,
198,
3500,
350,
10025,
18,
13,
31431,
198,
3500,
350,
10025,
18,
13,
23114,
198,
3500,
350,
10025,
18,
13,
18843,
602,
198,
198,
11748,
7308,
25,
6910,
18378,
11,
45285,
11,
45285,
5377,
37069,
507,
198,
11748,
7308,
13,
29531,
25,
471,
27586,
198,
3500,
7308,
13,
9704,
2902,
198,
198,
9979,
23991,
82,
796,
360,
713,
7,
198,
220,
220,
220,
366,
16794,
1,
220,
220,
220,
220,
220,
5218,
1058,
16794,
11,
198,
220,
220,
220,
366,
1701,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
16794,
11,
198,
220,
220,
220,
366,
13376,
1,
220,
220,
220,
5218,
1058,
13376,
11,
198,
220,
220,
220,
366,
301,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
13376,
11,
198,
220,
220,
220,
366,
526,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
13376,
11,
198,
220,
220,
220,
366,
12947,
1,
220,
220,
220,
5218,
1058,
12947,
11,
198,
220,
220,
220,
366,
19796,
1,
220,
220,
220,
220,
220,
5218,
1058,
12947,
11,
198,
220,
220,
220,
12813,
1,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
12947,
11,
198,
220,
220,
220,
366,
2860,
1,
220,
220,
220,
220,
220,
220,
5218,
1058,
2860,
11,
198,
220,
220,
220,
366,
17350,
1,
220,
220,
5218,
1058,
2860,
11,
198,
220,
220,
220,
43825,
1,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
2860,
11,
198,
220,
220,
220,
366,
26224,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
26224,
11,
198,
220,
220,
220,
366,
28956,
1,
220,
220,
220,
5218,
1058,
26224,
11,
198,
220,
220,
220,
366,
403,
17350,
1,
5218,
1058,
26224,
11,
198,
220,
220,
220,
366,
21215,
220,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
26224,
11,
198,
220,
220,
220,
366,
929,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
929,
11,
198,
220,
220,
220,
366,
19119,
1,
220,
220,
220,
5218,
1058,
929,
11,
198,
220,
220,
220,
366,
929,
9526,
1,
220,
220,
5218,
1058,
929,
11,
198,
220,
220,
220,
366,
9288,
1,
220,
220,
220,
220,
220,
5218,
1058,
9288,
11,
198,
220,
220,
220,
366,
36484,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
36484,
11,
198,
220,
220,
220,
366,
9501,
694,
1,
220,
220,
220,
220,
220,
5218,
1058,
9501,
694,
11,
198,
220,
220,
220,
366,
3866,
1177,
1,
220,
220,
5218,
1058,
3866,
1177,
11,
198,
8,
198,
198,
9979,
2172,
82,
796,
360,
713,
7,
198,
220,
220,
220,
366,
24330,
1,
220,
220,
220,
220,
220,
5218,
1058,
24330,
11,
198,
220,
220,
220,
366,
16302,
1,
220,
5218,
1058,
16302,
11,
198,
220,
220,
220,
366,
79,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
16302,
11,
198,
220,
220,
220,
366,
805,
8409,
1,
5218,
1058,
805,
8409,
11,
198,
220,
220,
220,
366,
76,
1,
220,
220,
220,
220,
220,
220,
220,
5218,
1058,
805,
8409,
11,
198,
220,
220,
220,
366,
22478,
1,
220,
220,
220,
5218,
1058,
22478,
11,
198,
220,
220,
220,
366,
1084,
273,
1,
220,
220,
220,
5218,
1058,
1084,
273,
11,
198,
220,
220,
220,
366,
17147,
1,
220,
220,
220,
5218,
1058,
17147,
11,
198,
220,
220,
220,
366,
34021,
1,
220,
220,
220,
5218,
1058,
34021,
11,
198,
220,
220,
220,
366,
1073,
1857,
1,
5218,
1058,
1073,
1857,
11,
198,
8,
198,
198,
8818,
21136,
62,
18076,
7,
4775,
3712,
23839,
10100,
8,
198,
220,
220,
220,
285,
796,
2872,
7,
81,
1,
61,
7,
27514,
532,
26933,
64,
12,
89,
12962,
930,
1377,
26933,
64,
12,
89,
60,
90,
17,
11,
92,
5769,
30,
7479,
82,
9,
28,
59,
82,
9,
38016,
50,
9,
4008,
30,
1267,
3,
1,
844,
11,
1573,
8,
198,
220,
220,
220,
285,
6624,
2147,
11405,
12067,
1082,
1472,
7203,
259,
12102,
3038,
25,
33172,
41575,
7,
4775,
4008,
198,
220,
220,
220,
479,
796,
285,
13,
27144,
942,
58,
16,
60,
14512,
2147,
5633,
285,
13,
27144,
942,
58,
16,
60,
1058,
285,
13,
27144,
942,
58,
17,
60,
198,
220,
220,
220,
468,
2539,
7,
404,
912,
11,
479,
8,
8614,
12067,
1082,
1472,
7203,
259,
12102,
3038,
25,
33172,
41575,
7,
4775,
4008,
198,
220,
220,
220,
285,
13,
27144,
942,
58,
18,
60,
6624,
2147,
5633,
198,
220,
220,
220,
220,
220,
220,
220,
357,
25,
8738,
11,
2172,
82,
58,
74,
12962,
1058,
357,
25,
8738,
11,
2172,
82,
58,
74,
4357,
10903,
7,
76,
13,
27144,
942,
58,
18,
60,
4008,
198,
437,
198,
198,
1616,
334,
27112,
796,
8246,
18109,
30,
72,
38381,
15,
12,
24,
64,
12,
89,
60,
90,
23,
92,
49146,
15,
12,
24,
64,
12,
89,
60,
90,
19,
92,
49146,
15,
12,
24,
64,
12,
89,
60,
90,
19,
92,
49146,
15,
12,
24,
64,
12,
89,
60,
90,
19,
92,
49146,
15,
12,
24,
64,
12,
89,
60,
90,
1065,
92,
7,
30,
12,
72,
42501,
198,
220,
220,
220,
1438,
796,
8246,
18109,
59,
86,
10,
5769,
30,
7479,
13,
20362,
8,
1701,
198,
220,
220,
220,
3298,
1438,
62,
260,
796,
797,
25636,
7203,
61,
3,
3672,
59,
3,
4943,
198,
220,
220,
220,
3298,
334,
27112,
62,
260,
796,
797,
25636,
7203,
61,
3,
12303,
312,
59,
3,
4943,
198,
220,
220,
220,
3298,
1438,
62,
12303,
312,
62,
260,
796,
797,
25636,
7203,
61,
3,
3672,
6852,
82,
9,
28,
6852,
82,
9,
16763,
12303,
312,
19415,
3,
4943,
198,
437,
198,
198,
9979,
31191,
62,
260,
796,
374,
1,
61,
58,
59,
30,
17405,
14,
59,
10,
41441,
60,
930,
685,
61,
31,
59,
82,
48688,
59,
82,
9,
28,
59,
82,
9,
58,
61,
31,
59,
82,
48688,
930,
2488,
59,
82,
9,
58,
61,
31,
59,
82,
60,
9,
930,
685,
61,
31,
59,
82,
48688,
1,
87,
198,
198,
8818,
11241,
1096,
7,
28758,
3712,
10100,
2599,
25,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
42535,
198,
220,
220,
220,
16326,
796,
309,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
21737,
198,
220,
220,
220,
1303,
16926,
46,
25,
5412,
4731,
12,
421,
5191,
3815,
11,
304,
13,
70,
13,
3108,
3891,
198,
220,
220,
220,
2456,
796,
3975,
7,
76,
3784,
76,
13,
15699,
11,
1123,
15699,
7,
2588,
62,
260,
11,
23991,
4008,
198,
220,
220,
220,
1037,
62,
14171,
796,
3991,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
10879,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1573,
796,
6482,
0,
7,
10879,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1573,
58,
16,
60,
6624,
705,
19355,
11405,
4129,
7,
4775,
8,
1875,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
21136,
62,
18076,
7,
4775,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1573,
287,
8251,
7,
28758,
82,
8,
8614,
12067,
1082,
1472,
7203,
259,
12102,
3141,
25,
33172,
41575,
7,
4775,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
357,
25,
28758,
11,
23991,
82,
58,
4775,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
62,
14171,
8614,
23991,
82,
58,
4775,
60,
14512,
1058,
16794,
11405,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1037,
62,
14171,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
318,
28920,
7,
83,
482,
641,
8,
8614,
16326,
58,
437,
7131,
16,
60,
14512,
1058,
28758,
198,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
3919,
5301,
3141,
1813,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
10879,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1573,
796,
6482,
0,
7,
10879,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1573,
58,
16,
60,
6624,
705,
19355,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
21136,
62,
18076,
7,
4775,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
1573,
58,
16,
60,
6624,
705,
31,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
357,
25,
332,
11,
10628,
17257,
7,
36311,
7,
4775,
58,
17,
25,
437,
60,
35514,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
318,
15699,
7,
12303,
312,
62,
260,
11,
1573,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
357,
25,
35339,
11,
471,
27586,
7,
4775,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
318,
15699,
7,
3672,
62,
260,
11,
1573,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
357,
25,
35339,
11,
10903,
7,
15699,
7,
3672,
62,
260,
11,
1573,
737,
27144,
942,
58,
16,
60,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
318,
15699,
7,
3672,
62,
12303,
312,
62,
260,
11,
1573,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
796,
2872,
7,
3672,
62,
12303,
312,
62,
260,
11,
1573,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
83,
482,
641,
11,
357,
25,
35339,
11,
10903,
7,
76,
13,
27144,
942,
58,
16,
46570,
471,
27586,
7,
76,
13,
27144,
942,
58,
17,
60,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
4578,
25,
33172,
41575,
7,
4775,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
16326,
198,
437,
198,
198,
8818,
466,
62,
28758,
7,
35666,
3712,
14881,
13,
2200,
6489,
13,
23839,
2200,
6489,
11,
5128,
3712,
10100,
8,
198,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
16326,
796,
11241,
1096,
7,
15414,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1957,
17365,
62,
8738,
3712,
38176,
90,
10100,
11,
53,
1868,
92,
796,
651,
7,
1677,
53,
11,
366,
41,
6239,
3539,
62,
1677,
53,
1600,
2147,
8,
198,
220,
220,
220,
220,
220,
220,
220,
17365,
796,
2039,
85,
30562,
7,
24330,
62,
8738,
8,
198,
220,
220,
220,
220,
220,
220,
220,
466,
62,
28758,
0,
7,
24330,
11,
16326,
11,
2186,
8,
198,
220,
220,
220,
4929,
11454,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11454,
318,
64,
9455,
12331,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7308,
13,
13812,
62,
18224,
7,
35666,
13,
83,
13,
8056,
62,
5532,
11,
13047,
16922,
7,
8056,
13,
19662,
828,
350,
2213,
90,
53,
1868,
92,
58,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7308,
13,
13812,
62,
18224,
7,
35666,
13,
83,
13,
8056,
62,
5532,
11,
11454,
11,
7308,
13,
40198,
62,
1891,
40546,
28955,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
466,
62,
28758,
0,
7,
24330,
11,
16326,
11,
2186,
8,
198,
220,
220,
220,
1957,
23991,
3712,
13940,
23650,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
28758,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
23991,
796,
11241,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
17,
60,
6624,
1058,
24330,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
30001,
8,
6624,
513,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
1169,
4600,
438,
24330,
63,
3038,
4433,
257,
1988,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
17365,
62,
8738,
796,
11241,
58,
18,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
403,
26243,
1143,
3038,
25,
4600,
438,
3,
7,
30001,
58,
17,
12962,
63,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
25413,
21820,
11241,
25,
33172,
11241,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
23991,
6624,
1058,
16794,
220,
220,
220,
5633,
220,
220,
220,
466,
62,
16794,
0,
7,
24330,
11,
16326,
11,
2186,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
3866,
1177,
5633,
466,
62,
3866,
1177,
0,
7,
24330,
11,
16326,
11,
2186,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
26224,
220,
220,
220,
220,
220,
5633,
220,
220,
220,
220,
220,
466,
62,
26224,
0,
7,
24330,
11,
16326,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
2860,
220,
220,
220,
220,
5633,
220,
220,
220,
220,
466,
62,
2860,
0,
7,
24330,
11,
16326,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
929,
220,
220,
220,
220,
220,
5633,
220,
220,
220,
220,
220,
466,
62,
929,
0,
7,
24330,
11,
16326,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
13376,
220,
5633,
220,
466,
62,
13376,
0,
7,
24330,
11,
16326,
8,
1058,
198,
220,
220,
220,
23991,
6624,
1058,
9288,
220,
220,
5633,
220,
220,
466,
62,
9288,
0,
7,
24330,
11,
16326,
8,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
3,
28758,
63,
3141,
407,
1865,
9177,
4943,
198,
437,
198,
198,
8818,
466,
62,
3866,
1177,
0,
7,
24330,
11,
16326,
11,
2186,
8,
198,
220,
220,
220,
318,
28920,
7,
83,
482,
641,
8,
11405,
12067,
1082,
1472,
7203,
63,
3866,
1177,
63,
2476,
257,
3141,
4943,
198,
220,
220,
220,
17365,
13,
3866,
1177,
21737,
796,
2081,
198,
220,
220,
220,
1573,
796,
16326,
58,
16,
7131,
17,
60,
198,
220,
220,
220,
1573,
287,
8251,
7,
28758,
82,
8,
8614,
12067,
1082,
1472,
7203,
259,
12102,
3141,
25,
33172,
41575,
7,
4775,
4008,
198,
220,
220,
220,
16326,
58,
16,
60,
796,
357,
25,
28758,
11,
23991,
82,
58,
4775,
12962,
198,
220,
220,
220,
466,
62,
28758,
0,
7,
24330,
11,
16326,
11,
2186,
8,
198,
437,
198,
198,
9979,
1037,
796,
7308,
13,
9704,
2902,
13,
29572,
7203,
15931,
198,
220,
220,
220,
12429,
49771,
1174,
628,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
29,
685,
438,
24330,
28,
22345,
23991,
685,
404,
912,
60,
685,
22046,
60,
628,
220,
220,
220,
12429,
31441,
1174,
628,
220,
220,
220,
383,
4600,
438,
24330,
63,
13634,
3038,
15947,
543,
1628,
2858,
284,
18510,
13,
2750,
198,
220,
220,
220,
4277,
11,
428,
3073,
329,
257,
17606,
29924,
287,
262,
3397,
29196,
286,
262,
1459,
198,
220,
220,
220,
1762,
8619,
11,
290,
611,
340,
7228,
530,
11,
340,
3544,
326,
355,
281,
2858,
13,
15323,
11,
198,
220,
220,
220,
340,
3544,
257,
3706,
2858,
357,
48126,
1043,
287,
4600,
93,
11757,
73,
43640,
14,
268,
12103,
63,
8,
2045,
198,
220,
220,
220,
329,
12493,
3706,
4600,
85,
3,
7,
43717,
13,
22478,
737,
3,
7,
43717,
13,
1084,
273,
737,
3,
7,
43717,
13,
17147,
8,
47671,
198,
220,
220,
220,
4600,
85,
3,
7,
43717,
13,
22478,
737,
3,
7,
43717,
13,
1084,
273,
8,
47671,
220,
4600,
85,
3,
7,
43717,
13,
22478,
8,
63,
393,
4600,
12286,
63,
287,
1502,
13,
628,
220,
220,
220,
12429,
6935,
1746,
1174,
628,
220,
220,
220,
1867,
2223,
345,
765,
262,
5301,
4706,
284,
1011,
25,
628,
220,
220,
220,
4600,
16794,
63,
25,
905,
428,
3275,
628,
220,
220,
220,
4600,
13376,
63,
25,
35743,
10154,
286,
290,
2458,
284,
2858,
628,
220,
220,
220,
4600,
2860,
63,
25,
751,
10392,
284,
1628,
628,
220,
220,
220,
4600,
26224,
63,
25,
4781,
10392,
422,
1628,
393,
10561,
628,
220,
220,
220,
4600,
929,
63,
25,
4296,
10392,
287,
10561,
628,
220,
220,
220,
4600,
3866,
1177,
63,
25,
41418,
257,
8840,
3141,
1231,
13891,
262,
1459,
1181,
628,
220,
220,
220,
4600,
9288,
63,
25,
1057,
5254,
329,
10392,
198,
220,
220,
220,
13538,
4943,
198,
198,
9979,
5419,
796,
360,
713,
7,
198,
220,
220,
220,
1058,
16794,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
1037,
628,
220,
220,
220,
16531,
428,
3275,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1037,
23991,
2644,
628,
220,
220,
220,
16531,
8748,
1321,
329,
9729,
5610,
13,
628,
220,
220,
220,
14898,
9729,
25,
4600,
16794,
47671,
4600,
13376,
47671,
4600,
2860,
47671,
4600,
26224,
47671,
4600,
929,
63,
198,
220,
220,
220,
13538,
1600,
1058,
13376,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
3722,
198,
220,
220,
220,
220,
220,
220,
220,
3722,
25915,
79,
91,
438,
16302,
60,
198,
220,
220,
220,
220,
220,
220,
220,
3722,
25915,
76,
91,
438,
805,
8409,
60,
628,
220,
220,
220,
5438,
262,
3722,
286,
262,
1459,
2858,
13,
2750,
4277,
11,
262,
1336,
10154,
286,
198,
220,
220,
220,
262,
1628,
2393,
318,
31880,
11,
4478,
644,
2196,
1123,
5301,
318,
319,
290,
198,
220,
220,
220,
703,
340,
468,
3421,
1201,
262,
938,
17606,
4589,
357,
361,
287,
257,
17606,
29924,
828,
355,
880,
355,
198,
220,
220,
220,
597,
2458,
284,
10561,
10392,
407,
1541,
5610,
13,
554,
4600,
438,
16302,
63,
4235,
11,
262,
198,
220,
220,
220,
3722,
286,
262,
1628,
2393,
318,
31880,
13,
554,
4600,
438,
16302,
63,
4235,
11,
262,
3722,
286,
198,
220,
220,
220,
262,
1628,
2393,
318,
31880,
13,
198,
220,
220,
220,
13538,
1600,
1058,
2860,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
751,
279,
10025,
58,
28,
12303,
312,
60,
685,
31,
9641,
60,
2644,
628,
220,
220,
220,
3060,
5301,
4600,
35339,
63,
284,
262,
1459,
1628,
2393,
13,
1002,
4600,
35339,
63,
714,
3522,
284,
198,
220,
220,
220,
3294,
1180,
10392,
11,
31577,
4600,
12303,
312,
63,
3578,
345,
284,
595,
4131,
328,
4985,
13,
198,
220,
220,
220,
4600,
31,
9641,
63,
42976,
3578,
31577,
543,
6300,
286,
10392,
13,
18535,
507,
198,
220,
220,
220,
743,
307,
7368,
416,
4600,
31,
16,
47671,
4600,
31,
16,
13,
17,
47671,
4600,
31,
16,
13,
17,
13,
18,
47671,
5086,
597,
2196,
351,
257,
21231,
198,
220,
220,
220,
326,
7466,
11,
393,
16069,
15370,
11,
884,
355,
4600,
31,
16,
13,
17,
12,
18,
13,
19,
13,
20,
44646,
198,
220,
220,
220,
13538,
1600,
1058,
26224,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
42721,
25915,
79,
91,
438,
16302,
60,
279,
10025,
58,
28,
12303,
312,
60,
2644,
628,
220,
220,
220,
17220,
5301,
4600,
35339,
63,
422,
262,
1628,
2393,
13,
4619,
262,
1438,
4600,
35339,
63,
460,
691,
198,
220,
220,
220,
3522,
284,
530,
5301,
287,
257,
1628,
428,
318,
42053,
29709,
11,
475,
345,
460,
11986,
198,
220,
220,
220,
257,
4600,
12303,
312,
63,
6949,
11,
290,
262,
3141,
318,
9514,
11,
351,
257,
6509,
611,
5301,
1438,
198,
220,
220,
220,
290,
471,
27586,
466,
407,
285,
529,
354,
13,
1649,
257,
5301,
318,
4615,
422,
262,
1628,
2393,
11,
340,
198,
220,
220,
220,
743,
991,
3520,
287,
262,
10561,
611,
340,
318,
2672,
416,
617,
584,
5301,
287,
198,
220,
220,
220,
262,
1628,
13,
4935,
4235,
4905,
318,
262,
4277,
11,
523,
6427,
4600,
12,
79,
63,
393,
198,
220,
220,
220,
4600,
438,
16302,
63,
318,
11902,
4556,
340,
318,
27165,
416,
262,
4600,
12,
76,
63,
393,
4600,
438,
805,
8409,
63,
198,
220,
220,
220,
3689,
379,
617,
2961,
966,
13,
628,
220,
220,
220,
220,
220,
220,
220,
42721,
25915,
76,
91,
438,
805,
8409,
60,
279,
10025,
58,
28,
12303,
312,
60,
2644,
628,
220,
220,
220,
17220,
5301,
4600,
35339,
63,
422,
262,
10561,
2393,
13,
1002,
262,
1438,
4600,
35339,
63,
10229,
284,
198,
220,
220,
220,
3294,
10392,
287,
262,
10561,
11,
4600,
12303,
312,
63,
595,
4131,
328,
12632,
340,
13,
3982,
5165,
257,
5301,
198,
220,
220,
220,
422,
262,
10561,
3386,
262,
9934,
286,
477,
10392,
326,
4745,
319,
340,
11,
355,
880,
198,
220,
220,
220,
355,
597,
645,
12,
6511,
263,
12,
49986,
10561,
10392,
2233,
284,
1628,
5301,
816,
709,
874,
13,
198,
220,
220,
220,
13538,
1600,
1058,
929,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
510,
25915,
79,
91,
16302,
60,
220,
685,
404,
912,
60,
279,
10025,
58,
28,
12303,
312,
60,
685,
31,
9641,
60,
2644,
198,
220,
220,
220,
220,
220,
220,
220,
510,
25915,
76,
91,
805,
8409,
60,
685,
404,
912,
60,
279,
10025,
58,
28,
12303,
312,
60,
685,
31,
9641,
60,
2644,
628,
220,
220,
220,
220,
220,
220,
220,
2172,
82,
25,
1377,
22478,
930,
1377,
1084,
273,
930,
1377,
17147,
930,
1377,
34021,
628,
220,
220,
220,
10133,
262,
8203,
5301,
1626,
262,
17778,
286,
262,
8203,
2196,
198,
220,
220,
220,
20640,
13,
18535,
507,
743,
307,
7368,
416,
4600,
31,
16,
47671,
4600,
31,
16,
13,
17,
47671,
4600,
31,
16,
13,
17,
13,
18,
47671,
5086,
198,
220,
220,
220,
597,
2196,
351,
257,
21231,
326,
7466,
11,
393,
16069,
15370,
11,
884,
355,
4600,
31,
16,
13,
17,
12,
18,
13,
19,
13,
20,
44646,
198,
220,
220,
220,
554,
4600,
438,
16302,
63,
4235,
11,
5301,
20640,
691,
2872,
1628,
10392,
11,
981,
198,
220,
220,
220,
287,
4600,
805,
8409,
63,
4235,
484,
2872,
597,
10561,
5301,
13,
30149,
1241,
3689,
2700,
198,
220,
220,
220,
262,
1708,
10392,
284,
307,
17955,
691,
1626,
262,
1459,
1688,
11,
4159,
11,
198,
220,
220,
220,
8529,
2196,
26,
611,
262,
4600,
438,
34021,
63,
8515,
1241,
318,
1813,
11,
788,
262,
1708,
198,
220,
220,
220,
10392,
481,
407,
307,
17955,
379,
477,
13,
198,
220,
220,
220,
13538,
1600,
1058,
3866,
1177,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
12714,
23991,
628,
220,
220,
220,
44743,
262,
3141,
4600,
28758,
63,
287,
12714,
4235,
13,
770,
318,
5447,
884,
326,
645,
1735,
3048,
198,
220,
220,
220,
481,
1011,
1295,
1312,
13,
68,
13,
645,
10392,
389,
15680,
290,
6159,
262,
1628,
4249,
10561,
198,
220,
220,
220,
318,
9518,
13,
198,
220,
220,
220,
13538,
1600,
1058,
9288,
5218,
45243,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
1332,
685,
404,
912,
60,
279,
10025,
58,
28,
12303,
312,
60,
2644,
628,
220,
220,
220,
220,
220,
220,
220,
2172,
82,
25,
1377,
1073,
1857,
628,
220,
220,
220,
5660,
262,
5254,
329,
5301,
4600,
35339,
44646,
770,
318,
1760,
416,
2491,
262,
2393,
4600,
9288,
14,
81,
2797,
3558,
13,
20362,
63,
198,
220,
220,
220,
287,
262,
5301,
8619,
13,
383,
3038,
4600,
438,
1073,
1857,
63,
460,
307,
973,
284,
1057,
262,
5254,
351,
198,
220,
220,
220,
5197,
9343,
13,
198,
220,
220,
220,
13538,
1600,
198,
8,
198,
198,
8818,
466,
62,
16794,
0,
7,
198,
220,
220,
220,
17365,
3712,
4834,
85,
30562,
11,
198,
220,
220,
220,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
5512,
198,
220,
220,
220,
2186,
3712,
14881,
13,
2200,
6489,
13,
23839,
2200,
6489,
11,
198,
8,
198,
220,
220,
220,
4596,
796,
7308,
13,
2200,
6489,
13,
2200,
6489,
23114,
7,
35666,
8,
198,
220,
220,
220,
611,
318,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
7308,
13,
13812,
7,
6381,
79,
11,
1037,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1037,
62,
9132,
796,
45243,
15931,
198,
220,
220,
220,
329,
11241,
287,
16326,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
28758,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
35194,
11,
11241,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
28920,
7,
16794,
62,
9132,
13,
11299,
8,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
16794,
62,
9132,
13,
11299,
11,
45243,
1,
6329,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
16794,
62,
9132,
13,
11299,
11,
5419,
58,
30001,
58,
17,
60,
4083,
11299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
14385,
11,
314,
836,
470,
423,
597,
1037,
329,
262,
4600,
3,
7,
30001,
58,
17,
12962,
63,
3141,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
1212,
815,
407,
1645,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
7308,
13,
13812,
7,
6381,
79,
11,
1037,
62,
9132,
8,
198,
437,
198,
198,
8818,
466,
62,
26224,
0,
7,
24330,
3712,
4834,
85,
30562,
11,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
30072,
198,
220,
220,
220,
1303,
16326,
25,
5301,
3891,
290,
14,
273,
334,
84,
2340,
198,
220,
220,
220,
4235,
796,
1058,
16302,
198,
220,
220,
220,
279,
10025,
82,
796,
15717,
22882,
21737,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
35339,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
35339,
82,
11,
15717,
22882,
7,
30001,
58,
17,
25,
437,
60,
986,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
82,
58,
437,
4083,
14171,
796,
4235,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
332,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
26224,
63,
857,
407,
1011,
2196,
25274,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
17,
60,
287,
357,
25,
16302,
11,
1058,
805,
8409,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
30001,
8,
6624,
362,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
1169,
1377,
3,
7,
30001,
58,
17,
12962,
3038,
857,
407,
1011,
281,
4578,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4235,
796,
11241,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
3038,
329,
4600,
26224,
63,
25,
1377,
3,
7,
30001,
58,
17,
12962,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
318,
28920,
7,
35339,
82,
8,
11405,
198,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
26224,
63,
784,
1849,
4868,
10392,
284,
4781,
4943,
198,
220,
220,
220,
350,
10025,
18,
13,
17614,
13,
26224,
7,
24330,
11,
279,
10025,
82,
8,
198,
437,
198,
198,
8818,
466,
62,
2860,
0,
7,
24330,
3712,
4834,
85,
30562,
11,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
30072,
198,
220,
220,
220,
1303,
16326,
25,
5301,
3891,
290,
14,
273,
334,
84,
2340,
11,
42976,
3940,
416,
2196,
25274,
198,
220,
220,
220,
318,
28920,
7,
83,
482,
641,
8,
11405,
198,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
2860,
63,
784,
1849,
4868,
10392,
284,
751,
4943,
198,
220,
220,
220,
16326,
58,
16,
7131,
16,
60,
6624,
1058,
332,
11405,
198,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
26495,
1438,
14,
12303,
312,
1276,
8555,
68,
2196,
1020,
4600,
31,
3,
7,
83,
482,
641,
58,
16,
7131,
17,
12962,
63,
4943,
198,
220,
220,
220,
279,
10025,
82,
796,
15717,
22882,
21737,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
35339,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
35339,
82,
11,
15717,
22882,
7,
30001,
58,
17,
25,
437,
60,
986,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
332,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
82,
58,
437,
4083,
9641,
796,
10628,
22882,
7,
30001,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
318,
28920,
7,
83,
482,
641,
8,
8614,
16326,
58,
16,
7131,
16,
60,
6624,
1058,
35339,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
26495,
1438,
14,
12303,
312,
1276,
8555,
68,
2196,
1020,
4600,
31,
3,
7,
83,
482,
641,
58,
16,
7131,
17,
12962,
63,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
2860,
63,
1595,
470,
1011,
3689,
25,
1377,
3,
7,
22179,
7,
30001,
58,
17,
25,
437,
4357,
705,
11639,
4008,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
350,
10025,
18,
13,
17614,
13,
2860,
7,
24330,
11,
279,
10025,
82,
8,
198,
437,
198,
198,
8818,
466,
62,
929,
0,
7,
24330,
3712,
4834,
85,
30562,
11,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
30072,
198,
220,
220,
220,
1303,
16326,
25,
198,
220,
220,
220,
1303,
220,
532,
8515,
2974,
355,
3689,
25,
1377,
58,
34021,
91,
17147,
91,
1084,
273,
91,
22478,
60,
198,
220,
220,
220,
1303,
220,
532,
5301,
3891,
290,
14,
273,
334,
84,
2340,
11,
42976,
3940,
416,
2196,
25274,
198,
220,
220,
220,
4235,
796,
1058,
16302,
198,
220,
220,
220,
279,
10025,
82,
796,
15717,
22882,
21737,
198,
220,
220,
220,
1241,
796,
24236,
4971,
7,
25,
22478,
8,
198,
220,
220,
220,
938,
62,
30001,
62,
4906,
796,
1058,
28758,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
35339,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
35339,
82,
11,
15717,
22882,
7,
30001,
58,
17,
25,
437,
60,
986,
11,
1241,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
82,
58,
437,
4083,
14171,
796,
4235,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
332,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
82,
58,
437,
4083,
9641,
796,
10628,
22882,
7,
30001,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
938,
62,
30001,
62,
4906,
6624,
1058,
35339,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
26495,
1438,
14,
12303,
312,
1276,
8555,
68,
2196,
1020,
4600,
31,
3,
7,
30001,
58,
17,
12962,
63,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
17,
60,
287,
357,
25,
16302,
11,
1058,
805,
8409,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
30001,
8,
6624,
362,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
1169,
1377,
3,
7,
30001,
58,
17,
12962,
3038,
857,
407,
1011,
281,
4578,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4235,
796,
11241,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
17,
60,
287,
357,
25,
22478,
11,
1058,
1084,
273,
11,
1058,
17147,
11,
1058,
34021,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
30001,
8,
6624,
362,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
1169,
1377,
3,
7,
30001,
58,
17,
12962,
3038,
857,
407,
1011,
281,
4578,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1241,
796,
24236,
4971,
7,
30001,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
3038,
329,
4600,
929,
63,
25,
1377,
3,
7,
30001,
58,
17,
12962,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
938,
62,
30001,
62,
4906,
796,
11241,
58,
16,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
350,
10025,
18,
13,
17614,
13,
929,
7,
24330,
11,
279,
10025,
82,
26,
1241,
28,
5715,
11,
4235,
28,
14171,
8,
198,
437,
198,
198,
8818,
466,
62,
13376,
0,
7,
24330,
3712,
4834,
85,
30562,
11,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
30072,
198,
220,
220,
220,
4235,
796,
1058,
24011,
1389,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
17,
60,
287,
357,
25,
16302,
11,
1058,
805,
8409,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
30001,
8,
6624,
362,
8614,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
1169,
1377,
3,
7,
30001,
58,
17,
12962,
3038,
857,
407,
1011,
281,
4578,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4235,
796,
11241,
58,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
3038,
329,
4600,
13376,
63,
25,
1377,
3,
7,
30001,
58,
17,
12962,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
13376,
63,
857,
407,
1011,
7159,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
350,
10025,
18,
13,
23114,
13,
13376,
7,
24330,
11,
4235,
8,
198,
437,
198,
198,
2,
16926,
46,
837,
1332,
45115,
20086,
355,
319,
3038,
13,
198,
8818,
466,
62,
9288,
0,
7,
24330,
3712,
4834,
85,
30562,
11,
16326,
3712,
38469,
90,
51,
29291,
90,
13940,
23650,
11,
19852,
853,
90,
7149,
11709,
30072,
198,
220,
220,
220,
279,
10025,
82,
796,
15717,
22882,
21737,
198,
220,
220,
220,
5197,
796,
3991,
198,
220,
220,
220,
981,
5145,
271,
28920,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
11241,
796,
6482,
0,
7,
83,
482,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
16,
60,
6624,
1058,
35339,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
7,
30001,
8,
6624,
362,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
796,
15717,
22882,
7,
30001,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
13,
14171,
796,
1058,
805,
8409,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
35339,
82,
11,
279,
10025,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
63,
9288,
63,
691,
2753,
257,
900,
286,
10392,
284,
1332,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
11241,
58,
16,
60,
6624,
1058,
8738,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
11241,
58,
17,
60,
6624,
1058,
1073,
1857,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5197,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
3038,
329,
4600,
9288,
63,
25,
1377,
3,
7,
30001,
58,
17,
12962,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
25,
11625,
4049,
3275,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12067,
1082,
1472,
7203,
259,
12102,
8748,
329,
4600,
9288,
63,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
318,
28920,
7,
35339,
82,
8,
11405,
12067,
1082,
1472,
7203,
63,
9288,
63,
2753,
257,
900,
286,
10392,
4943,
198,
220,
220,
220,
350,
10025,
18,
13,
17614,
13,
9288,
7,
24330,
11,
279,
10025,
82,
26,
5197,
796,
5197,
8,
198,
437,
198,
198,
8818,
2251,
62,
14171,
7,
35666,
11,
1388,
8,
198,
220,
220,
220,
279,
10025,
62,
14171,
796,
6910,
18378,
13,
24129,
457,
7203,
35339,
29,
366,
26,
198,
220,
220,
220,
220,
220,
220,
220,
6152,
62,
40290,
796,
7308,
13,
5239,
62,
4033,
669,
58,
25,
17585,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
6152,
62,
37333,
844,
796,
366,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
23408,
796,
2081,
8,
628,
220,
220,
220,
611,
44156,
2849,
18189,
410,
1,
15,
13,
22,
13,
15,
12,
39345,
13,
1558,
2857,
1,
198,
220,
220,
220,
220,
220,
220,
220,
279,
10025,
62,
14171,
13,
35666,
796,
2186,
198,
220,
220,
220,
886,
628,
220,
220,
220,
27673,
796,
1388,
13,
10034,
198,
220,
220,
220,
27673,
13,
14171,
62,
76,
5912,
58,
25,
35339,
60,
796,
279,
10025,
62,
14171,
198,
220,
220,
220,
279,
10025,
62,
14171,
13,
10034,
796,
27673,
628,
220,
220,
220,
2989,
62,
16963,
457,
11,
264,
2539,
8899,
796,
6910,
18378,
13,
40406,
62,
12947,
62,
2539,
8899,
7,
24831,
8,
198,
220,
220,
220,
21231,
62,
16963,
457,
11,
21231,
62,
2539,
8899,
796,
6910,
18378,
13,
40406,
62,
40290,
62,
2539,
8899,
7,
24831,
11,
279,
10025,
62,
14171,
8,
628,
220,
220,
220,
279,
10025,
62,
14171,
13,
261,
62,
28060,
796,
357,
82,
11,
42684,
11,
12876,
8,
4613,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
12876,
8614,
1441,
45285,
13,
7645,
653,
7,
82,
11,
1058,
397,
419,
8,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
796,
10903,
7,
20657,
0,
7,
29325,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
45285,
13,
42503,
7,
35666,
8,
198,
220,
220,
220,
220,
220,
220,
220,
466,
62,
28758,
7,
35666,
11,
5128,
8,
198,
220,
220,
220,
220,
220,
220,
220,
45285,
13,
46012,
533,
62,
19545,
7,
35666,
8,
198,
220,
220,
220,
220,
220,
220,
220,
45285,
13,
42503,
62,
5219,
7,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
14421,
62,
14171,
13,
13915,
88,
8614,
45285,
13,
7645,
653,
7,
82,
11,
1388,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
33480,
796,
45285,
13,
14171,
62,
2539,
8899,
7,
12417,
8,
198,
220,
220,
220,
1303,
10563,
34,
815,
407,
8420,
6152,
198,
220,
220,
220,
12233,
0,
7,
28015,
11,
366,
61,
34,
4943,
628,
220,
220,
220,
275,
796,
360,
713,
90,
7149,
11,
7149,
92,
58,
198,
220,
220,
220,
220,
220,
220,
220,
264,
2539,
8899,
11,
33480,
11,
21231,
62,
2539,
8899,
11,
6910,
18378,
13,
23569,
62,
2539,
8899,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6910,
18378,
13,
12286,
62,
2539,
8899,
11,
6910,
18378,
13,
41915,
62,
12286,
82,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
279,
10025,
62,
14171,
13,
2539,
8899,
62,
11600,
796,
6910,
18378,
13,
2539,
8899,
7,
65,
8,
198,
220,
220,
220,
1441,
279,
10025,
62,
14171,
198,
437,
198,
198,
8818,
2186,
62,
15003,
7,
35666,
8,
198,
220,
220,
220,
1388,
62,
14171,
796,
2186,
13,
39994,
13,
76,
4147,
58,
16,
60,
198,
220,
220,
220,
279,
10025,
62,
14171,
796,
2251,
62,
14171,
7,
35666,
11,
1388,
62,
14171,
8,
198,
220,
220,
220,
4574,
0,
7,
35666,
13,
39994,
13,
76,
4147,
11,
279,
10025,
62,
14171,
8,
198,
220,
220,
220,
1994,
8899,
796,
360,
713,
90,
7149,
11,
7149,
92,
7,
198,
220,
220,
220,
220,
220,
220,
220,
705,
49946,
5218,
2163,
357,
82,
11,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
28920,
7,
82,
8,
8614,
2292,
7,
13949,
18378,
13,
22252,
7,
82,
4008,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
42684,
796,
4866,
7,
13949,
18378,
13,
22252,
7,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6910,
18378,
13,
7645,
653,
7,
82,
11,
279,
10025,
62,
14171,
8,
466,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6910,
18378,
13,
5219,
7,
82,
11,
279,
10025,
62,
14171,
737,
15414,
62,
22252,
796,
42684,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6910,
18378,
13,
19312,
62,
28463,
7,
82,
11,
705,
60,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
1388,
62,
14171,
13,
2539,
8899,
62,
11600,
796,
6910,
18378,
13,
2539,
8899,
62,
647,
469,
7,
12417,
62,
14171,
13,
2539,
8899,
62,
11600,
11,
1994,
8899,
8,
198,
220,
220,
220,
1441,
198,
437,
198,
198,
437,
198
] | 2.186438 | 7,713 |
using ThreeBodyDecay
using Parameters
using Test
@testset "Wigner angle permutations" begin
mp = 0.938; mK = 0.49367; mpi = 0.13957; mXic = 2.46867
tbs = ThreeBodySystem(mp,mK,mpi; m0=mXic)
σs = randomPoint(tbs.ms)
@unpack m1,m2,m3,m0 = tbs.ms
# (23) cosζ31_for1 = cosζ23_for1
@test cosζk1_for1(2,[σs.σ1,σs.σ2,σs.σ3],[m1^2,m2^2,m3^2,m0^2]) ==
cosζk1_for1(3,[σs.σ1,σs.σ3,σs.σ2],[m1^2,m3^2,m2^2,m0^2])
# (31) cosζ21_for2 = cosζ32_for2
@test cosζk2_for2(3,[σs.σ1,σs.σ2,σs.σ3],[m1^2,m2^2,m3^2,m0^2]) ==
cosζk2_for2(1,[σs.σ3,σs.σ2,σs.σ1],[m3^2,m2^2,m1^2,m0^2])
# (12) cosζ32_for3 = cosζ13_for3
@test cosζk3_for3(1,[σs.σ1,σs.σ2,σs.σ3],[m1^2,m2^2,m3^2,m0^2]) ==
cosζk3_for3(2,[σs.σ2,σs.σ1,σs.σ3],[m2^2,m1^2,m3^2,m0^2])
# (123) cosζ31_for1 = cosζ21_for2
@test cosζk2_for2(1,[σs.σ1,σs.σ2,σs.σ3],[m1^2,m2^2,m3^2,m0^2]) ==
cosζk1_for1(3,[σs.σ2,σs.σ3,σs.σ1],[m2^2,m3^2,m1^2,m0^2])
# (123)^2 cosζ31_for1 = cosζ23_for3
@test cosζk3_for3(2,[σs.σ1,σs.σ2,σs.σ3],[m1^2,m2^2,m3^2,m0^2]) ==
cosζk1_for1(3,[σs.σ3,σs[1],σs[2]],[m3^2,m1^2,m2^2,m0^2])
#
end
| [
3500,
7683,
25842,
10707,
323,
198,
3500,
40117,
198,
3500,
6208,
198,
198,
31,
9288,
2617,
366,
54,
570,
263,
9848,
9943,
32855,
1,
2221,
628,
220,
220,
220,
29034,
796,
657,
13,
24,
2548,
26,
285,
42,
796,
657,
13,
2920,
27824,
26,
285,
14415,
220,
796,
657,
13,
20219,
3553,
26,
285,
55,
291,
796,
362,
13,
38472,
3134,
198,
220,
220,
220,
256,
1443,
796,
7683,
25842,
11964,
7,
3149,
11,
76,
42,
11,
3149,
72,
26,
285,
15,
28,
76,
55,
291,
8,
198,
220,
220,
220,
18074,
225,
82,
796,
4738,
12727,
7,
83,
1443,
13,
907,
8,
628,
220,
220,
220,
2488,
403,
8002,
285,
16,
11,
76,
17,
11,
76,
18,
11,
76,
15,
796,
256,
1443,
13,
907,
198,
220,
220,
220,
1303,
357,
1954,
8,
8615,
138,
114,
3132,
62,
1640,
16,
796,
8615,
138,
114,
1954,
62,
1640,
16,
198,
220,
220,
220,
2488,
9288,
8615,
138,
114,
74,
16,
62,
1640,
16,
7,
17,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
38430,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8615,
138,
114,
74,
16,
62,
1640,
16,
7,
18,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
18,
11,
38392,
82,
13,
38392,
17,
38430,
76,
16,
61,
17,
11,
76,
18,
61,
17,
11,
76,
17,
61,
17,
11,
76,
15,
61,
17,
12962,
198,
220,
220,
220,
1303,
357,
3132,
8,
8615,
138,
114,
2481,
62,
1640,
17,
796,
8615,
138,
114,
2624,
62,
1640,
17,
198,
220,
220,
220,
2488,
9288,
8615,
138,
114,
74,
17,
62,
1640,
17,
7,
18,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
38430,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8615,
138,
114,
74,
17,
62,
1640,
17,
7,
16,
17414,
38392,
82,
13,
38392,
18,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
16,
38430,
76,
18,
61,
17,
11,
76,
17,
61,
17,
11,
76,
16,
61,
17,
11,
76,
15,
61,
17,
12962,
198,
220,
220,
220,
1303,
357,
1065,
8,
8615,
138,
114,
2624,
62,
1640,
18,
796,
8615,
138,
114,
1485,
62,
1640,
18,
198,
220,
220,
220,
2488,
9288,
8615,
138,
114,
74,
18,
62,
1640,
18,
7,
16,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
38430,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8615,
138,
114,
74,
18,
62,
1640,
18,
7,
17,
17414,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
18,
38430,
76,
17,
61,
17,
11,
76,
16,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
628,
220,
220,
220,
1303,
357,
10163,
8,
8615,
138,
114,
3132,
62,
1640,
16,
796,
8615,
138,
114,
2481,
62,
1640,
17,
198,
220,
220,
220,
2488,
9288,
8615,
138,
114,
74,
17,
62,
1640,
17,
7,
16,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
38430,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8615,
138,
114,
74,
16,
62,
1640,
16,
7,
18,
17414,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
11,
38392,
82,
13,
38392,
16,
38430,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
16,
61,
17,
11,
76,
15,
61,
17,
12962,
198,
220,
220,
220,
1303,
357,
10163,
8,
61,
17,
8615,
138,
114,
3132,
62,
1640,
16,
796,
8615,
138,
114,
1954,
62,
1640,
18,
198,
220,
220,
220,
2488,
9288,
8615,
138,
114,
74,
18,
62,
1640,
18,
7,
17,
17414,
38392,
82,
13,
38392,
16,
11,
38392,
82,
13,
38392,
17,
11,
38392,
82,
13,
38392,
18,
38430,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
18,
61,
17,
11,
76,
15,
61,
17,
12962,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8615,
138,
114,
74,
16,
62,
1640,
16,
7,
18,
17414,
38392,
82,
13,
38392,
18,
11,
38392,
82,
58,
16,
4357,
38392,
82,
58,
17,
60,
38430,
76,
18,
61,
17,
11,
76,
16,
61,
17,
11,
76,
17,
61,
17,
11,
76,
15,
61,
17,
12962,
198,
220,
220,
220,
1303,
198,
437,
198
] | 1.392727 | 825 |
#TODO: Fill
"""
```WIP``
this 'File Container' has the main instrutions
"""
# include("src/includes.jl") reads the below correctly
include("includes.jl")
function main()
drAccount(dr::Enum,cr::Enum,drAccount ,crAccount,amount)
if (dr == 1 && cr == 1) #dr drAccount (+), cr crAccount (+) #inflow type
# break
end
#=
else if (dr == 2 && cr == 2) # dr crAccount , cr drAccount
(dr,crAccount,amount), (cr,drAccount,amount)
#
break
end
#elseif ()
=#
end
main() | [
2,
51,
3727,
46,
25,
27845,
198,
198,
37811,
198,
15506,
63,
54,
4061,
15506,
198,
198,
5661,
705,
8979,
43101,
6,
468,
262,
1388,
6480,
3508,
198,
198,
37811,
198,
2,
2291,
7203,
10677,
14,
42813,
13,
20362,
4943,
9743,
262,
2174,
9380,
198,
17256,
7203,
42813,
13,
20362,
4943,
198,
8818,
1388,
3419,
628,
220,
220,
220,
220,
220,
220,
220,
1553,
30116,
7,
7109,
3712,
4834,
388,
11,
6098,
3712,
4834,
388,
11,
7109,
30116,
837,
6098,
30116,
11,
17287,
8,
198,
220,
220,
220,
220,
220,
220,
611,
357,
7109,
6624,
352,
11405,
1067,
6624,
352,
8,
220,
1303,
7109,
1553,
30116,
11502,
828,
1067,
1067,
30116,
11502,
8,
1303,
259,
11125,
2099,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
2270,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
2,
28,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
611,
357,
7109,
6624,
362,
11405,
1067,
6624,
362,
8,
1303,
1553,
1067,
30116,
837,
1067,
1553,
30116,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
7109,
11,
6098,
30116,
11,
17287,
828,
357,
6098,
11,
7109,
30116,
11,
17287,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
17772,
361,
7499,
198,
220,
220,
220,
220,
220,
220,
220,
796,
2,
198,
198,
437,
198,
12417,
3419
] | 2.101449 | 276 |
using Luxor
using OffsetArrays
function make_drawing(width, height, img_path, bkg_color, origin_p)
d = Drawing(width, height, img_path)
background(bkg_color)
origin(origin_p)
return d
end
width = 500
height = 500
path = "voronoi.png"
color = "black"
my_draw = make_drawing(width, height, path, color, O)
slope(x₁, y₁, x₂, y₂) = (y₂ - y₁) / (x₂ - x₁)
slope(P1, P2) = (P2.y - P1.y) / (P2.x - P1.x)
midpoint(x₁, y₁, x₂, y₂) = ((x₁ + x₂) / 2, (y₁ + y₂) / 2)
midpoint(P1, P2) = ((P1.x + P2.x) / 2, (P2.y + P2.y) / 2)
point_slope(x, x₁, y₁, m) = (x, m * (x - x₁) + y₁)
mat = zeros(width, height)
p1 = (x = 125, y = 125)
p2 = (x = 375, y = 375)
sp = slope(p1, p2)
mp = midpoint(p1, p2)
d(x1, y1, x2, y2, x, y) = (x - x1) * (y2 - y1) - (y - y1) * (x2 - x1)
h1_plane = []
h2_plane = []
h3_plane = []
for x in 1:500, y in 1:500
if d(500, 0, mp[1], mp[2], x, y) < 0
push!(h1_plane, Point(x, y))
elseif d(500, 0, mp[1], mp[2], x, y) > 0
push!(h2_plane, Point(x, y))
else
push!(h3_plane, Point(x, y))
end
end
# for p in vals
# mat[Int(p.x), Int(p.y)] = 1
# end
# function half_plane(p1, p2, width, height)
# mp = midpoint(p1.x, p1.y, p2.x, p2.y) |> Point
# sp = slope(p1.x, p1.y, p2.x, p2.y)
# first_point = point_slope(-250, mp.x, mp.y, sp == 0 ? 0 : -1 / sp) |> Point
# second_point = point_slope(250, mp.x, mp.y, sp == 0 ? 0 : -1 / sp) |> Point
# half_1 = [first_point, second_point, Point(width / 2, height / 2)]
# half_2 = [first_point, second_point, Point(-width / 2, height / 2)]
# return half_1, half_2
# end
setcolor(1, 0, 0, 1)
for c in h1_plane
circle(c, 1; action = :stroke)
end
setcolor(0, 0, 1, 1)
for c in h2_plane
circle(c, 1; action = :stroke)
end
setcolor(1, 1, 0, 1)
for c in h3_plane
circle(c, 1; action = :stroke)
end
setcolor(1, 0, 0, 1)
circle(p1.x, p1.y, 15, action = :fill)
setcolor(0, 0, 1, 1)
circle(p2.x, p2.y, 15, action = :fill)
finish()
| [
3500,
17145,
273,
198,
3500,
3242,
2617,
3163,
20477,
198,
198,
8818,
787,
62,
19334,
278,
7,
10394,
11,
6001,
11,
33705,
62,
6978,
11,
275,
10025,
62,
8043,
11,
8159,
62,
79,
8,
198,
220,
220,
220,
288,
796,
40027,
7,
10394,
11,
6001,
11,
33705,
62,
6978,
8,
198,
220,
220,
220,
4469,
7,
65,
10025,
62,
8043,
8,
198,
220,
220,
220,
8159,
7,
47103,
62,
79,
8,
198,
220,
220,
220,
1441,
288,
198,
437,
198,
198,
10394,
796,
5323,
198,
17015,
796,
5323,
198,
6978,
796,
366,
20867,
261,
23013,
13,
11134,
1,
198,
8043,
796,
366,
13424,
1,
198,
198,
1820,
62,
19334,
796,
787,
62,
19334,
278,
7,
10394,
11,
6001,
11,
3108,
11,
3124,
11,
440,
8,
198,
198,
6649,
3008,
7,
87,
158,
224,
223,
11,
331,
158,
224,
223,
11,
2124,
158,
224,
224,
11,
331,
158,
224,
224,
8,
796,
357,
88,
158,
224,
224,
532,
331,
158,
224,
223,
8,
1220,
357,
87,
158,
224,
224,
532,
2124,
158,
224,
223,
8,
198,
6649,
3008,
7,
47,
16,
11,
350,
17,
8,
796,
357,
47,
17,
13,
88,
532,
350,
16,
13,
88,
8,
1220,
357,
47,
17,
13,
87,
532,
350,
16,
13,
87,
8,
198,
13602,
4122,
7,
87,
158,
224,
223,
11,
331,
158,
224,
223,
11,
2124,
158,
224,
224,
11,
331,
158,
224,
224,
8,
796,
14808,
87,
158,
224,
223,
1343,
2124,
158,
224,
224,
8,
1220,
362,
11,
357,
88,
158,
224,
223,
1343,
331,
158,
224,
224,
8,
1220,
362,
8,
198,
13602,
4122,
7,
47,
16,
11,
350,
17,
8,
796,
14808,
47,
16,
13,
87,
1343,
350,
17,
13,
87,
8,
1220,
362,
11,
357,
47,
17,
13,
88,
1343,
350,
17,
13,
88,
8,
1220,
362,
8,
198,
4122,
62,
6649,
3008,
7,
87,
11,
2124,
158,
224,
223,
11,
331,
158,
224,
223,
11,
285,
8,
796,
357,
87,
11,
285,
1635,
357,
87,
532,
2124,
158,
224,
223,
8,
1343,
331,
158,
224,
223,
8,
198,
198,
6759,
796,
1976,
27498,
7,
10394,
11,
6001,
8,
198,
198,
79,
16,
796,
357,
87,
796,
13151,
11,
331,
796,
13151,
8,
198,
79,
17,
796,
357,
87,
796,
29414,
11,
331,
796,
29414,
8,
198,
198,
2777,
796,
22638,
7,
79,
16,
11,
279,
17,
8,
198,
3149,
796,
3095,
4122,
7,
79,
16,
11,
279,
17,
8,
198,
198,
67,
7,
87,
16,
11,
331,
16,
11,
2124,
17,
11,
331,
17,
11,
2124,
11,
331,
8,
796,
357,
87,
532,
2124,
16,
8,
1635,
357,
88,
17,
532,
331,
16,
8,
532,
357,
88,
532,
331,
16,
8,
1635,
357,
87,
17,
532,
2124,
16,
8,
198,
198,
71,
16,
62,
14382,
796,
17635,
198,
71,
17,
62,
14382,
796,
17635,
198,
71,
18,
62,
14382,
796,
17635,
198,
198,
1640,
2124,
287,
352,
25,
4059,
11,
331,
287,
352,
25,
4059,
198,
197,
361,
288,
7,
4059,
11,
657,
11,
29034,
58,
16,
4357,
29034,
58,
17,
4357,
2124,
11,
331,
8,
1279,
657,
220,
198,
197,
197,
14689,
0,
7,
71,
16,
62,
14382,
11,
6252,
7,
87,
11,
331,
4008,
198,
197,
17772,
361,
288,
7,
4059,
11,
657,
11,
29034,
58,
16,
4357,
29034,
58,
17,
4357,
2124,
11,
331,
8,
1875,
657,
220,
198,
197,
197,
14689,
0,
7,
71,
17,
62,
14382,
11,
6252,
7,
87,
11,
331,
4008,
198,
197,
17772,
198,
197,
197,
14689,
0,
7,
71,
18,
62,
14382,
11,
6252,
7,
87,
11,
331,
4008,
198,
197,
437,
198,
437,
628,
198,
2,
329,
279,
287,
410,
874,
198,
197,
2,
2603,
58,
5317,
7,
79,
13,
87,
828,
2558,
7,
79,
13,
88,
15437,
796,
352,
198,
2,
886,
198,
198,
2,
2163,
2063,
62,
14382,
7,
79,
16,
11,
279,
17,
11,
9647,
11,
6001,
8,
628,
220,
220,
220,
1303,
29034,
796,
3095,
4122,
7,
79,
16,
13,
87,
11,
279,
16,
13,
88,
11,
279,
17,
13,
87,
11,
279,
17,
13,
88,
8,
930,
29,
6252,
198,
220,
220,
220,
1303,
599,
796,
22638,
7,
79,
16,
13,
87,
11,
279,
16,
13,
88,
11,
279,
17,
13,
87,
11,
279,
17,
13,
88,
8,
198,
220,
220,
220,
1303,
717,
62,
4122,
796,
966,
62,
6649,
3008,
32590,
9031,
11,
29034,
13,
87,
11,
29034,
13,
88,
11,
599,
6624,
657,
5633,
657,
1058,
532,
16,
1220,
599,
8,
930,
29,
6252,
198,
220,
220,
220,
1303,
1218,
62,
4122,
796,
966,
62,
6649,
3008,
7,
9031,
11,
29034,
13,
87,
11,
29034,
13,
88,
11,
599,
6624,
657,
5633,
657,
1058,
532,
16,
1220,
599,
8,
930,
29,
6252,
628,
220,
220,
220,
1303,
2063,
62,
16,
796,
685,
11085,
62,
4122,
11,
1218,
62,
4122,
11,
6252,
7,
10394,
1220,
362,
11,
6001,
1220,
362,
15437,
198,
220,
220,
220,
1303,
2063,
62,
17,
796,
685,
11085,
62,
4122,
11,
1218,
62,
4122,
11,
6252,
32590,
10394,
1220,
362,
11,
6001,
1220,
362,
15437,
628,
220,
220,
220,
1303,
1441,
2063,
62,
16,
11,
2063,
62,
17,
198,
2,
886,
198,
198,
2617,
8043,
7,
16,
11,
657,
11,
657,
11,
352,
8,
198,
1640,
269,
287,
289,
16,
62,
14382,
198,
197,
45597,
7,
66,
11,
352,
26,
2223,
796,
1058,
30757,
8,
198,
437,
198,
198,
2617,
8043,
7,
15,
11,
657,
11,
352,
11,
352,
8,
198,
1640,
269,
287,
289,
17,
62,
14382,
198,
197,
45597,
7,
66,
11,
352,
26,
2223,
796,
1058,
30757,
8,
198,
437,
198,
198,
2617,
8043,
7,
16,
11,
352,
11,
657,
11,
352,
8,
198,
1640,
269,
287,
289,
18,
62,
14382,
198,
197,
45597,
7,
66,
11,
352,
26,
2223,
796,
1058,
30757,
8,
198,
437,
198,
198,
2617,
8043,
7,
16,
11,
657,
11,
657,
11,
352,
8,
198,
45597,
7,
79,
16,
13,
87,
11,
279,
16,
13,
88,
11,
1315,
11,
2223,
796,
1058,
20797,
8,
198,
198,
2617,
8043,
7,
15,
11,
657,
11,
352,
11,
352,
8,
198,
45597,
7,
79,
17,
13,
87,
11,
279,
17,
13,
88,
11,
1315,
11,
2223,
796,
1058,
20797,
8,
198,
198,
15643,
680,
3419,
198
] | 1.873308 | 1,034 |
using Test
using ThreadGantt
@testset "stuff" begin
@test 1 == 1
end
| [
3500,
6208,
198,
3500,
14122,
38,
415,
83,
198,
198,
31,
9288,
2617,
366,
41094,
1,
2221,
198,
220,
220,
220,
2488,
9288,
352,
6624,
352,
198,
437,
198
] | 2.551724 | 29 |
function __new__(T, args...)
# @show T
# @show args
# note: we also add __new__() to the list of primitives so it's not overdubbed recursively
if T <: NamedTuple
return T(args)
else
return T(args...)
end
end
__tuple__(args...) = tuple(args...)
__getfield__(args...) = getfield(args...)
function module_functions(modl)
res = Vector{Function}()
for s in Base.names(modl; all=true)
isdefined(modl, s) || continue
fn = getfield(modl, s)
if fn isa Function # && match(r"^[a-z#]+$", string(s)) != nothing
push!(res, fn)
end
end
return res
end
const PRIMITIVES = Set{Any}(vcat(
module_functions(Base),
module_functions(Core),
module_functions(Core.Intrinsics),
[Broadcast.materialize, Broadcast.broadcasted, Colon(), (:),
Base.not_int,
# our own special functions
__new__, __tuple__, __getfield__, namedtuple, guess_device]));
include("cassette.jl")
# include("interp.jl")
include("irtools.jl")
trace = irtrace
| [
8818,
11593,
3605,
834,
7,
51,
11,
26498,
23029,
198,
220,
220,
220,
1303,
2488,
12860,
309,
198,
220,
220,
220,
1303,
2488,
12860,
26498,
198,
220,
220,
220,
1303,
3465,
25,
356,
635,
751,
11593,
3605,
834,
3419,
284,
262,
1351,
286,
2684,
20288,
523,
340,
338,
407,
14904,
549,
3077,
664,
1834,
2280,
198,
220,
220,
220,
611,
309,
1279,
25,
34441,
51,
29291,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
309,
7,
22046,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
309,
7,
22046,
23029,
198,
220,
220,
220,
886,
198,
437,
628,
198,
834,
83,
29291,
834,
7,
22046,
23029,
796,
46545,
7,
22046,
23029,
198,
834,
1136,
3245,
834,
7,
22046,
23029,
796,
651,
3245,
7,
22046,
23029,
628,
198,
8818,
8265,
62,
12543,
2733,
7,
4666,
75,
8,
198,
220,
220,
220,
581,
796,
20650,
90,
22203,
92,
3419,
198,
220,
220,
220,
329,
264,
287,
7308,
13,
14933,
7,
4666,
75,
26,
477,
28,
7942,
8,
198,
220,
220,
220,
220,
220,
220,
220,
318,
23211,
7,
4666,
75,
11,
264,
8,
8614,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
24714,
796,
651,
3245,
7,
4666,
75,
11,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
24714,
318,
64,
15553,
1303,
11405,
2872,
7,
81,
1,
61,
58,
64,
12,
89,
2,
48688,
3,
1600,
4731,
7,
82,
4008,
14512,
2147,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
411,
11,
24714,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
581,
198,
437,
198,
198,
9979,
4810,
3955,
2043,
42472,
796,
5345,
90,
7149,
92,
7,
85,
9246,
7,
198,
220,
220,
220,
8265,
62,
12543,
2733,
7,
14881,
828,
198,
220,
220,
220,
8265,
62,
12543,
2733,
7,
14055,
828,
198,
220,
220,
220,
8265,
62,
12543,
2733,
7,
14055,
13,
5317,
81,
1040,
873,
828,
198,
220,
220,
220,
685,
30507,
2701,
13,
33665,
1096,
11,
44244,
13,
36654,
2701,
276,
11,
14049,
22784,
357,
25,
828,
198,
220,
220,
220,
220,
7308,
13,
1662,
62,
600,
11,
198,
220,
220,
220,
220,
1303,
674,
898,
2041,
5499,
198,
220,
220,
220,
220,
11593,
3605,
834,
11,
11593,
83,
29291,
834,
11,
11593,
1136,
3245,
834,
11,
3706,
83,
29291,
11,
4724,
62,
25202,
12962,
1776,
628,
198,
17256,
7203,
66,
562,
5857,
13,
20362,
4943,
198,
2,
2291,
7203,
3849,
79,
13,
20362,
4943,
198,
17256,
7203,
2265,
10141,
13,
20362,
4943,
628,
198,
40546,
796,
4173,
40546,
198
] | 2.361991 | 442 |
using Crux
using POMDPModels
using Test
using CUDA
using Flux
using Random
## mdp_data
d1 = mdp_data(ContinuousSpace(3), ContinuousSpace(4), 100)
d2 = mdp_data(ContinuousSpace(3), ContinuousSpace(4), 100, [:weight, :t, :advantage, :return, :logprob])
# @test_throws ErrorException mdp_data(ContinuousSpace(3), ContinuousSpace(4), 100, [:bad_key]) # Now this just throws a warning
d3 = mdp_data(ContinuousSpace(3), ContinuousSpace(4), 100, ArrayType = USE_CUDA ? CuArray : Array)
@test d1[:s] == zeros(Float32, 3, 100) && d2[:s] == zeros(Float32, 3, 100) && size(d3[:s]) == (3, 100)
@test d1[:sp] == zeros(Float32, 3, 100) && d2[:sp] == zeros(Float32, 3, 100) && size(d3[:sp]) == (3, 100)
@test d1[:a] == zeros(Bool, 4, 100) && size(d2[:a]) == (4, 100) && size(d3[:a]) == (4, 100)
@test d1[:r] == zeros(Float32, 1, 100) && size(d2[:r]) == (1, 100) && size(d3[:r]) == (1, 100)
@test d1[:done] == zeros(Bool, 1, 100) && size(d2[:done]) == (1, 100) && size(d3[:done]) == (1, 100)
@test d2[:return] == zeros(1, 100) && d2[:advantage] == zeros(1, 100) && d2[:logprob] == zeros(1, 100) && d2[:t] == zeros(1, 100) && d2[:weight] == ones(1, 100)
@test !haskey(d1, :return) && !haskey(d1, :advantage) && !haskey(d1, :logprob) && !haskey(d1, :t) && !haskey(d1, :weight)
USE_CUDA && @test d3[:s] isa CuArray
## circular_indices
circ_inds(start, Nsteps, l) = mod1.(start:start + Nsteps - 1, l)
@test circ_inds(4, 60, 100) == [4:63 ...]
@test circ_inds(1, 100, 100) == [1:100 ...]
@test circ_inds(1, 101, 100) == [1:100 ..., 1]
@test circ_inds(1, 120, 100) == [1:100 ..., 1:20 ...]
@test circ_inds(90, 20, 100) == [90:100 ..., 1:9 ...]
## Get last N indices test
# A not full buffer
b = ExperienceBuffer(ContinuousSpace(2), ContinuousSpace(1), 100)
d = Dict(:s => 2*ones(2,50), :a => ones(Bool, 1,50), :sp => ones(2,50), :r => ones(1,50), :done => zeros(1,50), :weight=>zeros(1,50))
push!(b, d)
@test get_last_N_indices(b, 10) == collect(41:50)
@test get_last_N_indices(b, 1) == [50]
@test get_last_N_indices(b, 50) == collect(1:50)
@test get_last_N_indices(b, 51) == collect(1:50)
@test get_last_N_indices(b, 1000) == collect(1:50)
# full buffer
push!(b, d)
push!(b, d)
@test get_last_N_indices(b, 10) == collect(41:50)
@test get_last_N_indices(b, 1) == [50]
@test get_last_N_indices(b, 50) == collect(1:50)
@test get_last_N_indices(b, 51) == [100, collect(1:50)...]
@test get_last_N_indices(b, 100) == [collect(51:100)..., collect(1:50)...]
@test get_last_N_indices(b, 1000) == [collect(51:100)..., collect(1:50)...]
## Priority Param Construction
p = PriorityParams(100, α=0.7)
@test length(p.priorities) == 100
@test p.α == 0.7f0
@test p.max_priority == 1.0f0
p2 = PriorityParams(1000, p)
@test length(p2.priorities)==1000
@test p2.α == p.α
@test p2.max_priority == p.max_priority
## Construction
b = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 100,)
bpriority = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 50, prioritized=true)
USE_CUDA && (b_gpu = b |> gpu)
bcopy = ExperienceBuffer(deepcopy(b.data), elements=0)
@test b.data == bcopy.data
@test b.priority_params == bcopy.priority_params
bcopy = ExperienceBuffer(deepcopy(b.data), prioritized=true)
@test isprioritized(bcopy)
@test b isa ExperienceBuffer{Array}
if USE_CUDA
@test b_gpu isa ExperienceBuffer{CuArray}
@test length(keys(b.data)) == length(keys(b_gpu.data))
end
@test :s in keys(b.data)
@test :a in keys(b.data)
@test :sp in keys(b.data)
@test :r in keys(b.data)
@test :done in keys(b.data)
@test !haskey(b, :weight)
@test haskey(bpriority, :weight)
@test bpriority.data[:weight] == ones(Float32, 1, 50)
@test size(b[:a]) == (4,0)
# Buffer_like function
bsmall = buffer_like(b, capacity=3, device=cpu)
@test Crux.device(bsmall) == cpu
@test keys(bsmall) == keys(b)
@test capacity(bsmall) == 3
@test length(bsmall) == 0
## Base functions
@test keys(b) == keys(b.data)
@test size(b[:s]) == (2,0)
@test length(b) == 0
@test capacity(b) == 100
USE_CUDA && @test size(b_gpu[:s]) == (2,0)
USE_CUDA && @test length(b_gpu) == 0
USE_CUDA && @test capacity(b_gpu) == 100
@test isprioritized(bpriority)
@test Crux.device(b) == cpu
@test Crux.device(bpriority) == cpu
USE_CUDA && @test Crux.device(b_gpu) == gpu
# Convert to and from GPU
USE_CUDA && @test Crux.device(gpu(b)) == gpu
USE_CUDA && @test Crux.device(cpu(b_gpu)) == cpu
## push!
#push dictionary with one element
d = Dict(:s => 2*ones(2,1), :a => ones(Bool, 4,1), :sp => ones(2,1), :r => ones(1,1), :done => zeros(1,1), :weight=>zeros(1,1))
push!(b, d)
@test length(b) == 1
@test b[:s] == 2*ones(2,1)
@test b[:a] == ones(Int, 4,1)
@test b[:sp] == ones(2,1)
@test b[:r] == ones(1,1)
@test b[:done] == zeros(1,1)
# push dictionary with more than one element
d = Dict(:s => 3*ones(2,3), :a => rand(4,3) .< 0.5, :sp => 5*ones(2,3), :r => 6*ones(1,3), :done => ones(1,3), :weight=>zeros(1,3))
push!(b, d)
@test length(b) == 4
@test b[:s][:,2:end] == 3*ones(2,3)
@test b[:a][:,2:end] == d[:a]
@test b[:sp][:,2:end] == 5*ones(2,3)
@test b[:r][:,2:end] == 6*ones(1,3)
@test b[:done][:,2:end] == ones(1,3)
# push a buffer
push!(b, b)
@test length(b) == 8
for k in keys(b)
@test b[k][:, 1:4] == b[k][:, 5:8]
end
## Reservoir storage
b = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10,)
d3 = Dict(:s => 3*ones(2,3), :a => rand(4,3) .< 0.5, :sp => 5*ones(2,3), :r => 6*ones(1,3), :done => ones(1,3), :weight=>zeros(1,3), :episode_end=> ones(1,3))
d1 = Dict(:s => 2*ones(2,1), :a => ones(Bool, 4,1), :sp => ones(2,1), :r => ones(1,1), :done => zeros(1,1), :weight=>zeros(1,1), :episode_end => zeros(1,1))
for i=1:10
push_reservoir!(b, d1)
@test length(b) == i
end
push_reservoir!(b, d3)
## clear!
bcopy = deepcopy(b)
clear!(bcopy)
@test length(bcopy) == 0
@test bcopy.next_ind == 1
## minibatch
I = [1,2,4]
d2 = minibatch(b, I)
for k in keys(d2)
@test all(d2[k] .== b[k][:, I])
end
## Split
@test Crux.split_batches(100, [0.5, 0.5]) == [50,50]
@test Crux.split_batches(100, [1.0]) == [100]
@test Crux.split_batches(100, [1/3, 1/3, 1/3]) == [34,33,33]
@test_throws AssertionError Crux.split_batches(100, 0.4)
v = rand(3,100)
bsplit = ExperienceBuffer(Dict(:a => v))
b1, b2 = split(bsplit, [0.5, 0.5])
@test length(b1) == 50
@test b1[:a] == v[:,1:50]
@test length(b2) == 50
@test b2[:a] == v[:,51:100]
## update_priorities!
update_priorities!(bpriority, [1,2,3], [1., 2., 3.])
@test bpriority.priority_params.max_priority == 3.0
@test bpriority.priority_params.priorities[1] ≈ 1f0^bpriority.priority_params.α
@test bpriority.priority_params.priorities[2] ≈ 2f0^bpriority.priority_params.α
@test bpriority.priority_params.priorities[3] ≈ 3f0^bpriority.priority_params.α
push!(bpriority, d)
push!(bpriority, d)
@test bpriority.priority_params.max_priority == 3.0
for i=1:6
@test bpriority.priority_params.priorities[i] ≈ 3f0^bpriority.priority_params.α
end
## sampling
# uniform sample
t = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10)
rand!(t, b)
t = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 3)
Random.seed!(0)
ids = rand(1:length(b), 3)
Random.seed!(0)
rand!(t, b)
for k in keys(t)
@test t[k] == b[k][:,ids]
end
# Test the multi-buffer sampling
t1 = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10)
d = Dict(:s => ones(2,1), :a => ones(Bool, 4,1), :sp => ones(2,1), :r => ones(1,1), :done => zeros(1,1))
push!(t1, d)
t2 = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10)
d = Dict(:s => 2*ones(2,1), :a => ones(Bool, 4,1), :sp => ones(2,1), :r => ones(1,1), :done => zeros(1,1))
push!(t2, d)
t3 = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10)
d = Dict(:s => 3*ones(2,1), :a => ones(4,1), :sp => ones(2,1), :r => ones(1,1), :done => zeros(1,1))
push!(t3, d)
t = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 10)
rand!(t, t1, t2, t3)
@test all(t[:s][:, 1:4] .== 1.0)
@test all(t[:s][:, 5:7] .== 2.0)
@test all(t[:s][:, 8:10] .== 3.0)
# Priority samples
bpriority[:s] .= rand(Float32, 2, 6)
update_priorities!(bpriority, [1:6...], [1.:6. ...])
t = ExperienceBuffer(ContinuousSpace(2), DiscreteSpace(4), 1000, [:weight])
priorities = [bpriority.priority_params.priorities[i] for i=1:length(bpriority)]
rand!(t, bpriority)
# Test the the frequency of samples is proportional to their priority
freqs = [sum(t.indices .== i) for i=1:6] ./ length(t)
probs = priorities ./ sum(priorities)
relerr = abs.(freqs .- probs) ./ probs
@test all(relerr .< 0.01)
@test all(t[:s] .== bpriority[:s][:,t.indices])
@test all(t[:weight] .<= 1.)
## merge
# bmerge = merge(b, b, capacity = 300)
# @test length(bmerge) == 200
# @test capacity(bmerge) == 300
# @test bmerge[:s][:, 1:100] == bmerge[:s][:, 101:200]
## Multi-D states
b2d = ExperienceBuffer(ContinuousSpace((2,2), UInt8), DiscreteSpace(4), 100;)
@test ndims(b2d[:s]) == 3
b2d[:s]
d = Dict(:s => 3*ones(2,2,1), :a => ones(4,1), :sp => ones(2,2,1), :r => ones(1,1), :done => zeros(1,1))
push!(b2d, d)
@test all(b2d[:s] .== 3)
| [
3500,
6472,
87,
198,
3500,
350,
2662,
6322,
5841,
1424,
198,
3500,
6208,
198,
3500,
29369,
5631,
198,
3500,
1610,
2821,
198,
3500,
14534,
198,
198,
2235,
285,
26059,
62,
7890,
198,
67,
16,
796,
285,
26059,
62,
7890,
7,
17875,
5623,
14106,
7,
18,
828,
45012,
14106,
7,
19,
828,
1802,
8,
198,
67,
17,
796,
285,
26059,
62,
7890,
7,
17875,
5623,
14106,
7,
18,
828,
45012,
14106,
7,
19,
828,
1802,
11,
685,
25,
6551,
11,
1058,
83,
11,
1058,
13461,
496,
11,
1058,
7783,
11,
1058,
6404,
1676,
65,
12962,
198,
2,
2488,
9288,
62,
400,
8516,
13047,
16922,
220,
285,
26059,
62,
7890,
7,
17875,
5623,
14106,
7,
18,
828,
45012,
14106,
7,
19,
828,
1802,
11,
685,
25,
14774,
62,
2539,
12962,
1303,
2735,
428,
655,
12542,
257,
6509,
198,
67,
18,
796,
285,
26059,
62,
7890,
7,
17875,
5623,
14106,
7,
18,
828,
45012,
14106,
7,
19,
828,
1802,
11,
15690,
6030,
796,
23210,
62,
43633,
5631,
5633,
14496,
19182,
1058,
15690,
8,
198,
198,
31,
9288,
288,
16,
58,
25,
82,
60,
6624,
1976,
27498,
7,
43879,
2624,
11,
513,
11,
1802,
8,
11405,
288,
17,
58,
25,
82,
60,
6624,
1976,
27498,
7,
43879,
2624,
11,
513,
11,
1802,
8,
11405,
2546,
7,
67,
18,
58,
25,
82,
12962,
6624,
357,
18,
11,
1802,
8,
198,
31,
9288,
288,
16,
58,
25,
2777,
60,
6624,
1976,
27498,
7,
43879,
2624,
11,
513,
11,
1802,
8,
11405,
288,
17,
58,
25,
2777,
60,
6624,
1976,
27498,
7,
43879,
2624,
11,
513,
11,
1802,
8,
11405,
2546,
7,
67,
18,
58,
25,
2777,
12962,
6624,
357,
18,
11,
1802,
8,
198,
31,
9288,
288,
16,
58,
25,
64,
60,
6624,
1976,
27498,
7,
33,
970,
11,
604,
11,
1802,
8,
11405,
2546,
7,
67,
17,
58,
25,
64,
12962,
6624,
357,
19,
11,
1802,
8,
11405,
2546,
7,
67,
18,
58,
25,
64,
12962,
6624,
357,
19,
11,
1802,
8,
198,
31,
9288,
288,
16,
58,
25,
81,
60,
6624,
1976,
27498,
7,
43879,
2624,
11,
352,
11,
1802,
8,
11405,
2546,
7,
67,
17,
58,
25,
81,
12962,
6624,
357,
16,
11,
1802,
8,
11405,
2546,
7,
67,
18,
58,
25,
81,
12962,
6624,
357,
16,
11,
1802,
8,
198,
31,
9288,
288,
16,
58,
25,
28060,
60,
6624,
1976,
27498,
7,
33,
970,
11,
352,
11,
1802,
8,
11405,
2546,
7,
67,
17,
58,
25,
28060,
12962,
6624,
357,
16,
11,
1802,
8,
11405,
2546,
7,
67,
18,
58,
25,
28060,
12962,
6624,
357,
16,
11,
1802,
8,
198,
31,
9288,
288,
17,
58,
25,
7783,
60,
6624,
1976,
27498,
7,
16,
11,
1802,
8,
11405,
288,
17,
58,
25,
13461,
496,
60,
6624,
1976,
27498,
7,
16,
11,
1802,
8,
11405,
288,
17,
58,
25,
6404,
1676,
65,
60,
6624,
1976,
27498,
7,
16,
11,
1802,
8,
11405,
288,
17,
58,
25,
83,
60,
6624,
1976,
27498,
7,
16,
11,
1802,
8,
11405,
288,
17,
58,
25,
6551,
60,
6624,
3392,
7,
16,
11,
1802,
8,
198,
31,
9288,
5145,
10134,
2539,
7,
67,
16,
11,
1058,
7783,
8,
11405,
5145,
10134,
2539,
7,
67,
16,
11,
1058,
13461,
496,
8,
11405,
5145,
10134,
2539,
7,
67,
16,
11,
1058,
6404,
1676,
65,
8,
11405,
5145,
10134,
2539,
7,
67,
16,
11,
1058,
83,
8,
11405,
5145,
10134,
2539,
7,
67,
16,
11,
1058,
6551,
8,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
288,
18,
58,
25,
82,
60,
318,
64,
14496,
19182,
198,
198,
2235,
18620,
62,
521,
1063,
198,
21170,
62,
521,
82,
7,
9688,
11,
399,
20214,
11,
300,
8,
796,
953,
16,
12195,
9688,
25,
9688,
1343,
399,
20214,
532,
352,
11,
300,
8,
198,
31,
9288,
2498,
62,
521,
82,
7,
19,
11,
3126,
11,
1802,
8,
6624,
685,
19,
25,
5066,
2644,
60,
198,
31,
9288,
2498,
62,
521,
82,
7,
16,
11,
1802,
11,
1802,
8,
6624,
685,
16,
25,
3064,
2644,
60,
198,
31,
9288,
2498,
62,
521,
82,
7,
16,
11,
8949,
11,
1802,
8,
6624,
685,
16,
25,
3064,
2644,
11,
352,
60,
198,
31,
9288,
2498,
62,
521,
82,
7,
16,
11,
7982,
11,
1802,
8,
6624,
685,
16,
25,
3064,
2644,
11,
352,
25,
1238,
2644,
60,
198,
31,
9288,
2498,
62,
521,
82,
7,
3829,
11,
1160,
11,
1802,
8,
6624,
685,
3829,
25,
3064,
2644,
11,
352,
25,
24,
2644,
60,
198,
198,
2235,
3497,
938,
399,
36525,
1332,
198,
2,
317,
407,
1336,
11876,
198,
65,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
45012,
14106,
7,
16,
828,
1802,
8,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
362,
9,
1952,
7,
17,
11,
1120,
828,
1058,
64,
5218,
3392,
7,
33,
970,
11,
352,
11,
1120,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
1120,
828,
1058,
81,
5218,
3392,
7,
16,
11,
1120,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
1120,
828,
1058,
6551,
14804,
9107,
418,
7,
16,
11,
1120,
4008,
198,
14689,
0,
7,
65,
11,
288,
8,
628,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
838,
8,
6624,
2824,
7,
3901,
25,
1120,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
352,
8,
6624,
685,
1120,
60,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
2026,
8,
6624,
2824,
7,
16,
25,
1120,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
6885,
8,
6624,
2824,
7,
16,
25,
1120,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
8576,
8,
6624,
2824,
7,
16,
25,
1120,
8,
198,
198,
2,
1336,
11876,
198,
14689,
0,
7,
65,
11,
288,
8,
198,
14689,
0,
7,
65,
11,
288,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
838,
8,
6624,
2824,
7,
3901,
25,
1120,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
352,
8,
6624,
685,
1120,
60,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
2026,
8,
6624,
2824,
7,
16,
25,
1120,
8,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
6885,
8,
6624,
685,
3064,
11,
2824,
7,
16,
25,
1120,
8,
22345,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
1802,
8,
6624,
685,
33327,
7,
4349,
25,
3064,
26513,
11,
2824,
7,
16,
25,
1120,
8,
22345,
198,
31,
9288,
651,
62,
12957,
62,
45,
62,
521,
1063,
7,
65,
11,
8576,
8,
6624,
685,
33327,
7,
4349,
25,
3064,
26513,
11,
2824,
7,
16,
25,
1120,
8,
22345,
628,
198,
2235,
34416,
25139,
20395,
198,
79,
796,
34416,
10044,
4105,
7,
3064,
11,
26367,
28,
15,
13,
22,
8,
198,
31,
9288,
4129,
7,
79,
13,
3448,
273,
871,
8,
6624,
1802,
198,
31,
9288,
279,
13,
17394,
6624,
657,
13,
22,
69,
15,
198,
31,
9288,
279,
13,
9806,
62,
49336,
6624,
352,
13,
15,
69,
15,
198,
198,
79,
17,
796,
34416,
10044,
4105,
7,
12825,
11,
279,
8,
198,
31,
9288,
4129,
7,
79,
17,
13,
3448,
273,
871,
8,
855,
12825,
198,
31,
9288,
279,
17,
13,
17394,
6624,
279,
13,
17394,
198,
31,
9288,
279,
17,
13,
9806,
62,
49336,
6624,
279,
13,
9806,
62,
49336,
198,
198,
2235,
20395,
198,
65,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
1802,
35751,
198,
65,
49336,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
2026,
11,
19086,
1143,
28,
7942,
8,
198,
19108,
62,
43633,
5631,
11405,
357,
65,
62,
46999,
796,
275,
930,
29,
308,
19944,
8,
198,
198,
15630,
11081,
796,
16386,
28632,
7,
22089,
30073,
7,
65,
13,
7890,
828,
4847,
28,
15,
8,
198,
31,
9288,
275,
13,
7890,
6624,
275,
30073,
13,
7890,
198,
31,
9288,
275,
13,
49336,
62,
37266,
6624,
275,
30073,
13,
49336,
62,
37266,
198,
15630,
11081,
796,
16386,
28632,
7,
22089,
30073,
7,
65,
13,
7890,
828,
19086,
1143,
28,
7942,
8,
198,
31,
9288,
318,
3448,
273,
36951,
7,
15630,
11081,
8,
198,
198,
31,
9288,
275,
318,
64,
16386,
28632,
90,
19182,
92,
198,
361,
23210,
62,
43633,
5631,
220,
198,
220,
220,
220,
2488,
9288,
275,
62,
46999,
318,
64,
16386,
28632,
90,
46141,
19182,
92,
198,
220,
220,
220,
2488,
9288,
4129,
7,
13083,
7,
65,
13,
7890,
4008,
6624,
4129,
7,
13083,
7,
65,
62,
46999,
13,
7890,
4008,
198,
437,
198,
198,
31,
9288,
1058,
82,
287,
8251,
7,
65,
13,
7890,
8,
198,
31,
9288,
1058,
64,
287,
8251,
7,
65,
13,
7890,
8,
198,
31,
9288,
1058,
2777,
287,
8251,
7,
65,
13,
7890,
8,
198,
31,
9288,
1058,
81,
287,
8251,
7,
65,
13,
7890,
8,
198,
31,
9288,
1058,
28060,
287,
8251,
7,
65,
13,
7890,
8,
220,
198,
198,
31,
9288,
5145,
10134,
2539,
7,
65,
11,
1058,
6551,
8,
198,
31,
9288,
468,
2539,
7,
65,
49336,
11,
1058,
6551,
8,
198,
31,
9288,
275,
49336,
13,
7890,
58,
25,
6551,
60,
6624,
3392,
7,
43879,
2624,
11,
352,
11,
2026,
8,
198,
31,
9288,
2546,
7,
65,
58,
25,
64,
12962,
6624,
357,
19,
11,
15,
8,
198,
198,
2,
47017,
62,
2339,
2163,
198,
1443,
76,
439,
796,
11876,
62,
2339,
7,
65,
11,
5339,
28,
18,
11,
3335,
28,
36166,
8,
198,
31,
9288,
6472,
87,
13,
25202,
7,
1443,
76,
439,
8,
6624,
42804,
198,
31,
9288,
8251,
7,
1443,
76,
439,
8,
6624,
8251,
7,
65,
8,
198,
31,
9288,
5339,
7,
1443,
76,
439,
8,
6624,
513,
198,
31,
9288,
4129,
7,
1443,
76,
439,
8,
6624,
657,
628,
198,
2235,
7308,
5499,
220,
198,
31,
9288,
8251,
7,
65,
8,
6624,
8251,
7,
65,
13,
7890,
8,
198,
198,
31,
9288,
2546,
7,
65,
58,
25,
82,
12962,
6624,
357,
17,
11,
15,
8,
198,
31,
9288,
4129,
7,
65,
8,
6624,
657,
198,
31,
9288,
5339,
7,
65,
8,
6624,
1802,
198,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
2546,
7,
65,
62,
46999,
58,
25,
82,
12962,
6624,
357,
17,
11,
15,
8,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
4129,
7,
65,
62,
46999,
8,
6624,
657,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
5339,
7,
65,
62,
46999,
8,
6624,
1802,
198,
198,
31,
9288,
318,
3448,
273,
36951,
7,
65,
49336,
8,
198,
31,
9288,
6472,
87,
13,
25202,
7,
65,
8,
6624,
42804,
198,
31,
9288,
6472,
87,
13,
25202,
7,
65,
49336,
8,
6624,
42804,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
6472,
87,
13,
25202,
7,
65,
62,
46999,
8,
6624,
308,
19944,
198,
198,
2,
38240,
284,
290,
422,
11362,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
6472,
87,
13,
25202,
7,
46999,
7,
65,
4008,
6624,
308,
19944,
198,
19108,
62,
43633,
5631,
11405,
2488,
9288,
6472,
87,
13,
25202,
7,
36166,
7,
65,
62,
46999,
4008,
6624,
42804,
198,
198,
2235,
4574,
0,
198,
2,
14689,
22155,
351,
530,
5002,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
362,
9,
1952,
7,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
33,
970,
11,
604,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
828,
1058,
6551,
14804,
9107,
418,
7,
16,
11,
16,
4008,
198,
14689,
0,
7,
65,
11,
288,
8,
198,
31,
9288,
4129,
7,
65,
8,
6624,
352,
198,
31,
9288,
275,
58,
25,
82,
60,
6624,
362,
9,
1952,
7,
17,
11,
16,
8,
198,
31,
9288,
275,
58,
25,
64,
60,
6624,
3392,
7,
5317,
11,
604,
11,
16,
8,
198,
31,
9288,
275,
58,
25,
2777,
60,
6624,
3392,
7,
17,
11,
16,
8,
198,
31,
9288,
275,
58,
25,
81,
60,
6624,
3392,
7,
16,
11,
16,
8,
198,
31,
9288,
275,
58,
25,
28060,
60,
6624,
1976,
27498,
7,
16,
11,
16,
8,
198,
198,
2,
4574,
22155,
351,
517,
621,
530,
5002,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
513,
9,
1952,
7,
17,
11,
18,
828,
1058,
64,
5218,
43720,
7,
19,
11,
18,
8,
764,
27,
657,
13,
20,
11,
1058,
2777,
5218,
642,
9,
1952,
7,
17,
11,
18,
828,
1058,
81,
5218,
718,
9,
1952,
7,
16,
11,
18,
828,
1058,
28060,
5218,
3392,
7,
16,
11,
18,
828,
1058,
6551,
14804,
9107,
418,
7,
16,
11,
18,
4008,
198,
14689,
0,
7,
65,
11,
288,
8,
198,
31,
9288,
4129,
7,
65,
8,
6624,
604,
198,
31,
9288,
275,
58,
25,
82,
7131,
45299,
17,
25,
437,
60,
6624,
220,
513,
9,
1952,
7,
17,
11,
18,
8,
198,
31,
9288,
275,
58,
25,
64,
7131,
45299,
17,
25,
437,
60,
6624,
288,
58,
25,
64,
60,
198,
31,
9288,
275,
58,
25,
2777,
7131,
45299,
17,
25,
437,
60,
6624,
642,
9,
1952,
7,
17,
11,
18,
8,
198,
31,
9288,
275,
58,
25,
81,
7131,
45299,
17,
25,
437,
60,
6624,
718,
9,
1952,
7,
16,
11,
18,
8,
198,
31,
9288,
275,
58,
25,
28060,
7131,
45299,
17,
25,
437,
60,
6624,
3392,
7,
16,
11,
18,
8,
198,
198,
2,
4574,
257,
11876,
198,
14689,
0,
7,
65,
11,
275,
8,
198,
31,
9288,
4129,
7,
65,
8,
6624,
807,
198,
1640,
479,
287,
8251,
7,
65,
8,
198,
220,
220,
220,
2488,
9288,
275,
58,
74,
7131,
45299,
352,
25,
19,
60,
6624,
275,
58,
74,
7131,
45299,
642,
25,
23,
60,
198,
437,
628,
198,
2235,
40425,
10840,
6143,
198,
65,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
35751,
198,
67,
18,
796,
360,
713,
7,
25,
82,
5218,
513,
9,
1952,
7,
17,
11,
18,
828,
1058,
64,
5218,
43720,
7,
19,
11,
18,
8,
764,
27,
657,
13,
20,
11,
1058,
2777,
5218,
642,
9,
1952,
7,
17,
11,
18,
828,
1058,
81,
5218,
718,
9,
1952,
7,
16,
11,
18,
828,
1058,
28060,
5218,
3392,
7,
16,
11,
18,
828,
1058,
6551,
14804,
9107,
418,
7,
16,
11,
18,
828,
1058,
38668,
62,
437,
14804,
3392,
7,
16,
11,
18,
4008,
198,
67,
16,
796,
360,
713,
7,
25,
82,
5218,
362,
9,
1952,
7,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
33,
970,
11,
604,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
828,
1058,
6551,
14804,
9107,
418,
7,
16,
11,
16,
828,
1058,
38668,
62,
437,
5218,
1976,
27498,
7,
16,
11,
16,
4008,
198,
198,
1640,
1312,
28,
16,
25,
940,
198,
220,
220,
220,
4574,
62,
411,
712,
10840,
0,
7,
65,
11,
288,
16,
8,
198,
220,
220,
220,
2488,
9288,
4129,
7,
65,
8,
6624,
1312,
198,
437,
198,
198,
14689,
62,
411,
712,
10840,
0,
7,
65,
11,
288,
18,
8,
628,
198,
2235,
1598,
0,
198,
15630,
11081,
796,
2769,
30073,
7,
65,
8,
198,
20063,
0,
7,
15630,
11081,
8,
198,
31,
9288,
4129,
7,
15630,
11081,
8,
6624,
657,
198,
31,
9288,
275,
30073,
13,
19545,
62,
521,
6624,
352,
198,
198,
2235,
949,
571,
963,
198,
40,
796,
685,
16,
11,
17,
11,
19,
60,
198,
67,
17,
796,
949,
571,
963,
7,
65,
11,
314,
8,
198,
1640,
479,
287,
8251,
7,
67,
17,
8,
198,
220,
220,
220,
2488,
9288,
477,
7,
67,
17,
58,
74,
60,
764,
855,
275,
58,
74,
7131,
45299,
314,
12962,
198,
437,
220,
198,
198,
2235,
27758,
198,
31,
9288,
6472,
87,
13,
35312,
62,
8664,
2052,
7,
3064,
11,
685,
15,
13,
20,
11,
657,
13,
20,
12962,
6624,
685,
1120,
11,
1120,
60,
198,
31,
9288,
6472,
87,
13,
35312,
62,
8664,
2052,
7,
3064,
11,
685,
16,
13,
15,
12962,
6624,
685,
3064,
60,
198,
31,
9288,
6472,
87,
13,
35312,
62,
8664,
2052,
7,
3064,
11,
685,
16,
14,
18,
11,
352,
14,
18,
11,
352,
14,
18,
12962,
6624,
685,
2682,
11,
2091,
11,
2091,
60,
198,
31,
9288,
62,
400,
8516,
2195,
861,
295,
12331,
6472,
87,
13,
35312,
62,
8664,
2052,
7,
3064,
11,
657,
13,
19,
8,
198,
198,
85,
796,
43720,
7,
18,
11,
3064,
8,
198,
1443,
489,
270,
796,
16386,
28632,
7,
35,
713,
7,
25,
64,
5218,
410,
4008,
198,
198,
65,
16,
11,
275,
17,
796,
6626,
7,
1443,
489,
270,
11,
685,
15,
13,
20,
11,
657,
13,
20,
12962,
198,
31,
9288,
4129,
7,
65,
16,
8,
6624,
2026,
198,
31,
9288,
275,
16,
58,
25,
64,
60,
6624,
410,
58,
45299,
16,
25,
1120,
60,
198,
31,
9288,
4129,
7,
65,
17,
8,
6624,
2026,
198,
31,
9288,
275,
17,
58,
25,
64,
60,
6624,
410,
58,
45299,
4349,
25,
3064,
60,
628,
198,
2235,
4296,
62,
3448,
273,
871,
0,
198,
19119,
62,
3448,
273,
871,
0,
7,
65,
49336,
11,
685,
16,
11,
17,
11,
18,
4357,
685,
16,
1539,
362,
1539,
513,
8183,
8,
198,
31,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
9806,
62,
49336,
6624,
513,
13,
15,
198,
31,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
3448,
273,
871,
58,
16,
60,
15139,
230,
352,
69,
15,
61,
65,
49336,
13,
49336,
62,
37266,
13,
17394,
198,
31,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
3448,
273,
871,
58,
17,
60,
15139,
230,
362,
69,
15,
61,
65,
49336,
13,
49336,
62,
37266,
13,
17394,
198,
31,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
3448,
273,
871,
58,
18,
60,
15139,
230,
513,
69,
15,
61,
65,
49336,
13,
49336,
62,
37266,
13,
17394,
628,
198,
14689,
0,
7,
65,
49336,
11,
288,
8,
198,
14689,
0,
7,
65,
49336,
11,
288,
8,
198,
31,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
9806,
62,
49336,
6624,
513,
13,
15,
198,
1640,
1312,
28,
16,
25,
21,
198,
220,
220,
220,
2488,
9288,
275,
49336,
13,
49336,
62,
37266,
13,
3448,
273,
871,
58,
72,
60,
15139,
230,
513,
69,
15,
61,
65,
49336,
13,
49336,
62,
37266,
13,
17394,
198,
437,
198,
220,
220,
220,
220,
198,
198,
2235,
19232,
198,
198,
2,
8187,
6291,
198,
83,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
8,
198,
25192,
0,
7,
83,
11,
275,
8,
198,
198,
83,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
513,
8,
198,
29531,
13,
28826,
0,
7,
15,
8,
198,
2340,
796,
43720,
7,
16,
25,
13664,
7,
65,
828,
513,
8,
198,
29531,
13,
28826,
0,
7,
15,
8,
198,
25192,
0,
7,
83,
11,
275,
8,
198,
198,
1640,
479,
287,
8251,
7,
83,
8,
198,
220,
220,
220,
2488,
9288,
256,
58,
74,
60,
6624,
275,
58,
74,
7131,
45299,
2340,
60,
198,
437,
198,
198,
2,
6208,
262,
5021,
12,
22252,
19232,
198,
83,
16,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
8,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
3392,
7,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
33,
970,
11,
604,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
4008,
198,
14689,
0,
7,
83,
16,
11,
288,
8,
198,
198,
83,
17,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
8,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
362,
9,
1952,
7,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
33,
970,
11,
604,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
4008,
198,
14689,
0,
7,
83,
17,
11,
288,
8,
198,
198,
83,
18,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
8,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
513,
9,
1952,
7,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
19,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
4008,
198,
14689,
0,
7,
83,
18,
11,
288,
8,
198,
198,
83,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
838,
8,
198,
25192,
0,
7,
83,
11,
256,
16,
11,
256,
17,
11,
256,
18,
8,
198,
198,
31,
9288,
477,
7,
83,
58,
25,
82,
7131,
45299,
352,
25,
19,
60,
764,
855,
352,
13,
15,
8,
198,
31,
9288,
477,
7,
83,
58,
25,
82,
7131,
45299,
642,
25,
22,
60,
764,
855,
362,
13,
15,
8,
198,
31,
9288,
477,
7,
83,
58,
25,
82,
7131,
45299,
807,
25,
940,
60,
764,
855,
513,
13,
15,
8,
628,
198,
198,
2,
34416,
8405,
198,
65,
49336,
58,
25,
82,
60,
764,
28,
43720,
7,
43879,
2624,
11,
362,
11,
718,
8,
198,
19119,
62,
3448,
273,
871,
0,
7,
65,
49336,
11,
685,
16,
25,
21,
986,
4357,
685,
16,
11207,
21,
13,
2644,
12962,
198,
83,
796,
16386,
28632,
7,
17875,
5623,
14106,
7,
17,
828,
8444,
8374,
14106,
7,
19,
828,
8576,
11,
685,
25,
6551,
12962,
198,
3448,
273,
871,
796,
685,
65,
49336,
13,
49336,
62,
37266,
13,
3448,
273,
871,
58,
72,
60,
329,
1312,
28,
16,
25,
13664,
7,
65,
49336,
15437,
628,
198,
25192,
0,
7,
83,
11,
275,
49336,
8,
198,
198,
2,
6208,
262,
262,
8373,
286,
8405,
318,
27111,
284,
511,
8475,
198,
19503,
48382,
796,
685,
16345,
7,
83,
13,
521,
1063,
764,
855,
1312,
8,
329,
1312,
28,
16,
25,
21,
60,
24457,
4129,
7,
83,
8,
198,
1676,
1443,
796,
15369,
24457,
2160,
7,
3448,
273,
871,
8,
198,
260,
1754,
81,
796,
2352,
12195,
19503,
48382,
764,
12,
386,
1443,
8,
24457,
386,
1443,
198,
31,
9288,
477,
7,
260,
1754,
81,
764,
27,
657,
13,
486,
8,
198,
198,
31,
9288,
477,
7,
83,
58,
25,
82,
60,
764,
855,
275,
49336,
58,
25,
82,
7131,
45299,
83,
13,
521,
1063,
12962,
198,
31,
9288,
477,
7,
83,
58,
25,
6551,
60,
764,
27,
28,
352,
2014,
198,
198,
2235,
20121,
220,
198,
2,
275,
647,
469,
796,
20121,
7,
65,
11,
275,
11,
5339,
796,
5867,
8,
198,
2,
2488,
9288,
4129,
7,
65,
647,
469,
8,
6624,
939,
198,
2,
2488,
9288,
5339,
7,
65,
647,
469,
8,
6624,
5867,
198,
2,
2488,
9288,
275,
647,
469,
58,
25,
82,
7131,
45299,
352,
25,
3064,
60,
6624,
275,
647,
469,
58,
25,
82,
7131,
45299,
8949,
25,
2167,
60,
220,
198,
198,
2235,
15237,
12,
35,
2585,
198,
65,
17,
67,
796,
16386,
28632,
7,
17875,
5623,
14106,
19510,
17,
11,
17,
828,
471,
5317,
23,
828,
8444,
8374,
14106,
7,
19,
828,
1802,
26,
8,
198,
31,
9288,
299,
67,
12078,
7,
65,
17,
67,
58,
25,
82,
12962,
6624,
513,
198,
65,
17,
67,
58,
25,
82,
60,
198,
198,
67,
796,
360,
713,
7,
25,
82,
5218,
513,
9,
1952,
7,
17,
11,
17,
11,
16,
828,
1058,
64,
5218,
3392,
7,
19,
11,
16,
828,
1058,
2777,
5218,
3392,
7,
17,
11,
17,
11,
16,
828,
1058,
81,
5218,
3392,
7,
16,
11,
16,
828,
1058,
28060,
5218,
1976,
27498,
7,
16,
11,
16,
4008,
198,
14689,
0,
7,
65,
17,
67,
11,
288,
8,
198,
198,
31,
9288,
477,
7,
65,
17,
67,
58,
25,
82,
60,
764,
855,
513,
8,
628
] | 2.214586 | 4,045 |
# Unit testing of (bounded) univariate discrete distributions
#
# Here, bounded means the sample values are bounded.
#
# Distributions covered by this suite:
#
# - Bernoulli
# - Categorical
# - DiscreteUniform
#
using Distributions
using Base.Test
import StatsBase: entropy
distlist = [
Bernoulli(0.1),
Bernoulli(0.5),
Bernoulli(0.9),
Categorical([0.1, 0.9]),
Categorical([0.5, 0.5]),
Categorical([0.9, 0.1]),
Categorical([0.2, 0.5, 0.3]),
DiscreteUniform(0, 3),
DiscreteUniform(2.0, 5.0),
Binomial(1, 0.5),
Binomial(100, 0.1),
Binomial(100, 0.9)]
if length(ARGS) > 0
newdistlist = {}
for arg in ARGS
a = eval(parse(arg))
if isa(a, DataType)
append!(newdistlist, filter(x -> isa(x,a),distlist))
elseif isa(a,Distribution)
push!(newdistlist, a)
end
end
distlist = newdistlist
end
for d in distlist
length(ARGS) > 0 && println(d)
xmin = minimum(d)
xmax = maximum(d)
@assert isa(xmin, Int)
@assert isa(xmax, Int)
@assert xmin <= xmax
####
#
# Part 1: testing the capability of sampling
#
####
n = 10000
# check that we can generate a single random draw
draw = rand(d)
@test isa(draw, Int)
@test xmin <= draw <= xmax
# check that we can generate many random draws at once
x = rand(d, n)
@test isa(x, Vector{Int})
@test xmin <= minimum(x) <= maximum(x) <= xmax
# check that we can generate many random draws in-place
rand!(d, x)
@test xmin <= minimum(x) <= maximum(x) <= xmax
####
#
# Part 2: testing insupport
#
####
x = [xmin:xmax]
n = length(x)
@test !insupport(d, xmin-1)
@test !insupport(d, xmax+1)
for i = 1:n
@test insupport(d, x[i])
end
@test all(insupport(d, x))
####
#
# Part 3: testing evaluation
#
####
p = Array(Float64, n)
c = Array(Float64, n)
cc = Array(Float64, n)
lp = Array(Float64, n)
lc = Array(Float64, n)
lcc = Array(Float64, n)
ci = 0.
for i in 1 : n
p[i] = pdf(d, x[i])
ci += p[i]
c[i] = cdf(d, x[i])
cc[i] = ccdf(d, x[i])
@test_approx_eq ci c[i]
@test_approx_eq c[i] + cc[i] 1.0
lp[i] = logpdf(d, x[i])
lc[i] = logcdf(d, x[i])
lcc[i] = logccdf(d, x[i])
@test_approx_eq_eps lp[i] log(p[i]) 1.0e-12
@test_approx_eq_eps lc[i] log(c[i]) 1.0e-12
@test_approx_eq_eps lcc[i] log(cc[i]) 1.0e-12
if !isa(d, Binomial)
@test quantile(d, c[i] - 1.0e-8) == x[i]
@test cquantile(d, cc[i] + 1.0e-8) == x[i]
@test invlogcdf(d, lc[i] - 1.0e-8) == x[i]
if 0.0 < c[i] < 1.0
@test invlogccdf(d, lcc[i] + 1.0e-8) == x[i]
end
end
end
# check consistency of scalar-based and vectorized evaluation
@test_approx_eq pdf(d, x) p
@test_approx_eq cdf(d, x) c
@test_approx_eq ccdf(d, x) cc
@test_approx_eq logpdf(d, x) lp
@test_approx_eq logcdf(d, x) lc
@test_approx_eq logccdf(d, x) lcc
####
#
# Part 4: testing statistics
#
####
xf = float64(x)
xmean = dot(p, xf)
xvar = dot(p, abs2(xf .- xmean))
xstd = sqrt(xvar)
xentropy = entropy(p)
xskew = dot(p, (xf .- xmean).^3) / (xstd.^3)
xkurt = dot(p, (xf .- xmean).^4) / (xvar.^2) - 3.0
@test_approx_eq mean(d) xmean
@test_approx_eq var(d) xvar
@test_approx_eq std(d) xstd
@test_approx_eq skewness(d) xskew
@test_approx_eq kurtosis(d) xkurt
@test_approx_eq entropy(d) xentropy
end
| [
2,
220,
11801,
4856,
286,
357,
65,
6302,
8,
555,
42524,
28810,
24570,
198,
2,
198,
2,
220,
3423,
11,
49948,
1724,
262,
6291,
3815,
389,
49948,
13,
220,
198,
2,
198,
2,
220,
46567,
507,
5017,
416,
428,
18389,
25,
198,
2,
198,
2,
220,
197,
12,
6206,
280,
15516,
198,
2,
220,
220,
197,
12,
327,
2397,
12409,
198,
2,
220,
220,
532,
8444,
8374,
3118,
6933,
198,
2,
198,
198,
3500,
46567,
507,
198,
3500,
7308,
13,
14402,
198,
11748,
20595,
14881,
25,
40709,
198,
198,
17080,
4868,
796,
685,
198,
220,
220,
220,
6206,
280,
15516,
7,
15,
13,
16,
828,
198,
220,
220,
220,
6206,
280,
15516,
7,
15,
13,
20,
828,
198,
220,
220,
220,
6206,
280,
15516,
7,
15,
13,
24,
828,
220,
198,
220,
220,
220,
327,
2397,
12409,
26933,
15,
13,
16,
11,
657,
13,
24,
46570,
198,
220,
220,
220,
327,
2397,
12409,
26933,
15,
13,
20,
11,
657,
13,
20,
46570,
198,
220,
220,
220,
327,
2397,
12409,
26933,
15,
13,
24,
11,
657,
13,
16,
46570,
220,
198,
220,
220,
220,
327,
2397,
12409,
26933,
15,
13,
17,
11,
657,
13,
20,
11,
657,
13,
18,
46570,
220,
198,
220,
220,
220,
8444,
8374,
3118,
6933,
7,
15,
11,
513,
828,
198,
220,
220,
220,
8444,
8374,
3118,
6933,
7,
17,
13,
15,
11,
642,
13,
15,
828,
198,
220,
220,
220,
20828,
49070,
7,
16,
11,
657,
13,
20,
828,
198,
220,
220,
220,
20828,
49070,
7,
3064,
11,
657,
13,
16,
828,
198,
220,
220,
220,
20828,
49070,
7,
3064,
11,
657,
13,
24,
15437,
198,
198,
361,
4129,
7,
1503,
14313,
8,
1875,
657,
198,
220,
220,
220,
649,
17080,
4868,
796,
23884,
198,
220,
220,
220,
329,
1822,
287,
5923,
14313,
198,
220,
220,
220,
220,
220,
220,
220,
257,
796,
5418,
7,
29572,
7,
853,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
611,
318,
64,
7,
64,
11,
6060,
6030,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24443,
0,
7,
3605,
17080,
4868,
11,
8106,
7,
87,
4613,
318,
64,
7,
87,
11,
64,
828,
17080,
4868,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
318,
64,
7,
64,
11,
20344,
3890,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
3605,
17080,
4868,
11,
257,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1233,
4868,
796,
649,
17080,
4868,
220,
220,
220,
220,
198,
437,
198,
198,
1640,
288,
287,
1233,
4868,
198,
220,
220,
220,
4129,
7,
1503,
14313,
8,
1875,
657,
11405,
44872,
7,
67,
8,
628,
220,
220,
220,
2124,
1084,
796,
5288,
7,
67,
8,
198,
220,
220,
220,
2124,
9806,
796,
5415,
7,
67,
8,
198,
220,
220,
220,
2488,
30493,
318,
64,
7,
87,
1084,
11,
2558,
8,
198,
220,
220,
220,
2488,
30493,
318,
64,
7,
87,
9806,
11,
2558,
8,
198,
220,
220,
220,
2488,
30493,
2124,
1084,
19841,
2124,
9806,
628,
220,
220,
220,
1303,
21017,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
220,
2142,
352,
25,
220,
4856,
262,
12971,
286,
19232,
198,
220,
220,
220,
1303,
220,
220,
198,
220,
220,
220,
1303,
21017,
628,
220,
220,
220,
299,
796,
33028,
628,
220,
220,
220,
1303,
2198,
326,
356,
460,
7716,
257,
2060,
4738,
3197,
198,
220,
220,
220,
3197,
796,
43720,
7,
67,
8,
198,
220,
220,
220,
2488,
9288,
318,
64,
7,
19334,
11,
2558,
8,
198,
220,
220,
220,
2488,
9288,
2124,
1084,
19841,
3197,
19841,
2124,
9806,
628,
220,
220,
220,
1303,
2198,
326,
356,
460,
7716,
867,
4738,
14293,
379,
1752,
198,
220,
220,
220,
2124,
796,
43720,
7,
67,
11,
299,
8,
198,
220,
220,
220,
2488,
9288,
318,
64,
7,
87,
11,
20650,
90,
5317,
30072,
198,
220,
220,
220,
2488,
9288,
2124,
1084,
19841,
5288,
7,
87,
8,
19841,
5415,
7,
87,
8,
19841,
2124,
9806,
628,
220,
220,
220,
1303,
2198,
326,
356,
460,
7716,
867,
4738,
14293,
287,
12,
5372,
198,
220,
220,
220,
43720,
0,
7,
67,
11,
2124,
8,
198,
220,
220,
220,
2488,
9288,
2124,
1084,
19841,
5288,
7,
87,
8,
19841,
5415,
7,
87,
8,
19841,
2124,
9806,
628,
220,
220,
220,
1303,
21017,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
220,
2142,
362,
25,
4856,
1035,
84,
4926,
198,
220,
220,
220,
1303,
220,
220,
198,
220,
220,
220,
1303,
21017,
628,
220,
220,
220,
2124,
796,
685,
87,
1084,
25,
87,
9806,
60,
198,
220,
220,
220,
299,
796,
4129,
7,
87,
8,
628,
220,
220,
220,
2488,
9288,
5145,
1040,
84,
4926,
7,
67,
11,
2124,
1084,
12,
16,
8,
198,
220,
220,
220,
2488,
9288,
5145,
1040,
84,
4926,
7,
67,
11,
2124,
9806,
10,
16,
8,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
1035,
84,
4926,
7,
67,
11,
2124,
58,
72,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
477,
7,
1040,
84,
4926,
7,
67,
11,
2124,
4008,
628,
220,
220,
220,
1303,
21017,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
220,
2142,
513,
25,
4856,
12660,
198,
220,
220,
220,
1303,
220,
220,
198,
220,
220,
220,
1303,
21017,
628,
220,
220,
220,
279,
796,
15690,
7,
43879,
2414,
11,
299,
8,
198,
220,
220,
220,
269,
796,
15690,
7,
43879,
2414,
11,
299,
8,
198,
220,
220,
220,
36624,
796,
15690,
7,
43879,
2414,
11,
299,
8,
628,
220,
220,
220,
300,
79,
796,
15690,
7,
43879,
2414,
11,
299,
8,
198,
220,
220,
220,
300,
66,
796,
15690,
7,
43879,
2414,
11,
299,
8,
198,
220,
220,
220,
300,
535,
796,
15690,
7,
43879,
2414,
11,
299,
8,
628,
220,
220,
220,
269,
72,
796,
657,
13,
628,
220,
220,
220,
329,
1312,
287,
352,
1058,
299,
198,
220,
220,
220,
220,
220,
220,
220,
279,
58,
72,
60,
796,
37124,
7,
67,
11,
2124,
58,
72,
12962,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
269,
72,
15853,
279,
58,
72,
60,
628,
220,
220,
220,
220,
220,
220,
220,
269,
58,
72,
60,
796,
269,
7568,
7,
67,
11,
2124,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
36624,
58,
72,
60,
796,
36624,
7568,
7,
67,
11,
2124,
58,
72,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
269,
72,
269,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
269,
58,
72,
60,
1343,
36624,
58,
72,
60,
352,
13,
15,
628,
220,
220,
220,
220,
220,
220,
220,
300,
79,
58,
72,
60,
796,
2604,
12315,
7,
67,
11,
2124,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
300,
66,
58,
72,
60,
796,
2604,
66,
7568,
7,
67,
11,
2124,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
300,
535,
58,
72,
60,
796,
2604,
535,
7568,
7,
67,
11,
2124,
58,
72,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
62,
25386,
300,
79,
58,
72,
60,
2604,
7,
79,
58,
72,
12962,
352,
13,
15,
68,
12,
1065,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
62,
25386,
300,
66,
58,
72,
60,
2604,
7,
66,
58,
72,
12962,
352,
13,
15,
68,
12,
1065,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
62,
25386,
300,
535,
58,
72,
60,
2604,
7,
535,
58,
72,
12962,
352,
13,
15,
68,
12,
1065,
628,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
9160,
7,
67,
11,
20828,
49070,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5554,
576,
7,
67,
11,
269,
58,
72,
60,
532,
352,
13,
15,
68,
12,
23,
8,
6624,
2124,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
269,
40972,
576,
7,
67,
11,
36624,
58,
72,
60,
1343,
352,
13,
15,
68,
12,
23,
8,
6624,
2124,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
800,
6404,
66,
7568,
7,
67,
11,
300,
66,
58,
72,
60,
532,
352,
13,
15,
68,
12,
23,
8,
6624,
2124,
58,
72,
60,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
657,
13,
15,
1279,
269,
58,
72,
60,
1279,
352,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
800,
6404,
535,
7568,
7,
67,
11,
300,
535,
58,
72,
60,
1343,
352,
13,
15,
68,
12,
23,
8,
6624,
2124,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
2198,
15794,
286,
16578,
283,
12,
3106,
290,
15879,
1143,
12660,
628,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
37124,
7,
67,
11,
2124,
8,
279,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
269,
7568,
7,
67,
11,
2124,
8,
269,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
36624,
7568,
7,
67,
11,
2124,
8,
36624,
628,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
2604,
12315,
7,
67,
11,
2124,
8,
300,
79,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
2604,
66,
7568,
7,
67,
11,
2124,
8,
300,
66,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
2604,
535,
7568,
7,
67,
11,
2124,
8,
300,
535,
628,
220,
220,
220,
1303,
21017,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
220,
2142,
604,
25,
4856,
7869,
198,
220,
220,
220,
1303,
220,
220,
198,
220,
220,
220,
1303,
21017,
220,
220,
220,
220,
628,
220,
220,
220,
2124,
69,
796,
12178,
2414,
7,
87,
8,
198,
220,
220,
220,
2124,
32604,
796,
16605,
7,
79,
11,
2124,
69,
8,
198,
220,
220,
220,
2124,
7785,
796,
16605,
7,
79,
11,
2352,
17,
7,
26152,
764,
12,
2124,
32604,
4008,
198,
220,
220,
220,
2124,
19282,
796,
19862,
17034,
7,
87,
7785,
8,
198,
220,
220,
220,
2124,
298,
28338,
796,
40709,
7,
79,
8,
198,
220,
220,
220,
2124,
82,
365,
86,
796,
16605,
7,
79,
11,
357,
26152,
764,
12,
2124,
32604,
737,
61,
18,
8,
1220,
357,
87,
19282,
13,
61,
18,
8,
198,
220,
220,
220,
2124,
74,
3325,
796,
16605,
7,
79,
11,
357,
26152,
764,
12,
2124,
32604,
737,
61,
19,
8,
1220,
357,
87,
7785,
13,
61,
17,
8,
532,
513,
13,
15,
628,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
1612,
7,
67,
8,
220,
220,
220,
220,
2124,
32604,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
1401,
7,
67,
8,
220,
220,
220,
220,
220,
2124,
7785,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
14367,
7,
67,
8,
220,
220,
220,
220,
220,
2124,
19282,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
6146,
675,
408,
7,
67,
8,
2124,
82,
365,
86,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
479,
3325,
5958,
7,
67,
8,
2124,
74,
3325,
198,
220,
220,
220,
2488,
9288,
62,
1324,
13907,
62,
27363,
40709,
7,
67,
8,
220,
2124,
298,
28338,
198,
198,
437,
628,
198
] | 1.882145 | 1,977 |
# Nominal Models
@testset "Nominal Models" begin
data = CSV.read(joinpath(pkgdir(Econometrics), "data", "insure.csv"), DataFrame, select = [:insure, :age, :male, :nonwhite, :site]) |>
dropmissing |>
(data -> transform!(data, [:insure, :site] .=> categorical, renamecols = false))
model = fit(
EconometricModel,
@formula(insure ~ age + male + nonwhite + site),
data,
contrasts = Dict(:insure => DummyCoding(base = "Uninsure")),
)
@test sprint(show, model) ==
"Probability Model for Nominal Response\nCategories: Uninsure, Indemnity, Prepaid\nNumber of observations: 615\nNull Loglikelihood: -555.85\nLoglikelihood: -534.36\nR-squared: 0.0387\nLR Test: 42.99 ∼ χ²(10) ⟹ Pr > χ² = 0.0000\nFormula: insure ~ 1 + age + male + nonwhite + site\n───────────────────────────────────────────────────────────────────────────────────────────────────\n PE SE t-value Pr > |t| 2.50% 97.50%\n───────────────────────────────────────────────────────────────────────────────────────────────────\ninsure: Indemnity ~ (Intercept) 1.28694 0.59232 2.17271 0.0302 0.123689 2.4502\ninsure: Indemnity ~ age 0.00779612 0.0114418 0.681372 0.4959 -0.0146743 0.0302666\ninsure: Indemnity ~ male -0.451848 0.367486 -1.22957 0.2193 -1.17355 0.269855\ninsure: Indemnity ~ nonwhite -0.217059 0.425636 -0.509965 0.6103 -1.05296 0.618843\ninsure: Indemnity ~ site: 2 1.21152 0.470506 2.57493 0.0103 0.287497 2.13554\ninsure: Indemnity ~ site: 3 0.207813 0.366293 0.56734 0.5707 -0.511547 0.927172\ninsure: Prepaid ~ (Intercept) 1.55666 0.596327 2.61041 0.0093 0.385533 2.72778\ninsure: Prepaid ~ age -0.00394887 0.0115993 -0.340439 0.7336 -0.0267287 0.018831\ninsure: Prepaid ~ male 0.109846 0.365187 0.300793 0.7637 -0.607343 0.827035\ninsure: Prepaid ~ nonwhite 0.757718 0.419575 1.80592 0.0714 -0.0662835 1.58172\ninsure: Prepaid ~ site: 2 1.32456 0.469789 2.81947 0.0050 0.401941 2.24717\ninsure: Prepaid ~ site: 3 -0.380175 0.372819 -1.01973 0.3083 -1.11235 0.352001\n───────────────────────────────────────────────────────────────────────────────────────────────────"
β, V, σ = coef(model), vcov(model), stderror(model)
@test β ≈ [
1.286943,
0.0077961,
-0.4518496,
-0.2170589,
1.211563,
0.2078123,
1.556656,
-0.0039489,
0.1098438,
0.7577178,
1.324599,
-0.3801756,
] rtol = 1e-3
@test V ≈
[
0.35084518 -0.00590456 -0.02519209 -0.01837512 -0.08995794 -0.08264268 0.29928937 -0.00510107 -0.02257270 -0.01585492 -0.07392512 -0.06808314
-0.00590456 0.00013092 -0.00046225 -0.00028066 0.00041004 0.00040470 -0.00509454 0.00011354 -0.00039387 -0.00024122 0.00033847 0.00035236
-0.02519209 -0.00046225 0.13504644 0.01565749 0.01009559 0.00933967 -0.02288847 -0.00039497 0.11365141 0.01369872 0.00945927 0.00802593
-0.01837512 -0.00590456 -0.02519209 0.18116609 0.01886597 -0.02821348 -0.01638629 -0.00023179 0.01314666 0.15068111 0.01664999 -0.02345786
-0.08995794 -0.00590456 -0.02519209 -0.01837512 0.22138224 0.064050660 -0.07438947 0.00035751 0.00845363 0.01594691 0.19895500 0.05189742
-0.08264268 0.00040470 0.00933967 -0.02821348 0.06405066 0.134170290 -0.06796097 0.00034828 0.00826890 -0.02353016 0.05182727 0.11060487
0.29928937 -0.00509454 -0.02288847 -0.01638629 -0.07438947 -0.06796097 0.35560782 -0.00601966 -0.02683161 -0.02105510 -0.08991231 -0.08165509
-0.00510107 0.00011354 -0.00039497 -0.00023179 0.00035751 0.00034828 -0.00601966 0.00013455 -0.00047223 -0.00028680 0.00039990 0.0004179
-0.02257270 -0.00039387 0.11365141 0.01314666 0.00845363 0.00826890 -0.02683161 -0.00047223 0.13336253 0.01625685 0.01101870 0.00922333
-0.01585492 -0.00024122 0.01369872 0.15068111 0.01594691 -0.02353016 -0.02105510 -0.00028680 0.01625685 0.17604391 0.02099458 -0.03008391
-0.07392512 0.00033847 0.00945927 0.01664999 0.19895500 0.05182727 -0.08991231 0.00039990 0.01101870 0.02099458 0.22070774 0.06273376
-0.06808314 0.00035236 0.00802593 -0.02345786 0.05189742 0.11060487 -0.08165509 0.00041790 0.00922333 -0.03008391 0.06273376 0.13899387
] |>
Hermitian rtol = 1e-3
@test σ ≈ [
0.5923219,
0.0114418,
0.3674867,
0.4256361,
0.4705127,
0.3662926,
0.5963286,
0.0115994,
0.3651883,
0.4195759,
0.4697954,
0.3728188,
] rtol = 1e-4
end
| [
2,
21198,
1292,
32329,
198,
31,
9288,
2617,
366,
45,
296,
1292,
32329,
1,
2221,
198,
220,
220,
220,
1366,
796,
44189,
13,
961,
7,
22179,
6978,
7,
35339,
15908,
7,
36,
1102,
908,
10466,
828,
366,
7890,
1600,
366,
1040,
495,
13,
40664,
12340,
6060,
19778,
11,
2922,
796,
685,
25,
1040,
495,
11,
1058,
496,
11,
1058,
22606,
11,
1058,
13159,
11186,
11,
1058,
15654,
12962,
930,
29,
198,
220,
220,
220,
220,
220,
220,
220,
4268,
45688,
930,
29,
198,
220,
220,
220,
220,
220,
220,
220,
357,
7890,
4613,
6121,
0,
7,
7890,
11,
685,
25,
1040,
495,
11,
1058,
15654,
60,
764,
14804,
4253,
12409,
11,
36265,
4033,
82,
796,
3991,
4008,
198,
220,
220,
220,
2746,
796,
4197,
7,
198,
220,
220,
220,
220,
220,
220,
220,
412,
1102,
16996,
17633,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
687,
4712,
7,
1040,
495,
5299,
2479,
1343,
4257,
1343,
1729,
11186,
1343,
2524,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1366,
11,
198,
220,
220,
220,
220,
220,
220,
220,
39469,
796,
360,
713,
7,
25,
1040,
495,
5218,
360,
13513,
34,
7656,
7,
8692,
796,
366,
3118,
1040,
495,
4943,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
2488,
9288,
18553,
7,
12860,
11,
2746,
8,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
2964,
65,
1799,
9104,
329,
21198,
1292,
18261,
59,
77,
34,
26129,
25,
791,
1040,
495,
11,
1423,
37705,
414,
11,
19141,
1698,
59,
77,
15057,
286,
13050,
25,
718,
1314,
59,
77,
35067,
5972,
2339,
11935,
25,
532,
31046,
13,
5332,
59,
77,
11187,
2339,
11935,
25,
532,
20,
2682,
13,
2623,
59,
77,
49,
12,
16485,
1144,
25,
657,
13,
15,
32220,
59,
77,
35972,
6208,
25,
5433,
13,
2079,
42783,
18074,
229,
31185,
7,
940,
8,
2343,
253,
117,
1736,
1875,
18074,
229,
31185,
796,
657,
13,
2388,
59,
77,
8479,
4712,
25,
38976,
5299,
352,
1343,
2479,
1343,
4257,
1343,
1729,
11186,
1343,
2524,
59,
77,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
8418,
7280,
59,
77,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18468,
220,
220,
220,
220,
220,
220,
220,
220,
7946,
220,
220,
220,
220,
220,
220,
256,
12,
8367,
220,
1736,
1875,
930,
83,
91,
220,
220,
220,
220,
220,
220,
362,
13,
1120,
4,
220,
220,
220,
220,
10111,
13,
1120,
4,
59,
77,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
8418,
7280,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
357,
9492,
984,
8,
220,
220,
352,
13,
2078,
45214,
220,
220,
220,
220,
657,
13,
3270,
24339,
220,
220,
220,
220,
362,
13,
1558,
28977,
220,
220,
220,
220,
657,
13,
15,
22709,
220,
220,
657,
13,
1065,
2623,
4531,
220,
220,
362,
13,
17885,
17,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
2479,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
13,
405,
3324,
4846,
1065,
220,
657,
13,
486,
18444,
1507,
220,
220,
657,
13,
3104,
1485,
4761,
220,
220,
220,
657,
13,
2920,
3270,
220,
532,
15,
13,
486,
24669,
3559,
220,
657,
13,
39101,
2075,
2791,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
4257,
220,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2231,
1507,
2780,
220,
220,
220,
657,
13,
27824,
34251,
220,
220,
532,
16,
13,
23539,
3553,
220,
220,
220,
220,
657,
13,
17,
24943,
220,
532,
16,
13,
1558,
28567,
220,
220,
220,
657,
13,
2075,
4089,
2816,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
1729,
11186,
220,
220,
220,
220,
532,
15,
13,
24591,
46712,
220,
220,
220,
657,
13,
19,
11645,
2623,
220,
220,
532,
15,
13,
1120,
2079,
2996,
220,
220,
220,
657,
13,
21,
15197,
220,
532,
16,
13,
2713,
27137,
220,
220,
220,
657,
13,
21,
20356,
3559,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
2524,
25,
362,
220,
220,
220,
220,
220,
220,
352,
13,
21895,
4309,
220,
220,
220,
220,
657,
13,
27790,
35638,
220,
220,
220,
362,
13,
3553,
43134,
220,
220,
220,
220,
657,
13,
486,
3070,
220,
220,
657,
13,
27800,
38073,
220,
220,
362,
13,
1485,
44218,
59,
77,
1040,
495,
25,
1423,
37705,
414,
5299,
2524,
25,
513,
220,
220,
220,
220,
220,
220,
657,
13,
1238,
3695,
1485,
220,
220,
220,
657,
13,
32459,
31675,
220,
220,
220,
657,
13,
20,
3134,
2682,
220,
220,
220,
220,
657,
13,
20,
24038,
220,
532,
15,
13,
20,
15363,
2857,
220,
220,
657,
13,
24,
1983,
23628,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
357,
9492,
984,
8,
220,
220,
220,
220,
352,
13,
2816,
27310,
220,
220,
220,
220,
657,
13,
3270,
5066,
1983,
220,
220,
220,
362,
13,
39132,
3901,
220,
220,
220,
220,
657,
13,
405,
6052,
220,
220,
657,
13,
2548,
2816,
2091,
220,
220,
362,
13,
47760,
3695,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
2479,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
405,
2670,
2780,
5774,
220,
657,
13,
486,
1314,
44821,
220,
532,
15,
13,
23601,
47106,
220,
220,
220,
657,
13,
22,
29211,
220,
532,
15,
13,
15,
25674,
27800,
220,
657,
13,
486,
3459,
3132,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
4257,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
13,
940,
4089,
3510,
220,
220,
220,
657,
13,
24760,
23451,
220,
220,
220,
657,
13,
6200,
44750,
220,
220,
220,
657,
13,
4304,
2718,
220,
532,
15,
13,
31980,
32118,
220,
220,
657,
13,
23,
20233,
2327,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
1729,
11186,
220,
220,
220,
220,
220,
220,
220,
657,
13,
2425,
3324,
1507,
220,
220,
220,
657,
13,
19,
22186,
2425,
220,
220,
220,
352,
13,
1795,
45839,
220,
220,
220,
220,
657,
13,
2998,
1415,
220,
532,
15,
13,
15,
2791,
2078,
2327,
220,
352,
13,
3365,
23628,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
2524,
25,
362,
220,
220,
220,
220,
220,
220,
220,
220,
352,
13,
33916,
3980,
220,
220,
220,
220,
657,
13,
42947,
40401,
220,
220,
220,
362,
13,
23,
1129,
2857,
220,
220,
220,
220,
657,
13,
405,
1120,
220,
220,
657,
13,
21844,
24,
3901,
220,
220,
362,
13,
23753,
1558,
59,
77,
1040,
495,
25,
19141,
1698,
5299,
2524,
25,
513,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2548,
486,
2425,
220,
220,
220,
657,
13,
2718,
2078,
1129,
220,
220,
532,
16,
13,
30484,
4790,
220,
220,
220,
220,
657,
13,
1270,
5999,
220,
532,
16,
13,
14686,
2327,
220,
220,
220,
657,
13,
2327,
14585,
59,
77,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
28542,
8418,
7280,
1,
198,
220,
220,
220,
27169,
11,
569,
11,
18074,
225,
796,
763,
891,
7,
19849,
828,
410,
66,
709,
7,
19849,
828,
336,
1082,
1472,
7,
19849,
8,
198,
220,
220,
220,
2488,
9288,
27169,
15139,
230,
685,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
2078,
3388,
3559,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
405,
3324,
4846,
16,
11,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2231,
1507,
37747,
11,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
24591,
2713,
4531,
11,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
21895,
46572,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1238,
3695,
10163,
11,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
2816,
2791,
3980,
11,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
405,
2670,
35890,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
940,
4089,
43704,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
2425,
3324,
23188,
11,
198,
220,
220,
220,
220,
220,
220,
220,
352,
13,
18,
22995,
2079,
11,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2548,
486,
38219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
374,
83,
349,
796,
352,
68,
12,
18,
198,
220,
220,
220,
2488,
9288,
569,
15139,
230,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
14877,
23,
2231,
1507,
532,
15,
13,
405,
36993,
29228,
532,
15,
13,
36629,
1129,
22567,
532,
15,
13,
486,
5999,
2425,
1065,
532,
15,
13,
2919,
2079,
3553,
5824,
532,
15,
13,
2919,
18897,
25022,
657,
13,
22579,
27693,
2718,
532,
15,
13,
405,
4349,
486,
2998,
532,
15,
13,
2999,
28676,
20233,
532,
15,
13,
486,
38905,
40256,
532,
15,
13,
2998,
2670,
1495,
1065,
532,
15,
13,
3312,
1795,
5999,
1415,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
405,
36993,
29228,
657,
13,
18005,
1270,
5892,
532,
15,
13,
830,
3510,
18182,
532,
15,
13,
830,
21033,
2791,
657,
13,
830,
19,
3064,
19,
657,
13,
830,
26429,
2154,
532,
15,
13,
405,
29022,
34229,
657,
13,
18005,
1485,
4051,
532,
15,
13,
830,
2670,
32220,
532,
15,
13,
830,
1731,
18376,
657,
13,
830,
28460,
2857,
657,
13,
830,
2327,
24940,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
36629,
1129,
22567,
532,
15,
13,
830,
3510,
18182,
657,
13,
1485,
33580,
29173,
657,
13,
25150,
37680,
2920,
657,
13,
486,
28694,
38605,
657,
13,
28694,
29626,
3134,
532,
15,
13,
44087,
28011,
2857,
532,
15,
13,
830,
2670,
38073,
657,
13,
1157,
24760,
23756,
657,
13,
486,
2623,
4089,
4761,
657,
13,
28694,
33459,
1983,
657,
13,
405,
1795,
1495,
6052,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
486,
5999,
2425,
1065,
532,
15,
13,
405,
36993,
29228,
532,
15,
13,
36629,
1129,
22567,
657,
13,
1507,
18298,
31751,
657,
13,
486,
3459,
2996,
5607,
532,
15,
13,
46957,
26427,
2780,
532,
15,
13,
27037,
21734,
1959,
532,
15,
13,
830,
1954,
21738,
657,
13,
30273,
1415,
27310,
657,
13,
8628,
3104,
16243,
657,
13,
27037,
2414,
17032,
532,
15,
13,
45310,
2231,
46302,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2919,
2079,
3553,
5824,
532,
15,
13,
405,
36993,
29228,
532,
15,
13,
36629,
1129,
22567,
532,
15,
13,
486,
5999,
2425,
1065,
657,
13,
1828,
1485,
6469,
1731,
657,
13,
3312,
1821,
35638,
1899,
532,
15,
13,
2998,
19,
29769,
2857,
657,
13,
830,
2327,
48365,
657,
13,
25257,
2231,
35447,
657,
13,
486,
3270,
42947,
16,
657,
13,
25475,
2816,
405,
657,
13,
2713,
1507,
5607,
3682,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2919,
18897,
25022,
657,
13,
830,
26429,
2154,
657,
13,
28694,
29626,
3134,
532,
15,
13,
46957,
26427,
2780,
657,
13,
3312,
1821,
1120,
2791,
657,
13,
19880,
17279,
24369,
532,
15,
13,
15,
37601,
1899,
5607,
657,
13,
830,
28978,
2078,
657,
13,
25257,
25022,
3829,
532,
15,
13,
45310,
4310,
27037,
657,
13,
2713,
1507,
1983,
1983,
657,
13,
11442,
1899,
35133,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
22579,
27693,
2718,
532,
15,
13,
405,
29022,
34229,
532,
15,
13,
44087,
28011,
2857,
532,
15,
13,
27037,
21734,
1959,
532,
15,
13,
2998,
19,
29769,
2857,
532,
15,
13,
15,
37601,
1899,
5607,
657,
13,
28567,
1899,
46519,
532,
15,
13,
28041,
30484,
2791,
532,
15,
13,
45987,
5999,
25948,
532,
15,
13,
2999,
940,
2816,
940,
532,
15,
13,
2919,
2079,
1065,
3132,
532,
15,
13,
2919,
20986,
29022,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
405,
4349,
486,
2998,
657,
13,
18005,
1485,
4051,
532,
15,
13,
830,
2670,
38073,
532,
15,
13,
830,
1954,
21738,
657,
13,
830,
2327,
48365,
657,
13,
830,
28978,
2078,
532,
15,
13,
28041,
30484,
2791,
657,
13,
18005,
27712,
20,
532,
15,
13,
830,
2857,
22047,
532,
15,
13,
830,
27033,
1795,
657,
13,
830,
28771,
3829,
657,
13,
830,
19,
21738,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2999,
28676,
20233,
532,
15,
13,
830,
2670,
32220,
657,
13,
1157,
24760,
23756,
657,
13,
30273,
1415,
27310,
657,
13,
25257,
2231,
35447,
657,
13,
25257,
25022,
3829,
532,
15,
13,
45987,
5999,
25948,
532,
15,
13,
830,
2857,
22047,
657,
13,
1485,
2091,
26704,
18,
657,
13,
486,
26704,
35978,
657,
13,
486,
8784,
46951,
657,
13,
28694,
1828,
20370,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
486,
38905,
40256,
532,
15,
13,
830,
1731,
18376,
657,
13,
486,
2623,
4089,
4761,
657,
13,
8628,
3104,
16243,
657,
13,
486,
3270,
42947,
16,
532,
15,
13,
45310,
4310,
27037,
532,
15,
13,
2999,
940,
2816,
940,
532,
15,
13,
830,
27033,
1795,
657,
13,
486,
26704,
35978,
657,
13,
1558,
31916,
37710,
657,
13,
33618,
2079,
29334,
532,
15,
13,
3070,
25257,
37710,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
2998,
2670,
1495,
1065,
657,
13,
830,
28460,
2857,
657,
13,
28694,
33459,
1983,
657,
13,
27037,
2414,
17032,
657,
13,
25475,
2816,
405,
657,
13,
2713,
1507,
1983,
1983,
532,
15,
13,
2919,
2079,
1065,
3132,
657,
13,
830,
28771,
3829,
657,
13,
486,
8784,
46951,
657,
13,
33618,
2079,
29334,
657,
13,
17572,
2154,
47582,
657,
13,
3312,
1983,
2091,
4304,
198,
220,
220,
220,
220,
220,
220,
220,
532,
15,
13,
3312,
1795,
5999,
1415,
657,
13,
830,
2327,
24940,
657,
13,
405,
1795,
1495,
6052,
532,
15,
13,
45310,
2231,
46302,
657,
13,
2713,
1507,
5607,
3682,
657,
13,
11442,
1899,
35133,
532,
15,
13,
2919,
20986,
29022,
657,
13,
830,
38547,
3829,
657,
13,
28694,
1828,
20370,
532,
15,
13,
3070,
25257,
37710,
657,
13,
3312,
1983,
2091,
4304,
657,
13,
20107,
2079,
32220,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
930,
29,
198,
220,
220,
220,
220,
220,
220,
220,
2332,
2781,
666,
374,
83,
349,
796,
352,
68,
12,
18,
198,
220,
220,
220,
2488,
9288,
18074,
225,
15139,
230,
685,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
3270,
24339,
1129,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
486,
18444,
1507,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
27824,
2780,
3134,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
19,
11645,
35195,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
27790,
20,
16799,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
32459,
1959,
2075,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
3270,
5066,
27033,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
486,
1314,
42691,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
24760,
1507,
5999,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
19,
22186,
38314,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
42947,
3720,
4051,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
2718,
2078,
20356,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
374,
83,
349,
796,
352,
68,
12,
19,
198,
437,
198
] | 1.873786 | 2,575 |
module SplitApplyCombine
using Base: @propagate_inbounds, @pure, promote_op
using Indexing
# Syntax
export @_
# collections -> scalar
export only
# collections -> collections
import Base: merge, merge!
export mapmany
# collections -> collections of collections
export group, groupinds, Groups, groupview, groupreduce, splitdims, splitdimsview, SplitDimsArray
# colletions of collections -> collections
export flatten #, flattenview
# collections of collections -> collections of collections
export innerjoin, ⨝, leftgroupjoin
# `pivot` or similar - like transpose, but nested.
include("only.jl")
include("merge.jl")
include("map.jl")
include("group.jl")
include("innerjoin.jl")
include("leftgroupjoin.jl")
include("splitdims.jl")
# Syntax
include("underscore.jl")
# Silly definitions missing from Base
# ===================================
# this should always work
Base.haskey(a, i) = i ∈ keys(a)
# mini-compat (more for my knowledge than anything)
if VERSION < v"0.7-"
Base.keys(v::AbstractVector) = indices(v)[1]
Base.keys(a::AbstractArray) = CartesianRange(indices(a)...)
Base.keys(::NTuple{N,Any}) where {N} = Base.OneTo(N)
Base.keys(::Number) = Base.OneTo(1)
# A Nullable is a container with 0 or 1 values... so...
Base.start(::Nullable) = false
Base.done(n::Nullable, i::Bool) = isnull(n) | i
Base.next(n::Nullable, i::Bool) = (n.valie, true)
Base.first(n::Nullable) = get(n)
Base.last(n::Nullable) = get(n)
@propagate_inbounds function Base.getindex(n::Nullable)
@boundscheck if !n.hasvalue
return NullException()
end
return n.value
end
end
end # module
# Random thoughts:
# merge! many other mutating ops returns collection, so:
# why does setindex! return the set value(s), not the collection???
| [
21412,
27758,
44836,
20575,
500,
198,
198,
3500,
7308,
25,
2488,
22930,
37861,
62,
259,
65,
3733,
11,
2488,
37424,
11,
7719,
62,
404,
198,
3500,
12901,
278,
198,
198,
2,
26375,
897,
198,
39344,
2488,
62,
198,
198,
2,
17268,
4613,
16578,
283,
198,
39344,
691,
198,
198,
2,
17268,
4613,
17268,
198,
11748,
7308,
25,
20121,
11,
20121,
0,
198,
39344,
3975,
21834,
198,
198,
2,
17268,
4613,
17268,
286,
17268,
198,
39344,
1448,
11,
1448,
521,
82,
11,
27441,
11,
1448,
1177,
11,
1448,
445,
7234,
11,
6626,
67,
12078,
11,
6626,
67,
12078,
1177,
11,
27758,
35,
12078,
19182,
198,
198,
2,
951,
1616,
507,
286,
17268,
4613,
17268,
198,
39344,
27172,
268,
1303,
11,
27172,
268,
1177,
198,
198,
2,
17268,
286,
17268,
4613,
17268,
286,
17268,
198,
39344,
8434,
22179,
11,
2343,
101,
251,
11,
1364,
8094,
22179,
198,
2,
4600,
79,
45785,
63,
393,
2092,
532,
588,
1007,
3455,
11,
475,
28376,
13,
198,
198,
17256,
7203,
8807,
13,
20362,
4943,
198,
17256,
7203,
647,
469,
13,
20362,
4943,
198,
17256,
7203,
8899,
13,
20362,
4943,
198,
17256,
7203,
8094,
13,
20362,
4943,
198,
17256,
7203,
5083,
22179,
13,
20362,
4943,
198,
17256,
7203,
9464,
8094,
22179,
13,
20362,
4943,
198,
17256,
7203,
35312,
67,
12078,
13,
20362,
4943,
198,
198,
2,
26375,
897,
198,
17256,
7203,
41116,
7295,
13,
20362,
4943,
628,
198,
2,
311,
6548,
17336,
4814,
422,
7308,
198,
2,
46111,
855,
198,
2,
428,
815,
1464,
670,
198,
14881,
13,
10134,
2539,
7,
64,
11,
1312,
8,
796,
1312,
18872,
230,
8251,
7,
64,
8,
220,
198,
198,
2,
9927,
12,
5589,
265,
357,
3549,
329,
616,
3725,
621,
1997,
8,
198,
361,
44156,
2849,
1279,
410,
1,
15,
13,
22,
21215,
198,
220,
220,
220,
7308,
13,
13083,
7,
85,
3712,
23839,
38469,
8,
796,
36525,
7,
85,
38381,
16,
60,
198,
220,
220,
220,
7308,
13,
13083,
7,
64,
3712,
23839,
19182,
8,
796,
13690,
35610,
17257,
7,
521,
1063,
7,
64,
8,
23029,
198,
220,
220,
220,
7308,
13,
13083,
7,
3712,
11251,
29291,
90,
45,
11,
7149,
30072,
810,
1391,
45,
92,
796,
7308,
13,
3198,
2514,
7,
45,
8,
198,
220,
220,
220,
7308,
13,
13083,
7,
3712,
15057,
8,
796,
7308,
13,
3198,
2514,
7,
16,
8,
628,
220,
220,
220,
1303,
317,
35886,
540,
318,
257,
9290,
351,
657,
393,
352,
3815,
986,
523,
986,
198,
220,
220,
220,
7308,
13,
9688,
7,
3712,
35067,
540,
8,
796,
3991,
198,
220,
220,
220,
7308,
13,
28060,
7,
77,
3712,
35067,
540,
11,
1312,
3712,
33,
970,
8,
796,
2125,
724,
7,
77,
8,
930,
1312,
198,
220,
220,
220,
7308,
13,
19545,
7,
77,
3712,
35067,
540,
11,
1312,
3712,
33,
970,
8,
796,
357,
77,
13,
2100,
494,
11,
2081,
8,
198,
220,
220,
220,
7308,
13,
11085,
7,
77,
3712,
35067,
540,
8,
796,
651,
7,
77,
8,
198,
220,
220,
220,
7308,
13,
12957,
7,
77,
3712,
35067,
540,
8,
796,
651,
7,
77,
8,
198,
220,
220,
220,
2488,
22930,
37861,
62,
259,
65,
3733,
2163,
7308,
13,
1136,
9630,
7,
77,
3712,
35067,
540,
8,
198,
220,
220,
220,
2488,
7784,
15952,
694,
611,
5145,
77,
13,
10134,
8367,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
35886,
16922,
3419,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
299,
13,
8367,
198,
437,
198,
198,
437,
628,
198,
437,
1303,
8265,
198,
198,
2,
14534,
6066,
25,
198,
198,
2,
20121,
0,
867,
584,
4517,
803,
39628,
5860,
4947,
11,
523,
25,
198,
2,
1521,
857,
900,
9630,
0,
1441,
262,
900,
1988,
7,
82,
828,
407,
262,
4947,
28358,
198
] | 2.899514 | 617 |
# This file is auto-generated by AWSMetadata.jl
using AWS
using AWS.AWSServices: iot_events_data
using AWS.Compat
using AWS.UUIDs
"""
batch_put_message(messages)
batch_put_message(messages, params::Dict{String,<:Any})
Sends a set of messages to the AWS IoT Events system. Each message payload is transformed
into the input you specify (\"inputName\") and ingested into any detectors that monitor
that input. If multiple messages are sent, the order in which the messages are processed
isn't guaranteed. To guarantee ordering, you must send messages one at a time and wait for
a successful response.
# Arguments
- `messages`: The list of messages to send. Each message has the following format: '{
\"messageId\": \"string\", \"inputName\": \"string\", \"payload\": \"string\"}'
"""
batch_put_message(messages; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("POST", "/inputs/messages", Dict{String, Any}("messages"=>messages); aws_config=aws_config)
batch_put_message(messages, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("POST", "/inputs/messages", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("messages"=>messages), params)); aws_config=aws_config)
"""
batch_update_detector(detectors)
batch_update_detector(detectors, params::Dict{String,<:Any})
Updates the state, variable values, and timer settings of one or more detectors (instances)
of a specified detector model.
# Arguments
- `detectors`: The list of detectors (instances) to update, along with the values to update.
"""
batch_update_detector(detectors; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("POST", "/detectors", Dict{String, Any}("detectors"=>detectors); aws_config=aws_config)
batch_update_detector(detectors, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("POST", "/detectors", Dict{String, Any}(mergewith(_merge, Dict{String, Any}("detectors"=>detectors), params)); aws_config=aws_config)
"""
describe_detector(detector_model_name)
describe_detector(detector_model_name, params::Dict{String,<:Any})
Returns information about the specified detector (instance).
# Arguments
- `detector_model_name`: The name of the detector model whose detectors (instances) you
want information about.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"keyValue"`: A filter used to limit results to detectors (instances) created because of
the given key ID.
"""
describe_detector(detectorModelName; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("GET", "/detectors/$(detectorModelName)/keyValues/"; aws_config=aws_config)
describe_detector(detectorModelName, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("GET", "/detectors/$(detectorModelName)/keyValues/", params; aws_config=aws_config)
"""
list_detectors(detector_model_name)
list_detectors(detector_model_name, params::Dict{String,<:Any})
Lists detectors (the instances of a detector model).
# Arguments
- `detector_model_name`: The name of the detector model whose detectors (instances) are
listed.
# Optional Parameters
Optional parameters can be passed as a `params::Dict{String,<:Any}`. Valid keys are:
- `"maxResults"`: The maximum number of results to return at one time.
- `"nextToken"`: The token for the next set of results.
- `"stateName"`: A filter that limits results to those detectors (instances) in the given
state.
"""
list_detectors(detectorModelName; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("GET", "/detectors/$(detectorModelName)"; aws_config=aws_config)
list_detectors(detectorModelName, params::AbstractDict{String, <:Any}; aws_config::AbstractAWSConfig=global_aws_config()) = iot_events_data("GET", "/detectors/$(detectorModelName)", params; aws_config=aws_config)
| [
2,
770,
2393,
318,
8295,
12,
27568,
416,
30865,
9171,
14706,
13,
20362,
198,
3500,
30865,
198,
3500,
30865,
13,
12298,
5432,
712,
1063,
25,
1312,
313,
62,
31534,
62,
7890,
198,
3500,
30865,
13,
40073,
198,
3500,
30865,
13,
52,
27586,
82,
198,
198,
37811,
198,
220,
220,
220,
15458,
62,
1996,
62,
20500,
7,
37348,
1095,
8,
198,
220,
220,
220,
15458,
62,
1996,
62,
20500,
7,
37348,
1095,
11,
42287,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
30072,
198,
198,
50,
2412,
257,
900,
286,
6218,
284,
262,
30865,
38488,
18715,
1080,
13,
5501,
3275,
21437,
318,
14434,
198,
20424,
262,
5128,
345,
11986,
357,
7879,
15414,
5376,
59,
4943,
290,
44694,
656,
597,
40471,
326,
5671,
198,
5562,
5128,
13,
1002,
3294,
6218,
389,
1908,
11,
262,
1502,
287,
543,
262,
6218,
389,
13686,
198,
271,
77,
470,
11462,
13,
1675,
9149,
16216,
11,
345,
1276,
3758,
6218,
530,
379,
257,
640,
290,
4043,
329,
198,
64,
4388,
2882,
13,
198,
198,
2,
20559,
2886,
198,
12,
4600,
37348,
1095,
63,
25,
383,
1351,
286,
6218,
284,
3758,
13,
5501,
3275,
468,
262,
1708,
5794,
25,
705,
90,
198,
220,
19990,
20500,
7390,
30478,
19990,
8841,
34607,
19990,
15414,
5376,
30478,
19990,
8841,
34607,
19990,
15577,
2220,
30478,
19990,
8841,
7879,
92,
6,
198,
198,
37811,
198,
43501,
62,
1996,
62,
20500,
7,
37348,
1095,
26,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
32782,
1600,
12813,
15414,
82,
14,
37348,
1095,
1600,
360,
713,
90,
10100,
11,
4377,
92,
7203,
37348,
1095,
1,
14804,
37348,
1095,
1776,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
43501,
62,
1996,
62,
20500,
7,
37348,
1095,
11,
42287,
3712,
23839,
35,
713,
90,
10100,
11,
1279,
25,
7149,
19629,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
32782,
1600,
12813,
15414,
82,
14,
37348,
1095,
1600,
360,
713,
90,
10100,
11,
4377,
92,
7,
647,
39909,
342,
28264,
647,
469,
11,
360,
713,
90,
10100,
11,
4377,
92,
7203,
37348,
1095,
1,
14804,
37348,
1095,
828,
42287,
18125,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
198,
37811,
198,
220,
220,
220,
15458,
62,
19119,
62,
15255,
9250,
7,
15255,
478,
669,
8,
198,
220,
220,
220,
15458,
62,
19119,
62,
15255,
9250,
7,
15255,
478,
669,
11,
42287,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
30072,
198,
198,
4933,
19581,
262,
1181,
11,
7885,
3815,
11,
290,
19781,
6460,
286,
530,
393,
517,
40471,
357,
8625,
1817,
8,
198,
1659,
257,
7368,
31029,
2746,
13,
198,
198,
2,
20559,
2886,
198,
12,
4600,
15255,
478,
669,
63,
25,
383,
1351,
286,
40471,
357,
8625,
1817,
8,
284,
4296,
11,
1863,
351,
262,
3815,
284,
4296,
13,
198,
198,
37811,
198,
43501,
62,
19119,
62,
15255,
9250,
7,
15255,
478,
669,
26,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
32782,
1600,
12813,
15255,
478,
669,
1600,
360,
713,
90,
10100,
11,
4377,
92,
7203,
15255,
478,
669,
1,
14804,
15255,
478,
669,
1776,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
43501,
62,
19119,
62,
15255,
9250,
7,
15255,
478,
669,
11,
42287,
3712,
23839,
35,
713,
90,
10100,
11,
1279,
25,
7149,
19629,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
32782,
1600,
12813,
15255,
478,
669,
1600,
360,
713,
90,
10100,
11,
4377,
92,
7,
647,
39909,
342,
28264,
647,
469,
11,
360,
713,
90,
10100,
11,
4377,
92,
7203,
15255,
478,
669,
1,
14804,
15255,
478,
669,
828,
42287,
18125,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
198,
37811,
198,
220,
220,
220,
6901,
62,
15255,
9250,
7,
15255,
9250,
62,
19849,
62,
3672,
8,
198,
220,
220,
220,
6901,
62,
15255,
9250,
7,
15255,
9250,
62,
19849,
62,
3672,
11,
42287,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
30072,
198,
198,
35561,
1321,
546,
262,
7368,
31029,
357,
39098,
737,
198,
198,
2,
20559,
2886,
198,
12,
4600,
15255,
9250,
62,
19849,
62,
3672,
63,
25,
383,
1438,
286,
262,
31029,
2746,
3025,
40471,
357,
8625,
1817,
8,
345,
198,
220,
765,
1321,
546,
13,
198,
198,
2,
32233,
40117,
198,
30719,
10007,
460,
307,
3804,
355,
257,
4600,
37266,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
92,
44646,
48951,
8251,
389,
25,
198,
12,
4600,
1,
2539,
11395,
1,
63,
25,
317,
8106,
973,
284,
4179,
2482,
284,
40471,
357,
8625,
1817,
8,
2727,
780,
286,
198,
220,
262,
1813,
1994,
4522,
13,
198,
37811,
198,
20147,
4892,
62,
15255,
9250,
7,
15255,
9250,
17633,
5376,
26,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
18851,
1600,
12813,
15255,
478,
669,
32624,
7,
15255,
9250,
17633,
5376,
20679,
2539,
40161,
14,
8172,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
20147,
4892,
62,
15255,
9250,
7,
15255,
9250,
17633,
5376,
11,
42287,
3712,
23839,
35,
713,
90,
10100,
11,
1279,
25,
7149,
19629,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
18851,
1600,
12813,
15255,
478,
669,
32624,
7,
15255,
9250,
17633,
5376,
20679,
2539,
40161,
14,
1600,
42287,
26,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
198,
37811,
198,
220,
220,
220,
1351,
62,
15255,
478,
669,
7,
15255,
9250,
62,
19849,
62,
3672,
8,
198,
220,
220,
220,
1351,
62,
15255,
478,
669,
7,
15255,
9250,
62,
19849,
62,
3672,
11,
42287,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
30072,
198,
198,
43,
1023,
40471,
357,
1169,
10245,
286,
257,
31029,
2746,
737,
198,
198,
2,
20559,
2886,
198,
12,
4600,
15255,
9250,
62,
19849,
62,
3672,
63,
25,
383,
1438,
286,
262,
31029,
2746,
3025,
40471,
357,
8625,
1817,
8,
389,
198,
220,
5610,
13,
198,
198,
2,
32233,
40117,
198,
30719,
10007,
460,
307,
3804,
355,
257,
4600,
37266,
3712,
35,
713,
90,
10100,
11,
27,
25,
7149,
92,
44646,
48951,
8251,
389,
25,
198,
12,
4600,
1,
9806,
25468,
1,
63,
25,
383,
5415,
1271,
286,
2482,
284,
1441,
379,
530,
640,
13,
198,
12,
4600,
1,
19545,
30642,
1,
63,
25,
383,
11241,
329,
262,
1306,
900,
286,
2482,
13,
198,
12,
4600,
1,
5219,
5376,
1,
63,
25,
317,
8106,
326,
7095,
2482,
284,
883,
40471,
357,
8625,
1817,
8,
287,
262,
1813,
198,
220,
1181,
13,
198,
37811,
198,
4868,
62,
15255,
478,
669,
7,
15255,
9250,
17633,
5376,
26,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
18851,
1600,
12813,
15255,
478,
669,
32624,
7,
15255,
9250,
17633,
5376,
8,
8172,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198,
4868,
62,
15255,
478,
669,
7,
15255,
9250,
17633,
5376,
11,
42287,
3712,
23839,
35,
713,
90,
10100,
11,
1279,
25,
7149,
19629,
3253,
82,
62,
11250,
3712,
23839,
12298,
50,
16934,
28,
20541,
62,
8356,
62,
11250,
28955,
796,
1312,
313,
62,
31534,
62,
7890,
7203,
18851,
1600,
12813,
15255,
478,
669,
32624,
7,
15255,
9250,
17633,
5376,
42501,
42287,
26,
3253,
82,
62,
11250,
28,
8356,
62,
11250,
8,
198
] | 3.133229 | 1,276 |