content
stringlengths 5
1.03M
| input_ids
sequencelengths 4
823k
| ratio_char_token
float64 0.4
12.5
| token_count
int64 4
823k
|
---|---|---|---|
"""
newtonroot(f[, f']; x0 = 0.8, tolerance = 1.e-13, maxiter = 1000)
This function computes the local root of a univariate smooth function `f(x)` using the Newton's Method. This method starts with a `x_0` guess, a function `f(x)` and the first-derivative `f'(x)`. The algorithm follows: `` x^{n+1} = x^n - f(x^n)/f'(x^n) `` until `` |x^{n+1} - x^n|`` is below the tolerance level.
...
# Arguments
- `f(x)::Function`: the function you are trying to solve.
- `f'(x)::Function`: the first derivative of the function you are trying to solve. If it is not given the program estimate `f'(x)` using ForwardDiff.
- `x0::Float64`: the initial value for the algorithm. The default value is 0.8.
- `tolerance::Float64` : the minimum tolerance for the algorithm to converge. The default value is 1.0e-13.
- `maxiter::Int64`: the maximum number of iterations allowed. The default value is 1000.
---
# Examples
```julia-repl
julia> f(x) = (x - 2)^2
f (generic function with 1 method)
julia> df(x) = 2(x - 2)
df (generic function with 1 method)
julia> newtonroot(f,df)
(value = 1.9999999999999318, normdiff = 6.816769371198461e-14, iter = 45)
julia> a = newtonroot(f)[1]
1.9999999999999318
julia> newtonroot(f)[1] ≈ 2
true
```
...
"""
function newtonroot(f, f_prime; x0=0.8, tolerance=1.0E-13, maxiter=1000)
# Initial values
v_old = x0
normdiff = Inf
iter = 1
# Running the algorithm
while (normdiff > tolerance) && (iter < maxiter)
if !(f_prime(v_old) == 0)
v_new = v_old - (f(v_old) / f_prime(v_old))
normdiff = norm(v_new - v_old)
# replace and continue
v_old = v_new
iter = iter + 1
else
return(value = nothing, normdiff = nothing, iter = nothing)
end
end
if (iter < maxiter)
return(value = v_old, normdiff = normdiff, iter = iter)
else
return(value = nothing, normdiff = nothing, iter = nothing)
end
end
function newtonroot(f; x0=0.8, tolerance=1.0E-13, maxiter=1000)
# Initial values
v_old = x0
normdiff = Inf
iter = 1
# Taking the derivative
D(f) = x -> ForwardDiff.derivative(f, x)
f_prime = D(f)
# Running the algorithm
while (normdiff > tolerance) && (iter < maxiter)
if !(f_prime(v_old) == 0)
v_new = v_old - (f(v_old) / f_prime(v_old))
normdiff = norm(v_new - v_old)
# replace and continue
v_old = v_new
iter = iter + 1
else
return(value = nothing, normdiff = nothing, iter = nothing)
end
end
if (iter < maxiter)
return(value = v_old, normdiff = normdiff, iter = iter)
else
return(value = nothing, normdiff = nothing, iter = nothing)
end
end
| [
198,
37811,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
1122,
15763,
7,
69,
58,
11,
277,
6,
11208,
2124,
15,
796,
657,
13,
23,
11,
15621,
796,
352,
13,
68,
12,
1485,
11,
3509,
2676,
796,
8576,
8,
628,
198,
1212,
2163,
552,
1769,
262,
1957,
6808,
286,
257,
555,
42524,
7209,
2163,
4600,
69,
7,
87,
8,
63,
1262,
262,
17321,
338,
11789,
13,
770,
2446,
4940,
351,
257,
220,
4600,
87,
62,
15,
63,
4724,
11,
257,
2163,
4600,
69,
7,
87,
8,
63,
290,
262,
717,
12,
1082,
452,
876,
220,
4600,
69,
6,
7,
87,
8,
44646,
383,
11862,
5679,
25,
7559,
2124,
36796,
77,
10,
16,
92,
796,
2124,
61,
77,
532,
277,
7,
87,
61,
77,
20679,
69,
6,
7,
87,
61,
77,
8,
7559,
1566,
7559,
930,
87,
36796,
77,
10,
16,
92,
532,
2124,
61,
77,
91,
15506,
318,
2174,
262,
15621,
1241,
13,
198,
220,
198,
986,
198,
2,
20559,
2886,
198,
12,
4600,
69,
7,
87,
2599,
25,
22203,
63,
25,
262,
2163,
345,
389,
2111,
284,
8494,
13,
198,
12,
4600,
69,
6,
7,
87,
2599,
25,
22203,
63,
25,
262,
717,
27255,
286,
262,
2163,
345,
389,
2111,
284,
8494,
13,
1002,
340,
318,
407,
1813,
262,
1430,
8636,
4600,
69,
6,
7,
87,
8,
63,
1262,
19530,
28813,
13,
198,
12,
4600,
87,
15,
3712,
43879,
2414,
63,
25,
262,
4238,
1988,
329,
262,
11862,
13,
383,
4277,
1988,
318,
657,
13,
23,
13,
198,
12,
4600,
83,
37668,
3712,
43879,
2414,
63,
1058,
262,
5288,
15621,
329,
262,
11862,
284,
47873,
13,
383,
4277,
1988,
318,
352,
13,
15,
68,
12,
1485,
13,
198,
12,
4600,
9806,
2676,
3712,
5317,
2414,
63,
25,
262,
5415,
1271,
286,
34820,
3142,
13,
383,
4277,
1988,
318,
8576,
13,
198,
6329,
198,
2,
21066,
198,
15506,
63,
73,
43640,
12,
35666,
198,
73,
43640,
29,
277,
7,
87,
8,
220,
796,
220,
357,
87,
532,
362,
8,
61,
17,
198,
69,
357,
41357,
2163,
351,
352,
2446,
8,
198,
198,
73,
43640,
29,
47764,
7,
87,
8,
796,
362,
7,
87,
532,
362,
8,
198,
7568,
357,
41357,
2163,
351,
352,
2446,
8,
198,
198,
73,
43640,
29,
649,
1122,
15763,
7,
69,
11,
7568,
8,
198,
7,
8367,
796,
352,
13,
24214,
24214,
24214,
6052,
1507,
11,
2593,
26069,
796,
718,
13,
23,
21940,
3388,
2718,
16315,
23,
40652,
68,
12,
1415,
11,
11629,
796,
4153,
8,
198,
198,
73,
43640,
29,
257,
796,
649,
1122,
15763,
7,
69,
38381,
16,
60,
198,
16,
13,
24214,
24214,
24214,
6052,
1507,
198,
198,
73,
43640,
29,
649,
1122,
15763,
7,
69,
38381,
16,
60,
15139,
230,
362,
198,
7942,
198,
15506,
63,
198,
986,
198,
198,
37811,
198,
8818,
649,
1122,
15763,
7,
69,
11,
277,
62,
35505,
26,
2124,
15,
28,
15,
13,
23,
11,
15621,
28,
16,
13,
15,
36,
12,
1485,
11,
3509,
2676,
28,
12825,
8,
198,
220,
220,
220,
1303,
20768,
3815,
198,
220,
220,
220,
410,
62,
727,
796,
2124,
15,
198,
220,
220,
220,
2593,
26069,
796,
4806,
198,
220,
220,
220,
11629,
796,
352,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
18162,
262,
11862,
220,
198,
220,
220,
220,
981,
357,
27237,
26069,
1875,
15621,
8,
220,
11405,
357,
2676,
1279,
3509,
2676,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
7,
69,
62,
35505,
7,
85,
62,
727,
8,
6624,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
410,
62,
3605,
796,
410,
62,
727,
532,
357,
69,
7,
85,
62,
727,
8,
1220,
277,
62,
35505,
7,
85,
62,
727,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
26069,
796,
2593,
7,
85,
62,
3605,
532,
410,
62,
727,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6330,
290,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
410,
62,
727,
796,
410,
62,
3605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11629,
796,
11629,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
2147,
11,
2593,
26069,
796,
2147,
11,
11629,
796,
2147,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
357,
2676,
1279,
3509,
2676,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
410,
62,
727,
11,
2593,
26069,
796,
2593,
26069,
11,
11629,
796,
11629,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
2147,
11,
2593,
26069,
796,
2147,
11,
11629,
796,
2147,
8,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
649,
1122,
15763,
7,
69,
26,
2124,
15,
28,
15,
13,
23,
11,
15621,
28,
16,
13,
15,
36,
12,
1485,
11,
3509,
2676,
28,
12825,
8,
198,
220,
220,
220,
1303,
20768,
3815,
198,
220,
220,
220,
410,
62,
727,
796,
2124,
15,
198,
220,
220,
220,
2593,
26069,
796,
4806,
198,
220,
220,
220,
11629,
796,
352,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
20879,
262,
27255,
198,
220,
220,
220,
360,
7,
69,
8,
796,
2124,
4613,
19530,
28813,
13,
1082,
452,
876,
7,
69,
11,
2124,
8,
198,
220,
220,
220,
277,
62,
35505,
796,
360,
7,
69,
8,
628,
220,
220,
220,
1303,
18162,
262,
11862,
220,
628,
220,
220,
220,
981,
357,
27237,
26069,
1875,
15621,
8,
220,
11405,
357,
2676,
1279,
3509,
2676,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
7,
69,
62,
35505,
7,
85,
62,
727,
8,
6624,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
410,
62,
3605,
796,
410,
62,
727,
532,
357,
69,
7,
85,
62,
727,
8,
1220,
277,
62,
35505,
7,
85,
62,
727,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2593,
26069,
796,
2593,
7,
85,
62,
3605,
532,
410,
62,
727,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
6330,
290,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
410,
62,
727,
796,
410,
62,
3605,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
11629,
796,
11629,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
2147,
11,
2593,
26069,
796,
2147,
11,
11629,
796,
2147,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
357,
2676,
1279,
3509,
2676,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
410,
62,
727,
11,
2593,
26069,
796,
2593,
26069,
11,
11629,
796,
11629,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
7,
8367,
796,
2147,
11,
2593,
26069,
796,
2147,
11,
11629,
796,
2147,
8,
198,
220,
220,
220,
886,
198,
437,
198
] | 2.302135 | 1,218 |
#=win.jl - replay the game fromstart to finish, at every step checking if the game
is won. If the game is won, print ”B” for Black winning, and ”W” for white winning. If black resigned,
print ”R”. If white resigned, print ”r”. If the game is on, print ”?”. If the game is a draw, print
”D”.
Accepts 1 command line argument,<filename> => database
=#
include("board.jl")
include("dParse.jl")
module win
using BM
using SQLite
function winner()
database = ARGS[1] #/path/to/database/file {string}
db = SQLite.DB(database) #Opens the database gamefile
board = BM.startGame("standard")
state = board.state
res = "?"
maxMove = parse(get(SQLite.query(db, """SELECT max(move_number) from moves;""")[1,1]))
for x in 1:maxMove #iterates through each row of the database
dataMove = SQLite.query(db, """SELECT move_number, move_type, targetx, targety,sourcex,sourcey FROM moves WHERE "move_number" = '$x'""")
move_type = get(dataMove[1,2])
if !isnull(dataMove[1,3])
targetx = parse(get(dataMove[1,3]))
targety = parse(get(dataMove[1,4]))
end
#Case 1: Resigned
if move_type == "resign"
if iseven(x) == true
res="r"
else #x is odd
res="R"
end
#Case 2: Win
#Game is won on the move that captures a king
#I implemented win where, if the target X Y location of the current move is a king, it means the king is captpured so the other team wins
elseif ( get(state,(targetx,targety),('x','x'))[1] == 'k') #uses function from spuare.jl
if (get(state,(targetx,targety),('x','x'))[2] == 'b')
res = "W"
else #board[targetx][targety].team == "w"
res = "B"
end
end
if !(isnull(dataMove[1,5])) #type:move
sourcex=parse(get(dataMove[1,5]))
sourcey=parse(get(dataMove[1,6]))
state[(targetx,targety)] = deepcopy(state[(sourcex,sourcey)]) #Updates the board before next move
delete!(state,(sourcex,sourcey))
end
end
return res
end #End function
res = winner()
println(res)
end
| [
2,
28,
5404,
13,
20362,
532,
24788,
262,
983,
422,
9688,
284,
5461,
11,
379,
790,
2239,
10627,
611,
262,
983,
198,
271,
1839,
13,
1002,
262,
983,
318,
1839,
11,
3601,
564,
251,
33,
447,
251,
329,
2619,
5442,
11,
290,
564,
251,
54,
447,
251,
329,
2330,
5442,
13,
1002,
2042,
16542,
11,
198,
4798,
564,
251,
49,
447,
251,
13,
1002,
2330,
16542,
11,
3601,
564,
251,
81,
447,
251,
13,
1002,
262,
983,
318,
319,
11,
3601,
564,
251,
30,
447,
251,
13,
1002,
262,
983,
318,
257,
3197,
11,
3601,
198,
447,
251,
35,
447,
251,
13,
198,
38855,
82,
352,
3141,
1627,
4578,
11,
27,
34345,
29,
5218,
6831,
198,
46249,
198,
17256,
7203,
3526,
13,
20362,
4943,
198,
17256,
7203,
67,
10044,
325,
13,
20362,
4943,
198,
21412,
1592,
198,
3500,
29944,
198,
220,
1262,
16363,
578,
198,
198,
8818,
8464,
3419,
198,
220,
6831,
796,
5923,
14313,
58,
16,
60,
1303,
14,
6978,
14,
1462,
14,
48806,
14,
7753,
1391,
8841,
92,
198,
220,
20613,
796,
16363,
578,
13,
11012,
7,
48806,
8,
220,
1303,
18257,
641,
262,
6831,
983,
7753,
198,
220,
3096,
796,
29944,
13,
9688,
8777,
7203,
20307,
4943,
198,
220,
1181,
796,
3096,
13,
5219,
198,
220,
581,
796,
366,
1701,
198,
220,
3509,
21774,
796,
21136,
7,
1136,
7,
17861,
578,
13,
22766,
7,
9945,
11,
37227,
46506,
3509,
7,
21084,
62,
17618,
8,
422,
6100,
26,
15931,
4943,
58,
16,
11,
16,
60,
4008,
198,
220,
329,
2124,
287,
352,
25,
9806,
21774,
220,
1303,
2676,
689,
832,
1123,
5752,
286,
262,
6831,
198,
220,
220,
220,
1366,
21774,
796,
16363,
578,
13,
22766,
7,
9945,
11,
37227,
46506,
1445,
62,
17618,
11,
1445,
62,
4906,
11,
2496,
87,
11,
2496,
88,
11,
10459,
87,
11,
10459,
88,
16034,
6100,
33411,
366,
21084,
62,
17618,
1,
796,
705,
3,
87,
6,
15931,
4943,
198,
220,
220,
220,
1445,
62,
4906,
796,
651,
7,
7890,
21774,
58,
16,
11,
17,
12962,
198,
220,
220,
220,
611,
5145,
271,
8423,
7,
7890,
21774,
58,
16,
11,
18,
12962,
198,
220,
220,
220,
2496,
87,
796,
21136,
7,
1136,
7,
7890,
21774,
58,
16,
11,
18,
60,
4008,
198,
220,
220,
220,
2496,
88,
796,
21136,
7,
1136,
7,
7890,
21774,
58,
16,
11,
19,
60,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
20448,
352,
25,
1874,
3916,
198,
220,
220,
220,
611,
1445,
62,
4906,
6624,
366,
411,
570,
1,
198,
220,
220,
220,
220,
220,
611,
318,
10197,
7,
87,
8,
6624,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
581,
2625,
81,
1,
198,
220,
220,
220,
220,
220,
2073,
1303,
87,
318,
5629,
198,
220,
220,
220,
220,
220,
220,
220,
581,
2625,
49,
1,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
20448,
362,
25,
7178,
198,
220,
220,
220,
1303,
8777,
318,
1839,
319,
262,
1445,
326,
23007,
257,
5822,
198,
220,
220,
220,
1303,
40,
9177,
1592,
810,
11,
611,
262,
2496,
1395,
575,
4067,
286,
262,
1459,
1445,
318,
257,
5822,
11,
340,
1724,
262,
5822,
318,
3144,
79,
1522,
523,
262,
584,
1074,
7864,
198,
220,
2073,
361,
357,
651,
7,
5219,
11,
7,
16793,
87,
11,
83,
853,
2963,
828,
10786,
87,
41707,
87,
6,
4008,
58,
16,
60,
6624,
705,
74,
11537,
1303,
2664,
2163,
422,
599,
84,
533,
13,
20362,
198,
220,
220,
220,
220,
220,
611,
357,
1136,
7,
5219,
11,
7,
16793,
87,
11,
83,
853,
2963,
828,
10786,
87,
41707,
87,
6,
4008,
58,
17,
60,
6624,
705,
65,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
366,
54,
1,
198,
220,
220,
220,
220,
220,
2073,
1303,
3526,
58,
16793,
87,
7131,
83,
853,
2963,
4083,
15097,
6624,
366,
86,
1,
198,
220,
220,
220,
220,
220,
220,
220,
581,
796,
366,
33,
1,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
5145,
7,
271,
8423,
7,
7890,
21774,
58,
16,
11,
20,
60,
4008,
1303,
4906,
25,
21084,
198,
197,
220,
220,
220,
2723,
87,
28,
29572,
7,
1136,
7,
7890,
21774,
58,
16,
11,
20,
60,
4008,
198,
197,
220,
220,
220,
2723,
88,
28,
29572,
7,
1136,
7,
7890,
21774,
58,
16,
11,
21,
60,
4008,
198,
220,
220,
220,
220,
220,
1181,
58,
7,
16793,
87,
11,
83,
853,
2963,
15437,
796,
2769,
30073,
7,
5219,
58,
7,
10459,
87,
11,
10459,
88,
8,
12962,
1303,
4933,
19581,
262,
3096,
878,
1306,
1445,
198,
220,
220,
220,
220,
220,
12233,
0,
7,
5219,
11,
7,
10459,
87,
11,
10459,
88,
4008,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
1441,
581,
198,
437,
1303,
12915,
2163,
198,
411,
796,
8464,
3419,
198,
35235,
7,
411,
8,
198,
437,
198
] | 2.482165 | 813 |
module BuildBasis
export buildbasisfunc
using TypesParticles, TypesBasis
@doc raw"""
buildbasisfunction(atomicsystem::SystemOfAtoms,basis::Basis)
Returns atom-centered basis functions and number of electrons.
Description: This function will take the system information and create the basis functions
that are atomically centered. Each basis function will contain the parameters for the Gaussian
functions that when linearly combined make up the basis function. Note that the actual basis
function is not yet constructed here, i.e., we are not taking the summation of Gaussians.
Depends on datatypes in TypesParticles.jl and TypesBasis.jl
""" function buildbasisfunc(atomicsystem::SystemOfAtoms,basis::Basis)
natoms = atomicsystem.natoms;
nelectrons = 0;
#Closed-shell system only
for i=1:natoms
nelectrons += atomicsystem.atoms[i].Z
end
nbasis = basis.nbasisfunc;
basisfunc = Array{GaussOrbitals,2}(undef,natoms,nbasis);
#Assign each atom-centered basis functions
#ie = 1; #total electron counter
for a=1:natoms
#For each gaussian store 5 values: c,alpha,xo,yo,zo
#For Z=1 n-basis per atom is 1 so basisfunc length equal num atoms.
for j=1:nbasis
#6-31 type basis set
if basis.basisfunc[j].info == "6-31"
basisfunc[a,j] = GaussOrbitals(atomicsystem.atoms[a],basis.basisfunc[j])
end
end # nbasis
end # atomicsystem.atoms
return basisfunc,nelectrons
end #buildbasisfunction
end #BuildBasis
| [
21412,
10934,
15522,
271,
198,
198,
39344,
1382,
12093,
4468,
19524,
198,
198,
3500,
24897,
7841,
2983,
11,
24897,
15522,
271,
628,
198,
31,
15390,
8246,
37811,
198,
11249,
12093,
4468,
4575,
7,
265,
31994,
6781,
3712,
11964,
5189,
2953,
3150,
11,
12093,
271,
3712,
15522,
271,
8,
198,
198,
35561,
22037,
12,
38050,
4308,
5499,
290,
1271,
286,
28722,
13,
220,
198,
198,
11828,
25,
770,
2163,
481,
1011,
262,
1080,
1321,
290,
2251,
262,
4308,
5499,
198,
5562,
389,
22037,
1146,
19254,
13,
5501,
4308,
2163,
481,
3994,
262,
10007,
329,
262,
12822,
31562,
198,
12543,
2733,
326,
618,
9493,
11458,
5929,
787,
510,
262,
4308,
2163,
13,
5740,
326,
262,
4036,
4308,
220,
198,
8818,
318,
407,
1865,
12006,
994,
11,
1312,
13,
68,
1539,
356,
389,
407,
2263,
262,
30114,
341,
286,
12822,
1046,
1547,
13,
220,
198,
198,
12156,
2412,
319,
4818,
265,
9497,
287,
24897,
7841,
2983,
13,
20362,
290,
24897,
15522,
271,
13,
20362,
198,
198,
37811,
2163,
1382,
12093,
4468,
19524,
7,
265,
31994,
6781,
3712,
11964,
5189,
2953,
3150,
11,
12093,
271,
3712,
15522,
271,
8,
198,
220,
220,
220,
34664,
3150,
796,
22037,
873,
6781,
13,
32353,
3150,
26,
198,
220,
220,
220,
497,
801,
12212,
796,
657,
26,
628,
220,
220,
220,
1303,
2601,
1335,
12,
29149,
1080,
691,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
32353,
3150,
198,
220,
220,
220,
220,
220,
220,
220,
497,
801,
12212,
15853,
22037,
873,
6781,
13,
265,
3150,
58,
72,
4083,
57,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
299,
12093,
271,
796,
4308,
13,
77,
12093,
4468,
19524,
26,
198,
220,
220,
220,
4308,
20786,
796,
15690,
90,
35389,
1046,
5574,
2545,
874,
11,
17,
92,
7,
917,
891,
11,
32353,
3150,
11,
77,
12093,
271,
1776,
628,
220,
220,
220,
1303,
8021,
570,
1123,
22037,
12,
38050,
4308,
5499,
198,
220,
220,
220,
1303,
494,
796,
352,
26,
1303,
23350,
11538,
3753,
198,
220,
220,
220,
329,
257,
28,
16,
25,
32353,
3150,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1890,
1123,
31986,
31562,
3650,
642,
3815,
25,
269,
11,
26591,
11,
87,
78,
11,
8226,
11,
10872,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1890,
1168,
28,
16,
299,
12,
12093,
271,
583,
22037,
318,
352,
523,
4308,
20786,
4129,
4961,
997,
23235,
13,
220,
198,
220,
220,
220,
220,
220,
220,
220,
329,
474,
28,
16,
25,
77,
12093,
271,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
21,
12,
3132,
2099,
4308,
900,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4308,
13,
12093,
4468,
19524,
58,
73,
4083,
10951,
6624,
366,
21,
12,
3132,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4308,
20786,
58,
64,
11,
73,
60,
796,
220,
12822,
1046,
5574,
2545,
874,
7,
265,
31994,
6781,
13,
265,
3150,
58,
64,
4357,
12093,
271,
13,
12093,
4468,
19524,
58,
73,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
1303,
299,
12093,
271,
198,
220,
220,
220,
886,
1303,
22037,
873,
6781,
13,
265,
3150,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
4308,
20786,
11,
710,
801,
12212,
198,
437,
1303,
11249,
12093,
4468,
4575,
198,
198,
437,
1303,
15580,
15522,
271,
198
] | 2.674699 | 581 |
module JellyFish
using Libdl: find_library
export jaro_winkler, jaro_distance, hamming_distance,
levenshtein_distance, damerau_levenshtein_distance, soundex, metaphone,
match_rating_codex, match_rating_comparison, nysiis
const _jellyfishlib = find_library(["jellyfish"], [joinpath(@__DIR__, "..", "deps")])
macro _calls1s2type(func, returntype, s1, s2)
:(ccall(($(esc(func)), _jellyfishlib), $(esc(returntype)), (Ptr{Cchar}, Ptr{Cchar}), $(esc(s1)), $(esc(s2))))
end
function jaro_winkler(s1::String, s2::String)
ccall((:jaro_winkler, _jellyfishlib), Cdouble, (Ptr{Cchar}, Ptr{Cchar}, Bool), s1, s2, false)
end
function jaro_distance(s1::String, s2::String)
@_calls1s2type(:jaro_distance, Cdouble, s1, s2)
end
function hamming_distance(s1::String, s2::String)
convert(Int, @_calls1s2type(:hamming_distance, Csize_t, s1, s2))
end
function levenshtein_distance(s1::String, s2::String)
@_calls1s2type(:levenshtein_distance, Cint, s1, s2)
end
function damerau_levenshtein_distance(s1::String, s2::String)
@_calls1s2type(:damerau_levenshtein_distance, Cint, s1, s2)
end
# for some reason doesn't work:
function _callstr(func::Symbol, s::String)
r = ccall((func, _jellyfishlib), Ptr{Cchar}, (Ptr{Cchar},), s)
unsafe_string(r)
end
function soundex(s::String)
# _callstr(:soundex, s)
r = ccall((:soundex, _jellyfishlib), Ptr{Cchar}, (Ptr{Cchar},), s)
unsafe_string(r)
end
function metaphone(s::String)
# _callstr(:metaphone, s)
r = ccall((:metaphone, _jellyfishlib), Ptr{Cchar}, (Ptr{Cchar},), s)
unsafe_string(r)
end
function match_rating_codex(s::String)
# _callstr(:match_rating_codex, s)
r = ccall((:match_rating_codex, _jellyfishlib), Ptr{Cchar}, (Ptr{Cchar},), s)
unsafe_string(r)
end
function match_rating_comparison(s1::String, s2::String)
@_calls1s2type(:match_rating_comparison, Bool, s1, s2)
end
function nysiis(s::String)
# _callstr(:nysiis, s)
r = ccall((:nysiis, _jellyfishlib), Ptr{Cchar}, (Ptr{Cchar},), s)
unsafe_string(r)
end
end
| [
21412,
37152,
39428,
198,
197,
3500,
7980,
25404,
25,
1064,
62,
32016,
628,
197,
39344,
474,
12022,
62,
86,
676,
1754,
11,
474,
12022,
62,
30246,
11,
8891,
2229,
62,
30246,
11,
220,
198,
197,
197,
293,
574,
1477,
22006,
62,
30246,
11,
1801,
263,
559,
62,
293,
574,
1477,
22006,
62,
30246,
11,
2128,
1069,
11,
13738,
505,
11,
220,
198,
197,
197,
15699,
62,
8821,
62,
19815,
1069,
11,
2872,
62,
8821,
62,
785,
1845,
1653,
11,
299,
893,
72,
271,
198,
197,
9979,
4808,
73,
6148,
11084,
8019,
796,
1064,
62,
32016,
7,
14692,
73,
6148,
11084,
33116,
685,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
492,
1600,
366,
10378,
82,
4943,
12962,
628,
197,
20285,
305,
4808,
66,
5691,
16,
82,
17,
4906,
7,
20786,
11,
1005,
333,
429,
2981,
11,
264,
16,
11,
264,
17,
8,
198,
197,
197,
37498,
535,
439,
7,
16763,
7,
3798,
7,
20786,
36911,
4808,
73,
6148,
11084,
8019,
828,
29568,
3798,
7,
1186,
333,
429,
2981,
36911,
357,
46745,
90,
34,
10641,
5512,
350,
2213,
90,
34,
10641,
92,
828,
29568,
3798,
7,
82,
16,
36911,
29568,
3798,
7,
82,
17,
35514,
198,
197,
437,
628,
197,
8818,
474,
12022,
62,
86,
676,
1754,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
535,
439,
19510,
25,
9491,
78,
62,
86,
676,
1754,
11,
4808,
73,
6148,
11084,
8019,
828,
327,
23352,
11,
357,
46745,
90,
34,
10641,
5512,
350,
2213,
90,
34,
10641,
5512,
347,
970,
828,
264,
16,
11,
264,
17,
11,
3991,
8,
198,
197,
437,
628,
197,
8818,
474,
12022,
62,
30246,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
31,
62,
66,
5691,
16,
82,
17,
4906,
7,
25,
9491,
78,
62,
30246,
11,
327,
23352,
11,
264,
16,
11,
264,
17,
8,
198,
197,
437,
628,
197,
8818,
8891,
2229,
62,
30246,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
1102,
1851,
7,
5317,
11,
2488,
62,
66,
5691,
16,
82,
17,
4906,
7,
25,
2763,
2229,
62,
30246,
11,
327,
7857,
62,
83,
11,
264,
16,
11,
264,
17,
4008,
198,
197,
437,
628,
197,
8818,
443,
574,
1477,
22006,
62,
30246,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
31,
62,
66,
5691,
16,
82,
17,
4906,
7,
25,
293,
574,
1477,
22006,
62,
30246,
11,
327,
600,
11,
264,
16,
11,
264,
17,
8,
198,
197,
437,
628,
197,
8818,
1801,
263,
559,
62,
293,
574,
1477,
22006,
62,
30246,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
31,
62,
66,
5691,
16,
82,
17,
4906,
7,
25,
67,
2382,
559,
62,
293,
574,
1477,
22006,
62,
30246,
11,
327,
600,
11,
264,
16,
11,
264,
17,
8,
198,
197,
437,
628,
197,
2,
329,
617,
1738,
1595,
470,
670,
25,
198,
197,
8818,
4808,
13345,
2536,
7,
20786,
3712,
13940,
23650,
11,
264,
3712,
10100,
8,
198,
197,
197,
81,
796,
269,
13345,
19510,
20786,
11,
4808,
73,
6148,
11084,
8019,
828,
350,
2213,
90,
34,
10641,
5512,
357,
46745,
90,
34,
10641,
5512,
828,
264,
8,
198,
197,
197,
13271,
8635,
62,
8841,
7,
81,
8,
198,
197,
437,
628,
197,
8818,
2128,
1069,
7,
82,
3712,
10100,
8,
198,
197,
197,
2,
4808,
13345,
2536,
7,
25,
23661,
1069,
11,
264,
8,
198,
197,
197,
81,
796,
269,
13345,
19510,
25,
23661,
1069,
11,
4808,
73,
6148,
11084,
8019,
828,
350,
2213,
90,
34,
10641,
5512,
357,
46745,
90,
34,
10641,
5512,
828,
264,
8,
198,
197,
197,
13271,
8635,
62,
8841,
7,
81,
8,
198,
197,
437,
628,
197,
8818,
13738,
505,
7,
82,
3712,
10100,
8,
198,
197,
197,
2,
4808,
13345,
2536,
7,
25,
4164,
6570,
505,
11,
264,
8,
198,
197,
197,
81,
796,
269,
13345,
19510,
25,
4164,
6570,
505,
11,
4808,
73,
6148,
11084,
8019,
828,
350,
2213,
90,
34,
10641,
5512,
357,
46745,
90,
34,
10641,
5512,
828,
264,
8,
198,
197,
197,
13271,
8635,
62,
8841,
7,
81,
8,
198,
197,
437,
628,
197,
8818,
2872,
62,
8821,
62,
19815,
1069,
7,
82,
3712,
10100,
8,
198,
197,
197,
2,
4808,
13345,
2536,
7,
25,
15699,
62,
8821,
62,
19815,
1069,
11,
264,
8,
198,
197,
197,
81,
796,
269,
13345,
19510,
25,
15699,
62,
8821,
62,
19815,
1069,
11,
4808,
73,
6148,
11084,
8019,
828,
350,
2213,
90,
34,
10641,
5512,
357,
46745,
90,
34,
10641,
5512,
828,
264,
8,
198,
197,
197,
13271,
8635,
62,
8841,
7,
81,
8,
198,
197,
437,
628,
197,
8818,
2872,
62,
8821,
62,
785,
1845,
1653,
7,
82,
16,
3712,
10100,
11,
264,
17,
3712,
10100,
8,
198,
197,
197,
31,
62,
66,
5691,
16,
82,
17,
4906,
7,
25,
15699,
62,
8821,
62,
785,
1845,
1653,
11,
347,
970,
11,
264,
16,
11,
264,
17,
8,
198,
197,
437,
628,
197,
8818,
299,
893,
72,
271,
7,
82,
3712,
10100,
8,
198,
197,
197,
2,
4808,
13345,
2536,
7,
25,
77,
893,
72,
271,
11,
264,
8,
198,
197,
197,
81,
796,
269,
13345,
19510,
25,
77,
893,
72,
271,
11,
4808,
73,
6148,
11084,
8019,
828,
350,
2213,
90,
34,
10641,
5512,
357,
46745,
90,
34,
10641,
5512,
828,
264,
8,
198,
197,
197,
13271,
8635,
62,
8841,
7,
81,
8,
198,
197,
437,
198,
437,
198
] | 2.232123 | 909 |
import Pkg; Pkg.activate("../../")
println("Loading libraries ...")
include("PreProcess.jl")
import CSV
import DataFrames; const DF = DataFrames
println("Finished loading libraries.")
data_dir = "../data"
path_to_data = "$(data_dir)/cb_transformed.csv"
function separatesamples(Y)
sample_ids = sort(unique(Y.sample_id))
return Matrix.(DF.select(Y[Y.sample_id .== i, :], DF.Not(:sample_id))
for i in sample_ids)
end
# Read transformed CB data into Y as a data frame.
# Replace `missing` with `NaN`.
Y = coalesce.(CSV.read(path_to_data), NaN)
markernames = filter(x -> x != :sample_id, names(Y))
y = separatesamples(Y)
isgoodmarker = PreProcess.preprocess!(y, maxNanOrNegProp=.9,
maxPosProp=.9, rowThresh=-6.0)
includedmarkers = Symbol[]
excludedmarkers = Symbol[]
for j in 1:length(isgoodmarker)
marker = markernames[j]
if isgoodmarker[j]
append!(includedmarkers, [marker])
else
append!(excludedmarkers, [marker])
end
end
# Concatenate y and convert to data frame
Y_reduced = DF.DataFrame(vcat(y...), includedmarkers)
# Convert NaN to missing
Y_reduced = ifelse.(isnan.(Y_reduced), missing, Y_reduced)
# Append a column for sample_id
Y_reduced[!, :sample_id] = vcat([fill(i, size(y[i], 1))
for i in 1:length(y)]...)
# Path to reduced data
path_to_reduced_data = "$(data_dir)/cb_transformed_reduced.csv"
# Write reduced data to disk.
println("Writing reduced-and-transformed CB data to: ")
println(path_to_reduced_data)
CSV.write(path_to_reduced_data, Y_reduced)
println("Done!")
| [
11748,
350,
10025,
26,
350,
10025,
13,
39022,
7203,
40720,
40720,
4943,
198,
198,
35235,
7203,
19031,
12782,
35713,
8,
198,
17256,
7203,
6719,
18709,
13,
20362,
4943,
198,
11748,
44189,
198,
11748,
6060,
35439,
26,
1500,
36323,
796,
6060,
35439,
198,
35235,
7203,
18467,
1348,
11046,
12782,
19570,
198,
198,
7890,
62,
15908,
796,
366,
40720,
7890,
1,
198,
6978,
62,
1462,
62,
7890,
796,
17971,
7,
7890,
62,
15908,
20679,
21101,
62,
7645,
12214,
13,
40664,
1,
198,
198,
8818,
31555,
12629,
7,
56,
8,
198,
220,
6291,
62,
2340,
796,
3297,
7,
34642,
7,
56,
13,
39873,
62,
312,
4008,
198,
220,
1441,
24936,
12195,
8068,
13,
19738,
7,
56,
58,
56,
13,
39873,
62,
312,
764,
855,
1312,
11,
1058,
4357,
36323,
13,
3673,
7,
25,
39873,
62,
312,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
6291,
62,
2340,
8,
198,
437,
198,
198,
2,
4149,
14434,
10078,
1366,
656,
575,
355,
257,
1366,
5739,
13,
198,
2,
40177,
4600,
45688,
63,
351,
4600,
26705,
45,
44646,
198,
56,
796,
46064,
344,
12195,
7902,
53,
13,
961,
7,
6978,
62,
1462,
62,
7890,
828,
11013,
45,
8,
198,
4102,
1142,
1047,
796,
8106,
7,
87,
4613,
2124,
14512,
1058,
39873,
62,
312,
11,
3891,
7,
56,
4008,
198,
88,
796,
31555,
12629,
7,
56,
8,
198,
271,
11274,
4102,
263,
796,
3771,
18709,
13,
3866,
14681,
0,
7,
88,
11,
3509,
45,
272,
5574,
32863,
24331,
28,
13,
24,
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,
3509,
21604,
24331,
28,
13,
24,
11,
5752,
817,
3447,
10779,
21,
13,
15,
8,
198,
198,
259,
10341,
4102,
364,
796,
38357,
21737,
198,
1069,
10341,
4102,
364,
796,
38357,
21737,
198,
198,
1640,
474,
287,
352,
25,
13664,
7,
271,
11274,
4102,
263,
8,
198,
220,
18364,
796,
1317,
1142,
1047,
58,
73,
60,
198,
220,
611,
318,
11274,
4102,
263,
58,
73,
60,
198,
220,
220,
220,
24443,
0,
7,
259,
10341,
4102,
364,
11,
685,
4102,
263,
12962,
198,
220,
2073,
198,
220,
220,
220,
24443,
0,
7,
1069,
10341,
4102,
364,
11,
685,
4102,
263,
12962,
198,
220,
886,
198,
437,
198,
198,
2,
1482,
9246,
268,
378,
331,
290,
10385,
284,
1366,
5739,
198,
56,
62,
445,
19513,
796,
36323,
13,
6601,
19778,
7,
85,
9246,
7,
88,
986,
828,
3017,
4102,
364,
8,
628,
198,
2,
38240,
11013,
45,
284,
4814,
198,
56,
62,
445,
19513,
796,
611,
17772,
12195,
271,
12647,
12195,
56,
62,
445,
19513,
828,
4814,
11,
575,
62,
445,
19513,
8,
198,
198,
2,
2034,
437,
257,
5721,
329,
6291,
62,
312,
198,
56,
62,
445,
19513,
58,
28265,
1058,
39873,
62,
312,
60,
796,
410,
9246,
26933,
20797,
7,
72,
11,
2546,
7,
88,
58,
72,
4357,
352,
4008,
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,
329,
1312,
287,
352,
25,
13664,
7,
88,
15437,
23029,
198,
198,
2,
10644,
284,
5322,
1366,
198,
6978,
62,
1462,
62,
445,
19513,
62,
7890,
796,
17971,
7,
7890,
62,
15908,
20679,
21101,
62,
7645,
12214,
62,
445,
19513,
13,
40664,
1,
198,
198,
2,
19430,
5322,
1366,
284,
11898,
13,
198,
35235,
7203,
33874,
5322,
12,
392,
12,
7645,
12214,
10078,
1366,
284,
25,
366,
8,
198,
35235,
7,
6978,
62,
1462,
62,
445,
19513,
62,
7890,
8,
198,
198,
7902,
53,
13,
13564,
7,
6978,
62,
1462,
62,
445,
19513,
62,
7890,
11,
575,
62,
445,
19513,
8,
198,
198,
35235,
7203,
45677,
2474,
8,
198
] | 2.465331 | 649 |
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.4.2
# kernelspec:
# display_name: Julia 1.4.0
# language: julia
# name: julia-1.4
# ---
# # Strong Landau Damping
#
# Electrostatic example of strong Landau damping
# $$
# f(x,v) =\frac{1}{2\pi\sigma^2} \exp
# \Big( - \frac{v_1^2 + v_2^2}{2\sigma^2} \Big)
# ( 1+\alpha \cos(k x)),
# $$
#
using ProgressMeter, Plots
using CSV, Dates, FFTW
using GEMPIC
using Sobol
using Random
using Distributions
using JLD2
using FileIO
function main_sample!( pg :: ParticleGroup{1,1},
ps :: ParticleSampler,
df :: GEMPIC.CosSumGaussianSpin,
mesh :: Mesh )
s = zeros( pg.n_spin )
theta = 0.0
phi = 0.0
n_rnds = 0
if df.params.n_gaussians > 1
n_rnds = 1
end
δ = zeros(df.params.n_gaussians)
for i_v=1:df.params.n_gaussians
δ[i_v] = sum(df.params.δ[1:i_v])
end
n_rnds += 2
rdn = zeros(3)
if ps.sampling_type == :sobol
rng_sobol = SobolSeq(1)
end
rng_random = MersenneTwister(ps.seed)
d = Normal()
for i_part = 1:(pg.n_particles)
if ps.sampling_type == :sobol
x = mesh.xmin[1] + Sobol.next!(rng_sobol)[1] * mesh.Lx[1]
else
x = mesh.xmin[1] + rand(rng_random) * mesh.Lx[1]
end
v = rand(rng_random, d)
# For multiple Gaussian, draw which one to take
rnd_no = rdn[3]
i_gauss = 1
while( rnd_no > δ[i_gauss] )
i_gauss += 1
end
v = v * df.params.σ[i_gauss] + df.params.μ[i_gauss]
#for a peaked initial condition in the s direction
s = [0, 0, 1]
#for a uniformly distributed initial condition on the sphere
# for tt = 1:10
# s[1] = randn()
# s[2] = randn()
# s[3] = randn()
# if norm(s) > 10^(-4)
# break
# end
# end
# s .= s./norm(s)
# Set weight according to value of perturbation
w = GEMPIC.eval_x_density(df, x) * prod(mesh.Lx)
# Copy the generated numbers to the particle
GEMPIC.set_x(pg, i_part, x[1])
GEMPIC.set_v(pg, i_part, v)
GEMPIC.set_spin(pg, i_part, 1, s[1])
GEMPIC.set_spin(pg, i_part, 2, s[2])
GEMPIC.set_spin(pg, i_part, 3, s[3])
# Set weights.
GEMPIC.set_weights(pg, i_part, w)
end
end
# +
function run( steps :: Int64)
σ, μ = 0.02, 0.0
kx, α = 1.004355, 0.001
xmin, xmax = 0, 2π/kx
nx = 32 #NC 1024
n_particles = 1000 #NC 100000
mesh = Mesh( xmin, xmax, nx)
spline_degree = 3
df = GEMPIC.CosSumGaussianSpin([[kx]], [α], [[σ]], [[μ]] )
particle_group2 = ParticleGroup{1,1}( n_particles, n_spin=3)
sampler = ParticleSampler{1,1}( :sobol, n_particles)
main_sample!(particle_group2, sampler, df, mesh)
particle_group = ParticleGroup{1,1}( n_particles, n_spin=3)
for i_part = 1:n_particles
x = zeros( 1 )
v = zeros( 1 )
s = zeros( 3 )
w = zeros( 1 )
x = GEMPIC.get_x(particle_group2, i_part)
v = GEMPIC.get_v(particle_group2, i_part)
s1 = GEMPIC.get_spin(particle_group2, i_part, 1)
s2 = GEMPIC.get_spin(particle_group2, i_part, 2)
s3 = GEMPIC.get_spin(particle_group2, i_part, 3)
w = GEMPIC.get_weights(particle_group2, i_part)
GEMPIC.set_x(particle_group, i_part, x[1])
GEMPIC.set_v(particle_group, i_part, v[1])
GEMPIC.set_spin(particle_group, i_part, 1, s1)
GEMPIC.set_spin(particle_group, i_part, 2, s2)
GEMPIC.set_spin(particle_group, i_part, 3, s3)
GEMPIC.set_weights(particle_group, i_part, w[1])
end
kernel_smoother2 = ParticleMeshCoupling( mesh, n_particles, spline_degree-2, :galerkin)
kernel_smoother1 = ParticleMeshCoupling( mesh, n_particles, spline_degree-1, :galerkin)
kernel_smoother0 = ParticleMeshCoupling( mesh, n_particles, spline_degree, :galerkin)
rho = zeros(Float64, nx)
efield_poisson = zeros(Float64, nx)
# Init!ialize the field solver
maxwell_solver = Maxwell1DFEM(mesh, spline_degree)
# efield by Poisson
solve_poisson!( efield_poisson, particle_group, kernel_smoother0, maxwell_solver, rho )
# Initialize the arrays for the spline coefficients of the fields
k0 = 12.0523
E0 = 10
ww = 12.104827940833333
#Test 1 with only Ey and Ay (and with HH=0)
Ey(x) = E0*cos(k0*x)
Ez(x) = 0.0*E0*sin(k0*x)
Ay(x) = -E0/ww*sin(k0*x)
Az(x) = 0.0*E0/ww*cos(k0*x)
efield_dofs = [efield_poisson, zeros(Float64, nx), zeros(Float64, nx)]
afield_dofs = [zeros(Float64, nx), zeros(Float64, nx)]
l2projection!( efield_dofs[2], maxwell_solver, Ey, spline_degree)
l2projection!( efield_dofs[3], maxwell_solver, Ez, spline_degree)
l2projection!( afield_dofs[1], maxwell_solver, Ay, spline_degree)
l2projection!( afield_dofs[2], maxwell_solver, Az, spline_degree)
propagator = HamiltonianSplittingSpin( maxwell_solver,
kernel_smoother0,
kernel_smoother1,
kernel_smoother2,
particle_group,
efield_dofs,
afield_dofs)
efield_dofs_n = propagator.e_dofs
thdiag = TimeHistoryDiagnosticsSpin( particle_group, maxwell_solver,
kernel_smoother0, kernel_smoother1 );
# mode = zeros(ComplexF64,steps,nx)
th_modes = Vector{ComplexF64}[]
elec_tmp = zeros(Float64,nx)
Δt = 0.002
@showprogress 1 for jstep = 1:steps # loop over time
# Strang splitting
strang_splitting!(propagator, Δt, 1)
solve_poisson!( efield_poisson, particle_group,
kernel_smoother0, maxwell_solver, rho)
write_step!(thdiag, jstep * Δt, spline_degree,
efield_dofs, afield_dofs,
efield_dofs_n, efield_poisson, propagator)
#diagnostics
#store particles at some specific times
if (jstep % 1000 == 0)
GEMPIC.save( "save_particles", jstep, particle_group)
end
#Fourier modes of the longitudinal electric field
for i = 1:nx
elec_tmp[i] = GEMPIC.evaluate(thdiag.kernel_smoother_1, (i-1)*propagator.delta_x[1], efield_dofs[1])
end
push!(th_modes,fft(elec_tmp))
end
thdiag.data, th_modes
end
# +
thdiag, th_modes = run(100) # choose number of steps
CSV.write("thdiag-$(now()).csv", thdiag)
file="th_modes"
#datafile = @sprintf("%s.jld2", file)
FileIO.save("th_modes.jld2", Dict("modes" => th_modes))
# -
| [
2,
532,
9,
12,
19617,
25,
3384,
69,
12,
23,
532,
9,
12,
198,
2,
11420,
198,
2,
474,
929,
88,
353,
25,
198,
2,
220,
220,
474,
929,
88,
5239,
25,
198,
2,
220,
220,
220,
220,
17519,
25,
20966,
2047,
65,
11,
20362,
25,
2971,
198,
2,
220,
220,
220,
220,
2420,
62,
15603,
341,
25,
198,
2,
220,
220,
220,
220,
220,
220,
7552,
25,
764,
20362,
198,
2,
220,
220,
220,
220,
220,
220,
5794,
62,
3672,
25,
1657,
198,
2,
220,
220,
220,
220,
220,
220,
5794,
62,
9641,
25,
705,
16,
13,
20,
6,
198,
2,
220,
220,
220,
220,
220,
220,
474,
929,
88,
5239,
62,
9641,
25,
352,
13,
19,
13,
17,
198,
2,
220,
220,
50207,
43106,
25,
198,
2,
220,
220,
220,
220,
3359,
62,
3672,
25,
22300,
352,
13,
19,
13,
15,
198,
2,
220,
220,
220,
220,
3303,
25,
474,
43640,
198,
2,
220,
220,
220,
220,
1438,
25,
474,
43640,
12,
16,
13,
19,
198,
2,
11420,
198,
198,
2,
1303,
13535,
6379,
559,
360,
37843,
198,
2,
198,
2,
38781,
12708,
1672,
286,
1913,
6379,
559,
21151,
278,
198,
2,
32382,
198,
2,
277,
7,
87,
11,
85,
8,
796,
59,
31944,
90,
16,
18477,
17,
59,
14415,
59,
82,
13495,
61,
17,
92,
220,
3467,
11201,
220,
198,
2,
3467,
12804,
7,
532,
3467,
31944,
90,
85,
62,
16,
61,
17,
1343,
410,
62,
17,
61,
17,
18477,
17,
59,
82,
13495,
61,
17,
92,
3467,
12804,
8,
198,
2,
357,
352,
10,
59,
26591,
3467,
6966,
7,
74,
2124,
8,
176,
237,
108,
223,
828,
198,
2,
32382,
198,
2,
198,
198,
3500,
18387,
44,
2357,
11,
1345,
1747,
198,
3500,
44189,
11,
44712,
11,
376,
9792,
54,
198,
3500,
402,
39494,
2149,
198,
3500,
36884,
349,
198,
3500,
14534,
198,
3500,
46567,
507,
198,
3500,
449,
11163,
17,
198,
3500,
9220,
9399,
628,
198,
8818,
1388,
62,
39873,
0,
7,
23241,
220,
220,
7904,
2142,
1548,
13247,
90,
16,
11,
16,
5512,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26692,
220,
220,
7904,
2142,
1548,
16305,
20053,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47764,
220,
220,
7904,
402,
39494,
2149,
13,
36734,
13065,
35389,
31562,
4561,
259,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19609,
7904,
47529,
1267,
628,
220,
220,
220,
264,
796,
1976,
27498,
7,
23241,
13,
77,
62,
39706,
1267,
628,
220,
220,
220,
262,
8326,
796,
657,
13,
15,
198,
220,
220,
220,
872,
72,
796,
657,
13,
15,
198,
220,
220,
220,
299,
62,
81,
358,
82,
796,
657,
198,
220,
220,
220,
611,
47764,
13,
37266,
13,
77,
62,
4908,
1046,
1547,
1875,
352,
198,
220,
220,
220,
220,
220,
220,
299,
62,
81,
358,
82,
796,
352,
198,
220,
220,
220,
886,
628,
220,
220,
220,
7377,
112,
796,
1976,
27498,
7,
7568,
13,
37266,
13,
77,
62,
4908,
1046,
1547,
8,
198,
220,
220,
220,
329,
1312,
62,
85,
28,
16,
25,
7568,
13,
37266,
13,
77,
62,
4908,
1046,
1547,
198,
220,
220,
220,
220,
220,
220,
7377,
112,
58,
72,
62,
85,
60,
796,
2160,
7,
7568,
13,
37266,
13,
138,
112,
58,
16,
25,
72,
62,
85,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
299,
62,
81,
358,
82,
15853,
362,
198,
220,
220,
220,
374,
32656,
796,
1976,
27498,
7,
18,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
611,
26692,
13,
37687,
11347,
62,
4906,
6624,
1058,
568,
28984,
198,
220,
220,
220,
220,
220,
220,
374,
782,
62,
568,
28984,
220,
796,
36884,
349,
4653,
80,
7,
16,
8,
198,
220,
220,
220,
886,
220,
628,
220,
220,
220,
374,
782,
62,
25120,
796,
337,
364,
29727,
5080,
1694,
7,
862,
13,
28826,
8,
628,
220,
220,
220,
288,
796,
14435,
3419,
628,
220,
220,
220,
329,
1312,
62,
3911,
796,
352,
37498,
6024,
13,
77,
62,
3911,
2983,
8,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
611,
26692,
13,
37687,
11347,
62,
4906,
6624,
1058,
568,
28984,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
19609,
13,
87,
1084,
58,
16,
60,
1343,
36884,
349,
13,
19545,
0,
7,
81,
782,
62,
568,
28984,
38381,
16,
60,
1635,
19609,
13,
43,
87,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
796,
19609,
13,
87,
1084,
58,
16,
60,
1343,
43720,
7,
81,
782,
62,
25120,
8,
1635,
19609,
13,
43,
87,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
410,
796,
43720,
7,
81,
782,
62,
25120,
11,
288,
8,
628,
220,
220,
220,
220,
220,
220,
1303,
1114,
3294,
12822,
31562,
11,
3197,
543,
530,
284,
1011,
198,
220,
220,
220,
220,
220,
220,
374,
358,
62,
3919,
796,
374,
32656,
58,
18,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
1312,
62,
4908,
1046,
796,
352,
198,
220,
220,
220,
220,
220,
220,
981,
7,
374,
358,
62,
3919,
1875,
7377,
112,
58,
72,
62,
4908,
1046,
60,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
4908,
1046,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
410,
796,
410,
1635,
47764,
13,
37266,
13,
38392,
58,
72,
62,
4908,
1046,
60,
1343,
47764,
13,
37266,
13,
34703,
58,
72,
62,
4908,
1046,
60,
198,
198,
2,
1640,
257,
33948,
4238,
4006,
287,
262,
264,
4571,
220,
198,
220,
220,
220,
220,
220,
220,
264,
796,
685,
15,
11,
657,
11,
352,
60,
198,
2,
1640,
257,
42096,
9387,
4238,
4006,
319,
262,
16558,
198,
2,
220,
220,
220,
220,
220,
220,
329,
256,
83,
796,
352,
25,
940,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
58,
16,
60,
796,
43720,
77,
3419,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
58,
17,
60,
796,
43720,
77,
3419,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
58,
18,
60,
796,
43720,
77,
3419,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2593,
7,
82,
8,
1875,
838,
61,
32590,
19,
8,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
2,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
2,
220,
220,
220,
220,
220,
220,
220,
886,
198,
2,
220,
220,
220,
220,
220,
220,
220,
264,
764,
28,
264,
19571,
27237,
7,
82,
8,
628,
220,
220,
220,
220,
220,
220,
1303,
5345,
3463,
1864,
284,
1988,
286,
22146,
5945,
341,
198,
220,
220,
220,
220,
220,
220,
266,
220,
796,
402,
39494,
2149,
13,
18206,
62,
87,
62,
43337,
7,
7568,
11,
2124,
8,
1635,
40426,
7,
76,
5069,
13,
43,
87,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
1303,
17393,
262,
7560,
3146,
284,
262,
18758,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
87,
7,
6024,
11,
1312,
62,
3911,
11,
2124,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
85,
7,
6024,
11,
1312,
62,
3911,
11,
410,
8,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
6024,
11,
1312,
62,
3911,
11,
352,
11,
264,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
6024,
11,
1312,
62,
3911,
11,
362,
11,
264,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
6024,
11,
1312,
62,
3911,
11,
513,
11,
264,
58,
18,
12962,
198,
220,
220,
220,
220,
220,
220,
1303,
5345,
19590,
13,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
43775,
7,
6024,
11,
1312,
62,
3911,
11,
266,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
198,
437,
628,
198,
198,
2,
1343,
198,
8818,
1057,
7,
4831,
7904,
2558,
2414,
8,
220,
198,
220,
220,
220,
198,
220,
220,
18074,
225,
11,
18919,
796,
657,
13,
2999,
11,
657,
13,
15,
198,
220,
220,
479,
87,
11,
26367,
796,
352,
13,
22914,
28567,
11,
657,
13,
8298,
198,
220,
220,
2124,
1084,
11,
2124,
9806,
796,
657,
11,
362,
46582,
14,
74,
87,
198,
220,
220,
299,
87,
796,
3933,
1303,
7792,
28119,
220,
198,
220,
220,
299,
62,
3911,
2983,
796,
8576,
1303,
7792,
1802,
830,
198,
220,
220,
19609,
796,
47529,
7,
2124,
1084,
11,
2124,
9806,
11,
299,
87,
8,
198,
220,
220,
4328,
500,
62,
16863,
796,
513,
198,
220,
220,
220,
198,
220,
220,
47764,
796,
402,
39494,
2149,
13,
36734,
13065,
35389,
31562,
4561,
259,
26933,
58,
74,
87,
60,
4357,
685,
17394,
4357,
16410,
38392,
60,
4357,
16410,
34703,
11907,
1267,
198,
220,
220,
220,
198,
220,
220,
18758,
62,
8094,
17,
796,
2142,
1548,
13247,
90,
16,
11,
16,
92,
7,
299,
62,
3911,
2983,
11,
299,
62,
39706,
28,
18,
8,
220,
220,
220,
198,
220,
220,
6072,
20053,
796,
2142,
1548,
16305,
20053,
90,
16,
11,
16,
92,
7,
1058,
568,
28984,
11,
299,
62,
3911,
2983,
8,
198,
220,
220,
220,
198,
220,
220,
1388,
62,
39873,
0,
7,
3911,
1548,
62,
8094,
17,
11,
6072,
20053,
11,
47764,
11,
19609,
8,
198,
220,
220,
220,
198,
220,
220,
18758,
62,
8094,
796,
2142,
1548,
13247,
90,
16,
11,
16,
92,
7,
299,
62,
3911,
2983,
11,
299,
62,
39706,
28,
18,
8,
198,
220,
220,
220,
198,
220,
220,
329,
220,
1312,
62,
3911,
796,
352,
25,
77,
62,
3911,
2983,
628,
220,
220,
220,
220,
220,
220,
2124,
796,
1976,
27498,
7,
352,
1267,
198,
220,
220,
220,
220,
220,
220,
410,
796,
1976,
27498,
7,
352,
1267,
198,
220,
220,
220,
220,
220,
220,
264,
796,
1976,
27498,
7,
513,
1267,
198,
220,
220,
220,
220,
220,
220,
266,
796,
1976,
27498,
7,
352,
1267,
198,
220,
220,
220,
220,
220,
220,
2124,
796,
402,
39494,
2149,
13,
1136,
62,
87,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
8,
198,
220,
220,
220,
220,
220,
220,
410,
796,
402,
39494,
2149,
13,
1136,
62,
85,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
8,
628,
220,
220,
220,
220,
220,
220,
264,
16,
796,
402,
39494,
2149,
13,
1136,
62,
39706,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
264,
17,
796,
402,
39494,
2149,
13,
1136,
62,
39706,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
264,
18,
796,
402,
39494,
2149,
13,
1136,
62,
39706,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
11,
513,
8,
628,
220,
220,
220,
220,
220,
220,
266,
796,
402,
39494,
2149,
13,
1136,
62,
43775,
7,
3911,
1548,
62,
8094,
17,
11,
1312,
62,
3911,
8,
628,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
87,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
2124,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
85,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
410,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
352,
11,
264,
16,
8,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
362,
11,
264,
17,
8,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
39706,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
513,
11,
264,
18,
8,
198,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
2617,
62,
43775,
7,
3911,
1548,
62,
8094,
11,
1312,
62,
3911,
11,
266,
58,
16,
12962,
628,
220,
220,
886,
198,
220,
220,
220,
198,
220,
220,
9720,
62,
5796,
31724,
17,
796,
2142,
1548,
37031,
34,
280,
11347,
7,
19609,
11,
299,
62,
3911,
2983,
11,
4328,
500,
62,
16863,
12,
17,
11,
1058,
13528,
263,
5116,
8,
220,
198,
220,
220,
9720,
62,
5796,
31724,
16,
796,
2142,
1548,
37031,
34,
280,
11347,
7,
19609,
11,
299,
62,
3911,
2983,
11,
4328,
500,
62,
16863,
12,
16,
11,
1058,
13528,
263,
5116,
8,
220,
220,
220,
220,
198,
220,
220,
9720,
62,
5796,
31724,
15,
796,
2142,
1548,
37031,
34,
280,
11347,
7,
19609,
11,
299,
62,
3911,
2983,
11,
4328,
500,
62,
16863,
11,
1058,
13528,
263,
5116,
8,
198,
220,
220,
220,
198,
220,
220,
374,
8873,
796,
1976,
27498,
7,
43879,
2414,
11,
299,
87,
8,
198,
220,
220,
304,
3245,
62,
7501,
30927,
796,
1976,
27498,
7,
43879,
2414,
11,
299,
87,
8,
198,
220,
220,
220,
198,
220,
220,
1303,
44707,
0,
498,
1096,
262,
2214,
1540,
332,
198,
220,
220,
3509,
4053,
62,
82,
14375,
796,
28276,
16,
8068,
3620,
7,
76,
5069,
11,
4328,
500,
62,
16863,
8,
198,
220,
220,
1303,
304,
3245,
416,
7695,
30927,
198,
220,
220,
8494,
62,
7501,
30927,
0,
7,
304,
3245,
62,
7501,
30927,
11,
18758,
62,
8094,
11,
9720,
62,
5796,
31724,
15,
11,
3509,
4053,
62,
82,
14375,
11,
374,
8873,
1267,
198,
220,
220,
220,
198,
220,
220,
1303,
20768,
1096,
262,
26515,
329,
262,
4328,
500,
44036,
286,
262,
7032,
198,
220,
220,
479,
15,
796,
1105,
13,
2713,
1954,
220,
198,
220,
220,
412,
15,
796,
838,
198,
220,
220,
266,
86,
796,
1105,
13,
940,
2780,
26050,
26200,
2091,
20370,
628,
220,
220,
1303,
14402,
352,
351,
691,
21566,
290,
13709,
357,
392,
351,
47138,
28,
15,
8,
198,
220,
220,
21566,
7,
87,
8,
796,
412,
15,
9,
6966,
7,
74,
15,
9,
87,
8,
198,
220,
220,
21034,
7,
87,
8,
796,
657,
13,
15,
9,
36,
15,
9,
31369,
7,
74,
15,
9,
87,
8,
198,
220,
220,
13709,
7,
87,
8,
796,
532,
36,
15,
14,
1383,
9,
31369,
7,
74,
15,
9,
87,
8,
198,
220,
220,
7578,
7,
87,
8,
796,
657,
13,
15,
9,
36,
15,
14,
1383,
9,
6966,
7,
74,
15,
9,
87,
8,
198,
220,
220,
220,
198,
220,
220,
304,
3245,
62,
67,
1659,
82,
796,
685,
891,
1164,
62,
7501,
30927,
11,
1976,
27498,
7,
43879,
2414,
11,
299,
87,
828,
1976,
27498,
7,
43879,
2414,
11,
299,
87,
15437,
198,
220,
220,
257,
3245,
62,
67,
1659,
82,
796,
685,
9107,
418,
7,
43879,
2414,
11,
299,
87,
828,
1976,
27498,
7,
43879,
2414,
11,
299,
87,
15437,
198,
220,
220,
220,
198,
220,
220,
300,
17,
16302,
295,
0,
7,
304,
3245,
62,
67,
1659,
82,
58,
17,
4357,
3509,
4053,
62,
82,
14375,
11,
21566,
11,
4328,
500,
62,
16863,
8,
198,
220,
220,
300,
17,
16302,
295,
0,
7,
304,
3245,
62,
67,
1659,
82,
58,
18,
4357,
3509,
4053,
62,
82,
14375,
11,
21034,
11,
4328,
500,
62,
16863,
8,
198,
220,
220,
300,
17,
16302,
295,
0,
7,
257,
3245,
62,
67,
1659,
82,
58,
16,
4357,
3509,
4053,
62,
82,
14375,
11,
13709,
11,
4328,
500,
62,
16863,
8,
198,
220,
220,
300,
17,
16302,
295,
0,
7,
257,
3245,
62,
67,
1659,
82,
58,
17,
4357,
3509,
4053,
62,
82,
14375,
11,
7578,
11,
4328,
500,
62,
16863,
8,
198,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
8928,
1352,
796,
11582,
666,
26568,
2535,
4561,
259,
7,
3509,
4053,
62,
82,
14375,
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,
9720,
62,
5796,
31724,
15,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9720,
62,
5796,
31724,
16,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9720,
62,
5796,
31724,
17,
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,
18758,
62,
8094,
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,
304,
3245,
62,
67,
1659,
82,
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,
257,
3245,
62,
67,
1659,
82,
8,
198,
220,
220,
198,
220,
220,
304,
3245,
62,
67,
1659,
82,
62,
77,
796,
8928,
1352,
13,
68,
62,
67,
1659,
82,
198,
220,
220,
220,
198,
220,
220,
294,
10989,
363,
796,
3862,
18122,
18683,
4660,
34558,
4561,
259,
7,
18758,
62,
8094,
11,
3509,
4053,
62,
82,
14375,
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,
220,
9720,
62,
5796,
31724,
15,
11,
9720,
62,
5796,
31724,
16,
5619,
198,
198,
2,
220,
220,
220,
4235,
796,
1976,
27498,
7,
5377,
11141,
37,
2414,
11,
20214,
11,
77,
87,
8,
198,
220,
220,
220,
220,
294,
62,
76,
4147,
796,
20650,
90,
5377,
11141,
37,
2414,
92,
21737,
198,
220,
220,
220,
9766,
66,
62,
22065,
796,
1976,
27498,
7,
43879,
2414,
11,
77,
87,
8,
198,
220,
220,
220,
198,
220,
220,
37455,
83,
796,
657,
13,
21601,
628,
220,
220,
2488,
12860,
33723,
352,
329,
474,
9662,
796,
352,
25,
20214,
1303,
9052,
625,
640,
198,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
1303,
4285,
648,
26021,
198,
220,
220,
220,
220,
220,
220,
36666,
62,
22018,
2535,
0,
7,
22930,
363,
1352,
11,
37455,
83,
11,
352,
8,
198,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
8494,
62,
7501,
30927,
0,
7,
304,
3245,
62,
7501,
30927,
11,
18758,
62,
8094,
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,
9720,
62,
5796,
31724,
15,
11,
3509,
4053,
62,
82,
14375,
11,
374,
8873,
8,
198,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
3551,
62,
9662,
0,
7,
400,
10989,
363,
11,
474,
9662,
1635,
37455,
83,
11,
4328,
500,
62,
16863,
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,
304,
3245,
62,
67,
1659,
82,
11,
220,
257,
3245,
62,
67,
1659,
82,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
3245,
62,
67,
1659,
82,
62,
77,
11,
304,
3245,
62,
7501,
30927,
11,
8928,
1352,
8,
628,
220,
220,
220,
220,
220,
220,
1303,
47356,
34558,
628,
220,
220,
220,
220,
220,
220,
1303,
8095,
13166,
379,
617,
2176,
1661,
220,
198,
220,
220,
220,
220,
220,
220,
611,
357,
73,
9662,
4064,
8576,
6624,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
402,
39494,
2149,
13,
21928,
7,
366,
21928,
62,
3911,
2983,
1600,
474,
9662,
11,
18758,
62,
8094,
8,
198,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
1303,
37,
280,
5277,
12881,
286,
262,
36211,
5186,
2214,
198,
220,
220,
220,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
87,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9766,
66,
62,
22065,
58,
72,
60,
796,
402,
39494,
2149,
13,
49786,
7,
400,
10989,
363,
13,
33885,
62,
5796,
31724,
62,
16,
11,
357,
72,
12,
16,
27493,
22930,
363,
1352,
13,
67,
12514,
62,
87,
58,
16,
4357,
304,
3245,
62,
67,
1659,
82,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
400,
62,
76,
4147,
11,
487,
83,
7,
11129,
66,
62,
22065,
4008,
628,
198,
220,
220,
886,
628,
220,
220,
294,
10989,
363,
13,
7890,
11,
294,
62,
76,
4147,
198,
198,
437,
198,
2,
1343,
198,
400,
10989,
363,
11,
294,
62,
76,
4147,
796,
1057,
7,
3064,
8,
1303,
3853,
1271,
286,
4831,
198,
198,
7902,
53,
13,
13564,
7203,
400,
10989,
363,
22799,
7,
2197,
3419,
737,
40664,
1600,
294,
10989,
363,
8,
198,
198,
7753,
2625,
400,
62,
76,
4147,
1,
198,
2,
7890,
7753,
796,
2488,
82,
37435,
7203,
4,
82,
13,
73,
335,
17,
1600,
2393,
8,
198,
198,
8979,
9399,
13,
21928,
7203,
400,
62,
76,
4147,
13,
73,
335,
17,
1600,
360,
713,
7203,
76,
4147,
1,
5218,
294,
62,
76,
4147,
4008,
628,
198,
2,
532,
628,
628
] | 1.873458 | 3,730 |
#=
Modela diferentes tipos de anemômetros
=#
"""
HWSensor(I, E, R, T)
Condições de operação do sensor de um anemômetro de fio quente.
"""
struct HWSensor
"Corrente passando no sensor"
I::Float64
"Tenão no sensor"
E::Float64
"Resistência do sensor"
R::Float64
"Temmperatura do sensor"
T::Float64
"Potência dissipada no sensor"
P::Float64
HWSensor(I, E, R, T) = new(I, E, R, T, I*E)
end
"""
const_current(mA, R::Thermistor, U=5.0, d=3.0, Ta=20.0, Pa=101.3, dterr=1e-6, nmax=20000)
Modela um anemômetro trabalhando a corrente constante. Não simula circuitos elétricos.
Utiliza um esquema iterativo.
Argumentos:
* `mA` Corrente em mA
* `R` Objeto que modela o termistor
* `U` Velocidade em m/s
* `d` Diâmetro em mm
* `Ta` Temperatura ao longe em °C
* `Pa` Pressão atmosférica em kPa
* `dterr` Erro admissível para convergência da temperatura.
* `nmax` Número máximo de iterações.
```jldoctest
julia> R = Thermistor(5e3, 3200, 20)
THW.Thermistor(5000.0, 3200.0, 293.15)
julia> const_current(20, R, 5.0, 2.0)
THW.HWSensor(0.02, 9.395209322307162, 469.7604661153581, 101.07772779650266, 0.18790418644614323)
julia> const_current(20, R, 1.0, 2.0)
THW.HWSensor(0.02, 5.872996120670518, 293.64980603352586, 122.8352988426391, 0.11745992241341036)
julia> const_current(20, R, 10.0, 2.0)
THW.HWSensor(0.02, 11.70131737284239, 585.0658686421194, 91.71177677466494, 0.2340263474568478)
julia> const_current(20, R, 10.0, 10.0)
THW.HWSensor(0.02, 44.971641701710844, 2248.582085085542, 43.15632417996514, 0.8994328340342169)
```
"""
function const_current(mA, R::Thermistor, U=5.0, d=3.0, Ta=20.0, Pa=101.3, dterr=1e-6, nmax=20000)
I = mA/1000
D = d/1000
r = D/2
A = 4π*r^2
Tw = Ta + 0.01
i = 0
P = 0.0
for i = 1:nmax
h = hconvect(U, D, Tw, Ta, Pa)
#println(h)
P = R(Tw)*I^2
Tw1 = P/(h*A) + Ta
dt = Tw1-Tw
if abs(dt) < dterr
Tw = Tw1
break
end
Tw = Tw + 0.4*dt
end
res = R(Tw)
E = res*I
return HWSensor(I, E, res, Tw)
end
"""
const_temperature(Tw, R::Thermistor, U=5.0, d=3.0, Ta=20.0, Pa=101.3)
Modela um anemômetro trabalhando a temperatura constante. Não simula circuitos elétricos.
Argumentos:
* `Tw` Temperatura de operação do sensor
* `R` Objeto que modela o termistor
* `U` Velocidade em m/s
* `d` Diâmetro em mm
* `Ta` Temperatura ao longe em °C
* `Pa` Pressão atmosférica em kPa
```jldoctest
julia> R = Thermistor(5e3, 3200, 20)
THW.Thermistor(5000.0, 3200.0, 293.15)
julia> const_temperature(100.0, R, 5.0, 2.0)
THW.HWSensor(0.019627341883449854, 9.45069202339691, 481.50646580247894, 100.0, 0.18549196337840362)
julia> const_temperature(100.0, R, 1.0, 2.0)
THW.HWSensor(0.01383013241982859, 6.65929818305195, 481.50646580247894, 100.0, 0.09209897569473241)
julia> const_temperature(100.0, R, 10.0, 2.0)
THW.HWSensor(0.023241402160834233, 11.190885414757389, 481.50646580247894, 100.0, 0.26009186846019067)
julia> const_temperature(100.0, R, 20.0, 2.0)
THW.HWSensor(0.027741857167247384, 13.357883599398457, 481.50646580247894, 100.0, 0.3705724988712284)
julia> const_temperature(100.0, R, 20.0, 3.0)
THW.HWSensor(0.037797691428912955, 18.19983281542853, 481.50646580247894, 100.0, 0.6879116648153717)
```
"""
function const_temperature(Tw, R::Thermistor, U=5.0, d=3.0, Ta=20.0, Pa=101.3)
D = d/1000
r = D/2
A = 4π*r^2
Rw = R(Tw)
h = hconvect(U, D, Tw, Ta, Pa)
i = sqrt(h*A*(Tw-Ta)/Rw)
return HWSensor(i, Rw*i, Rw, Tw)
end
function const_temperature_cyl(Tw, R::AbstractResistor, U=5.0, d=5.0, l=3, Ta=20.0, Pa=101.325)
D = d/1e6
L = l / 1000
r = D/2
A = L * π * D
Rw = R(Tw)
h = hconvectcyl(U, D, Tw, Ta, Pa)
i = sqrt(h*A*(Tw-Ta)/Rw)
return i*1000
end
| [
2,
28,
198,
198,
5841,
10304,
288,
361,
9100,
274,
8171,
418,
390,
281,
368,
27083,
4164,
4951,
198,
198,
46249,
198,
198,
37811,
198,
220,
220,
220,
367,
19416,
22854,
7,
40,
11,
412,
11,
371,
11,
309,
8,
198,
198,
25559,
72,
16175,
127,
113,
274,
390,
27296,
16175,
28749,
466,
12694,
390,
23781,
281,
368,
27083,
4164,
305,
390,
277,
952,
627,
21872,
13,
198,
37811,
198,
7249,
367,
19416,
22854,
198,
220,
220,
220,
366,
10606,
1156,
68,
1208,
25440,
645,
12694,
1,
198,
220,
220,
220,
314,
3712,
43879,
2414,
198,
220,
220,
220,
366,
24893,
28749,
645,
12694,
1,
198,
220,
220,
220,
412,
3712,
43879,
2414,
198,
220,
220,
220,
366,
4965,
396,
25792,
10782,
544,
466,
12694,
1,
198,
220,
220,
220,
371,
3712,
43879,
2414,
198,
220,
220,
220,
366,
12966,
76,
525,
2541,
64,
466,
12694,
1,
198,
220,
220,
220,
309,
3712,
43879,
2414,
198,
220,
220,
220,
366,
25396,
25792,
10782,
544,
32008,
4763,
645,
12694,
1,
198,
220,
220,
220,
350,
3712,
43879,
2414,
198,
220,
220,
220,
367,
19416,
22854,
7,
40,
11,
412,
11,
371,
11,
309,
8,
796,
649,
7,
40,
11,
412,
11,
371,
11,
309,
11,
314,
9,
36,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
1500,
62,
14421,
7,
42646,
11,
371,
3712,
35048,
76,
32380,
11,
471,
28,
20,
13,
15,
11,
288,
28,
18,
13,
15,
11,
11940,
28,
1238,
13,
15,
11,
11243,
28,
8784,
13,
18,
11,
288,
353,
81,
28,
16,
68,
12,
21,
11,
299,
9806,
28,
2167,
405,
8,
198,
198,
5841,
10304,
23781,
281,
368,
27083,
4164,
305,
491,
44349,
4993,
78,
257,
1162,
1156,
68,
6937,
68,
13,
399,
28749,
985,
4712,
10349,
418,
1288,
25125,
1173,
418,
13,
220,
198,
18274,
346,
23638,
23781,
1658,
421,
19687,
11629,
265,
23593,
13,
628,
198,
28100,
1713,
418,
25,
198,
1635,
4600,
42646,
63,
2744,
1156,
68,
795,
285,
32,
198,
1635,
4600,
49,
63,
38764,
27206,
8358,
2746,
64,
267,
3381,
32380,
198,
1635,
4600,
52,
63,
17378,
420,
312,
671,
795,
285,
14,
82,
198,
1635,
4600,
67,
63,
6031,
22940,
4164,
305,
795,
8085,
198,
1635,
4600,
38586,
63,
48125,
2541,
64,
257,
78,
300,
14220,
795,
22074,
34,
198,
1635,
4600,
28875,
63,
4332,
28749,
379,
16785,
69,
2634,
30997,
795,
479,
28875,
198,
1635,
4600,
67,
353,
81,
63,
5256,
305,
512,
3927,
8836,
626,
31215,
6718,
70,
25792,
10782,
544,
12379,
4124,
2541,
64,
13,
198,
1635,
4600,
77,
9806,
63,
399,
21356,
647,
78,
285,
6557,
87,
25147,
390,
340,
8607,
16175,
127,
113,
274,
13,
198,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
371,
796,
12634,
76,
32380,
7,
20,
68,
18,
11,
513,
2167,
11,
1160,
8,
198,
4221,
54,
13,
35048,
76,
32380,
7,
27641,
13,
15,
11,
513,
2167,
13,
15,
11,
37224,
13,
1314,
8,
198,
198,
73,
43640,
29,
1500,
62,
14421,
7,
1238,
11,
371,
11,
642,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
2999,
11,
860,
13,
31010,
1238,
6052,
1828,
22996,
25061,
11,
604,
3388,
13,
22,
31916,
2791,
15363,
2327,
6659,
11,
8949,
13,
2998,
3324,
1983,
3720,
17544,
25540,
11,
657,
13,
1507,
3720,
3023,
1507,
2414,
3510,
21139,
1954,
8,
198,
198,
73,
43640,
29,
1500,
62,
14421,
7,
1238,
11,
371,
11,
352,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
2999,
11,
642,
13,
5774,
1959,
4846,
1065,
3312,
34801,
1507,
11,
37224,
13,
33300,
1795,
1899,
27326,
1495,
4521,
11,
19409,
13,
23,
2327,
1959,
40353,
2075,
37710,
11,
657,
13,
17657,
2231,
2079,
24137,
19880,
940,
2623,
8,
198,
198,
73,
43640,
29,
1500,
62,
14421,
7,
1238,
11,
371,
11,
838,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
2999,
11,
1367,
13,
22,
30273,
1558,
2718,
30336,
23516,
11,
642,
5332,
13,
15,
38431,
3104,
2414,
2481,
22913,
11,
10495,
13,
22,
1157,
3324,
40179,
3510,
2414,
5824,
11,
657,
13,
1954,
1821,
2075,
30995,
2231,
3104,
29059,
8,
198,
198,
73,
43640,
29,
1500,
62,
14421,
7,
1238,
11,
371,
11,
838,
13,
15,
11,
838,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
2999,
11,
5846,
13,
5607,
23237,
1558,
29326,
15711,
2598,
11,
362,
23045,
13,
3365,
21315,
33042,
2816,
3682,
11,
5946,
13,
1314,
5066,
1731,
1558,
2079,
2996,
1415,
11,
657,
13,
44093,
3559,
2078,
23601,
2682,
20666,
24,
8,
198,
15506,
63,
198,
37811,
198,
8818,
1500,
62,
14421,
7,
42646,
11,
371,
3712,
35048,
76,
32380,
11,
471,
28,
20,
13,
15,
11,
288,
28,
18,
13,
15,
11,
11940,
28,
1238,
13,
15,
11,
11243,
28,
8784,
13,
18,
11,
288,
353,
81,
28,
16,
68,
12,
21,
11,
299,
9806,
28,
2167,
405,
8,
628,
220,
220,
220,
314,
796,
285,
32,
14,
12825,
628,
220,
220,
220,
360,
796,
288,
14,
12825,
198,
220,
220,
220,
374,
796,
360,
14,
17,
198,
220,
220,
220,
317,
796,
604,
46582,
9,
81,
61,
17,
628,
220,
220,
220,
1815,
796,
11940,
1343,
657,
13,
486,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1312,
796,
657,
198,
220,
220,
220,
350,
796,
657,
13,
15,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
9806,
198,
220,
220,
220,
220,
220,
220,
220,
289,
796,
289,
1102,
303,
310,
7,
52,
11,
360,
11,
1815,
11,
11940,
11,
11243,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
35235,
7,
71,
8,
198,
220,
220,
220,
220,
220,
220,
220,
350,
796,
371,
7,
5080,
27493,
40,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
1815,
16,
796,
350,
29006,
71,
9,
32,
8,
1343,
11940,
198,
220,
220,
220,
220,
220,
220,
220,
288,
83,
796,
1815,
16,
12,
5080,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2352,
7,
28664,
8,
1279,
288,
353,
81,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1815,
796,
1815,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1815,
796,
1815,
1343,
657,
13,
19,
9,
28664,
198,
220,
220,
220,
886,
628,
220,
220,
220,
581,
796,
371,
7,
5080,
8,
198,
220,
220,
220,
412,
796,
581,
9,
40,
198,
220,
220,
220,
1441,
367,
19416,
22854,
7,
40,
11,
412,
11,
581,
11,
1815,
8,
198,
437,
628,
198,
37811,
198,
220,
220,
220,
1500,
62,
11498,
21069,
7,
5080,
11,
371,
3712,
35048,
76,
32380,
11,
471,
28,
20,
13,
15,
11,
288,
28,
18,
13,
15,
11,
11940,
28,
1238,
13,
15,
11,
11243,
28,
8784,
13,
18,
8,
198,
198,
5841,
10304,
23781,
281,
368,
27083,
4164,
305,
491,
44349,
4993,
78,
257,
4124,
2541,
64,
6937,
68,
13,
399,
28749,
985,
4712,
10349,
418,
1288,
25125,
1173,
418,
13,
220,
628,
198,
28100,
1713,
418,
25,
198,
1635,
4600,
5080,
63,
48125,
2541,
64,
390,
27296,
16175,
28749,
466,
12694,
198,
1635,
4600,
49,
63,
38764,
27206,
8358,
2746,
64,
267,
3381,
32380,
198,
1635,
4600,
52,
63,
17378,
420,
312,
671,
795,
285,
14,
82,
198,
1635,
4600,
67,
63,
6031,
22940,
4164,
305,
795,
8085,
198,
1635,
4600,
38586,
63,
48125,
2541,
64,
257,
78,
300,
14220,
795,
22074,
34,
198,
1635,
4600,
28875,
63,
4332,
28749,
379,
16785,
69,
2634,
30997,
795,
479,
28875,
628,
198,
15506,
63,
73,
335,
38441,
395,
198,
73,
43640,
29,
371,
796,
12634,
76,
32380,
7,
20,
68,
18,
11,
513,
2167,
11,
1160,
8,
198,
4221,
54,
13,
35048,
76,
32380,
7,
27641,
13,
15,
11,
513,
2167,
13,
15,
11,
37224,
13,
1314,
8,
198,
198,
73,
43640,
29,
1500,
62,
11498,
21069,
7,
3064,
13,
15,
11,
371,
11,
642,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
486,
4846,
1983,
2682,
1507,
5999,
2598,
4089,
4051,
11,
860,
13,
17885,
3388,
1238,
1954,
2670,
49541,
11,
4764,
16,
13,
1120,
2414,
2996,
1795,
1731,
3695,
5824,
11,
1802,
13,
15,
11,
657,
13,
21652,
2920,
25272,
2091,
3695,
1821,
35667,
8,
198,
198,
73,
43640,
29,
1500,
62,
11498,
21069,
7,
3064,
13,
15,
11,
371,
11,
352,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
486,
2548,
18938,
33916,
22337,
2078,
3270,
11,
718,
13,
36445,
27728,
1507,
22515,
22186,
11,
4764,
16,
13,
1120,
2414,
2996,
1795,
1731,
3695,
5824,
11,
1802,
13,
15,
11,
657,
13,
2931,
1238,
42520,
2425,
3388,
37804,
28872,
8,
198,
198,
73,
43640,
29,
1500,
62,
11498,
21069,
7,
3064,
13,
15,
11,
371,
11,
838,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
45310,
1731,
1415,
2999,
1433,
2919,
2682,
25429,
11,
1367,
13,
1129,
46556,
4051,
1415,
39251,
29769,
11,
4764,
16,
13,
1120,
2414,
2996,
1795,
1731,
3695,
5824,
11,
1802,
13,
15,
11,
657,
13,
2075,
28694,
1507,
3104,
3510,
486,
3829,
3134,
8,
198,
198,
73,
43640,
29,
1500,
62,
11498,
21069,
7,
3064,
13,
15,
11,
371,
11,
1160,
13,
15,
11,
362,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
44698,
4524,
1507,
3553,
21940,
23753,
22842,
11,
1511,
13,
27277,
3459,
2327,
2079,
31952,
33032,
11,
4764,
16,
13,
1120,
2414,
2996,
1795,
1731,
3695,
5824,
11,
1802,
13,
15,
11,
657,
13,
20167,
3553,
21626,
46660,
1065,
30336,
8,
198,
198,
73,
43640,
29,
1500,
62,
11498,
21069,
7,
3064,
13,
15,
11,
371,
11,
1160,
13,
15,
11,
513,
13,
15,
8,
198,
4221,
54,
13,
39,
19416,
22854,
7,
15,
13,
15,
2718,
44673,
3388,
1415,
27693,
18741,
2816,
11,
1248,
13,
21113,
34256,
21526,
2078,
4310,
11,
4764,
16,
13,
1120,
2414,
2996,
1795,
1731,
3695,
5824,
11,
1802,
13,
15,
11,
657,
13,
3104,
3720,
18298,
34287,
1314,
2718,
1558,
8,
198,
15506,
63,
198,
37811,
198,
8818,
1500,
62,
11498,
21069,
7,
5080,
11,
371,
3712,
35048,
76,
32380,
11,
471,
28,
20,
13,
15,
11,
288,
28,
18,
13,
15,
11,
11940,
28,
1238,
13,
15,
11,
11243,
28,
8784,
13,
18,
8,
628,
628,
220,
220,
220,
360,
796,
288,
14,
12825,
198,
220,
220,
220,
374,
796,
360,
14,
17,
198,
220,
220,
220,
317,
796,
604,
46582,
9,
81,
61,
17,
628,
220,
220,
220,
31641,
796,
371,
7,
5080,
8,
198,
220,
220,
220,
289,
796,
289,
1102,
303,
310,
7,
52,
11,
360,
11,
1815,
11,
11940,
11,
11243,
8,
198,
220,
220,
220,
1312,
796,
19862,
17034,
7,
71,
9,
32,
9,
7,
5080,
12,
38586,
20679,
49,
86,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
367,
19416,
22854,
7,
72,
11,
31641,
9,
72,
11,
31641,
11,
1815,
8,
198,
437,
628,
198,
8818,
1500,
62,
11498,
21069,
62,
38801,
7,
5080,
11,
371,
3712,
23839,
4965,
32380,
11,
471,
28,
20,
13,
15,
11,
288,
28,
20,
13,
15,
11,
300,
28,
18,
11,
11940,
28,
1238,
13,
15,
11,
11243,
28,
8784,
13,
26582,
8,
198,
220,
220,
220,
220,
628,
198,
220,
220,
220,
360,
796,
288,
14,
16,
68,
21,
198,
220,
220,
220,
406,
796,
300,
1220,
8576,
198,
220,
220,
220,
220,
198,
220,
220,
220,
374,
796,
360,
14,
17,
198,
220,
220,
220,
220,
198,
220,
220,
220,
317,
796,
406,
1635,
18074,
222,
1635,
360,
628,
220,
220,
220,
31641,
796,
371,
7,
5080,
8,
198,
220,
220,
220,
289,
796,
289,
1102,
303,
310,
38801,
7,
52,
11,
360,
11,
1815,
11,
11940,
11,
11243,
8,
198,
220,
220,
220,
1312,
796,
19862,
17034,
7,
71,
9,
32,
9,
7,
5080,
12,
38586,
20679,
49,
86,
8,
628,
220,
220,
220,
1441,
1312,
9,
12825,
198,
437,
628
] | 1.905206 | 2,036 |
function avgfilter1d_constprop_setup(n, w = 3)
xs = rand(SVector{w,UInt8}, n)
ys = zero(xs)
return (; ys, xs)
end
@inline function avg_at(xs0, i, N)
@static if USE_ALIASSCOPE
xs = Const(xs0)
else
xs = xs0
end
s = zero(eltype(xs))
for k in 1:N
s = s .+ @inbounds xs[i + k - 1]
end
return s .÷ N
end
@inline function avgfilter1d_constprop_seq!(ys, xs, N = 4)
@assert axes(ys) == axes(xs)
for i0 in 0:length(xs) - N
i = firstindex(xs) + i0
@inbounds ys[i] = avg_at(xs, i, N)
end
return ys
end
@inline function avgfilter1d_constprop_threads!(ys, xs, N = 4)
@assert axes(ys) == axes(xs)
Threads.@threads for i0 in 0:length(xs) - N
i = firstindex(xs) + i0
@inbounds ys[i] = avg_at(xs, i, N)
end
return ys
end
# Using `@inline` to nudge that the 3-arg method sees the constant 4 set by the
# "outer" 2-arg function.
@inline function avgfilter1d_constprop_tapir_dac!(ys, xs, N = 4)
@assert axes(ys) == axes(xs)
Tapir.@par dac for i0 in 0:length(xs) - N
i = firstindex(xs) + i0
@inbounds ys[i] = avg_at(xs, i, N)
@grainsize 131072
end
return ys
end
@inline function avgfilter1d_constprop_tapir_seq!(ys, xs, N = 4)
@assert axes(ys) == axes(xs)
Tapir.@par seq for i0 in 0:length(xs) - N
i = firstindex(xs) + i0
@inbounds ys[i] = avg_at(xs, i, N)
@grainsize 131072
end
return ys
end
| [
8818,
42781,
24455,
16,
67,
62,
9979,
22930,
62,
40406,
7,
77,
11,
266,
796,
513,
8,
198,
220,
220,
220,
2124,
82,
796,
43720,
7,
50,
38469,
90,
86,
11,
52,
5317,
23,
5512,
299,
8,
198,
220,
220,
220,
331,
82,
796,
6632,
7,
34223,
8,
198,
220,
220,
220,
1441,
357,
26,
331,
82,
11,
2124,
82,
8,
198,
437,
198,
198,
31,
45145,
2163,
42781,
62,
265,
7,
34223,
15,
11,
1312,
11,
399,
8,
198,
220,
220,
220,
2488,
12708,
611,
23210,
62,
1847,
43429,
6173,
32135,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
82,
796,
4757,
7,
34223,
15,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
82,
796,
2124,
82,
15,
198,
220,
220,
220,
886,
198,
220,
220,
220,
264,
796,
6632,
7,
417,
4906,
7,
34223,
4008,
198,
220,
220,
220,
329,
479,
287,
352,
25,
45,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
264,
764,
10,
2488,
259,
65,
3733,
2124,
82,
58,
72,
1343,
479,
532,
352,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
264,
764,
127,
115,
399,
198,
437,
198,
198,
31,
45145,
2163,
42781,
24455,
16,
67,
62,
9979,
22930,
62,
41068,
0,
7,
893,
11,
2124,
82,
11,
399,
796,
604,
8,
198,
220,
220,
220,
2488,
30493,
34197,
7,
893,
8,
6624,
34197,
7,
34223,
8,
198,
220,
220,
220,
329,
1312,
15,
287,
657,
25,
13664,
7,
34223,
8,
532,
399,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
796,
717,
9630,
7,
34223,
8,
1343,
1312,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
331,
82,
58,
72,
60,
796,
42781,
62,
265,
7,
34223,
11,
1312,
11,
399,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
331,
82,
198,
437,
198,
198,
31,
45145,
2163,
42781,
24455,
16,
67,
62,
9979,
22930,
62,
16663,
82,
0,
7,
893,
11,
2124,
82,
11,
399,
796,
604,
8,
198,
220,
220,
220,
2488,
30493,
34197,
7,
893,
8,
6624,
34197,
7,
34223,
8,
198,
220,
220,
220,
14122,
82,
13,
31,
16663,
82,
329,
1312,
15,
287,
657,
25,
13664,
7,
34223,
8,
532,
399,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
796,
717,
9630,
7,
34223,
8,
1343,
1312,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
331,
82,
58,
72,
60,
796,
42781,
62,
265,
7,
34223,
11,
1312,
11,
399,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
331,
82,
198,
437,
198,
198,
2,
8554,
4600,
31,
45145,
63,
284,
299,
12587,
326,
262,
513,
12,
853,
2446,
7224,
262,
6937,
604,
900,
416,
262,
198,
2,
366,
39605,
1,
362,
12,
853,
2163,
13,
198,
31,
45145,
2163,
42781,
24455,
16,
67,
62,
9979,
22930,
62,
44335,
343,
62,
67,
330,
0,
7,
893,
11,
2124,
82,
11,
399,
796,
604,
8,
198,
220,
220,
220,
2488,
30493,
34197,
7,
893,
8,
6624,
34197,
7,
34223,
8,
198,
220,
220,
220,
16880,
343,
13,
31,
1845,
288,
330,
329,
1312,
15,
287,
657,
25,
13664,
7,
34223,
8,
532,
399,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
796,
717,
9630,
7,
34223,
8,
1343,
1312,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
331,
82,
58,
72,
60,
796,
42781,
62,
265,
7,
34223,
11,
1312,
11,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
2164,
1299,
1096,
1511,
940,
4761,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
331,
82,
198,
437,
198,
198,
31,
45145,
2163,
42781,
24455,
16,
67,
62,
9979,
22930,
62,
44335,
343,
62,
41068,
0,
7,
893,
11,
2124,
82,
11,
399,
796,
604,
8,
198,
220,
220,
220,
2488,
30493,
34197,
7,
893,
8,
6624,
34197,
7,
34223,
8,
198,
220,
220,
220,
16880,
343,
13,
31,
1845,
33756,
329,
1312,
15,
287,
657,
25,
13664,
7,
34223,
8,
532,
399,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
796,
717,
9630,
7,
34223,
8,
1343,
1312,
15,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
331,
82,
58,
72,
60,
796,
42781,
62,
265,
7,
34223,
11,
1312,
11,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
2164,
1299,
1096,
1511,
940,
4761,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
331,
82,
198,
437,
198
] | 1.970784 | 753 |
srand(1)
a = mapweight(grid2(20),x->1/(rand(1)[1]));
la = lap(a)
n = size(la)[1]
b = randn(n)
b = b - mean(b);
d = diag(la)
pre = (x)->(x ./ d)
x = pcg(la,b,pre,maxits=2000,maxtime=1,verbose=true);
x = Laplacians.pcgBLAS(la,b,pre,maxits=2000,maxtime=1,verbose=true);
x = Laplacians.pcgSlow(la,b,pre,maxits=2000,maxtime=1,verbose=true);
x = pcg(la,b,pre,maxits=2000,verbose=true);
x = Laplacians.pcgBLAS(la,b,pre,maxits=2000,verbose=true);
x = Laplacians.pcgSlow(la,b,pre,maxits=2000,verbose=true);
x = Laplacians.pcgBLAS(la,b,pre,tol=1e-2);
x = Laplacians.pcgSlow(la,b,pre,tol=1e-2);
x = pcg(la,b,pre,tol=1e-2);
x = cg(la,b,verbose=true,maxtime=1,maxits=1000);
x = Laplacians.cgBLAS(la,b,verbose=true,maxtime=1,maxits=1000);
x = Laplacians.cgSlow(la,b,verbose=true,maxtime=1,maxits=1000);
x = cg(la,b,verbose=true,maxits=2000);
x = Laplacians.cgBLAS(la,b,verbose=true,maxits=2000);
x = Laplacians.cgSlow(la,b,verbose=true,maxits=2000);
x = cg(la,b,verbose=true,tol=0.5);
x = Laplacians.cgBLAS(la,b,verbose=true,tol=0.5);
x = Laplacians.cgSlow(la,b,verbose=true,tol=0.5);
n = 100
a = wtedChimera(n,3)
la = lap(a)
f = cgSolver(la,verbose=false)
b = randn(n)
b = b - mean(b)
x = f(b)
norm(la*x-b)
x = f(b,maxits=15,verbose=true, maxtime=1)
d = diagm(1./diag(la))
pre = x -> d*x
x = pcg(la, b, diagm(diag(la)),maxits=10)
x = pcg(la, b, pre,maxits=10,verbose=true)
f = pcgSolver(la, diagm(diag(la)) ,maxits=10,verbose=true)
x = f(b)
f = pcgSolver(la,pre,maxits=10,verbose=false)
x = f(b,verbose=true, maxits=1000, maxtime = 2)
| [
82,
25192,
7,
16,
8,
198,
64,
796,
3975,
6551,
7,
25928,
17,
7,
1238,
828,
87,
3784,
16,
29006,
25192,
7,
16,
38381,
16,
12962,
1776,
198,
5031,
796,
14779,
7,
64,
8,
198,
77,
796,
2546,
7,
5031,
38381,
16,
60,
198,
65,
796,
43720,
77,
7,
77,
8,
198,
65,
796,
275,
532,
1612,
7,
65,
1776,
198,
198,
67,
796,
2566,
363,
7,
5031,
8,
198,
3866,
796,
357,
87,
8,
3784,
7,
87,
24457,
288,
8,
198,
198,
87,
796,
40653,
70,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
2611,
742,
524,
28,
16,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
9148,
1921,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
2611,
742,
524,
28,
16,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
36423,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
2611,
742,
524,
28,
16,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
40653,
70,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
9148,
1921,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
36423,
7,
5031,
11,
65,
11,
3866,
11,
9806,
896,
28,
11024,
11,
19011,
577,
28,
7942,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
9148,
1921,
7,
5031,
11,
65,
11,
3866,
11,
83,
349,
28,
16,
68,
12,
17,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
14751,
70,
36423,
7,
5031,
11,
65,
11,
3866,
11,
83,
349,
28,
16,
68,
12,
17,
1776,
198,
87,
796,
40653,
70,
7,
5031,
11,
65,
11,
3866,
11,
83,
349,
28,
16,
68,
12,
17,
1776,
198,
198,
87,
796,
269,
70,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
2611,
742,
524,
28,
16,
11,
9806,
896,
28,
12825,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
9148,
1921,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
2611,
742,
524,
28,
16,
11,
9806,
896,
28,
12825,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
36423,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
2611,
742,
524,
28,
16,
11,
9806,
896,
28,
12825,
1776,
198,
87,
796,
269,
70,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
9806,
896,
28,
11024,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
9148,
1921,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
9806,
896,
28,
11024,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
36423,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
9806,
896,
28,
11024,
1776,
198,
87,
796,
269,
70,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
83,
349,
28,
15,
13,
20,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
9148,
1921,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
83,
349,
28,
15,
13,
20,
1776,
198,
87,
796,
4689,
489,
330,
1547,
13,
66,
70,
36423,
7,
5031,
11,
65,
11,
19011,
577,
28,
7942,
11,
83,
349,
28,
15,
13,
20,
1776,
628,
628,
198,
77,
796,
1802,
198,
64,
796,
266,
1513,
1925,
320,
8607,
7,
77,
11,
18,
8,
198,
5031,
796,
14779,
7,
64,
8,
198,
198,
69,
796,
269,
70,
50,
14375,
7,
5031,
11,
19011,
577,
28,
9562,
8,
198,
65,
796,
43720,
77,
7,
77,
8,
198,
65,
796,
275,
532,
1612,
7,
65,
8,
198,
87,
796,
277,
7,
65,
8,
198,
27237,
7,
5031,
9,
87,
12,
65,
8,
198,
198,
87,
796,
277,
7,
65,
11,
9806,
896,
28,
1314,
11,
19011,
577,
28,
7942,
11,
17266,
742,
524,
28,
16,
8,
198,
198,
67,
796,
2566,
363,
76,
7,
16,
19571,
10989,
363,
7,
5031,
4008,
198,
3866,
796,
2124,
4613,
288,
9,
87,
198,
198,
87,
796,
40653,
70,
7,
5031,
11,
275,
11,
2566,
363,
76,
7,
10989,
363,
7,
5031,
36911,
9806,
896,
28,
940,
8,
198,
87,
796,
40653,
70,
7,
5031,
11,
275,
11,
662,
11,
9806,
896,
28,
940,
11,
19011,
577,
28,
7942,
8,
198,
69,
796,
40653,
70,
50,
14375,
7,
5031,
11,
2566,
363,
76,
7,
10989,
363,
7,
5031,
4008,
837,
9806,
896,
28,
940,
11,
19011,
577,
28,
7942,
8,
198,
87,
796,
277,
7,
65,
8,
198,
69,
796,
40653,
70,
50,
14375,
7,
5031,
11,
3866,
11,
9806,
896,
28,
940,
11,
19011,
577,
28,
9562,
8,
198,
87,
796,
277,
7,
65,
11,
19011,
577,
28,
7942,
11,
3509,
896,
28,
12825,
11,
17266,
742,
524,
796,
362,
8,
198
] | 1.853688 | 827 |
using Plots
using Colors
pyplot()
include("N_plots.jl")
# Model and Objective
N = 51
model, obj = Dynamics.dubinscar_parallelpark
obj_uncon = UnconstrainedObjective(obj)
opts = SolverOptions()
opts.verbose = false
opts.cost_tolerance = 1e-6
opts.cost_tolerance_intermediate = 1e-5
opts.constraint_tolerance = 1e-4
opts.resolve_feasible = false
opts.outer_loop_update_type = :default
opts.penalty_scaling = 200
opts.penalty_initial = .1
opts.R_infeasible = 20
dircol_options = Dict("tol"=>opts.cost_tolerance,"constr_viol_tol"=>opts.constraint_tolerance)
#### UNCONSTRAINED #####
solver = Solver(model, obj_uncon, N=N, opts=opts)
n,m,N = get_sizes(solver)
U0 = ones(m,N)
X0 = line_trajectory(solver)
X0_rollout = rollout(solver,U0)
res_i, stats_i = solve(solver,U0)
stats_i["iterations"]
stats_i["runtime"]
evals(solver,:f) / stats_i["iterations"]
res_p, stats_p = solve_dircol(solver,X0_rollout,U0)
stats_p["iterations"]
evals(solver,:f)/stats_p["iterations"]
stats_p["runtime"]
Ns = [101,201,301,401]
group = "parallelpark/unconstrained"
run_step_size_comparison(model, obj_uncon, U0, group, Ns, opts=opts, integrations=[:rk3,:ipopt],benchmark=true)
plot_stat("runtime",group,legend=:bottomright,["rk3","ipopt"],title="Unconstrained Parallel Park")
plot_stat("iterations",group,legend=:bottom,["rk3","ipopt"],title="Unconstrained Parallel Park")
plot_stat("error",group,yscale=:log10,legend=:right,["rk3","ipopt"],title="Unconstrained Parallel Park")
plot_stat("std",group,yscale=:log10,legend=:right,["rk3","ipopt"],title="Unconstrained Parallel Park")
#### CONSTRAINED ####
solver = Solver(model, obj, N=N, opts=opts)
n,m,N = get_sizes(solver)
U0 = ones(m,N)
X0 = line_trajectory(solver)
X0_rollout = rollout(solver,U0)
res_i, stats_i = solve(solver,U0)
res_p, stats_p = solve_dircol(solver,X0_rollout,U0)
stats_i["iterations"]
stats_i["runtime"]
evals(solver,:f) / stats_i["iterations"]
stats_p["iterations"]
evals(solver,:f)/stats_p["iterations"]
stats_p["runtime"]
Ns = [101,201,301,401]
group = "parallelpark/constrained"
run_step_size_comparison(model, obj, U0, group, Ns, opts=opts, integrations=[:rk3,:ipopt],benchmark=true)
plot_stat("runtime",group,legend=:bottomright,["rk3","ipopt",""],title="Constrained Parallel Park",color=[:blue :darkorange2])
savefig(joinpath(IMAGE_DIR,"ppark_runtime.eps"))
plot_stat("iterations",group,legend=:bottom,["rk3","ipopt"],title="Constrained Parallel Park",color=[:blue :darkorange2])
savefig(joinpath(IMAGE_DIR,"ppark_iterations.eps"))
plot_stat("error",group,yscale=:log10,legend=:right,["rk3","ipopt"],title="Constrained Parallel Park")
Plots.eps(joinpath(IMAGE_DIR,"ppark_runtime"))
# Constraint vs time (Newton tail)
# using TrajectoryOptimization: gen_usrfun_newton, NewtonVars, gen_newton_functions, newton_projection
# t_start = time_ns()
# V_ = newton_projection(solver,res_i,eps=1e-8,verbose=false)
# res_ = ConstrainedVectorResults(solver,V_.Z.X,V_.Z.U)
# backwardpass!(res_,solver)
# rollout!(res_,solver,0.0)
# max_violation(res_)
# t_newton = float(time_ns()-t_start)/1e9
#
# t_i = 0.469548 # from running @btime
# t_p = 0.659831 # from running @btime
# t_2 = 11.325 # from running @btime
# time_i = collect(range(0,stop=t_i,length=stats_i["iterations"]))
# time_p = range(0,stop=t_p,length=stats_p["iterations"])
# p = plot(time_p,stats_p["c_max"][2:end],yscale=:log10,label="Ipopt",color=:blue,width=2,
# markershape=:circle,markerstrokecolor=:blue)
# c_max = [stats_i["c_max"]; max_violation(res_)]
# push!(time_i,t_i+t_newton)
# plot!(time_i,c_max,label="ALTRO*",color=:green,width=2,markershape=:circle,markerstrokecolor=:green,
# xlabel="runtime (s)",ylabel="max constraint violation")
# plot_vertical_lines!(p,[t_i])
# time_2 = range(0,step=time_i[2]-time_i[1],length=stats_2["iterations"])
# plot!(time_2,stats_2["c_max"],label="ALTRO",width=2,color=:darkorange2,
# markershape=:circle,markerstrokecolor=:darkorange2,xlim=[0,1.5],size=(500,250))
# savefig(p,joinpath(IMAGE_DIR,"ppark_newton.eps"))
# Constraint vs Iteration (Newton tail)
using TrajectoryOptimization: gen_usrfun_newton, NewtonVars, gen_newton_functions, newton_projection
t_start = time_ns()
solver.opts.iterations = 25
solver.opts.constraint_tolerance = 1e-2
res_i, stats_i = solve(solver,U0)
max_violation(res_i)
plot(stats_i["c_max"],yscale=:log10)
V_ = newton_projection(solver,res_i,eps=1e-8,verbose=false)
res_ = ConstrainedVectorResults(solver,V_.Z.X,V_.Z.U)
backwardpass!(res_,solver)
rollout!(res_,solver,0.0)
max_violation(res_)
t_newton = float(time_ns()-t_start)/1e9
t_i = 0.469548 # from running @btime
t_p = 0.659831 # from running @btime
t_2 = 11.325 # from running @btime
time_i = collect(range(0,stop=t_i,length=stats_i["iterations"]))
time_p = range(0,stop=t_p,length=stats_p["iterations"])
p = plot(time_p,stats_p["c_max"][2:end],yscale=:log10,label="Ipopt",color=:blue,width=2,
markershape=:circle,markerstrokecolor=:blue)
c_max = [stats_i["c_max"]; max_violation(res_)]
push!(time_i,t_i+t_newton)
plot!(time_i,c_max,label="ALTRO*",color=:green,width=2,markershape=:circle,markerstrokecolor=:green,
xlabel="runtime (s)",ylabel="max constraint violation")
plot_vertical_lines!(p,[t_i])
time_2 = range(0,step=time_i[2]-time_i[1],length=stats_2["iterations"])
plot!(time_2,stats_2["c_max"],label="ALTRO",width=2,color=:darkorange2,
markershape=:circle,markerstrokecolor=:darkorange2,xlim=[0,1.5],size=(500,250))
savefig(p,joinpath(IMAGE_DIR,"ppark_newton.eps"))
# #### INFEASIBLE ####
# opts = SolverOptions()
# opts.verbose = false
# opts.cost_tolerance = 1e-6
# opts.cost_tolerance_intermediate = 1e-3
# opts.cost_tolerance_infeasible = 1e-4
# opts.constraint_tolerance = 1e-4
# opts.resolve_feasible = false
# opts.outer_loop_update_type = :default
# opts.use_nesterov = true
# opts.penalty_scaling = 200
# opts.penalty_initial = 10
# opts.R_infeasible = 10
# opts.square_root = true
# opts.constraint_decrease_ratio = 0.25
# opts.penalty_update_frequency = 2
#
# solver = Solver(model, obj, N=101, opts=opts)
# n,m,N = get_sizes(solver)
# U0 = ones(m,N)
# X0 = line_trajectory(solver)
# X0_rollout = rollout(solver,U0)
#
# solver.opts.verbose = false
# solver.opts.resolve_feasible = true
# solver.opts.cost_tolerance_infeasible = 1e-5
# @time res_i, stats_i = solve(solver,X0,U0)
# stats_i["iterations"]
# res_i.U[1]
# stats_i["runtime"]
# stats_i["iterations (infeasible)"]
# @time res_p, stats_p = solve_dircol(solver,X0_rollout,U0)
# # res_s, stats_s = solve_dircol(solver,X0_rollout,U0,nlp=:snopt)
#
# # import TrajectoryOptimization: _solve, get_feasible_trajectory
# # results = copy(res_i)
# # solver.state.infeasible = true
# # results_feasible = get_feasible_trajectory(results, solver)
# # results_feasible.λ_prev[1]
#
# # solver.state.infeasible
# # res, stats = _solve(solver,to_array(results_feasible.U),prevResults=results_feasible); stats["iterations"]
# # res, stats = _solve(solver,to_array(results_feasible.U)); stats["iterations"]
# # res, stats = _solve(solver,to_array(results_feasible.U),λ=results_feasible.λ); stats["iterations"]
# # res, stats = _solve(solver,to_array(results_feasible.U),λ=results_feasible.λ,μ=results_feasible.μ); stats["iterations"]
# #
#
# constraint_plot(solver,X0,U0)
#
# Ns = [101,201,301,401]
# group = "parallelpark/infeasible"
# run_step_size_comparison(model, obj, U0, group, Ns, opts=opts, integrations=[:rk3,:ipopt],benchmark=true, infeasible=true)
# plot_stat("runtime",group,legend=:bottomright,["rk3","ipopt"],title="Constrained Parallel Park (infeasible)",ylim=[0,1.5])
# plot_stat("iterations",group,legend=:bottom,["rk3","ipopt"],title="Constrained Parallel Park (infeasible)")
# plot_stat("error",group,yscale=:log10,legend=:right,["rk3","ipopt"],title="Constrained Parallel Park (infeasible)")
#
#
#
# Combined Plot
group = "parallelpark/constrained"
Ns, data = load_data("runtime","ipopt","parallelpark/constrained")
Ns, err = load_data("std","ipopt","parallelpark/constrained")
p1 = plot(Ns,data,yerr=err,label="DIRCOL",color=:blue,marker=:circle,markerstrokecolor=:blue,ylabel="runtime",markersize=6)
Ns, data = load_data("runtime","rk3","parallelpark/constrained")
Ns, err = load_data("std","rk3","parallelpark/constrained")
plot!(Ns,data,yerr=err,label="ALTRO",color=:darkorange2,marker=:circle,markerstrokecolor=:darkorange2,markersize=6,ylim=(0,1.9))
Ns, data = load_data("runtime","rk3","parallelpark/infeasible")
Ns, err = load_data("std","rk3","parallelpark/infeasible")
plot!(Ns,data,yerr=err,label="ALTRO (inf)",color=:darkorange2,style=:dash,
marker=:utriangle,markerstrokecolor=:darkorange2,markersize=8,
title="Constrained",titlefontsize=10)
Ns, err = load_data("std","rk3","parallelpark/infeasible")
Ns, data = load_data("runtime",["rk3","ipopt"],"parallelpark/unconstrained")
Ns, err = load_data("std",["rk3","ipopt"],"parallelpark/unconstrained")
p2 = plot(Ns,data[2],yerr=err[2],color=:blue,style=:dot,label="DIRCOL", width=1.5,
marker=:square,markerstrokecolor=:blue,legend=:topleft,markersize=4,ylim=ylims(p1))
plot!(Ns,data[1],yerr=err[1],color=:darkorange2,style=:dot,label="ALTRO",width=1.5,
marker=:square,markerstrokecolor=:darkorange2,markersize=4,
title="Unconstrained",titlefontsize=10)
plot(p1,p2,layout=(1,2),size=(500,300),dpi=400,xlabel="Knot points",ylabel="Runtime")
savefig(joinpath(IMAGE_DIR,"ppark_runtime.png"))
| [
3500,
1345,
1747,
198,
3500,
29792,
198,
9078,
29487,
3419,
198,
17256,
7203,
45,
62,
489,
1747,
13,
20362,
4943,
198,
198,
2,
9104,
290,
37092,
198,
45,
796,
6885,
198,
19849,
11,
26181,
796,
33806,
13,
67,
549,
1040,
7718,
62,
1845,
29363,
20928,
198,
26801,
62,
403,
1102,
796,
791,
1102,
2536,
1328,
10267,
425,
7,
26801,
8,
198,
198,
404,
912,
796,
4294,
332,
29046,
3419,
198,
404,
912,
13,
19011,
577,
796,
3991,
198,
404,
912,
13,
15805,
62,
83,
37668,
796,
352,
68,
12,
21,
198,
404,
912,
13,
15805,
62,
83,
37668,
62,
3849,
13857,
796,
352,
68,
12,
20,
198,
404,
912,
13,
1102,
2536,
2913,
62,
83,
37668,
796,
352,
68,
12,
19,
198,
404,
912,
13,
411,
6442,
62,
5036,
292,
856,
796,
3991,
198,
404,
912,
13,
39605,
62,
26268,
62,
19119,
62,
4906,
796,
1058,
12286,
198,
404,
912,
13,
3617,
6017,
62,
1416,
4272,
796,
939,
198,
404,
912,
13,
3617,
6017,
62,
36733,
796,
764,
16,
198,
404,
912,
13,
49,
62,
259,
5036,
292,
856,
796,
1160,
198,
67,
1980,
349,
62,
25811,
796,
360,
713,
7203,
83,
349,
1,
14804,
404,
912,
13,
15805,
62,
83,
37668,
553,
1102,
2536,
62,
17069,
62,
83,
349,
1,
14804,
404,
912,
13,
1102,
2536,
2913,
62,
83,
37668,
8,
198,
198,
4242,
4725,
10943,
2257,
3861,
1268,
1961,
46424,
198,
82,
14375,
796,
4294,
332,
7,
19849,
11,
26181,
62,
403,
1102,
11,
399,
28,
45,
11,
2172,
82,
28,
404,
912,
8,
198,
77,
11,
76,
11,
45,
796,
651,
62,
82,
4340,
7,
82,
14375,
8,
198,
52,
15,
796,
3392,
7,
76,
11,
45,
8,
198,
55,
15,
796,
1627,
62,
9535,
752,
652,
7,
82,
14375,
8,
198,
55,
15,
62,
2487,
448,
796,
38180,
7,
82,
14375,
11,
52,
15,
8,
198,
198,
411,
62,
72,
11,
9756,
62,
72,
796,
8494,
7,
82,
14375,
11,
52,
15,
8,
198,
34242,
62,
72,
14692,
2676,
602,
8973,
198,
34242,
62,
72,
14692,
43282,
8973,
198,
1990,
874,
7,
82,
14375,
11,
25,
69,
8,
1220,
9756,
62,
72,
14692,
2676,
602,
8973,
198,
198,
411,
62,
79,
11,
9756,
62,
79,
796,
8494,
62,
67,
1980,
349,
7,
82,
14375,
11,
55,
15,
62,
2487,
448,
11,
52,
15,
8,
198,
34242,
62,
79,
14692,
2676,
602,
8973,
198,
1990,
874,
7,
82,
14375,
11,
25,
69,
20679,
34242,
62,
79,
14692,
2676,
602,
8973,
198,
34242,
62,
79,
14692,
43282,
8973,
198,
198,
47503,
796,
685,
8784,
11,
1264,
11,
18938,
11,
21844,
60,
198,
8094,
796,
366,
1845,
29363,
20928,
14,
403,
1102,
2536,
1328,
1,
198,
5143,
62,
9662,
62,
7857,
62,
785,
1845,
1653,
7,
19849,
11,
26181,
62,
403,
1102,
11,
471,
15,
11,
1448,
11,
399,
82,
11,
2172,
82,
28,
404,
912,
11,
4132,
9143,
41888,
25,
81,
74,
18,
11,
25,
541,
8738,
4357,
26968,
4102,
28,
7942,
8,
198,
29487,
62,
14269,
7203,
43282,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3118,
1102,
2536,
1328,
42945,
3250,
4943,
198,
29487,
62,
14269,
7203,
2676,
602,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3118,
1102,
2536,
1328,
42945,
3250,
4943,
198,
29487,
62,
14269,
7203,
18224,
1600,
8094,
11,
28349,
1000,
28,
25,
6404,
940,
11,
1455,
437,
28,
25,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3118,
1102,
2536,
1328,
42945,
3250,
4943,
198,
29487,
62,
14269,
7203,
19282,
1600,
8094,
11,
28349,
1000,
28,
25,
6404,
940,
11,
1455,
437,
28,
25,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3118,
1102,
2536,
1328,
42945,
3250,
4943,
198,
198,
4242,
7102,
2257,
3861,
1268,
1961,
1303,
21017,
198,
82,
14375,
796,
4294,
332,
7,
19849,
11,
26181,
11,
399,
28,
45,
11,
2172,
82,
28,
404,
912,
8,
198,
77,
11,
76,
11,
45,
796,
651,
62,
82,
4340,
7,
82,
14375,
8,
198,
52,
15,
796,
3392,
7,
76,
11,
45,
8,
198,
55,
15,
796,
1627,
62,
9535,
752,
652,
7,
82,
14375,
8,
198,
55,
15,
62,
2487,
448,
796,
38180,
7,
82,
14375,
11,
52,
15,
8,
198,
198,
411,
62,
72,
11,
9756,
62,
72,
796,
8494,
7,
82,
14375,
11,
52,
15,
8,
198,
411,
62,
79,
11,
9756,
62,
79,
796,
8494,
62,
67,
1980,
349,
7,
82,
14375,
11,
55,
15,
62,
2487,
448,
11,
52,
15,
8,
198,
198,
34242,
62,
72,
14692,
2676,
602,
8973,
198,
34242,
62,
72,
14692,
43282,
8973,
198,
1990,
874,
7,
82,
14375,
11,
25,
69,
8,
1220,
9756,
62,
72,
14692,
2676,
602,
8973,
198,
198,
34242,
62,
79,
14692,
2676,
602,
8973,
198,
1990,
874,
7,
82,
14375,
11,
25,
69,
20679,
34242,
62,
79,
14692,
2676,
602,
8973,
198,
34242,
62,
79,
14692,
43282,
8973,
198,
198,
47503,
796,
685,
8784,
11,
1264,
11,
18938,
11,
21844,
60,
198,
8094,
796,
366,
1845,
29363,
20928,
14,
1102,
2536,
1328,
1,
198,
5143,
62,
9662,
62,
7857,
62,
785,
1845,
1653,
7,
19849,
11,
26181,
11,
471,
15,
11,
1448,
11,
399,
82,
11,
2172,
82,
28,
404,
912,
11,
4132,
9143,
41888,
25,
81,
74,
18,
11,
25,
541,
8738,
4357,
26968,
4102,
28,
7942,
8,
198,
29487,
62,
14269,
7203,
43282,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
2430,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
1600,
8043,
41888,
25,
17585,
1058,
21953,
43745,
17,
12962,
198,
21928,
5647,
7,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
43282,
13,
25386,
48774,
198,
29487,
62,
14269,
7203,
2676,
602,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
1600,
8043,
41888,
25,
17585,
1058,
21953,
43745,
17,
12962,
198,
21928,
5647,
7,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
2676,
602,
13,
25386,
48774,
198,
29487,
62,
14269,
7203,
18224,
1600,
8094,
11,
28349,
1000,
28,
25,
6404,
940,
11,
1455,
437,
28,
25,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
4943,
198,
3646,
1747,
13,
25386,
7,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
43282,
48774,
198,
198,
2,
1482,
2536,
2913,
3691,
640,
357,
3791,
1122,
7894,
8,
198,
2,
1262,
4759,
752,
652,
27871,
320,
1634,
25,
2429,
62,
14629,
12543,
62,
3605,
1122,
11,
17321,
53,
945,
11,
2429,
62,
3605,
1122,
62,
12543,
2733,
11,
649,
1122,
62,
16302,
295,
198,
2,
256,
62,
9688,
796,
640,
62,
5907,
3419,
198,
2,
569,
62,
796,
649,
1122,
62,
16302,
295,
7,
82,
14375,
11,
411,
62,
72,
11,
25386,
28,
16,
68,
12,
23,
11,
19011,
577,
28,
9562,
8,
198,
2,
581,
62,
796,
1482,
2536,
1328,
38469,
25468,
7,
82,
14375,
11,
53,
44807,
57,
13,
55,
11,
53,
44807,
57,
13,
52,
8,
198,
2,
19528,
6603,
0,
7,
411,
62,
11,
82,
14375,
8,
198,
2,
38180,
0,
7,
411,
62,
11,
82,
14375,
11,
15,
13,
15,
8,
198,
2,
3509,
62,
17069,
341,
7,
411,
62,
8,
198,
2,
256,
62,
3605,
1122,
796,
12178,
7,
2435,
62,
5907,
3419,
12,
83,
62,
9688,
20679,
16,
68,
24,
198,
2,
198,
2,
256,
62,
72,
796,
657,
13,
19,
37381,
2780,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
2,
256,
62,
79,
796,
657,
13,
2996,
4089,
3132,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
2,
256,
62,
17,
796,
1367,
13,
26582,
220,
220,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
2,
640,
62,
72,
796,
2824,
7,
9521,
7,
15,
11,
11338,
28,
83,
62,
72,
11,
13664,
28,
34242,
62,
72,
14692,
2676,
602,
8973,
4008,
198,
2,
640,
62,
79,
796,
2837,
7,
15,
11,
11338,
28,
83,
62,
79,
11,
13664,
28,
34242,
62,
79,
14692,
2676,
602,
8973,
8,
198,
2,
279,
796,
7110,
7,
2435,
62,
79,
11,
34242,
62,
79,
14692,
66,
62,
9806,
1,
7131,
17,
25,
437,
4357,
28349,
1000,
28,
25,
6404,
940,
11,
18242,
2625,
40,
79,
8738,
1600,
8043,
28,
25,
17585,
11,
10394,
28,
17,
11,
198,
2,
220,
220,
220,
220,
19736,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
17585,
8,
198,
2,
269,
62,
9806,
796,
685,
34242,
62,
72,
14692,
66,
62,
9806,
8973,
26,
3509,
62,
17069,
341,
7,
411,
62,
15437,
198,
2,
4574,
0,
7,
2435,
62,
72,
11,
83,
62,
72,
10,
83,
62,
3605,
1122,
8,
198,
2,
7110,
0,
7,
2435,
62,
72,
11,
66,
62,
9806,
11,
18242,
2625,
1847,
5446,
46,
9,
1600,
8043,
28,
25,
14809,
11,
10394,
28,
17,
11,
4102,
364,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
14809,
11,
198,
2,
220,
220,
220,
220,
2124,
18242,
2625,
43282,
357,
82,
42501,
2645,
9608,
2625,
9806,
32315,
8747,
4943,
198,
2,
7110,
62,
1851,
605,
62,
6615,
0,
7,
79,
17414,
83,
62,
72,
12962,
198,
2,
640,
62,
17,
796,
2837,
7,
15,
11,
9662,
28,
2435,
62,
72,
58,
17,
45297,
2435,
62,
72,
58,
16,
4357,
13664,
28,
34242,
62,
17,
14692,
2676,
602,
8973,
8,
198,
2,
7110,
0,
7,
2435,
62,
17,
11,
34242,
62,
17,
14692,
66,
62,
9806,
33116,
18242,
2625,
1847,
5446,
46,
1600,
10394,
28,
17,
11,
8043,
28,
25,
21953,
43745,
17,
11,
198,
2,
220,
220,
220,
220,
19736,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
21953,
43745,
17,
11,
87,
2475,
41888,
15,
11,
16,
13,
20,
4357,
7857,
16193,
4059,
11,
9031,
4008,
198,
2,
3613,
5647,
7,
79,
11,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
3605,
1122,
13,
25386,
48774,
198,
198,
2,
1482,
2536,
2913,
3691,
40806,
341,
357,
3791,
1122,
7894,
8,
198,
3500,
4759,
752,
652,
27871,
320,
1634,
25,
2429,
62,
14629,
12543,
62,
3605,
1122,
11,
17321,
53,
945,
11,
2429,
62,
3605,
1122,
62,
12543,
2733,
11,
649,
1122,
62,
16302,
295,
198,
83,
62,
9688,
796,
640,
62,
5907,
3419,
198,
82,
14375,
13,
404,
912,
13,
2676,
602,
796,
1679,
198,
82,
14375,
13,
404,
912,
13,
1102,
2536,
2913,
62,
83,
37668,
796,
352,
68,
12,
17,
198,
411,
62,
72,
11,
9756,
62,
72,
796,
8494,
7,
82,
14375,
11,
52,
15,
8,
198,
9806,
62,
17069,
341,
7,
411,
62,
72,
8,
198,
198,
29487,
7,
34242,
62,
72,
14692,
66,
62,
9806,
33116,
28349,
1000,
28,
25,
6404,
940,
8,
198,
198,
53,
62,
796,
649,
1122,
62,
16302,
295,
7,
82,
14375,
11,
411,
62,
72,
11,
25386,
28,
16,
68,
12,
23,
11,
19011,
577,
28,
9562,
8,
198,
411,
62,
796,
1482,
2536,
1328,
38469,
25468,
7,
82,
14375,
11,
53,
44807,
57,
13,
55,
11,
53,
44807,
57,
13,
52,
8,
198,
1891,
904,
6603,
0,
7,
411,
62,
11,
82,
14375,
8,
198,
2487,
448,
0,
7,
411,
62,
11,
82,
14375,
11,
15,
13,
15,
8,
198,
9806,
62,
17069,
341,
7,
411,
62,
8,
198,
83,
62,
3605,
1122,
796,
12178,
7,
2435,
62,
5907,
3419,
12,
83,
62,
9688,
20679,
16,
68,
24,
198,
198,
83,
62,
72,
796,
657,
13,
19,
37381,
2780,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
83,
62,
79,
796,
657,
13,
2996,
4089,
3132,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
83,
62,
17,
796,
1367,
13,
26582,
220,
220,
220,
1303,
422,
2491,
2488,
65,
2435,
198,
2435,
62,
72,
796,
2824,
7,
9521,
7,
15,
11,
11338,
28,
83,
62,
72,
11,
13664,
28,
34242,
62,
72,
14692,
2676,
602,
8973,
4008,
198,
2435,
62,
79,
796,
2837,
7,
15,
11,
11338,
28,
83,
62,
79,
11,
13664,
28,
34242,
62,
79,
14692,
2676,
602,
8973,
8,
198,
79,
796,
7110,
7,
2435,
62,
79,
11,
34242,
62,
79,
14692,
66,
62,
9806,
1,
7131,
17,
25,
437,
4357,
28349,
1000,
28,
25,
6404,
940,
11,
18242,
2625,
40,
79,
8738,
1600,
8043,
28,
25,
17585,
11,
10394,
28,
17,
11,
198,
220,
220,
220,
19736,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
17585,
8,
198,
66,
62,
9806,
796,
685,
34242,
62,
72,
14692,
66,
62,
9806,
8973,
26,
3509,
62,
17069,
341,
7,
411,
62,
15437,
198,
14689,
0,
7,
2435,
62,
72,
11,
83,
62,
72,
10,
83,
62,
3605,
1122,
8,
198,
29487,
0,
7,
2435,
62,
72,
11,
66,
62,
9806,
11,
18242,
2625,
1847,
5446,
46,
9,
1600,
8043,
28,
25,
14809,
11,
10394,
28,
17,
11,
4102,
364,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
14809,
11,
198,
220,
220,
220,
2124,
18242,
2625,
43282,
357,
82,
42501,
2645,
9608,
2625,
9806,
32315,
8747,
4943,
198,
29487,
62,
1851,
605,
62,
6615,
0,
7,
79,
17414,
83,
62,
72,
12962,
198,
2435,
62,
17,
796,
2837,
7,
15,
11,
9662,
28,
2435,
62,
72,
58,
17,
45297,
2435,
62,
72,
58,
16,
4357,
13664,
28,
34242,
62,
17,
14692,
2676,
602,
8973,
8,
198,
29487,
0,
7,
2435,
62,
17,
11,
34242,
62,
17,
14692,
66,
62,
9806,
33116,
18242,
2625,
1847,
5446,
46,
1600,
10394,
28,
17,
11,
8043,
28,
25,
21953,
43745,
17,
11,
198,
220,
220,
220,
19736,
71,
1758,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
21953,
43745,
17,
11,
87,
2475,
41888,
15,
11,
16,
13,
20,
4357,
7857,
16193,
4059,
11,
9031,
4008,
198,
21928,
5647,
7,
79,
11,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
3605,
1122,
13,
25386,
48774,
198,
198,
2,
1303,
21017,
3268,
15112,
1921,
34563,
1303,
21017,
198,
2,
2172,
82,
796,
4294,
332,
29046,
3419,
198,
2,
2172,
82,
13,
19011,
577,
796,
3991,
198,
2,
2172,
82,
13,
15805,
62,
83,
37668,
796,
352,
68,
12,
21,
198,
2,
2172,
82,
13,
15805,
62,
83,
37668,
62,
3849,
13857,
796,
352,
68,
12,
18,
198,
2,
2172,
82,
13,
15805,
62,
83,
37668,
62,
259,
5036,
292,
856,
796,
352,
68,
12,
19,
198,
2,
2172,
82,
13,
1102,
2536,
2913,
62,
83,
37668,
796,
352,
68,
12,
19,
198,
2,
2172,
82,
13,
411,
6442,
62,
5036,
292,
856,
796,
3991,
198,
2,
2172,
82,
13,
39605,
62,
26268,
62,
19119,
62,
4906,
796,
1058,
12286,
198,
2,
2172,
82,
13,
1904,
62,
2516,
353,
709,
796,
2081,
198,
2,
2172,
82,
13,
3617,
6017,
62,
1416,
4272,
796,
939,
198,
2,
2172,
82,
13,
3617,
6017,
62,
36733,
796,
838,
198,
2,
2172,
82,
13,
49,
62,
259,
5036,
292,
856,
796,
838,
198,
2,
2172,
82,
13,
23415,
62,
15763,
796,
2081,
198,
2,
2172,
82,
13,
1102,
2536,
2913,
62,
12501,
260,
589,
62,
10366,
952,
796,
657,
13,
1495,
198,
2,
2172,
82,
13,
3617,
6017,
62,
19119,
62,
35324,
796,
362,
198,
2,
198,
2,
1540,
332,
796,
4294,
332,
7,
19849,
11,
26181,
11,
399,
28,
8784,
11,
2172,
82,
28,
404,
912,
8,
198,
2,
299,
11,
76,
11,
45,
796,
651,
62,
82,
4340,
7,
82,
14375,
8,
198,
2,
471,
15,
796,
3392,
7,
76,
11,
45,
8,
198,
2,
1395,
15,
796,
1627,
62,
9535,
752,
652,
7,
82,
14375,
8,
198,
2,
1395,
15,
62,
2487,
448,
796,
38180,
7,
82,
14375,
11,
52,
15,
8,
198,
2,
198,
2,
1540,
332,
13,
404,
912,
13,
19011,
577,
796,
3991,
198,
2,
1540,
332,
13,
404,
912,
13,
411,
6442,
62,
5036,
292,
856,
796,
2081,
198,
2,
1540,
332,
13,
404,
912,
13,
15805,
62,
83,
37668,
62,
259,
5036,
292,
856,
796,
352,
68,
12,
20,
198,
2,
2488,
2435,
581,
62,
72,
11,
9756,
62,
72,
796,
8494,
7,
82,
14375,
11,
55,
15,
11,
52,
15,
8,
198,
2,
9756,
62,
72,
14692,
2676,
602,
8973,
198,
2,
581,
62,
72,
13,
52,
58,
16,
60,
198,
2,
9756,
62,
72,
14692,
43282,
8973,
198,
2,
9756,
62,
72,
14692,
2676,
602,
357,
259,
5036,
292,
856,
8,
8973,
198,
2,
2488,
2435,
581,
62,
79,
11,
9756,
62,
79,
796,
8494,
62,
67,
1980,
349,
7,
82,
14375,
11,
55,
15,
62,
2487,
448,
11,
52,
15,
8,
198,
2,
1303,
581,
62,
82,
11,
9756,
62,
82,
796,
8494,
62,
67,
1980,
349,
7,
82,
14375,
11,
55,
15,
62,
2487,
448,
11,
52,
15,
11,
21283,
79,
28,
25,
16184,
8738,
8,
198,
2,
198,
2,
1303,
1330,
4759,
752,
652,
27871,
320,
1634,
25,
4808,
82,
6442,
11,
651,
62,
5036,
292,
856,
62,
9535,
752,
652,
198,
2,
1303,
2482,
796,
4866,
7,
411,
62,
72,
8,
198,
2,
1303,
1540,
332,
13,
5219,
13,
259,
5036,
292,
856,
796,
2081,
198,
2,
1303,
2482,
62,
5036,
292,
856,
796,
651,
62,
5036,
292,
856,
62,
9535,
752,
652,
7,
43420,
11,
1540,
332,
8,
198,
2,
1303,
2482,
62,
5036,
292,
856,
13,
39377,
62,
47050,
58,
16,
60,
198,
2,
198,
2,
1303,
1540,
332,
13,
5219,
13,
259,
5036,
292,
856,
198,
2,
1303,
581,
11,
9756,
796,
4808,
82,
6442,
7,
82,
14375,
11,
1462,
62,
18747,
7,
43420,
62,
5036,
292,
856,
13,
52,
828,
47050,
25468,
28,
43420,
62,
5036,
292,
856,
1776,
9756,
14692,
2676,
602,
8973,
198,
2,
1303,
581,
11,
9756,
796,
4808,
82,
6442,
7,
82,
14375,
11,
1462,
62,
18747,
7,
43420,
62,
5036,
292,
856,
13,
52,
18125,
9756,
14692,
2676,
602,
8973,
198,
2,
1303,
581,
11,
9756,
796,
4808,
82,
6442,
7,
82,
14375,
11,
1462,
62,
18747,
7,
43420,
62,
5036,
292,
856,
13,
52,
828,
39377,
28,
43420,
62,
5036,
292,
856,
13,
39377,
1776,
9756,
14692,
2676,
602,
8973,
198,
2,
1303,
581,
11,
9756,
796,
4808,
82,
6442,
7,
82,
14375,
11,
1462,
62,
18747,
7,
43420,
62,
5036,
292,
856,
13,
52,
828,
39377,
28,
43420,
62,
5036,
292,
856,
13,
39377,
11,
34703,
28,
43420,
62,
5036,
292,
856,
13,
34703,
1776,
9756,
14692,
2676,
602,
8973,
198,
2,
1303,
198,
2,
198,
2,
32315,
62,
29487,
7,
82,
14375,
11,
55,
15,
11,
52,
15,
8,
198,
2,
198,
2,
399,
82,
796,
685,
8784,
11,
1264,
11,
18938,
11,
21844,
60,
198,
2,
1448,
796,
366,
1845,
29363,
20928,
14,
259,
5036,
292,
856,
1,
198,
2,
1057,
62,
9662,
62,
7857,
62,
785,
1845,
1653,
7,
19849,
11,
26181,
11,
471,
15,
11,
1448,
11,
399,
82,
11,
2172,
82,
28,
404,
912,
11,
4132,
9143,
41888,
25,
81,
74,
18,
11,
25,
541,
8738,
4357,
26968,
4102,
28,
7942,
11,
1167,
30412,
856,
28,
7942,
8,
198,
2,
7110,
62,
14269,
7203,
43282,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
357,
259,
5036,
292,
856,
42501,
88,
2475,
41888,
15,
11,
16,
13,
20,
12962,
198,
2,
7110,
62,
14269,
7203,
2676,
602,
1600,
8094,
11,
1455,
437,
28,
25,
22487,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
357,
259,
5036,
292,
856,
8,
4943,
198,
2,
7110,
62,
14269,
7203,
18224,
1600,
8094,
11,
28349,
1000,
28,
25,
6404,
940,
11,
1455,
437,
28,
25,
3506,
11,
14692,
81,
74,
18,
2430,
541,
8738,
33116,
7839,
2625,
3103,
2536,
1328,
42945,
3250,
357,
259,
5036,
292,
856,
8,
4943,
198,
2,
198,
2,
198,
2,
198,
2,
32028,
28114,
198,
8094,
796,
366,
1845,
29363,
20928,
14,
1102,
2536,
1328,
1,
198,
47503,
11,
1366,
796,
3440,
62,
7890,
7203,
43282,
2430,
541,
8738,
2430,
1845,
29363,
20928,
14,
1102,
2536,
1328,
4943,
198,
47503,
11,
11454,
796,
3440,
62,
7890,
7203,
19282,
2430,
541,
8738,
2430,
1845,
29363,
20928,
14,
1102,
2536,
1328,
4943,
198,
79,
16,
796,
7110,
7,
47503,
11,
7890,
11,
88,
8056,
28,
8056,
11,
18242,
2625,
34720,
25154,
1600,
8043,
28,
25,
17585,
11,
4102,
263,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
17585,
11,
2645,
9608,
2625,
43282,
1600,
4102,
364,
1096,
28,
21,
8,
198,
47503,
11,
1366,
796,
3440,
62,
7890,
7203,
43282,
2430,
81,
74,
18,
2430,
1845,
29363,
20928,
14,
1102,
2536,
1328,
4943,
198,
47503,
11,
11454,
796,
3440,
62,
7890,
7203,
19282,
2430,
81,
74,
18,
2430,
1845,
29363,
20928,
14,
1102,
2536,
1328,
4943,
198,
29487,
0,
7,
47503,
11,
7890,
11,
88,
8056,
28,
8056,
11,
18242,
2625,
1847,
5446,
46,
1600,
8043,
28,
25,
21953,
43745,
17,
11,
4102,
263,
28,
25,
45597,
11,
4102,
263,
30757,
8043,
28,
25,
21953,
43745,
17,
11,
4102,
364,
1096,
28,
21,
11,
88,
2475,
16193,
15,
11,
16,
13,
24,
4008,
198,
47503,
11,
1366,
796,
3440,
62,
7890,
7203,
43282,
2430,
81,
74,
18,
2430,
1845,
29363,
20928,
14,
259,
5036,
292,
856,
4943,
198,
47503,
11,
11454,
796,
3440,
62,
7890,
7203,
19282,
2430,
81,
74,
18,
2430,
1845,
29363,
20928,
14,
259,
5036,
292,
856,
4943,
198,
29487,
0,
7,
47503,
11,
7890,
11,
88,
8056,
28,
8056,
11,
18242,
2625,
1847,
5446,
46,
357,
10745,
42501,
8043,
28,
25,
21953,
43745,
17,
11,
7635,
28,
25,
42460,
11,
198,
220,
220,
220,
18364,
28,
25,
315,
380,
9248,
11,
4102,
263,
30757,
8043,
28,
25,
21953,
43745,
17,
11,
4102,
364,
1096,
28,
23,
11,
198,
220,
220,
220,
3670,
2625,
3103,
2536,
1328,
1600,
7839,
10331,
7857,
28,
940,
8,
198,
198,
47503,
11,
11454,
796,
3440,
62,
7890,
7203,
19282,
2430,
81,
74,
18,
2430,
1845,
29363,
20928,
14,
259,
5036,
292,
856,
4943,
198,
198,
47503,
11,
1366,
796,
3440,
62,
7890,
7203,
43282,
1600,
14692,
81,
74,
18,
2430,
541,
8738,
34171,
1845,
29363,
20928,
14,
403,
1102,
2536,
1328,
4943,
198,
47503,
11,
11454,
796,
3440,
62,
7890,
7203,
19282,
1600,
14692,
81,
74,
18,
2430,
541,
8738,
34171,
1845,
29363,
20928,
14,
403,
1102,
2536,
1328,
4943,
198,
79,
17,
796,
7110,
7,
47503,
11,
7890,
58,
17,
4357,
88,
8056,
28,
8056,
58,
17,
4357,
8043,
28,
25,
17585,
11,
7635,
28,
25,
26518,
11,
18242,
2625,
34720,
25154,
1600,
9647,
28,
16,
13,
20,
11,
198,
220,
220,
220,
18364,
28,
25,
23415,
11,
4102,
263,
30757,
8043,
28,
25,
17585,
11,
1455,
437,
28,
25,
83,
643,
701,
11,
4102,
364,
1096,
28,
19,
11,
88,
2475,
28,
88,
2475,
82,
7,
79,
16,
4008,
198,
29487,
0,
7,
47503,
11,
7890,
58,
16,
4357,
88,
8056,
28,
8056,
58,
16,
4357,
8043,
28,
25,
21953,
43745,
17,
11,
7635,
28,
25,
26518,
11,
18242,
2625,
1847,
5446,
46,
1600,
10394,
28,
16,
13,
20,
11,
198,
220,
220,
220,
18364,
28,
25,
23415,
11,
4102,
263,
30757,
8043,
28,
25,
21953,
43745,
17,
11,
4102,
364,
1096,
28,
19,
11,
198,
220,
220,
220,
3670,
2625,
3118,
1102,
2536,
1328,
1600,
7839,
10331,
7857,
28,
940,
8,
198,
29487,
7,
79,
16,
11,
79,
17,
11,
39786,
16193,
16,
11,
17,
828,
7857,
16193,
4059,
11,
6200,
828,
67,
14415,
28,
7029,
11,
87,
18242,
2625,
42,
1662,
2173,
1600,
2645,
9608,
2625,
41006,
4943,
198,
198,
21928,
5647,
7,
22179,
6978,
7,
3955,
11879,
62,
34720,
553,
381,
668,
62,
43282,
13,
11134,
48774,
198
] | 2.35891 | 3,962 |
@inline function generate_compat_entry(v::VersionNumber)::String
if v.major == 0 && v.minor == 0
return "0.0.$(v.patch)"
else
return "$(v.major).$(v.minor)"
end
end
# The `_remove_trailing_zeros` function is based on
# the `compat_version` function from:
# https://github.com/invenia/PkgTemplates.jl/blob/master/src/plugins/project_file.jl
@inline function _remove_trailing_zeros(v::VersionNumber)::String
if v.patch == 0
if v.minor == 0
if v.major == 0 # v.major is 0, v.minor is 0, v.patch is 0
throw(DomainError("0.0.0 is not a valid input"))
else # v.major is nonzero and v.minor is 0 and v.patch is 0
return "$(v.major)"
end
else # v.minor is nonzero, v.patch is 0
return "$(v.major).$(v.minor)"
end
else # v.patch is nonzero
return "$(v.major).$(v.minor).$(v.patch)"
end
end
# @inline function MajorMinorVersion(version::VersionNumber)
# major = version.major::Base.VInt
# minor = version.minor::Base.VInt
# result = MajorMinorVersion(major, minor)
# return result
# end
# @inline MajorMinorVersion(::Nothing) = nothing
# @inline function VersionNumber(x::MajorMinorVersion)
# major = x.major::Base.VInt
# minor = x.minor::Base.VInt
# result = VersionNumber(x, y)::VersionNumber
# return result
# end
# @inline function Base.isless(a::MajorMinorVersion, b::MajorMinorVersion)
# a_versionnumber = VersionNumber(a)::VersionNumber
# b_versionnumber = VersionNumber(b)::VersionNumber
# result = Base.isless(a_versionnumber, b_versionnumber)
# return result
# end
| [
31,
45145,
2163,
7716,
62,
5589,
265,
62,
13000,
7,
85,
3712,
14815,
15057,
2599,
25,
10100,
198,
220,
220,
220,
611,
410,
13,
22478,
6624,
657,
11405,
410,
13,
1084,
273,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
15,
13,
15,
48082,
7,
85,
13,
17147,
16725,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17971,
7,
85,
13,
22478,
737,
3,
7,
85,
13,
1084,
273,
16725,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
383,
4600,
62,
28956,
62,
9535,
4386,
62,
9107,
418,
63,
2163,
318,
1912,
319,
198,
2,
262,
4600,
5589,
265,
62,
9641,
63,
2163,
422,
25,
198,
2,
3740,
1378,
12567,
13,
785,
14,
259,
574,
544,
14,
47,
10025,
12966,
17041,
13,
20362,
14,
2436,
672,
14,
9866,
14,
10677,
14,
37390,
14,
16302,
62,
7753,
13,
20362,
198,
198,
31,
45145,
2163,
4808,
28956,
62,
9535,
4386,
62,
9107,
418,
7,
85,
3712,
14815,
15057,
2599,
25,
10100,
198,
220,
220,
220,
611,
410,
13,
17147,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
611,
410,
13,
1084,
273,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
410,
13,
22478,
6624,
657,
1303,
410,
13,
22478,
318,
657,
11,
410,
13,
1084,
273,
318,
657,
11,
410,
13,
17147,
318,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3714,
7,
43961,
12331,
7203,
15,
13,
15,
13,
15,
318,
407,
257,
4938,
5128,
48774,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
1303,
410,
13,
22478,
318,
1729,
22570,
290,
410,
13,
1084,
273,
318,
657,
290,
410,
13,
17147,
318,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
17971,
7,
85,
13,
22478,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
1303,
410,
13,
1084,
273,
318,
1729,
22570,
11,
410,
13,
17147,
318,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
17971,
7,
85,
13,
22478,
737,
3,
7,
85,
13,
1084,
273,
16725,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
1303,
410,
13,
17147,
318,
1729,
22570,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17971,
7,
85,
13,
22478,
737,
3,
7,
85,
13,
1084,
273,
737,
3,
7,
85,
13,
17147,
16725,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
2488,
45145,
2163,
8386,
39825,
14815,
7,
9641,
3712,
14815,
15057,
8,
198,
2,
220,
220,
220,
220,
1688,
796,
2196,
13,
22478,
3712,
14881,
13,
53,
5317,
198,
2,
220,
220,
220,
220,
4159,
796,
2196,
13,
1084,
273,
3712,
14881,
13,
53,
5317,
198,
2,
220,
220,
220,
220,
1255,
796,
8386,
39825,
14815,
7,
22478,
11,
4159,
8,
198,
2,
220,
220,
220,
220,
1441,
1255,
198,
2,
886,
198,
198,
2,
2488,
45145,
8386,
39825,
14815,
7,
3712,
18465,
8,
796,
2147,
198,
198,
2,
2488,
45145,
2163,
10628,
15057,
7,
87,
3712,
24206,
39825,
14815,
8,
198,
2,
220,
220,
220,
220,
1688,
796,
2124,
13,
22478,
3712,
14881,
13,
53,
5317,
198,
2,
220,
220,
220,
220,
4159,
796,
2124,
13,
1084,
273,
3712,
14881,
13,
53,
5317,
198,
2,
220,
220,
220,
220,
1255,
796,
10628,
15057,
7,
87,
11,
331,
2599,
25,
14815,
15057,
198,
2,
220,
220,
220,
220,
1441,
1255,
198,
2,
886,
198,
198,
2,
2488,
45145,
2163,
7308,
13,
271,
1203,
7,
64,
3712,
24206,
39825,
14815,
11,
275,
3712,
24206,
39825,
14815,
8,
198,
2,
220,
220,
220,
220,
257,
62,
9641,
17618,
796,
10628,
15057,
7,
64,
2599,
25,
14815,
15057,
198,
2,
220,
220,
220,
220,
275,
62,
9641,
17618,
796,
10628,
15057,
7,
65,
2599,
25,
14815,
15057,
198,
2,
220,
220,
220,
220,
1255,
796,
7308,
13,
271,
1203,
7,
64,
62,
9641,
17618,
11,
275,
62,
9641,
17618,
8,
198,
2,
220,
220,
220,
220,
1441,
1255,
198,
2,
886,
198
] | 2.383738 | 701 |
module Orekit
import Dates
using Pkg.Artifacts
using JavaCall
using Reexport
function init()
JavaCall.addClassPath(joinpath(artifact"jars", "orekit-artifacts-10.2", "*.jar"))
JavaCall.init()
end
include(joinpath(@__DIR__, "..", "gen", "OrekitWrapper", "OrekitWrapper.jl"))
include(joinpath(@__DIR__, "..", "gen", "HipparchusWrapper", "HipparchusWrapper.jl"))
include("Time.jl")
@reexport using .Time
end # module
| [
21412,
22452,
15813,
198,
198,
11748,
44712,
198,
3500,
350,
10025,
13,
8001,
37199,
198,
198,
3500,
7349,
14134,
198,
3500,
797,
39344,
198,
198,
8818,
2315,
3419,
198,
220,
220,
220,
7349,
14134,
13,
2860,
9487,
15235,
7,
22179,
6978,
7,
433,
29660,
1,
73,
945,
1600,
366,
382,
15813,
12,
50179,
12,
940,
13,
17,
1600,
366,
24620,
9491,
48774,
198,
220,
220,
220,
7349,
14134,
13,
15003,
3419,
198,
437,
198,
198,
17256,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
492,
1600,
366,
5235,
1600,
366,
41543,
15813,
36918,
2848,
1600,
366,
41543,
15813,
36918,
2848,
13,
20362,
48774,
198,
17256,
7,
22179,
6978,
7,
31,
834,
34720,
834,
11,
366,
492,
1600,
366,
5235,
1600,
366,
39,
3974,
998,
385,
36918,
2848,
1600,
366,
39,
3974,
998,
385,
36918,
2848,
13,
20362,
48774,
198,
198,
17256,
7203,
7575,
13,
20362,
4943,
198,
198,
31,
631,
87,
634,
1262,
764,
7575,
198,
198,
437,
1303,
8265,
198
] | 2.625767 | 163 |
# UnitCommitment.jl: Optimization Package for Security-Constrained Unit Commitment
# Copyright (C) 2020, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
struct DotDict
inner::Dict
end
DotDict() = DotDict(Dict())
function Base.setproperty!(d::DotDict, key::Symbol, value)
setindex!(getfield(d, :inner), value, key)
end
function Base.getproperty(d::DotDict, key::Symbol)
(key == :inner ? getfield(d, :inner) : d.inner[key])
end
function Base.getindex(d::DotDict, key::Int64)
d.inner[Symbol(key)]
end
function Base.getindex(d::DotDict, key::Symbol)
d.inner[key]
end
function Base.keys(d::DotDict)
keys(d.inner)
end
function Base.values(d::DotDict)
values(d.inner)
end
function Base.iterate(d::DotDict)
iterate(values(d.inner))
end
function Base.iterate(d::DotDict, v::Int64)
iterate(values(d.inner), v)
end
function Base.length(d::DotDict)
length(values(d.inner))
end
function Base.show(io::IO, d::DotDict)
print(io, "DotDict with $(length(keys(d.inner))) entries:\n")
count = 0
for k in keys(d.inner)
count += 1
if count > 10
print(io, " ...\n")
break
end
print(io, " :$(k) => $(d.inner[k])\n")
end
end
function recursive_to_dot_dict(el)
if typeof(el) == Dict{String, Any}
return DotDict(Dict(Symbol(k) => recursive_to_dot_dict(el[k]) for k in keys(el)))
else
return el
end
end
export recursive_to_dot_dict | [
2,
11801,
6935,
270,
434,
13,
20362,
25,
30011,
1634,
15717,
329,
4765,
12,
3103,
2536,
1328,
11801,
35910,
434,
198,
2,
15069,
357,
34,
8,
12131,
11,
471,
25705,
49974,
710,
11,
11419,
13,
1439,
2489,
10395,
13,
198,
2,
28728,
739,
262,
9518,
347,
10305,
5964,
13,
4091,
27975,
45761,
13,
9132,
329,
517,
3307,
13,
198,
198,
7249,
22875,
35,
713,
198,
220,
220,
220,
8434,
3712,
35,
713,
198,
437,
198,
198,
35,
313,
35,
713,
3419,
796,
22875,
35,
713,
7,
35,
713,
28955,
198,
198,
8818,
7308,
13,
2617,
26745,
0,
7,
67,
3712,
35,
313,
35,
713,
11,
1994,
3712,
13940,
23650,
11,
1988,
8,
198,
220,
220,
220,
900,
9630,
0,
7,
1136,
3245,
7,
67,
11,
1058,
5083,
828,
1988,
11,
1994,
8,
198,
437,
198,
198,
8818,
7308,
13,
1136,
26745,
7,
67,
3712,
35,
313,
35,
713,
11,
1994,
3712,
13940,
23650,
8,
198,
220,
220,
220,
357,
2539,
6624,
1058,
5083,
5633,
651,
3245,
7,
67,
11,
1058,
5083,
8,
1058,
288,
13,
5083,
58,
2539,
12962,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
67,
3712,
35,
313,
35,
713,
11,
1994,
3712,
5317,
2414,
8,
198,
220,
220,
220,
288,
13,
5083,
58,
13940,
23650,
7,
2539,
15437,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
67,
3712,
35,
313,
35,
713,
11,
1994,
3712,
13940,
23650,
8,
198,
220,
220,
220,
288,
13,
5083,
58,
2539,
60,
198,
437,
198,
198,
8818,
7308,
13,
13083,
7,
67,
3712,
35,
313,
35,
713,
8,
198,
220,
220,
220,
8251,
7,
67,
13,
5083,
8,
198,
437,
198,
198,
8818,
7308,
13,
27160,
7,
67,
3712,
35,
313,
35,
713,
8,
198,
220,
220,
220,
3815,
7,
67,
13,
5083,
8,
198,
437,
198,
198,
8818,
7308,
13,
2676,
378,
7,
67,
3712,
35,
313,
35,
713,
8,
198,
220,
220,
220,
11629,
378,
7,
27160,
7,
67,
13,
5083,
4008,
198,
437,
198,
198,
8818,
7308,
13,
2676,
378,
7,
67,
3712,
35,
313,
35,
713,
11,
410,
3712,
5317,
2414,
8,
198,
220,
220,
220,
11629,
378,
7,
27160,
7,
67,
13,
5083,
828,
410,
8,
198,
437,
198,
198,
8818,
7308,
13,
13664,
7,
67,
3712,
35,
313,
35,
713,
8,
198,
220,
220,
220,
4129,
7,
27160,
7,
67,
13,
5083,
4008,
198,
437,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
288,
3712,
35,
313,
35,
713,
8,
198,
220,
220,
220,
3601,
7,
952,
11,
366,
35,
313,
35,
713,
351,
29568,
13664,
7,
13083,
7,
67,
13,
5083,
22305,
12784,
7479,
77,
4943,
198,
220,
220,
220,
954,
796,
657,
198,
220,
220,
220,
329,
479,
287,
8251,
7,
67,
13,
5083,
8,
198,
220,
220,
220,
220,
220,
220,
220,
954,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
954,
1875,
838,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
952,
11,
366,
220,
2644,
59,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
952,
11,
366,
220,
1058,
3,
7,
74,
8,
5218,
29568,
67,
13,
5083,
58,
74,
12962,
59,
77,
4943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
45115,
62,
1462,
62,
26518,
62,
11600,
7,
417,
8,
198,
220,
220,
220,
611,
2099,
1659,
7,
417,
8,
6624,
360,
713,
90,
10100,
11,
4377,
92,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
22875,
35,
713,
7,
35,
713,
7,
13940,
23650,
7,
74,
8,
5218,
45115,
62,
1462,
62,
26518,
62,
11600,
7,
417,
58,
74,
12962,
329,
479,
287,
8251,
7,
417,
22305,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
1288,
198,
220,
220,
220,
886,
198,
437,
198,
198,
39344,
45115,
62,
1462,
62,
26518,
62,
11600
] | 2.293413 | 668 |
# packaged version of align.jl. Run align_prep.jl or prep_full.jl first.
include("../src/NMRCalibrate.jl")
import .NMRCalibrate
import NLopt
import PlotlyJS
using Plots; plotly()
PyPlot.close("all")
fig_num = 1
Random.seed!(25)
PyPlot.matplotlib["rcParams"][:update](["font.size" => 22, "font.family" => "serif"])
save_BSON_flag = true
N_d = sum( NMRCalibrate.getNd(Bs[n]) for n = 1:length(Bs) )
N_β = sum( NMRCalibrate.getNβ(κs_β_DOFs[n], Bs[n]) for n = 1:length(Bs) )
shift_lb = -ones(N_d)
shift_ub = ones(N_d)
Es = collect( NMRSpectraSimulator.καFIDModelType(Bs[i]) for i = 1:length(Bs) )
a_setp, b_setp, minxs,
rets = NMRCalibrate.setupitpab(0.1, 10, 0.7; optim_algorithm = :LN_BOBYQA)
#
w = ones(Float64, length(As))
#LS_inds = 1:length(U_cost)
loop_range = 1:length(cost_inds_set)
println("Timing:")
@time obj_funcs, minfs, minxs, rets = NMRCalibrate.aligncompoundκ(y,
U_y,
P_y,
As,
Bs,
Es,
fs,
SW,
Δsys_cs,
a_setp, b_setp, κs_β_DOFs, κs_β_orderings,
shift_lb,
shift_ub,
cost_inds_set;
loop_range = loop_range,
w = w,
N_starts = 100,
#N_starts = 500, # ethanol region 1.
local_optim_algorithm = NLopt.LN_BOBYQA,
#xtol_rel = 1e-3,
xtol_rel = 1e-9,
maxeval = 50,
maxtime = Inf,
β_optim_algorithm = :GN_DIRECT_L,
κ_lb_default = 1e-2,
κ_ub_default = 1e2,
β_max_iters = 500,
#β_max_iters = 1000,
β_xtol_rel = 1e-9,
β_ftol_rel = 1e-9,
β_maxtime = Inf);
dummy = 1
if save_BSON_flag
save_path = joinpath(project_folder, "alignment_results.bson")
BSON.bson(save_path, region_min_dist = region_min_dist,
minfs = minfs,
minxs = minxs,
rets = rets)
end
function plotregion(P, U, q_U, P_y, y, P_cost, y_cost, display_threshold_factor, display_reduction_factor,
save_folder, title_string, file_name;
save_plot_flag = true,
display_plot_flag = true,
canvas_size = (1000, 400))
# # reduce the plotting positions for low signal regions. Otherwise the plot store size will be too large, and the time to load the plot will be long.
# inds, _ = NMRSpectraSimulator.prunelowsignalentries(q_U, display_threshold_factor, display_reduction_factor)
# P_display = P[inds]
# U_display = U[inds]
# q_U_display = q_U[inds]
P_display = P
U_display = U
q_U_display = q_U
# plot.
isdir(save_folder) || mkpath(save_folder)
plots_save_path = joinpath(save_folder, file_name)
#title_string = "$(project_name) alignment results, region $(r), real part"
plot_obj = Plots.plot( P_display,
real.(q_U_display),
title = title_string,
label = "model",
seriestype = :line,
ticks = :native,
xlims = (P_display[1],P_display[end]),
hover = P_display,
linewidth = 4,
xlabel = "ppm",
ylabel = "real part of spectrum",
xflip = true,
size = canvas_size)
Plots.plot!(plot_obj, P_y, real.(y), label = "full data",
seriestype = :line,
linestyle = :dot,
xflip = true,
linewidth = 4)
Plots.plot!(plot_obj, P_cost, real.(y_cost), label = "fit data",
markershape = :circle,
seriestype = :scatter,
xflip = true)
if save_plot_flag
Plots.savefig(plot_obj, plots_save_path)
end
if display_plot_flag
display(plot_obj)
end
return nothing
end
function plotalignmentresults(As, Es, w, save_folder,
P_y, y,
region_min_dist,
obj_funcs, minfs, minxs, rets,
display_reduction_factor, display_threshold_factor,
cost_inds_set, loop_range;
canvas_size = (1000, 400),
display_flag = false,
save_plot_flag = true,
N_viz = 50000)
U = LinRange(u_min, u_max, N_viz)
P = hz2ppmfunc.(U)
U_rad = U .* (2*π)
for r in loop_range
y_cost = y[cost_inds_set[r]]
P_cost = P_y[cost_inds_set[r]]
q2 = uu->NMRSpectraSimulator.evalitpproxymixture(uu, As, Es; w = w)
obj_funcs[r](minxs[r])
# # debug.
# N_κ, N_κ_singlets = NMRCalibrate.countκ(Es)
# N_κ_vars = N_κ + N_κ_singlets
# NMRCalibrate.parseκ!(Es, ones(N_κ_vars))
# #
q_U = q2.(U_rad)
file_name = "results_real_$(r).html"
title_string = "$(project_name) alignment results, region $(r), real part"
plotregion(P, U, q_U, P_y, y, P_cost, y_cost, display_threshold_factor, display_reduction_factor,
save_folder, title_string, file_name;
save_plot_flag = save_plot_flag,
display_plot_flag = display_flag,
canvas_size = canvas_size)
end
return nothing
end
#### visualize.
# minxs[1][1] = 0.000
# minxs[2][1] = 0.000
display_reduction_factor = 100
display_threshold_factor = 0.05/10
if "L-Isoleucine" in molecule_names
display_reduction_factor = 1
display_threshold_factor = 0.001/10
end
save_plot_flag = true
display_flag = true
plotalignmentresults(As, Es, w, project_folder,
P_y, y,
region_min_dist,
obj_funcs, minfs, minxs, rets,
display_reduction_factor, display_threshold_factor,
cost_inds_set, loop_range;
canvas_size = (1000, 400),
display_flag = display_flag,
save_plot_flag = save_plot_flag,
N_viz = 50000)
for r in loop_range
println("region $(r):")
println("objective: $(minfs[r]), return status: $(rets)")
println("shift variable:")
display(minxs)
println()
end
| [
2,
25555,
2196,
286,
10548,
13,
20362,
13,
5660,
10548,
62,
46012,
13,
20362,
393,
3143,
62,
12853,
13,
20362,
717,
13,
198,
198,
17256,
7203,
40720,
10677,
14,
32755,
7397,
282,
2889,
378,
13,
20362,
4943,
198,
11748,
764,
32755,
7397,
282,
2889,
378,
198,
198,
11748,
22879,
8738,
198,
11748,
28114,
306,
20120,
198,
3500,
1345,
1747,
26,
7110,
306,
3419,
198,
198,
20519,
43328,
13,
19836,
7203,
439,
4943,
198,
5647,
62,
22510,
796,
352,
198,
198,
29531,
13,
28826,
0,
7,
1495,
8,
198,
20519,
43328,
13,
6759,
29487,
8019,
14692,
6015,
10044,
4105,
1,
7131,
25,
19119,
16151,
14692,
10331,
13,
7857,
1,
5218,
2534,
11,
366,
10331,
13,
17989,
1,
5218,
366,
2655,
361,
8973,
8,
198,
198,
21928,
62,
4462,
1340,
62,
32109,
796,
2081,
198,
198,
45,
62,
67,
796,
2160,
7,
28692,
7397,
282,
2889,
378,
13,
1136,
45,
67,
7,
37000,
58,
77,
12962,
329,
299,
796,
352,
25,
13664,
7,
37000,
8,
1267,
198,
45,
62,
26638,
796,
2160,
7,
28692,
7397,
282,
2889,
378,
13,
1136,
45,
26638,
7,
43000,
82,
62,
26638,
62,
18227,
42388,
58,
77,
4357,
347,
82,
58,
77,
12962,
329,
299,
796,
352,
25,
13664,
7,
37000,
8,
1267,
198,
198,
30846,
62,
23160,
796,
532,
1952,
7,
45,
62,
67,
8,
198,
30846,
62,
549,
796,
3392,
7,
45,
62,
67,
8,
198,
198,
23041,
796,
2824,
7,
28692,
6998,
806,
430,
8890,
8927,
13,
43000,
17394,
37,
2389,
17633,
6030,
7,
37000,
58,
72,
12962,
329,
1312,
796,
352,
25,
13664,
7,
37000,
8,
1267,
198,
198,
64,
62,
2617,
79,
11,
275,
62,
2617,
79,
11,
949,
34223,
11,
198,
220,
220,
220,
302,
912,
796,
28692,
7397,
282,
2889,
378,
13,
40406,
270,
79,
397,
7,
15,
13,
16,
11,
838,
11,
657,
13,
22,
26,
6436,
62,
282,
42289,
796,
1058,
43,
45,
62,
8202,
17513,
48,
32,
8,
198,
2,
198,
198,
86,
796,
3392,
7,
43879,
2414,
11,
4129,
7,
1722,
4008,
198,
2,
6561,
62,
521,
82,
796,
352,
25,
13664,
7,
52,
62,
15805,
8,
198,
26268,
62,
9521,
796,
352,
25,
13664,
7,
15805,
62,
521,
82,
62,
2617,
8,
198,
198,
35235,
7203,
14967,
278,
25,
4943,
198,
31,
2435,
26181,
62,
12543,
6359,
11,
949,
9501,
11,
949,
34223,
11,
302,
912,
796,
28692,
7397,
282,
2889,
378,
13,
31494,
5589,
633,
43000,
7,
88,
11,
198,
220,
220,
220,
471,
62,
88,
11,
198,
220,
220,
220,
350,
62,
88,
11,
198,
220,
220,
220,
1081,
11,
198,
220,
220,
220,
347,
82,
11,
198,
220,
220,
220,
8678,
11,
198,
220,
220,
220,
43458,
11,
198,
220,
220,
220,
12672,
11,
198,
220,
220,
220,
37455,
17597,
62,
6359,
11,
198,
220,
220,
220,
257,
62,
2617,
79,
11,
275,
62,
2617,
79,
11,
7377,
118,
82,
62,
26638,
62,
18227,
42388,
11,
7377,
118,
82,
62,
26638,
62,
2875,
654,
11,
198,
220,
220,
220,
6482,
62,
23160,
11,
198,
220,
220,
220,
6482,
62,
549,
11,
198,
220,
220,
220,
1575,
62,
521,
82,
62,
2617,
26,
198,
220,
220,
220,
9052,
62,
9521,
796,
9052,
62,
9521,
11,
198,
220,
220,
220,
266,
796,
266,
11,
198,
220,
220,
220,
399,
62,
301,
5889,
796,
1802,
11,
198,
220,
220,
220,
1303,
45,
62,
301,
5889,
796,
5323,
11,
1303,
28829,
3814,
352,
13,
198,
220,
220,
220,
1957,
62,
40085,
62,
282,
42289,
796,
22879,
8738,
13,
43,
45,
62,
8202,
17513,
48,
32,
11,
198,
220,
220,
220,
1303,
742,
349,
62,
2411,
796,
352,
68,
12,
18,
11,
198,
220,
220,
220,
220,
742,
349,
62,
2411,
796,
352,
68,
12,
24,
11,
198,
220,
220,
220,
3509,
18206,
796,
2026,
11,
198,
220,
220,
220,
17266,
742,
524,
796,
4806,
11,
198,
220,
220,
220,
27169,
62,
40085,
62,
282,
42289,
796,
1058,
16630,
62,
17931,
23988,
62,
43,
11,
198,
220,
220,
220,
7377,
118,
62,
23160,
62,
12286,
796,
352,
68,
12,
17,
11,
198,
220,
220,
220,
7377,
118,
62,
549,
62,
12286,
796,
352,
68,
17,
11,
198,
220,
220,
220,
27169,
62,
9806,
62,
270,
364,
796,
5323,
11,
198,
220,
220,
220,
1303,
26638,
62,
9806,
62,
270,
364,
796,
8576,
11,
198,
220,
220,
220,
27169,
62,
742,
349,
62,
2411,
796,
352,
68,
12,
24,
11,
198,
220,
220,
220,
27169,
62,
701,
349,
62,
2411,
796,
352,
68,
12,
24,
11,
198,
220,
220,
220,
27169,
62,
2611,
742,
524,
796,
4806,
1776,
198,
198,
67,
13513,
796,
352,
628,
198,
361,
3613,
62,
4462,
1340,
62,
32109,
198,
220,
220,
220,
3613,
62,
6978,
796,
4654,
6978,
7,
16302,
62,
43551,
11,
366,
282,
16747,
62,
43420,
13,
1443,
261,
4943,
198,
220,
220,
220,
347,
11782,
13,
1443,
261,
7,
21928,
62,
6978,
11,
3814,
62,
1084,
62,
17080,
796,
3814,
62,
1084,
62,
17080,
11,
198,
220,
220,
220,
949,
9501,
796,
949,
9501,
11,
198,
220,
220,
220,
949,
34223,
796,
949,
34223,
11,
198,
220,
220,
220,
302,
912,
796,
302,
912,
8,
198,
437,
628,
198,
8818,
7110,
36996,
7,
47,
11,
471,
11,
10662,
62,
52,
11,
350,
62,
88,
11,
331,
11,
350,
62,
15805,
11,
331,
62,
15805,
11,
3359,
62,
400,
10126,
62,
31412,
11,
3359,
62,
445,
8110,
62,
31412,
11,
198,
220,
220,
220,
3613,
62,
43551,
11,
3670,
62,
8841,
11,
2393,
62,
3672,
26,
198,
220,
220,
220,
3613,
62,
29487,
62,
32109,
796,
2081,
11,
198,
220,
220,
220,
3359,
62,
29487,
62,
32109,
796,
2081,
11,
198,
220,
220,
220,
21978,
62,
7857,
796,
357,
12825,
11,
7337,
4008,
628,
220,
220,
220,
1303,
1303,
4646,
262,
29353,
6116,
329,
1877,
6737,
7652,
13,
15323,
262,
7110,
3650,
2546,
481,
307,
1165,
1588,
11,
290,
262,
640,
284,
3440,
262,
7110,
481,
307,
890,
13,
198,
220,
220,
220,
1303,
773,
82,
11,
4808,
796,
28692,
6998,
806,
430,
8890,
8927,
13,
1050,
403,
417,
1666,
570,
282,
298,
1678,
7,
80,
62,
52,
11,
3359,
62,
400,
10126,
62,
31412,
11,
3359,
62,
445,
8110,
62,
31412,
8,
198,
220,
220,
220,
1303,
350,
62,
13812,
796,
350,
58,
521,
82,
60,
198,
220,
220,
220,
1303,
471,
62,
13812,
796,
471,
58,
521,
82,
60,
198,
220,
220,
220,
1303,
10662,
62,
52,
62,
13812,
796,
10662,
62,
52,
58,
521,
82,
60,
198,
220,
220,
220,
350,
62,
13812,
796,
350,
198,
220,
220,
220,
471,
62,
13812,
796,
471,
198,
220,
220,
220,
10662,
62,
52,
62,
13812,
796,
10662,
62,
52,
628,
220,
220,
220,
1303,
7110,
13,
198,
220,
220,
220,
318,
15908,
7,
21928,
62,
43551,
8,
8614,
33480,
6978,
7,
21928,
62,
43551,
8,
628,
220,
220,
220,
21528,
62,
21928,
62,
6978,
796,
4654,
6978,
7,
21928,
62,
43551,
11,
2393,
62,
3672,
8,
198,
220,
220,
220,
1303,
7839,
62,
8841,
796,
17971,
7,
16302,
62,
3672,
8,
19114,
2482,
11,
3814,
29568,
81,
828,
1103,
636,
1,
628,
220,
220,
220,
7110,
62,
26801,
796,
1345,
1747,
13,
29487,
7,
350,
62,
13812,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1103,
12195,
80,
62,
52,
62,
13812,
828,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
796,
3670,
62,
8841,
11,
198,
220,
220,
220,
220,
220,
220,
220,
6167,
796,
366,
19849,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
1055,
6386,
2981,
796,
1058,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
36066,
796,
1058,
30191,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
2475,
82,
796,
357,
47,
62,
13812,
58,
16,
4357,
47,
62,
13812,
58,
437,
46570,
198,
220,
220,
220,
220,
220,
220,
220,
20599,
796,
350,
62,
13812,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
796,
604,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
18242,
796,
366,
381,
76,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
331,
18242,
796,
366,
5305,
636,
286,
10958,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
2704,
541,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2546,
796,
21978,
62,
7857,
8,
628,
220,
220,
220,
1345,
1747,
13,
29487,
0,
7,
29487,
62,
26801,
11,
350,
62,
88,
11,
1103,
12195,
88,
828,
6167,
796,
366,
12853,
1366,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
1055,
6386,
2981,
796,
1058,
1370,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9493,
10992,
796,
1058,
26518,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
2704,
541,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
9493,
413,
5649,
796,
604,
8,
628,
220,
220,
220,
1345,
1747,
13,
29487,
0,
7,
29487,
62,
26801,
11,
350,
62,
15805,
11,
1103,
12195,
88,
62,
15805,
828,
6167,
796,
366,
11147,
1366,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
19736,
71,
1758,
796,
1058,
45597,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1055,
6386,
2981,
796,
1058,
1416,
1436,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
2704,
541,
796,
2081,
8,
628,
220,
220,
220,
611,
3613,
62,
29487,
62,
32109,
198,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
13,
21928,
5647,
7,
29487,
62,
26801,
11,
21528,
62,
21928,
62,
6978,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
3359,
62,
29487,
62,
32109,
198,
220,
220,
220,
220,
220,
220,
220,
3359,
7,
29487,
62,
26801,
8,
198,
220,
220,
220,
886,
628,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
8818,
458,
4997,
16747,
43420,
7,
1722,
11,
8678,
11,
266,
11,
3613,
62,
43551,
11,
198,
220,
220,
220,
350,
62,
88,
11,
331,
11,
198,
220,
220,
220,
3814,
62,
1084,
62,
17080,
11,
198,
220,
220,
220,
26181,
62,
12543,
6359,
11,
949,
9501,
11,
949,
34223,
11,
302,
912,
11,
198,
220,
220,
220,
3359,
62,
445,
8110,
62,
31412,
11,
3359,
62,
400,
10126,
62,
31412,
11,
198,
220,
220,
220,
1575,
62,
521,
82,
62,
2617,
11,
9052,
62,
9521,
26,
198,
220,
220,
220,
21978,
62,
7857,
796,
357,
12825,
11,
7337,
828,
198,
220,
220,
220,
3359,
62,
32109,
796,
3991,
11,
198,
220,
220,
220,
3613,
62,
29487,
62,
32109,
796,
2081,
11,
198,
220,
220,
220,
399,
62,
85,
528,
796,
642,
2388,
8,
628,
220,
220,
220,
471,
796,
5164,
17257,
7,
84,
62,
1084,
11,
334,
62,
9806,
11,
399,
62,
85,
528,
8,
198,
220,
220,
220,
350,
796,
289,
89,
17,
381,
76,
20786,
12195,
52,
8,
198,
220,
220,
220,
471,
62,
6335,
796,
471,
764,
9,
357,
17,
9,
46582,
8,
628,
220,
220,
220,
329,
374,
287,
9052,
62,
9521,
628,
220,
220,
220,
220,
220,
220,
220,
331,
62,
15805,
796,
331,
58,
15805,
62,
521,
82,
62,
2617,
58,
81,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
350,
62,
15805,
796,
350,
62,
88,
58,
15805,
62,
521,
82,
62,
2617,
58,
81,
11907,
628,
220,
220,
220,
220,
220,
220,
220,
10662,
17,
796,
334,
84,
3784,
32755,
6998,
806,
430,
8890,
8927,
13,
18206,
270,
381,
13907,
4948,
9602,
7,
12303,
11,
1081,
11,
8678,
26,
266,
796,
266,
8,
628,
220,
220,
220,
220,
220,
220,
220,
26181,
62,
12543,
6359,
58,
81,
16151,
1084,
34223,
58,
81,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1303,
14257,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
399,
62,
43000,
11,
399,
62,
43000,
62,
12215,
5289,
796,
28692,
7397,
282,
2889,
378,
13,
9127,
43000,
7,
23041,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
399,
62,
43000,
62,
85,
945,
796,
399,
62,
43000,
1343,
399,
62,
43000,
62,
12215,
5289,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
28692,
7397,
282,
2889,
378,
13,
29572,
43000,
0,
7,
23041,
11,
3392,
7,
45,
62,
43000,
62,
85,
945,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
1303,
628,
220,
220,
220,
220,
220,
220,
220,
10662,
62,
52,
796,
10662,
17,
12195,
52,
62,
6335,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
3672,
796,
366,
43420,
62,
5305,
62,
3,
7,
81,
737,
6494,
1,
198,
220,
220,
220,
220,
220,
220,
220,
3670,
62,
8841,
796,
17971,
7,
16302,
62,
3672,
8,
19114,
2482,
11,
3814,
29568,
81,
828,
1103,
636,
1,
628,
220,
220,
220,
220,
220,
220,
220,
7110,
36996,
7,
47,
11,
471,
11,
10662,
62,
52,
11,
350,
62,
88,
11,
331,
11,
350,
62,
15805,
11,
331,
62,
15805,
11,
3359,
62,
400,
10126,
62,
31412,
11,
3359,
62,
445,
8110,
62,
31412,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
43551,
11,
3670,
62,
8841,
11,
2393,
62,
3672,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3613,
62,
29487,
62,
32109,
796,
3613,
62,
29487,
62,
32109,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3359,
62,
29487,
62,
32109,
796,
3359,
62,
32109,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
21978,
62,
7857,
796,
21978,
62,
7857,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
2147,
198,
437,
628,
198,
4242,
38350,
13,
198,
2,
949,
34223,
58,
16,
7131,
16,
60,
796,
657,
13,
830,
198,
2,
949,
34223,
58,
17,
7131,
16,
60,
796,
657,
13,
830,
198,
13812,
62,
445,
8110,
62,
31412,
796,
1802,
198,
13812,
62,
400,
10126,
62,
31412,
796,
657,
13,
2713,
14,
940,
198,
361,
366,
43,
12,
40,
6753,
1229,
500,
1,
287,
27756,
62,
14933,
198,
220,
220,
220,
3359,
62,
445,
8110,
62,
31412,
796,
352,
198,
220,
220,
220,
3359,
62,
400,
10126,
62,
31412,
796,
657,
13,
8298,
14,
940,
198,
437,
198,
21928,
62,
29487,
62,
32109,
796,
2081,
198,
13812,
62,
32109,
796,
2081,
198,
198,
489,
4997,
16747,
43420,
7,
1722,
11,
8678,
11,
266,
11,
1628,
62,
43551,
11,
198,
220,
220,
220,
350,
62,
88,
11,
331,
11,
198,
220,
220,
220,
3814,
62,
1084,
62,
17080,
11,
198,
220,
220,
220,
26181,
62,
12543,
6359,
11,
949,
9501,
11,
949,
34223,
11,
302,
912,
11,
198,
220,
220,
220,
3359,
62,
445,
8110,
62,
31412,
11,
3359,
62,
400,
10126,
62,
31412,
11,
198,
220,
220,
220,
1575,
62,
521,
82,
62,
2617,
11,
9052,
62,
9521,
26,
198,
220,
220,
220,
21978,
62,
7857,
796,
357,
12825,
11,
7337,
828,
198,
220,
220,
220,
3359,
62,
32109,
796,
3359,
62,
32109,
11,
198,
220,
220,
220,
3613,
62,
29487,
62,
32109,
796,
3613,
62,
29487,
62,
32109,
11,
198,
220,
220,
220,
399,
62,
85,
528,
796,
642,
2388,
8,
198,
198,
1640,
374,
287,
9052,
62,
9521,
198,
220,
220,
220,
44872,
7203,
36996,
29568,
81,
2599,
4943,
198,
220,
220,
220,
44872,
7203,
15252,
425,
25,
29568,
1084,
9501,
58,
81,
46570,
1441,
3722,
25,
29568,
8004,
8,
4943,
198,
220,
220,
220,
44872,
7203,
30846,
7885,
25,
4943,
198,
220,
220,
220,
3359,
7,
1084,
34223,
8,
198,
220,
220,
220,
44872,
3419,
198,
437,
198
] | 2.121601 | 2,574 |
using Swagger
using Test
# set the current julia executable to be used henceforth
("JULIA" in keys(ENV)) || (ENV["JULIA"] = joinpath(Sys.BINDIR, "julia"))
const gencmd = joinpath(dirname(@__FILE__()), "petstore", "generate.sh")
println("Generating petstore using $gencmd")
run(`$gencmd`)
println("Running petstore tests...")
include("petstore/runtests.jl")
| [
3500,
2451,
7928,
198,
3500,
6208,
198,
198,
2,
900,
262,
1459,
474,
43640,
28883,
284,
307,
973,
12891,
25718,
198,
7203,
41,
6239,
3539,
1,
287,
8251,
7,
1677,
53,
4008,
8614,
357,
1677,
53,
14692,
41,
6239,
3539,
8973,
796,
4654,
6978,
7,
44387,
13,
33,
12115,
4663,
11,
366,
73,
43640,
48774,
198,
198,
9979,
2429,
28758,
796,
4654,
6978,
7,
15908,
3672,
7,
31,
834,
25664,
834,
3419,
828,
366,
6449,
8095,
1600,
366,
8612,
378,
13,
1477,
4943,
198,
35235,
7203,
8645,
803,
4273,
8095,
1262,
720,
5235,
28758,
4943,
198,
5143,
7,
63,
3,
5235,
28758,
63,
8,
198,
198,
35235,
7203,
28768,
4273,
8095,
5254,
9313,
8,
198,
17256,
7203,
6449,
8095,
14,
81,
2797,
3558,
13,
20362,
4943,
198
] | 2.834646 | 127 |
# ---
# title: 765. Couples Holding Hands
# id: problem765
# author: Indigo
# date: 2021-02-14
# difficulty: Hard
# categories: Greedy, Union Find, Graph
# link: <https://leetcode.com/problems/couples-holding-hands/description/>
# hidden: true
# ---
#
# N couples sit in 2N seats arranged in a row and want to hold hands. We want to
# know the minimum number of swaps so that every couple is sitting side by side.
# A _swap_ consists of choosing **any** two people, then they stand up and
# switch seats.
#
# The people and seats are represented by an integer from `0` to `2N-1`, the
# couples are numbered in order, the first couple being `(0, 1)`, the second
# couple being `(2, 3)`, and so on with the last couple being `(2N-2, 2N-1)`.
#
# The couples' initial seating is given by `row[i]` being the value of the
# person who is initially sitting in the i-th seat.
#
# **Example 1:**
#
#
#
# Input: row = [0, 2, 1, 3]
# Output: 1
# Explanation: We only need to swap the second (row[1]) and third (row[2]) person.
#
#
# **Example 2:**
#
#
#
# Input: row = [3, 2, 0, 1]
# Output: 0
# Explanation: All couples are already seated side by side.
#
#
# **Note:**
#
# 1. `len(row)` is even and in the range of `[4, 60]`.
# 2. `row` is guaranteed to be a permutation of `0...len(row)-1`.
#
#
## @lc code=start
using LeetCode
function min_swaps_couples(row::Vector{Int})
len, ps, res = length(row), length(row) ÷ 2, 0
grp = [Set{Int}() for i in 1:ps]
for i in 1:2:len
l, r = row[i] ÷ 2 + 1, row[i + 1] ÷ 2 + 1
(l != r) && (push!(grp[l], r); push!(grp[r], l))
end
visited = fill(false, ps)
q = Queue{Int}()
for i in 1:ps
visited[i] && continue
enqueue!(q, i)
visited[i] = true
cnt = 0
while !isempty(q)
frt = dequeue!(q)
cnt += 1
for neighbor in grp[frt]
visited[neighbor] && continue
enqueue!(q, neighbor)
visited[neighbor] = true
end
end
res += cnt - 1
end
res
end
## @lc code=end
| [
2,
11420,
198,
2,
3670,
25,
767,
2996,
13,
15062,
2374,
31703,
22237,
198,
2,
4686,
25,
1917,
29143,
198,
2,
1772,
25,
40673,
198,
2,
3128,
25,
33448,
12,
2999,
12,
1415,
198,
2,
8722,
25,
6912,
198,
2,
9376,
25,
11955,
4716,
11,
4479,
9938,
11,
29681,
198,
2,
2792,
25,
1279,
5450,
1378,
293,
316,
8189,
13,
785,
14,
1676,
22143,
14,
66,
280,
2374,
12,
19216,
12,
43365,
14,
11213,
15913,
198,
2,
7104,
25,
2081,
198,
2,
11420,
198,
2,
220,
198,
2,
399,
11886,
1650,
287,
362,
45,
8632,
14921,
287,
257,
5752,
290,
765,
284,
1745,
2832,
13,
775,
765,
284,
198,
2,
760,
262,
5288,
1271,
286,
43997,
523,
326,
790,
3155,
318,
5586,
1735,
416,
1735,
13,
198,
2,
317,
4808,
2032,
499,
62,
10874,
286,
11236,
12429,
1092,
1174,
734,
661,
11,
788,
484,
1302,
510,
290,
198,
2,
5078,
8632,
13,
198,
2,
220,
198,
2,
383,
661,
290,
8632,
389,
7997,
416,
281,
18253,
422,
4600,
15,
63,
284,
4600,
17,
45,
12,
16,
47671,
262,
198,
2,
11886,
389,
25840,
287,
1502,
11,
262,
717,
3155,
852,
4600,
7,
15,
11,
352,
8,
47671,
262,
1218,
198,
2,
3155,
852,
4600,
7,
17,
11,
513,
8,
47671,
290,
523,
319,
351,
262,
938,
3155,
852,
4600,
7,
17,
45,
12,
17,
11,
362,
45,
12,
16,
8,
44646,
198,
2,
220,
198,
2,
383,
11886,
6,
4238,
24800,
318,
1813,
416,
4600,
808,
58,
72,
60,
63,
852,
262,
1988,
286,
262,
198,
2,
1048,
508,
318,
7317,
5586,
287,
262,
1312,
12,
400,
5852,
13,
198,
2,
220,
198,
2,
12429,
16281,
352,
25,
1174,
220,
220,
198,
2,
220,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
220,
220,
220,
23412,
25,
5752,
796,
685,
15,
11,
362,
11,
352,
11,
513,
60,
198,
2,
220,
220,
220,
220,
25235,
25,
352,
198,
2,
220,
220,
220,
220,
50125,
341,
25,
775,
691,
761,
284,
16075,
262,
1218,
357,
808,
58,
16,
12962,
290,
2368,
357,
808,
58,
17,
12962,
1048,
13,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
198,
2,
12429,
16281,
362,
25,
1174,
220,
220,
198,
2,
220,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
220,
220,
220,
23412,
25,
5752,
796,
685,
18,
11,
362,
11,
657,
11,
352,
60,
198,
2,
220,
220,
220,
220,
25235,
25,
657,
198,
2,
220,
220,
220,
220,
50125,
341,
25,
1439,
11886,
389,
1541,
21639,
1735,
416,
1735,
13,
198,
2,
220,
220,
220,
220,
220,
198,
2,
220,
198,
2,
12429,
6425,
25,
1174,
198,
2,
220,
198,
2,
220,
220,
352,
13,
4600,
11925,
7,
808,
8,
63,
318,
772,
290,
287,
262,
2837,
286,
4600,
58,
19,
11,
3126,
60,
44646,
198,
2,
220,
220,
362,
13,
4600,
808,
63,
318,
11462,
284,
307,
257,
9943,
7094,
286,
4600,
15,
986,
11925,
7,
808,
13219,
16,
44646,
198,
2,
220,
198,
2,
220,
198,
2235,
2488,
44601,
2438,
28,
9688,
198,
3500,
1004,
316,
10669,
198,
198,
8818,
949,
62,
2032,
1686,
62,
66,
280,
2374,
7,
808,
3712,
38469,
90,
5317,
30072,
198,
220,
220,
220,
18896,
11,
26692,
11,
581,
796,
4129,
7,
808,
828,
4129,
7,
808,
8,
6184,
115,
362,
11,
657,
198,
220,
220,
220,
1036,
79,
796,
685,
7248,
90,
5317,
92,
3419,
329,
1312,
287,
352,
25,
862,
60,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
17,
25,
11925,
198,
220,
220,
220,
220,
220,
220,
220,
300,
11,
374,
796,
5752,
58,
72,
60,
6184,
115,
362,
1343,
352,
11,
5752,
58,
72,
1343,
352,
60,
6184,
115,
362,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
357,
75,
14512,
374,
8,
11405,
357,
14689,
0,
7,
2164,
79,
58,
75,
4357,
374,
1776,
4574,
0,
7,
2164,
79,
58,
81,
4357,
300,
4008,
198,
220,
220,
220,
886,
198,
220,
220,
220,
8672,
796,
6070,
7,
9562,
11,
26692,
8,
198,
220,
220,
220,
10662,
796,
4670,
518,
90,
5317,
92,
3419,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
862,
198,
220,
220,
220,
220,
220,
220,
220,
8672,
58,
72,
60,
11405,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
551,
36560,
0,
7,
80,
11,
1312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
8672,
58,
72,
60,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
269,
429,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
981,
5145,
271,
28920,
7,
80,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1216,
83,
796,
390,
36560,
0,
7,
80,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
429,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
4780,
287,
1036,
79,
58,
8310,
83,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8672,
58,
710,
394,
2865,
60,
11405,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
551,
36560,
0,
7,
80,
11,
4780,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8672,
58,
710,
394,
2865,
60,
796,
2081,
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,
581,
15853,
269,
429,
532,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
581,
198,
437,
198,
2235,
2488,
44601,
2438,
28,
437,
198
] | 2.233402 | 964 |
# NOTE: These tests are not part of the active test suite, because they require Distributions.jl.
# DO NOT INCORPORATE INTO runtests.jl.
using Distributions
using LightGraphs
using StatsBase
using Test
import Random
import Base: -
import LightGraphs: randbn
import StatsBase: SummaryStats
function -(s::SummaryStats, t::SummaryStats)
return SummaryStats(s.mean - t.mean,
s.min - t.min,
s.q25 - t.q25,
s.median - t.median,
s.q75 - t.q75,
s.max - t.max)
end
function binomial_test(n, p, s)
drand = rand(Binomial(n, p), s)
lrand = Int64[randbn(n, p) for i in 1:s]
ds = @show summarystats(drand)
ls = @show summarystats(lrand)
dσ = @show std(drand)
lσ = @show std(lrand)
summarydiff = @show ds - ls
@test abs(summarydiff.mean) / ds.mean < .10
@test abs(summarydiff.median) / ds.median < .10
@test abs(summarydiff.q25) / ds.q25 < .10
@test abs(summarydiff.q75) / ds.q75 < .10
@show dσ - lσ
@test abs(dσ - lσ) / dσ < .10
end
seed!(1234)
n = 10000
p = 0.3
s = 100000
for (n, p, s) in [(100, 0.3, 1000), (1000, 0.8, 1000), (10000, 0.25, 1000)]
binomial_test(n, p, s)
end
| [
2,
24550,
25,
2312,
5254,
389,
407,
636,
286,
262,
4075,
1332,
18389,
11,
780,
484,
2421,
46567,
507,
13,
20362,
13,
198,
2,
8410,
5626,
19387,
1581,
44680,
6158,
39319,
1057,
41989,
13,
20362,
13,
198,
198,
3500,
46567,
507,
198,
3500,
4401,
37065,
82,
198,
3500,
20595,
14881,
198,
3500,
6208,
198,
11748,
14534,
198,
198,
11748,
7308,
25,
532,
198,
11748,
4401,
37065,
82,
25,
43720,
9374,
198,
11748,
20595,
14881,
25,
21293,
29668,
198,
198,
8818,
532,
7,
82,
3712,
22093,
29668,
11,
256,
3712,
22093,
29668,
8,
198,
220,
220,
220,
1441,
21293,
29668,
7,
82,
13,
32604,
532,
256,
13,
32604,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
1084,
532,
256,
13,
1084,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
80,
1495,
532,
256,
13,
80,
1495,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
1150,
666,
532,
256,
13,
1150,
666,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
80,
2425,
532,
256,
13,
80,
2425,
11,
198,
220,
220,
220,
220,
220,
220,
220,
264,
13,
9806,
532,
256,
13,
9806,
8,
198,
437,
198,
8818,
9874,
49070,
62,
9288,
7,
77,
11,
279,
11,
264,
8,
198,
220,
220,
220,
1553,
392,
796,
43720,
7,
33,
259,
49070,
7,
77,
11,
279,
828,
264,
8,
198,
220,
220,
220,
300,
25192,
796,
2558,
2414,
58,
25192,
9374,
7,
77,
11,
279,
8,
329,
1312,
287,
352,
25,
82,
60,
628,
220,
220,
220,
288,
82,
796,
2488,
12860,
10638,
34242,
7,
7109,
392,
8,
198,
220,
220,
220,
43979,
796,
2488,
12860,
10638,
34242,
7,
14050,
392,
8,
198,
220,
220,
220,
288,
38392,
796,
2488,
12860,
14367,
7,
7109,
392,
8,
198,
220,
220,
220,
300,
38392,
796,
2488,
12860,
14367,
7,
14050,
392,
8,
628,
220,
220,
220,
10638,
26069,
796,
2488,
12860,
288,
82,
532,
43979,
198,
220,
220,
220,
2488,
9288,
2352,
7,
49736,
26069,
13,
32604,
8,
1220,
288,
82,
13,
32604,
1279,
764,
940,
198,
220,
220,
220,
2488,
9288,
2352,
7,
49736,
26069,
13,
1150,
666,
8,
1220,
288,
82,
13,
1150,
666,
1279,
764,
940,
198,
220,
220,
220,
2488,
9288,
2352,
7,
49736,
26069,
13,
80,
1495,
8,
1220,
288,
82,
13,
80,
1495,
1279,
764,
940,
198,
220,
220,
220,
2488,
9288,
2352,
7,
49736,
26069,
13,
80,
2425,
8,
1220,
288,
82,
13,
80,
2425,
1279,
764,
940,
628,
220,
220,
220,
2488,
12860,
288,
38392,
532,
300,
38392,
198,
220,
220,
220,
2488,
9288,
2352,
7,
67,
38392,
532,
300,
38392,
8,
1220,
288,
38392,
1279,
764,
940,
198,
437,
198,
28826,
0,
7,
1065,
2682,
8,
198,
77,
796,
33028,
198,
79,
796,
657,
13,
18,
198,
82,
796,
1802,
830,
198,
198,
1640,
357,
77,
11,
279,
11,
264,
8,
287,
47527,
3064,
11,
657,
13,
18,
11,
8576,
828,
357,
12825,
11,
657,
13,
23,
11,
8576,
828,
357,
49388,
11,
657,
13,
1495,
11,
8576,
15437,
198,
220,
220,
220,
9874,
49070,
62,
9288,
7,
77,
11,
279,
11,
264,
8,
198,
437,
628
] | 2.239006 | 523 |
module Classical
using LinearAlgebra
#using StaticArrays
"""
visco()
Implements a power-law dependence for the viscosity ν on the surface density Σ,
ν = ν₀(Σ/Σ₀)ᵝ
following Grätz, Seiß & Spahn (2018).
"""
function visco(Σrel,β)
THRESH = 0.01 # Thresholding allows us to use β<0, which would otherwise lead to infinities.
threshold(Σ) = Σ > THRESH ? Σ : THRESH
Σr = threshold.(Σrel)
return Diagonal(Σr.^β)
end
"""
Potentially confusing terminology: a planetary particulate disk is called a "ring",
not a disk.
"""
mutable struct ring
# α::Float64
# Δx::Float64
# Δt::Float64
# xi, xf ::Float64
N::Integer
β::Float64
ΔtMAX::Float64
# Defined on nodes:
X_::Array{Float64,1}
ΔX_::Array{Float64,1}
U_::Array{Float64,1}
# Defined on cells:
x_::Array{Float64,1}
σ_::Array{Float64,1}
Gᵐ::Any # Tridiagonal
# μ_::Array{Float64,1}
# νᵐ::Any
end
function ring(N=5;β=0,xf=3.0,xi=0.01)#10*xf/N)
xtemp_ = collect(range(xi,xf,length=N+1))
X_ = xtemp_[2:end]
U_ = 1.0 ./ X_.^4
ΔX_ = diff(xtemp_)
x_ = 0.5*(xtemp_[1:end-1]+xtemp_[2:end]) # midpoints
σ_ = ones(N)
νᵐ = visco(σ_,β)
Mᵐ = Diagonal(ΔX_)
Mⁱᵐ= Diagonal(1.0./ΔX_)
Kdiag = [1.0 ./ diff(x_)..., 0.0]
Ksuper = -Kdiag[1:end-1]
Ksub = zeros(N-1)
Kᵐ = Tridiagonal(Ksub,Kdiag,Ksuper)
Dᵐ = Tridiagonal(ones(N-1),-ones(N),zeros(N-1))
Gᵐ = 3 * Dᵐ * Kᵐ * νᵐ
μ_ = Mᵐ * σ_ # mass (per azimuthal length) in annulus
ΔtVN = 0.5 * minimum(diff(X_).^2 ./ diag(νᵐ)[1:end-1] )
ΔtADV = minimum(ΔX_ ./ U_)
ΔtMAX = min(ΔtVN,ΔtADV)
return ring(N,β,ΔtMAX,X_,ΔX_,U_,x_,σ_,Gᵐ)#,μ_)
end
function adjust!(r::ring)
νᵐ = visco(r.σ_,r.β)
Kdiag = [1.0 ./ diff(r.x_)..., 0.0]
Ksuper = -Kdiag[1:end-1]
Ksub = zeros(r.N-1)
Kᵐ = Tridiagonal(Ksub,Kdiag,Ksuper)
Dᵐ = Tridiagonal(ones(r.N-1),-ones(r.N),zeros(r.N-1))
Gᵐ = 3 * Dᵐ * Kᵐ * νᵐ
r.Gᵐ = Gᵐ
end
function advect!(r::ring;Δt=r.ΔtMAX)
σ = r.σ_; U = r.U_;; ΔX = r.ΔX_
σ[2:end] += Δt .* (σ[1:end-1] .* U[1:end-1] ./ ΔX[2:end] )
σ[1:end] -= Δt .* (σ[1:end] .* U[1:end] ./ ΔX[1:end] )
end
function diffuse!(r::ring;Δt=r.ΔtMAX,α=0.5)
Gᵐ = r.Gᵐ
N = r.N
Aᵐ = I(N) - α * Δt * Gᵐ
Bᵐ = I(N) + (1-α) * Δt * Gᵐ
# Solve:
r.σ_ = Aᵐ \ (Bᵐ * r.σ_)
# r.σ_[1] = 0.0
r.σ_[end] = 1.0
end
function iterate!(r::ring;Δt=r.ΔtMAX,α=0.5)
adjust!(r)
diffuse!(r;Δt=Δt,α=α)
advect!(r;Δt=Δt)
end
end#module
| [
21412,
43680,
198,
3500,
44800,
2348,
29230,
198,
2,
3500,
36125,
3163,
20477,
198,
198,
37811,
198,
4703,
1073,
3419,
198,
198,
3546,
1154,
902,
257,
1176,
12,
6270,
21403,
329,
262,
1490,
6966,
414,
7377,
121,
319,
262,
4417,
12109,
7377,
96,
11,
628,
220,
220,
220,
7377,
121,
796,
7377,
121,
158,
224,
222,
7,
138,
96,
14,
138,
96,
158,
224,
222,
8,
39611,
251,
198,
198,
27780,
278,
1902,
11033,
22877,
11,
1001,
72,
39683,
1222,
1338,
15386,
357,
7908,
737,
198,
37811,
198,
8818,
1490,
1073,
7,
138,
96,
2411,
11,
26638,
8,
198,
220,
220,
220,
2320,
19535,
39,
796,
657,
13,
486,
1303,
536,
10126,
278,
3578,
514,
284,
779,
27169,
27,
15,
11,
543,
561,
4306,
1085,
284,
1167,
259,
871,
13,
198,
220,
220,
220,
11387,
7,
138,
96,
8,
796,
7377,
96,
1875,
2320,
19535,
39,
5633,
7377,
96,
1058,
2320,
19535,
39,
198,
220,
220,
220,
7377,
96,
81,
796,
11387,
12195,
138,
96,
2411,
8,
198,
220,
220,
220,
1441,
6031,
27923,
7,
138,
96,
81,
13,
61,
26638,
8,
198,
437,
198,
198,
37811,
198,
25396,
3746,
15337,
29191,
25,
257,
27047,
1344,
5039,
11898,
318,
1444,
257,
366,
1806,
1600,
198,
1662,
257,
11898,
13,
198,
37811,
198,
76,
18187,
2878,
5858,
198,
2,
220,
220,
220,
26367,
3712,
43879,
2414,
198,
2,
220,
220,
220,
37455,
87,
3712,
43879,
2414,
198,
2,
220,
220,
220,
37455,
83,
3712,
43879,
2414,
198,
2,
220,
220,
220,
2124,
72,
11,
2124,
69,
7904,
43879,
2414,
198,
220,
220,
220,
399,
3712,
46541,
198,
220,
220,
220,
27169,
3712,
43879,
2414,
198,
220,
220,
220,
37455,
83,
22921,
3712,
43879,
2414,
198,
220,
220,
220,
1303,
2896,
1389,
319,
13760,
25,
198,
220,
220,
220,
1395,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
220,
220,
220,
37455,
55,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
220,
220,
220,
471,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
220,
220,
220,
1303,
2896,
1389,
319,
4778,
25,
198,
220,
220,
220,
2124,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
220,
220,
220,
18074,
225,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
220,
220,
220,
402,
39611,
238,
3712,
7149,
1303,
833,
19830,
27923,
198,
2,
220,
220,
220,
18919,
62,
3712,
19182,
90,
43879,
2414,
11,
16,
92,
198,
2,
220,
220,
220,
7377,
121,
39611,
238,
3712,
7149,
198,
437,
198,
8818,
5858,
7,
45,
28,
20,
26,
26638,
28,
15,
11,
26152,
28,
18,
13,
15,
11,
29992,
28,
15,
13,
486,
8,
2,
940,
9,
26152,
14,
45,
8,
198,
220,
220,
220,
220,
742,
45787,
62,
796,
2824,
7,
9521,
7,
29992,
11,
26152,
11,
13664,
28,
45,
10,
16,
4008,
198,
220,
220,
220,
1395,
62,
796,
220,
742,
45787,
62,
58,
17,
25,
437,
60,
198,
220,
220,
220,
471,
62,
796,
352,
13,
15,
24457,
1395,
44807,
61,
19,
198,
220,
220,
220,
37455,
55,
62,
796,
814,
7,
742,
45787,
62,
8,
198,
220,
220,
220,
2124,
62,
796,
657,
13,
20,
9,
7,
742,
45787,
62,
58,
16,
25,
437,
12,
16,
48688,
742,
45787,
62,
58,
17,
25,
437,
12962,
1303,
3095,
13033,
198,
220,
220,
220,
18074,
225,
62,
796,
3392,
7,
45,
8,
198,
220,
220,
220,
7377,
121,
39611,
238,
796,
1490,
1073,
7,
38392,
62,
11,
26638,
8,
198,
220,
220,
220,
337,
39611,
238,
796,
6031,
27923,
7,
138,
242,
55,
62,
8,
198,
220,
220,
220,
337,
46256,
109,
39611,
238,
28,
6031,
27923,
7,
16,
13,
15,
19571,
138,
242,
55,
62,
8,
198,
220,
220,
220,
509,
10989,
363,
796,
685,
16,
13,
15,
24457,
814,
7,
87,
62,
26513,
11,
657,
13,
15,
60,
198,
220,
220,
220,
509,
16668,
796,
532,
42,
10989,
363,
58,
16,
25,
437,
12,
16,
60,
198,
220,
220,
220,
509,
7266,
796,
1976,
27498,
7,
45,
12,
16,
8,
198,
220,
220,
220,
509,
39611,
238,
796,
833,
19830,
27923,
7,
42,
7266,
11,
42,
10989,
363,
11,
42,
16668,
8,
198,
220,
220,
220,
360,
39611,
238,
796,
833,
19830,
27923,
7,
1952,
7,
45,
12,
16,
828,
12,
1952,
7,
45,
828,
9107,
418,
7,
45,
12,
16,
4008,
198,
220,
220,
220,
402,
39611,
238,
796,
513,
1635,
360,
39611,
238,
1635,
509,
39611,
238,
1635,
7377,
121,
39611,
238,
198,
220,
220,
220,
18919,
62,
796,
337,
39611,
238,
1635,
18074,
225,
62,
1303,
2347,
357,
525,
35560,
320,
1071,
282,
4129,
8,
287,
1529,
23515,
198,
220,
220,
220,
37455,
83,
53,
45,
796,
657,
13,
20,
1635,
5288,
7,
26069,
7,
55,
62,
737,
61,
17,
24457,
2566,
363,
7,
26180,
39611,
238,
38381,
16,
25,
437,
12,
16,
60,
1267,
198,
220,
220,
220,
37455,
83,
2885,
53,
796,
5288,
7,
138,
242,
55,
62,
24457,
471,
62,
8,
198,
220,
220,
220,
37455,
83,
22921,
796,
949,
7,
138,
242,
83,
53,
45,
11,
138,
242,
83,
2885,
53,
8,
198,
220,
220,
220,
1441,
5858,
7,
45,
11,
26638,
11,
138,
242,
83,
22921,
11,
55,
62,
11,
138,
242,
55,
62,
11,
52,
62,
11,
87,
62,
11,
38392,
62,
11,
38,
39611,
238,
8,
2,
11,
34703,
62,
8,
198,
437,
628,
198,
8818,
4532,
0,
7,
81,
3712,
1806,
8,
198,
220,
220,
220,
7377,
121,
39611,
238,
796,
1490,
1073,
7,
81,
13,
38392,
62,
11,
81,
13,
26638,
8,
198,
220,
220,
220,
509,
10989,
363,
796,
685,
16,
13,
15,
24457,
814,
7,
81,
13,
87,
62,
26513,
11,
657,
13,
15,
60,
198,
220,
220,
220,
509,
16668,
796,
532,
42,
10989,
363,
58,
16,
25,
437,
12,
16,
60,
198,
220,
220,
220,
509,
7266,
796,
1976,
27498,
7,
81,
13,
45,
12,
16,
8,
198,
220,
220,
220,
509,
39611,
238,
796,
833,
19830,
27923,
7,
42,
7266,
11,
42,
10989,
363,
11,
42,
16668,
8,
198,
220,
220,
220,
360,
39611,
238,
796,
833,
19830,
27923,
7,
1952,
7,
81,
13,
45,
12,
16,
828,
12,
1952,
7,
81,
13,
45,
828,
9107,
418,
7,
81,
13,
45,
12,
16,
4008,
198,
220,
220,
220,
402,
39611,
238,
796,
513,
1635,
360,
39611,
238,
1635,
509,
39611,
238,
1635,
7377,
121,
39611,
238,
198,
220,
220,
220,
374,
13,
38,
39611,
238,
796,
402,
39611,
238,
198,
437,
628,
198,
8818,
512,
303,
310,
0,
7,
81,
3712,
1806,
26,
138,
242,
83,
28,
81,
13,
138,
242,
83,
22921,
8,
198,
220,
220,
220,
18074,
225,
796,
374,
13,
38392,
62,
26,
471,
796,
374,
13,
52,
62,
7665,
37455,
55,
796,
374,
13,
138,
242,
55,
62,
198,
220,
220,
220,
18074,
225,
58,
17,
25,
437,
60,
220,
220,
15853,
37455,
83,
764,
9,
357,
38392,
58,
16,
25,
437,
12,
16,
60,
764,
9,
471,
58,
16,
25,
437,
12,
16,
60,
24457,
37455,
55,
58,
17,
25,
437,
60,
1267,
198,
220,
220,
220,
18074,
225,
58,
16,
25,
437,
60,
48185,
37455,
83,
764,
9,
357,
38392,
58,
16,
25,
437,
60,
764,
9,
471,
58,
16,
25,
437,
60,
24457,
37455,
55,
58,
16,
25,
437,
60,
1267,
198,
437,
198,
198,
8818,
42864,
0,
7,
81,
3712,
1806,
26,
138,
242,
83,
28,
81,
13,
138,
242,
83,
22921,
11,
17394,
28,
15,
13,
20,
8,
198,
220,
220,
220,
402,
39611,
238,
796,
374,
13,
38,
39611,
238,
198,
220,
220,
220,
399,
796,
374,
13,
45,
198,
220,
220,
220,
317,
39611,
238,
796,
314,
7,
45,
8,
532,
220,
220,
220,
26367,
220,
1635,
37455,
83,
1635,
402,
39611,
238,
198,
220,
220,
220,
347,
39611,
238,
796,
314,
7,
45,
8,
1343,
357,
16,
12,
17394,
8,
1635,
37455,
83,
1635,
402,
39611,
238,
198,
220,
220,
220,
1303,
4294,
303,
25,
198,
220,
220,
220,
374,
13,
38392,
62,
796,
317,
39611,
238,
3467,
357,
33,
39611,
238,
1635,
374,
13,
38392,
62,
8,
198,
2,
220,
220,
220,
374,
13,
38392,
62,
58,
16,
60,
220,
220,
796,
657,
13,
15,
198,
220,
220,
220,
374,
13,
38392,
62,
58,
437,
60,
796,
352,
13,
15,
198,
437,
198,
198,
8818,
11629,
378,
0,
7,
81,
3712,
1806,
26,
138,
242,
83,
28,
81,
13,
138,
242,
83,
22921,
11,
17394,
28,
15,
13,
20,
8,
198,
220,
220,
220,
4532,
0,
7,
81,
8,
198,
220,
220,
220,
42864,
0,
7,
81,
26,
138,
242,
83,
28,
138,
242,
83,
11,
17394,
28,
17394,
8,
198,
220,
220,
220,
512,
303,
310,
0,
7,
81,
26,
138,
242,
83,
28,
138,
242,
83,
8,
198,
437,
198,
198,
437,
2,
21412,
198
] | 1.706203 | 1,467 |
let
x = zeros(150, 150)
carts = []
mutable struct Cart
dir::Int
coord::Tuple{Int, Int}
offset::Tuple{Int, Int}
end
#9
d = Dict('^' => (0,1), 'v' => (0,-1), '<' => (-1,0), '>' => (1,0))
mdirs = [(x, y) -> (y, -x), (x, y) -> (x, y), (x, y) -> (-y, x)]
for (j, line) in eachline("day13.e") |> enumerate
for (i, val) in split(line, "") |> enumerate
val[1] in ['/' '\\' '+' '-' '|'] && (x[i,j] = 1)
val[1] in ['^' 'v' '<' '>'] && push!(carts, Cart(3, (i, j), d[val[1]]))
end
end;
while true;
sort!(carts, by = x -> x.coord[2])
for c in carts; @info c
hasint = sum(x[max(1, c.coord[1] - 1): min(150, c.coord[1] + 1), max(1, c.coord[2] - 1): min(150, c.coord[2] + 1)]) > 3
if hasint
c.dir += 1; c.dir > 3 && (c.dir = 1)
c.offset = mdirs[c.dir](c.offset...)
else
nc = c.coord .+ c.offset;
if any(nc .> 150) || any(nc .< 1) || x[nc...] == 0; @info "here"
for (z, i) in enumerate(mdirs);
ncc = c.coord .+ i(c.offset...);
(any(ncc .> 150) || any(ncc .< 1)) && continue
x[ncc...] == 1 && (c.offset = i(c.offset...))
end
end
end
c.coord = c.coord .+ c.offset
for cc in carts
all(c.coord .== cc.coord) && c.offset != cc.offset && error(c.coord)
end
end
end
end
| [
1616,
198,
220,
220,
220,
220,
220,
220,
2124,
796,
1976,
27498,
7,
8628,
11,
6640,
8,
198,
220,
220,
220,
220,
220,
220,
44355,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
4517,
540,
2878,
13690,
198,
220,
220,
220,
220,
220,
220,
26672,
3712,
5317,
198,
220,
220,
220,
220,
220,
220,
6349,
3712,
51,
29291,
90,
5317,
11,
2558,
92,
198,
220,
220,
220,
220,
220,
220,
11677,
3712,
51,
29291,
90,
5317,
11,
2558,
92,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
1303,
24,
198,
220,
220,
220,
220,
220,
220,
288,
796,
360,
713,
10786,
61,
6,
5218,
357,
15,
11,
16,
828,
705,
85,
6,
5218,
357,
15,
12095,
16,
828,
705,
27,
6,
5218,
13841,
16,
11,
15,
828,
705,
29,
6,
5218,
357,
16,
11,
15,
4008,
198,
220,
220,
220,
220,
220,
220,
285,
15908,
82,
796,
47527,
87,
11,
331,
8,
4613,
357,
88,
11,
532,
87,
828,
357,
87,
11,
331,
8,
4613,
357,
87,
11,
331,
828,
357,
87,
11,
331,
8,
4613,
13841,
88,
11,
2124,
15437,
198,
220,
220,
220,
220,
220,
220,
329,
357,
73,
11,
1627,
8,
287,
1123,
1370,
7203,
820,
1485,
13,
68,
4943,
930,
29,
27056,
378,
198,
220,
220,
220,
220,
220,
220,
329,
357,
72,
11,
1188,
8,
287,
6626,
7,
1370,
11,
366,
4943,
930,
29,
27056,
378,
198,
220,
220,
220,
220,
220,
220,
1188,
58,
16,
60,
287,
685,
26488,
6,
705,
6852,
6,
705,
10,
6,
705,
19355,
705,
91,
20520,
11405,
357,
87,
58,
72,
11,
73,
60,
796,
352,
8,
198,
220,
220,
220,
220,
220,
220,
1188,
58,
16,
60,
287,
37250,
61,
6,
705,
85,
6,
705,
27,
6,
705,
29,
20520,
11405,
4574,
0,
7,
66,
5889,
11,
13690,
7,
18,
11,
357,
72,
11,
474,
828,
288,
58,
2100,
58,
16,
11907,
4008,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
26,
198,
220,
220,
220,
220,
220,
220,
981,
2081,
26,
198,
220,
220,
220,
220,
220,
220,
3297,
0,
7,
66,
5889,
11,
416,
796,
2124,
4613,
2124,
13,
37652,
58,
17,
12962,
198,
220,
220,
220,
220,
220,
220,
329,
269,
287,
44355,
26,
2488,
10951,
269,
198,
220,
220,
220,
220,
220,
220,
468,
600,
796,
2160,
7,
87,
58,
9806,
7,
16,
11,
269,
13,
37652,
58,
16,
60,
532,
352,
2599,
949,
7,
8628,
11,
269,
13,
37652,
58,
16,
60,
1343,
352,
828,
3509,
7,
16,
11,
269,
13,
37652,
58,
17,
60,
532,
352,
2599,
949,
7,
8628,
11,
269,
13,
37652,
58,
17,
60,
1343,
352,
8,
12962,
1875,
513,
198,
220,
220,
220,
220,
220,
220,
611,
468,
600,
198,
220,
220,
220,
220,
220,
220,
269,
13,
15908,
15853,
352,
26,
269,
13,
15908,
1875,
513,
11405,
357,
66,
13,
15908,
796,
352,
8,
198,
220,
220,
220,
220,
220,
220,
269,
13,
28968,
796,
285,
15908,
82,
58,
66,
13,
15908,
16151,
66,
13,
28968,
23029,
198,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
299,
66,
796,
269,
13,
37652,
764,
10,
269,
13,
28968,
26,
198,
220,
220,
220,
220,
220,
220,
611,
597,
7,
10782,
764,
29,
6640,
8,
8614,
597,
7,
10782,
764,
27,
352,
8,
8614,
2124,
58,
10782,
22345,
6624,
657,
26,
2488,
10951,
366,
1456,
1,
198,
220,
220,
220,
220,
220,
220,
329,
357,
89,
11,
1312,
8,
287,
27056,
378,
7,
9132,
17062,
1776,
198,
220,
220,
220,
220,
220,
220,
299,
535,
796,
269,
13,
37652,
764,
10,
1312,
7,
66,
13,
28968,
986,
1776,
198,
220,
220,
220,
220,
220,
220,
357,
1092,
7,
77,
535,
764,
29,
6640,
8,
8614,
597,
7,
77,
535,
764,
27,
352,
4008,
11405,
2555,
198,
220,
220,
220,
220,
220,
220,
2124,
58,
77,
535,
22345,
6624,
352,
11405,
357,
66,
13,
28968,
796,
1312,
7,
66,
13,
28968,
986,
4008,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
269,
13,
37652,
796,
269,
13,
37652,
764,
10,
269,
13,
28968,
198,
220,
220,
220,
220,
220,
220,
329,
36624,
287,
44355,
198,
220,
220,
220,
220,
220,
220,
477,
7,
66,
13,
37652,
764,
855,
36624,
13,
37652,
8,
11405,
269,
13,
28968,
14512,
36624,
13,
28968,
11405,
4049,
7,
66,
13,
37652,
8,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
886,
198
] | 1.794969 | 795 |
export permanent
"""
permanent(A)
Compute the permanent of the square matrix `A`. Works best if `A`
is relatively sparse. For a dense matrix, this will be slow.
"""
function permanent(A::Matrix{T}) where {T<:Number}
r, c = size(A)
if r != c
error("Matrix must be square")
end
if r == 0
return zero(T)
end
allow = [findall((x) -> x != 0, A[i, :]) for i = 1:r]
PG = PermGen(allow)
try
first(PG) # make sure PG is not empty
return sum(prod(A[i, p[i]] for i = 1:r) for p in PG)
catch
return zero(T)
end
end
| [
39344,
7748,
198,
37811,
198,
220,
220,
220,
7748,
7,
32,
8,
198,
198,
7293,
1133,
262,
7748,
286,
262,
6616,
17593,
4600,
32,
44646,
10933,
1266,
611,
4600,
32,
63,
198,
271,
5365,
29877,
13,
1114,
257,
15715,
17593,
11,
428,
481,
307,
3105,
13,
198,
37811,
198,
8818,
7748,
7,
32,
3712,
46912,
90,
51,
30072,
810,
1391,
51,
27,
25,
15057,
92,
198,
220,
220,
220,
374,
11,
269,
796,
2546,
7,
32,
8,
198,
220,
220,
220,
611,
374,
14512,
269,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
46912,
1276,
307,
6616,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
374,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6632,
7,
51,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1249,
796,
685,
19796,
439,
19510,
87,
8,
4613,
2124,
14512,
657,
11,
317,
58,
72,
11,
1058,
12962,
329,
1312,
796,
352,
25,
81,
60,
198,
220,
220,
220,
23842,
796,
2448,
76,
13746,
7,
12154,
8,
628,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
717,
7,
6968,
8,
220,
1303,
787,
1654,
23842,
318,
407,
6565,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
2160,
7,
1676,
67,
7,
32,
58,
72,
11,
279,
58,
72,
11907,
329,
1312,
796,
352,
25,
81,
8,
329,
279,
287,
23842,
8,
198,
220,
220,
220,
4929,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
6632,
7,
51,
8,
198,
220,
220,
220,
886,
198,
437,
198
] | 2.290698 | 258 |
#############################################################################
#Copyright (c) 2016 Charles Le Losq
#
#The MIT License (MIT)
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the #Software without restriction, including without limitation the rights to use, copy, #modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, #and to permit persons to whom the Software is furnished to do so, subject to the #following conditions:
#
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#############################################################################
function rameau(paths::Tuple,switches::Tuple;input_properties=('\t',0),prediction_coef=[0.0059;0.0005],temperature=23.0,laser=532.0,lb_break=1600.,hb_start=2600.,basetype="gcvspline")
# some function definition
calibration_model(x, p) = p[1].*x
baseline_lfmodel(x, p) = p[1].*x + p[2].*x.^2 + p[3].*x.^3
if switches[1] == "internal"
scale = 1
liste=readcsv(paths[1], skipstart=1)
names = liste[:,1]
water = Array{Float64}(liste[:,3])
smo_lf = Array{Float64}(liste[:,4])
smo_hf = Array{Float64}(liste[:,5])
roi = ones(Int((size(liste,2)-5)/2),2,size(liste,1))
for j = 1:size(liste,1)
roi[:,1,j] = (liste[j,6:2:end])
roi[:,2,j] = (liste[j,7:2:end])
end
rws = ones(size(liste,1),3)
for i = 1:size(liste,1)
spectra = readdlm(string(paths[2],names[i]),input_properties[1],skipstart=input_properties[2])
if spectra[end,1] < spectra[1,1]
spectra = flipdim(spectra,1)
end
x = spectra[:,1]
spectra[:,2] = spectra[:,2] - minimum(spectra[:,2])
y = spectra[:,2]./maximum(spectra[:,2]).*scale + 0.1# area normalisation, and we avoid any 0
ratio_bkg = minimum(y)/maximum(y) # to keep a record of the ratio of maximum signal intensity over minimum background intensity
#### PRELIMINARY STEP: FIRST WE GRAB THE GOOD SIGNAL IN THE ROI
interest_index::Array{Int64} = find(roi[1,1,i] .<= x[:,1] .<= roi[1,2,i])
if size(roi)[1] > 1
for j = 2:size(roi)[1]
interest_index = vcat(interest_index, find(roi[j,1,i] .<= x[:,1] .<= roi[j,2,i]))
end
end
interest_x = x[interest_index,1]
interest_y = y[interest_index,1]
if switches[3] == "yes" # if user asks for the experimental baseline
if switches[4] == "yes"
x, y_long, ~ = tlcorrection([x[:] y[:]],temperature,laser) # Long correction
y_long=y_long./maximum(y_long).*scale
### THE FOLLOWING IS PURELY EXPERIMENTAL
lb = roi[:,1,i]
hb = roi[:,2,i]
roi_hf = [lb[hb.>hb_start] hb[hb.>hb_start]]
roi_lf = [lb[hb.<lb_break] hb[hb.<lb_break]]
y_hf = y_long[x.>hb_start]
y_lf = y_long[x.<lb_break]
# A first linear baseline in signals between ~1300 and ~ 2000 cm-1
#y_calc_hf, baseline_hf = baseline(x,y_long,[2600. 3100.;3775. 3900.],"gcvspline",p=smo_hf[i])
#y_calc_hf, baseline_hf = baseline(x,y_long,[roi_hf[end-1,1] roi_hf[end-1,2];roi_hf[end,1] roi_hf[end,2]],"poly",p=3.0)
y_calc_hf, baseline_hf = baseline(x,y_long,[3000. 3100;3750. 3800.],"poly",p=1.0)
x_fit = [x[0 .< x .< 150];x[1250. .< x .< 1500]]
y_fit = [y_long[0 .< x .< 150];y_long[1250. .< x .< 1500.]]
#sss = size(x_fit,1)
#mod = Model(solver=IpoptSolver())
#@variable(mod, k1 >= 0.0,start=1.0)
#@variable(mod, k2 >= 0.0, start = 1.0)
#@NLexpression(mod, base[k=1:sss],k1*x_fit[k] + k2*x_fit[k]*x_fit[k])
#@NLobjective(mod,Min,sum{(base[k] - y_fit[k])^2,k=sss})
#status = solve(mod)
#p1 = getvalue(k1)
#p2 = getvalue(k2)
#fit_bas = curve_fit(baseline_lfmodel, , [y_long[0 .< x .< 100];y_long[1250. .< x .< 1500.]], [0.5,0.5,0.5])
#coef_bas = fit_bas.param
#baseline_lf = baseline_lfmodel(x,[p1;p2])
#y_calc_lf = y_long - baseline_lf
y_calc_lf, baseline_lf = baseline(x,y_long,[0. 150;1250. 1600.],"poly",p=3.0)
#y_calc_lf, baseline_lf = baseline(x,y_long,roi[:,:,i],basetype,p=smo_lf[i])
y_calc2 = [y_calc_lf[x.<=1600.];y_calc_hf[x.>1600.]]
bas2 = [baseline_lf[x.<=1600.];baseline_hf[x.>1600.]]
#y_calc2 = y_calc2[:,1]./trapz(x[:],y_calc2[:,1]).*scale # area normalisation
figure(figsize=(20,20))
suptitle("Baseline sub. with Long corr., sp. $(names[i])")
subplot(3,2,(1,2))
plot(x,y,"black",label="Raw sp.")
plot(x,y_long,"blue",label="Long corr. sp.")
scatter(interest_x,y_long[interest_index,1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x,bas2,"red",label="Baseline")
legend(loc="best",fancybox="true")
subplot(3,2,3)
plot(x[x.<1500],y_long[x.<1500],"blue",label="Long corr. sp.")
scatter(interest_x[interest_x.<1500],y_long[interest_index[interest_x.<1500],1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x[x.<1500],bas2[x.<1500],"red",label="Baseline")
xlim(0,1500)
legend(loc="best",fancybox="true")
subplot(3,2,4)
plot(x[x.>2800],y_long[x.>2800],"blue",label="Long corr. sp.")
scatter(interest_x[interest_x.>2800],y_long[interest_index[interest_x.>2800],1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x[x.>2800],bas2[x.>2800],"red",label="Baseline")
xlim(2800,4000)
legend(loc="best",fancybox="true")
subplot(3,2,(5,6))
plot(x,y_calc2,"cyan",label="Final sp.")
xlabel(L"Raman shift, cm$^{-1}$")
ylabel("Intensity, area normalised")
legend(loc="best",fancybox="true")
else
# ALSO FULLY EXPERIMENTAL!!!! IT DOES NOT WORK!
y_hf = y[x.>hb_start]
y_lf = y[x.<lb_break]
# A first linear baseline in signals between ~1300 and ~ 2000 cm-1
y_calc_hf, baseline_hf = baseline(x,y,[2600. 2900.;3775. 3900.],"poly",p=3.0)
#A first linear baseline in signals between ~1300 and ~ 2000 cm-1
y_calc1_part1, baseline1 = baseline(x,y,[1300 1800.],"poly",p=1.0)
# we get a mean signal for background below 1300 cm-1
X_low_lf = x[y .== minimum(y[100 .<x.<1400])]
b_low_lf = mean(y[X_low_lf[1]-10 .< x .< X_low_lf[1]+10])
baseline1[x.<1250.] = b_low_lf
y_calc1_part1 = y - baseline1
bas2 = [baseline1[x.<lb_break];baseline_hf[x.>lb_break]]
y_calc2 = [y_calc1_part1[x.<lb_break];y_calc_hf[x.>lb_break]]
figure()
plot(x,y,color="black")
plot(x,baseline_hf,color="red")
plot(x,y_calc2,color="blue")
end
else # only a single baseline treatment is asked
# we test if thre Long correction is asked, and react accordingly for baseline substraction
if switches[4] == "yes"
x, y_long, ~ = tlcorrection([x[:] y[:]],temperature,laser) # Long correction
y_long=y_long./maximum(y_long).*scale
y_calc2, bas2 = baseline(x,y_long,roi[:,:,i],basetype,p=smo_lf[i])
y_calc2 = y_calc2[:,1]./trapz(x[:],y_calc2[:,1]).*(scale./10) # area normalisation
figure(figsize=(20,20))
suptitle("LL2012 method, sp. $(names[i])")
subplot(3,2,(1,2))
plot(x,y,"black",label="Raw sp.")
plot(x,y_long,"blue",label="Long corr. sp.")
scatter(interest_x,y_long[interest_index,1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x,bas2,"red",label="Baseline")
legend(loc="best",fancybox="true")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
ylabel("Intensity,a. u.",fontsize=18,fontname="Arial")
subplot(3,2,3)
plot(x[x.<1500],y_long[x.<1500],"blue",label="Long corr. sp.")
scatter(interest_x[interest_x.<1500],y_long[interest_index[interest_x.<1500],1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x[x.<1500],bas2[x.<1500],"red",label="Baseline")
xlim(0,1500)
legend(loc="best",fancybox="true")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
ylabel("Intensity,a. u.",fontsize=18,fontname="Arial")
subplot(3,2,4)
plot(x[x.>2800],y_long[x.>2800],"blue",label="Long corr. sp.")
scatter(interest_x[interest_x.>2800],y_long[interest_index[interest_x.>2800],1],s=10.,color="red",label="ROI") # the ROI signals after first baseline and long correction
plot(x[x.>2800],bas2[x.>2800],"red",label="Baseline")
xlim(2600,4000)
legend(loc="best",fancybox="true")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
ylabel("Intensity,a. u.",fontsize=18,fontname="Arial")
subplot(3,2,(5,6))
plot(x,y_calc2,"cyan",label="Final sp.")
xlabel(L"Raman shift, cm$^{-1}$")
ylabel("Intensity, area normalised")
legend(loc="best",fancybox="true")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
ylabel("Intensity,a. u.",fontsize=18,fontname="Arial")
else
y_calc2, bas2 = baseline(x,y,roi[:,:,i],basetype,p=smo_lf[i])
y_calc2 = y_calc2[:,1]./trapz(x[:],y_calc2[:,1]).*scale # area normalisation
figure()
plot(x,y.*10,"black",label="Raw sp.")
scatter(interest_x,interest_y.*10,s=10.,color="red",label="ROI")
plot(x,bas2.*10,"red",label="Baseline")
plot(x,y_calc2,"cyan",label="Final sp.")
xlabel(L"Raman shift, cm$^{-1}$")
ylabel("Intensity, area normalised")
title("Baseline sub., NO Long corr.")
legend(loc="best",fancybox="true")
end
end
# saving the corrected spectrum
writecsv(string(paths[3],names[i]),[x y_calc2 bas2])
#Saving the generated figure (specified directory should exist)
savefig(string(paths[4],"baseline_",names[i],".pdf"))
close()
if switches[3] == "yes"
# calc=ulating the areas under silicate and water bands
if switches[4] == "yes"
As = (trapz(x[150 .<x.<600],y_calc2[150 .<x.<600])+trapz(x[1000 .<x.<1250],y_calc2[1000 .<x.<1250]))
Aw = trapz(x[3100 .< x .<3750],y_calc2[3100 .< x .<3750])
else
#idx1a = find(y[400 .<x.<600] .== maximum(y[400 .<x.<600]))
#idx1b = find(y[600 .<x.<1000] .== minimum(y[600 .<x.<1000]))
#idx2a = find( y[900 .<x.<1250] .== maximum(y[900 .<x.<1250]))
#idx2b = find( y[1000 .<x.<1250] .== minimum(y[1000 .<x.<1250]))
#idx3a = find( y[3000 .<x.<3700] .== maximum(y[3000 .<x.<3700]))
#idx3b = find( y[3700 .<x.<3800] .== minimum(y[3700 .<x.<3800]))
#As = mean(y[(idx1a[1]-4):(idx1a[1]+4),1]) - mean(y[(idx1b[1]-4):(idx1b[1]+4),1]) + mean(y[(idx2a[1]-4):(idx2a[1]+4),1]) - mean(y[(idx2b[1]-4):(idx2b[1]+4),1])
#Aw = mean(y[idx3a[1]-4 : idx3a[1]+4,1]) - mean(y[idx3b[1]-4 : idx3b[1]+4,1])
As = maximum(y[400 .<x.<600]) - minimum(y[600 .<x.<1000]) + maximum(y[900 .<x.<1250]) - minimum(y[1000 .<x.<1250])
Aw = maximum(y[3000 .<x.<3700]) - minimum(y[3700 .<x.<3800])
end
else
# calc=ulating the areas under silicate and water bands
As = trapz(x[150 .< x .<1300],y_calc2[150 .< x .<1300])
Aw = trapz(x[2800 .< x .<3750],y_calc2[2800 .< x .<3750])
end
# recording them
rws[i,1] = As;
rws[i,2] = Aw;
rws[i,3] = Aw./(As);
println("Spectrum $(names[i]), the rws is $(rws[i,3])")
end
if switches[2] == "yes"
fit = curve_fit(calibration_model, rws[:,3], water[:]./(100.-water[:]), [0.5])
coef = fit.param
sigma = estimate_errors(fit, 0.95)
rws_calibration = collect(0:0.01:round(maximum(rws[:,3]),2))
water_ratio_calibration = calibration_model(rws_calibration,coef)
water_compare = 100.*calibration_model(rws[:,3],coef)./(calibration_model(rws[:,3],coef)+1) # eq. 3 Le Losq et al. (2012)
rmse_calibration = sqrt(1./(size(rws,1)-1).*sum((water_compare-water).^2))
rmse_ratio_ws = rmse_calibration/100*(rmse_calibration/(100-rmse_calibration)+1)
figure()
scatter(rws[:,3],water[:]./(100.-water[:]))
plot(rws_calibration,water_ratio_calibration,color="red",linewidth=2.0)
plot(rws_calibration,water_ratio_calibration+rmse_ratio_ws,color="red",linestyle="--",linewidth=1.0)
plot(rws_calibration,water_ratio_calibration-rmse_ratio_ws,color="red",linestyle="--",linewidth=1.0)
plot(rws_calibration,water_ratio_calibration,color="red")
xlim(0,maximum(rws_calibration)+1./4*maximum(rws_calibration))
ylim(0,maximum(water_ratio_calibration)+1./4*maximum(water_ratio_calibration))
xlabel(L"A$_{water}$/A$_{silicates}$, area ratio",fontsize=18,fontname="Arial")
ylabel("Water/Glass, weight ratio",fontsize=18,fontname="Arial")
annotate(L"R$_{ws}$=",xy=(0.3,0.9),xycoords="axes fraction",fontsize=18,fontname="Arial",horizontalalignment="center")
annotate("$(round(coef[1],5)) +/- $(round(sigma[1],5))",xy=(0.3,0.8),xycoords="axes fraction",fontsize=18,fontname="Arial",horizontalalignment="center")
annotate("Standard deviation\n= $(round(rmse_calibration,2)) wt%",xy=(0.7,0.3),xycoords="axes fraction",horizontalalignment="center",fontsize=18,fontname="Arial")
savefig(paths[6])
writecsv(string(paths[5]), ["spectrum" "product" "Rws" "Water input" "Water Raman";liste[:,1] liste[:,2] rws[:,3] water water_compare])
#return [rws[:,3] water water_compare]
else
water_predicted = 100.*(rws[:,3].*prediction_coef[1]./(rws[:,3].*prediction_coef[1]+1))
water_predicted_high = 100.*(rws[:,3].*sum(prediction_coef)./(rws[:,3].*sum(prediction_coef)+1))
writecsv(string(paths[5]), ["spectrum" "product" "Rws" "Water Raman" "Error";liste[:,1] liste[:,2] rws[:,3] water_predicted water_predicted_high-water_predicted])
#return [rws[:,3] water_predicted]
end
elseif switches[1] == "external"
liste=readcsv(paths[1], skipstart=1)
reference = liste[:,1]
# reference product names are in first column for record
reference_density = liste[:,3]
reference_water = liste[:,4]
sample = liste[:,5]
# sample product names are in column 6 for record
sample_density = liste[:,7]
water = ones(size(liste,1),1) # the array to record water content
for i = 1:size(liste,1)
#importing data
reference_sp = readdlm(string(paths[2],reference[i]),input_properties[1],skipstart=input_properties[2])
sample_sp = readdlm(string(paths[2],sample[i]),input_properties[1],skipstart=input_properties[2])
if reference_sp[end,1] < reference_sp[1,1]
reference_sp = flipdim(reference_sp,1)
end
if sample_sp[end,1] < sample_sp[1,1]
sample_sp = flipdim(sample_sp,1)
end
# temperature - excitation line correction with the Hehlen formula
x_ref, reference_sp_long, ~ = tlcorrection(reference_sp,temperature,laser,correction="hehlen",normalisation="no",density=reference_density[i])
x_sp, sample_sp_long, ~ = tlcorrection(sample_sp,temperature,laser,correction="hehlen",normalisation="no",density=sample_density[i])
# Linear baseline subtraction
roi_hf = [3000. 3100.; 3800. 3900.] # the region where the basline is constrained
reference_sp_corr2, reference_baseline = baseline(x_ref,reference_sp_long,roi_hf,"poly",p=1.0)
sample_sp_corr2, sample_baseline = baseline(x_sp,sample_sp_long,roi_hf,"poly",p=1.0)
# Area calculation between 3100 and 3800 cm-1
Area_reference = trapz(x_ref[3100. .<x_ref[:,1].<3800.],reference_sp_corr2[3100. .<x_ref[:,1].<3800.])
Area_sample = trapz(x_sp[3100. .<x_sp[:,1].<3800.],sample_sp_corr2[3100. .<x_sp[:,1].<3800.])
# With the intensity
Intensity_reference = maximum(reference_sp_corr2[3100. .<x_ref[:,1].<3800])
Intensity_sample = maximum(sample_sp_corr2[3100. .<x_ref[:,1].<3800])
# Water calculation
water[i] = (reference_water[i]./1.8*reference_density[i]) .*Area_sample./Area_reference # water is in mol/L
#water[i] = (reference_water[i]./1.8*reference_density[i]) .*Intensity_sample./Intensity_reference # water is in mol/L
water[i] = water[i] *1.8./sample_density[i] # water converted in wt%
figure(figsize=(7.5,15))
subplot(311)
title("External calibration: $(round(water[i],2)) wt% water,\n sp. $(sample[i]) with ref. $(reference[i]) ")
plot(reference_sp[:,1],reference_sp[:,2],color="black",label="Reference")
plot(sample_sp[:,1],sample_sp[:,2],color="blue",label="Sample")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
legend(loc="best",frameon=false)
subplot(312)
plot(x_ref[:],reference_sp_long[:],color="black",label=L"T-$\nu$ corrected reference")
plot(x_ref[:],reference_baseline,color="grey",label="Reference baseline")
plot(x_sp[:],sample_sp_long[:],color="blue",label=L"T-$\nu$ corrected sample")
plot(x_sp[:],sample_baseline,color="cyan",label="Sample baseline")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
ylabel("Normalized intensity, a. u.",fontsize=18,fontname="Arial")
legend(loc="best",frameon=false)
subplot(313)
plot(x_ref,reference_sp_corr2,color="black",label="Ref. spectrum")
plot(x_sp,sample_sp_corr2,color="blue",label="Sample spectrum")
xlabel(L"Raman shift, cm$^{-1}$",fontsize=18,fontname="Arial")
legend(loc="best",frameon=false)
tight_layout()
# saving the water content
writecsv(string(paths[5]), ["Spectrum" "Sample Name" "Estimated water content";liste[:,5] liste[:,6] water])
#Saving the generated figure (specified directory should exist)
savefig(string(paths[4],"Internal_Std_",sample[i],".pdf"))
end
else # or error message
error("the first switch indicates if you want to use an internal or external calibration mode. Please choose between both.")
end
end
| [
29113,
29113,
7804,
4242,
2,
198,
2,
15269,
357,
66,
8,
1584,
7516,
1004,
5401,
80,
198,
2,
198,
2,
464,
17168,
13789,
357,
36393,
8,
198,
2,
198,
2,
5990,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
287,
262,
1303,
25423,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
284,
779,
11,
4866,
11,
1303,
4666,
1958,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
9088,
286,
262,
10442,
11,
1303,
392,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
30760,
284,
466,
523,
11,
2426,
284,
262,
1303,
27780,
278,
3403,
25,
198,
2,
198,
2,
464,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
9088,
393,
8904,
16690,
286,
262,
10442,
13,
198,
2,
198,
2,
10970,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
8959,
49094,
11,
1303,
1268,
39149,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
43031,
25382,
11,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
47466,
13,
198,
2,
198,
29113,
29113,
7804,
4242,
2,
198,
198,
8818,
374,
480,
559,
7,
6978,
82,
3712,
51,
29291,
11,
2032,
9249,
3712,
51,
29291,
26,
15414,
62,
48310,
28,
10786,
59,
83,
3256,
15,
828,
28764,
2867,
62,
1073,
891,
41888,
15,
13,
405,
3270,
26,
15,
13,
830,
20,
4357,
11498,
21069,
28,
1954,
13,
15,
11,
75,
6005,
28,
20,
2624,
13,
15,
11,
23160,
62,
9032,
28,
36150,
1539,
71,
65,
62,
9688,
28,
2075,
405,
1539,
12093,
2963,
431,
2625,
36484,
14259,
489,
500,
4943,
198,
197,
198,
197,
2,
617,
2163,
6770,
198,
197,
9948,
571,
1358,
62,
19849,
7,
87,
11,
279,
8,
796,
279,
58,
16,
4083,
9,
87,
198,
197,
12093,
4470,
62,
1652,
19849,
7,
87,
11,
279,
8,
796,
279,
58,
16,
4083,
9,
87,
1343,
279,
58,
17,
4083,
9,
87,
13,
61,
17,
1343,
279,
58,
18,
4083,
9,
87,
13,
61,
18,
198,
197,
198,
197,
361,
18225,
58,
16,
60,
6624,
366,
32538,
1,
198,
197,
198,
197,
198,
197,
197,
9888,
796,
352,
198,
197,
198,
197,
197,
4868,
68,
28,
961,
40664,
7,
6978,
82,
58,
16,
4357,
14267,
9688,
28,
16,
8,
198,
197,
197,
14933,
796,
1351,
68,
58,
45299,
16,
60,
198,
197,
197,
7050,
796,
15690,
90,
43879,
2414,
92,
7,
4868,
68,
58,
45299,
18,
12962,
198,
197,
197,
5796,
78,
62,
1652,
796,
15690,
90,
43879,
2414,
92,
7,
4868,
68,
58,
45299,
19,
12962,
198,
197,
197,
5796,
78,
62,
71,
69,
796,
15690,
90,
43879,
2414,
92,
7,
4868,
68,
58,
45299,
20,
12962,
198,
197,
197,
305,
72,
796,
3392,
7,
5317,
19510,
7857,
7,
4868,
68,
11,
17,
13219,
20,
20679,
17,
828,
17,
11,
7857,
7,
4868,
68,
11,
16,
4008,
198,
197,
197,
1640,
474,
796,
352,
25,
7857,
7,
4868,
68,
11,
16,
8,
198,
197,
197,
197,
305,
72,
58,
45299,
16,
11,
73,
60,
796,
357,
4868,
68,
58,
73,
11,
21,
25,
17,
25,
437,
12962,
198,
197,
197,
197,
305,
72,
58,
45299,
17,
11,
73,
60,
796,
357,
4868,
68,
58,
73,
11,
22,
25,
17,
25,
437,
12962,
198,
197,
197,
437,
628,
197,
197,
81,
18504,
796,
3392,
7,
7857,
7,
4868,
68,
11,
16,
828,
18,
8,
198,
197,
198,
197,
197,
1640,
1312,
796,
352,
25,
7857,
7,
4868,
68,
11,
16,
8,
220,
220,
220,
198,
197,
197,
197,
4443,
430,
796,
1100,
25404,
76,
7,
8841,
7,
6978,
82,
58,
17,
4357,
14933,
58,
72,
46570,
15414,
62,
48310,
58,
16,
4357,
48267,
9688,
28,
15414,
62,
48310,
58,
17,
12962,
198,
220,
220,
220,
220,
198,
197,
197,
197,
361,
5444,
430,
58,
437,
11,
16,
60,
1279,
5444,
430,
58,
16,
11,
16,
60,
198,
197,
197,
197,
197,
4443,
430,
796,
14283,
27740,
7,
4443,
430,
11,
16,
8,
198,
197,
197,
197,
437,
198,
220,
220,
220,
220,
198,
197,
197,
197,
87,
796,
5444,
430,
58,
45299,
16,
60,
198,
197,
197,
197,
4443,
430,
58,
45299,
17,
60,
796,
5444,
430,
58,
45299,
17,
60,
532,
5288,
7,
4443,
430,
58,
45299,
17,
12962,
198,
197,
197,
197,
88,
796,
5444,
430,
58,
45299,
17,
4083,
14,
47033,
7,
4443,
430,
58,
45299,
17,
35944,
9,
9888,
1343,
657,
13,
16,
2,
1989,
3487,
5612,
11,
290,
356,
3368,
597,
657,
198,
197,
197,
197,
10366,
952,
62,
65,
10025,
796,
5288,
7,
88,
20679,
47033,
7,
88,
8,
1303,
284,
1394,
257,
1700,
286,
262,
8064,
286,
5415,
6737,
12245,
625,
5288,
4469,
12245,
198,
197,
197,
197,
198,
197,
197,
197,
4242,
350,
16448,
3955,
1268,
13153,
49154,
25,
31328,
12887,
402,
3861,
33,
3336,
21090,
36771,
1847,
3268,
3336,
15107,
40,
198,
197,
197,
197,
9446,
62,
9630,
3712,
19182,
90,
5317,
2414,
92,
796,
1064,
7,
305,
72,
58,
16,
11,
16,
11,
72,
60,
764,
27,
28,
2124,
58,
45299,
16,
60,
764,
27,
28,
686,
72,
58,
16,
11,
17,
11,
72,
12962,
198,
197,
197,
197,
361,
2546,
7,
305,
72,
38381,
16,
60,
1875,
352,
198,
197,
197,
197,
197,
1640,
474,
796,
362,
25,
7857,
7,
305,
72,
38381,
16,
60,
198,
197,
197,
197,
197,
197,
9446,
62,
9630,
796,
410,
9246,
7,
9446,
62,
9630,
11,
220,
1064,
7,
305,
72,
58,
73,
11,
16,
11,
72,
60,
764,
27,
28,
2124,
58,
45299,
16,
60,
764,
27,
28,
686,
72,
58,
73,
11,
17,
11,
72,
60,
4008,
198,
197,
197,
197,
197,
437,
198,
197,
197,
197,
437,
198,
197,
197,
197,
9446,
62,
87,
796,
2124,
58,
9446,
62,
9630,
11,
16,
60,
198,
197,
197,
197,
9446,
62,
88,
796,
331,
58,
9446,
62,
9630,
11,
16,
60,
198,
220,
220,
220,
220,
198,
197,
197,
197,
361,
18225,
58,
18,
60,
6624,
366,
8505,
1,
1303,
611,
2836,
7893,
329,
262,
11992,
14805,
198,
220,
220,
220,
220,
220,
220,
220,
220,
197,
197,
198,
197,
197,
197,
197,
361,
18225,
58,
19,
60,
6624,
366,
8505,
1,
198,
197,
197,
197,
197,
197,
87,
11,
331,
62,
6511,
11,
5299,
796,
256,
75,
10215,
8243,
26933,
87,
58,
47715,
331,
58,
47715,
4357,
11498,
21069,
11,
75,
6005,
8,
1303,
5882,
17137,
198,
197,
197,
197,
197,
197,
88,
62,
6511,
28,
88,
62,
6511,
19571,
47033,
7,
88,
62,
6511,
737,
9,
9888,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
21017,
3336,
11895,
44765,
2751,
3180,
350,
11335,
11319,
7788,
18973,
3955,
3525,
1847,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
23160,
796,
686,
72,
58,
45299,
16,
11,
72,
60,
198,
197,
197,
197,
197,
197,
71,
65,
796,
686,
72,
58,
45299,
17,
11,
72,
60,
628,
197,
197,
197,
197,
197,
305,
72,
62,
71,
69,
796,
220,
685,
23160,
58,
71,
65,
13,
29,
71,
65,
62,
9688,
60,
289,
65,
58,
71,
65,
13,
29,
71,
65,
62,
9688,
11907,
198,
197,
197,
197,
197,
197,
305,
72,
62,
1652,
796,
220,
685,
23160,
58,
71,
65,
29847,
23160,
62,
9032,
60,
289,
65,
58,
71,
65,
29847,
23160,
62,
9032,
11907,
198,
197,
197,
197,
198,
197,
197,
197,
197,
197,
88,
62,
71,
69,
796,
331,
62,
6511,
58,
87,
13,
29,
71,
65,
62,
9688,
60,
198,
197,
197,
197,
197,
197,
88,
62,
1652,
796,
331,
62,
6511,
58,
87,
29847,
23160,
62,
9032,
60,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
317,
717,
14174,
14805,
287,
10425,
1022,
5299,
1485,
405,
290,
5299,
4751,
12067,
12,
16,
198,
197,
197,
197,
197,
197,
2,
88,
62,
9948,
66,
62,
71,
69,
11,
14805,
62,
71,
69,
796,
14805,
7,
87,
11,
88,
62,
6511,
17414,
2075,
405,
13,
513,
3064,
15089,
2718,
2425,
13,
5014,
405,
8183,
553,
36484,
14259,
489,
500,
1600,
79,
28,
5796,
78,
62,
71,
69,
58,
72,
12962,
198,
197,
197,
197,
197,
197,
2,
88,
62,
9948,
66,
62,
71,
69,
11,
14805,
62,
71,
69,
796,
14805,
7,
87,
11,
88,
62,
6511,
17414,
305,
72,
62,
71,
69,
58,
437,
12,
16,
11,
16,
60,
686,
72,
62,
71,
69,
58,
437,
12,
16,
11,
17,
11208,
305,
72,
62,
71,
69,
58,
437,
11,
16,
60,
686,
72,
62,
71,
69,
58,
437,
11,
17,
11907,
553,
35428,
1600,
79,
28,
18,
13,
15,
8,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
62,
71,
69,
11,
14805,
62,
71,
69,
796,
14805,
7,
87,
11,
88,
62,
6511,
17414,
23924,
13,
513,
3064,
26,
2718,
1120,
13,
4353,
405,
8183,
553,
35428,
1600,
79,
28,
16,
13,
15,
8,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
87,
62,
11147,
796,
685,
87,
58,
15,
764,
27,
2124,
764,
27,
6640,
11208,
87,
58,
1065,
1120,
13,
764,
27,
2124,
764,
27,
20007,
11907,
198,
197,
197,
197,
197,
197,
88,
62,
11147,
796,
685,
88,
62,
6511,
58,
15,
764,
27,
2124,
764,
27,
6640,
11208,
88,
62,
6511,
58,
1065,
1120,
13,
764,
27,
2124,
764,
27,
20007,
8183,
60,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
824,
82,
796,
2546,
7,
87,
62,
11147,
11,
16,
8,
198,
197,
197,
197,
197,
197,
2,
4666,
796,
9104,
7,
82,
14375,
28,
40,
79,
8738,
50,
14375,
28955,
198,
197,
197,
197,
197,
197,
2,
31,
45286,
7,
4666,
11,
479,
16,
18189,
657,
13,
15,
11,
9688,
28,
16,
13,
15,
8,
198,
197,
197,
197,
197,
197,
2,
31,
45286,
7,
4666,
11,
479,
17,
18189,
657,
13,
15,
11,
923,
796,
352,
13,
15,
8,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
31,
32572,
38011,
7,
4666,
11,
2779,
58,
74,
28,
16,
25,
824,
82,
4357,
74,
16,
9,
87,
62,
11147,
58,
74,
60,
1343,
479,
17,
9,
87,
62,
11147,
58,
74,
60,
9,
87,
62,
11147,
58,
74,
12962,
198,
197,
197,
197,
197,
197,
2,
31,
32572,
15252,
425,
7,
4666,
11,
9452,
11,
16345,
90,
7,
8692,
58,
74,
60,
532,
331,
62,
11147,
58,
74,
12962,
61,
17,
11,
74,
28,
824,
82,
30072,
198,
197,
197,
197,
197,
197,
2,
13376,
796,
8494,
7,
4666,
8,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
79,
16,
796,
651,
8367,
7,
74,
16,
8,
198,
197,
197,
197,
197,
197,
2,
79,
17,
796,
651,
8367,
7,
74,
17,
8,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
11147,
62,
12093,
796,
12133,
62,
11147,
7,
12093,
4470,
62,
1652,
19849,
11,
837,
685,
88,
62,
6511,
58,
15,
764,
27,
2124,
764,
27,
1802,
11208,
88,
62,
6511,
58,
1065,
1120,
13,
764,
27,
2124,
764,
27,
20007,
8183,
4357,
685,
15,
13,
20,
11,
15,
13,
20,
11,
15,
13,
20,
12962,
198,
197,
197,
197,
197,
197,
2,
1073,
891,
62,
12093,
796,
4197,
62,
12093,
13,
17143,
198,
197,
197,
197,
197,
197,
2,
12093,
4470,
62,
1652,
796,
14805,
62,
1652,
19849,
7,
87,
17414,
79,
16,
26,
79,
17,
12962,
198,
197,
197,
197,
197,
197,
2,
88,
62,
9948,
66,
62,
1652,
796,
331,
62,
6511,
532,
14805,
62,
1652,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
62,
1652,
11,
14805,
62,
1652,
796,
14805,
7,
87,
11,
88,
62,
6511,
17414,
15,
13,
6640,
26,
1065,
1120,
13,
26143,
8183,
553,
35428,
1600,
79,
28,
18,
13,
15,
8,
198,
197,
197,
197,
197,
197,
2,
88,
62,
9948,
66,
62,
1652,
11,
14805,
62,
1652,
796,
14805,
7,
87,
11,
88,
62,
6511,
11,
305,
72,
58,
45299,
45299,
72,
4357,
12093,
2963,
431,
11,
79,
28,
5796,
78,
62,
1652,
58,
72,
12962,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
796,
685,
88,
62,
9948,
66,
62,
1652,
58,
87,
29847,
28,
36150,
8183,
26,
88,
62,
9948,
66,
62,
71,
69,
58,
87,
13,
29,
36150,
8183,
60,
198,
197,
197,
197,
197,
197,
12093,
17,
796,
685,
12093,
4470,
62,
1652,
58,
87,
29847,
28,
36150,
8183,
26,
12093,
4470,
62,
71,
69,
58,
87,
13,
29,
36150,
8183,
60,
198,
197,
197,
197,
197,
197,
2,
88,
62,
9948,
66,
17,
796,
331,
62,
9948,
66,
17,
58,
45299,
16,
4083,
14,
46670,
89,
7,
87,
58,
25,
4357,
88,
62,
9948,
66,
17,
58,
45299,
16,
35944,
9,
9888,
1303,
1989,
3487,
5612,
198,
197,
197,
198,
197,
197,
197,
197,
197,
26875,
7,
5647,
7857,
16193,
1238,
11,
1238,
4008,
198,
197,
197,
197,
197,
197,
2385,
457,
2578,
7203,
15522,
4470,
850,
13,
351,
5882,
1162,
81,
1539,
599,
13,
29568,
14933,
58,
72,
12962,
4943,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
7,
16,
11,
17,
4008,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
553,
13424,
1600,
18242,
2625,
27369,
599,
19570,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
6511,
553,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
11,
88,
62,
6511,
58,
9446,
62,
9630,
11,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
12093,
17,
553,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
18,
8,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
29847,
33698,
4357,
88,
62,
6511,
58,
87,
29847,
33698,
17241,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
58,
9446,
62,
87,
29847,
33698,
4357,
88,
62,
6511,
58,
9446,
62,
9630,
58,
9446,
62,
87,
29847,
33698,
4357,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
29847,
33698,
4357,
12093,
17,
58,
87,
29847,
33698,
17241,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
87,
2475,
7,
15,
11,
33698,
8,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
19,
8,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
13,
29,
2078,
405,
4357,
88,
62,
6511,
58,
87,
13,
29,
2078,
405,
17241,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
58,
9446,
62,
87,
13,
29,
2078,
405,
4357,
88,
62,
6511,
58,
9446,
62,
9630,
58,
9446,
62,
87,
13,
29,
2078,
405,
4357,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
13,
29,
2078,
405,
4357,
12093,
17,
58,
87,
13,
29,
2078,
405,
17241,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
87,
2475,
7,
2078,
405,
11,
27559,
8,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
7,
20,
11,
21,
4008,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
9948,
66,
17,
553,
948,
272,
1600,
18242,
2625,
19006,
599,
19570,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
1989,
3487,
1417,
4943,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
17772,
198,
197,
197,
197,
197,
197,
2,
35912,
34958,
56,
7788,
18973,
3955,
3525,
1847,
13896,
7283,
38359,
5626,
30936,
0,
198,
197,
197,
197,
197,
197,
88,
62,
71,
69,
796,
331,
58,
87,
13,
29,
71,
65,
62,
9688,
60,
198,
197,
197,
197,
197,
197,
88,
62,
1652,
796,
331,
58,
87,
29847,
23160,
62,
9032,
60,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
317,
717,
14174,
14805,
287,
10425,
1022,
5299,
1485,
405,
290,
5299,
4751,
12067,
12,
16,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
62,
71,
69,
11,
14805,
62,
71,
69,
796,
14805,
7,
87,
11,
88,
17414,
2075,
405,
13,
2808,
405,
15089,
2718,
2425,
13,
5014,
405,
8183,
553,
35428,
1600,
79,
28,
18,
13,
15,
8,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
220,
220,
220,
1303,
32,
717,
14174,
14805,
287,
10425,
1022,
5299,
1485,
405,
290,
5299,
4751,
12067,
12,
16,
198,
197,
197,
197,
197,
220,
220,
220,
197,
88,
62,
9948,
66,
16,
62,
3911,
16,
11,
14805,
16,
796,
14805,
7,
87,
11,
88,
17414,
1485,
405,
21431,
8183,
553,
35428,
1600,
79,
28,
16,
13,
15,
8,
198,
197,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
356,
651,
257,
1612,
6737,
329,
4469,
2174,
36058,
12067,
12,
16,
198,
197,
197,
197,
197,
197,
55,
62,
9319,
62,
1652,
796,
2124,
58,
88,
764,
855,
5288,
7,
88,
58,
3064,
764,
27,
87,
29847,
1415,
405,
12962,
60,
198,
197,
197,
197,
197,
197,
65,
62,
9319,
62,
1652,
796,
1612,
7,
88,
58,
55,
62,
9319,
62,
1652,
58,
16,
45297,
940,
764,
27,
2124,
764,
27,
1395,
62,
9319,
62,
1652,
58,
16,
48688,
940,
12962,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
12093,
4470,
16,
58,
87,
29847,
1065,
1120,
8183,
796,
275,
62,
9319,
62,
1652,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
16,
62,
3911,
16,
796,
331,
532,
14805,
16,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
12093,
17,
796,
685,
12093,
4470,
16,
58,
87,
29847,
23160,
62,
9032,
11208,
12093,
4470,
62,
71,
69,
58,
87,
13,
29,
23160,
62,
9032,
11907,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
796,
685,
88,
62,
9948,
66,
16,
62,
3911,
16,
58,
87,
29847,
23160,
62,
9032,
11208,
88,
62,
9948,
66,
62,
71,
69,
58,
87,
13,
29,
23160,
62,
9032,
11907,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
26875,
3419,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
11,
8043,
2625,
13424,
4943,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
12093,
4470,
62,
71,
69,
11,
8043,
2625,
445,
4943,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
9948,
66,
17,
11,
8043,
2625,
17585,
4943,
198,
197,
197,
197,
197,
437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
17772,
1303,
691,
257,
2060,
14805,
3513,
318,
1965,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
197,
2,
356,
1332,
611,
294,
260,
5882,
17137,
318,
1965,
11,
290,
6324,
16062,
329,
14805,
3293,
7861,
198,
197,
197,
197,
197,
361,
18225,
58,
19,
60,
6624,
366,
8505,
1,
198,
197,
197,
197,
197,
197,
87,
11,
331,
62,
6511,
11,
5299,
796,
256,
75,
10215,
8243,
26933,
87,
58,
47715,
331,
58,
47715,
4357,
11498,
21069,
11,
75,
6005,
8,
1303,
5882,
17137,
198,
197,
197,
197,
197,
197,
88,
62,
6511,
28,
88,
62,
6511,
19571,
47033,
7,
88,
62,
6511,
737,
9,
9888,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
11,
1615,
17,
796,
14805,
7,
87,
11,
88,
62,
6511,
11,
305,
72,
58,
45299,
45299,
72,
4357,
12093,
2963,
431,
11,
79,
28,
5796,
78,
62,
1652,
58,
72,
12962,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
796,
331,
62,
9948,
66,
17,
58,
45299,
16,
4083,
14,
46670,
89,
7,
87,
58,
25,
4357,
88,
62,
9948,
66,
17,
58,
45299,
16,
35944,
9,
7,
9888,
19571,
940,
8,
1303,
1989,
3487,
5612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
197,
197,
26875,
7,
5647,
7857,
16193,
1238,
11,
1238,
4008,
198,
197,
197,
197,
197,
197,
2385,
457,
2578,
7203,
3069,
6999,
2446,
11,
599,
13,
29568,
14933,
58,
72,
12962,
4943,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
7,
16,
11,
17,
4008,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
553,
13424,
1600,
18242,
2625,
27369,
599,
19570,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
6511,
553,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
11,
88,
62,
6511,
58,
9446,
62,
9630,
11,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
12093,
17,
553,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
64,
13,
334,
33283,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
18,
8,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
29847,
33698,
4357,
88,
62,
6511,
58,
87,
29847,
33698,
17241,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
58,
9446,
62,
87,
29847,
33698,
4357,
88,
62,
6511,
58,
9446,
62,
9630,
58,
9446,
62,
87,
29847,
33698,
4357,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
29847,
33698,
4357,
12093,
17,
58,
87,
29847,
33698,
17241,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
87,
2475,
7,
15,
11,
33698,
8,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
64,
13,
334,
33283,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
19,
8,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
13,
29,
2078,
405,
4357,
88,
62,
6511,
58,
87,
13,
29,
2078,
405,
17241,
17585,
1600,
18242,
2625,
14617,
1162,
81,
13,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
58,
9446,
62,
87,
13,
29,
2078,
405,
4357,
88,
62,
6511,
58,
9446,
62,
9630,
58,
9446,
62,
87,
13,
29,
2078,
405,
4357,
16,
4357,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
1303,
262,
15107,
40,
10425,
706,
717,
14805,
290,
890,
17137,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
58,
87,
13,
29,
2078,
405,
4357,
12093,
17,
58,
87,
13,
29,
2078,
405,
17241,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
87,
2475,
7,
2075,
405,
11,
27559,
8,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
64,
13,
334,
33283,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
7266,
29487,
7,
18,
11,
17,
11,
7,
20,
11,
21,
4008,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
9948,
66,
17,
553,
948,
272,
1600,
18242,
2625,
19006,
599,
19570,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
1989,
3487,
1417,
4943,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
64,
13,
334,
33283,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
197,
17772,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
11,
1615,
17,
796,
14805,
7,
87,
11,
88,
11,
305,
72,
58,
45299,
45299,
72,
4357,
12093,
2963,
431,
11,
79,
28,
5796,
78,
62,
1652,
58,
72,
12962,
198,
197,
197,
197,
197,
197,
88,
62,
9948,
66,
17,
796,
331,
62,
9948,
66,
17,
58,
45299,
16,
4083,
14,
46670,
89,
7,
87,
58,
25,
4357,
88,
62,
9948,
66,
17,
58,
45299,
16,
35944,
9,
9888,
1303,
1989,
3487,
5612,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
197,
197,
26875,
3419,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
15885,
940,
553,
13424,
1600,
18242,
2625,
27369,
599,
19570,
198,
197,
197,
197,
197,
197,
1416,
1436,
7,
9446,
62,
87,
11,
9446,
62,
88,
15885,
940,
11,
82,
28,
940,
1539,
8043,
2625,
445,
1600,
18242,
2625,
13252,
40,
4943,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
12093,
17,
15885,
940,
553,
445,
1600,
18242,
2625,
15522,
4470,
4943,
198,
197,
197,
197,
197,
197,
29487,
7,
87,
11,
88,
62,
9948,
66,
17,
553,
948,
272,
1600,
18242,
2625,
19006,
599,
19570,
198,
197,
197,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
4943,
198,
197,
197,
197,
197,
197,
2645,
9608,
7203,
5317,
6377,
11,
1989,
3487,
1417,
4943,
198,
197,
197,
197,
197,
197,
7839,
7203,
15522,
4470,
850,
1539,
8005,
5882,
1162,
81,
19570,
198,
197,
197,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
69,
3883,
3524,
2625,
7942,
4943,
198,
197,
197,
197,
197,
437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
437,
198,
220,
220,
220,
220,
198,
197,
197,
197,
2,
8914,
262,
19267,
10958,
198,
197,
197,
197,
13564,
40664,
7,
8841,
7,
6978,
82,
58,
18,
4357,
14933,
58,
72,
46570,
58,
87,
331,
62,
9948,
66,
17,
1615,
17,
12962,
198,
220,
220,
220,
220,
198,
197,
197,
197,
2,
50,
2703,
262,
7560,
3785,
357,
23599,
8619,
815,
2152,
8,
198,
197,
197,
197,
21928,
5647,
7,
8841,
7,
6978,
82,
58,
19,
17241,
12093,
4470,
62,
1600,
14933,
58,
72,
17241,
13,
12315,
48774,
198,
220,
220,
220,
220,
197,
197,
19836,
3419,
198,
197,
197,
197,
361,
18225,
58,
18,
60,
6624,
366,
8505,
1,
198,
197,
197,
197,
197,
2,
42302,
28,
8306,
262,
3006,
739,
3313,
5344,
290,
1660,
11760,
198,
197,
197,
197,
197,
198,
197,
197,
197,
197,
361,
18225,
58,
19,
60,
6624,
366,
8505,
1,
198,
197,
197,
197,
197,
197,
1722,
796,
357,
46670,
89,
7,
87,
58,
8628,
764,
27,
87,
29847,
8054,
4357,
88,
62,
9948,
66,
17,
58,
8628,
764,
27,
87,
29847,
8054,
12962,
10,
46670,
89,
7,
87,
58,
12825,
764,
27,
87,
29847,
1065,
1120,
4357,
88,
62,
9948,
66,
17,
58,
12825,
764,
27,
87,
29847,
1065,
1120,
60,
4008,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
23155,
796,
12840,
89,
7,
87,
58,
18,
3064,
764,
27,
2124,
764,
27,
2718,
1120,
4357,
88,
62,
9948,
66,
17,
58,
18,
3064,
764,
27,
2124,
764,
27,
2718,
1120,
12962,
198,
197,
197,
197,
197,
17772,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
312,
87,
16,
64,
796,
1064,
7,
88,
58,
7029,
764,
27,
87,
29847,
8054,
60,
764,
855,
5415,
7,
88,
58,
7029,
764,
27,
87,
29847,
8054,
60,
4008,
198,
197,
197,
197,
197,
197,
2,
312,
87,
16,
65,
796,
1064,
7,
88,
58,
8054,
764,
27,
87,
29847,
12825,
60,
764,
855,
5288,
7,
88,
58,
8054,
764,
27,
87,
29847,
12825,
60,
4008,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
312,
87,
17,
64,
796,
1064,
7,
331,
58,
12865,
764,
27,
87,
29847,
1065,
1120,
60,
764,
855,
5415,
7,
88,
58,
12865,
764,
27,
87,
29847,
1065,
1120,
60,
4008,
198,
197,
197,
197,
197,
197,
2,
312,
87,
17,
65,
796,
1064,
7,
331,
58,
12825,
764,
27,
87,
29847,
1065,
1120,
60,
764,
855,
5288,
7,
88,
58,
12825,
764,
27,
87,
29847,
1065,
1120,
60,
4008,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
312,
87,
18,
64,
796,
1064,
7,
331,
58,
23924,
764,
27,
87,
29847,
2718,
405,
60,
764,
855,
5415,
7,
88,
58,
23924,
764,
27,
87,
29847,
2718,
405,
60,
4008,
198,
197,
197,
197,
197,
197,
2,
312,
87,
18,
65,
796,
1064,
7,
331,
58,
2718,
405,
764,
27,
87,
29847,
2548,
405,
60,
764,
855,
5288,
7,
88,
58,
2718,
405,
764,
27,
87,
29847,
2548,
405,
60,
4008,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
2,
1722,
796,
1612,
7,
88,
58,
7,
312,
87,
16,
64,
58,
16,
45297,
19,
2599,
7,
312,
87,
16,
64,
58,
16,
48688,
19,
828,
16,
12962,
532,
1612,
7,
88,
58,
7,
312,
87,
16,
65,
58,
16,
45297,
19,
2599,
7,
312,
87,
16,
65,
58,
16,
48688,
19,
828,
16,
12962,
1343,
1612,
7,
88,
58,
7,
312,
87,
17,
64,
58,
16,
45297,
19,
2599,
7,
312,
87,
17,
64,
58,
16,
48688,
19,
828,
16,
12962,
532,
1612,
7,
88,
58,
7,
312,
87,
17,
65,
58,
16,
45297,
19,
2599,
7,
312,
87,
17,
65,
58,
16,
48688,
19,
828,
16,
12962,
198,
197,
197,
197,
197,
197,
2,
23155,
796,
1612,
7,
88,
58,
312,
87,
18,
64,
58,
16,
45297,
19,
1058,
4686,
87,
18,
64,
58,
16,
48688,
19,
11,
16,
12962,
532,
1612,
7,
88,
58,
312,
87,
18,
65,
58,
16,
45297,
19,
1058,
4686,
87,
18,
65,
58,
16,
48688,
19,
11,
16,
12962,
198,
197,
197,
197,
197,
197,
198,
197,
197,
197,
197,
197,
1722,
796,
5415,
7,
88,
58,
7029,
764,
27,
87,
29847,
8054,
12962,
532,
5288,
7,
88,
58,
8054,
764,
27,
87,
29847,
12825,
12962,
1343,
5415,
7,
88,
58,
12865,
764,
27,
87,
29847,
1065,
1120,
12962,
532,
5288,
7,
88,
58,
12825,
764,
27,
87,
29847,
1065,
1120,
12962,
198,
197,
197,
197,
197,
197,
23155,
796,
5415,
7,
88,
58,
23924,
764,
27,
87,
29847,
2718,
405,
12962,
532,
5288,
7,
88,
58,
2718,
405,
764,
27,
87,
29847,
2548,
405,
12962,
198,
197,
197,
197,
197,
437,
198,
197,
197,
197,
17772,
198,
197,
197,
197,
197,
2,
42302,
28,
8306,
262,
3006,
739,
3313,
5344,
290,
1660,
11760,
198,
197,
197,
197,
197,
1722,
796,
12840,
89,
7,
87,
58,
8628,
764,
27,
2124,
764,
27,
1485,
405,
4357,
88,
62,
9948,
66,
17,
58,
8628,
764,
27,
2124,
764,
27,
1485,
405,
12962,
198,
197,
197,
197,
197,
23155,
796,
12840,
89,
7,
87,
58,
2078,
405,
764,
27,
2124,
764,
27,
2718,
1120,
4357,
88,
62,
9948,
66,
17,
58,
2078,
405,
764,
27,
2124,
764,
27,
2718,
1120,
12962,
198,
197,
197,
197,
437,
198,
220,
220,
220,
220,
198,
197,
197,
197,
2,
8296,
606,
198,
197,
197,
197,
81,
18504,
58,
72,
11,
16,
60,
796,
1081,
26,
198,
197,
197,
197,
81,
18504,
58,
72,
11,
17,
60,
796,
5851,
26,
198,
197,
197,
197,
81,
18504,
58,
72,
11,
18,
60,
796,
5851,
19571,
7,
1722,
1776,
198,
197,
197,
197,
35235,
7203,
49738,
6582,
29568,
14933,
58,
72,
46570,
262,
374,
18504,
318,
29568,
81,
18504,
58,
72,
11,
18,
12962,
4943,
198,
197,
197,
437,
198,
197,
198,
197,
197,
361,
18225,
58,
17,
60,
6624,
366,
8505,
1,
198,
197,
197,
197,
11147,
796,
12133,
62,
11147,
7,
9948,
571,
1358,
62,
19849,
11,
374,
18504,
58,
45299,
18,
4357,
1660,
58,
25,
4083,
29006,
3064,
7874,
7050,
58,
25,
46570,
685,
15,
13,
20,
12962,
198,
197,
197,
197,
1073,
891,
796,
4197,
13,
17143,
198,
197,
197,
197,
82,
13495,
796,
8636,
62,
48277,
7,
11147,
11,
657,
13,
3865,
8,
628,
197,
197,
197,
81,
18504,
62,
9948,
571,
1358,
796,
2824,
7,
15,
25,
15,
13,
486,
25,
744,
7,
47033,
7,
81,
18504,
58,
45299,
18,
46570,
17,
4008,
198,
197,
197,
197,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
796,
36537,
62,
19849,
7,
81,
18504,
62,
9948,
571,
1358,
11,
1073,
891,
8,
198,
197,
197,
197,
7050,
62,
5589,
533,
796,
220,
1802,
15885,
9948,
571,
1358,
62,
19849,
7,
81,
18504,
58,
45299,
18,
4357,
1073,
891,
737,
29006,
9948,
571,
1358,
62,
19849,
7,
81,
18504,
58,
45299,
18,
4357,
1073,
891,
47762,
16,
8,
1303,
37430,
13,
513,
1004,
5401,
80,
2123,
435,
13,
357,
6999,
8,
628,
197,
197,
197,
26224,
325,
62,
9948,
571,
1358,
796,
19862,
17034,
7,
16,
19571,
7,
7857,
7,
81,
18504,
11,
16,
13219,
16,
737,
9,
16345,
19510,
7050,
62,
5589,
533,
12,
7050,
737,
61,
17,
4008,
198,
197,
197,
197,
26224,
325,
62,
10366,
952,
62,
18504,
796,
42721,
325,
62,
9948,
571,
1358,
14,
3064,
9,
7,
26224,
325,
62,
9948,
571,
1358,
29006,
3064,
12,
26224,
325,
62,
9948,
571,
1358,
47762,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
26875,
3419,
198,
197,
197,
197,
1416,
1436,
7,
81,
18504,
58,
45299,
18,
4357,
7050,
58,
25,
4083,
29006,
3064,
7874,
7050,
58,
47715,
4008,
198,
197,
197,
197,
29487,
7,
81,
18504,
62,
9948,
571,
1358,
11,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
11,
8043,
2625,
445,
1600,
2815,
413,
5649,
28,
17,
13,
15,
8,
198,
197,
197,
197,
29487,
7,
81,
18504,
62,
9948,
571,
1358,
11,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
10,
26224,
325,
62,
10366,
952,
62,
18504,
11,
8043,
2625,
445,
1600,
2815,
10992,
2625,
438,
1600,
2815,
413,
5649,
28,
16,
13,
15,
8,
198,
197,
197,
197,
29487,
7,
81,
18504,
62,
9948,
571,
1358,
11,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
12,
26224,
325,
62,
10366,
952,
62,
18504,
11,
8043,
2625,
445,
1600,
2815,
10992,
2625,
438,
1600,
2815,
413,
5649,
28,
16,
13,
15,
8,
198,
197,
197,
197,
29487,
7,
81,
18504,
62,
9948,
571,
1358,
11,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
11,
8043,
2625,
445,
4943,
198,
197,
197,
197,
87,
2475,
7,
15,
11,
47033,
7,
81,
18504,
62,
9948,
571,
1358,
47762,
16,
19571,
19,
9,
47033,
7,
81,
18504,
62,
9948,
571,
1358,
4008,
198,
197,
197,
197,
88,
2475,
7,
15,
11,
47033,
7,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
47762,
16,
19571,
19,
9,
47033,
7,
7050,
62,
10366,
952,
62,
9948,
571,
1358,
4008,
198,
197,
197,
197,
198,
197,
197,
197,
87,
18242,
7,
43,
1,
32,
3,
23330,
7050,
92,
3,
14,
32,
3,
23330,
18217,
16856,
92,
47113,
1989,
8064,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
2645,
9608,
7203,
19184,
14,
47698,
11,
3463,
8064,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
34574,
378,
7,
43,
1,
49,
3,
23330,
18504,
92,
3,
28,
1600,
5431,
16193,
15,
13,
18,
11,
15,
13,
24,
828,
5431,
1073,
3669,
2625,
897,
274,
13390,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
1600,
17899,
38342,
282,
16747,
2625,
16159,
4943,
198,
197,
197,
197,
34574,
378,
7203,
3,
7,
744,
7,
1073,
891,
58,
16,
4357,
20,
4008,
29694,
29568,
744,
7,
82,
13495,
58,
16,
4357,
20,
4008,
1600,
5431,
16193,
15,
13,
18,
11,
15,
13,
23,
828,
5431,
1073,
3669,
2625,
897,
274,
13390,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
1600,
17899,
38342,
282,
16747,
2625,
16159,
4943,
198,
197,
197,
197,
34574,
378,
7203,
23615,
28833,
59,
77,
28,
29568,
744,
7,
26224,
325,
62,
9948,
571,
1358,
11,
17,
4008,
266,
83,
4,
1600,
5431,
16193,
15,
13,
22,
11,
15,
13,
18,
828,
5431,
1073,
3669,
2625,
897,
274,
13390,
1600,
17899,
38342,
282,
16747,
2625,
16159,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
21928,
5647,
7,
6978,
82,
58,
21,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
197,
13564,
40664,
7,
8841,
7,
6978,
82,
58,
20,
46570,
14631,
4443,
6582,
1,
366,
11167,
1,
366,
49,
18504,
1,
366,
19184,
5128,
1,
366,
19184,
7431,
272,
8172,
4868,
68,
58,
45299,
16,
60,
1351,
68,
58,
45299,
17,
60,
374,
18504,
58,
45299,
18,
60,
1660,
1660,
62,
5589,
533,
12962,
198,
197,
197,
197,
2,
7783,
685,
81,
18504,
58,
45299,
18,
60,
1660,
1660,
62,
5589,
533,
60,
220,
220,
220,
198,
197,
197,
17772,
198,
197,
197,
197,
7050,
62,
28764,
5722,
796,
1802,
15885,
7,
81,
18504,
58,
45299,
18,
4083,
9,
28764,
2867,
62,
1073,
891,
58,
16,
4083,
29006,
81,
18504,
58,
45299,
18,
4083,
9,
28764,
2867,
62,
1073,
891,
58,
16,
48688,
16,
4008,
198,
197,
197,
197,
7050,
62,
28764,
5722,
62,
8929,
796,
1802,
15885,
7,
81,
18504,
58,
45299,
18,
4083,
9,
16345,
7,
28764,
2867,
62,
1073,
891,
737,
29006,
81,
18504,
58,
45299,
18,
4083,
9,
16345,
7,
28764,
2867,
62,
1073,
891,
47762,
16,
4008,
220,
198,
197,
197,
197,
13564,
40664,
7,
8841,
7,
6978,
82,
58,
20,
46570,
14631,
4443,
6582,
1,
366,
11167,
1,
366,
49,
18504,
1,
366,
19184,
7431,
272,
1,
366,
12331,
8172,
4868,
68,
58,
45299,
16,
60,
1351,
68,
58,
45299,
17,
60,
374,
18504,
58,
45299,
18,
60,
1660,
62,
28764,
5722,
1660,
62,
28764,
5722,
62,
8929,
12,
7050,
62,
28764,
5722,
12962,
198,
197,
197,
197,
2,
7783,
685,
81,
18504,
58,
45299,
18,
60,
1660,
62,
28764,
5722,
60,
198,
197,
197,
437,
220,
220,
220,
220,
220,
220,
220,
220,
198,
197,
197,
198,
197,
17772,
361,
18225,
58,
16,
60,
6624,
366,
22615,
1,
198,
197,
197,
4868,
68,
28,
961,
40664,
7,
6978,
82,
58,
16,
4357,
14267,
9688,
28,
16,
8,
198,
197,
197,
198,
197,
197,
35790,
796,
1351,
68,
58,
45299,
16,
60,
198,
197,
197,
2,
4941,
1720,
3891,
389,
287,
717,
5721,
329,
1700,
198,
197,
197,
35790,
62,
43337,
796,
1351,
68,
58,
45299,
18,
60,
198,
197,
197,
35790,
62,
7050,
796,
1351,
68,
58,
45299,
19,
60,
198,
197,
197,
198,
197,
197,
39873,
796,
1351,
68,
58,
45299,
20,
60,
198,
197,
197,
2,
6291,
1720,
3891,
389,
287,
5721,
718,
329,
1700,
198,
197,
197,
39873,
62,
43337,
796,
1351,
68,
58,
45299,
22,
60,
198,
197,
197,
198,
197,
197,
7050,
796,
3392,
7,
7857,
7,
4868,
68,
11,
16,
828,
16,
8,
1303,
262,
7177,
284,
1700,
1660,
2695,
198,
197,
197,
198,
197,
197,
1640,
1312,
796,
352,
25,
7857,
7,
4868,
68,
11,
16,
8,
198,
197,
197,
197,
198,
197,
197,
197,
2,
11748,
278,
1366,
198,
197,
197,
197,
35790,
62,
2777,
796,
1100,
25404,
76,
7,
8841,
7,
6978,
82,
58,
17,
4357,
35790,
58,
72,
46570,
15414,
62,
48310,
58,
16,
4357,
48267,
9688,
28,
15414,
62,
48310,
58,
17,
12962,
198,
197,
197,
197,
39873,
62,
2777,
796,
1100,
25404,
76,
7,
8841,
7,
6978,
82,
58,
17,
4357,
39873,
58,
72,
46570,
15414,
62,
48310,
58,
16,
4357,
48267,
9688,
28,
15414,
62,
48310,
58,
17,
12962,
198,
197,
197,
197,
198,
197,
197,
197,
361,
4941,
62,
2777,
58,
437,
11,
16,
60,
1279,
4941,
62,
2777,
58,
16,
11,
16,
60,
198,
197,
197,
197,
197,
35790,
62,
2777,
796,
14283,
27740,
7,
35790,
62,
2777,
11,
16,
8,
198,
197,
197,
197,
437,
198,
197,
197,
197,
198,
197,
197,
197,
361,
6291,
62,
2777,
58,
437,
11,
16,
60,
1279,
6291,
62,
2777,
58,
16,
11,
16,
60,
198,
197,
197,
197,
197,
39873,
62,
2777,
796,
14283,
27740,
7,
39873,
62,
2777,
11,
16,
8,
198,
197,
197,
197,
437,
198,
197,
197,
197,
198,
197,
197,
197,
2,
5951,
532,
2859,
3780,
1627,
17137,
351,
262,
679,
71,
11925,
10451,
198,
197,
197,
197,
87,
62,
5420,
11,
4941,
62,
2777,
62,
6511,
11,
5299,
796,
256,
75,
10215,
8243,
7,
35790,
62,
2777,
11,
11498,
21069,
11,
75,
6005,
11,
10215,
8243,
2625,
258,
71,
11925,
1600,
11265,
5612,
2625,
3919,
1600,
43337,
28,
35790,
62,
43337,
58,
72,
12962,
198,
197,
197,
197,
87,
62,
2777,
11,
6291,
62,
2777,
62,
6511,
11,
5299,
796,
256,
75,
10215,
8243,
7,
39873,
62,
2777,
11,
11498,
21069,
11,
75,
6005,
11,
10215,
8243,
2625,
258,
71,
11925,
1600,
11265,
5612,
2625,
3919,
1600,
43337,
28,
39873,
62,
43337,
58,
72,
12962,
198,
197,
197,
197,
198,
197,
197,
197,
2,
44800,
14805,
13284,
7861,
198,
197,
197,
197,
305,
72,
62,
71,
69,
796,
685,
23924,
13,
513,
3064,
15089,
4353,
405,
13,
5014,
405,
8183,
1303,
262,
3814,
810,
262,
1615,
1370,
318,
31070,
198,
197,
197,
197,
35790,
62,
2777,
62,
10215,
81,
17,
11,
4941,
62,
12093,
4470,
796,
14805,
7,
87,
62,
5420,
11,
35790,
62,
2777,
62,
6511,
11,
305,
72,
62,
71,
69,
553,
35428,
1600,
79,
28,
16,
13,
15,
8,
198,
197,
197,
197,
39873,
62,
2777,
62,
10215,
81,
17,
11,
6291,
62,
12093,
4470,
796,
14805,
7,
87,
62,
2777,
11,
39873,
62,
2777,
62,
6511,
11,
305,
72,
62,
71,
69,
553,
35428,
1600,
79,
28,
16,
13,
15,
8,
198,
197,
197,
197,
198,
197,
197,
197,
2,
9498,
17952,
1022,
513,
3064,
290,
4353,
405,
12067,
12,
16,
198,
197,
197,
197,
30547,
62,
35790,
796,
12840,
89,
7,
87,
62,
5420,
58,
18,
3064,
13,
764,
27,
87,
62,
5420,
58,
45299,
16,
4083,
27,
2548,
405,
13,
4357,
35790,
62,
2777,
62,
10215,
81,
17,
58,
18,
3064,
13,
764,
27,
87,
62,
5420,
58,
45299,
16,
4083,
27,
2548,
405,
8183,
8,
198,
197,
197,
197,
30547,
62,
39873,
796,
12840,
89,
7,
87,
62,
2777,
58,
18,
3064,
13,
764,
27,
87,
62,
2777,
58,
45299,
16,
4083,
27,
2548,
405,
13,
4357,
39873,
62,
2777,
62,
10215,
81,
17,
58,
18,
3064,
13,
764,
27,
87,
62,
2777,
58,
45299,
16,
4083,
27,
2548,
405,
8183,
8,
198,
197,
197,
197,
198,
197,
197,
197,
2,
2080,
262,
12245,
198,
197,
197,
197,
5317,
6377,
62,
35790,
796,
5415,
7,
35790,
62,
2777,
62,
10215,
81,
17,
58,
18,
3064,
13,
764,
27,
87,
62,
5420,
58,
45299,
16,
4083,
27,
2548,
405,
12962,
198,
197,
197,
197,
5317,
6377,
62,
39873,
796,
5415,
7,
39873,
62,
2777,
62,
10215,
81,
17,
58,
18,
3064,
13,
764,
27,
87,
62,
5420,
58,
45299,
16,
4083,
27,
2548,
405,
12962,
628,
197,
197,
197,
2,
5638,
17952,
198,
197,
197,
197,
7050,
58,
72,
60,
796,
357,
35790,
62,
7050,
58,
72,
4083,
14,
16,
13,
23,
9,
35790,
62,
43337,
58,
72,
12962,
764,
9,
30547,
62,
39873,
19571,
30547,
62,
35790,
1303,
1660,
318,
287,
18605,
14,
43,
198,
197,
197,
197,
2,
7050,
58,
72,
60,
796,
357,
35790,
62,
7050,
58,
72,
4083,
14,
16,
13,
23,
9,
35790,
62,
43337,
58,
72,
12962,
764,
9,
5317,
6377,
62,
39873,
19571,
5317,
6377,
62,
35790,
1303,
1660,
318,
287,
18605,
14,
43,
198,
197,
197,
197,
198,
197,
197,
197,
7050,
58,
72,
60,
796,
1660,
58,
72,
60,
1635,
16,
13,
23,
19571,
39873,
62,
43337,
58,
72,
60,
1303,
1660,
11513,
287,
266,
83,
4,
198,
197,
197,
197,
198,
197,
197,
197,
26875,
7,
5647,
7857,
16193,
22,
13,
20,
11,
1314,
4008,
198,
197,
197,
197,
198,
197,
197,
197,
7266,
29487,
7,
36244,
8,
198,
197,
197,
197,
7839,
7203,
41506,
36537,
25,
29568,
744,
7,
7050,
58,
72,
4357,
17,
4008,
266,
83,
4,
1660,
11,
59,
77,
599,
13,
29568,
39873,
58,
72,
12962,
351,
1006,
13,
29568,
35790,
58,
72,
12962,
366,
8,
198,
197,
197,
197,
29487,
7,
35790,
62,
2777,
58,
45299,
16,
4357,
35790,
62,
2777,
58,
45299,
17,
4357,
8043,
2625,
13424,
1600,
18242,
2625,
26687,
4943,
198,
197,
197,
197,
29487,
7,
39873,
62,
2777,
58,
45299,
16,
4357,
39873,
62,
2777,
58,
45299,
17,
4357,
8043,
2625,
17585,
1600,
18242,
2625,
36674,
4943,
198,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
14535,
261,
28,
9562,
8,
198,
197,
197,
197,
198,
197,
197,
197,
7266,
29487,
7,
27970,
8,
198,
197,
197,
197,
29487,
7,
87,
62,
5420,
58,
25,
4357,
35790,
62,
2777,
62,
6511,
58,
25,
4357,
8043,
2625,
13424,
1600,
18242,
28,
43,
1,
51,
22799,
59,
28803,
3,
19267,
4941,
4943,
198,
197,
197,
197,
29487,
7,
87,
62,
5420,
58,
25,
4357,
35790,
62,
12093,
4470,
11,
8043,
2625,
49502,
1600,
18242,
2625,
26687,
14805,
4943,
198,
197,
197,
197,
29487,
7,
87,
62,
2777,
58,
25,
4357,
39873,
62,
2777,
62,
6511,
58,
25,
4357,
8043,
2625,
17585,
1600,
18242,
28,
43,
1,
51,
22799,
59,
28803,
3,
19267,
6291,
4943,
198,
197,
197,
197,
29487,
7,
87,
62,
2777,
58,
25,
4357,
39873,
62,
12093,
4470,
11,
8043,
2625,
948,
272,
1600,
18242,
2625,
36674,
14805,
4943,
198,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
2645,
9608,
7203,
26447,
1143,
12245,
11,
257,
13,
334,
33283,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
14535,
261,
28,
9562,
8,
198,
197,
197,
197,
198,
197,
197,
197,
7266,
29487,
7,
25838,
8,
198,
197,
197,
197,
29487,
7,
87,
62,
5420,
11,
35790,
62,
2777,
62,
10215,
81,
17,
11,
8043,
2625,
13424,
1600,
18242,
2625,
8134,
13,
10958,
4943,
198,
197,
197,
197,
29487,
7,
87,
62,
2777,
11,
39873,
62,
2777,
62,
10215,
81,
17,
11,
8043,
2625,
17585,
1600,
18242,
2625,
36674,
10958,
4943,
198,
197,
197,
197,
87,
18242,
7,
43,
1,
49,
10546,
6482,
11,
12067,
3,
36796,
12,
16,
92,
3,
1600,
10331,
7857,
28,
1507,
11,
10331,
3672,
2625,
32,
4454,
4943,
198,
197,
197,
197,
1455,
437,
7,
17946,
2625,
13466,
1600,
14535,
261,
28,
9562,
8,
198,
197,
197,
197,
33464,
62,
39786,
3419,
198,
197,
197,
197,
2,
8914,
262,
1660,
2695,
198,
197,
197,
197,
13564,
40664,
7,
8841,
7,
6978,
82,
58,
20,
46570,
14631,
49738,
6582,
1,
366,
36674,
6530,
1,
366,
22362,
15655,
1660,
2695,
8172,
4868,
68,
58,
45299,
20,
60,
1351,
68,
58,
45299,
21,
60,
1660,
12962,
198,
197,
197,
197,
198,
197,
197,
197,
2,
50,
2703,
262,
7560,
3785,
357,
23599,
8619,
815,
2152,
8,
198,
197,
197,
197,
21928,
5647,
7,
8841,
7,
6978,
82,
58,
19,
17241,
37693,
62,
1273,
67,
62,
1600,
39873,
58,
72,
17241,
13,
12315,
48774,
198,
197,
197,
197,
198,
197,
197,
437,
198,
197,
197,
220,
220,
220,
198,
197,
197,
220,
220,
220,
198,
197,
17772,
1303,
393,
4049,
3275,
198,
197,
197,
18224,
7203,
1169,
717,
5078,
9217,
611,
345,
765,
284,
779,
281,
5387,
393,
7097,
36537,
4235,
13,
4222,
3853,
1022,
1111,
19570,
198,
197,
437,
198,
437,
628
] | 2.141722 | 8,559 |
using NPZ
using JuMP
using Ipopt
using LinearAlgebra
using .Threads
using WoodburyMatrices
using Statistics
using UnicodePlots
function main(B)
X1 = npzread("Kernels/G1.npy")
X2 = npzread("Kernels/G2.npy")
X3 = npzread("Kernels/G3.npy")
nfactor = npzread("Testing/nfactor.npy")
n = size(X3, 1)
ndas = size(X1, 1)
T = Float64
ϵ = 1.0
λ = 100.0
α = 100.0
X = [X3 zeros(T, size(X3));
zeros(T, size(X3)) X3;
nfactor*X1 nfactor*X2]
Xn = maximum(sqrt.(sum(X.^2, dims=2)))
#Xn = sqrt.(sum(X.^2, dims=2)) #normalize all rows to be 1?
X ./= Xn
v, V = eigen(X'*X + ϵ*I)
#eigtol = 5#quantile(v, 0.99)
n_eigs = 5#sum(v.>=eigtol)
Γ = V[:, (end-n_eigs+1):end]
μ_init = ones(n) ./ n .* B
μn = sum(μ_init)/B
μ_init ./= μn
U_init = copy(Γ)
function Ml(μ, X, ϵ)
M = ϵ*I + X'*Diagonal(μ)*X
Mc = cholesky(Hermitian(M))
return (M, Mc)
end
Ml(μ) = Ml(μ, X, ϵ)
function subproblem_sμ(μ_init, u, X, λ, B, maxiter=1000)
function f(μ, u, λ)
M, Mc = Ml(μ)
return -logdet(M) + λ*tr(u'*(Mc\u))
end
f(μ) = f(μ, u, λ)
jump_wrapper_f(x...) = f(vcat([x[i] for i in 1:length(x)], [x[i] for i in 1:length(x)], ones(T, ndas)))
function gi(i, Mc, μ, u, λ)
ld_term = @views -X[i,:]'*(Mc\X[i,:])
tmp_A = SymWoodbury(Mc, X[i,:], -μ[i])
tmp_b = @views tmp_A \ X[i,:]
#tmp_1 = (u'*tmp_b)^2
tmp_1 = sum((u'*tmp_b).^2) # think that this should be correct for tr(U'MU) for matrix U but need to check
tmp_d = @views X[i,:]'*tmp_b
tmp_den = (1+μ[i]*tmp_d)^2
eig_term = ((1+μ[i]*tmp_d)*tmp_1 - μ[i]*tmp_1*tmp_d) / tmp_den
return ld_term - λ*eig_term #apparently need a -ve sign here, work out why
end
function g!(gvec, μ, X, u, λ, n)
M, Mc = Ml(μ)
@threads for i = 1:n
g1 = gi(i, Mc, μ, u, λ) # in respect to x component
g2 = gi(i+n, Mc, μ, u, λ) # in respect to y component
gvec[i] = g1 + g2
end
end
g!(gvec, μ) = g!(gvec, μ, X, u, λ, n)
jump_wrapper_g!(gvec, x...) = g!(gvec, vcat([x[i] for i in 1:length(x)], [x[i] for i in 1:length(x)], ones(T, ndas)))
model = Model(optimizer_with_attributes(Ipopt.Optimizer, "max_iter"=>maxiter, "tol"=>1e-4/B))
JuMP.register(model, :f, n, jump_wrapper_f, jump_wrapper_g!)
@variable(model, 0.0<=x[1:n]<= 1.0)
set_start_value.(x, μ_init)
@NLconstraint(model, +(x...) <= B)
@NLobjective(model, Min, f(x...))
optimize!(model)
return (value.(x), vcat(value.(x), value.(x), ones(T, ndas)), objective_value(model))
end
function subproblem_sO(u_init, μ, γ, X, λ, α, maxiter=1000)
_, Mc = Ml(μ)
f(u) = α*sum((u.-γ).^2) + λ*tr(u'*(Mc\u))
function g!(gvec, u)
gvec .= 2*α*(u-γ) + 2*λ*(Mc\u)
end
jump_wrapper_f(x...) = f([x[i] for i in 1:length(x)])
jump_wrapper_g!(gvec, x...) = g!(gvec, [x[i] for i in 1:length(x)])
sumsquares(x...) = sum(x[i]^2 for i in 1:length(x))
function sumsquares_grad!(gvec, x...)
for i in 1:length(x)
gvec[i] = 2*x[i]
end
end
model = Model(optimizer_with_attributes(Ipopt.Optimizer, "max_iter"=>maxiter))
JuMP.register(model, :f, length(γ), jump_wrapper_f, jump_wrapper_g!)
JuMP.register(model, :sumsquares, length(γ), sumsquares, sumsquares_grad!)
@variable(model, x[1:length(γ)])
set_start_value.(x, u_init)
@NLconstraint(model, sumsquares(x...) == 1)
@NLobjective(model, Min, f(x...))
optimize!(model)
return (value.(x), objective_value(model))
end
function subproblem_sO(U_init, μ, Γ, X, λ, α, m, n, maxiter=1000)
_, Mc = Ml(μ)
f(U) = α*sum((U.-Γ).^2) + λ*tr(U'*(Mc\U))
function g!(gvec, U, m, n)
@threads for i = 1:n
@views gvec[((i-1)*m+1):i*m] .= 2*α*(U[1:m, i].-Γ[1:m, i]) .+ 2*λ*(Mc\U[1:m, i])
end
end
L = LinearIndices((m, n))
jump_wrapper_f(x...) = f([x[L[i,j]] for i in 1:m, j in 1:n])
jump_wrapper_g!(gvec, x...) = g!(gvec, [x[L[i,j]] for i in 1:m, j in 1:n], m, n)
sumprod(x...) = sum(x[i]*x[i+m] for i in 1:m)
function sumprod_grad!(gvec, x...)
for i in 1:m
gvec[i] = x[i+m]
gvec[i+m] = x[i]
end
end
model = Model(optimizer_with_attributes(Ipopt.Optimizer, "max_iter"=>maxiter))
JuMP.register(model, :f, m*n, jump_wrapper_f, jump_wrapper_g!)
JuMP.register(model, :sumprod, 2*m, sumprod, sumprod_grad!)
@variable(model, x[1:m, 1:n])
set_start_value.(x, U_init)
for i = 1:n
for j = i:n
x_i = x[1:m, i]
x_j = x[1:m, j]
@NLconstraint(model, sumprod(x_i..., x_j...) == ((i==j) ? 1 : 0)) end
end
@NLobjective(model, Min, f(x...))
optimize!(model)
return (value.(x), objective_value(model)) # want to have all of the x here as a matrix
end
function optimize_spectral(μ_init, u_init, iters, γ, X, λ, α, B)
μ = copy(μ_init)
u = copy(u_init)
ob1l = Float64[]
ob2l = Float64[]
for iter in 1:iters
μ, μl, ob1 = subproblem_sμ(μ, u, X, λ, B)
u, ob2 = subproblem_sO(u, μl, γ, X, λ, α)
push!(ob1l, ob1)
push!(ob2l, ob2)
end
μ, μl, ob1 = subproblem_sμ(μ, u, X, λ, B)
push!(ob1l, ob1)
return (μ, u, ob1l, ob2l)
end
function optimize_spectral(μ_init, U_init, iters, Γ, X, λ, α, B, m, n)
μ = copy(μ_init)
U = copy(U_init)
ob1l = Float64[]
ob2l = Float64[]
for iter in 1:iters
μ, μl, ob1 = subproblem_sμ(μ, U, X, λ, B)
U, ob2 = subproblem_sO(U, μl, Γ, X, λ, α, m, n)
push!(ob1l, ob1)
push!(ob2l, ob2)
end
μ, μl, ob1 = subproblem_sμ(μ, U, X, λ, B)
push!(ob1l, ob1)
return (μ, U, ob1l, ob2l)
end
μ, U_res, ob1l, ob2l = optimize_spectral(μ_init, U_init, 5, Γ, X, λ, α, B, size(Γ)...)
M, _ = Ml(vcat(μ,μ, ones(ndas)))
vμ, Vμ = eigen(M)
npzwrite("SpectralResults/res_spectral_$B.npy", μ)
lineplot(ob1l)
lineplot(ob2l)
end
for i in [4,8,16,32,64,128,256]
main(i)
end
#yeh | [
3500,
28498,
57,
198,
3500,
12585,
7378,
198,
3500,
314,
79,
8738,
198,
3500,
44800,
2348,
29230,
198,
3500,
764,
16818,
82,
198,
3500,
5326,
10711,
19044,
45977,
198,
3500,
14370,
198,
3500,
34371,
3646,
1747,
628,
198,
8818,
1388,
7,
33,
8,
198,
220,
220,
220,
1395,
16,
796,
45941,
89,
961,
7203,
42,
44930,
14,
38,
16,
13,
77,
9078,
4943,
198,
220,
220,
220,
1395,
17,
796,
45941,
89,
961,
7203,
42,
44930,
14,
38,
17,
13,
77,
9078,
4943,
198,
220,
220,
220,
1395,
18,
796,
45941,
89,
961,
7203,
42,
44930,
14,
38,
18,
13,
77,
9078,
4943,
198,
220,
220,
220,
299,
31412,
796,
45941,
89,
961,
7203,
44154,
14,
77,
31412,
13,
77,
9078,
4943,
628,
220,
220,
220,
299,
796,
2546,
7,
55,
18,
11,
352,
8,
198,
220,
220,
220,
299,
67,
292,
796,
2546,
7,
55,
16,
11,
352,
8,
628,
220,
220,
220,
309,
796,
48436,
2414,
198,
220,
220,
220,
18074,
113,
796,
352,
13,
15,
198,
220,
220,
220,
7377,
119,
796,
1802,
13,
15,
198,
220,
220,
220,
26367,
796,
1802,
13,
15,
628,
220,
220,
220,
1395,
796,
685,
55,
18,
1976,
27498,
7,
51,
11,
2546,
7,
55,
18,
18125,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
27498,
7,
51,
11,
2546,
7,
55,
18,
4008,
1395,
18,
26,
198,
220,
220,
220,
220,
220,
220,
220,
299,
31412,
9,
55,
16,
299,
31412,
9,
55,
17,
60,
198,
220,
220,
220,
1395,
77,
796,
5415,
7,
31166,
17034,
12195,
16345,
7,
55,
13,
61,
17,
11,
5391,
82,
28,
17,
22305,
198,
220,
220,
220,
1303,
55,
77,
796,
19862,
17034,
12195,
16345,
7,
55,
13,
61,
17,
11,
5391,
82,
28,
17,
4008,
1303,
11265,
1096,
477,
15274,
284,
307,
352,
30,
198,
220,
220,
220,
1395,
24457,
28,
1395,
77,
628,
220,
220,
220,
410,
11,
569,
796,
304,
9324,
7,
55,
6,
9,
55,
1343,
18074,
113,
9,
40,
8,
628,
220,
220,
220,
1303,
68,
328,
83,
349,
796,
642,
2,
40972,
576,
7,
85,
11,
657,
13,
2079,
8,
628,
220,
220,
220,
299,
62,
68,
9235,
796,
642,
2,
16345,
7,
85,
13,
29,
28,
68,
328,
83,
349,
8,
628,
220,
220,
220,
7377,
241,
796,
569,
58,
45299,
357,
437,
12,
77,
62,
68,
9235,
10,
16,
2599,
437,
60,
628,
220,
220,
220,
18919,
62,
15003,
796,
3392,
7,
77,
8,
24457,
299,
764,
9,
347,
198,
220,
220,
220,
18919,
77,
796,
2160,
7,
34703,
62,
15003,
20679,
33,
198,
220,
220,
220,
18919,
62,
15003,
24457,
28,
18919,
77,
198,
220,
220,
220,
471,
62,
15003,
796,
4866,
7,
138,
241,
8,
628,
220,
220,
220,
2163,
337,
75,
7,
34703,
11,
1395,
11,
18074,
113,
8,
198,
220,
220,
220,
220,
220,
220,
220,
337,
796,
18074,
113,
9,
40,
1343,
1395,
6,
9,
18683,
27923,
7,
34703,
27493,
55,
198,
220,
220,
220,
220,
220,
220,
220,
1982,
796,
442,
4316,
2584,
7,
9360,
2781,
666,
7,
44,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
44,
11,
1982,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
337,
75,
7,
34703,
8,
796,
337,
75,
7,
34703,
11,
1395,
11,
18074,
113,
8,
628,
220,
220,
220,
2163,
850,
45573,
62,
82,
34703,
7,
34703,
62,
15003,
11,
334,
11,
1395,
11,
7377,
119,
11,
347,
11,
3509,
2676,
28,
12825,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2163,
277,
7,
34703,
11,
334,
11,
7377,
119,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
11,
1982,
796,
337,
75,
7,
34703,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
532,
6404,
15255,
7,
44,
8,
1343,
7377,
119,
9,
2213,
7,
84,
6,
9,
7,
9742,
59,
84,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
277,
7,
34703,
8,
796,
277,
7,
34703,
11,
334,
11,
7377,
119,
8,
220,
628,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
69,
7,
87,
23029,
796,
277,
7,
85,
9246,
26933,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
4357,
685,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
4357,
3392,
7,
51,
11,
299,
67,
292,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
2163,
308,
72,
7,
72,
11,
1982,
11,
18919,
11,
334,
11,
7377,
119,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
67,
62,
4354,
796,
2488,
33571,
532,
55,
58,
72,
11,
47715,
6,
9,
7,
9742,
59,
55,
58,
72,
11,
25,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45218,
62,
32,
796,
15845,
22911,
10711,
7,
9742,
11,
1395,
58,
72,
11,
25,
4357,
532,
34703,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45218,
62,
65,
796,
2488,
33571,
45218,
62,
32,
3467,
1395,
58,
72,
11,
47715,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
22065,
62,
16,
796,
357,
84,
6,
9,
22065,
62,
65,
8,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45218,
62,
16,
796,
2160,
19510,
84,
6,
9,
22065,
62,
65,
737,
61,
17,
8,
1303,
892,
326,
428,
815,
307,
3376,
329,
491,
7,
52,
6,
42422,
8,
329,
17593,
471,
475,
761,
284,
2198,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45218,
62,
67,
796,
2488,
33571,
1395,
58,
72,
11,
47715,
6,
9,
22065,
62,
65,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45218,
62,
6559,
796,
357,
16,
10,
34703,
58,
72,
60,
9,
22065,
62,
67,
8,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
304,
328,
62,
4354,
796,
14808,
16,
10,
34703,
58,
72,
60,
9,
22065,
62,
67,
27493,
22065,
62,
16,
532,
18919,
58,
72,
60,
9,
22065,
62,
16,
9,
22065,
62,
67,
8,
1220,
45218,
62,
6559,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
300,
67,
62,
4354,
532,
7377,
119,
9,
68,
328,
62,
4354,
1303,
1324,
13773,
761,
257,
532,
303,
1051,
994,
11,
670,
503,
1521,
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,
2163,
308,
0,
7,
70,
35138,
11,
18919,
11,
1395,
11,
334,
11,
7377,
119,
11,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
11,
1982,
796,
337,
75,
7,
34703,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
16663,
82,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
16,
796,
308,
72,
7,
72,
11,
1982,
11,
18919,
11,
334,
11,
7377,
119,
8,
1303,
287,
2461,
284,
2124,
7515,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
17,
796,
308,
72,
7,
72,
10,
77,
11,
1982,
11,
18919,
11,
334,
11,
7377,
119,
8,
1303,
287,
2461,
284,
331,
7515,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
35138,
58,
72,
60,
796,
308,
16,
1343,
308,
17,
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,
220,
198,
220,
220,
220,
220,
220,
220,
220,
308,
0,
7,
70,
35138,
11,
18919,
8,
796,
308,
0,
7,
70,
35138,
11,
18919,
11,
1395,
11,
334,
11,
7377,
119,
11,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
70,
0,
7,
70,
35138,
11,
2124,
23029,
796,
308,
0,
7,
70,
35138,
11,
410,
9246,
26933,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
4357,
685,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
4357,
3392,
7,
51,
11,
299,
67,
292,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
7,
40085,
7509,
62,
4480,
62,
1078,
7657,
7,
40,
79,
8738,
13,
27871,
320,
7509,
11,
366,
9806,
62,
2676,
1,
14804,
9806,
2676,
11,
366,
83,
349,
1,
14804,
16,
68,
12,
19,
14,
33,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
12585,
7378,
13,
30238,
7,
19849,
11,
1058,
69,
11,
299,
11,
4391,
62,
48553,
62,
69,
11,
4391,
62,
48553,
62,
70,
8133,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
45286,
7,
19849,
11,
657,
13,
15,
27,
28,
87,
58,
16,
25,
77,
60,
27,
28,
352,
13,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
900,
62,
9688,
62,
8367,
12195,
87,
11,
18919,
62,
15003,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
1102,
2536,
2913,
7,
19849,
11,
1343,
7,
87,
23029,
19841,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
15252,
425,
7,
19849,
11,
1855,
11,
277,
7,
87,
986,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
27183,
0,
7,
19849,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
8367,
12195,
87,
828,
410,
9246,
7,
8367,
12195,
87,
828,
1988,
12195,
87,
828,
3392,
7,
51,
11,
299,
67,
292,
36911,
9432,
62,
8367,
7,
19849,
4008,
628,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
850,
45573,
62,
82,
46,
7,
84,
62,
15003,
11,
18919,
11,
7377,
111,
11,
1395,
11,
7377,
119,
11,
26367,
11,
3509,
2676,
28,
12825,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
11,
1982,
796,
337,
75,
7,
34703,
8,
628,
220,
220,
220,
220,
220,
220,
220,
277,
7,
84,
8,
796,
26367,
9,
16345,
19510,
84,
7874,
42063,
737,
61,
17,
8,
1343,
7377,
119,
9,
2213,
7,
84,
6,
9,
7,
9742,
59,
84,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2163,
308,
0,
7,
70,
35138,
11,
334,
8,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
35138,
764,
28,
362,
9,
17394,
9,
7,
84,
12,
42063,
8,
1343,
362,
9,
39377,
9,
7,
9742,
59,
84,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
69,
7,
87,
23029,
796,
277,
26933,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
70,
0,
7,
70,
35138,
11,
2124,
23029,
796,
308,
0,
7,
70,
35138,
11,
685,
87,
58,
72,
60,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
2160,
16485,
3565,
7,
87,
23029,
796,
2160,
7,
87,
58,
72,
60,
61,
17,
329,
1312,
287,
352,
25,
13664,
7,
87,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2163,
2160,
16485,
3565,
62,
9744,
0,
7,
70,
35138,
11,
2124,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
352,
25,
13664,
7,
87,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
35138,
58,
72,
60,
796,
362,
9,
87,
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,
628,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
7,
40085,
7509,
62,
4480,
62,
1078,
7657,
7,
40,
79,
8738,
13,
27871,
320,
7509,
11,
366,
9806,
62,
2676,
1,
14804,
9806,
2676,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
12585,
7378,
13,
30238,
7,
19849,
11,
1058,
69,
11,
4129,
7,
42063,
828,
4391,
62,
48553,
62,
69,
11,
4391,
62,
48553,
62,
70,
8133,
198,
220,
220,
220,
220,
220,
220,
220,
12585,
7378,
13,
30238,
7,
19849,
11,
1058,
82,
5700,
421,
3565,
11,
4129,
7,
42063,
828,
2160,
16485,
3565,
11,
2160,
16485,
3565,
62,
9744,
8133,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
45286,
7,
19849,
11,
2124,
58,
16,
25,
13664,
7,
42063,
8,
12962,
628,
220,
220,
220,
220,
220,
220,
220,
900,
62,
9688,
62,
8367,
12195,
87,
11,
334,
62,
15003,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
1102,
2536,
2913,
7,
19849,
11,
2160,
16485,
3565,
7,
87,
23029,
6624,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
15252,
425,
7,
19849,
11,
1855,
11,
277,
7,
87,
986,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
27183,
0,
7,
19849,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
8367,
12195,
87,
828,
9432,
62,
8367,
7,
19849,
4008,
628,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
850,
45573,
62,
82,
46,
7,
52,
62,
15003,
11,
18919,
11,
7377,
241,
11,
1395,
11,
7377,
119,
11,
26367,
11,
285,
11,
299,
11,
3509,
2676,
28,
12825,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
11,
1982,
796,
337,
75,
7,
34703,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
7,
52,
8,
796,
26367,
9,
16345,
19510,
52,
7874,
138,
241,
737,
61,
17,
8,
1343,
7377,
119,
9,
2213,
7,
52,
6,
9,
7,
9742,
59,
52,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2163,
308,
0,
7,
70,
35138,
11,
471,
11,
285,
11,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
16663,
82,
329,
1312,
796,
352,
25,
77,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
33571,
308,
35138,
58,
19510,
72,
12,
16,
27493,
76,
10,
16,
2599,
72,
9,
76,
60,
764,
28,
362,
9,
17394,
9,
7,
52,
58,
16,
25,
76,
11,
1312,
4083,
12,
138,
241,
58,
16,
25,
76,
11,
1312,
12962,
764,
10,
362,
9,
39377,
9,
7,
9742,
59,
52,
58,
16,
25,
76,
11,
1312,
12962,
220,
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,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
406,
796,
44800,
5497,
1063,
19510,
76,
11,
299,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
69,
7,
87,
23029,
796,
277,
26933,
87,
58,
43,
58,
72,
11,
73,
11907,
329,
1312,
287,
352,
25,
76,
11,
474,
287,
352,
25,
77,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4391,
62,
48553,
62,
70,
0,
7,
70,
35138,
11,
2124,
23029,
796,
308,
0,
7,
70,
35138,
11,
685,
87,
58,
43,
58,
72,
11,
73,
11907,
329,
1312,
287,
352,
25,
76,
11,
474,
287,
352,
25,
77,
4357,
285,
11,
299,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
931,
14892,
7,
87,
23029,
796,
2160,
7,
87,
58,
72,
60,
9,
87,
58,
72,
10,
76,
60,
329,
1312,
287,
352,
25,
76,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2163,
264,
931,
14892,
62,
9744,
0,
7,
70,
35138,
11,
2124,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
352,
25,
76,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
35138,
58,
72,
60,
796,
2124,
58,
72,
10,
76,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
35138,
58,
72,
10,
76,
60,
796,
2124,
58,
72,
60,
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,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
7,
40085,
7509,
62,
4480,
62,
1078,
7657,
7,
40,
79,
8738,
13,
27871,
320,
7509,
11,
366,
9806,
62,
2676,
1,
14804,
9806,
2676,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12585,
7378,
13,
30238,
7,
19849,
11,
1058,
69,
11,
285,
9,
77,
11,
4391,
62,
48553,
62,
69,
11,
4391,
62,
48553,
62,
70,
8133,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12585,
7378,
13,
30238,
7,
19849,
11,
1058,
82,
931,
14892,
11,
362,
9,
76,
11,
264,
931,
14892,
11,
264,
931,
14892,
62,
9744,
8133,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
45286,
7,
19849,
11,
2124,
58,
16,
25,
76,
11,
352,
25,
77,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
900,
62,
9688,
62,
8367,
12195,
87,
11,
471,
62,
15003,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
796,
1312,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
72,
796,
2124,
58,
16,
25,
76,
11,
1312,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
73,
796,
2124,
58,
16,
25,
76,
11,
474,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
1102,
2536,
2913,
7,
19849,
11,
264,
931,
14892,
7,
87,
62,
72,
986,
11,
2124,
62,
73,
23029,
6624,
14808,
72,
855,
73,
8,
5633,
352,
1058,
657,
4008,
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,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
32572,
15252,
425,
7,
19849,
11,
1855,
11,
277,
7,
87,
986,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
27183,
0,
7,
19849,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
8367,
12195,
87,
828,
9432,
62,
8367,
7,
19849,
4008,
1303,
765,
284,
423,
477,
286,
262,
2124,
994,
355,
257,
17593,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
27183,
62,
4443,
1373,
7,
34703,
62,
15003,
11,
334,
62,
15003,
11,
340,
364,
11,
7377,
111,
11,
1395,
11,
7377,
119,
11,
26367,
11,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
18919,
796,
4866,
7,
34703,
62,
15003,
8,
198,
220,
220,
220,
220,
220,
220,
220,
334,
796,
4866,
7,
84,
62,
15003,
8,
198,
220,
220,
220,
220,
220,
220,
220,
909,
16,
75,
796,
48436,
2414,
21737,
198,
220,
220,
220,
220,
220,
220,
220,
909,
17,
75,
796,
48436,
2414,
21737,
198,
220,
220,
220,
220,
220,
220,
220,
329,
11629,
287,
352,
25,
270,
364,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18919,
11,
18919,
75,
11,
909,
16,
796,
850,
45573,
62,
82,
34703,
7,
34703,
11,
334,
11,
1395,
11,
7377,
119,
11,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
11,
909,
17,
796,
850,
45573,
62,
82,
46,
7,
84,
11,
18919,
75,
11,
7377,
111,
11,
1395,
11,
7377,
119,
11,
26367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
16,
75,
11,
909,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
17,
75,
11,
909,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
18919,
11,
18919,
75,
11,
909,
16,
796,
850,
45573,
62,
82,
34703,
7,
34703,
11,
334,
11,
1395,
11,
7377,
119,
11,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
16,
75,
11,
909,
16,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
34703,
11,
334,
11,
909,
16,
75,
11,
909,
17,
75,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
27183,
62,
4443,
1373,
7,
34703,
62,
15003,
11,
471,
62,
15003,
11,
340,
364,
11,
7377,
241,
11,
1395,
11,
7377,
119,
11,
26367,
11,
347,
11,
285,
11,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
18919,
796,
4866,
7,
34703,
62,
15003,
8,
198,
220,
220,
220,
220,
220,
220,
220,
471,
796,
4866,
7,
52,
62,
15003,
8,
198,
220,
220,
220,
220,
220,
220,
220,
909,
16,
75,
796,
48436,
2414,
21737,
198,
220,
220,
220,
220,
220,
220,
220,
909,
17,
75,
796,
48436,
2414,
21737,
198,
220,
220,
220,
220,
220,
220,
220,
329,
11629,
287,
352,
25,
270,
364,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18919,
11,
18919,
75,
11,
909,
16,
796,
850,
45573,
62,
82,
34703,
7,
34703,
11,
471,
11,
1395,
11,
7377,
119,
11,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
471,
11,
909,
17,
796,
850,
45573,
62,
82,
46,
7,
52,
11,
18919,
75,
11,
7377,
241,
11,
1395,
11,
7377,
119,
11,
26367,
11,
285,
11,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
16,
75,
11,
909,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
17,
75,
11,
909,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
18919,
11,
18919,
75,
11,
909,
16,
796,
850,
45573,
62,
82,
34703,
7,
34703,
11,
471,
11,
1395,
11,
7377,
119,
11,
347,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
672,
16,
75,
11,
909,
16,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
357,
34703,
11,
471,
11,
909,
16,
75,
11,
909,
17,
75,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
18919,
11,
471,
62,
411,
11,
909,
16,
75,
11,
909,
17,
75,
796,
27183,
62,
4443,
1373,
7,
34703,
62,
15003,
11,
471,
62,
15003,
11,
642,
11,
7377,
241,
11,
1395,
11,
7377,
119,
11,
26367,
11,
347,
11,
2546,
7,
138,
241,
8,
23029,
628,
220,
220,
220,
337,
11,
4808,
796,
337,
75,
7,
85,
9246,
7,
34703,
11,
34703,
11,
3392,
7,
358,
292,
22305,
198,
220,
220,
220,
410,
34703,
11,
569,
34703,
796,
304,
9324,
7,
44,
8,
628,
220,
220,
220,
45941,
89,
13564,
7203,
49738,
1373,
25468,
14,
411,
62,
4443,
1373,
62,
3,
33,
13,
77,
9078,
1600,
18919,
8,
628,
220,
220,
220,
1627,
29487,
7,
672,
16,
75,
8,
628,
220,
220,
220,
1627,
29487,
7,
672,
17,
75,
8,
198,
437,
198,
198,
1640,
1312,
287,
685,
19,
11,
23,
11,
1433,
11,
2624,
11,
2414,
11,
12762,
11,
11645,
60,
198,
220,
220,
220,
1388,
7,
72,
8,
198,
437,
198,
198,
2,
5948,
71
] | 1.677277 | 4,084 |
using OED
using jInv.Utils
using jInv.ForwardShare
using Base.Test
using jInv.Mesh
n = 100
nrhs = 5
A = sdiag(1./linspace(1,n,n).^4)
A = A[1:2:end,:]
N = size(A,1)
x = rand(n,nrhs); x[4:7,:] = 1;
D = A*x + 1e-8* randn(N,nrhs)/1e3
OEDparamA = OEDTypeAParam(A,D,zeros(0,0))
# setup OED type B param
r = 20;
l = 2;
Mimg = getRegularMesh([-1 1 -1 1.],[10,10])
Mgrid = getRegularMesh([-1.2 2.4 -1.6 1.4],[20,20])
OEDparamB = getOEDTypeBParam(r,l,x,Mimg,Mgrid,noiseLevel=0.)
OEDparamC = getOEDTypeCParam(r,l,x,Mimg,Mgrid,noiseLevel=0.)
L = 1e-1*speye(n)
pForA = UnconstrainedOEDParam(OEDparamA,L,[],[])
pForB = UnconstrainedOEDParam(OEDparamB,L,[],[])
pForC = UnconstrainedOEDParam(OEDparamC,0*L,[],[])
pFors = (pForA,pForB,pForC)
println("\n\t---test OED with unconstrained lower-level problem---")
for k=1:3
display(pFors[k])
np = getNumberOfDesignParameters(pFors[k].Design)
p0 = rand(np)
println("\t\tcheck reconstruction")
xr, = getData(p0,pFors[k])
println("\t\t\trel.error: $(norm(xr-x)/norm(x))")
print("\t\tcheckDerivative...")
pass, = checkDerivative(p0,pFors[k])
@test pass
print("passed!\n")
print("\t\tadjoint test...")
(nw,nv) = getSensMatSize(pFors[k])
w = rand(nw)
v = rand(nv)
t1 = dot(w,getSensMatVec(v,p0,pFors[k]))
t2 = dot(v,getSensTMatVec(w,p0,pFors[k]))
@test norm(t1-t2)/norm(t1)<1e-10
print("passed!\n")
end
println("\t---least squares IP: sensitivities OK ---")
| [
3500,
440,
1961,
198,
3500,
474,
19904,
13,
18274,
4487,
198,
3500,
474,
19904,
13,
39746,
11649,
198,
3500,
7308,
13,
14402,
198,
3500,
474,
19904,
13,
37031,
198,
198,
77,
796,
1802,
198,
48624,
11994,
796,
642,
198,
198,
32,
796,
264,
10989,
363,
7,
16,
19571,
21602,
10223,
7,
16,
11,
77,
11,
77,
737,
61,
19,
8,
198,
32,
796,
317,
58,
16,
25,
17,
25,
437,
11,
47715,
198,
45,
796,
2546,
7,
32,
11,
16,
8,
198,
87,
796,
43720,
7,
77,
11,
48624,
11994,
1776,
2124,
58,
19,
25,
22,
11,
47715,
796,
352,
26,
198,
35,
796,
317,
9,
87,
220,
1343,
352,
68,
12,
23,
9,
43720,
77,
7,
45,
11,
48624,
11994,
20679,
16,
68,
18,
198,
46,
1961,
17143,
32,
796,
440,
1961,
6030,
2969,
41158,
7,
32,
11,
35,
11,
9107,
418,
7,
15,
11,
15,
4008,
198,
198,
2,
9058,
440,
1961,
2099,
347,
5772,
198,
81,
796,
1160,
26,
198,
75,
796,
362,
26,
198,
44,
9600,
220,
796,
651,
40164,
37031,
26933,
12,
16,
352,
532,
16,
352,
13,
38430,
940,
11,
940,
12962,
198,
44,
25928,
796,
651,
40164,
37031,
26933,
12,
16,
13,
17,
362,
13,
19,
532,
16,
13,
21,
352,
13,
19,
38430,
1238,
11,
1238,
12962,
198,
46,
1961,
17143,
33,
796,
651,
46,
1961,
6030,
33,
22973,
7,
81,
11,
75,
11,
87,
11,
44,
9600,
11,
44,
25928,
11,
3919,
786,
4971,
28,
15,
2014,
198,
46,
1961,
17143,
34,
796,
651,
46,
1961,
6030,
8697,
41158,
7,
81,
11,
75,
11,
87,
11,
44,
9600,
11,
44,
25928,
11,
3919,
786,
4971,
28,
15,
2014,
628,
198,
43,
796,
352,
68,
12,
16,
9,
4125,
5948,
7,
77,
8,
198,
79,
1890,
32,
796,
791,
1102,
2536,
1328,
46,
1961,
22973,
7,
46,
1961,
17143,
32,
11,
43,
17414,
38430,
12962,
198,
79,
1890,
33,
796,
791,
1102,
2536,
1328,
46,
1961,
22973,
7,
46,
1961,
17143,
33,
11,
43,
17414,
38430,
12962,
198,
79,
1890,
34,
796,
791,
1102,
2536,
1328,
46,
1961,
22973,
7,
46,
1961,
17143,
34,
11,
15,
9,
43,
17414,
38430,
12962,
198,
198,
79,
37,
669,
796,
357,
79,
1890,
32,
11,
79,
1890,
33,
11,
79,
1890,
34,
8,
198,
198,
35235,
7203,
59,
77,
59,
83,
6329,
9288,
440,
1961,
351,
21254,
2536,
1328,
2793,
12,
5715,
1917,
6329,
4943,
198,
1640,
479,
28,
16,
25,
18,
198,
197,
13812,
7,
79,
37,
669,
58,
74,
12962,
198,
197,
37659,
220,
796,
220,
651,
15057,
5189,
23067,
48944,
7,
79,
37,
669,
58,
74,
4083,
23067,
8,
198,
197,
79,
15,
220,
220,
220,
220,
220,
796,
43720,
7,
37659,
8,
628,
197,
35235,
7203,
59,
83,
59,
83,
9122,
25056,
4943,
198,
197,
87,
81,
11,
796,
651,
6601,
7,
79,
15,
11,
79,
37,
669,
58,
74,
12962,
198,
197,
35235,
7203,
59,
83,
59,
83,
59,
83,
2411,
13,
18224,
25,
29568,
27237,
7,
87,
81,
12,
87,
20679,
27237,
7,
87,
4008,
4943,
198,
197,
198,
197,
4798,
7203,
59,
83,
59,
83,
9122,
28532,
452,
876,
9313,
8,
198,
197,
198,
197,
6603,
11,
796,
2198,
28532,
452,
876,
7,
79,
15,
11,
79,
37,
669,
58,
74,
12962,
198,
197,
31,
9288,
1208,
198,
197,
4798,
7203,
6603,
276,
0,
59,
77,
4943,
198,
197,
198,
197,
4798,
7203,
59,
83,
59,
83,
41255,
1563,
1332,
9313,
8,
198,
197,
7,
47516,
11,
48005,
8,
796,
651,
50,
641,
19044,
10699,
7,
79,
37,
669,
58,
74,
12962,
198,
197,
86,
796,
43720,
7,
47516,
8,
198,
197,
85,
796,
43720,
7,
48005,
8,
198,
197,
83,
16,
796,
16605,
7,
86,
11,
1136,
50,
641,
19044,
53,
721,
7,
85,
11,
79,
15,
11,
79,
37,
669,
58,
74,
60,
4008,
198,
197,
83,
17,
796,
16605,
7,
85,
11,
1136,
50,
641,
15972,
265,
53,
721,
7,
86,
11,
79,
15,
11,
79,
37,
669,
58,
74,
60,
4008,
198,
197,
31,
9288,
2593,
7,
83,
16,
12,
83,
17,
20679,
27237,
7,
83,
16,
8,
27,
16,
68,
12,
940,
198,
197,
4798,
7203,
6603,
276,
0,
59,
77,
4943,
198,
437,
198,
35235,
7203,
59,
83,
6329,
293,
459,
24438,
6101,
25,
44752,
28720,
7477,
11420,
4943,
198
] | 1.981894 | 718 |
This is the JLL package corresponding to the `ReSHOP.jl` Julia package.
The Julia code is based on the one produced by `BinaryBuilder.jl` and has been manually edited.
| [
1212,
318,
262,
449,
3069,
5301,
11188,
284,
262,
4600,
3041,
9693,
3185,
13,
20362,
63,
22300,
5301,
13,
198,
198,
464,
22300,
2438,
318,
1912,
319,
262,
530,
4635,
416,
4600,
33,
3219,
32875,
13,
20362,
63,
290,
468,
587,
14500,
13012,
13,
198
] | 3.755556 | 45 |
using Persa
using Test
using DatasetsCF
using ModelBasedCF
dataset = DatasetsCF.MovieLens()
@testset "Random Model Tests" begin
model = ModelBasedCF.RandomModel(dataset)
Persa.train!(model, dataset)
@test !isnan(model[1,1])
end
@testset "Factorization Matrix Models Tests" begin
@testset "Baseline Tests" begin
model = ModelBasedCF.Baseline(dataset)
Persa.train!(model, dataset, max_epochs = 1)
@test !isnan(model[1,1])
end
@testset "RSVD Tests" begin
model = ModelBasedCF.RSVD(dataset, 1)
Persa.train!(model, dataset, max_epochs = 1)
@test !isnan(model[1,1])
end
@testset "IRSVD Tests" begin
model = ModelBasedCF.IRSVD(dataset, 1)
Persa.train!(model, dataset, max_epochs = 1)
@test !isnan(model[1,1])
end
end | [
3500,
9467,
64,
198,
3500,
6208,
198,
3500,
16092,
292,
1039,
22495,
198,
198,
3500,
9104,
15001,
22495,
198,
198,
19608,
292,
316,
796,
16092,
292,
1039,
22495,
13,
25097,
49479,
3419,
198,
198,
31,
9288,
2617,
366,
29531,
9104,
30307,
1,
2221,
198,
220,
220,
220,
2746,
796,
9104,
15001,
22495,
13,
29531,
17633,
7,
19608,
292,
316,
8,
198,
220,
220,
220,
9467,
64,
13,
27432,
0,
7,
19849,
11,
27039,
8,
628,
220,
220,
220,
2488,
9288,
5145,
271,
12647,
7,
19849,
58,
16,
11,
16,
12962,
198,
437,
198,
198,
31,
9288,
2617,
366,
41384,
1634,
24936,
32329,
30307,
1,
2221,
198,
220,
220,
220,
2488,
9288,
2617,
366,
15522,
4470,
30307,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
15001,
22495,
13,
15522,
4470,
7,
19608,
292,
316,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
64,
13,
27432,
0,
7,
19849,
11,
27039,
11,
3509,
62,
538,
5374,
82,
796,
352,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
271,
12647,
7,
19849,
58,
16,
11,
16,
12962,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
6998,
8898,
30307,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
15001,
22495,
13,
6998,
8898,
7,
19608,
292,
316,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
64,
13,
27432,
0,
7,
19849,
11,
27039,
11,
3509,
62,
538,
5374,
82,
796,
352,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
271,
12647,
7,
19849,
58,
16,
11,
16,
12962,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
4663,
50,
8898,
30307,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
9104,
15001,
22495,
13,
4663,
50,
8898,
7,
19608,
292,
316,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
64,
13,
27432,
0,
7,
19849,
11,
27039,
11,
3509,
62,
538,
5374,
82,
796,
352,
8,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
5145,
271,
12647,
7,
19849,
58,
16,
11,
16,
12962,
198,
220,
220,
220,
886,
198,
437
] | 2.247283 | 368 |
using DiskArrays
using DiskArrays: ReshapedDiskArray, PermutedDiskArray
using Test
#Define a data structure that can be used for testing
struct _DiskArray{T,N,A<:AbstractArray{T,N}} <: AbstractDiskArray{T,N}
getindex_count::Ref{Int}
setindex_count::Ref{Int}
parent::A
chunksize::NTuple{N,Int}
end
_DiskArray(a;chunksize=size(a)) = _DiskArray(Ref(0),Ref(0),a,chunksize)
Base.size(a::_DiskArray) = size(a.parent)
DiskArrays.haschunks(::_DiskArray) = DiskArrays.Chunked()
DiskArrays.eachchunk(a::_DiskArray) = DiskArrays.GridChunks(a,a.chunksize)
getindex_count(a::_DiskArray) = a.getindex_count[]
setindex_count(a::_DiskArray) = a.setindex_count[]
trueparent(a::_DiskArray) = a.parent
getindex_count(a::ReshapedDiskArray) = getindex_count(a.parent)
setindex_count(a::ReshapedDiskArray) = setindex_count(a.parent)
trueparent(a::ReshapedDiskArray) = trueparent(a.parent)
getindex_count(a::PermutedDiskArray) = getindex_count(a.a.parent)
setindex_count(a::PermutedDiskArray) = setindex_count(a.a.parent)
trueparent(a::PermutedDiskArray{T,N,<:PermutedDimsArray{T,N,perm,iperm}}) where {T,N,perm,iperm} = permutedims(trueparent(a.a.parent),perm)
function DiskArrays.readblock!(a::_DiskArray,aout,i::AbstractUnitRange...)
ndims(a) == length(i) || error("Number of indices is not correct")
all(r->isa(r,AbstractUnitRange),i) || error("Not all indices are unit ranges")
#println("reading from indices ", join(string.(i)," "))
a.getindex_count[] += 1
aout .= a.parent[i...]
end
function DiskArrays.writeblock!(a::_DiskArray,v,i::AbstractUnitRange...)
ndims(a) == length(i) || error("Number of indices is not correct")
all(r->isa(r,AbstractUnitRange),i) || error("Not all indices are unit ranges")
#println("Writing to indices ", join(string.(i)," "))
a.setindex_count[] += 1
view(a.parent,i...) .= v
end
function test_getindex(a)
@test a[2,3,1] == 10
@test a[2,3] == 10
@test a[2,3,1,1] == 10
@test a[:,1] == [1, 2, 3, 4]
@test a[1:2, 1:2,1,1] == [1 5; 2 6]
@test a[2:2:4,1:2:5] == [2 10 18; 4 12 20]
@test a[end:-1:1,1,1] == [4,3,2,1]
@test a[[1,3,4],[1,3],1] == [1 9; 3 11; 4 12]
# Test bitmask indexing
m = falses(4,5,1)
m[2,:,1] .= true
@test a[m] == [2,6,10,14,18]
# Test linear indexing
@test a[11:15] == 11:15
@test a[20:-1:9] == 20:-1:9
@test a[[3, 5, 8]] == [3, 5, 8]
@test a[2:4:14] == [2,6,10,14]
#Test that readblock was called exactly onces for every getindex
@test getindex_count(a) == 13
end
function test_setindex(a)
a[1,1,1] = 1
a[1,2] = 2
a[1,3,1,1] = 3
a[2,:] = [1, 2, 3, 4, 5]
a[3, 3:4,1,1] = [3,4]
# Test bitmask indexing
m = falses(4,5,1)
m[4,:,1] .= true
a[m] = [10,11,12,13,14]
#Test that readblock was called exactly onces for every getindex
@test setindex_count(a) == 6
@test trueparent(a)[1,1:3,1] == [1,2,3]
@test trueparent(a)[2,:,1] == [1,2,3,4,5]
@test trueparent(a)[3,3:4,1] == [3,4]
@test trueparent(a)[4,:,1] == [10,11,12,13,14]
a[1:2:4,1:2:5,1] = [1 2 3; 5 6 7]
@test trueparent(a)[1:2:4,1:2:5,1] == [1 2 3; 5 6 7]
@test setindex_count(a) == 7
a[[2,4],1:2,1] = [1 2; 5 6]
@test trueparent(a)[[2,4],1:2,1] == [1 2; 5 6]
@test setindex_count(a) == 8
end
function test_view(a)
v = view(a,2:3,2:4,1)
v[1:2,1] = [1,2]
v[1:2,2:3] = [4 4; 4 4]
@test v[1:2,1] == [1,2]
@test v[1:2,2:3] == [4 4; 4 4]
@test trueparent(a)[2:3,2] == [1,2]
@test trueparent(a)[2:3,3:4] == [4 4; 4 4]
@test getindex_count(a) == 2
@test setindex_count(a) == 2
end
function test_reductions(af)
data = rand(10,20,2)
for f in (minimum,maximum,sum,
(i,args...;kwargs...)->all(j->j>0.1,i,args...;kwargs...),
(i,args...;kwargs...)->any(j->j<0.1,i,args...;kwargs...),
(i,args...;kwargs...)->mapreduce(x->2*x,+,i,args...;kwargs...))
a = af(data)
@test isapprox(f(a),f(data))
@test getindex_count(a) <= 10
#And test reduction along dimensions
a = _DiskArray(data,chunksize=(5,4,2))
@test all(isapprox.(f(a,dims=2),f(data,dims=2)))
#The minimum and maximum functions do some initialization, which will increase
#the number of reads
@test f in (minimum, maximum) || getindex_count(a) <= 12
a = _DiskArray(data,chunksize=(5,4,2))
@test all(isapprox.(f(a,dims=(1,3)),f(data,dims=(1,3))))
@test f in (minimum, maximum) || getindex_count(a) <= 12
end
end
function test_broadcast(a_disk1)
a_disk2 = _DiskArray(rand(1:10,1,9), chunksize=(1,3))
a_mem = reshape(1:2,1,1,2);
s = a_disk1 .+ a_disk2 .* Ref(2) ./ (2,)
#Test lazy broadcasting
@test s isa DiskArrays.BroadcastDiskArray
@test s === DiskArrays.BroadcastDiskArray(s.bc)
@test getindex_count(a_disk1)==0
@test setindex_count(a_disk1)==0
@test getindex_count(a_disk2)==0
@test setindex_count(a_disk2)==0
@test size(s)==(10,9,2)
@test eltype(s) == Float64
#Lets merge another broadcast
s2 = s ./ a_mem
@test s isa DiskArrays.BroadcastDiskArray
@test getindex_count(a_disk1)==0
@test getindex_count(a_disk2)==0
@test size(s)==(10,9,2)
@test eltype(s) == Float64
#And now do the computation with Array as a sink
aout = zeros(10,9,2)
aout .= s2 .* 2 ./ Ref(2)
#Test if the result is correct
@test aout == (trueparent(a_disk1) .+ trueparent(a_disk2))./a_mem
@test getindex_count(a_disk1)==6
@test getindex_count(a_disk2)==6
#Now use another DiskArray as the output
aout = _DiskArray(zeros(10,9,2),chunksize=(5,3,2))
aout .= s ./ a_mem
@test trueparent(aout) == (trueparent(a_disk1) .+ trueparent(a_disk2))./a_mem
@test setindex_count(aout)==6
@test getindex_count(a_disk1)==12
@test getindex_count(a_disk2)==12
#Test reduction of broadcasted expression
r = sum(s2, dims=(1,2))
@test all(isapprox.(sum((trueparent(a_disk1) .+ trueparent(a_disk2))./a_mem,dims=(1,2)),r))
@test getindex_count(a_disk1)==18
@test getindex_count(a_disk2)==18
end
@testset "Index interpretation" begin
import DiskArrays: DimsDropper, Reshaper
a = zeros(3,3,1)
@test interpret_indices_disk(a, (:,2,:)) == ((Base.OneTo(3), 2:2, Base.OneTo(1)), DimsDropper{Tuple{Int}}((2,)))
@test interpret_indices_disk(a, (1,2,:)) == ((1:1, 2:2, Base.OneTo(1)), DimsDropper{Tuple{Int,Int}}((1, 2)))
@test interpret_indices_disk(a, (1,2,2,1)) == ((1:1, 2:2, 2:2), DimsDropper{Tuple{Int,Int,Int}}((1, 2, 3)))
@test interpret_indices_disk(a, (1,2,2,1)) == ((1:1, 2:2, 2:2), DimsDropper{Tuple{Int,Int,Int}}((1, 2, 3)))
@test interpret_indices_disk(a, (:,1:2)) == ((Base.OneTo(3), 1:2, 1:1), DimsDropper{Tuple{Int}}((3,)))
@test interpret_indices_disk(a, (:,)) == ((Base.OneTo(3), Base.OneTo(3), Base.OneTo(1)), DiskArrays.Reshaper{Int}(9))
end
@testset "AbstractDiskArray getindex" begin
a = _DiskArray(reshape(1:20,4,5,1))
test_getindex(a)
end
@testset "AbstractDiskArray setindex" begin
a = _DiskArray(zeros(Int,4,5,1))
test_setindex(a)
end
@testset "Zerodimensional" begin
a = _DiskArray(zeros(Int))
@test a[] == 0
@test a[1] == 0
a[] = 5
@test a[] == 5
a[1] = 6
@test a[] == 6
end
@testset "Views" begin
a = _DiskArray(zeros(Int,4,5,1))
test_view(a)
end
# The remaing tests only work for Julia >= 1.3
if VERSION >= v"1.3.0"
import Statistics: mean
@testset "Reductions" begin
a = data -> _DiskArray(data,chunksize=(5,4,2))
test_reductions(a)
end
@testset "Broadcast" begin
a_disk1 = _DiskArray(rand(10,9,2), chunksize=(5,3,2))
test_broadcast(a_disk1)
end
@testset "Broadcast with length 1 final dim" begin
a_disk1 = _DiskArray(rand(10,9,1), chunksize=(5,3,1))
a_disk2 = _DiskArray(rand(1:10,1,9), chunksize=(1,3))
s = a_disk1 .+ a_disk2
@test DiskArrays.eachchunk(s) isa DiskArrays.GridChunks{3}
@test size(collect(s)) == (10, 9, 1)
end
@testset "Reshape" begin
a = reshape(_DiskArray(reshape(1:20,4,5)),4,5,1)
test_getindex(a)
a = reshape(_DiskArray(zeros(Int,4,5)),4,5,1)
test_setindex(a)
a = reshape(_DiskArray(zeros(Int,4,5)),4,5,1)
test_view(a)
a = data -> reshape(_DiskArray(data,chunksize=(5,4,2)),10,20,2,1)
test_reductions(a)
a = reshape(_DiskArray(reshape(1:20,4,5)),4,5,1)
@test ReshapedDiskArray(a.parent, a.keepdim, a.newsize) === a
end
import Base.PermutedDimsArrays.invperm
@testset "Permutedims" begin
p = (3,1,2)
ip = invperm(p)
a = permutedims(_DiskArray(permutedims(reshape(1:20,4,5,1),ip)),p)
test_getindex(a)
a = permutedims(_DiskArray(zeros(Int,5,1,4)),p)
test_setindex(a)
a = permutedims(_DiskArray(zeros(Int,5,1,4)),p)
test_view(a)
a = data -> permutedims(_DiskArray(permutedims(data,ip),chunksize=(4,2,5)),p)
test_reductions(a)
a_disk1 = permutedims(_DiskArray(rand(9,2,10), chunksize=(3,2,5)),p)
test_broadcast(a_disk1)
@test PermutedDiskArray(a_disk1.a) === a_disk1
end
@testset "Unchunked String arrays" begin
a = reshape(1:200000,200,1000)
b = string.(a)
c = collect(Union{Int,Missing},a)
DiskArrays.default_chunk_size[] = 100
DiskArrays.fallback_element_size[] = 100
@test DiskArrays.estimate_chunksize(a) == (200,1000)
@test DiskArrays.eachchunk(a) == DiskArrays.GridChunks(a,(200,1000))
@test DiskArrays.estimate_chunksize(b) == (200,1000)
@test DiskArrays.eachchunk(b) == DiskArrays.GridChunks(b,(200,1000))
@test DiskArrays.estimate_chunksize(c) == (200,1000)
@test DiskArrays.eachchunk(c) == DiskArrays.GridChunks(c,(200,1000))
DiskArrays.default_chunk_size[] = 1
@test DiskArrays.estimate_chunksize(a) == (200,625)
@test DiskArrays.eachchunk(a) == DiskArrays.GridChunks(a,(200,625))
@test DiskArrays.estimate_chunksize(b) == (200,50)
@test DiskArrays.eachchunk(b) == DiskArrays.GridChunks(b,(200,50))
@test DiskArrays.estimate_chunksize(c) == (200,625)
@test DiskArrays.eachchunk(c) == DiskArrays.GridChunks(c,(200,625))
DiskArrays.fallback_element_size[] = 1000
@test DiskArrays.estimate_chunksize(a) == (200,625)
@test DiskArrays.eachchunk(a) == DiskArrays.GridChunks(a,(200,625))
@test DiskArrays.estimate_chunksize(b) == (200,5)
@test DiskArrays.eachchunk(b) == DiskArrays.GridChunks(b,(200,5))
@test DiskArrays.estimate_chunksize(c) == (200,625)
@test DiskArrays.eachchunk(c) == DiskArrays.GridChunks(c,(200,625))
end
end
| [
3500,
31664,
3163,
20477,
198,
3500,
31664,
3163,
20477,
25,
1874,
71,
5813,
40961,
19182,
11,
2448,
76,
7241,
40961,
19182,
198,
3500,
6208,
198,
198,
2,
7469,
500,
257,
1366,
4645,
326,
460,
307,
973,
329,
4856,
198,
7249,
4808,
40961,
19182,
90,
51,
11,
45,
11,
32,
27,
25,
23839,
19182,
90,
51,
11,
45,
11709,
1279,
25,
27741,
40961,
19182,
90,
51,
11,
45,
92,
198,
220,
651,
9630,
62,
9127,
3712,
8134,
90,
5317,
92,
198,
220,
900,
9630,
62,
9127,
3712,
8134,
90,
5317,
92,
198,
220,
2560,
3712,
32,
198,
220,
22716,
1096,
3712,
11251,
29291,
90,
45,
11,
5317,
92,
198,
437,
198,
62,
40961,
19182,
7,
64,
26,
354,
14125,
1096,
28,
7857,
7,
64,
4008,
796,
4808,
40961,
19182,
7,
8134,
7,
15,
828,
8134,
7,
15,
828,
64,
11,
354,
14125,
1096,
8,
198,
14881,
13,
7857,
7,
64,
3712,
62,
40961,
19182,
8,
796,
2546,
7,
64,
13,
8000,
8,
198,
40961,
3163,
20477,
13,
10134,
354,
14125,
7,
3712,
62,
40961,
19182,
8,
796,
31664,
3163,
20477,
13,
1925,
2954,
276,
3419,
198,
40961,
3163,
20477,
13,
27379,
354,
2954,
7,
64,
3712,
62,
40961,
19182,
8,
796,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
64,
11,
64,
13,
354,
14125,
1096,
8,
198,
1136,
9630,
62,
9127,
7,
64,
3712,
62,
40961,
19182,
8,
796,
257,
13,
1136,
9630,
62,
9127,
21737,
198,
2617,
9630,
62,
9127,
7,
64,
3712,
62,
40961,
19182,
8,
796,
257,
13,
2617,
9630,
62,
9127,
21737,
198,
7942,
8000,
7,
64,
3712,
62,
40961,
19182,
8,
796,
257,
13,
8000,
198,
1136,
9630,
62,
9127,
7,
64,
3712,
4965,
71,
5813,
40961,
19182,
8,
796,
651,
9630,
62,
9127,
7,
64,
13,
8000,
8,
198,
2617,
9630,
62,
9127,
7,
64,
3712,
4965,
71,
5813,
40961,
19182,
8,
796,
900,
9630,
62,
9127,
7,
64,
13,
8000,
8,
198,
7942,
8000,
7,
64,
3712,
4965,
71,
5813,
40961,
19182,
8,
796,
2081,
8000,
7,
64,
13,
8000,
8,
198,
1136,
9630,
62,
9127,
7,
64,
3712,
5990,
76,
7241,
40961,
19182,
8,
796,
651,
9630,
62,
9127,
7,
64,
13,
64,
13,
8000,
8,
198,
2617,
9630,
62,
9127,
7,
64,
3712,
5990,
76,
7241,
40961,
19182,
8,
796,
900,
9630,
62,
9127,
7,
64,
13,
64,
13,
8000,
8,
198,
7942,
8000,
7,
64,
3712,
5990,
76,
7241,
40961,
19182,
90,
51,
11,
45,
11,
27,
25,
5990,
76,
7241,
35,
12078,
19182,
90,
51,
11,
45,
11,
16321,
11,
9346,
76,
11709,
8,
810,
1391,
51,
11,
45,
11,
16321,
11,
9346,
76,
92,
796,
9943,
7241,
12078,
7,
7942,
8000,
7,
64,
13,
64,
13,
8000,
828,
16321,
8,
198,
8818,
31664,
3163,
20477,
13,
961,
9967,
0,
7,
64,
3712,
62,
40961,
19182,
11,
64,
448,
11,
72,
3712,
23839,
26453,
17257,
23029,
198,
220,
299,
67,
12078,
7,
64,
8,
6624,
4129,
7,
72,
8,
8614,
4049,
7203,
15057,
286,
36525,
318,
407,
3376,
4943,
198,
220,
477,
7,
81,
3784,
9160,
7,
81,
11,
23839,
26453,
17257,
828,
72,
8,
8614,
4049,
7203,
3673,
477,
36525,
389,
4326,
16069,
4943,
198,
220,
1303,
35235,
7203,
25782,
422,
36525,
33172,
4654,
7,
8841,
12195,
72,
27267,
366,
4008,
198,
220,
257,
13,
1136,
9630,
62,
9127,
21737,
15853,
352,
198,
220,
257,
448,
764,
28,
257,
13,
8000,
58,
72,
22345,
198,
437,
198,
8818,
31664,
3163,
20477,
13,
13564,
9967,
0,
7,
64,
3712,
62,
40961,
19182,
11,
85,
11,
72,
3712,
23839,
26453,
17257,
23029,
198,
220,
299,
67,
12078,
7,
64,
8,
6624,
4129,
7,
72,
8,
8614,
4049,
7203,
15057,
286,
36525,
318,
407,
3376,
4943,
198,
220,
477,
7,
81,
3784,
9160,
7,
81,
11,
23839,
26453,
17257,
828,
72,
8,
8614,
4049,
7203,
3673,
477,
36525,
389,
4326,
16069,
4943,
198,
220,
1303,
35235,
7203,
33874,
284,
36525,
33172,
4654,
7,
8841,
12195,
72,
27267,
366,
4008,
198,
220,
257,
13,
2617,
9630,
62,
9127,
21737,
15853,
352,
198,
220,
1570,
7,
64,
13,
8000,
11,
72,
23029,
764,
28,
410,
198,
437,
198,
198,
8818,
1332,
62,
1136,
9630,
7,
64,
8,
198,
220,
2488,
9288,
257,
58,
17,
11,
18,
11,
16,
60,
6624,
838,
198,
220,
2488,
9288,
257,
58,
17,
11,
18,
60,
6624,
838,
198,
220,
2488,
9288,
257,
58,
17,
11,
18,
11,
16,
11,
16,
60,
6624,
838,
198,
220,
2488,
9288,
257,
58,
45299,
16,
60,
6624,
685,
16,
11,
362,
11,
513,
11,
604,
60,
198,
220,
2488,
9288,
257,
58,
16,
25,
17,
11,
352,
25,
17,
11,
16,
11,
16,
60,
6624,
685,
16,
642,
26,
362,
718,
60,
198,
220,
2488,
9288,
257,
58,
17,
25,
17,
25,
19,
11,
16,
25,
17,
25,
20,
60,
6624,
685,
17,
838,
1248,
26,
604,
1105,
1160,
60,
198,
220,
2488,
9288,
257,
58,
437,
21912,
16,
25,
16,
11,
16,
11,
16,
60,
6624,
685,
19,
11,
18,
11,
17,
11,
16,
60,
198,
220,
2488,
9288,
257,
30109,
16,
11,
18,
11,
19,
38430,
16,
11,
18,
4357,
16,
60,
6624,
685,
16,
860,
26,
513,
1367,
26,
604,
1105,
60,
198,
220,
1303,
6208,
1643,
27932,
6376,
278,
198,
220,
285,
796,
27807,
274,
7,
19,
11,
20,
11,
16,
8,
198,
220,
285,
58,
17,
11,
45299,
16,
60,
764,
28,
2081,
198,
220,
2488,
9288,
257,
58,
76,
60,
6624,
685,
17,
11,
21,
11,
940,
11,
1415,
11,
1507,
60,
198,
220,
1303,
6208,
14174,
6376,
278,
198,
220,
2488,
9288,
257,
58,
1157,
25,
1314,
60,
6624,
1367,
25,
1314,
198,
220,
2488,
9288,
257,
58,
1238,
21912,
16,
25,
24,
60,
6624,
1160,
21912,
16,
25,
24,
198,
220,
2488,
9288,
257,
30109,
18,
11,
642,
11,
807,
11907,
6624,
685,
18,
11,
642,
11,
807,
60,
198,
220,
2488,
9288,
257,
58,
17,
25,
19,
25,
1415,
60,
6624,
685,
17,
11,
21,
11,
940,
11,
1415,
60,
198,
220,
1303,
14402,
326,
1100,
9967,
373,
1444,
3446,
319,
728,
329,
790,
651,
9630,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
8,
6624,
1511,
198,
437,
198,
198,
8818,
1332,
62,
2617,
9630,
7,
64,
8,
198,
220,
257,
58,
16,
11,
16,
11,
16,
60,
796,
352,
198,
220,
257,
58,
16,
11,
17,
60,
796,
362,
198,
220,
257,
58,
16,
11,
18,
11,
16,
11,
16,
60,
796,
513,
198,
220,
257,
58,
17,
11,
47715,
796,
685,
16,
11,
362,
11,
513,
11,
604,
11,
642,
60,
198,
220,
257,
58,
18,
11,
513,
25,
19,
11,
16,
11,
16,
60,
796,
685,
18,
11,
19,
60,
198,
220,
1303,
6208,
1643,
27932,
6376,
278,
198,
220,
285,
796,
27807,
274,
7,
19,
11,
20,
11,
16,
8,
198,
220,
285,
58,
19,
11,
45299,
16,
60,
764,
28,
2081,
198,
220,
257,
58,
76,
60,
796,
685,
940,
11,
1157,
11,
1065,
11,
1485,
11,
1415,
60,
198,
220,
1303,
14402,
326,
1100,
9967,
373,
1444,
3446,
319,
728,
329,
790,
651,
9630,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
8,
6624,
718,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
16,
11,
16,
25,
18,
11,
16,
60,
6624,
685,
16,
11,
17,
11,
18,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
17,
11,
45299,
16,
60,
6624,
685,
16,
11,
17,
11,
18,
11,
19,
11,
20,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
18,
11,
18,
25,
19,
11,
16,
60,
6624,
685,
18,
11,
19,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
19,
11,
45299,
16,
60,
6624,
685,
940,
11,
1157,
11,
1065,
11,
1485,
11,
1415,
60,
198,
220,
257,
58,
16,
25,
17,
25,
19,
11,
16,
25,
17,
25,
20,
11,
16,
60,
796,
685,
16,
362,
513,
26,
642,
718,
767,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
16,
25,
17,
25,
19,
11,
16,
25,
17,
25,
20,
11,
16,
60,
6624,
685,
16,
362,
513,
26,
642,
718,
767,
60,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
8,
6624,
767,
198,
220,
257,
30109,
17,
11,
19,
4357,
16,
25,
17,
11,
16,
60,
796,
685,
16,
362,
26,
642,
718,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
8,
30109,
17,
11,
19,
4357,
16,
25,
17,
11,
16,
60,
6624,
685,
16,
362,
26,
642,
718,
60,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
8,
6624,
807,
198,
437,
198,
198,
8818,
1332,
62,
1177,
7,
64,
8,
198,
220,
410,
796,
1570,
7,
64,
11,
17,
25,
18,
11,
17,
25,
19,
11,
16,
8,
628,
220,
410,
58,
16,
25,
17,
11,
16,
60,
796,
685,
16,
11,
17,
60,
198,
220,
410,
58,
16,
25,
17,
11,
17,
25,
18,
60,
796,
685,
19,
604,
26,
604,
604,
60,
198,
220,
2488,
9288,
410,
58,
16,
25,
17,
11,
16,
60,
6624,
685,
16,
11,
17,
60,
198,
220,
2488,
9288,
410,
58,
16,
25,
17,
11,
17,
25,
18,
60,
6624,
685,
19,
604,
26,
604,
604,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
17,
25,
18,
11,
17,
60,
6624,
685,
16,
11,
17,
60,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
38381,
17,
25,
18,
11,
18,
25,
19,
60,
6624,
685,
19,
604,
26,
604,
604,
60,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
8,
6624,
362,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
8,
6624,
362,
198,
437,
198,
198,
8818,
1332,
62,
445,
20847,
7,
1878,
8,
198,
220,
1366,
796,
43720,
7,
940,
11,
1238,
11,
17,
8,
198,
220,
329,
277,
287,
357,
39504,
11,
47033,
11,
16345,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
72,
11,
22046,
986,
26,
46265,
22046,
23029,
3784,
439,
7,
73,
3784,
73,
29,
15,
13,
16,
11,
72,
11,
22046,
986,
26,
46265,
22046,
986,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
72,
11,
22046,
986,
26,
46265,
22046,
23029,
3784,
1092,
7,
73,
3784,
73,
27,
15,
13,
16,
11,
72,
11,
22046,
986,
26,
46265,
22046,
986,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
72,
11,
22046,
986,
26,
46265,
22046,
23029,
3784,
8899,
445,
7234,
7,
87,
3784,
17,
9,
87,
11,
28200,
72,
11,
22046,
986,
26,
46265,
22046,
986,
4008,
198,
220,
220,
220,
257,
796,
6580,
7,
7890,
8,
198,
220,
220,
220,
2488,
9288,
318,
1324,
13907,
7,
69,
7,
64,
828,
69,
7,
7890,
4008,
198,
220,
220,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
8,
19841,
838,
198,
220,
220,
220,
1303,
1870,
1332,
7741,
1863,
15225,
198,
220,
220,
220,
257,
796,
4808,
40961,
19182,
7,
7890,
11,
354,
14125,
1096,
16193,
20,
11,
19,
11,
17,
4008,
198,
220,
220,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
69,
7,
64,
11,
67,
12078,
28,
17,
828,
69,
7,
7890,
11,
67,
12078,
28,
17,
22305,
198,
220,
220,
220,
1303,
464,
5288,
290,
5415,
5499,
466,
617,
37588,
11,
543,
481,
2620,
198,
220,
220,
220,
1303,
1169,
1271,
286,
9743,
198,
220,
220,
220,
2488,
9288,
277,
287,
357,
39504,
11,
5415,
8,
8614,
651,
9630,
62,
9127,
7,
64,
8,
19841,
1105,
198,
220,
220,
220,
257,
796,
4808,
40961,
19182,
7,
7890,
11,
354,
14125,
1096,
16193,
20,
11,
19,
11,
17,
4008,
198,
220,
220,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
69,
7,
64,
11,
67,
12078,
16193,
16,
11,
18,
36911,
69,
7,
7890,
11,
67,
12078,
16193,
16,
11,
18,
35514,
198,
220,
220,
220,
2488,
9288,
277,
287,
357,
39504,
11,
5415,
8,
8614,
651,
9630,
62,
9127,
7,
64,
8,
19841,
1105,
198,
220,
886,
198,
437,
198,
198,
8818,
1332,
62,
36654,
2701,
7,
64,
62,
39531,
16,
8,
198,
220,
257,
62,
39531,
17,
796,
4808,
40961,
19182,
7,
25192,
7,
16,
25,
940,
11,
16,
11,
24,
828,
22716,
1096,
16193,
16,
11,
18,
4008,
198,
220,
257,
62,
11883,
220,
220,
796,
27179,
1758,
7,
16,
25,
17,
11,
16,
11,
16,
11,
17,
1776,
628,
220,
264,
796,
257,
62,
39531,
16,
764,
10,
257,
62,
39531,
17,
764,
9,
6524,
7,
17,
8,
24457,
357,
17,
35751,
198,
220,
1303,
14402,
16931,
22978,
198,
220,
2488,
9288,
264,
318,
64,
31664,
3163,
20477,
13,
30507,
2701,
40961,
19182,
198,
220,
2488,
9288,
264,
24844,
31664,
3163,
20477,
13,
30507,
2701,
40961,
19182,
7,
82,
13,
15630,
8,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
15,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
15,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
15,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
15,
198,
220,
2488,
9288,
2546,
7,
82,
8,
855,
7,
940,
11,
24,
11,
17,
8,
198,
220,
2488,
9288,
1288,
4906,
7,
82,
8,
6624,
48436,
2414,
198,
220,
1303,
43,
1039,
20121,
1194,
7025,
198,
220,
264,
17,
796,
264,
24457,
257,
62,
11883,
198,
220,
2488,
9288,
264,
318,
64,
31664,
3163,
20477,
13,
30507,
2701,
40961,
19182,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
15,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
15,
198,
220,
2488,
9288,
2546,
7,
82,
8,
855,
7,
940,
11,
24,
11,
17,
8,
198,
220,
2488,
9288,
1288,
4906,
7,
82,
8,
6624,
48436,
2414,
198,
220,
1303,
1870,
783,
466,
262,
29964,
351,
15690,
355,
257,
14595,
198,
220,
257,
448,
796,
1976,
27498,
7,
940,
11,
24,
11,
17,
8,
198,
220,
257,
448,
764,
28,
264,
17,
764,
9,
362,
24457,
6524,
7,
17,
8,
198,
220,
1303,
14402,
611,
262,
1255,
318,
3376,
198,
220,
2488,
9288,
257,
448,
6624,
357,
7942,
8000,
7,
64,
62,
39531,
16,
8,
764,
10,
2081,
8000,
7,
64,
62,
39531,
17,
29720,
14,
64,
62,
11883,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
21,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
21,
198,
220,
1303,
3844,
779,
1194,
31664,
19182,
355,
262,
5072,
198,
220,
257,
448,
796,
4808,
40961,
19182,
7,
9107,
418,
7,
940,
11,
24,
11,
17,
828,
354,
14125,
1096,
16193,
20,
11,
18,
11,
17,
4008,
198,
220,
257,
448,
764,
28,
264,
24457,
257,
62,
11883,
198,
220,
2488,
9288,
2081,
8000,
7,
64,
448,
8,
6624,
357,
7942,
8000,
7,
64,
62,
39531,
16,
8,
764,
10,
2081,
8000,
7,
64,
62,
39531,
17,
29720,
14,
64,
62,
11883,
198,
220,
2488,
9288,
900,
9630,
62,
9127,
7,
64,
448,
8,
855,
21,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
1065,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
1065,
198,
220,
1303,
14402,
7741,
286,
7025,
276,
5408,
198,
220,
374,
796,
2160,
7,
82,
17,
11,
5391,
82,
16193,
16,
11,
17,
4008,
198,
220,
2488,
9288,
477,
7,
271,
1324,
13907,
12195,
16345,
19510,
7942,
8000,
7,
64,
62,
39531,
16,
8,
764,
10,
2081,
8000,
7,
64,
62,
39531,
17,
29720,
14,
64,
62,
11883,
11,
67,
12078,
16193,
16,
11,
17,
36911,
81,
4008,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
16,
8,
855,
1507,
198,
220,
2488,
9288,
651,
9630,
62,
9127,
7,
64,
62,
39531,
17,
8,
855,
1507,
198,
437,
198,
198,
31,
9288,
2617,
366,
15732,
10794,
1,
2221,
198,
220,
1330,
31664,
3163,
20477,
25,
360,
12078,
35442,
2848,
11,
1874,
71,
2136,
198,
220,
257,
796,
1976,
27498,
7,
18,
11,
18,
11,
16,
8,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
45299,
17,
11,
25,
4008,
6624,
14808,
14881,
13,
3198,
2514,
7,
18,
828,
362,
25,
17,
11,
7308,
13,
3198,
2514,
7,
16,
36911,
360,
12078,
35442,
2848,
90,
51,
29291,
90,
5317,
11709,
19510,
17,
11,
22305,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
16,
11,
17,
11,
25,
4008,
6624,
14808,
16,
25,
16,
11,
362,
25,
17,
11,
7308,
13,
3198,
2514,
7,
16,
36911,
360,
12078,
35442,
2848,
90,
51,
29291,
90,
5317,
11,
5317,
11709,
19510,
16,
11,
362,
22305,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
16,
11,
17,
11,
17,
11,
16,
4008,
6624,
14808,
16,
25,
16,
11,
362,
25,
17,
11,
362,
25,
17,
828,
360,
12078,
35442,
2848,
90,
51,
29291,
90,
5317,
11,
5317,
11,
5317,
11709,
19510,
16,
11,
362,
11,
513,
22305,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
16,
11,
17,
11,
17,
11,
16,
4008,
6624,
14808,
16,
25,
16,
11,
362,
25,
17,
11,
362,
25,
17,
828,
360,
12078,
35442,
2848,
90,
51,
29291,
90,
5317,
11,
5317,
11,
5317,
11709,
19510,
16,
11,
362,
11,
513,
22305,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
45299,
16,
25,
17,
4008,
6624,
14808,
14881,
13,
3198,
2514,
7,
18,
828,
352,
25,
17,
11,
352,
25,
16,
828,
360,
12078,
35442,
2848,
90,
51,
29291,
90,
5317,
11709,
19510,
18,
11,
22305,
198,
220,
2488,
9288,
6179,
62,
521,
1063,
62,
39531,
7,
64,
11,
357,
45299,
4008,
6624,
14808,
14881,
13,
3198,
2514,
7,
18,
828,
7308,
13,
3198,
2514,
7,
18,
828,
7308,
13,
3198,
2514,
7,
16,
36911,
31664,
3163,
20477,
13,
4965,
71,
2136,
90,
5317,
92,
7,
24,
4008,
198,
437,
198,
198,
31,
9288,
2617,
366,
23839,
40961,
19182,
651,
9630,
1,
2221,
198,
220,
257,
796,
4808,
40961,
19182,
7,
3447,
1758,
7,
16,
25,
1238,
11,
19,
11,
20,
11,
16,
4008,
198,
220,
1332,
62,
1136,
9630,
7,
64,
8,
198,
437,
628,
198,
31,
9288,
2617,
366,
23839,
40961,
19182,
900,
9630,
1,
2221,
198,
220,
257,
796,
4808,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
19,
11,
20,
11,
16,
4008,
198,
220,
1332,
62,
2617,
9630,
7,
64,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
57,
263,
375,
16198,
1,
2221,
198,
220,
257,
796,
4808,
40961,
19182,
7,
9107,
418,
7,
5317,
4008,
198,
220,
2488,
9288,
257,
21737,
6624,
657,
198,
220,
2488,
9288,
257,
58,
16,
60,
6624,
657,
198,
220,
257,
21737,
796,
642,
198,
220,
2488,
9288,
257,
21737,
6624,
642,
198,
220,
257,
58,
16,
60,
796,
718,
198,
220,
2488,
9288,
257,
21737,
6624,
718,
198,
437,
198,
198,
31,
9288,
2617,
366,
7680,
82,
1,
2221,
198,
220,
257,
796,
4808,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
19,
11,
20,
11,
16,
4008,
198,
220,
1332,
62,
1177,
7,
64,
8,
198,
437,
198,
198,
2,
383,
816,
64,
278,
5254,
691,
670,
329,
22300,
18189,
352,
13,
18,
198,
361,
44156,
2849,
18189,
410,
1,
16,
13,
18,
13,
15,
1,
198,
11748,
14370,
25,
1612,
198,
31,
9288,
2617,
366,
7738,
20847,
1,
2221,
198,
220,
257,
796,
1366,
4613,
4808,
40961,
19182,
7,
7890,
11,
354,
14125,
1096,
16193,
20,
11,
19,
11,
17,
4008,
198,
220,
1332,
62,
445,
20847,
7,
64,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
30507,
2701,
1,
2221,
198,
220,
257,
62,
39531,
16,
796,
4808,
40961,
19182,
7,
25192,
7,
940,
11,
24,
11,
17,
828,
22716,
1096,
16193,
20,
11,
18,
11,
17,
4008,
198,
220,
1332,
62,
36654,
2701,
7,
64,
62,
39531,
16,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
30507,
2701,
351,
4129,
352,
2457,
5391,
1,
2221,
198,
220,
257,
62,
39531,
16,
796,
4808,
40961,
19182,
7,
25192,
7,
940,
11,
24,
11,
16,
828,
22716,
1096,
16193,
20,
11,
18,
11,
16,
4008,
198,
220,
257,
62,
39531,
17,
796,
4808,
40961,
19182,
7,
25192,
7,
16,
25,
940,
11,
16,
11,
24,
828,
22716,
1096,
16193,
16,
11,
18,
4008,
198,
220,
264,
796,
257,
62,
39531,
16,
764,
10,
257,
62,
39531,
17,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
82,
8,
318,
64,
31664,
3163,
20477,
13,
41339,
1925,
14125,
90,
18,
92,
198,
220,
2488,
9288,
2546,
7,
33327,
7,
82,
4008,
6624,
357,
940,
11,
860,
11,
352,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
4965,
71,
1758,
1,
2221,
198,
220,
257,
796,
27179,
1758,
28264,
40961,
19182,
7,
3447,
1758,
7,
16,
25,
1238,
11,
19,
11,
20,
36911,
19,
11,
20,
11,
16,
8,
198,
220,
1332,
62,
1136,
9630,
7,
64,
8,
198,
220,
257,
796,
27179,
1758,
28264,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
19,
11,
20,
36911,
19,
11,
20,
11,
16,
8,
198,
220,
1332,
62,
2617,
9630,
7,
64,
8,
198,
220,
257,
796,
27179,
1758,
28264,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
19,
11,
20,
36911,
19,
11,
20,
11,
16,
8,
198,
220,
1332,
62,
1177,
7,
64,
8,
198,
220,
257,
796,
1366,
4613,
27179,
1758,
28264,
40961,
19182,
7,
7890,
11,
354,
14125,
1096,
16193,
20,
11,
19,
11,
17,
36911,
940,
11,
1238,
11,
17,
11,
16,
8,
198,
220,
1332,
62,
445,
20847,
7,
64,
8,
198,
220,
257,
796,
27179,
1758,
28264,
40961,
19182,
7,
3447,
1758,
7,
16,
25,
1238,
11,
19,
11,
20,
36911,
19,
11,
20,
11,
16,
8,
198,
220,
2488,
9288,
1874,
71,
5813,
40961,
19182,
7,
64,
13,
8000,
11,
257,
13,
14894,
27740,
11,
257,
13,
3605,
7857,
8,
24844,
257,
198,
437,
198,
198,
11748,
7308,
13,
5990,
76,
7241,
35,
12078,
3163,
20477,
13,
16340,
16321,
198,
31,
9288,
2617,
366,
5990,
76,
7241,
12078,
1,
2221,
198,
220,
279,
796,
357,
18,
11,
16,
11,
17,
8,
198,
220,
20966,
796,
800,
16321,
7,
79,
8,
198,
220,
257,
796,
9943,
7241,
12078,
28264,
40961,
19182,
7,
16321,
7241,
12078,
7,
3447,
1758,
7,
16,
25,
1238,
11,
19,
11,
20,
11,
16,
828,
541,
36911,
79,
8,
198,
220,
1332,
62,
1136,
9630,
7,
64,
8,
198,
220,
257,
796,
9943,
7241,
12078,
28264,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
20,
11,
16,
11,
19,
36911,
79,
8,
198,
220,
1332,
62,
2617,
9630,
7,
64,
8,
198,
220,
257,
796,
9943,
7241,
12078,
28264,
40961,
19182,
7,
9107,
418,
7,
5317,
11,
20,
11,
16,
11,
19,
36911,
79,
8,
198,
220,
1332,
62,
1177,
7,
64,
8,
198,
220,
257,
796,
1366,
4613,
9943,
7241,
12078,
28264,
40961,
19182,
7,
16321,
7241,
12078,
7,
7890,
11,
541,
828,
354,
14125,
1096,
16193,
19,
11,
17,
11,
20,
36911,
79,
8,
198,
220,
1332,
62,
445,
20847,
7,
64,
8,
198,
220,
257,
62,
39531,
16,
796,
9943,
7241,
12078,
28264,
40961,
19182,
7,
25192,
7,
24,
11,
17,
11,
940,
828,
22716,
1096,
16193,
18,
11,
17,
11,
20,
36911,
79,
8,
198,
220,
1332,
62,
36654,
2701,
7,
64,
62,
39531,
16,
8,
198,
220,
2488,
9288,
2448,
76,
7241,
40961,
19182,
7,
64,
62,
39531,
16,
13,
64,
8,
24844,
257,
62,
39531,
16,
198,
437,
198,
198,
31,
9288,
2617,
366,
3118,
354,
2954,
276,
10903,
26515,
1,
2221,
198,
220,
257,
796,
27179,
1758,
7,
16,
25,
33470,
11,
2167,
11,
12825,
8,
198,
220,
275,
796,
4731,
12195,
64,
8,
198,
220,
269,
796,
2824,
7,
38176,
90,
5317,
11,
43730,
5512,
64,
8,
628,
220,
31664,
3163,
20477,
13,
12286,
62,
354,
2954,
62,
7857,
21737,
796,
1802,
198,
220,
31664,
3163,
20477,
13,
7207,
1891,
62,
30854,
62,
7857,
21737,
796,
1802,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
64,
8,
6624,
357,
2167,
11,
12825,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
64,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
64,
11,
7,
2167,
11,
12825,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
65,
8,
6624,
357,
2167,
11,
12825,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
65,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
65,
11,
7,
2167,
11,
12825,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
66,
8,
6624,
357,
2167,
11,
12825,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
66,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
66,
11,
7,
2167,
11,
12825,
4008,
198,
220,
31664,
3163,
20477,
13,
12286,
62,
354,
2954,
62,
7857,
21737,
796,
352,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
64,
8,
6624,
357,
2167,
11,
26704,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
64,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
64,
11,
7,
2167,
11,
26704,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
65,
8,
6624,
357,
2167,
11,
1120,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
65,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
65,
11,
7,
2167,
11,
1120,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
66,
8,
6624,
357,
2167,
11,
26704,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
66,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
66,
11,
7,
2167,
11,
26704,
4008,
198,
220,
31664,
3163,
20477,
13,
7207,
1891,
62,
30854,
62,
7857,
21737,
796,
8576,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
64,
8,
6624,
357,
2167,
11,
26704,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
64,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
64,
11,
7,
2167,
11,
26704,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
65,
8,
6624,
357,
2167,
11,
20,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
65,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
65,
11,
7,
2167,
11,
20,
4008,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
395,
1920,
62,
354,
14125,
1096,
7,
66,
8,
6624,
357,
2167,
11,
26704,
8,
198,
220,
2488,
9288,
31664,
3163,
20477,
13,
27379,
354,
2954,
7,
66,
8,
6624,
31664,
3163,
20477,
13,
41339,
1925,
14125,
7,
66,
11,
7,
2167,
11,
26704,
4008,
198,
437,
198,
198,
437,
198
] | 2.221954 | 4,555 |
function reliability(t::Vector{Float64}, Φ::Matrix{Float64}, dists::Dict)
P = zeros(size(t))
for index in CartesianIndices(Φ)
p = ones(size(t))
for k = 1:length(size(Φ))
mk = size(Φ)[k] - 1
lk = index[k] - 1
Fk = dists[k]
p .*=
binomial(mk, lk) .* (cdf.(Fk, t) .^ (mk - lk)) .* ((1 .- cdf.(Fk, t)) .^ lk)
end
P .+= Φ[index] .* p
end
return P
end
function reliability(
t::Vector{Float64},
Φ::Matrix{Float64},
types::Dict{Int64,Array{Int64,1}},
failures::Matrix{Float64},
)
idx = map_failures_to_type(failures, types)
Φ_f = map_types_to_signature(idx, Φ, types)
sort!(failures, dims = 2)
P = zeros(size(t))
for (r_i, r) ∈ enumerate(eachrow(failures))
@inbounds P[t.<r[1]] .+= 1
for c_i ∈ 1:length(r)-1
if Φ_f[r_i, c_i] === 0.0
break
end
@inbounds P[r[c_i].<=t.<r[c_i+1]] .+= Φ_f[r_i, c_i]
end
if Φ_f[r_i, end] > 0.0
@inbounds P[t.>=r[end]] .+= Φ_f[r_i, end]
end
end
return P ./ size(failures, 1)
end
function map_failures_to_type(f, types::Dict{Int64,Array{Int64,1}})
type_map = Dict{Int64,Int64}()
for n ∈ vcat(values(types)...)
for (type, components) ∈ types
n ∈ components && (type_map[n] = type; break)
end
end
idx = zeros(size(f))
for i ∈ 1:size(f, 1)
@views idx[i, :] = map(x -> type_map[x], sortperm(f[i, :]))
end
return Int.(idx)
end
function map_types_to_signature(idx, Φ, types)
F = ones(Int64, size(idx, 1), size(idx, 2), length(types))
for (type, components) ∈ types
F[:, :, type] += length(components) .- cumsum(idx .== type, dims = 2)
end
Φ_f = zeros(size(idx))
for j = 1:size(F, 2)
for i = 1:size(F, 1)
Φ_f[i, j] = Φ[(F[i, j, :])...]
end
end
return Φ_f
end
| [
8818,
17843,
7,
83,
3712,
38469,
90,
43879,
2414,
5512,
7377,
99,
3712,
46912,
90,
43879,
2414,
5512,
288,
1023,
3712,
35,
713,
8,
198,
220,
220,
220,
350,
796,
1976,
27498,
7,
7857,
7,
83,
4008,
628,
220,
220,
220,
329,
6376,
287,
13690,
35610,
5497,
1063,
7,
138,
99,
8,
198,
220,
220,
220,
220,
220,
220,
220,
279,
796,
3392,
7,
7857,
7,
83,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
13664,
7,
7857,
7,
138,
99,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33480,
796,
2546,
7,
138,
99,
38381,
74,
60,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
74,
796,
6376,
58,
74,
60,
532,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
376,
74,
796,
288,
1023,
58,
74,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
764,
9,
28,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9874,
49070,
7,
28015,
11,
300,
74,
8,
764,
9,
357,
66,
7568,
12195,
37,
74,
11,
256,
8,
764,
61,
357,
28015,
532,
300,
74,
4008,
764,
9,
14808,
16,
764,
12,
269,
7568,
12195,
37,
74,
11,
256,
4008,
764,
61,
300,
74,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
350,
764,
47932,
7377,
99,
58,
9630,
60,
764,
9,
279,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
350,
198,
437,
198,
198,
8818,
17843,
7,
198,
220,
220,
220,
256,
3712,
38469,
90,
43879,
2414,
5512,
198,
220,
220,
220,
7377,
99,
3712,
46912,
90,
43879,
2414,
5512,
198,
220,
220,
220,
3858,
3712,
35,
713,
90,
5317,
2414,
11,
19182,
90,
5317,
2414,
11,
16,
92,
5512,
198,
220,
220,
220,
15536,
3712,
46912,
90,
43879,
2414,
5512,
198,
8,
198,
220,
220,
220,
4686,
87,
796,
3975,
62,
32165,
942,
62,
1462,
62,
4906,
7,
32165,
942,
11,
3858,
8,
628,
220,
220,
220,
7377,
99,
62,
69,
796,
3975,
62,
19199,
62,
1462,
62,
12683,
1300,
7,
312,
87,
11,
7377,
99,
11,
3858,
8,
628,
220,
220,
220,
3297,
0,
7,
32165,
942,
11,
5391,
82,
796,
362,
8,
628,
220,
220,
220,
350,
796,
1976,
27498,
7,
7857,
7,
83,
4008,
628,
220,
220,
220,
329,
357,
81,
62,
72,
11,
374,
8,
18872,
230,
27056,
378,
7,
27379,
808,
7,
32165,
942,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
350,
58,
83,
29847,
81,
58,
16,
11907,
764,
47932,
352,
198,
220,
220,
220,
220,
220,
220,
220,
329,
269,
62,
72,
18872,
230,
352,
25,
13664,
7,
81,
13219,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
7377,
99,
62,
69,
58,
81,
62,
72,
11,
269,
62,
72,
60,
24844,
657,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2270,
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,
350,
58,
81,
58,
66,
62,
72,
4083,
27,
28,
83,
29847,
81,
58,
66,
62,
72,
10,
16,
11907,
764,
47932,
7377,
99,
62,
69,
58,
81,
62,
72,
11,
269,
62,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
611,
7377,
99,
62,
69,
58,
81,
62,
72,
11,
886,
60,
1875,
657,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
350,
58,
83,
13,
29,
28,
81,
58,
437,
11907,
764,
47932,
7377,
99,
62,
69,
58,
81,
62,
72,
11,
886,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
350,
24457,
2546,
7,
32165,
942,
11,
352,
8,
198,
437,
198,
198,
8818,
3975,
62,
32165,
942,
62,
1462,
62,
4906,
7,
69,
11,
3858,
3712,
35,
713,
90,
5317,
2414,
11,
19182,
90,
5317,
2414,
11,
16,
11709,
8,
198,
220,
220,
220,
2099,
62,
8899,
796,
360,
713,
90,
5317,
2414,
11,
5317,
2414,
92,
3419,
628,
220,
220,
220,
329,
299,
18872,
230,
410,
9246,
7,
27160,
7,
19199,
8,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
329,
357,
4906,
11,
6805,
8,
18872,
230,
3858,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
18872,
230,
6805,
11405,
357,
4906,
62,
8899,
58,
77,
60,
796,
2099,
26,
2270,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
4686,
87,
796,
1976,
27498,
7,
7857,
7,
69,
4008,
628,
220,
220,
220,
329,
1312,
18872,
230,
352,
25,
7857,
7,
69,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
33571,
4686,
87,
58,
72,
11,
1058,
60,
796,
3975,
7,
87,
4613,
2099,
62,
8899,
58,
87,
4357,
3297,
16321,
7,
69,
58,
72,
11,
1058,
60,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
2558,
12195,
312,
87,
8,
198,
437,
198,
198,
8818,
3975,
62,
19199,
62,
1462,
62,
12683,
1300,
7,
312,
87,
11,
7377,
99,
11,
3858,
8,
198,
220,
220,
220,
376,
796,
3392,
7,
5317,
2414,
11,
2546,
7,
312,
87,
11,
352,
828,
2546,
7,
312,
87,
11,
362,
828,
4129,
7,
19199,
4008,
628,
220,
220,
220,
329,
357,
4906,
11,
6805,
8,
18872,
230,
3858,
198,
220,
220,
220,
220,
220,
220,
220,
376,
58,
45299,
1058,
11,
2099,
60,
15853,
4129,
7,
5589,
3906,
8,
764,
12,
269,
5700,
388,
7,
312,
87,
764,
855,
2099,
11,
5391,
82,
796,
362,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
7377,
99,
62,
69,
796,
1976,
27498,
7,
7857,
7,
312,
87,
4008,
628,
220,
220,
220,
329,
474,
796,
352,
25,
7857,
7,
37,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
796,
352,
25,
7857,
7,
37,
11,
352,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
99,
62,
69,
58,
72,
11,
474,
60,
796,
7377,
99,
58,
7,
37,
58,
72,
11,
474,
11,
1058,
12962,
22345,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
7377,
99,
62,
69,
198,
437,
198
] | 1.775382 | 1,113 |
# ============================================================
# Structs of Initial & Boundary Conditions
# ============================================================
"""
mutable struct IB{T} <: AbstractCondition
fw::Function
bc::T
end
Initial & boundary conditions with no distribution function
"""
mutable struct IB{T<:Union{Function,AbstractArray}} <: AbstractCondition
fw::Function
bc::T
end
function IB(fw, gas::Scalar)
γ = gas.a
bc = function (args...)
w = fw(args...)
return ifelse(γ == 0, conserve_prim(w), conserve_prim(w, γ))
end
return IB{typeof(bc)}(fw, bc)
end
function IB(fw, gas::AbstractGas)
bc = function (args...)
w = fw(args...)
prim = begin
if ndims(w) == 1
conserve_prim(w, gas.γ)
else
mixture_conserve_prim(w, gas.γ)
end
end
return prim
end
return IB{typeof(bc)}(fw, bc)
end
"""
mutable struct IB1F{T} <: AbstractCondition
fw::Function
ff::Function
bc::T
end
Initial & boundary condition with 1 distribution function
"""
mutable struct IB1F{T} <: AbstractCondition
fw::Function
ff::Function
bc::T
end
function IB1F(fw, vs::AbstractVelocitySpace, gas::AbstractProperty)
bc = function (args...)
w = fw(args...)
prim = begin
if ndims(w) == 1
conserve_prim(w, gas.γ)
else
mixture_conserve_prim(w, gas.γ)
end
end
return prim
end
ff = function (args...)
prim = bc(args...)
M = begin
if !isdefined(vs, :v)
if ndims(prim) == 1
maxwellian(vs.u, prim)
else
mixture_maxwellian(vs.u, prim)
end
elseif !isdefined(vs, :w)
if ndims(prim) == 1
maxwellian(vs.u, vs.v, prim)
else
mixture_maxwellian(vs.u, vs.v, prim)
end
else
if ndims(prim) == 1
maxwellian(vs.u, vs.v, vs.w, prim)
else
mixture_maxwellian(vs.u, vs.v, vs.w, prim)
end
end
end
return M
end
return IB1F{typeof(bc)}(fw, ff, bc)
end
"""
mutable struct IB2F{T} <: AbstractCondition
fw::Function
ff::Function
bc::T
end
Initial & boundary condition with 2 distribution functions
"""
mutable struct IB2F{T} <: AbstractCondition
fw::Function
ff::Function
bc::T
end
function IB2F(fw, vs::AbstractVelocitySpace, gas::AbstractProperty)
bc = function (args...)
w = fw(args...)
prim = begin
if ndims(w) == 1
conserve_prim(w, gas.γ)
else
mixture_conserve_prim(w, gas.γ)
end
end
return prim
end
ff = function (args...)
prim = bc(args...)
if !isdefined(vs, :v)
if ndims(prim) == 1
H = maxwellian(vs.u, prim)
B = H .* gas.K / 2 / prim[end]
else
H = mixture_maxwellian(vs.u, prim)
B = zero(H)
for j in axes(B, 2)
B[:, j] = H[:, j] * gas.K / (2.0 * prim[end, j])
end
end
elseif !isdefined(vs, :w)
if ndims(prim) == 1
H = maxwellian(vs.u, vs.v, prim)
B = H .* gas.K / 2 / prim[end]
else
H = mixture_maxwellian(vs.u, vs.v, prim)
B = zero(H)
for j in axes(B, 3)
B[:, :, j] = H[:, :, j] * gas.K / (2.0 * prim[end, j])
end
end
else
if ndims(prim) == 1
H = maxwellian(vs.u, vs.v, vs.w, prim)
B = H .* gas.K / 2 / prim[end]
else
H = mixture_maxwellian(vs.u, vs.v, vs.w, prim)
B = zero(H)
for j in axes(B, 4)
B[:, :, :, j] = H[:, :, :, j] * gas.K / (2.0 * prim[end, j])
end
end
end
return H, B
end
return IB2F{typeof(bc)}(fw, ff, bc)
end
"""
mutable struct IB3F{T} <: AbstractCondition
fw::Function
ff::Function
fE::Function
fB::Function
fL::Function
bc::T
end
Initial & boundary condition with 3 distribution functions
"""
mutable struct IB3F{T} <: AbstractCondition
fw::Function
ff::Function
fE::Function
fB::Function
fL::Function
bc::T
end
"""
mutable struct IB4F{T} <: AbstractCondition
fw::Function
ff::Function
fE::Function
fB::Function
fL::Function
bc::T
end
Initial & boundary condition with 4 distribution functions
"""
mutable struct IB4F{T} <: AbstractCondition
fw::Function
ff::Function
fE::Function
fB::Function
fL::Function
bc::T
end
| [
2,
46111,
4770,
2559,
18604,
198,
2,
32112,
82,
286,
20768,
1222,
30149,
560,
27617,
198,
2,
46111,
4770,
2559,
18604,
198,
198,
37811,
198,
220,
220,
220,
4517,
540,
2878,
34782,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
220,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
47125,
3712,
51,
198,
220,
220,
220,
886,
198,
198,
24243,
1222,
18645,
3403,
351,
645,
6082,
2163,
198,
198,
37811,
198,
76,
18187,
2878,
34782,
90,
51,
27,
25,
38176,
90,
22203,
11,
23839,
19182,
11709,
1279,
25,
27741,
48362,
198,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
47125,
3712,
51,
198,
437,
198,
198,
8818,
34782,
7,
44482,
11,
3623,
3712,
3351,
282,
283,
8,
198,
220,
220,
220,
7377,
111,
796,
3623,
13,
64,
628,
220,
220,
220,
47125,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
277,
86,
7,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
611,
17772,
7,
42063,
6624,
657,
11,
45075,
62,
19795,
7,
86,
828,
45075,
62,
19795,
7,
86,
11,
7377,
111,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
34782,
90,
4906,
1659,
7,
15630,
38165,
7,
44482,
11,
47125,
8,
198,
437,
198,
198,
8818,
34782,
7,
44482,
11,
3623,
3712,
23839,
39699,
8,
198,
220,
220,
220,
47125,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
277,
86,
7,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
2684,
796,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
86,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45075,
62,
19795,
7,
86,
11,
3623,
13,
42063,
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,
11710,
62,
5936,
3760,
62,
19795,
7,
86,
11,
3623,
13,
42063,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2684,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
34782,
90,
4906,
1659,
7,
15630,
38165,
7,
44482,
11,
47125,
8,
198,
437,
628,
198,
37811,
198,
220,
220,
220,
4517,
540,
2878,
34782,
16,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
220,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
47125,
3712,
51,
198,
220,
220,
220,
886,
198,
198,
24243,
1222,
18645,
4006,
351,
352,
6082,
2163,
198,
198,
37811,
198,
76,
18187,
2878,
34782,
16,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
47125,
3712,
51,
198,
437,
198,
198,
8818,
34782,
16,
37,
7,
44482,
11,
3691,
3712,
23839,
46261,
11683,
14106,
11,
3623,
3712,
23839,
21746,
8,
198,
220,
220,
220,
47125,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
277,
86,
7,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
2684,
796,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
86,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45075,
62,
19795,
7,
86,
11,
3623,
13,
42063,
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,
11710,
62,
5936,
3760,
62,
19795,
7,
86,
11,
3623,
13,
42063,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2684,
198,
220,
220,
220,
886,
628,
220,
220,
220,
31246,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
2684,
796,
47125,
7,
22046,
23029,
628,
220,
220,
220,
220,
220,
220,
220,
337,
796,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
271,
23211,
7,
14259,
11,
1058,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
4053,
666,
7,
14259,
13,
84,
11,
2684,
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,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
2684,
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,
2073,
361,
5145,
271,
23211,
7,
14259,
11,
1058,
86,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
4053,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
2684,
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,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
2684,
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,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
4053,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
3691,
13,
86,
11,
2684,
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,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
3691,
13,
86,
11,
2684,
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,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
337,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
34782,
16,
37,
90,
4906,
1659,
7,
15630,
38165,
7,
44482,
11,
31246,
11,
47125,
8,
198,
437,
628,
198,
37811,
198,
220,
220,
220,
4517,
540,
2878,
34782,
17,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
220,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
47125,
3712,
51,
198,
220,
220,
220,
886,
198,
198,
24243,
1222,
18645,
4006,
351,
362,
6082,
5499,
198,
198,
37811,
198,
76,
18187,
2878,
34782,
17,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
47125,
3712,
51,
198,
437,
198,
198,
8818,
34782,
17,
37,
7,
44482,
11,
3691,
3712,
23839,
46261,
11683,
14106,
11,
3623,
3712,
23839,
21746,
8,
198,
220,
220,
220,
47125,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
266,
796,
277,
86,
7,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
2684,
796,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
86,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
45075,
62,
19795,
7,
86,
11,
3623,
13,
42063,
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,
11710,
62,
5936,
3760,
62,
19795,
7,
86,
11,
3623,
13,
42063,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
2684,
198,
220,
220,
220,
886,
628,
220,
220,
220,
31246,
796,
2163,
357,
22046,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
2684,
796,
47125,
7,
22046,
23029,
628,
220,
220,
220,
220,
220,
220,
220,
611,
5145,
271,
23211,
7,
14259,
11,
1058,
85,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
367,
796,
3509,
4053,
666,
7,
14259,
13,
84,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
367,
764,
9,
3623,
13,
42,
1220,
362,
1220,
2684,
58,
437,
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,
367,
796,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
6632,
7,
39,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
34197,
7,
33,
11,
362,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
58,
45299,
474,
60,
796,
367,
58,
45299,
474,
60,
1635,
3623,
13,
42,
1220,
357,
17,
13,
15,
1635,
2684,
58,
437,
11,
474,
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,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
5145,
271,
23211,
7,
14259,
11,
1058,
86,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
367,
796,
3509,
4053,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
367,
764,
9,
3623,
13,
42,
1220,
362,
1220,
2684,
58,
437,
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,
367,
796,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
6632,
7,
39,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
34197,
7,
33,
11,
513,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
58,
45299,
1058,
11,
474,
60,
796,
367,
58,
45299,
1058,
11,
474,
60,
1635,
3623,
13,
42,
1220,
357,
17,
13,
15,
1635,
2684,
58,
437,
11,
474,
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,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
299,
67,
12078,
7,
19795,
8,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
367,
796,
3509,
4053,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
3691,
13,
86,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
367,
764,
9,
3623,
13,
42,
1220,
362,
1220,
2684,
58,
437,
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,
367,
796,
11710,
62,
29047,
666,
7,
14259,
13,
84,
11,
3691,
13,
85,
11,
3691,
13,
86,
11,
2684,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
796,
6632,
7,
39,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
474,
287,
34197,
7,
33,
11,
604,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
347,
58,
45299,
1058,
11,
1058,
11,
474,
60,
796,
367,
58,
45299,
1058,
11,
1058,
11,
474,
60,
1635,
3623,
13,
42,
1220,
357,
17,
13,
15,
1635,
2684,
58,
437,
11,
474,
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,
886,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1441,
367,
11,
347,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
34782,
17,
37,
90,
4906,
1659,
7,
15630,
38165,
7,
44482,
11,
31246,
11,
47125,
8,
198,
437,
628,
198,
37811,
198,
220,
220,
220,
4517,
540,
2878,
34782,
18,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
220,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
36,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
33,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
43,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
47125,
3712,
51,
198,
220,
220,
220,
886,
198,
198,
24243,
1222,
18645,
4006,
351,
513,
6082,
5499,
198,
198,
37811,
198,
76,
18187,
2878,
34782,
18,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
277,
36,
3712,
22203,
198,
220,
220,
220,
277,
33,
3712,
22203,
198,
220,
220,
220,
277,
43,
3712,
22203,
198,
220,
220,
220,
47125,
3712,
51,
198,
437,
628,
198,
37811,
198,
220,
220,
220,
4517,
540,
2878,
34782,
19,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
220,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
36,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
33,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
277,
43,
3712,
22203,
198,
220,
220,
220,
220,
220,
220,
220,
47125,
3712,
51,
198,
220,
220,
220,
886,
198,
198,
24243,
1222,
18645,
4006,
351,
604,
6082,
5499,
198,
198,
37811,
198,
76,
18187,
2878,
34782,
19,
37,
90,
51,
92,
1279,
25,
27741,
48362,
198,
220,
220,
220,
277,
86,
3712,
22203,
198,
220,
220,
220,
31246,
3712,
22203,
198,
220,
220,
220,
277,
36,
3712,
22203,
198,
220,
220,
220,
277,
33,
3712,
22203,
198,
220,
220,
220,
277,
43,
3712,
22203,
198,
220,
220,
220,
47125,
3712,
51,
198,
437,
198
] | 1.855596 | 2,770 |
using Test
using PolynomialBasis
using ImplicitDomainQuadrature
using CartesianMesh
# using Revise
using HDGElasticity
function allapprox(v1,v2)
return all(v1 .≈ v2)
end
function allequal(v1,v2)
return all(v1 .== v2)
end
function allapprox(v1,v2,atol)
@assert length(v1) == length(v2)
return all([isapprox(v1[i],v2[i],atol=atol) for i = 1:length(v1)])
end
function plane_distance_function(coords,n,x0)
return [n'*(coords[:,idx]-x0) for idx in 1:size(coords)[2]]
end
facequads = [[1,2],[],[1,2,3],[]]
solverid = HDGElasticity.face_to_solverid(facequads)
@test allequal(solverid,[1,0,2,0])
vbasis = TensorProductBasis(2,1)
mesh = UniformMesh([0.,0.],[1.,1.],[2,1])
coords = HDGElasticity.nodal_coordinates(mesh,vbasis)
NF = HDGElasticity.number_of_basis_functions(vbasis)
coeffs = reshape(plane_distance_function(coords,[1.,0.],[0.4,0.]),NF,:)
poly = InterpolatingPolynomial(1,vbasis)
dgmesh = HDGElasticity.DGMesh(mesh,coeffs,poly)
ufs = HDGElasticity.UniformFunctionSpace(dgmesh,1,4,coeffs,poly)
l1,m1 = (1.,2.)
l2,m2 = (2.,3.)
D1 = sqrt(HDGElasticity.plane_strain_voigt_hooke_matrix_2d(l1,m1))
D2 = sqrt(HDGElasticity.plane_strain_voigt_hooke_matrix_2d(l2,m2))
stabilization = 1.0
cellmap = HDGElasticity.CellMap(dgmesh.domain[1])
solveridx = HDGElasticity.cell_to_solver_index(dgmesh.cellsign)
testsolveridx = [3 1
4 0]
@test allequal(solveridx,testsolveridx)
cellsolvers = HDGElasticity.CellSolvers(dgmesh,ufs,D1,D2,stabilization)
@test length(cellsolvers.localsolvers) == 4
@test allapprox(cellsolvers.stiffness[1],D1)
@test allapprox(cellsolvers.stiffness[2],D2)
@test cellsolvers.stabilization ≈ stabilization
update!(ufs.imap,ufs.icoeffs[1,1])
LL1 = HDGElasticity.local_operator(ufs.vbasis,ufs.vquads[1,1],ufs.fquads[1,1],
dgmesh.facemaps,ufs.iquad,ufs.imap,-ufs.inormals[1],D1,stabilization,cellmap)
fLH1 = HDGElasticity.local_hybrid_operator(ufs.vbasis,ufs.sbasis,ufs.fquads[1,1],
dgmesh.facemaps,ufs.fnormals,D1,stabilization,cellmap)
iLH1 = HDGElasticity.local_hybrid_operator_on_interface(ufs.vbasis,ufs.sbasis,
ufs.iquad,ufs.imap,-ufs.inormals[1],D1,stabilization,cellmap)
LH1 = [hcat(fLH1...) iLH1]
@test allapprox(cellsolvers[1,1].LL,LL1)
@test allapprox(cellsolvers[1,1].LH,LH1)
@test allequal(cellsolvers[1,1].facetosolverid,[1,2,3,0,4])
LL2 = HDGElasticity.local_operator(ufs.vbasis,ufs.vquads[2,1],ufs.fquads[2,1],
dgmesh.facemaps,ufs.iquad,ufs.imap,ufs.inormals[1],D2,stabilization,cellmap)
fLH2 = HDGElasticity.local_hybrid_operator(ufs.vbasis,ufs.sbasis,ufs.fquads[2,1],
dgmesh.facemaps,ufs.fnormals,D2,stabilization,cellmap)
iLH2 = HDGElasticity.local_hybrid_operator_on_interface(ufs.vbasis,ufs.sbasis,
ufs.iquad,ufs.imap,ufs.inormals[1],D2,stabilization,cellmap)
LH2 = [hcat(fLH2...) iLH2]
@test allapprox(cellsolvers[2,1].LL,LL2)
@test allapprox(cellsolvers[2,1].LH,LH2)
@test allapprox(cellsolvers[2,1].facetosolverid,[1,0,2,3,4])
uLL1 = HDGElasticity.local_operator(ufs.vbasis,ufs.vtpq,ufs.ftpq,
dgmesh.facemaps,D1,stabilization,cellmap)
ufLH1 = HDGElasticity.local_hybrid_operator(ufs.vbasis,ufs.sbasis,ufs.ftpq,
dgmesh.facemaps,ufs.fnormals,D1,stabilization,cellmap)
uLH1 = hcat(ufLH1...)
@test allapprox(cellsolvers.localsolvers[1].LL,uLL1)
@test allapprox(cellsolvers.localsolvers[1].LH,uLH1)
@test allequal(cellsolvers.localsolvers[1].facetosolverid,[1,2,3,4])
uLL2 = HDGElasticity.local_operator(ufs.vbasis,ufs.vtpq,ufs.ftpq,
dgmesh.facemaps,D2,stabilization,cellmap)
ufLH2 = HDGElasticity.local_hybrid_operator(ufs.vbasis,ufs.sbasis,ufs.ftpq,
dgmesh.facemaps,ufs.fnormals,D2,stabilization,cellmap)
uLH2 = hcat(ufLH2...)
@test allapprox(cellsolvers.localsolvers[2].LL,uLL2)
@test allapprox(cellsolvers.localsolvers[2].LH,uLH2)
@test allequal(cellsolvers.localsolvers[2].facetosolverid,[1,2,3,4])
| [
3500,
6208,
198,
3500,
12280,
26601,
498,
15522,
271,
198,
3500,
34347,
3628,
43961,
4507,
41909,
1300,
198,
3500,
13690,
35610,
37031,
198,
2,
1262,
5416,
786,
198,
3500,
5572,
8264,
75,
3477,
414,
198,
198,
8818,
477,
1324,
13907,
7,
85,
16,
11,
85,
17,
8,
198,
220,
220,
220,
1441,
477,
7,
85,
16,
764,
35705,
230,
410,
17,
8,
198,
437,
198,
198,
8818,
28654,
13255,
7,
85,
16,
11,
85,
17,
8,
198,
220,
220,
220,
1441,
477,
7,
85,
16,
764,
855,
410,
17,
8,
198,
437,
198,
198,
8818,
477,
1324,
13907,
7,
85,
16,
11,
85,
17,
11,
265,
349,
8,
198,
220,
220,
220,
2488,
30493,
4129,
7,
85,
16,
8,
6624,
4129,
7,
85,
17,
8,
198,
220,
220,
220,
1441,
477,
26933,
271,
1324,
13907,
7,
85,
16,
58,
72,
4357,
85,
17,
58,
72,
4357,
265,
349,
28,
265,
349,
8,
329,
1312,
796,
352,
25,
13664,
7,
85,
16,
8,
12962,
198,
437,
198,
198,
8818,
6614,
62,
30246,
62,
8818,
7,
1073,
3669,
11,
77,
11,
87,
15,
8,
198,
220,
220,
220,
1441,
685,
77,
6,
9,
7,
1073,
3669,
58,
45299,
312,
87,
45297,
87,
15,
8,
329,
4686,
87,
287,
352,
25,
7857,
7,
1073,
3669,
38381,
17,
11907,
198,
437,
198,
198,
2550,
421,
5643,
796,
16410,
16,
11,
17,
38430,
38430,
16,
11,
17,
11,
18,
38430,
11907,
198,
82,
14375,
312,
796,
5572,
8264,
75,
3477,
414,
13,
2550,
62,
1462,
62,
82,
14375,
312,
7,
2550,
421,
5643,
8,
198,
31,
9288,
28654,
13255,
7,
82,
14375,
312,
17414,
16,
11,
15,
11,
17,
11,
15,
12962,
198,
198,
85,
12093,
271,
796,
309,
22854,
15667,
15522,
271,
7,
17,
11,
16,
8,
198,
76,
5069,
796,
35712,
37031,
26933,
15,
1539,
15,
13,
38430,
16,
1539,
16,
13,
38430,
17,
11,
16,
12962,
198,
1073,
3669,
796,
5572,
8264,
75,
3477,
414,
13,
77,
375,
282,
62,
37652,
17540,
7,
76,
5069,
11,
85,
12093,
271,
8,
198,
21870,
796,
5572,
8264,
75,
3477,
414,
13,
17618,
62,
1659,
62,
12093,
271,
62,
12543,
2733,
7,
85,
12093,
271,
8,
198,
1073,
14822,
82,
796,
27179,
1758,
7,
14382,
62,
30246,
62,
8818,
7,
1073,
3669,
17414,
16,
1539,
15,
13,
38430,
15,
13,
19,
11,
15,
8183,
828,
21870,
11,
25,
8,
198,
35428,
796,
4225,
16104,
803,
34220,
26601,
498,
7,
16,
11,
85,
12093,
271,
8,
198,
198,
67,
39870,
5069,
796,
5572,
8264,
75,
3477,
414,
13,
35,
15548,
5069,
7,
76,
5069,
11,
1073,
14822,
82,
11,
35428,
8,
198,
3046,
82,
796,
5572,
8264,
75,
3477,
414,
13,
3118,
6933,
22203,
14106,
7,
67,
39870,
5069,
11,
16,
11,
19,
11,
1073,
14822,
82,
11,
35428,
8,
198,
198,
75,
16,
11,
76,
16,
796,
357,
16,
1539,
17,
2014,
198,
75,
17,
11,
76,
17,
796,
357,
17,
1539,
18,
2014,
198,
35,
16,
796,
19862,
17034,
7,
10227,
8264,
75,
3477,
414,
13,
14382,
62,
2536,
391,
62,
13038,
328,
83,
62,
8873,
2088,
62,
6759,
8609,
62,
17,
67,
7,
75,
16,
11,
76,
16,
4008,
198,
35,
17,
796,
19862,
17034,
7,
10227,
8264,
75,
3477,
414,
13,
14382,
62,
2536,
391,
62,
13038,
328,
83,
62,
8873,
2088,
62,
6759,
8609,
62,
17,
67,
7,
75,
17,
11,
76,
17,
4008,
198,
301,
14991,
1634,
796,
352,
13,
15,
198,
3846,
8899,
796,
5572,
8264,
75,
3477,
414,
13,
28780,
13912,
7,
67,
39870,
5069,
13,
27830,
58,
16,
12962,
198,
198,
82,
14375,
312,
87,
796,
5572,
8264,
75,
3477,
414,
13,
3846,
62,
1462,
62,
82,
14375,
62,
9630,
7,
67,
39870,
5069,
13,
3846,
12683,
8,
198,
41989,
14375,
312,
87,
796,
685,
18,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
604,
657,
60,
198,
31,
9288,
28654,
13255,
7,
82,
14375,
312,
87,
11,
41989,
14375,
312,
87,
8,
198,
198,
3846,
34453,
690,
796,
5572,
8264,
75,
3477,
414,
13,
28780,
36949,
690,
7,
67,
39870,
5069,
11,
3046,
82,
11,
35,
16,
11,
35,
17,
11,
301,
14991,
1634,
8,
198,
31,
9288,
4129,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
8,
6624,
604,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
301,
733,
1108,
58,
16,
4357,
35,
16,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
301,
733,
1108,
58,
17,
4357,
35,
17,
8,
198,
31,
9288,
4778,
349,
690,
13,
301,
14991,
1634,
15139,
230,
43200,
198,
198,
19119,
0,
7,
3046,
82,
13,
320,
499,
11,
3046,
82,
13,
291,
2577,
487,
82,
58,
16,
11,
16,
12962,
198,
3069,
16,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
85,
421,
5643,
58,
16,
11,
16,
4357,
3046,
82,
13,
69,
421,
5643,
58,
16,
11,
16,
4357,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
1557,
324,
11,
3046,
82,
13,
320,
499,
12095,
3046,
82,
13,
259,
579,
874,
58,
16,
4357,
35,
16,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
69,
43,
39,
16,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
3046,
82,
13,
69,
421,
5643,
58,
16,
11,
16,
4357,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
22184,
579,
874,
11,
35,
16,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
72,
43,
39,
16,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
62,
261,
62,
39994,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
198,
220,
220,
220,
334,
9501,
13,
1557,
324,
11,
3046,
82,
13,
320,
499,
12095,
3046,
82,
13,
259,
579,
874,
58,
16,
4357,
35,
16,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
43,
39,
16,
796,
685,
71,
9246,
7,
69,
43,
39,
16,
23029,
1312,
43,
39,
16,
60,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
58,
16,
11,
16,
4083,
3069,
11,
3069,
16,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
58,
16,
11,
16,
4083,
43,
39,
11,
43,
39,
16,
8,
198,
31,
9288,
28654,
13255,
7,
3846,
34453,
690,
58,
16,
11,
16,
4083,
69,
23253,
418,
14375,
312,
17414,
16,
11,
17,
11,
18,
11,
15,
11,
19,
12962,
198,
198,
3069,
17,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
85,
421,
5643,
58,
17,
11,
16,
4357,
3046,
82,
13,
69,
421,
5643,
58,
17,
11,
16,
4357,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
1557,
324,
11,
3046,
82,
13,
320,
499,
11,
3046,
82,
13,
259,
579,
874,
58,
16,
4357,
35,
17,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
69,
43,
39,
17,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
3046,
82,
13,
69,
421,
5643,
58,
17,
11,
16,
4357,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
22184,
579,
874,
11,
35,
17,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
72,
43,
39,
17,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
62,
261,
62,
39994,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
198,
220,
220,
220,
334,
9501,
13,
1557,
324,
11,
3046,
82,
13,
320,
499,
11,
3046,
82,
13,
259,
579,
874,
58,
16,
4357,
35,
17,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
43,
39,
17,
796,
685,
71,
9246,
7,
69,
43,
39,
17,
23029,
1312,
43,
39,
17,
60,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
58,
17,
11,
16,
4083,
3069,
11,
3069,
17,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
58,
17,
11,
16,
4083,
43,
39,
11,
43,
39,
17,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
58,
17,
11,
16,
4083,
69,
23253,
418,
14375,
312,
17414,
16,
11,
15,
11,
17,
11,
18,
11,
19,
12962,
198,
198,
84,
3069,
16,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
85,
34788,
80,
11,
3046,
82,
13,
701,
79,
80,
11,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
35,
16,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
3046,
43,
39,
16,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
3046,
82,
13,
701,
79,
80,
11,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
22184,
579,
874,
11,
35,
16,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
84,
43,
39,
16,
796,
289,
9246,
7,
3046,
43,
39,
16,
23029,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
16,
4083,
3069,
11,
84,
3069,
16,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
16,
4083,
43,
39,
11,
84,
43,
39,
16,
8,
198,
31,
9288,
28654,
13255,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
16,
4083,
69,
23253,
418,
14375,
312,
17414,
16,
11,
17,
11,
18,
11,
19,
12962,
198,
198,
84,
3069,
17,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
85,
34788,
80,
11,
3046,
82,
13,
701,
79,
80,
11,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
35,
17,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
3046,
43,
39,
17,
796,
5572,
8264,
75,
3477,
414,
13,
12001,
62,
12114,
10236,
62,
46616,
7,
3046,
82,
13,
85,
12093,
271,
11,
3046,
82,
13,
82,
12093,
271,
11,
3046,
82,
13,
701,
79,
80,
11,
198,
220,
220,
220,
288,
39870,
5069,
13,
38942,
368,
1686,
11,
3046,
82,
13,
22184,
579,
874,
11,
35,
17,
11,
301,
14991,
1634,
11,
3846,
8899,
8,
198,
84,
43,
39,
17,
796,
289,
9246,
7,
3046,
43,
39,
17,
23029,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
17,
4083,
3069,
11,
84,
3069,
17,
8,
198,
31,
9288,
477,
1324,
13907,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
17,
4083,
43,
39,
11,
84,
43,
39,
17,
8,
198,
31,
9288,
28654,
13255,
7,
3846,
34453,
690,
13,
17946,
874,
349,
690,
58,
17,
4083,
69,
23253,
418,
14375,
312,
17414,
16,
11,
17,
11,
18,
11,
19,
12962,
198
] | 2.028132 | 1,884 |
using Printf
"""
Represents the time of day.
fields: hour, minute, second
"""
struct MyTime
hour
minute
second
end
# Exercise 16-1
function printtime(t::MyTime)
@printf("%02d:%02d:%02d", t.hour, t.minute, t.second)
end
t = MyTime(23, 10, 58)
# printtime(t)
# Exercise 16-2
function isafter(t1::MyTime, t2::MyTime)
return (t1.hour, t1.minute, t1.second) > (t2.hour, t2.minute, t2.second)
end
# Exercise 16-3
function increment!(time, seconds)
time.second += seconds
dmin, time.second = divrem(time.second, 60)
time.minute += dmin
dhour, time.minute = divrem(time.minute, 60)
time.hour += dhour
time.hour %= 24
nothing
end
# Exercise 16-4
function increment(time, seconds)
nsecond = time.second + seconds
dmin, nsecond = divrem(nsecond, 60)
nminute = time.minute + dmin
dhour, nminute = divrem(nminute, 60)
nhour = time.hour + dhour
nhour %= 24
return MyTime(nhour, nminute, nsecond)
end
# Exercise 16-5
function timetoint(time)
minutes = time.hour * 60 + time.minute
seconds = minutes * 60 + time.second
end
function inttotime(seconds)
(minutes, second) = divrem(seconds, 60)
hour, minute = divrem(minutes, 60)
MyTime(hour, minute, second)
end
function increment(time, seconds)
return inttotime(timetoint(time) + seconds)
end
# Exercise 16-6
function multime(time::MyTime, x::Number)
return inttotime(timetoint(time) * x)
end
# println(multime(t, 3))
function timepermile(time::MyTime, dist::Number)
return multime(time, 1/dist)
end
# println(timepermile(t, 3))
# Exercise 16-7
using Dates
td = today()
println(td)
println(dayofweek(td))
println(dayname(td))
function age(bday)
td = today()
td - bday
dyear = year(td) - year(bday)
dmonth = month(td) - month(bday)
dday = day(td) - day(bday)
if dmonth < 0
dyear -= 1
elseif dmonth == 0 && dday < 0
dyear -= 1
end
println("Age: $dyear")
next_bday = bday + Year(dyear + 1)
println("Next birthday: $next_bday")
nextdiff = DateTime(next_bday) - now()
timeleft = canonicalize(Dates.CompoundPeriod(nextdiff))
println("Time to next birthday: $timeleft")
end
# age(Date(1995, 11, 02))
function doubleday(d1, d2)
@assert(d2 > d1, "d2 should be later than d1")
return d2 - d1 + d2
end
d1 = Date(2000, 1, 2)
d2 = Date(2005, 6, 24)
# println(doubleday(d1, d2))
function n_day(d1, d2, n)
@assert(d2 > d1, "d2 should be later than d1")
diff = d2 - d1
age1, age2 = diff.value, 0
while age2 * n != age1
if age2 * n > age1
error("Impossible combination of inputs")
end
age1 += 1
age2 += 1
end
return d1 + Day(age1)
end
# println(n_day(d1, d2, 2))
# println(n_day(d1, d2, 3))
# println(n_day(d1, d2, 6)) | [
3500,
12578,
69,
198,
198,
37811,
198,
6207,
6629,
262,
640,
286,
1110,
13,
198,
198,
25747,
25,
1711,
11,
5664,
11,
1218,
198,
37811,
198,
7249,
2011,
7575,
198,
220,
220,
220,
1711,
198,
220,
220,
220,
5664,
198,
220,
220,
220,
1218,
198,
437,
198,
198,
2,
32900,
1467,
12,
16,
198,
8818,
3601,
2435,
7,
83,
3712,
3666,
7575,
8,
198,
220,
220,
220,
2488,
37435,
7203,
4,
2999,
67,
25,
4,
2999,
67,
25,
4,
2999,
67,
1600,
256,
13,
9769,
11,
256,
13,
11374,
11,
256,
13,
12227,
8,
198,
437,
198,
198,
83,
796,
2011,
7575,
7,
1954,
11,
838,
11,
7618,
8,
198,
2,
3601,
2435,
7,
83,
8,
198,
198,
2,
32900,
1467,
12,
17,
198,
8818,
318,
8499,
7,
83,
16,
3712,
3666,
7575,
11,
256,
17,
3712,
3666,
7575,
8,
198,
220,
220,
220,
1441,
357,
83,
16,
13,
9769,
11,
256,
16,
13,
11374,
11,
256,
16,
13,
12227,
8,
1875,
357,
83,
17,
13,
9769,
11,
256,
17,
13,
11374,
11,
256,
17,
13,
12227,
8,
220,
198,
437,
198,
198,
2,
32900,
1467,
12,
18,
198,
8818,
18703,
0,
7,
2435,
11,
4201,
8,
198,
220,
220,
220,
640,
13,
12227,
15853,
4201,
198,
220,
220,
220,
288,
1084,
11,
640,
13,
12227,
796,
2659,
2787,
7,
2435,
13,
12227,
11,
3126,
8,
198,
220,
220,
220,
640,
13,
11374,
15853,
288,
1084,
198,
220,
220,
220,
288,
9769,
11,
640,
13,
11374,
796,
2659,
2787,
7,
2435,
13,
11374,
11,
3126,
8,
198,
220,
220,
220,
640,
13,
9769,
15853,
288,
9769,
198,
220,
220,
220,
640,
13,
9769,
4064,
28,
1987,
198,
220,
220,
220,
2147,
198,
437,
198,
198,
2,
32900,
1467,
12,
19,
198,
8818,
18703,
7,
2435,
11,
4201,
8,
198,
220,
220,
220,
299,
12227,
796,
640,
13,
12227,
1343,
4201,
198,
220,
220,
220,
288,
1084,
11,
299,
12227,
796,
2659,
2787,
7,
77,
12227,
11,
3126,
8,
198,
220,
220,
220,
299,
11374,
796,
640,
13,
11374,
1343,
288,
1084,
198,
220,
220,
220,
288,
9769,
11,
299,
11374,
796,
2659,
2787,
7,
77,
11374,
11,
3126,
8,
198,
220,
220,
220,
299,
9769,
796,
640,
13,
9769,
1343,
288,
9769,
198,
220,
220,
220,
299,
9769,
4064,
28,
1987,
198,
220,
220,
220,
1441,
2011,
7575,
7,
77,
9769,
11,
299,
11374,
11,
299,
12227,
8,
198,
437,
198,
198,
2,
32900,
1467,
12,
20,
198,
8818,
35732,
1563,
7,
2435,
8,
198,
220,
220,
220,
2431,
796,
640,
13,
9769,
1635,
3126,
1343,
640,
13,
11374,
198,
220,
220,
220,
4201,
796,
2431,
1635,
3126,
1343,
640,
13,
12227,
198,
437,
198,
198,
8818,
493,
83,
313,
524,
7,
43012,
8,
198,
220,
220,
220,
357,
1084,
1769,
11,
1218,
8,
796,
2659,
2787,
7,
43012,
11,
3126,
8,
198,
220,
220,
220,
1711,
11,
5664,
796,
2659,
2787,
7,
1084,
1769,
11,
3126,
8,
198,
220,
220,
220,
2011,
7575,
7,
9769,
11,
5664,
11,
1218,
8,
198,
437,
198,
198,
8818,
18703,
7,
2435,
11,
4201,
8,
198,
220,
220,
220,
1441,
493,
83,
313,
524,
7,
16514,
316,
1563,
7,
2435,
8,
1343,
4201,
8,
198,
437,
198,
198,
2,
32900,
1467,
12,
21,
198,
8818,
1963,
524,
7,
2435,
3712,
3666,
7575,
11,
2124,
3712,
15057,
8,
198,
220,
220,
220,
1441,
493,
83,
313,
524,
7,
16514,
316,
1563,
7,
2435,
8,
1635,
2124,
8,
198,
437,
198,
198,
2,
44872,
7,
16680,
524,
7,
83,
11,
513,
4008,
198,
198,
8818,
640,
16321,
576,
7,
2435,
3712,
3666,
7575,
11,
1233,
3712,
15057,
8,
198,
220,
220,
220,
1441,
1963,
524,
7,
2435,
11,
352,
14,
17080,
8,
198,
437,
198,
198,
2,
44872,
7,
2435,
16321,
576,
7,
83,
11,
513,
4008,
198,
198,
2,
32900,
1467,
12,
22,
198,
3500,
44712,
198,
198,
8671,
796,
1909,
3419,
198,
35235,
7,
8671,
8,
198,
35235,
7,
820,
1659,
10464,
7,
8671,
4008,
198,
35235,
7,
820,
3672,
7,
8671,
4008,
198,
198,
8818,
2479,
7,
65,
820,
8,
198,
220,
220,
220,
41560,
796,
1909,
3419,
198,
220,
220,
220,
41560,
532,
275,
820,
198,
220,
220,
220,
288,
1941,
796,
614,
7,
8671,
8,
532,
614,
7,
65,
820,
8,
198,
220,
220,
220,
288,
8424,
796,
1227,
7,
8671,
8,
532,
1227,
7,
65,
820,
8,
198,
220,
220,
220,
288,
820,
796,
1110,
7,
8671,
8,
532,
1110,
7,
65,
820,
8,
198,
220,
220,
220,
611,
288,
8424,
1279,
657,
198,
220,
220,
220,
220,
220,
220,
220,
288,
1941,
48185,
352,
198,
220,
220,
220,
2073,
361,
288,
8424,
6624,
657,
11405,
288,
820,
1279,
657,
198,
220,
220,
220,
220,
220,
220,
220,
288,
1941,
48185,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
44872,
7203,
23396,
25,
720,
67,
1941,
4943,
628,
220,
220,
220,
1306,
62,
65,
820,
796,
275,
820,
1343,
6280,
7,
67,
1941,
1343,
352,
8,
198,
220,
220,
220,
44872,
7203,
10019,
10955,
25,
720,
19545,
62,
65,
820,
4943,
198,
220,
220,
220,
1306,
26069,
796,
7536,
7575,
7,
19545,
62,
65,
820,
8,
532,
783,
3419,
198,
220,
220,
220,
640,
9464,
796,
40091,
1096,
7,
35,
689,
13,
7293,
633,
5990,
2101,
7,
19545,
26069,
4008,
198,
220,
220,
220,
44872,
7203,
7575,
284,
1306,
10955,
25,
720,
2435,
9464,
4943,
198,
437,
198,
198,
2,
2479,
7,
10430,
7,
21908,
11,
1367,
11,
7816,
4008,
198,
198,
8818,
15229,
323,
7,
67,
16,
11,
288,
17,
8,
198,
220,
220,
220,
2488,
30493,
7,
67,
17,
1875,
288,
16,
11,
366,
67,
17,
815,
307,
1568,
621,
288,
16,
4943,
198,
220,
220,
220,
1441,
288,
17,
532,
288,
16,
1343,
288,
17,
198,
437,
198,
198,
67,
16,
796,
7536,
7,
11024,
11,
352,
11,
362,
8,
198,
67,
17,
796,
7536,
7,
14315,
11,
718,
11,
1987,
8,
198,
2,
44872,
7,
67,
280,
9342,
323,
7,
67,
16,
11,
288,
17,
4008,
198,
198,
8818,
299,
62,
820,
7,
67,
16,
11,
288,
17,
11,
299,
8,
198,
220,
220,
220,
2488,
30493,
7,
67,
17,
1875,
288,
16,
11,
366,
67,
17,
815,
307,
1568,
621,
288,
16,
4943,
198,
220,
220,
220,
814,
796,
288,
17,
532,
288,
16,
198,
220,
220,
220,
2479,
16,
11,
2479,
17,
796,
814,
13,
8367,
11,
657,
198,
220,
220,
220,
981,
2479,
17,
1635,
299,
14512,
2479,
16,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2479,
17,
1635,
299,
1875,
2479,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
26950,
4733,
6087,
286,
17311,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2479,
16,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
2479,
17,
15853,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
288,
16,
1343,
3596,
7,
496,
16,
8,
198,
437,
198,
198,
2,
44872,
7,
77,
62,
820,
7,
67,
16,
11,
288,
17,
11,
362,
4008,
198,
2,
44872,
7,
77,
62,
820,
7,
67,
16,
11,
288,
17,
11,
513,
4008,
198,
2,
44872,
7,
77,
62,
820,
7,
67,
16,
11,
288,
17,
11,
718,
4008
] | 2.311422 | 1,217 |
######### StanSample example ###########
using StanSample, Test
bernoulli_model = "
data {
int<lower=1> N;
array[N] int<lower=0,upper=1> y;
}
parameters {
real<lower=0,upper=1> theta;
}
model {
theta ~ beta(1,1);
y ~ bernoulli(theta);
}
";
bernoulli_data = [
Dict("N" => 10, "y" => [0, 1, 0, 1, 0, 0, 0, 0, 0, 1]),
Dict("N" => 10, "y" => [0, 1, 0, 0, 1, 0, 0, 0, 0, 1]),
Dict("N" => 10, "y" => [0, 1, 0, 1, 0, 0, 0, 0, 1, 0]),
Dict("N" => 10, "y" => [0, 0, 0, 1, 0, 0, 1, 0, 0, 1]),
]
sm = SampleModel("bernoulli", bernoulli_model)
rc = stan_sample(sm; data=bernoulli_data, delta=0.85, num_threads=1)
if success(rc)
# Fetch the same output in the `sdf` ChainDataFrame
sdf = read_summary(sm)
@test sdf[sdf.parameters .== :theta, :mean][1] ≈ 0.33 rtol=0.05
end | [
7804,
2,
7299,
36674,
1672,
220,
1303,
7804,
2235,
198,
198,
3500,
7299,
36674,
11,
6208,
198,
198,
33900,
280,
15516,
62,
19849,
796,
366,
198,
7890,
1391,
220,
198,
220,
493,
27,
21037,
28,
16,
29,
399,
26,
220,
198,
220,
7177,
58,
45,
60,
493,
27,
21037,
28,
15,
11,
45828,
28,
16,
29,
331,
26,
198,
92,
220,
198,
17143,
7307,
1391,
198,
220,
1103,
27,
21037,
28,
15,
11,
45828,
28,
16,
29,
262,
8326,
26,
198,
92,
220,
198,
19849,
1391,
198,
220,
262,
8326,
5299,
12159,
7,
16,
11,
16,
1776,
198,
220,
331,
5299,
275,
1142,
280,
15516,
7,
1169,
8326,
1776,
198,
92,
198,
8172,
198,
198,
33900,
280,
15516,
62,
7890,
796,
685,
198,
220,
360,
713,
7203,
45,
1,
5218,
838,
11,
366,
88,
1,
5218,
685,
15,
11,
352,
11,
657,
11,
352,
11,
657,
11,
657,
11,
657,
11,
657,
11,
657,
11,
352,
46570,
198,
220,
360,
713,
7203,
45,
1,
5218,
838,
11,
366,
88,
1,
5218,
685,
15,
11,
352,
11,
657,
11,
657,
11,
352,
11,
657,
11,
657,
11,
657,
11,
657,
11,
352,
46570,
198,
220,
360,
713,
7203,
45,
1,
5218,
838,
11,
366,
88,
1,
5218,
685,
15,
11,
352,
11,
657,
11,
352,
11,
657,
11,
657,
11,
657,
11,
657,
11,
352,
11,
657,
46570,
198,
220,
360,
713,
7203,
45,
1,
5218,
838,
11,
366,
88,
1,
5218,
685,
15,
11,
657,
11,
657,
11,
352,
11,
657,
11,
657,
11,
352,
11,
657,
11,
657,
11,
352,
46570,
198,
60,
198,
198,
5796,
796,
27565,
17633,
7203,
33900,
280,
15516,
1600,
275,
1142,
280,
15516,
62,
19849,
8,
198,
6015,
796,
336,
272,
62,
39873,
7,
5796,
26,
1366,
28,
33900,
280,
15516,
62,
7890,
11,
25979,
28,
15,
13,
5332,
11,
997,
62,
16663,
82,
28,
16,
8,
198,
361,
1943,
7,
6015,
8,
628,
220,
1303,
376,
7569,
262,
976,
5072,
287,
262,
4600,
82,
7568,
63,
21853,
6601,
19778,
198,
220,
264,
7568,
796,
1100,
62,
49736,
7,
5796,
8,
628,
220,
2488,
9288,
264,
7568,
58,
82,
7568,
13,
17143,
7307,
764,
855,
1058,
1169,
8326,
11,
1058,
32604,
7131,
16,
60,
15139,
230,
657,
13,
2091,
374,
83,
349,
28,
15,
13,
2713,
198,
220,
220,
198,
437
] | 2.056848 | 387 |
using Core.Compiler: AbstractInterpreter, CodeInstance, MethodInstance, WorldView, NativeInterpreter
using InteractiveUtils
function infer_function(interp, tt)
# Find all methods that are applicable to these types
mthds = _methods_by_ftype(tt, -1, typemax(UInt))
if mthds === false || length(mthds) != 1
error("Unable to find single applicable method for $tt")
end
mtypes, msp, m = mthds[1]
# Grab the appropriate method instance for these types
mi = Core.Compiler.specialize_method(m, mtypes, msp)
# Construct InferenceResult to hold the result,
result = Core.Compiler.InferenceResult(mi)
# Create an InferenceState to begin inference, give it a world that is always newest
world = Core.Compiler.get_world_counter()
frame = Core.Compiler.InferenceState(result, #=cached=# true, interp)
# Run type inference on this frame. Because the interpreter is embedded
# within this InferenceResult, we don't need to pass the interpreter in.
Core.Compiler.typeinf(interp, frame)
# Give the result back
return (mi, result)
end
struct ExtractingInterpreter <: Core.Compiler.AbstractInterpreter
code::Dict{MethodInstance, CodeInstance}
native_interpreter::NativeInterpreter
msgs::Vector{Tuple{MethodInstance, Int, String}}
optimize::Bool
end
ExtractingInterpreter(;optimize=false) = ExtractingInterpreter(
Dict{MethodInstance, Any}(),
NativeInterpreter(),
Vector{Tuple{MethodInstance, Int, String}}(),
optimize
)
import Core.Compiler: InferenceParams, OptimizationParams, get_world_counter,
get_inference_cache, code_cache,
WorldView, lock_mi_inference, unlock_mi_inference, InferenceState
InferenceParams(ei::ExtractingInterpreter) = InferenceParams(ei.native_interpreter)
OptimizationParams(ei::ExtractingInterpreter) = OptimizationParams(ei.native_interpreter)
get_world_counter(ei::ExtractingInterpreter) = get_world_counter(ei.native_interpreter)
get_inference_cache(ei::ExtractingInterpreter) = get_inference_cache(ei.native_interpreter)
# No need to do any locking since we're not putting our results into the runtime cache
lock_mi_inference(ei::ExtractingInterpreter, mi::MethodInstance) = nothing
unlock_mi_inference(ei::ExtractingInterpreter, mi::MethodInstance) = nothing
code_cache(ei::ExtractingInterpreter) = ei.code
Core.Compiler.get(a::Dict, b, c) = Base.get(a,b,c)
Core.Compiler.get(a::WorldView{<:Dict}, b, c) = Base.get(a.cache,b,c)
Core.Compiler.haskey(a::Dict, b) = Base.haskey(a, b)
Core.Compiler.haskey(a::WorldView{<:Dict}, b) =
Core.Compiler.haskey(a.cache, b)
Core.Compiler.setindex!(a::Dict, b, c) = setindex!(a, b, c)
Core.Compiler.may_optimize(ei::ExtractingInterpreter) = ei.optimize
Core.Compiler.may_compress(ei::ExtractingInterpreter) = false
Core.Compiler.may_discard_trees(ei::ExtractingInterpreter) = false
function Core.Compiler.add_remark!(ei::ExtractingInterpreter, sv::InferenceState, msg)
@show msg
push!(ei.msgs, (sv.linfo, sv.currpc, msg))
end
macro code_typed_nocache(ex0...)
esc(:(@InteractiveUtils.code_typed interp=$(ExtractingInterpreter)() $(ex0...)))
end
export @code_typed_nocache
| [
3500,
7231,
13,
7293,
5329,
25,
27741,
9492,
3866,
353,
11,
6127,
33384,
11,
11789,
33384,
11,
2159,
7680,
11,
12547,
9492,
3866,
353,
198,
3500,
21365,
18274,
4487,
198,
198,
8818,
13249,
62,
8818,
7,
3849,
79,
11,
256,
83,
8,
198,
220,
220,
220,
1303,
9938,
477,
5050,
326,
389,
9723,
284,
777,
3858,
198,
220,
220,
220,
285,
400,
9310,
796,
4808,
24396,
82,
62,
1525,
62,
701,
2981,
7,
926,
11,
532,
16,
11,
2170,
368,
897,
7,
52,
5317,
4008,
198,
220,
220,
220,
611,
285,
400,
9310,
24844,
3991,
8614,
4129,
7,
76,
400,
9310,
8,
14512,
352,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
3118,
540,
284,
1064,
2060,
9723,
2446,
329,
720,
926,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
285,
19199,
11,
285,
2777,
11,
285,
796,
285,
400,
9310,
58,
16,
60,
628,
220,
220,
220,
1303,
25339,
262,
5035,
2446,
4554,
329,
777,
3858,
198,
220,
220,
220,
21504,
796,
7231,
13,
7293,
5329,
13,
20887,
1096,
62,
24396,
7,
76,
11,
285,
19199,
11,
285,
2777,
8,
628,
220,
220,
220,
1303,
28407,
554,
4288,
23004,
284,
1745,
262,
1255,
11,
198,
220,
220,
220,
1255,
796,
7231,
13,
7293,
5329,
13,
818,
4288,
23004,
7,
11632,
8,
628,
220,
220,
220,
1303,
13610,
281,
554,
4288,
9012,
284,
2221,
32278,
11,
1577,
340,
257,
995,
326,
318,
1464,
15530,
198,
220,
220,
220,
995,
796,
7231,
13,
7293,
5329,
13,
1136,
62,
6894,
62,
24588,
3419,
198,
220,
220,
220,
5739,
796,
7231,
13,
7293,
5329,
13,
818,
4288,
9012,
7,
20274,
11,
1303,
28,
66,
2317,
46249,
2081,
11,
987,
79,
8,
628,
220,
220,
220,
1303,
5660,
2099,
32278,
319,
428,
5739,
13,
220,
4362,
262,
28846,
318,
14553,
198,
220,
220,
220,
1303,
1626,
428,
554,
4288,
23004,
11,
356,
836,
470,
761,
284,
1208,
262,
28846,
287,
13,
198,
220,
220,
220,
7231,
13,
7293,
5329,
13,
4906,
10745,
7,
3849,
79,
11,
5739,
8,
628,
220,
220,
220,
1303,
13786,
262,
1255,
736,
198,
220,
220,
220,
1441,
357,
11632,
11,
1255,
8,
198,
437,
198,
198,
7249,
29677,
278,
9492,
3866,
353,
1279,
25,
7231,
13,
7293,
5329,
13,
23839,
9492,
3866,
353,
198,
220,
220,
220,
2438,
3712,
35,
713,
90,
17410,
33384,
11,
6127,
33384,
92,
198,
220,
220,
220,
6868,
62,
3849,
3866,
353,
3712,
31272,
9492,
3866,
353,
198,
220,
220,
220,
13845,
14542,
3712,
38469,
90,
51,
29291,
90,
17410,
33384,
11,
2558,
11,
10903,
11709,
198,
220,
220,
220,
27183,
3712,
33,
970,
198,
437,
198,
198,
11627,
974,
278,
9492,
3866,
353,
7,
26,
40085,
1096,
28,
9562,
8,
796,
29677,
278,
9492,
3866,
353,
7,
198,
220,
220,
220,
360,
713,
90,
17410,
33384,
11,
4377,
92,
22784,
198,
220,
220,
220,
12547,
9492,
3866,
353,
22784,
198,
220,
220,
220,
20650,
90,
51,
29291,
90,
17410,
33384,
11,
2558,
11,
10903,
11709,
22784,
198,
220,
220,
220,
27183,
198,
8,
198,
198,
11748,
7231,
13,
7293,
5329,
25,
554,
4288,
10044,
4105,
11,
30011,
1634,
10044,
4105,
11,
651,
62,
6894,
62,
24588,
11,
198,
220,
220,
220,
651,
62,
259,
4288,
62,
23870,
11,
2438,
62,
23870,
11,
198,
220,
220,
220,
2159,
7680,
11,
5793,
62,
11632,
62,
259,
4288,
11,
12116,
62,
11632,
62,
259,
4288,
11,
554,
4288,
9012,
198,
818,
4288,
10044,
4105,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
554,
4288,
10044,
4105,
7,
20295,
13,
30191,
62,
3849,
3866,
353,
8,
198,
27871,
320,
1634,
10044,
4105,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
30011,
1634,
10044,
4105,
7,
20295,
13,
30191,
62,
3849,
3866,
353,
8,
198,
1136,
62,
6894,
62,
24588,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
651,
62,
6894,
62,
24588,
7,
20295,
13,
30191,
62,
3849,
3866,
353,
8,
198,
1136,
62,
259,
4288,
62,
23870,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
651,
62,
259,
4288,
62,
23870,
7,
20295,
13,
30191,
62,
3849,
3866,
353,
8,
198,
198,
2,
1400,
761,
284,
466,
597,
22656,
1201,
356,
821,
407,
5137,
674,
2482,
656,
262,
19124,
12940,
198,
5354,
62,
11632,
62,
259,
4288,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
11,
21504,
3712,
17410,
33384,
8,
796,
2147,
198,
403,
5354,
62,
11632,
62,
259,
4288,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
11,
21504,
3712,
17410,
33384,
8,
796,
2147,
198,
198,
8189,
62,
23870,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
304,
72,
13,
8189,
198,
14055,
13,
7293,
5329,
13,
1136,
7,
64,
3712,
35,
713,
11,
275,
11,
269,
8,
796,
7308,
13,
1136,
7,
64,
11,
65,
11,
66,
8,
198,
14055,
13,
7293,
5329,
13,
1136,
7,
64,
3712,
10603,
7680,
90,
27,
25,
35,
713,
5512,
275,
11,
269,
8,
796,
7308,
13,
1136,
7,
64,
13,
23870,
11,
65,
11,
66,
8,
198,
14055,
13,
7293,
5329,
13,
10134,
2539,
7,
64,
3712,
35,
713,
11,
275,
8,
796,
7308,
13,
10134,
2539,
7,
64,
11,
275,
8,
198,
14055,
13,
7293,
5329,
13,
10134,
2539,
7,
64,
3712,
10603,
7680,
90,
27,
25,
35,
713,
5512,
275,
8,
796,
198,
220,
220,
220,
7231,
13,
7293,
5329,
13,
10134,
2539,
7,
64,
13,
23870,
11,
275,
8,
198,
14055,
13,
7293,
5329,
13,
2617,
9630,
0,
7,
64,
3712,
35,
713,
11,
275,
11,
269,
8,
796,
900,
9630,
0,
7,
64,
11,
275,
11,
269,
8,
198,
14055,
13,
7293,
5329,
13,
11261,
62,
40085,
1096,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
304,
72,
13,
40085,
1096,
198,
14055,
13,
7293,
5329,
13,
11261,
62,
5589,
601,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
3991,
198,
14055,
13,
7293,
5329,
13,
11261,
62,
15410,
446,
62,
83,
6037,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
8,
796,
3991,
198,
198,
8818,
7231,
13,
7293,
5329,
13,
2860,
62,
2787,
668,
0,
7,
20295,
3712,
11627,
974,
278,
9492,
3866,
353,
11,
38487,
3712,
818,
4288,
9012,
11,
31456,
8,
198,
220,
220,
220,
2488,
12860,
31456,
198,
220,
220,
220,
4574,
0,
7,
20295,
13,
907,
14542,
11,
357,
21370,
13,
2815,
6513,
11,
38487,
13,
22019,
81,
14751,
11,
31456,
4008,
198,
437,
198,
198,
20285,
305,
2438,
62,
774,
9124,
62,
77,
420,
4891,
7,
1069,
15,
23029,
198,
220,
220,
220,
3671,
7,
37498,
31,
9492,
5275,
18274,
4487,
13,
8189,
62,
774,
9124,
987,
79,
43641,
7,
11627,
974,
278,
9492,
3866,
353,
8,
3419,
29568,
1069,
15,
986,
22305,
198,
437,
198,
198,
39344,
2488,
8189,
62,
774,
9124,
62,
77,
420,
4891,
198
] | 2.773205 | 1,142 |
function bob(stimulus)
# 1) Checar si la cadena esta vacia
# 2) Checar si la cadena tiene un signo de interrogacion (?)
# 3) Checar si la cadena es toda en mayusculas
# 4) Cualquier otra cosa regresa "Whatever."
nospace = strip(stimulus)
if isempty(nospace)
return "Fine. Be that way!"
elseif uppercase(stimulus) == stimulus
if endswith(stimulus, "?")
return "Calm down, I know what I'm doing!"
else
return "Whoa, chill out!"
end
else
if endswith(stimulus, "?")
return "Sure."
end
end
return "Whatever."
end
| [
8818,
29202,
7,
42003,
23515,
8,
198,
220,
220,
220,
1303,
352,
8,
2580,
7718,
33721,
8591,
20603,
8107,
1556,
64,
6658,
544,
198,
220,
220,
220,
1303,
362,
8,
2580,
7718,
33721,
8591,
20603,
8107,
46668,
1734,
555,
1051,
78,
390,
15054,
49443,
357,
10091,
198,
220,
220,
220,
1303,
513,
8,
2580,
7718,
33721,
8591,
20603,
8107,
1658,
284,
6814,
551,
743,
385,
3129,
292,
198,
220,
220,
220,
1303,
604,
8,
327,
723,
421,
959,
267,
9535,
269,
8546,
842,
14625,
366,
21875,
526,
198,
220,
220,
220,
299,
24912,
796,
10283,
7,
42003,
23515,
8,
198,
220,
220,
220,
611,
318,
28920,
7,
77,
24912,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
34389,
13,
1355,
326,
835,
2474,
198,
220,
220,
220,
2073,
361,
334,
39921,
589,
7,
42003,
23515,
8,
6624,
19819,
198,
220,
220,
220,
220,
220,
220,
220,
611,
886,
2032,
342,
7,
42003,
23515,
11,
366,
1701,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
9771,
76,
866,
11,
314,
760,
644,
314,
1101,
1804,
2474,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
8241,
64,
11,
20493,
503,
2474,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
611,
886,
2032,
342,
7,
42003,
23515,
11,
366,
1701,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
366,
19457,
526,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
366,
21875,
526,
198,
437,
198
] | 2.194444 | 288 |
using Distributions
using Test, Random
@test rand(Bernoulli()) isa Bool
@test rand(Bernoulli(), 10) isa Vector{Bool}
| [
3500,
46567,
507,
198,
3500,
6208,
11,
14534,
198,
198,
31,
9288,
43720,
7,
23927,
280,
15516,
28955,
318,
64,
347,
970,
198,
31,
9288,
43720,
7,
23927,
280,
15516,
22784,
838,
8,
318,
64,
20650,
90,
33,
970,
92,
198
] | 2.878049 | 41 |
A = [1 2 ; 3 4]
B = [10, 10]
sum!(B, A)
sum!(A, B)
using ReverseDiffSource
Nn = [20,10,1]
function ann(l1, l2, x1)
x2 = l1 * x1
x2 = max(0., x2) #relu
x3 = l2 * x2
x3 = (max(0., x3[1]))^2 #relu
end
# ls = Array[ nn.ws...]
ls = init(Nn)
dann = rdiff(ann, (ls..., ones(20) ))
out = dann(ls..., ones(20) )
nn = S.NN((ls[1], ls[2]), (S.Relu(), S.Relu()))
ts2 = S.cycle(nn, ones(20), zeros(1))
out[2]
ts2.dws[1]
out[3]
ts2.dws[2]
ts2.ds[end]
out[3] ./ ts2.dws[2]
r1 = S.calc(nn, ones(20))[1] # 1.16217
r2 = ann(ls..., ones(20))
r1-r2
ls[1][9,1] += 1e-10
(ann(ls..., ones(20)) - r1) * 1e10 # -0.8600
nn.ws[1][9,1] += 1e-10
(S.calc(nn, ones(20)) - r2) * 1e10 # -0.8600
reload("SimpleNeuralNets"); S=SimpleNeuralNets
nn = S.NN([10,10,10,10,1], [ S.Tanh(), S.Tanh()] )
ts = S.TrainState(nn, 10)
size(nn)
size(ts)
ts2 = S.cycle(nn, ones(20,10), ones(5,10))
S.cycle!(ts, nn, ones(10,10), ones(1,10))
S.depth(nn)
s0 = S.calc(nn, rand(20))
copy!(s0.ss[1], ones(20))
S.compatible(nn, s0)
S.calc!(nn, s0)
s0 = S.calc(nn, rand(20,10))
copy!(s0.ss[1], ones(20))
S.compatible(nn, s0)
S.calc!(nn, s0)
a = (1,2,3)
typeof(a)
a[1]
a[1] = 2
nn = S.NN((randn(1,1),), (S.Relu(),))
S.calc(nn, [1.])
nn = S.NN((randn(1,1),), (S.SoftRelu(),))
S.calc(nn, [1.])
########### ANN3 #################################"
import Bokeh
# using ReverseDiffSource
reload("SimpleNeuralNets"); s = SimpleNeuralNets
f(x) = exp(-(x-1)^2/5)*cos(x)*sign(x)
xs = collect(-5:0.001:5)
X = Float64[ x for x in xs ]'
Y = Float64[ f(x) for x in xs ]'
nn = s.NN([1,10,10,10,1], [ s.Relu(), s.Tanh()] )
ts = s.TrainingSet(X, Y)
any(ts.weights .!= 1.0)
λ0, μ = 1e-3, 0.9
s.sgd(nn, ts, λ0, μ, freq=200, steps=1000)
ts2 = s.TrainingSet(X, Y, SqEuclidean(), rand(size(X,2)))
s.sgd(nn, ts2, λ0, μ, freq=200, steps=1000)
s.colwise(a,b,c)
length(a.weights)
px = s.calc(nn, X)
sum(s.colwise(ts2.metric, px, ts2.Y))
λ0, μ = 1e-3, 0.9
s.sgd(nn, λ0, μ, X, Y, freq=200, steps=10000)
λ0, μ = 1e-5, 0.999
s.sgd(nn, λ0, μ, X, Y, freq=200, steps=10000)
Bokeh.hold(true)
Bokeh.plot(f, -5:5, "k-")
px = collect(-5:0.01:5)
py = s.calc(nn, px')'
Bokeh.plot(px, py, "b-")
Bokeh.showplot("/tmp/plot.html")
Bokeh.hold(false)
nn = s.NN([1,10,10,10,1], [ s.SoftRelu(), s.Tanh()] )
λ0, μ = 1e-3, 0.9
s.sgd(nn, λ0, μ, X, Y, freq=200, steps=10000)
λ0, μ = 1e-3, 0.
s.sgd(nn, λ0, μ, X, Y, freq=1000, steps=10000)
Bokeh.hold(true)
Bokeh.plot(f, -5:5, "k-")
px = collect(-4:0.1:4)
py = s.calc(nn, px')'
Bokeh.plot(px, py, "b-")
Bokeh.showplot("/tmp/plot.html")
Bokeh.hold(false) | [
628,
220,
220,
220,
317,
796,
685,
16,
362,
2162,
513,
604,
60,
198,
220,
220,
220,
347,
796,
685,
940,
11,
838,
60,
198,
220,
220,
220,
2160,
0,
7,
33,
11,
317,
8,
198,
220,
220,
220,
2160,
0,
7,
32,
11,
347,
8,
628,
198,
220,
220,
220,
1262,
31849,
28813,
7416,
628,
220,
220,
220,
220,
220,
220,
220,
399,
77,
796,
685,
1238,
11,
940,
11,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2163,
1529,
7,
75,
16,
11,
300,
17,
11,
2124,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
300,
16,
1635,
2124,
16,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
17,
796,
3509,
7,
15,
1539,
2124,
17,
8,
1303,
260,
2290,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
18,
796,
300,
17,
1635,
2124,
17,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
18,
796,
357,
9806,
7,
15,
1539,
2124,
18,
58,
16,
60,
4008,
61,
17,
1303,
260,
2290,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
43979,
796,
15690,
58,
299,
77,
13,
18504,
22345,
198,
220,
220,
220,
220,
220,
220,
220,
43979,
796,
2315,
7,
45,
77,
8,
198,
220,
220,
220,
220,
220,
220,
220,
288,
1236,
796,
374,
26069,
7,
1236,
11,
357,
7278,
986,
11,
3392,
7,
1238,
8,
15306,
198,
220,
220,
220,
220,
220,
220,
220,
503,
796,
288,
1236,
7,
7278,
986,
11,
3392,
7,
1238,
8,
1267,
628,
220,
220,
220,
299,
77,
796,
311,
13,
6144,
19510,
7278,
58,
16,
4357,
43979,
58,
17,
46570,
357,
50,
13,
6892,
84,
22784,
311,
13,
6892,
84,
3419,
4008,
198,
220,
220,
220,
40379,
17,
796,
311,
13,
13696,
7,
20471,
11,
3392,
7,
1238,
828,
1976,
27498,
7,
16,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
503,
58,
17,
60,
220,
198,
220,
220,
220,
220,
220,
220,
220,
40379,
17,
13,
67,
18504,
58,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
503,
58,
18,
60,
220,
198,
220,
220,
220,
220,
220,
220,
220,
40379,
17,
13,
67,
18504,
58,
17,
60,
628,
220,
220,
220,
220,
220,
220,
220,
40379,
17,
13,
9310,
58,
437,
60,
628,
220,
220,
220,
220,
220,
220,
220,
503,
58,
18,
60,
24457,
40379,
17,
13,
67,
18504,
58,
17,
60,
628,
220,
220,
220,
374,
16,
796,
311,
13,
9948,
66,
7,
20471,
11,
3392,
7,
1238,
4008,
58,
16,
60,
1303,
352,
13,
1433,
24591,
198,
220,
220,
220,
374,
17,
796,
1529,
7,
7278,
986,
11,
3392,
7,
1238,
4008,
198,
220,
220,
220,
374,
16,
12,
81,
17,
628,
220,
220,
220,
43979,
58,
16,
7131,
24,
11,
16,
60,
15853,
352,
68,
12,
940,
198,
220,
220,
220,
357,
1236,
7,
7278,
986,
11,
3392,
7,
1238,
4008,
532,
374,
16,
8,
1635,
352,
68,
940,
220,
1303,
532,
15,
13,
4521,
405,
628,
220,
220,
220,
299,
77,
13,
18504,
58,
16,
7131,
24,
11,
16,
60,
15853,
352,
68,
12,
940,
198,
220,
220,
220,
357,
50,
13,
9948,
66,
7,
20471,
11,
3392,
7,
1238,
4008,
532,
374,
17,
8,
1635,
352,
68,
940,
220,
1303,
532,
15,
13,
4521,
405,
628,
198,
220,
220,
220,
18126,
7203,
26437,
8199,
1523,
45,
1039,
15341,
311,
28,
26437,
8199,
1523,
45,
1039,
628,
220,
220,
220,
299,
77,
796,
311,
13,
6144,
26933,
940,
11,
940,
11,
940,
11,
940,
11,
16,
4357,
685,
311,
13,
45557,
71,
22784,
311,
13,
45557,
71,
3419,
60,
1267,
198,
220,
220,
220,
40379,
796,
311,
13,
44077,
9012,
7,
20471,
11,
838,
8,
628,
220,
220,
220,
2546,
7,
20471,
8,
198,
220,
220,
220,
2546,
7,
912,
8,
628,
220,
220,
220,
40379,
17,
796,
311,
13,
13696,
7,
20471,
11,
3392,
7,
1238,
11,
940,
828,
3392,
7,
20,
11,
940,
4008,
198,
220,
220,
220,
311,
13,
13696,
0,
7,
912,
11,
299,
77,
11,
3392,
7,
940,
11,
940,
828,
3392,
7,
16,
11,
940,
4008,
628,
220,
220,
220,
311,
13,
18053,
7,
20471,
8,
628,
220,
220,
220,
264,
15,
796,
311,
13,
9948,
66,
7,
20471,
11,
43720,
7,
1238,
4008,
198,
220,
220,
220,
4866,
0,
7,
82,
15,
13,
824,
58,
16,
4357,
3392,
7,
1238,
4008,
198,
220,
220,
220,
311,
13,
38532,
7,
20471,
11,
264,
15,
8,
198,
220,
220,
220,
311,
13,
9948,
66,
0,
7,
20471,
11,
264,
15,
8,
628,
220,
220,
220,
264,
15,
796,
311,
13,
9948,
66,
7,
20471,
11,
43720,
7,
1238,
11,
940,
4008,
198,
220,
220,
220,
4866,
0,
7,
82,
15,
13,
824,
58,
16,
4357,
3392,
7,
1238,
4008,
198,
220,
220,
220,
311,
13,
38532,
7,
20471,
11,
264,
15,
8,
198,
220,
220,
220,
311,
13,
9948,
66,
0,
7,
20471,
11,
264,
15,
8,
628,
220,
220,
220,
257,
796,
357,
16,
11,
17,
11,
18,
8,
198,
220,
220,
220,
2099,
1659,
7,
64,
8,
198,
220,
220,
220,
257,
58,
16,
60,
198,
220,
220,
220,
257,
58,
16,
60,
796,
362,
628,
198,
220,
220,
220,
299,
77,
796,
311,
13,
6144,
19510,
25192,
77,
7,
16,
11,
16,
828,
828,
357,
50,
13,
6892,
84,
22784,
4008,
198,
220,
220,
220,
311,
13,
9948,
66,
7,
20471,
11,
685,
16,
8183,
8,
628,
220,
220,
220,
299,
77,
796,
311,
13,
6144,
19510,
25192,
77,
7,
16,
11,
16,
828,
828,
357,
50,
13,
18380,
6892,
84,
22784,
4008,
198,
220,
220,
220,
311,
13,
9948,
66,
7,
20471,
11,
685,
16,
8183,
8,
198,
198,
7804,
21017,
40126,
18,
1303,
29113,
1,
628,
220,
220,
220,
1330,
347,
2088,
71,
198,
220,
220,
220,
1303,
1262,
31849,
28813,
7416,
198,
220,
220,
220,
18126,
7203,
26437,
8199,
1523,
45,
1039,
15341,
264,
796,
17427,
8199,
1523,
45,
1039,
628,
220,
220,
220,
277,
7,
87,
8,
796,
1033,
7,
30420,
87,
12,
16,
8,
61,
17,
14,
20,
27493,
6966,
7,
87,
27493,
12683,
7,
87,
8,
628,
220,
220,
220,
2124,
82,
796,
2824,
32590,
20,
25,
15,
13,
8298,
25,
20,
8,
198,
220,
220,
220,
1395,
796,
48436,
2414,
58,
2124,
329,
2124,
287,
2124,
82,
2361,
6,
198,
220,
220,
220,
575,
796,
48436,
2414,
58,
277,
7,
87,
8,
329,
2124,
287,
2124,
82,
2361,
6,
628,
220,
220,
220,
299,
77,
796,
264,
13,
6144,
26933,
16,
11,
940,
11,
940,
11,
940,
11,
16,
4357,
685,
264,
13,
6892,
84,
22784,
264,
13,
45557,
71,
3419,
60,
1267,
628,
220,
220,
220,
40379,
796,
264,
13,
44357,
7248,
7,
55,
11,
575,
8,
198,
220,
220,
220,
597,
7,
912,
13,
43775,
764,
0,
28,
352,
13,
15,
8,
628,
220,
220,
220,
7377,
119,
15,
11,
18919,
796,
352,
68,
12,
18,
11,
657,
13,
24,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
40379,
11,
7377,
119,
15,
11,
18919,
11,
2030,
80,
28,
2167,
11,
4831,
28,
12825,
8,
628,
220,
220,
220,
40379,
17,
796,
264,
13,
44357,
7248,
7,
55,
11,
575,
11,
311,
80,
36,
36616,
485,
272,
22784,
43720,
7,
7857,
7,
55,
11,
17,
22305,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
40379,
17,
11,
7377,
119,
15,
11,
18919,
11,
2030,
80,
28,
2167,
11,
4831,
28,
12825,
8,
628,
220,
220,
220,
264,
13,
4033,
3083,
7,
64,
11,
65,
11,
66,
8,
198,
220,
220,
220,
4129,
7,
64,
13,
43775,
8,
628,
220,
220,
220,
279,
87,
796,
264,
13,
9948,
66,
7,
20471,
11,
1395,
8,
198,
220,
220,
220,
2160,
7,
82,
13,
4033,
3083,
7,
912,
17,
13,
4164,
1173,
11,
279,
87,
11,
40379,
17,
13,
56,
4008,
628,
198,
220,
220,
220,
7377,
119,
15,
11,
18919,
796,
352,
68,
12,
18,
11,
657,
13,
24,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
7377,
119,
15,
11,
18919,
11,
1395,
11,
575,
11,
2030,
80,
28,
2167,
11,
4831,
28,
49388,
8,
198,
220,
220,
220,
7377,
119,
15,
11,
18919,
796,
352,
68,
12,
20,
11,
657,
13,
17032,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
7377,
119,
15,
11,
18919,
11,
1395,
11,
575,
11,
2030,
80,
28,
2167,
11,
4831,
28,
49388,
8,
628,
220,
220,
220,
347,
2088,
71,
13,
2946,
7,
7942,
8,
198,
220,
220,
220,
347,
2088,
71,
13,
29487,
7,
69,
11,
532,
20,
25,
20,
11,
366,
74,
12,
4943,
198,
220,
220,
220,
279,
87,
796,
2824,
32590,
20,
25,
15,
13,
486,
25,
20,
8,
198,
220,
220,
220,
12972,
796,
264,
13,
9948,
66,
7,
20471,
11,
279,
87,
11537,
6,
198,
220,
220,
220,
347,
2088,
71,
13,
29487,
7,
8416,
11,
12972,
11,
366,
65,
12,
4943,
198,
220,
220,
220,
347,
2088,
71,
13,
12860,
29487,
7203,
14,
22065,
14,
29487,
13,
6494,
4943,
198,
220,
220,
220,
347,
2088,
71,
13,
2946,
7,
9562,
8,
628,
220,
220,
220,
299,
77,
796,
264,
13,
6144,
26933,
16,
11,
940,
11,
940,
11,
940,
11,
16,
4357,
685,
264,
13,
18380,
6892,
84,
22784,
264,
13,
45557,
71,
3419,
60,
1267,
198,
220,
220,
220,
7377,
119,
15,
11,
18919,
796,
352,
68,
12,
18,
11,
657,
13,
24,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
7377,
119,
15,
11,
18919,
11,
1395,
11,
575,
11,
2030,
80,
28,
2167,
11,
4831,
28,
49388,
8,
198,
220,
220,
220,
7377,
119,
15,
11,
18919,
796,
352,
68,
12,
18,
11,
657,
13,
198,
220,
220,
220,
264,
13,
82,
21287,
7,
20471,
11,
7377,
119,
15,
11,
18919,
11,
1395,
11,
575,
11,
2030,
80,
28,
12825,
11,
4831,
28,
49388,
8,
628,
220,
220,
220,
347,
2088,
71,
13,
2946,
7,
7942,
8,
198,
220,
220,
220,
347,
2088,
71,
13,
29487,
7,
69,
11,
532,
20,
25,
20,
11,
366,
74,
12,
4943,
198,
220,
220,
220,
279,
87,
796,
2824,
32590,
19,
25,
15,
13,
16,
25,
19,
8,
198,
220,
220,
220,
12972,
796,
264,
13,
9948,
66,
7,
20471,
11,
279,
87,
11537,
6,
198,
220,
220,
220,
347,
2088,
71,
13,
29487,
7,
8416,
11,
12972,
11,
366,
65,
12,
4943,
198,
220,
220,
220,
347,
2088,
71,
13,
12860,
29487,
7203,
14,
22065,
14,
29487,
13,
6494,
4943,
198,
220,
220,
220,
347,
2088,
71,
13,
2946,
7,
9562,
8
] | 1.674276 | 1,796 |
import Blosc: compress, decompress
function parallel_density_grid{T}(C::Matrix{T}, width::T, d::Int, σ::T, ϵ::T = 1e-4, num_workers::Int = nworkers())
num_points = size(C, 2)
num_points_per_worker = fill(fld(num_points, num_workers), num_workers)
num_points_per_worker[1:mod(num_points, num_workers)] += 1
start_indices = unshift!(cumsum(num_points_per_worker), 0) .+ 1
pop!(start_indices)
params = map(zip(start_indices, num_points_per_worker)) do r
C[:, range(r[1], r[2])], width, d, σ, ϵ
end
#ρs_compressed = pmap(params, pids = collect(take(workers(), num_workers))) do p
ρs_compressed = pmap(params) do p
compress(density_grid(p...), level = 9, shuffle = true, itemsize = sizeof(T))
end
ρ = mapreduce(.+, zeros(T, d^3), ρs_compressed) do ρ_compressed
decompress(T, ρ_compressed)
end
return reshape(ρ, d, d, d)
end
function density_grid{T}(C::Matrix{T}, width::T, d::Int, σ::T, ϵ::T= 1e-4)
hw = width / 2
ρ = zeros(T, d, d, d)
num_points = size(C, 2)
r_max_sq = max(0, -σ^2 * log(ϵ))
r_max = sqrt(r_max_sq)
b = floor(Int, d * r_max / width) + 1
g = collect(linspace(-hw, hw, d))
@inbounds for i in 1:num_points
ix = floor(Int, d * (C[1, i] + hw) / width) + 1
iy = floor(Int, d * (C[2, i] + hw) / width) + 1
iz = floor(Int, d * (C[3, i] + hw) / width) + 1
x_min = max(1, ix - b)
y_min = max(1, iy - b)
z_min = max(1, iz - b)
x_max = min(d, ix + b)
y_max = min(d, iy + b)
z_max = min(d, iz + b)
for jx in x_min:x_max, jy in y_min:y_max, jz in z_min:z_max
r_sq = (C[1, i] - g[jx])^2 + (C[2, i] - g[jy])^2 + (C[3, i] - g[jz])^2
if r_sq < r_max_sq
ρ[jx, jy, jz] += exp(-r_sq / σ^2)
end
end
end
return ρ
end
function density_grid{T}(x::Array{T, 3}, y::Array{T, 3}, z::Array{T, 3}, C::Matrix{T}, σ::T, ϵ::T = 1e-4)
D = size(x)
ρ = zeros(T, D)
num_points = size(C, 2)
R = CartesianRange(size(ρ))
I_min, I_max = first(R), last(R)
x_spread = x[I_max] - x[I_min]
y_spread = y[I_max] - y[I_min]
z_spread = z[I_max] - z[I_min]
r_max_sq = max(0, -σ^2 * log(ϵ))
r_max = sqrt(r_max_sq)
dx = floor(Int, D[1] * r_max / x_spread) + 1
dy = floor(Int, D[2] * r_max / y_spread) + 1
dz = floor(Int, D[3] * r_max / z_spread) + 1
B = CartesianIndex((dx, dy, dz))
@inbounds for i in 1:num_points
ix = floor(Int, D[1] * (C[1, i] - x[I_min]) / x_spread) + 1
iy = floor(Int, D[2] * (C[2, i] - y[I_min]) / y_spread) + 1
iz = floor(Int, D[3] * (C[3, i] - z[I_min]) / z_spread) + 1
I = CartesianIndex((ix, iy, iz))
for J in CartesianRange(max(I_min, I - B), min(I_max, I + B))
r_sq = (C[1, i] - x[J])^2 + (C[2, i] - y[J])^2 + (C[3, i] - z[J])^2
if r_sq < r_max_sq
ρ[J] += exp(-r_sq / σ^2)
end
end
end
return ρ
end
function density_grid_stats{T}(width::T, d::Int, σ::T, ϵ::T)
r_max = sqrt(max(0, -σ^2 * log(ϵ)))
b = floor(Int, r_max / (width / d)) + 1
num_blocks = (2b + 1)^3
println("Max radius: $(r_max)")
println("Blocks per dimension: $b")
println("Total blocks: $(num_blocks)")
flush(STDOUT)
end
| [
11748,
1086,
17500,
25,
27413,
11,
38237,
601,
198,
198,
8818,
10730,
62,
43337,
62,
25928,
90,
51,
92,
7,
34,
3712,
46912,
90,
51,
5512,
9647,
3712,
51,
11,
288,
3712,
5317,
11,
18074,
225,
3712,
51,
11,
18074,
113,
3712,
51,
796,
352,
68,
12,
19,
11,
997,
62,
22896,
3712,
5317,
796,
299,
22896,
28955,
198,
220,
220,
220,
997,
62,
13033,
796,
2546,
7,
34,
11,
362,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
997,
62,
13033,
62,
525,
62,
28816,
796,
6070,
7,
69,
335,
7,
22510,
62,
13033,
11,
997,
62,
22896,
828,
997,
62,
22896,
8,
198,
220,
220,
220,
997,
62,
13033,
62,
525,
62,
28816,
58,
16,
25,
4666,
7,
22510,
62,
13033,
11,
997,
62,
22896,
15437,
15853,
352,
628,
220,
220,
220,
923,
62,
521,
1063,
796,
555,
30846,
0,
7,
66,
5700,
388,
7,
22510,
62,
13033,
62,
525,
62,
28816,
828,
657,
8,
764,
10,
352,
198,
220,
220,
220,
1461,
0,
7,
9688,
62,
521,
1063,
8,
198,
220,
220,
220,
42287,
796,
3975,
7,
13344,
7,
9688,
62,
521,
1063,
11,
997,
62,
13033,
62,
525,
62,
28816,
4008,
466,
374,
198,
220,
220,
220,
220,
220,
220,
220,
327,
58,
45299,
2837,
7,
81,
58,
16,
4357,
374,
58,
17,
12962,
4357,
9647,
11,
288,
11,
18074,
225,
11,
18074,
113,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
33643,
82,
62,
5589,
2790,
796,
279,
8899,
7,
37266,
11,
279,
2340,
796,
2824,
7,
20657,
7,
22896,
22784,
997,
62,
22896,
22305,
466,
279,
198,
220,
220,
220,
18074,
223,
82,
62,
5589,
2790,
796,
279,
8899,
7,
37266,
8,
466,
279,
198,
220,
220,
220,
220,
220,
220,
220,
27413,
7,
43337,
62,
25928,
7,
79,
986,
828,
1241,
796,
860,
11,
36273,
796,
2081,
11,
3709,
1096,
796,
39364,
7,
51,
4008,
198,
220,
220,
220,
886,
628,
220,
220,
220,
18074,
223,
796,
3975,
445,
7234,
7,
13,
28200,
1976,
27498,
7,
51,
11,
288,
61,
18,
828,
18074,
223,
82,
62,
5589,
2790,
8,
466,
18074,
223,
62,
5589,
2790,
198,
220,
220,
220,
220,
220,
220,
220,
38237,
601,
7,
51,
11,
18074,
223,
62,
5589,
2790,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
27179,
1758,
7,
33643,
11,
288,
11,
288,
11,
288,
8,
198,
437,
198,
198,
8818,
12109,
62,
25928,
90,
51,
92,
7,
34,
3712,
46912,
90,
51,
5512,
9647,
3712,
51,
11,
288,
3712,
5317,
11,
18074,
225,
3712,
51,
11,
18074,
113,
3712,
51,
28,
352,
68,
12,
19,
8,
198,
220,
220,
220,
289,
86,
796,
9647,
1220,
362,
198,
220,
220,
220,
18074,
223,
796,
1976,
27498,
7,
51,
11,
288,
11,
288,
11,
288,
8,
628,
220,
220,
220,
997,
62,
13033,
796,
2546,
7,
34,
11,
362,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
374,
62,
9806,
62,
31166,
796,
3509,
7,
15,
11,
532,
38392,
61,
17,
1635,
2604,
7,
139,
113,
4008,
198,
220,
220,
220,
374,
62,
9806,
796,
19862,
17034,
7,
81,
62,
9806,
62,
31166,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
275,
796,
4314,
7,
5317,
11,
288,
1635,
374,
62,
9806,
1220,
9647,
8,
1343,
352,
198,
220,
220,
220,
220,
198,
220,
220,
220,
308,
796,
2824,
7,
21602,
10223,
32590,
36599,
11,
289,
86,
11,
288,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
259,
65,
3733,
329,
1312,
287,
352,
25,
22510,
62,
13033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
844,
796,
4314,
7,
5317,
11,
288,
1635,
357,
34,
58,
16,
11,
1312,
60,
1343,
289,
86,
8,
1220,
9647,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
88,
796,
4314,
7,
5317,
11,
288,
1635,
357,
34,
58,
17,
11,
1312,
60,
1343,
289,
86,
8,
1220,
9647,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
528,
796,
4314,
7,
5317,
11,
288,
1635,
357,
34,
58,
18,
11,
1312,
60,
1343,
289,
86,
8,
1220,
9647,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
1084,
796,
3509,
7,
16,
11,
220,
844,
532,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
1084,
796,
3509,
7,
16,
11,
1312,
88,
532,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
1084,
796,
3509,
7,
16,
11,
220,
528,
532,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
62,
9806,
796,
949,
7,
67,
11,
220,
844,
1343,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
331,
62,
9806,
796,
949,
7,
67,
11,
1312,
88,
1343,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
62,
9806,
796,
949,
7,
67,
11,
220,
528,
1343,
275,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
329,
474,
87,
287,
2124,
62,
1084,
25,
87,
62,
9806,
11,
474,
88,
287,
331,
62,
1084,
25,
88,
62,
9806,
11,
474,
89,
287,
1976,
62,
1084,
25,
89,
62,
9806,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
62,
31166,
796,
357,
34,
58,
16,
11,
1312,
60,
532,
308,
58,
73,
87,
12962,
61,
17,
1343,
357,
34,
58,
17,
11,
1312,
60,
532,
308,
58,
73,
88,
12962,
61,
17,
1343,
357,
34,
58,
18,
11,
1312,
60,
532,
308,
58,
73,
89,
12962,
61,
17,
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,
611,
374,
62,
31166,
1279,
374,
62,
9806,
62,
31166,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
223,
58,
73,
87,
11,
474,
88,
11,
474,
89,
60,
15853,
1033,
32590,
81,
62,
31166,
1220,
18074,
225,
61,
17,
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,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
18074,
223,
198,
437,
198,
198,
8818,
12109,
62,
25928,
90,
51,
92,
7,
87,
3712,
19182,
90,
51,
11,
513,
5512,
331,
3712,
19182,
90,
51,
11,
513,
5512,
1976,
3712,
19182,
90,
51,
11,
513,
5512,
327,
3712,
46912,
90,
51,
5512,
18074,
225,
3712,
51,
11,
18074,
113,
3712,
51,
796,
352,
68,
12,
19,
8,
198,
220,
220,
220,
360,
796,
2546,
7,
87,
8,
198,
220,
220,
220,
18074,
223,
796,
1976,
27498,
7,
51,
11,
360,
8,
628,
220,
220,
220,
997,
62,
13033,
796,
2546,
7,
34,
11,
362,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
371,
796,
13690,
35610,
17257,
7,
7857,
7,
33643,
4008,
198,
220,
220,
220,
314,
62,
1084,
11,
314,
62,
9806,
796,
717,
7,
49,
828,
938,
7,
49,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2124,
62,
43639,
796,
2124,
58,
40,
62,
9806,
60,
532,
2124,
58,
40,
62,
1084,
60,
198,
220,
220,
220,
331,
62,
43639,
796,
331,
58,
40,
62,
9806,
60,
532,
331,
58,
40,
62,
1084,
60,
198,
220,
220,
220,
1976,
62,
43639,
796,
1976,
58,
40,
62,
9806,
60,
532,
1976,
58,
40,
62,
1084,
60,
198,
220,
220,
220,
220,
198,
220,
220,
220,
374,
62,
9806,
62,
31166,
796,
3509,
7,
15,
11,
532,
38392,
61,
17,
1635,
2604,
7,
139,
113,
4008,
198,
220,
220,
220,
374,
62,
9806,
796,
19862,
17034,
7,
81,
62,
9806,
62,
31166,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
44332,
796,
4314,
7,
5317,
11,
360,
58,
16,
60,
1635,
374,
62,
9806,
1220,
2124,
62,
43639,
8,
1343,
352,
198,
220,
220,
220,
20268,
796,
4314,
7,
5317,
11,
360,
58,
17,
60,
1635,
374,
62,
9806,
1220,
331,
62,
43639,
8,
1343,
352,
198,
220,
220,
220,
288,
89,
796,
4314,
7,
5317,
11,
360,
58,
18,
60,
1635,
374,
62,
9806,
1220,
1976,
62,
43639,
8,
1343,
352,
628,
220,
220,
220,
347,
796,
13690,
35610,
15732,
19510,
34350,
11,
20268,
11,
288,
89,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
2488,
259,
65,
3733,
329,
1312,
287,
352,
25,
22510,
62,
13033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
844,
796,
4314,
7,
5317,
11,
360,
58,
16,
60,
1635,
357,
34,
58,
16,
11,
1312,
60,
532,
2124,
58,
40,
62,
1084,
12962,
1220,
2124,
62,
43639,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
88,
796,
4314,
7,
5317,
11,
360,
58,
17,
60,
1635,
357,
34,
58,
17,
11,
1312,
60,
532,
331,
58,
40,
62,
1084,
12962,
1220,
331,
62,
43639,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
528,
796,
4314,
7,
5317,
11,
360,
58,
18,
60,
1635,
357,
34,
58,
18,
11,
1312,
60,
532,
1976,
58,
40,
62,
1084,
12962,
1220,
1976,
62,
43639,
8,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
314,
796,
13690,
35610,
15732,
19510,
844,
11,
1312,
88,
11,
220,
528,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
329,
449,
287,
13690,
35610,
17257,
7,
9806,
7,
40,
62,
1084,
11,
314,
532,
347,
828,
949,
7,
40,
62,
9806,
11,
314,
1343,
347,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
374,
62,
31166,
796,
357,
34,
58,
16,
11,
1312,
60,
532,
2124,
58,
41,
12962,
61,
17,
1343,
357,
34,
58,
17,
11,
1312,
60,
532,
331,
58,
41,
12962,
61,
17,
1343,
357,
34,
58,
18,
11,
1312,
60,
532,
1976,
58,
41,
12962,
61,
17,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
374,
62,
31166,
1279,
374,
62,
9806,
62,
31166,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18074,
223,
58,
41,
60,
15853,
1033,
32590,
81,
62,
31166,
1220,
18074,
225,
61,
17,
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,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1441,
18074,
223,
198,
437,
198,
198,
8818,
12109,
62,
25928,
62,
34242,
90,
51,
92,
7,
10394,
3712,
51,
11,
288,
3712,
5317,
11,
18074,
225,
3712,
51,
11,
18074,
113,
3712,
51,
8,
198,
220,
220,
220,
374,
62,
9806,
796,
19862,
17034,
7,
9806,
7,
15,
11,
532,
38392,
61,
17,
1635,
2604,
7,
139,
113,
22305,
198,
220,
220,
220,
275,
796,
4314,
7,
5317,
11,
374,
62,
9806,
1220,
357,
10394,
1220,
288,
4008,
1343,
352,
198,
220,
220,
220,
997,
62,
27372,
796,
357,
17,
65,
1343,
352,
8,
61,
18,
198,
220,
220,
220,
220,
198,
220,
220,
220,
44872,
7203,
11518,
16874,
25,
29568,
81,
62,
9806,
8,
4943,
198,
220,
220,
220,
44872,
7203,
45356,
583,
15793,
25,
720,
65,
4943,
198,
220,
220,
220,
44872,
7203,
14957,
7021,
25,
29568,
22510,
62,
27372,
8,
4943,
198,
220,
220,
220,
24773,
7,
36886,
8,
198,
437,
198
] | 1.786047 | 1,935 |
struct Involute{T} <: JointType{T}
i::SVector{3, T}
j::SVector{3, T}
k::SVector{3, T}
ρ::T
ρ_inv::T
function Involute{T}(b_axis::AbstractVector,n_axis::AbstractVector,ρ::T) where {T}
j, k = map(axis -> normalize(SVector{3}(axis)), (n_axis, b_axis))
@assert isapprox(k ⋅ j, 0; atol = 100 * eps(T))
@assert ρ > 0
new{T}(j × k, j, k, ρ, inv(ρ))
end
end
@propagate_inbounds function joint_transform(jt::Involute, frame_after::CartesianFrame3D, frame_before::CartesianFrame3D, q::AbstractVector)
rot = RotMatrix(AngleAxis(jt.ρ_inv*q[1],jt.k[1],jt.k[2],jt.k[3],false))
trans = rot*(jt.ρ*jt.j+q[1]*jt.i)
Transform3D(frame_after,frame_before,rot,trans)
end
@propagate_inbounds function joint_twist(jt::Involute, frame_after::CartesianFrame3D, frame_before::CartesianFrame3D,
q::AbstractVector, v::AbstractVector)
angular = jt.ρ_inv*jt.k*v[1]
linear = jt.ρ_inv*q[1]*jt.j*v[1]
Twist(frame_after, frame_before, frame_after, angular, linear)
end
@propagate_inbounds function joint_spacial_acceleration(jt::Involute, frame_after::CartesianFrame3D, frame_before::CartesianFrame3D,
q::AbstractVector, v::AbstractVector, vd::AbstractVector)
S = promote_eltype(jt, q, v, vd)
angular = jt.ρ_inv*jt.k*vd[1]
linear = (jt.ρ_inv*q[1]*jt.j)*vd[1] + (jt.j-jt.ρ_inv*q[1]*jt.i)*jt.ρ_inv*v[1]^2
SpatialAcceleration{S}(frame_after, frame_before, frame_after, angular, linear)
end
@propagate_inbounds function bias_acceleration(jt::Involute, frame_after::CartesianFrame3D, frame_before::CartesianFrame3D,
q::AbstractVector, v::AbstractVector)
S = promote_eltype(jt, q, v)
linear = zero(SVector{3,S})
angular = (jt.j-jt.ρ_inv*q[1]*jt.i)*jt.ρ_inv*v[1]^2
SpatialAcceleration{S}(frame_after, frame_before, frame_after, angular,linear)
end
@propagate_inbounds function joint_torque!(τ::AbstractVector, jt::Involute, q::AbstractVector, joint_wrench::Wrench)
R = RotMatrix(AngleAxis(-jt.ρ_inv*q[1],jt.k[1],jt.k[2],jt.k[3],false))
τ[1] = jt.ρ_inv*q[1]*jt.j'*linear(joint_wrench) + ρ_inv*k'*angular(joint_wrench)
nothing
end
@inline function motion_subspace(jt::Involute, frame_after::CartesianFrame3D, frame_before::CartesianFrame3D,
q::AbstractVector)
S = promote_eltype(jt, q)
angular = hcat(zero(SMatrix{3,2,S}),jt.k)
linear = hcat(zero(SVector{3,S}),jt.j,zero(SVector{3,S}))
GeometricJacobian(frame_after, frame_before, frame_after, angular, linear)
end
@inline function constraint_wrench_subspace(jt::Involute, joint_transform::Transform3D)
S = promote_eltype(jt, joint_transform)
angular = hcat(jt.i, jt.j, zero(SVector{3, S}))
linear = hcat(jt.i, zero(SVector{3, S}), jt.k )
WrenchMatrix(joint_transform.from, angular, linear)
end | [
7249,
10001,
3552,
90,
51,
92,
1279,
25,
16798,
6030,
90,
51,
92,
198,
197,
72,
3712,
50,
38469,
90,
18,
11,
309,
92,
198,
197,
73,
3712,
50,
38469,
90,
18,
11,
309,
92,
198,
197,
74,
3712,
50,
38469,
90,
18,
11,
309,
92,
198,
197,
33643,
3712,
51,
198,
197,
33643,
62,
16340,
3712,
51,
628,
197,
8818,
10001,
3552,
90,
51,
92,
7,
65,
62,
22704,
3712,
23839,
38469,
11,
77,
62,
22704,
3712,
23839,
38469,
11,
33643,
3712,
51,
8,
810,
1391,
51,
92,
198,
197,
197,
73,
11,
479,
796,
3975,
7,
22704,
4613,
3487,
1096,
7,
50,
38469,
90,
18,
92,
7,
22704,
36911,
357,
77,
62,
22704,
11,
275,
62,
22704,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
318,
1324,
13907,
7,
74,
2343,
233,
227,
474,
11,
657,
26,
379,
349,
796,
1802,
1635,
304,
862,
7,
51,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
30493,
18074,
223,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
649,
90,
51,
92,
7,
73,
13958,
479,
11,
474,
11,
479,
11,
18074,
223,
11,
800,
7,
33643,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
6466,
62,
35636,
7,
73,
83,
3712,
19904,
3552,
11,
5739,
62,
8499,
3712,
43476,
35610,
19778,
18,
35,
11,
5739,
62,
19052,
3712,
43476,
35610,
19778,
18,
35,
11,
10662,
3712,
23839,
38469,
8,
198,
197,
10599,
796,
18481,
46912,
7,
13450,
293,
31554,
271,
7,
73,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
4357,
73,
83,
13,
74,
58,
16,
4357,
73,
83,
13,
74,
58,
17,
4357,
73,
83,
13,
74,
58,
18,
4357,
9562,
4008,
198,
197,
7645,
796,
5724,
9,
7,
73,
83,
13,
33643,
9,
73,
83,
13,
73,
10,
80,
58,
16,
60,
9,
73,
83,
13,
72,
8,
198,
197,
41762,
18,
35,
7,
14535,
62,
8499,
11,
14535,
62,
19052,
11,
10599,
11,
7645,
8,
198,
437,
198,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
6466,
62,
4246,
396,
7,
73,
83,
3712,
19904,
3552,
11,
5739,
62,
8499,
3712,
43476,
35610,
19778,
18,
35,
11,
5739,
62,
19052,
3712,
43476,
35610,
19778,
18,
35,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
3712,
23839,
38469,
11,
410,
3712,
23839,
38469,
8,
198,
197,
21413,
796,
474,
83,
13,
33643,
62,
16340,
9,
73,
83,
13,
74,
9,
85,
58,
16,
60,
198,
197,
29127,
796,
474,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
60,
9,
73,
83,
13,
73,
9,
85,
58,
16,
60,
198,
197,
5080,
396,
7,
14535,
62,
8499,
11,
5739,
62,
19052,
11,
5739,
62,
8499,
11,
32558,
11,
14174,
8,
198,
437,
198,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
6466,
62,
2777,
18150,
62,
330,
7015,
341,
7,
73,
83,
3712,
19904,
3552,
11,
5739,
62,
8499,
3712,
43476,
35610,
19778,
18,
35,
11,
5739,
62,
19052,
3712,
43476,
35610,
19778,
18,
35,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
3712,
23839,
38469,
11,
410,
3712,
23839,
38469,
11,
410,
67,
3712,
23839,
38469,
8,
198,
197,
50,
796,
7719,
62,
417,
4906,
7,
73,
83,
11,
10662,
11,
410,
11,
410,
67,
8,
198,
197,
21413,
796,
474,
83,
13,
33643,
62,
16340,
9,
73,
83,
13,
74,
9,
20306,
58,
16,
60,
198,
197,
29127,
796,
357,
73,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
60,
9,
73,
83,
13,
73,
27493,
20306,
58,
16,
60,
1343,
357,
73,
83,
13,
73,
12,
73,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
60,
9,
73,
83,
13,
72,
27493,
73,
83,
13,
33643,
62,
16340,
9,
85,
58,
16,
60,
61,
17,
198,
197,
4561,
34961,
12832,
7015,
341,
90,
50,
92,
7,
14535,
62,
8499,
11,
5739,
62,
19052,
11,
5739,
62,
8499,
11,
32558,
11,
14174,
8,
198,
437,
198,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
10690,
62,
330,
7015,
341,
7,
73,
83,
3712,
19904,
3552,
11,
5739,
62,
8499,
3712,
43476,
35610,
19778,
18,
35,
11,
5739,
62,
19052,
3712,
43476,
35610,
19778,
18,
35,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
3712,
23839,
38469,
11,
410,
3712,
23839,
38469,
8,
198,
220,
220,
220,
311,
796,
7719,
62,
417,
4906,
7,
73,
83,
11,
10662,
11,
410,
8,
198,
220,
220,
220,
14174,
796,
6632,
7,
50,
38469,
90,
18,
11,
50,
30072,
198,
220,
220,
220,
32558,
796,
357,
73,
83,
13,
73,
12,
73,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
60,
9,
73,
83,
13,
72,
27493,
73,
83,
13,
33643,
62,
16340,
9,
85,
58,
16,
60,
61,
17,
198,
220,
220,
220,
1338,
34961,
12832,
7015,
341,
90,
50,
92,
7,
14535,
62,
8499,
11,
5739,
62,
19052,
11,
5739,
62,
8499,
11,
32558,
11,
29127,
8,
198,
437,
198,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
6466,
62,
13165,
4188,
0,
7,
32830,
3712,
23839,
38469,
11,
474,
83,
3712,
19904,
3552,
11,
10662,
3712,
23839,
38469,
11,
6466,
62,
86,
3532,
3712,
54,
3532,
8,
198,
197,
49,
796,
18481,
46912,
7,
13450,
293,
31554,
271,
32590,
73,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
4357,
73,
83,
13,
74,
58,
16,
4357,
73,
83,
13,
74,
58,
17,
4357,
73,
83,
13,
74,
58,
18,
4357,
9562,
4008,
198,
197,
32830,
58,
16,
60,
796,
474,
83,
13,
33643,
62,
16340,
9,
80,
58,
16,
60,
9,
73,
83,
13,
73,
6,
9,
29127,
7,
73,
1563,
62,
86,
3532,
8,
1343,
18074,
223,
62,
16340,
9,
74,
6,
9,
21413,
7,
73,
1563,
62,
86,
3532,
8,
198,
197,
22366,
198,
437,
198,
198,
31,
45145,
2163,
6268,
62,
7266,
13200,
7,
73,
83,
3712,
19904,
3552,
11,
5739,
62,
8499,
3712,
43476,
35610,
19778,
18,
35,
11,
5739,
62,
19052,
3712,
43476,
35610,
19778,
18,
35,
11,
198,
220,
220,
220,
220,
220,
220,
220,
10662,
3712,
23839,
38469,
8,
198,
220,
220,
220,
311,
796,
7719,
62,
417,
4906,
7,
73,
83,
11,
10662,
8,
198,
197,
21413,
796,
289,
9246,
7,
22570,
7,
12310,
265,
8609,
90,
18,
11,
17,
11,
50,
92,
828,
73,
83,
13,
74,
8,
198,
197,
29127,
796,
289,
9246,
7,
22570,
7,
50,
38469,
90,
18,
11,
50,
92,
828,
73,
83,
13,
73,
11,
22570,
7,
50,
38469,
90,
18,
11,
50,
92,
4008,
198,
197,
10082,
16996,
46751,
666,
7,
14535,
62,
8499,
11,
5739,
62,
19052,
11,
5739,
62,
8499,
11,
32558,
11,
14174,
8,
198,
437,
198,
198,
31,
45145,
2163,
32315,
62,
86,
3532,
62,
7266,
13200,
7,
73,
83,
3712,
19904,
3552,
11,
6466,
62,
35636,
3712,
41762,
18,
35,
8,
198,
220,
220,
220,
311,
796,
7719,
62,
417,
4906,
7,
73,
83,
11,
6466,
62,
35636,
8,
198,
220,
220,
220,
32558,
796,
289,
9246,
7,
73,
83,
13,
72,
11,
474,
83,
13,
73,
11,
6632,
7,
50,
38469,
90,
18,
11,
311,
92,
4008,
198,
220,
220,
220,
14174,
796,
289,
9246,
7,
73,
83,
13,
72,
11,
6632,
7,
50,
38469,
90,
18,
11,
311,
92,
828,
474,
83,
13,
74,
1267,
198,
220,
220,
220,
370,
3532,
46912,
7,
73,
1563,
62,
35636,
13,
6738,
11,
32558,
11,
14174,
8,
198,
437
] | 2.192926 | 1,244 |
@testset "DataMatrix" begin
a = @data [1.0, 2.0, 3.0]
v_a = [1.0, 2.0, 3.0]
b = @data eye(3, 3)
m_b = eye(3, 3)
#
# Transposes
#
@test all(a' .== v_a')
@test all(a'' .== v_a'')
@test all(b' .== m_b')
@test all(b'' .== m_b'')
#
# DataVector * DataMatrix
#
# TODO: Get indexing for b[1, :] to work
# @test all(a * b[1, :] .== v_a * m_b[1, :])
#
# DataMatrix * DataVector
#
@test all(b * a .== m_b * v_a)
@test all(convert(Array, b * a) .== m_b * v_a)
#
# DataMatrix * DataMatrix
#
@test all(b * b .== m_b * m_b)
#
# DataVector * DataMatrix w/ missings
#
b[1, 1] = missing
res = a * b[1:1, :]
@test all(ismissing.(res[:, 1]))
@test all(.!(ismissing.(res[:, 2])))
@test all(.!(ismissing.(res[:, 3])))
res = a * b[2:2, :]
@test all(.!(ismissing.(res)))
#
# DataMatrix w missings * DataVector
#
res = b * a
@test ismissing.(res[1])
@test .!(ismissing.(res[2]))
@test .!(ismissing.(res[3]))
#
# DataMatrix * DataMatrix
#
res = b * b
# 3x3 Float64 DataMatrix:
# missing missing missing
# missing 1.0 0.0
# missing 0.0 1.0
@test ismissing.(res[1, 1])
@test ismissing.(res[1, 2])
@test ismissing.(res[1, 3])
@test ismissing.(res[2, 1])
@test .!(ismissing.(res[2, 2]))
@test .!(ismissing.(res[2, 3]))
@test ismissing.(res[3, 1])
@test .!(ismissing.(res[3, 2]))
@test .!(ismissing.(res[3, 3]))
res = b * @data eye(3)
# 3x3 Float64 DataMatrix:
# missing missing missing
# 0.0 1.0 0.0
# 0.0 0.0 1.0
@test ismissing.(res[1, 1])
@test ismissing.(res[1, 2])
@test ismissing.(res[1, 3])
@test .!(ismissing.(res[2, 1]))
@test .!(ismissing.(res[2, 2]))
@test .!(ismissing.(res[2, 3]))
@test .!(ismissing.(res[3, 1]))
@test .!(ismissing.(res[3, 2]))
@test .!(ismissing.(res[3, 3]))
res = (@data eye(3)) * b
# julia> dataeye(3) * b
# 3x3 Float64 DataMatrix:
# missing 0.0 0.0
# missing 1.0 0.0
# missing 0.0 1.0
@test ismissing.(res[1, 1])
@test .!(ismissing.(res[1, 2]))
@test .!(ismissing.(res[1, 3]))
@test ismissing.(res[2, 1])
@test .!(ismissing.(res[2, 2]))
@test .!(ismissing.(res[2, 3]))
@test ismissing.(res[3, 1])
@test .!(ismissing.(res[3, 2]))
@test .!(ismissing.(res[3, 3]))
# Test row operations
dm = @data eye(6, 2)
# rowmeans(dm)
# Test column operations
dm = @data eye(6, 2)
# colmeans(dm)
# Test linear algebra
du, dd, dv = svd((@data eye(3, 3)))
u, d, v = svd(eye(3, 3))
@test all(du .== u)
@test all(dd .== d)
@test all(dv .== v)
# Test elementary functions
dm = -(@data eye(5, 5))
@test all(abs(dm) .== eye(5, 5))
end
| [
31,
9288,
2617,
366,
6601,
46912,
1,
2221,
198,
220,
220,
220,
257,
796,
2488,
7890,
685,
16,
13,
15,
11,
362,
13,
15,
11,
513,
13,
15,
60,
198,
220,
220,
220,
410,
62,
64,
796,
685,
16,
13,
15,
11,
362,
13,
15,
11,
513,
13,
15,
60,
628,
220,
220,
220,
275,
796,
2488,
7890,
4151,
7,
18,
11,
513,
8,
198,
220,
220,
220,
285,
62,
65,
796,
4151,
7,
18,
11,
513,
8,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
3602,
4832,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
2488,
9288,
477,
7,
64,
6,
764,
855,
410,
62,
64,
11537,
198,
220,
220,
220,
2488,
9288,
477,
7,
64,
7061,
764,
855,
410,
62,
64,
7061,
8,
198,
220,
220,
220,
2488,
9288,
477,
7,
65,
6,
764,
855,
285,
62,
65,
11537,
198,
220,
220,
220,
2488,
9288,
477,
7,
65,
7061,
764,
855,
285,
62,
65,
7061,
8,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
38469,
1635,
6060,
46912,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
1303,
16926,
46,
25,
3497,
6376,
278,
329,
275,
58,
16,
11,
1058,
60,
284,
670,
198,
220,
220,
220,
1303,
2488,
9288,
477,
7,
64,
1635,
275,
58,
16,
11,
1058,
60,
764,
855,
410,
62,
64,
1635,
285,
62,
65,
58,
16,
11,
1058,
12962,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
46912,
1635,
6060,
38469,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
2488,
9288,
477,
7,
65,
1635,
257,
764,
855,
285,
62,
65,
1635,
410,
62,
64,
8,
198,
220,
220,
220,
2488,
9288,
477,
7,
1102,
1851,
7,
19182,
11,
275,
1635,
257,
8,
764,
855,
285,
62,
65,
1635,
410,
62,
64,
8,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
46912,
1635,
6060,
46912,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
2488,
9288,
477,
7,
65,
1635,
275,
764,
855,
285,
62,
65,
1635,
285,
62,
65,
8,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
38469,
1635,
6060,
46912,
266,
14,
2051,
654,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
275,
58,
16,
11,
352,
60,
796,
4814,
198,
220,
220,
220,
581,
796,
257,
1635,
275,
58,
16,
25,
16,
11,
1058,
60,
198,
220,
220,
220,
2488,
9288,
477,
7,
1042,
747,
278,
12195,
411,
58,
45299,
352,
60,
4008,
198,
220,
220,
220,
2488,
9288,
477,
7,
13,
0,
7,
1042,
747,
278,
12195,
411,
58,
45299,
362,
60,
22305,
198,
220,
220,
220,
2488,
9288,
477,
7,
13,
0,
7,
1042,
747,
278,
12195,
411,
58,
45299,
513,
60,
22305,
198,
220,
220,
220,
581,
796,
257,
1635,
275,
58,
17,
25,
17,
11,
1058,
60,
198,
220,
220,
220,
2488,
9288,
477,
7,
13,
0,
7,
1042,
747,
278,
12195,
411,
22305,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
46912,
266,
2051,
654,
1635,
6060,
38469,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
581,
796,
275,
1635,
257,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
60,
4008,
628,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
6060,
46912,
1635,
6060,
46912,
198,
220,
220,
220,
1303,
628,
220,
220,
220,
581,
796,
275,
1635,
275,
198,
220,
220,
220,
1303,
513,
87,
18,
48436,
2414,
6060,
46912,
25,
198,
220,
220,
220,
1303,
220,
4814,
220,
220,
4814,
220,
220,
4814,
198,
220,
220,
220,
1303,
220,
4814,
220,
352,
13,
15,
220,
657,
13,
15,
198,
220,
220,
220,
1303,
220,
4814,
220,
657,
13,
15,
220,
352,
13,
15,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
362,
12962,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
513,
12962,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
17,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
513,
60,
4008,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
18,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
513,
60,
4008,
628,
220,
220,
220,
581,
796,
275,
1635,
2488,
7890,
4151,
7,
18,
8,
198,
220,
220,
220,
1303,
513,
87,
18,
48436,
2414,
6060,
46912,
25,
198,
220,
220,
220,
1303,
220,
220,
4814,
220,
220,
4814,
220,
220,
4814,
198,
220,
220,
220,
1303,
220,
657,
13,
15,
220,
352,
13,
15,
220,
657,
13,
15,
198,
220,
220,
220,
1303,
220,
657,
13,
15,
220,
657,
13,
15,
220,
352,
13,
15,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
362,
12962,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
513,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
352,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
513,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
352,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
513,
60,
4008,
628,
220,
220,
220,
581,
796,
4275,
7890,
4151,
7,
18,
4008,
1635,
275,
198,
220,
220,
220,
1303,
474,
43640,
29,
1366,
25379,
7,
18,
8,
1635,
275,
198,
220,
220,
220,
1303,
513,
87,
18,
48436,
2414,
6060,
46912,
25,
198,
220,
220,
220,
1303,
220,
4814,
220,
657,
13,
15,
220,
657,
13,
15,
198,
220,
220,
220,
1303,
220,
4814,
220,
352,
13,
15,
220,
657,
13,
15,
198,
220,
220,
220,
1303,
220,
4814,
220,
657,
13,
15,
220,
352,
13,
15,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
16,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
16,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
16,
11,
513,
60,
4008,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
17,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
17,
11,
513,
60,
4008,
198,
220,
220,
220,
2488,
9288,
318,
45688,
12195,
411,
58,
18,
11,
352,
12962,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
362,
60,
4008,
198,
220,
220,
220,
2488,
9288,
764,
0,
7,
1042,
747,
278,
12195,
411,
58,
18,
11,
513,
60,
4008,
628,
220,
220,
220,
1303,
6208,
5752,
4560,
198,
220,
220,
220,
288,
76,
796,
2488,
7890,
4151,
7,
21,
11,
362,
8,
198,
220,
220,
220,
1303,
5752,
1326,
504,
7,
36020,
8,
628,
220,
220,
220,
1303,
6208,
5721,
4560,
198,
220,
220,
220,
288,
76,
796,
2488,
7890,
4151,
7,
21,
11,
362,
8,
198,
220,
220,
220,
1303,
951,
1326,
504,
7,
36020,
8,
628,
220,
220,
220,
1303,
6208,
14174,
37139,
198,
220,
220,
220,
7043,
11,
49427,
11,
288,
85,
796,
264,
20306,
19510,
31,
7890,
4151,
7,
18,
11,
513,
22305,
198,
220,
220,
220,
334,
11,
288,
11,
410,
796,
264,
20306,
7,
25379,
7,
18,
11,
513,
4008,
198,
220,
220,
220,
2488,
9288,
477,
7,
646,
764,
855,
334,
8,
198,
220,
220,
220,
2488,
9288,
477,
7,
1860,
764,
855,
288,
8,
198,
220,
220,
220,
2488,
9288,
477,
7,
67,
85,
764,
855,
410,
8,
628,
220,
220,
220,
1303,
6208,
19823,
5499,
198,
220,
220,
220,
288,
76,
796,
532,
7,
31,
7890,
4151,
7,
20,
11,
642,
4008,
198,
220,
220,
220,
2488,
9288,
477,
7,
8937,
7,
36020,
8,
764,
855,
4151,
7,
20,
11,
642,
4008,
198,
437,
198
] | 1.916223 | 1,504 |
immutable PersistentQueue{T}
in::AbstractList{T}
out::AbstractList{T}
length::Int
PersistentQueue(in::AbstractList{T}, out::AbstractList{T}, length::Int) =
new(in, out, length)
PersistentQueue() = new(EmptyList{T}(), EmptyList{T}(), 0)
end
PersistentQueue{T}(v::AbstractVector{T}) =
PersistentQueue{T}(EmptyList{T}(), reverse(PersistentList(v)), length(v))
queue = PersistentQueue
Base.length(q::PersistentQueue) = q.length
Base.isempty(q::PersistentQueue) = is(q.length, 0)
peek(q::PersistentQueue) = isempty(q.out) ? head(reverse(q.in)) : head(q.out)
pop{T}(q::PersistentQueue{T}) =
if isempty(q.out)
PersistentQueue{T}(EmptyList{T}(), tail(reverse(q.in)), length(q) - 1)
else
PersistentQueue{T}(q.in, tail(q.out), length(q) - 1)
end
enq{T}(q::PersistentQueue{T}, val) =
if isempty(q.in) && isempty(q.out)
PersistentQueue{T}(q.in, val..EmptyList{T}(), 1)
else
PersistentQueue{T}(val..q.in, q.out, length(q) + 1)
end
Base.start(q::PersistentQueue) = (q.in, q.out)
Base.done{T}(::PersistentQueue{T}, state::(@compat Tuple{EmptyList{T}, EmptyList{T}})) = true
Base.done(::PersistentQueue, state) = false
function Base.next{T}(::PersistentQueue{T}, state::(@compat Tuple{AbstractList{T},
PersistentList{T}}))
in, out = state
(head(out), (in, tail(out)))
end
function Base.next{T}(q::PersistentQueue{T}, state::(@compat Tuple{PersistentList{T},
EmptyList{T}}))
in, out = state
next(q, (EmptyList{T}(), reverse(in)))
end
| [
8608,
18187,
9467,
7609,
34991,
90,
51,
92,
198,
220,
220,
220,
287,
3712,
23839,
8053,
90,
51,
92,
198,
220,
220,
220,
503,
3712,
23839,
8053,
90,
51,
92,
198,
220,
220,
220,
4129,
3712,
5317,
628,
220,
220,
220,
9467,
7609,
34991,
7,
259,
3712,
23839,
8053,
90,
51,
5512,
503,
3712,
23839,
8053,
90,
51,
5512,
4129,
3712,
5317,
8,
796,
198,
220,
220,
220,
220,
220,
220,
220,
649,
7,
259,
11,
503,
11,
4129,
8,
628,
220,
220,
220,
9467,
7609,
34991,
3419,
796,
649,
7,
40613,
8053,
90,
51,
92,
22784,
33523,
8053,
90,
51,
92,
22784,
657,
8,
198,
437,
198,
198,
30946,
7609,
34991,
90,
51,
92,
7,
85,
3712,
23839,
38469,
90,
51,
30072,
796,
198,
220,
220,
220,
9467,
7609,
34991,
90,
51,
92,
7,
40613,
8053,
90,
51,
92,
22784,
9575,
7,
30946,
7609,
8053,
7,
85,
36911,
4129,
7,
85,
4008,
198,
198,
36560,
796,
9467,
7609,
34991,
198,
198,
14881,
13,
13664,
7,
80,
3712,
30946,
7609,
34991,
8,
796,
10662,
13,
13664,
198,
14881,
13,
271,
28920,
7,
80,
3712,
30946,
7609,
34991,
8,
796,
318,
7,
80,
13,
13664,
11,
657,
8,
198,
198,
431,
988,
7,
80,
3712,
30946,
7609,
34991,
8,
796,
318,
28920,
7,
80,
13,
448,
8,
5633,
1182,
7,
50188,
7,
80,
13,
259,
4008,
1058,
1182,
7,
80,
13,
448,
8,
198,
198,
12924,
90,
51,
92,
7,
80,
3712,
30946,
7609,
34991,
90,
51,
30072,
796,
198,
220,
220,
220,
611,
318,
28920,
7,
80,
13,
448,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
7609,
34991,
90,
51,
92,
7,
40613,
8053,
90,
51,
92,
22784,
7894,
7,
50188,
7,
80,
13,
259,
36911,
4129,
7,
80,
8,
532,
352,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
7609,
34991,
90,
51,
92,
7,
80,
13,
259,
11,
7894,
7,
80,
13,
448,
828,
4129,
7,
80,
8,
532,
352,
8,
198,
220,
220,
220,
886,
198,
198,
268,
80,
90,
51,
92,
7,
80,
3712,
30946,
7609,
34991,
90,
51,
5512,
1188,
8,
796,
198,
220,
220,
220,
611,
318,
28920,
7,
80,
13,
259,
8,
11405,
318,
28920,
7,
80,
13,
448,
8,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
7609,
34991,
90,
51,
92,
7,
80,
13,
259,
11,
1188,
492,
40613,
8053,
90,
51,
92,
22784,
352,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
9467,
7609,
34991,
90,
51,
92,
7,
2100,
492,
80,
13,
259,
11,
10662,
13,
448,
11,
4129,
7,
80,
8,
1343,
352,
8,
198,
220,
220,
220,
886,
198,
198,
14881,
13,
9688,
7,
80,
3712,
30946,
7609,
34991,
8,
796,
357,
80,
13,
259,
11,
10662,
13,
448,
8,
198,
14881,
13,
28060,
90,
51,
92,
7,
3712,
30946,
7609,
34991,
90,
51,
5512,
1181,
3712,
7,
31,
5589,
265,
309,
29291,
90,
40613,
8053,
90,
51,
5512,
33523,
8053,
90,
51,
11709,
4008,
796,
2081,
198,
14881,
13,
28060,
7,
3712,
30946,
7609,
34991,
11,
1181,
8,
796,
3991,
198,
198,
8818,
7308,
13,
19545,
90,
51,
92,
7,
3712,
30946,
7609,
34991,
90,
51,
5512,
1181,
3712,
7,
31,
5589,
265,
309,
29291,
90,
23839,
8053,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9467,
7609,
8053,
90,
51,
11709,
4008,
198,
220,
220,
220,
287,
11,
503,
796,
1181,
198,
220,
220,
220,
357,
2256,
7,
448,
828,
357,
259,
11,
7894,
7,
448,
22305,
198,
437,
198,
8818,
7308,
13,
19545,
90,
51,
92,
7,
80,
3712,
30946,
7609,
34991,
90,
51,
5512,
1181,
3712,
7,
31,
5589,
265,
309,
29291,
90,
30946,
7609,
8053,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33523,
8053,
90,
51,
11709,
4008,
198,
220,
220,
220,
287,
11,
503,
796,
1181,
198,
220,
220,
220,
1306,
7,
80,
11,
357,
40613,
8053,
90,
51,
92,
22784,
9575,
7,
259,
22305,
198,
437,
198
] | 2.111675 | 788 |
# m5.3.As.jl
using Pkg, DrWatson
using MonteCarloMeasurements
using StanSample
using StatisticalRethinking
# ### snippet 5.1
df = CSV.read(sr_datadir("WaffleDivorce.csv"), DataFrame);
scale!(df, [:Marriage, :MedianAgeMarriage, :Divorce])
# Define the Stan language model
stan5_3_A = "
data {
int N;
vector[N] divorce_s;
vector[N] marriage_s;
vector[N] medianagemarriage_s;
}
parameters {
real a;
real bA;
real bM;
real aM;
real bAM;
real<lower=0> sigma;
real<lower=0> sigma_M;
}
model {
// A -> D <- M
vector[N] mu = a + bA * medianagemarriage_s + bM * marriage_s;
a ~ normal( 0 , 0.2 );
bA ~ normal( 0 , 0.5 );
bM ~ normal( 0 , 0.5 );
sigma ~ exponential( 1 );
divorce_s ~ normal( mu , sigma );
// A -> M
vector[N] mu_M = aM + bAM * medianagemarriage_s;
aM ~ normal( 0 , 0.2 );
bAM ~ normal( 0 , 0.5 );
sigma_M ~ exponential( 1 );
marriage_s ~ normal( mu_M , sigma_M );
}
";
# Define the SampleModel
m5_3_As = SampleModel("m5.3_A", stan5_3_A);
# Input data
m5_3_A_data = Dict(
"N" => size(df, 1),
"divorce_s" => df[:, :Divorce_s],
"marriage_s" => df[:, :Marriage_s],
"medianagemarriage_s" => df[:, :MedianAgeMarriage_s]
);
# Sample using cmdstan's sampling option
rc5_3_As = stan_sample(m5_3_As, data=m5_3_A_data);
if success(rc5_3_As)
# Describe the draws
part5_3_As = read_samples(m5_3_As, :particles)
part5_3_As |> display
end
# End of m5.3.As.jl | [
2,
285,
20,
13,
18,
13,
1722,
13,
20362,
198,
198,
3500,
350,
10025,
11,
1583,
54,
13506,
198,
198,
3500,
22489,
9914,
5439,
47384,
902,
198,
3500,
7299,
36674,
198,
3500,
34931,
49,
2788,
8040,
198,
198,
2,
44386,
39442,
642,
13,
16,
198,
198,
7568,
796,
44189,
13,
961,
7,
27891,
62,
19608,
324,
343,
7203,
54,
30697,
24095,
8387,
13,
40664,
12340,
6060,
19778,
1776,
198,
9888,
0,
7,
7568,
11,
685,
25,
7676,
4087,
11,
1058,
9921,
666,
23396,
7676,
4087,
11,
1058,
24095,
8387,
12962,
198,
198,
2,
2896,
500,
262,
7299,
3303,
2746,
198,
198,
14192,
20,
62,
18,
62,
32,
796,
366,
198,
7890,
1391,
198,
220,
220,
220,
493,
399,
26,
198,
220,
220,
220,
15879,
58,
45,
60,
13609,
62,
82,
26,
198,
220,
220,
220,
15879,
58,
45,
60,
4845,
62,
82,
26,
198,
220,
220,
220,
15879,
58,
45,
60,
14288,
363,
368,
283,
4087,
62,
82,
26,
198,
92,
198,
17143,
7307,
1391,
198,
220,
220,
220,
1103,
257,
26,
198,
220,
220,
220,
1103,
275,
32,
26,
198,
220,
220,
220,
1103,
275,
44,
26,
198,
220,
220,
220,
1103,
257,
44,
26,
198,
220,
220,
220,
1103,
275,
2390,
26,
198,
220,
220,
220,
1103,
27,
21037,
28,
15,
29,
264,
13495,
26,
198,
220,
220,
220,
1103,
27,
21037,
28,
15,
29,
264,
13495,
62,
44,
26,
198,
92,
198,
19849,
1391,
198,
220,
220,
220,
3373,
317,
4613,
360,
24293,
337,
198,
220,
220,
220,
15879,
58,
45,
60,
38779,
796,
257,
1343,
275,
32,
1635,
14288,
363,
368,
283,
4087,
62,
82,
1343,
275,
44,
1635,
4845,
62,
82,
26,
198,
220,
220,
220,
257,
5299,
3487,
7,
657,
837,
657,
13,
17,
5619,
198,
220,
220,
220,
275,
32,
5299,
3487,
7,
657,
837,
657,
13,
20,
5619,
198,
220,
220,
220,
275,
44,
5299,
3487,
7,
657,
837,
657,
13,
20,
5619,
198,
220,
220,
220,
264,
13495,
5299,
39682,
7,
352,
5619,
198,
220,
220,
220,
13609,
62,
82,
5299,
3487,
7,
38779,
837,
264,
13495,
5619,
198,
220,
220,
220,
3373,
317,
4613,
337,
198,
220,
220,
220,
15879,
58,
45,
60,
38779,
62,
44,
796,
257,
44,
1343,
275,
2390,
1635,
14288,
363,
368,
283,
4087,
62,
82,
26,
198,
220,
220,
220,
257,
44,
5299,
3487,
7,
657,
837,
657,
13,
17,
5619,
198,
220,
220,
220,
275,
2390,
5299,
3487,
7,
657,
837,
657,
13,
20,
5619,
198,
220,
220,
220,
264,
13495,
62,
44,
5299,
39682,
7,
352,
5619,
198,
220,
220,
220,
4845,
62,
82,
5299,
3487,
7,
38779,
62,
44,
837,
264,
13495,
62,
44,
5619,
198,
92,
198,
8172,
198,
198,
2,
2896,
500,
262,
27565,
17633,
198,
76,
20,
62,
18,
62,
1722,
796,
27565,
17633,
7203,
76,
20,
13,
18,
62,
32,
1600,
336,
272,
20,
62,
18,
62,
32,
1776,
198,
198,
2,
23412,
1366,
198,
198,
76,
20,
62,
18,
62,
32,
62,
7890,
796,
360,
713,
7,
198,
220,
220,
220,
366,
45,
1,
5218,
2546,
7,
7568,
11,
352,
828,
220,
198,
220,
220,
220,
366,
7146,
8387,
62,
82,
1,
5218,
47764,
58,
45299,
1058,
24095,
8387,
62,
82,
4357,
198,
220,
220,
220,
366,
45394,
62,
82,
1,
5218,
47764,
58,
45299,
1058,
7676,
4087,
62,
82,
4357,
198,
220,
220,
220,
366,
1150,
666,
363,
368,
283,
4087,
62,
82,
1,
5218,
47764,
58,
45299,
1058,
9921,
666,
23396,
7676,
4087,
62,
82,
60,
220,
198,
1776,
198,
198,
2,
27565,
1262,
23991,
14192,
338,
19232,
3038,
198,
198,
6015,
20,
62,
18,
62,
1722,
796,
336,
272,
62,
39873,
7,
76,
20,
62,
18,
62,
1722,
11,
1366,
28,
76,
20,
62,
18,
62,
32,
62,
7890,
1776,
198,
198,
361,
1943,
7,
6015,
20,
62,
18,
62,
1722,
8,
628,
220,
220,
220,
1303,
39373,
4892,
262,
14293,
628,
220,
220,
220,
636,
20,
62,
18,
62,
1722,
796,
1100,
62,
82,
12629,
7,
76,
20,
62,
18,
62,
1722,
11,
1058,
3911,
2983,
8,
198,
220,
220,
220,
636,
20,
62,
18,
62,
1722,
930,
29,
3359,
198,
198,
437,
198,
198,
2,
5268,
286,
285,
20,
13,
18,
13,
1722,
13,
20362
] | 2.122333 | 703 |
"""
plot(net::HybridNetwork, method::Symbol)
Plot a network using R graphics.
`method` should be `:R` (actually, any symbol would do, for now!).
optional arguments, shared with the Gadfly-based plot function:
- useEdgeLength: if true, the tree edges and major hybrid edges are
drawn proportionally to their length. Minor hybrid edges are not, however.
Note that edge lengths in coalescent units may scale very poorly with time.
- showTipLabel: if true, taxon labels are shown. You may need to zoom out to see them.
- showNodeNumber: if true, nodes are labelled with the number used internally.
- showEdgeLength: if true, edges are labelled with their length (above)
- showGamma: if true, hybrid edges are labelled with their heritability (below)
- edgeColor: color for tree edges. black by default.
- majorHybridEdgeColor: color for major hybrid edges
- minorHybridEdgeColor: color for minor hybrid edges
- showEdgeNumber: if true, edges are labelled with the number used internally.
- showIntNodeLabel: if true, internal nodes are labelled with their names.
Useful for hybrid nodes, which do have tags like 'H1'.
- edgeLabel: dataframe with two columns: the first with edge numbers, the second with labels
(like bootstrap values) to annotate edges. empty by default.
- nodeLabel: dataframe with two columns: the first with node numbers, the second with labels
(like bootstrap values for hybrid relationships) to annotate nodes. empty by default.
optional arguments specific to this function:
- xlim, ylim: array of 2 values
- tipOffset: to offset tip labels
Note that `plot` actually modifies some (minor) attributes of the network,
as it calls `directEdges!`, `preorder!` and `cladewiseorder!`.
If hybrid edges cross tree and major edges, you may choose to rotate some tree
edges to eliminate crossing edges, using `rotate!`
(in [`PhyloNetworks`](http://crsl4.github.io/PhyloNetworks.jl/latest/lib/public/#PhyloNetworks.rotate!)).
**Alternative**: a tree or network can be exported with [`sexp`](@ref)
and then displayed with R's "plot" and all its options.
"""
function plot(net::HybridNetwork, method::Symbol; useEdgeLength=false::Bool,
mainTree=false::Bool, showTipLabel=true::Bool, showNodeNumber=false::Bool,
showEdgeLength=false::Bool, showGamma=false::Bool,
edgeColor="black"::String,
majorHybridEdgeColor="deepskyblue4"::String,
minorHybridEdgeColor="deepskyblue"::String,
showEdgeNumber=false::Bool, showIntNodeLabel=true::Bool,
edgeLabel=DataFrame()::DataFrame, nodeLabel=DataFrame()::DataFrame,
xlim=Float64[]::Array{Float64,1}, ylim=Float64[]::Array{Float64,1},
tipOffset=0.0::Float64, tipcex=1.0::Float64)
(edge_xB, edge_xE, edge_yB, edge_yE, node_x, node_y, node_yB, node_yE,
xmin, xmax, ymin, ymax) = getEdgeNodeCoordinates(net, useEdgeLength)
labelnodes, nodeLabel = checkNodeDataFrame(net, nodeLabel)
ndf = prepareNodeDataFrame(net, nodeLabel, showNodeNumber,
showIntNodeLabel, labelnodes, node_x, node_y)
if (showTipLabel || showNodeNumber || showIntNodeLabel || labelnodes)
expfac = 0.1 # force 10% more space to show tip/node/root name
expfacy = 0.5 # additive expansion for y axis
xmin -= (xmax-xmin)*expfac
xmax += (xmax-xmin)*expfac
ymin -= expfacy
ymax += expfacy
end
xmax += tipOffset
if length(xlim)==2
xmin=xlim[1]; xmax=xlim[2]
end
if length(ylim)==2
ymin=ylim[1]; ymax=ylim[2]
end
leaves = [n.leaf for n in net.node]
eCol = fill(edgeColor, length(net.edge))
eCol[ [ e.hybrid for e in net.edge] ] .= majorHybridEdgeColor
eCol[ [!e.isMajor for e in net.edge] ] .= minorHybridEdgeColor
R"""
plot($(node_x[leaves]), $(node_y[leaves]), type='n',
xlim=c($xmin,$xmax), ylim=c($ymin,$ymax),
axes=FALSE, xlab='', ylab='')
segments($edge_xB, $edge_yB, $edge_xE, $edge_yE, col=$eCol)
segments($node_x, $node_yB, $node_x, $node_yE, col=$edgeColor)
"""
if showTipLabel
R"text"(node_x[leaves] .+ tipOffset, node_y[leaves],
tipLabels(net), adj=0, font=3, cex=tipcex)
end
if showIntNodeLabel
R"text"(ndf[.!ndf[!,:lea],:x], ndf[.!ndf[!,:lea],:y],
ndf[.!ndf[!,:lea],:name], font=3, cex=tipcex, adj=[.5,0])
end
if showNodeNumber
R"text"(ndf[!,:x], ndf[!,:y], ndf[!,:num], adj=1)
end
if labelnodes
R"text"(ndf[!,:x], ndf[!,:y], ndf[!,:lab], adj=1)
end
labeledges, edf = prepareEdgeDataFrame(net, edgeLabel, mainTree,
edge_xB, edge_xE, edge_yB, edge_yE)
if labeledges
R"text"(edf[!,:x], edf[!,:y], edf[!,:lab], adj=[.5,0])
end
if showEdgeLength
R"text"(edf[!,:x], edf[!,:y], edf[!,:len], adj=[.5,1.])
end
if (showGamma && net.numHybrids>0)
im = edf[!,:hyb] .& edf[!,:min]
iM = edf[!,:hyb] .& .!edf[!,:min]
R"text"(edf[im,:x], edf[im,:y], edf[im,:gam],
adj=[.5,1], col=minorHybridEdgeColor)
R"text"(edf[iM,:x], edf[iM,:y], edf[iM,:gam],
adj=[.5,1], col=majorHybridEdgeColor)
end
if showEdgeNumber
R"text"(edf[!,:x], edf[!,:y], edf[!,:num], adj=[.5,0])
end
return (xmin, xmax, ymin, ymax, node_x, node_y, node_yB, node_yE,
edge_xB, edge_xE, edge_yB, edge_yE, ndf, edf)
end
| [
37811,
198,
220,
220,
220,
7110,
7,
3262,
3712,
21217,
10236,
26245,
11,
2446,
3712,
13940,
23650,
8,
198,
198,
43328,
257,
3127,
1262,
371,
9382,
13,
198,
63,
24396,
63,
815,
307,
4600,
25,
49,
63,
357,
37739,
11,
597,
6194,
561,
466,
11,
329,
783,
19588,
198,
198,
25968,
7159,
11,
4888,
351,
262,
20925,
12254,
12,
3106,
7110,
2163,
25,
198,
12,
779,
37021,
24539,
25,
611,
2081,
11,
262,
5509,
13015,
290,
1688,
14554,
13015,
389,
198,
220,
7428,
9823,
453,
284,
511,
4129,
13,
15367,
14554,
13015,
389,
407,
11,
2158,
13,
198,
220,
5740,
326,
5743,
20428,
287,
46064,
1087,
4991,
743,
5046,
845,
13455,
351,
640,
13,
198,
12,
905,
28434,
33986,
25,
611,
2081,
11,
1687,
261,
14722,
389,
3402,
13,
921,
743,
761,
284,
19792,
503,
284,
766,
606,
13,
198,
12,
905,
19667,
15057,
25,
611,
2081,
11,
13760,
389,
30538,
351,
262,
1271,
973,
20947,
13,
198,
12,
905,
37021,
24539,
25,
611,
2081,
11,
13015,
389,
30538,
351,
511,
4129,
357,
29370,
8,
198,
12,
905,
34777,
2611,
25,
611,
2081,
11,
14554,
13015,
389,
30538,
351,
511,
607,
34147,
357,
35993,
8,
198,
12,
5743,
10258,
25,
3124,
329,
5509,
13015,
13,
2042,
416,
4277,
13,
198,
12,
1688,
21217,
10236,
37021,
10258,
25,
3124,
329,
1688,
14554,
13015,
198,
12,
4159,
21217,
10236,
37021,
10258,
25,
3124,
329,
4159,
14554,
13015,
198,
12,
905,
37021,
15057,
25,
611,
2081,
11,
13015,
389,
30538,
351,
262,
1271,
973,
20947,
13,
198,
12,
905,
5317,
19667,
33986,
25,
611,
2081,
11,
5387,
13760,
389,
30538,
351,
511,
3891,
13,
198,
220,
49511,
329,
14554,
13760,
11,
543,
466,
423,
15940,
588,
705,
39,
16,
4458,
198,
12,
5743,
33986,
25,
1366,
14535,
351,
734,
15180,
25,
262,
717,
351,
5743,
3146,
11,
262,
1218,
351,
14722,
198,
220,
357,
2339,
6297,
26418,
3815,
8,
284,
24708,
378,
13015,
13,
6565,
416,
4277,
13,
198,
12,
10139,
33986,
25,
1366,
14535,
351,
734,
15180,
25,
262,
717,
351,
10139,
3146,
11,
262,
1218,
351,
14722,
198,
220,
357,
2339,
6297,
26418,
3815,
329,
14554,
6958,
8,
284,
24708,
378,
13760,
13,
6565,
416,
4277,
13,
198,
198,
25968,
7159,
2176,
284,
428,
2163,
25,
198,
12,
2124,
2475,
11,
331,
2475,
25,
7177,
286,
362,
3815,
198,
12,
8171,
34519,
25,
284,
11677,
8171,
14722,
198,
198,
6425,
326,
4600,
29487,
63,
1682,
953,
6945,
617,
357,
1084,
273,
8,
12608,
286,
262,
3127,
11,
198,
292,
340,
3848,
4600,
12942,
7407,
3212,
0,
47671,
4600,
3866,
2875,
0,
63,
290,
4600,
29853,
413,
786,
2875,
0,
44646,
198,
198,
1532,
14554,
13015,
3272,
5509,
290,
1688,
13015,
11,
345,
743,
3853,
284,
23064,
617,
5509,
198,
276,
3212,
284,
11005,
12538,
13015,
11,
1262,
4600,
10599,
378,
0,
63,
198,
7,
259,
685,
63,
2725,
2645,
78,
7934,
5225,
63,
16151,
4023,
1378,
66,
3808,
75,
19,
13,
12567,
13,
952,
14,
2725,
2645,
78,
7934,
5225,
13,
20362,
14,
42861,
14,
8019,
14,
11377,
31113,
2725,
2645,
78,
7934,
5225,
13,
10599,
378,
8133,
737,
198,
198,
1174,
49788,
1174,
25,
257,
5509,
393,
3127,
460,
307,
29050,
351,
685,
63,
8044,
79,
63,
16151,
31,
5420,
8,
198,
392,
788,
9066,
351,
371,
338,
366,
29487,
1,
290,
477,
663,
3689,
13,
198,
37811,
198,
8818,
7110,
7,
3262,
3712,
21217,
10236,
26245,
11,
2446,
3712,
13940,
23650,
26,
779,
37021,
24539,
28,
9562,
3712,
33,
970,
11,
198,
220,
220,
220,
1388,
27660,
28,
9562,
3712,
33,
970,
11,
905,
28434,
33986,
28,
7942,
3712,
33,
970,
11,
905,
19667,
15057,
28,
9562,
3712,
33,
970,
11,
198,
220,
220,
220,
905,
37021,
24539,
28,
9562,
3712,
33,
970,
11,
905,
34777,
2611,
28,
9562,
3712,
33,
970,
11,
198,
220,
220,
220,
5743,
10258,
2625,
13424,
1298,
25,
10100,
11,
198,
220,
220,
220,
1688,
21217,
10236,
37021,
10258,
2625,
22089,
15688,
17585,
19,
1298,
25,
10100,
11,
198,
220,
220,
220,
4159,
21217,
10236,
37021,
10258,
2625,
22089,
15688,
17585,
1298,
25,
10100,
11,
198,
220,
220,
220,
905,
37021,
15057,
28,
9562,
3712,
33,
970,
11,
905,
5317,
19667,
33986,
28,
7942,
3712,
33,
970,
11,
198,
220,
220,
220,
5743,
33986,
28,
6601,
19778,
33529,
25,
6601,
19778,
11,
10139,
33986,
28,
6601,
19778,
33529,
25,
6601,
19778,
11,
198,
220,
220,
220,
2124,
2475,
28,
43879,
2414,
21737,
3712,
19182,
90,
43879,
2414,
11,
16,
5512,
331,
2475,
28,
43879,
2414,
21737,
3712,
19182,
90,
43879,
2414,
11,
16,
5512,
198,
220,
220,
220,
8171,
34519,
28,
15,
13,
15,
3712,
43879,
2414,
11,
8171,
344,
87,
28,
16,
13,
15,
3712,
43879,
2414,
8,
628,
220,
220,
220,
357,
14907,
62,
87,
33,
11,
5743,
62,
87,
36,
11,
5743,
62,
88,
33,
11,
5743,
62,
88,
36,
11,
10139,
62,
87,
11,
10139,
62,
88,
11,
10139,
62,
88,
33,
11,
10139,
62,
88,
36,
11,
198,
220,
220,
220,
220,
2124,
1084,
11,
2124,
9806,
11,
331,
1084,
11,
331,
9806,
8,
796,
651,
37021,
19667,
7222,
585,
17540,
7,
3262,
11,
779,
37021,
24539,
8,
198,
220,
220,
220,
6167,
77,
4147,
11,
10139,
33986,
796,
2198,
19667,
6601,
19778,
7,
3262,
11,
10139,
33986,
8,
198,
220,
220,
220,
299,
7568,
796,
8335,
19667,
6601,
19778,
7,
3262,
11,
10139,
33986,
11,
905,
19667,
15057,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
905,
5317,
19667,
33986,
11,
6167,
77,
4147,
11,
10139,
62,
87,
11,
10139,
62,
88,
8,
198,
220,
220,
220,
611,
357,
12860,
28434,
33986,
8614,
905,
19667,
15057,
8614,
905,
5317,
19667,
33986,
8614,
6167,
77,
4147,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1033,
38942,
796,
657,
13,
16,
220,
1303,
2700,
838,
4,
517,
2272,
284,
905,
8171,
14,
17440,
14,
15763,
1438,
198,
220,
220,
220,
220,
220,
220,
220,
1033,
69,
1590,
796,
657,
13,
20,
1303,
38298,
7118,
329,
331,
16488,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
1084,
48185,
357,
87,
9806,
12,
87,
1084,
27493,
11201,
38942,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
9806,
15853,
357,
87,
9806,
12,
87,
1084,
27493,
11201,
38942,
198,
220,
220,
220,
220,
220,
220,
220,
331,
1084,
48185,
1033,
69,
1590,
198,
220,
220,
220,
220,
220,
220,
220,
331,
9806,
15853,
1033,
69,
1590,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2124,
9806,
15853,
8171,
34519,
198,
220,
220,
220,
611,
4129,
7,
87,
2475,
8,
855,
17,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
1084,
28,
87,
2475,
58,
16,
11208,
2124,
9806,
28,
87,
2475,
58,
17,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
4129,
7,
88,
2475,
8,
855,
17,
198,
220,
220,
220,
220,
220,
220,
220,
331,
1084,
28,
88,
2475,
58,
16,
11208,
331,
9806,
28,
88,
2475,
58,
17,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
5667,
796,
685,
77,
13,
33201,
329,
299,
287,
2010,
13,
17440,
60,
198,
220,
220,
220,
304,
5216,
796,
6070,
7,
14907,
10258,
11,
4129,
7,
3262,
13,
14907,
4008,
198,
220,
220,
220,
304,
5216,
58,
685,
304,
13,
12114,
10236,
220,
329,
304,
287,
2010,
13,
14907,
60,
2361,
764,
28,
1688,
21217,
10236,
37021,
10258,
198,
220,
220,
220,
304,
5216,
58,
685,
0,
68,
13,
271,
24206,
329,
304,
287,
2010,
13,
14907,
60,
2361,
764,
28,
4159,
21217,
10236,
37021,
10258,
628,
198,
220,
220,
220,
371,
37811,
198,
220,
220,
220,
7110,
16763,
7,
17440,
62,
87,
58,
293,
3080,
46570,
29568,
17440,
62,
88,
58,
293,
3080,
46570,
2099,
11639,
77,
3256,
198,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
2475,
28,
66,
16763,
87,
1084,
11,
3,
87,
9806,
828,
331,
2475,
28,
66,
16763,
88,
1084,
11,
3,
4948,
897,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
34197,
28,
37,
23719,
11,
2124,
23912,
11639,
3256,
331,
23912,
28,
7061,
8,
198,
220,
220,
220,
17894,
16763,
14907,
62,
87,
33,
11,
720,
14907,
62,
88,
33,
11,
720,
14907,
62,
87,
36,
11,
720,
14907,
62,
88,
36,
11,
951,
43641,
68,
5216,
8,
198,
220,
220,
220,
17894,
16763,
17440,
62,
87,
11,
720,
17440,
62,
88,
33,
11,
720,
17440,
62,
87,
11,
720,
17440,
62,
88,
36,
11,
951,
43641,
14907,
10258,
8,
198,
220,
220,
220,
37227,
198,
220,
220,
220,
611,
905,
28434,
33986,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
17440,
62,
87,
58,
293,
3080,
60,
764,
10,
8171,
34519,
11,
10139,
62,
88,
58,
293,
3080,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8171,
17822,
1424,
7,
3262,
828,
9224,
28,
15,
11,
10369,
28,
18,
11,
269,
1069,
28,
22504,
344,
87,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
905,
5317,
19667,
33986,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
358,
69,
58,
13,
0,
358,
69,
58,
28265,
25,
293,
64,
4357,
25,
87,
4357,
299,
7568,
58,
13,
0,
358,
69,
58,
28265,
25,
293,
64,
4357,
25,
88,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
7568,
58,
13,
0,
358,
69,
58,
28265,
25,
293,
64,
4357,
25,
3672,
4357,
10369,
28,
18,
11,
269,
1069,
28,
22504,
344,
87,
11,
9224,
41888,
13,
20,
11,
15,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
905,
19667,
15057,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
358,
69,
58,
28265,
25,
87,
4357,
299,
7568,
58,
28265,
25,
88,
4357,
299,
7568,
58,
28265,
25,
22510,
4357,
9224,
28,
16,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
6167,
77,
4147,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
358,
69,
58,
28265,
25,
87,
4357,
299,
7568,
58,
28265,
25,
88,
4357,
299,
7568,
58,
28265,
25,
23912,
4357,
9224,
28,
16,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
15494,
3212,
11,
1225,
69,
796,
8335,
37021,
6601,
19778,
7,
3262,
11,
5743,
33986,
11,
1388,
27660,
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,
5743,
62,
87,
33,
11,
5743,
62,
87,
36,
11,
5743,
62,
88,
33,
11,
5743,
62,
88,
36,
8,
198,
220,
220,
220,
611,
15494,
3212,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
276,
69,
58,
28265,
25,
87,
4357,
1225,
69,
58,
28265,
25,
88,
4357,
1225,
69,
58,
28265,
25,
23912,
4357,
9224,
41888,
13,
20,
11,
15,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
905,
37021,
24539,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
276,
69,
58,
28265,
25,
87,
4357,
1225,
69,
58,
28265,
25,
88,
4357,
1225,
69,
58,
28265,
25,
11925,
4357,
9224,
41888,
13,
20,
11,
16,
8183,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
357,
12860,
34777,
2611,
11405,
2010,
13,
22510,
21217,
40637,
29,
15,
8,
198,
220,
220,
220,
220,
220,
545,
796,
1225,
69,
58,
28265,
25,
12114,
65,
60,
764,
5,
1225,
69,
58,
28265,
25,
1084,
60,
198,
220,
220,
220,
220,
220,
1312,
44,
796,
1225,
69,
58,
28265,
25,
12114,
65,
60,
764,
5,
764,
0,
276,
69,
58,
28265,
25,
1084,
60,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
276,
69,
58,
320,
11,
25,
87,
4357,
1225,
69,
58,
320,
11,
25,
88,
4357,
1225,
69,
58,
320,
11,
25,
28483,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9224,
41888,
13,
20,
11,
16,
4357,
951,
28,
1084,
273,
21217,
10236,
37021,
10258,
8,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
276,
69,
58,
72,
44,
11,
25,
87,
4357,
1225,
69,
58,
72,
44,
11,
25,
88,
4357,
1225,
69,
58,
72,
44,
11,
25,
28483,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9224,
41888,
13,
20,
11,
16,
4357,
951,
28,
22478,
21217,
10236,
37021,
10258,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
905,
37021,
15057,
198,
220,
220,
220,
220,
220,
371,
1,
5239,
18109,
276,
69,
58,
28265,
25,
87,
4357,
1225,
69,
58,
28265,
25,
88,
4357,
1225,
69,
58,
28265,
25,
22510,
4357,
9224,
41888,
13,
20,
11,
15,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
357,
87,
1084,
11,
2124,
9806,
11,
331,
1084,
11,
331,
9806,
11,
10139,
62,
87,
11,
10139,
62,
88,
11,
10139,
62,
88,
33,
11,
10139,
62,
88,
36,
11,
198,
220,
220,
220,
220,
220,
5743,
62,
87,
33,
11,
5743,
62,
87,
36,
11,
5743,
62,
88,
33,
11,
5743,
62,
88,
36,
11,
299,
7568,
11,
1225,
69,
8,
198,
437,
198
] | 2.436588 | 2,192 |
using EVQueues, PGFPlots
lambda=120.0;
mu=1.0;
gamma=0.5;
#C=80.0;
C=60.0;
Tfinal=100.0;
edf = ev_edf(lambda,mu,gamma,Tfinal,C,snapshots=[Tfinal])
llf = ev_llf(lambda,mu,gamma,Tfinal,C,snapshots=[Tfinal])
llr = ev_llr(lambda,mu,gamma,Tfinal,C,snapshots=[Tfinal])
#compute_statistics!(sim)
fig = Axis([
Plots.Linear([ev.requestedEnergy for ev in edf.EVs][6000:10:end],[ev.requestedEnergy-ev.departureWorkload for ev in edf.EVs][6000:10:end], style="solid,only marks=true,blue", legendentry="EDF"),
Plots.Linear([ev.requestedEnergy for ev in llf.EVs][6000:10:end],[ev.requestedEnergy-ev.departureWorkload for ev in llf.EVs][6000:10:end], style="solid,only marks=true,red", legendentry="LLF"),
Plots.Linear([ev.requestedEnergy for ev in llr.EVs][6000:10:end],[ev.requestedEnergy-ev.departureWorkload for ev in llr.EVs][6000:10:end], style="solid,only marks=true,green", legendentry="LLR"),
],
legendPos="north west", xlabel="Requested Service (\$S\$)", ylabel="Attained Service (\$S_r\$)", xmin=0, xmax=3, ymin=0, ymax=3, width="0.7\\columnwidth", height="0.4\\columnwidth"
);
save("/tmp/sigma_compare.tex",fig,include_preamble=false)
| [
3500,
8696,
15681,
947,
11,
350,
21713,
3646,
1747,
198,
198,
50033,
28,
10232,
13,
15,
26,
198,
30300,
28,
16,
13,
15,
26,
198,
28483,
2611,
28,
15,
13,
20,
26,
198,
2,
34,
28,
1795,
13,
15,
26,
198,
34,
28,
1899,
13,
15,
26,
198,
198,
51,
20311,
28,
3064,
13,
15,
26,
628,
198,
276,
69,
796,
819,
62,
276,
69,
7,
50033,
11,
30300,
11,
28483,
2611,
11,
51,
20311,
11,
34,
11,
45380,
20910,
41888,
51,
20311,
12962,
198,
297,
69,
796,
819,
62,
297,
69,
7,
50033,
11,
30300,
11,
28483,
2611,
11,
51,
20311,
11,
34,
11,
45380,
20910,
41888,
51,
20311,
12962,
198,
297,
81,
796,
819,
62,
297,
81,
7,
50033,
11,
30300,
11,
28483,
2611,
11,
51,
20311,
11,
34,
11,
45380,
20910,
41888,
51,
20311,
12962,
198,
198,
2,
5589,
1133,
62,
14269,
3969,
0,
7,
14323,
8,
198,
198,
5647,
796,
38349,
26933,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
13,
14993,
451,
26933,
1990,
13,
25927,
276,
28925,
329,
819,
287,
1225,
69,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
38430,
1990,
13,
25927,
276,
28925,
12,
1990,
13,
10378,
433,
495,
12468,
2220,
329,
819,
287,
1225,
69,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
4357,
3918,
2625,
39390,
11,
8807,
8849,
28,
7942,
11,
17585,
1600,
8177,
13000,
2625,
1961,
37,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
13,
14993,
451,
26933,
1990,
13,
25927,
276,
28925,
329,
819,
287,
32660,
69,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
38430,
1990,
13,
25927,
276,
28925,
12,
1990,
13,
10378,
433,
495,
12468,
2220,
329,
819,
287,
32660,
69,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
4357,
3918,
2625,
39390,
11,
8807,
8849,
28,
7942,
11,
445,
1600,
8177,
13000,
2625,
3069,
37,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1345,
1747,
13,
14993,
451,
26933,
1990,
13,
25927,
276,
28925,
329,
819,
287,
32660,
81,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
38430,
1990,
13,
25927,
276,
28925,
12,
1990,
13,
10378,
433,
495,
12468,
2220,
329,
819,
287,
32660,
81,
13,
20114,
82,
7131,
43434,
25,
940,
25,
437,
4357,
3918,
2625,
39390,
11,
8807,
8849,
28,
7942,
11,
14809,
1600,
8177,
13000,
2625,
3069,
49,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
16589,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8177,
21604,
2625,
43588,
7421,
1600,
2124,
18242,
2625,
18453,
276,
4809,
357,
59,
3,
50,
59,
3,
42501,
331,
18242,
2625,
8086,
1328,
4809,
357,
59,
3,
50,
62,
81,
59,
3,
42501,
2124,
1084,
28,
15,
11,
2124,
9806,
28,
18,
11,
331,
1084,
28,
15,
11,
331,
9806,
28,
18,
11,
9647,
2625,
15,
13,
22,
6852,
28665,
10394,
1600,
6001,
2625,
15,
13,
19,
6852,
28665,
10394,
1,
198,
220,
220,
220,
5619,
198,
198,
21928,
7203,
14,
22065,
14,
82,
13495,
62,
5589,
533,
13,
16886,
1600,
5647,
11,
17256,
62,
79,
1476,
903,
28,
9562,
8,
198
] | 2.233886 | 543 |
#=
https://dtai.cs.kuleuven.be/problog/tutorial/basic/03_dice.html
"""
Let’s consider an infinite number of dice, which we roll one after the other until we see a
six for the first time. What is the probability of stopping after n dice? The first die is always rolled,
those with higher numbers D are only rolled if the previous roll did not stop the process.
"""
Cf dice_6_throws.jl
~/blog/rolling_dice4.blog
~/psi/rolling_dice4.psi
~/webppl/rolling_dice4.wppl
Theoretical values (1:50)
1:0.16666666666666666
2:0.1388888888888889
3:0.11574074074074076
4:0.09645061728395063
5:0.08037551440329219
6:0.06697959533607684
7:0.05581632944673069
8:0.04651360787227558
9:0.038761339893562986
10:0.032301116577969156
11:0.02691759714830763
12:0.022431330956923026
13:0.018692775797435855
14:0.015577313164529882
15:0.012981094303774901
16:0.010817578586479085
17:0.009014648822065905
18:0.0075122073517215875
19:0.006260172793101323
20:0.005216810660917769
21:0.0043473422174314744
22:0.003622785181192896
23:0.0030189876509940797
24:0.002515823042495067
25:0.002096519202079222
26:0.0017470993350660188
27:0.0014559161125550157
28:0.0012132634271291797
29:0.0010110528559409832
30:0.0008425440466174861
31:0.0007021200388479051
32:0.0005851000323732542
33:0.0004875833603110452
34:0.00040631946692587105
35:0.00033859955577155923
36:0.0002821662964762994
37:0.00023513858039691615
38:0.00019594881699743015
39:0.0001632906808311918
40:0.0001360755673593265
41:0.00011339630613277208
42:9.449692177731006e-5
43:7.874743481442506e-5
44:6.562286234535421e-5
45:5.468571862112852e-5
46:4.5571432184273776e-5
47:3.797619348689481e-5
48:3.164682790574568e-5
49:2.63723565881214e-5
50:2.19769638234345e-5
The values found by this model (run_model(0))
1.00000 => 6631 (0.165775)
2.00000 => 5661 (0.141525)
3.00000 => 4593 (0.114825)
4.00000 => 3867 (0.096675)
5.00000 => 3215 (0.080375)
6.00000 => 2700 (0.067500)
7.00000 => 2210 (0.055250)
8.00000 => 1845 (0.046125)
9.00000 => 1515 (0.037875)
10.00000 => 1282 (0.032050)
11.00000 => 1137 (0.028425)
12.00000 => 881 (0.022025)
13.00000 => 728 (0.018200)
14.00000 => 567 (0.014175)
15.00000 => 505 (0.012625)
16.00000 => 459 (0.011475)
17.00000 => 364 (0.009100)
18.00000 => 301 (0.007525)
19.00000 => 245 (0.006125)
20.00000 => 225 (0.005625)
22.00000 => 163 (0.004075)
21.00000 => 154 (0.003850)
23.00000 => 126 (0.003150)
24.00000 => 117 (0.002925)
25.00000 => 83 (0.002075)
26.00000 => 65 (0.001625)
27.00000 => 54 (0.001350)
30.00000 => 48 (0.001200)
28.00000 => 45 (0.001125)
29.00000 => 36 (0.000900)
31.00000 => 36 (0.000900)
32.00000 => 27 (0.000675)
34.00000 => 22 (0.000550)
33.00000 => 20 (0.000500)
35.00000 => 12 (0.000300)
37.00000 => 9 (0.000225)
38.00000 => 7 (0.000175)
39.00000 => 6 (0.000150)
42.00000 => 5 (0.000125)
40.00000 => 5 (0.000125)
36.00000 => 5 (0.000125)
46.00000 => 4 (0.000100)
41.00000 => 4 (0.000100)
44.00000 => 3 (0.000075)
47.00000 => 3 (0.000075)
48.00000 => 3 (0.000075)
57.00000 => 2 (0.000050)
49.00000 => 1 (0.000025)
45.00000 => 1 (0.000025)
50.00000 => 1 (0.000025)
43.00000 => 1 (0.000025)
72.00000 => 1 (0.000025)
=#
using Turing, StatsPlots, DataFrames
include("jl_utils.jl")
# Closed form of the probability
function theoretical_prob(n)
return (1/6.0) * ((5/6.0)^(n-1))
end
# For val = 0: show the full distribution of the length (len)
# otherwise show the probability of len == val
@model function dice_6_throws(val=0)
max_len = 100
function throws(a)
if length(a) > max_len
return a
end
# For some reason, this don't work: it just generates the same number repeatedly.
# t ~ DiscreteUniform(1,6)
t = rand(DiscreteUniform(1,6)) # This works.
# If we see a 6 then we stop
if t == 6
return vcat(a,t)
else
return throws(vcat(a,t))
end
end
len ~ DiscreteUniform(0,max_len)
# a = throws(TArray{Int64}(undef,0))
a = throws(Int64[])
len = length(a)
if val == 0
return len
else
return len == val
end
end
function run_model(len=0)
model = dice_6_throws(len)
num_chains = 4
# chains = sample(model, Prior(), 10_000)
# chains = sample(model, MH(), MCMCThreads(), 100_000, num_chains)
chains = sample(model, MH(), MCMCThreads(), 10_000, num_chains)
# chains = sample(model, MH(), 10_000)
# chains = sample(model, MH(), 1_000)
# chains = sample(model, PG(15), MCMCThreads(), 1_000, num_chains)
# chains = sample(model, SMC(1000), MCMCThreads(), 10_000, num_chains)
# chains = sample(model, SMC(1000), 10_000)
# chains = sample(model, IS(), 10_000)
#
# display(chains)
# show_var_dist_pct(chains,:len,1000)
println("prob return value:")
genq = generated_quantities(model, chains)
show_var_dist_pct(genq,1000)
if len > 0
println("\ntheoretical_prob($len): ", theoretical_prob(len))
end
end
for val in 0:10
println("\nval:$val")
run_model(val)
end
println("\nval:25")
run_model(25)
println("\nTheoretical values for 1:50")
for i in 1:50
println("$i:", theoretical_prob(i))
end
| [
2,
28,
628,
220,
3740,
1378,
28664,
1872,
13,
6359,
13,
74,
2261,
84,
574,
13,
1350,
14,
1676,
14036,
14,
83,
44917,
14,
35487,
14,
3070,
62,
67,
501,
13,
6494,
198,
220,
37227,
198,
220,
3914,
447,
247,
82,
2074,
281,
15541,
1271,
286,
17963,
11,
543,
356,
4836,
530,
706,
262,
584,
1566,
356,
766,
257,
198,
220,
2237,
329,
262,
717,
640,
13,
1867,
318,
262,
12867,
286,
12225,
706,
299,
17963,
30,
383,
717,
4656,
318,
1464,
11686,
11,
198,
220,
883,
351,
2440,
3146,
360,
389,
691,
11686,
611,
262,
2180,
4836,
750,
407,
2245,
262,
1429,
13,
198,
220,
37227,
628,
220,
43216,
17963,
62,
21,
62,
400,
8516,
13,
20362,
198,
220,
220,
220,
220,
47795,
14036,
14,
18886,
62,
67,
501,
19,
13,
14036,
198,
220,
220,
220,
220,
47795,
862,
72,
14,
18886,
62,
67,
501,
19,
13,
862,
72,
198,
220,
220,
220,
220,
47795,
12384,
381,
75,
14,
18886,
62,
67,
501,
19,
13,
86,
381,
75,
628,
220,
383,
9997,
605,
3815,
357,
16,
25,
1120,
8,
198,
16,
25,
15,
13,
1433,
41977,
19060,
27310,
198,
17,
25,
15,
13,
1485,
3459,
3459,
3459,
3459,
3459,
3459,
4531,
198,
18,
25,
15,
13,
1157,
3553,
30120,
30120,
30120,
1821,
4304,
198,
19,
25,
15,
13,
2931,
2414,
35638,
1558,
2078,
2670,
1120,
5066,
198,
20,
25,
15,
13,
33057,
22318,
47396,
31552,
1959,
28896,
198,
21,
25,
15,
13,
15,
36657,
3720,
35124,
2091,
1899,
30610,
19,
198,
22,
25,
15,
13,
2713,
3365,
24136,
1959,
2598,
3134,
1270,
3388,
198,
23,
25,
15,
13,
3023,
2996,
1485,
1899,
41019,
1828,
2425,
3365,
198,
24,
25,
15,
13,
15,
2548,
4304,
1485,
2670,
4531,
32066,
1959,
4521,
198,
940,
25,
15,
13,
3070,
1954,
486,
1157,
2996,
3324,
38819,
21599,
198,
1157,
25,
15,
13,
15,
26276,
1558,
43239,
18294,
1270,
49641,
198,
1065,
25,
15,
13,
2999,
1731,
25838,
1270,
3865,
3388,
19214,
2075,
198,
1485,
25,
15,
13,
29159,
3388,
1983,
2425,
3720,
4524,
31128,
2816,
198,
1415,
25,
15,
13,
486,
2816,
3324,
25838,
1433,
2231,
1959,
42980,
198,
1314,
25,
15,
13,
486,
27728,
940,
5824,
1270,
26514,
2920,
486,
198,
1433,
25,
15,
13,
486,
2919,
1558,
38907,
3365,
2414,
3720,
2919,
20,
198,
1558,
25,
15,
13,
28694,
28645,
2414,
3459,
17572,
36445,
2713,
198,
1507,
25,
15,
13,
405,
2425,
1065,
22745,
2327,
23628,
21273,
2425,
198,
1129,
25,
15,
13,
28041,
2075,
29326,
26050,
3132,
30273,
1954,
198,
1238,
25,
15,
13,
405,
4309,
14656,
15801,
31751,
22413,
3388,
198,
2481,
25,
15,
13,
22914,
30995,
2682,
1828,
1558,
3559,
20198,
2598,
198,
1828,
25,
15,
13,
405,
2623,
1828,
41172,
1507,
16315,
2078,
4846,
198,
1954,
25,
15,
13,
11245,
29159,
4089,
4304,
1120,
2079,
1821,
44673,
198,
1731,
25,
15,
13,
405,
1495,
1314,
6469,
21288,
21626,
1120,
3134,
198,
1495,
25,
15,
13,
405,
22567,
2996,
40454,
1238,
3720,
23148,
198,
2075,
25,
15,
13,
405,
22985,
2154,
2079,
2091,
1120,
2791,
486,
3459,
198,
1983,
25,
15,
13,
405,
1415,
38605,
1433,
14686,
31046,
486,
3553,
198,
2078,
25,
15,
13,
405,
1065,
1485,
2075,
2682,
1983,
18741,
1558,
5607,
198,
1959,
25,
15,
13,
8298,
486,
13348,
2078,
38605,
1821,
4089,
2624,
198,
1270,
25,
15,
13,
830,
5705,
24970,
26429,
2791,
1558,
2780,
5333,
198,
3132,
25,
15,
13,
830,
2154,
21777,
405,
30460,
31714,
2713,
16,
198,
2624,
25,
15,
13,
830,
3365,
4349,
830,
32637,
4790,
1495,
3682,
198,
2091,
25,
15,
13,
830,
2780,
38569,
2091,
1899,
3132,
940,
37730,
198,
2682,
25,
15,
13,
830,
1821,
5066,
22913,
36657,
1495,
5774,
13348,
198,
2327,
25,
15,
13,
830,
2091,
5332,
2079,
31046,
3324,
1314,
3270,
1954,
198,
2623,
25,
15,
13,
830,
2078,
20666,
48602,
2414,
4304,
1959,
5824,
198,
2718,
25,
15,
13,
830,
22370,
1485,
5332,
1795,
2670,
3388,
1433,
1314,
198,
2548,
25,
15,
13,
18005,
24,
3270,
33646,
1433,
39647,
3559,
25150,
198,
2670,
25,
15,
13,
18005,
5066,
1959,
3312,
28362,
3132,
1129,
1507,
198,
1821,
25,
15,
13,
18005,
15277,
38172,
3134,
2327,
6052,
22980,
198,
3901,
25,
15,
13,
18005,
1485,
34107,
20548,
1485,
27019,
21315,
198,
3682,
25,
24,
13,
31911,
3388,
24591,
46871,
3064,
21,
68,
12,
20,
198,
3559,
25,
22,
13,
5774,
38652,
28978,
1415,
3682,
35638,
68,
12,
20,
198,
2598,
25,
21,
13,
3980,
1828,
4521,
1954,
2231,
32182,
2481,
68,
12,
20,
198,
2231,
25,
20,
13,
38472,
3553,
25096,
2481,
12762,
4309,
68,
12,
20,
198,
3510,
25,
19,
13,
41948,
1415,
2624,
22883,
1983,
2718,
4304,
68,
12,
20,
198,
2857,
25,
18,
13,
3720,
4304,
1129,
28978,
40523,
40271,
68,
12,
20,
198,
2780,
25,
18,
13,
23237,
3104,
26050,
43526,
2231,
3104,
68,
12,
20,
198,
2920,
25,
17,
13,
21,
2718,
22370,
2996,
3459,
1065,
1415,
68,
12,
20,
198,
1120,
25,
17,
13,
24991,
38205,
2548,
1954,
3559,
2231,
68,
12,
20,
628,
198,
220,
383,
3815,
1043,
416,
428,
2746,
357,
5143,
62,
19849,
7,
15,
4008,
198,
220,
352,
13,
20483,
5218,
220,
220,
220,
7930,
3132,
220,
357,
15,
13,
1433,
3553,
2425,
8,
198,
17,
13,
20483,
5218,
220,
220,
220,
642,
47159,
220,
357,
15,
13,
1415,
1314,
1495,
8,
198,
18,
13,
20483,
5218,
220,
220,
220,
604,
49051,
220,
357,
15,
13,
1157,
2780,
1495,
8,
198,
19,
13,
20483,
5218,
220,
220,
220,
4353,
3134,
220,
357,
15,
13,
2931,
2791,
2425,
8,
198,
20,
13,
20483,
5218,
220,
220,
220,
3933,
1314,
220,
357,
15,
13,
33057,
22318,
8,
198,
21,
13,
20483,
5218,
220,
220,
220,
2681,
405,
220,
357,
15,
13,
3312,
2425,
405,
8,
198,
22,
13,
20483,
5218,
220,
220,
220,
2534,
940,
220,
357,
15,
13,
2713,
4309,
1120,
8,
198,
23,
13,
20483,
5218,
220,
220,
220,
1248,
2231,
220,
357,
15,
13,
45438,
11623,
8,
198,
24,
13,
20483,
5218,
220,
220,
220,
1315,
1314,
220,
357,
15,
13,
15,
30695,
2425,
8,
198,
940,
13,
20483,
5218,
220,
220,
220,
1105,
6469,
220,
357,
15,
13,
3070,
1238,
1120,
8,
198,
1157,
13,
20483,
5218,
220,
220,
220,
1367,
2718,
220,
357,
15,
13,
15,
30336,
1495,
8,
198,
1065,
13,
20483,
5218,
220,
220,
220,
220,
807,
6659,
220,
357,
15,
13,
2999,
1238,
1495,
8,
198,
1485,
13,
20483,
5218,
220,
220,
220,
220,
767,
2078,
220,
357,
15,
13,
29159,
2167,
8,
198,
1415,
13,
20483,
5218,
220,
220,
220,
220,
642,
3134,
220,
357,
15,
13,
28645,
17430,
8,
198,
1314,
13,
20483,
5218,
220,
220,
220,
220,
43367,
220,
357,
15,
13,
486,
2075,
1495,
8,
198,
1433,
13,
20483,
5218,
220,
220,
220,
220,
604,
3270,
220,
357,
15,
13,
486,
1415,
2425,
8,
198,
1558,
13,
20483,
5218,
220,
220,
220,
220,
44969,
220,
357,
15,
13,
28694,
3064,
8,
198,
1507,
13,
20483,
5218,
220,
220,
220,
220,
25643,
220,
357,
15,
13,
405,
2425,
1495,
8,
198,
1129,
13,
20483,
5218,
220,
220,
220,
220,
29637,
220,
357,
15,
13,
28041,
11623,
8,
198,
1238,
13,
20483,
5218,
220,
220,
220,
220,
18500,
220,
357,
15,
13,
405,
3980,
1495,
8,
198,
1828,
13,
20483,
5218,
220,
220,
220,
220,
26826,
220,
357,
15,
13,
405,
1821,
2425,
8,
198,
2481,
13,
20483,
5218,
220,
220,
220,
220,
24235,
220,
357,
15,
13,
405,
2548,
1120,
8,
198,
1954,
13,
20483,
5218,
220,
220,
220,
220,
19710,
220,
357,
15,
13,
405,
3132,
1120,
8,
198,
1731,
13,
20483,
5218,
220,
220,
220,
220,
19048,
220,
357,
15,
13,
405,
1959,
1495,
8,
198,
1495,
13,
20483,
5218,
220,
220,
220,
220,
220,
9698,
220,
357,
15,
13,
405,
1238,
2425,
8,
198,
2075,
13,
20483,
5218,
220,
220,
220,
220,
220,
6135,
220,
357,
15,
13,
405,
1433,
1495,
8,
198,
1983,
13,
20483,
5218,
220,
220,
220,
220,
220,
7175,
220,
357,
15,
13,
405,
1485,
1120,
8,
198,
1270,
13,
20483,
5218,
220,
220,
220,
220,
220,
4764,
220,
357,
15,
13,
405,
27550,
8,
198,
2078,
13,
20483,
5218,
220,
220,
220,
220,
220,
4153,
220,
357,
15,
13,
8298,
11623,
8,
198,
1959,
13,
20483,
5218,
220,
220,
220,
220,
220,
4570,
220,
357,
15,
13,
830,
12865,
8,
198,
3132,
13,
20483,
5218,
220,
220,
220,
220,
220,
4570,
220,
357,
15,
13,
830,
12865,
8,
198,
2624,
13,
20483,
5218,
220,
220,
220,
220,
220,
2681,
220,
357,
15,
13,
830,
42444,
8,
198,
2682,
13,
20483,
5218,
220,
220,
220,
220,
220,
2534,
220,
357,
15,
13,
830,
22730,
8,
198,
2091,
13,
20483,
5218,
220,
220,
220,
220,
220,
1160,
220,
357,
15,
13,
830,
4059,
8,
198,
2327,
13,
20483,
5218,
220,
220,
220,
220,
220,
1105,
220,
357,
15,
13,
830,
6200,
8,
198,
2718,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
860,
220,
357,
15,
13,
830,
18182,
8,
198,
2548,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
767,
220,
357,
15,
13,
18005,
2425,
8,
198,
2670,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
718,
220,
357,
15,
13,
18005,
1120,
8,
198,
3682,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
642,
220,
357,
15,
13,
18005,
1495,
8,
198,
1821,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
642,
220,
357,
15,
13,
18005,
1495,
8,
198,
2623,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
642,
220,
357,
15,
13,
18005,
1495,
8,
198,
3510,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
604,
220,
357,
15,
13,
18005,
405,
8,
198,
3901,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
604,
220,
357,
15,
13,
18005,
405,
8,
198,
2598,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
513,
220,
357,
15,
13,
2388,
2425,
8,
198,
2857,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
513,
220,
357,
15,
13,
2388,
2425,
8,
198,
2780,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
513,
220,
357,
15,
13,
2388,
2425,
8,
198,
3553,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
362,
220,
357,
15,
13,
2388,
1120,
8,
198,
2920,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
352,
220,
357,
15,
13,
2388,
1495,
8,
198,
2231,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
352,
220,
357,
15,
13,
2388,
1495,
8,
198,
1120,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
352,
220,
357,
15,
13,
2388,
1495,
8,
198,
3559,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
352,
220,
357,
15,
13,
2388,
1495,
8,
198,
4761,
13,
20483,
5218,
220,
220,
220,
220,
220,
220,
352,
220,
357,
15,
13,
2388,
1495,
8,
628,
198,
198,
46249,
198,
198,
3500,
39141,
11,
20595,
3646,
1747,
11,
6060,
35439,
198,
17256,
7203,
20362,
62,
26791,
13,
20362,
4943,
198,
198,
2,
30550,
1296,
286,
262,
12867,
198,
8818,
16200,
62,
1676,
65,
7,
77,
8,
198,
220,
220,
220,
1441,
357,
16,
14,
21,
13,
15,
8,
1635,
14808,
20,
14,
21,
13,
15,
8,
61,
7,
77,
12,
16,
4008,
198,
437,
198,
198,
2,
1114,
1188,
796,
657,
25,
905,
262,
1336,
6082,
286,
262,
4129,
357,
11925,
8,
198,
2,
4306,
905,
262,
12867,
286,
18896,
6624,
1188,
198,
31,
19849,
2163,
17963,
62,
21,
62,
400,
8516,
7,
2100,
28,
15,
8,
628,
220,
220,
220,
3509,
62,
11925,
796,
1802,
198,
220,
220,
220,
2163,
12542,
7,
64,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
7,
64,
8,
1875,
3509,
62,
11925,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
257,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1114,
617,
1738,
11,
428,
836,
470,
670,
25,
340,
655,
18616,
262,
976,
1271,
7830,
13,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
256,
5299,
220,
8444,
8374,
3118,
6933,
7,
16,
11,
21,
8,
198,
220,
220,
220,
220,
220,
220,
220,
256,
796,
43720,
7,
15642,
8374,
3118,
6933,
7,
16,
11,
21,
4008,
1303,
770,
2499,
13,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
1002,
356,
766,
257,
718,
788,
356,
2245,
198,
220,
220,
220,
220,
220,
220,
220,
611,
256,
6624,
718,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
410,
9246,
7,
64,
11,
83,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
12542,
7,
85,
9246,
7,
64,
11,
83,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
18896,
5299,
8444,
8374,
3118,
6933,
7,
15,
11,
9806,
62,
11925,
8,
628,
220,
220,
220,
1303,
257,
796,
12542,
7,
51,
19182,
90,
5317,
2414,
92,
7,
917,
891,
11,
15,
4008,
198,
220,
220,
220,
257,
796,
12542,
7,
5317,
2414,
58,
12962,
198,
220,
220,
220,
18896,
796,
4129,
7,
64,
8,
628,
220,
220,
220,
611,
1188,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
18896,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
18896,
6624,
1188,
198,
220,
220,
220,
886,
198,
437,
628,
198,
8818,
1057,
62,
19849,
7,
11925,
28,
15,
8,
198,
220,
220,
220,
2746,
796,
17963,
62,
21,
62,
400,
8516,
7,
11925,
8,
628,
220,
220,
220,
997,
62,
38861,
796,
604,
628,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
14481,
22784,
838,
62,
830,
8,
628,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
20752,
22784,
13122,
9655,
16818,
82,
22784,
1802,
62,
830,
11,
997,
62,
38861,
8,
198,
220,
220,
220,
14659,
796,
6291,
7,
19849,
11,
20752,
22784,
13122,
9655,
16818,
82,
22784,
838,
62,
830,
11,
997,
62,
38861,
8,
198,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
20752,
22784,
838,
62,
830,
8,
198,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
20752,
22784,
352,
62,
830,
8,
628,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
23842,
7,
1314,
828,
13122,
9655,
16818,
82,
22784,
352,
62,
830,
11,
997,
62,
38861,
8,
628,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
9447,
34,
7,
12825,
828,
13122,
9655,
16818,
82,
22784,
838,
62,
830,
11,
997,
62,
38861,
8,
198,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
9447,
34,
7,
12825,
828,
838,
62,
830,
8,
198,
220,
220,
220,
1303,
14659,
796,
6291,
7,
19849,
11,
3180,
22784,
838,
62,
830,
8,
198,
220,
220,
220,
1303,
198,
220,
220,
220,
1303,
3359,
7,
38861,
8,
198,
220,
220,
220,
1303,
905,
62,
7785,
62,
17080,
62,
79,
310,
7,
38861,
11,
25,
11925,
11,
12825,
8,
628,
220,
220,
220,
44872,
7203,
1676,
65,
1441,
1988,
25,
4943,
198,
220,
220,
220,
2429,
80,
796,
7560,
62,
40972,
871,
7,
19849,
11,
14659,
8,
198,
220,
220,
220,
905,
62,
7785,
62,
17080,
62,
79,
310,
7,
5235,
80,
11,
12825,
8,
198,
220,
220,
220,
611,
18896,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
59,
429,
258,
9997,
605,
62,
1676,
65,
16763,
11925,
2599,
33172,
16200,
62,
1676,
65,
7,
11925,
4008,
198,
220,
220,
220,
886,
198,
198,
437,
198,
198,
1640,
1188,
287,
657,
25,
940,
198,
220,
220,
220,
44872,
7203,
59,
77,
2100,
25,
3,
2100,
4943,
198,
220,
220,
220,
1057,
62,
19849,
7,
2100,
8,
198,
437,
198,
198,
35235,
7203,
59,
77,
2100,
25,
1495,
4943,
198,
5143,
62,
19849,
7,
1495,
8,
198,
198,
35235,
7203,
59,
77,
464,
9997,
605,
3815,
329,
352,
25,
1120,
4943,
198,
1640,
1312,
287,
352,
25,
1120,
198,
220,
220,
220,
44872,
7203,
3,
72,
25,
1600,
16200,
62,
1676,
65,
7,
72,
4008,
198,
437,
198
] | 2.033073 | 2,691 |
using Gurobi
using Mosek
# train adversarial method with kernel using constraint generation
function train_adv_kernel_cg(X::Matrix, y::Vector, C::Real=1.0,
kernel::Symbol=:linear, kernel_params::Vector=[];
perturb::Real=0.0, tol::Real=1e-6, psdtol::Real=1e-6, obj_reltol::Real=0.0,
log::Real=0, n_thread::Int=0, solver::Symbol=:gurobi, verbose::Bool=true)
n = length(y)
# add one
X1 = [ones(n) X]' # transpose
m = size(X1, 1)
# number of class
n_c = maximum(y)
n_f = n_c * m # number of features
alpha = zeros(0)
# array of tuple
constraints = Tuple{Integer, Vector}[]
# prepare saved vars
idmi = map(i -> idi(m, i), collect(1:n_c))
# kernel
kernel_func = linear_kernel
if kernel == :gaussian
kernel_func = gaussian_kernel
elseif kernel == :polynomial
kernel_func = polynomial_kernel
end
# precompute kernel
K = [( i >= j ? kernel_func(X1[:,i], X1[:,j], kernel_params...) : 0.0 )::Float64 for i=1:n, j=1:n]
K = [( i >= j ? K[i,j] : K[j,i] )::Float64 for i=1:n, j=1:n]
if solver == :gurobi
# gurobi solver
# gurobi environtment
env = Gurobi.Env()
# Method : 0=primal simplex, 1=dual simplex, 2=barrier ; default for QP: barrier
# Threads : default = 0 (use all threads)
setparams!(env, PSDTol=psdtol, LogToConsole=log, Method=2, Threads=n_thread)
elseif solver == :mosek
# mosek environtment
env = makeenv()
end
# params for Gurobi
Q = zeros(0,0)
nu = zeros(0)
A = spzeros(n, 0) # sparse matrix
b = ones(n) * C
Q_prev = zeros(0,0)
nu_prev = zeros(0)
A_prev = spzeros(n, 0) # sparse matrix
# save lambda dot psi_i
n_lps = n * n_c
LPsi = zeros(n_lps, 0)
LPsi_prev = zeros(n_lps, 0)
iter = 0
dual_obj = 0.0
dual_obj_prev = 0.0
while true
iter += 1
if verbose
println("Iteration : ", iter)
tic();
end
# previous constraints
const_prev = copy(constraints)
# previous alpha
alpha_prev = copy(alpha)
## add to constraints
const_added = Tuple{Integer, Vector}[]
# find constraint for each sample
for i=1:n
psis = psi_list_dual(alpha, LPsi, i, n_c)
psis_id, val = best_psis(psis) # most violated constraints
# current xi_i
id_i = find(x -> x[1] == i, constraints)
xi_i_list = map(x -> x[2], constraints[id_i])
max_xi_i = 0
for j = 1:length(xi_i_list)
a = calc_const(psis::Vector, xi_i_list[j])
if a > max_xi_i
max_xi_i = a
end
end
if val > max_xi_i
cs = (i, sort!(psis_id))
if findfirst(constraints .== cs) == 0
push!(constraints, cs)
push!(const_added, cs)
end
end
end
# if no constraints added
if length(const_added) == 0
break
end
n_const = length(constraints)
#### Start QP ###
if verbose
println(">> Start QP")
toc();
tic();
end
n_prev = length(const_prev)
n_added = length(const_added)
# init alpha with previous iteration
alpha = zeros(n_const)
alpha[1:n_prev] = alpha_prev
Q_aug = [ ( calc_dot((const_prev[i][1], const_prev[i][2], const_added[j][1], const_added[j][2]), K, y) )::Float64
for i=1:n_prev, j=1:n_added]
Q_aug_diag = [
( i >= j ? calc_dot((const_added[i][1], const_added[i][2], const_added[j][1], const_added[j][2]), K, y) : 0.0 )::Float64
for i=1:n_added, j=1:n_added]
Q_aug_diag = [ (i >= j ? Q_aug_diag[i,j] : Q_aug_diag[j,i] )::Float64 for i=1:n_added, j=1:n_added ]
Q = [
( (i <= n_prev && j <= n_prev) ? Q_prev[i, j] : ( i <= n_prev ? Q_aug[i, j-n_prev] :
( j <= n_prev ? Q_aug[j, i-n_prev] : Q_aug_diag[i-n_prev, j-n_prev] ) ) )::Float64
for i=1:n_const, j=1:n_const]
nu_aug = [ ( calc_cconst(const_added[i][2]) )::Float64 for i=1:n_added ]
nu = [ ( i <= n_prev ? nu_prev[i] : nu_aug[i-n_prev] )::Float64 for i=1:n_const]
A_aug = spzeros(n, n_added)
for j = 1:n_added
A_aug[const_added[j][1], j] = 1.0
end
A = [A_prev A_aug]
# update LPsi
LPsi_aug = [ ( calc_dot((ceil(Int64, i/n_c), [(i%n_c==0)? n_c:i%n_c], const_added[j][1], const_added[j][2]), K, y) )::Float64
for i=1:n_lps, j=1:n_added]
LPsi = [LPsi_prev LPsi_aug]
## add perturbation
for i=1:n_const
Q[i,i] = Q[i,i] + perturb
end
if verbose
toc();
tic();
end
if solver == :gurobi
if verbose println(">> Optim :: Gurobi") end
## init model
model = gurobi_model(env,
sense = :minimize,
H = Q,
f = -nu,
A = A,
b = b,
lb = zeros(n_const)
)
# Print the model to check correctness
# print(model)
# Solve with Gurobi
Gurobi.optimize(model)
if verbose
toc();
println("<< End QP")
end
dual_obj = -get_objval(model)
# Solution
if verbose println("Objective value: ", dual_obj) end
# get alpha
alpha = get_solution(model)
# println("alpha = ", alpha)
#
# println("constraints = ", constraints)
if verbose println("n constraints = ", length(constraints)) end
### end QP ###
elseif solver == :mosek
if verbose println(">> Optim :: Mosek") end
task = maketask(env)
# set params
putintparam(task, Mosek.MSK_IPAR_LOG, 1)
putintparam(task, Mosek.MSK_IPAR_LOG_CHECK_CONVEXITY, 1)
putdouparam(task, Mosek.MSK_DPAR_CHECK_CONVEXITY_REL_TOL, psdtol)
# variables
appendvars(task, n_const)
# bound on var
for i::Int32 = 1:n_const
putbound(task, Mosek.MSK_ACC_VAR, i, Mosek.MSK_BK_RA, 0.0, C)
end
# objective
putobjsense(task, Mosek.MSK_OBJECTIVE_SENSE_MINIMIZE)
qi = zeros(Int32, (n_const * (n_const+1)) ÷ 2 )
qj = zeros(Int32, (n_const * (n_const+1)) ÷ 2 )
qv = zeros(Float64, (n_const * (n_const+1)) ÷ 2 )
ix = 1
for j::Int32 = 1:n_const
for i::Int32 = j:n_const
qi[ix] = i
qj[ix] = j
qv[ix] = Q[i,j]
ix += 1
end
end
putqobj(task, qi, qj, qv)
putclist(task, collect(1:n_const), -nu)
# constraints
## sparse array
appendcons(task, n)
for i::Int32 = 1:n_const
id_nz = A[:,i].nzind
putacol(task, i, id_nz, ones(length(id_nz)))
end
for i::Int32 = 1:n
putbound(task, Mosek.MSK_ACC_CON, i, Mosek.MSK_BK_RA, 0.0, C)
end
if verbose
toc(); tic();
end
Mosek.optimize(task)
if verbose
toc();
println("<< End QP")
end
# Solution
dual_obj, _ = getsolutioninfo(task, Mosek.MSK_SOL_ITR)
if verbose println("Objective value: ", -dual_obj) end
# get alpha
alpha = getxx(task, Mosek.MSK_SOL_ITR)
if verbose println("n constraints = ", length(constraints)) end
end
if obj_reltol > 0.0
if (dual_obj - dual_obj_prev) / dual_obj_prev < obj_reltol && iter > 1
if verbose
println((dual_obj - dual_obj_prev) / dual_obj_prev)
println(">> Iteration STOPPED | Objective relative tolerance : ", obj_reltol)
end
break
end
end
if verbose println() end
Q_prev = Q
nu_prev = nu
A_prev = A
LPsi_prev = LPsi
dual_obj_prev = dual_obj
end
# finalizing losses
gv_aug = zeros(n)
gv_01 = zeros(n)
l_adv = zeros(n)
l_01 = zeros(n)
for i=1:n
psis = psi_list_dual(alpha, LPsi, i, n_c)
psis_id, val = best_psis(psis) # most violated constraints
n_ps = length(psis_id)
gv_aug[i] = val
# compute probs
p_hat = zeros(n_c)
p_check = zeros(n_c)
for j=1:n_c
if j in psis_id
p_hat[j] = ( (n_ps-1.0)*psis[j] - sum(psis[psis_id[psis_id .!= j]]) + 1.0 ) / n_ps
p_check[j] = 1.0 / n_ps
else
p_hat[j] = 0.0
p_check[j] = 0.0
end
end
C01 = 1 - eye(n_c) # 01 loss matrix
v = p_hat' * C01 * p_check # the result is vector size 1 not a number
gv_01[i] = v[1] #
## training loss
l_adv[i] = 1.0 - p_hat[y[i]]
l_01[i] = 1.0 - round(Int, indmax(p_hat) == y[i])
end
game_value_01 = mean(gv_01)
game_value_augmented = mean(gv_aug)
# create model
adv_model = KernelMultiAdversarialModel(kernel, kernel_params, alpha, constraints, n_c, game_value_01, game_value_augmented, mean(l_adv), mean(l_01))
return adv_model::KernelMultiAdversarialModel
end
function predict_adv_kernel(model::KernelMultiAdversarialModel, X_test::Matrix, X_train::Matrix, y_train::Vector)
alpha = model.alpha
n_c = model.n_class
n = size(X_test, 1)
constraints = model.constraints
n_const = length(alpha)
X1 = [ones(n) X_test]' # transpose
m = size(X1, 1)
# training data
n_tr = size(X_train, 1)
X1_tr = [ones(n_tr) X_train]' # transpose
# kernel
kernel = model.kernel
kernel_params = model.kernel_params
# kernel function
kernel_func = linear_kernel
if kernel == :gaussian
kernel_func = gaussian_kernel
elseif kernel == :polynomial
kernel_func = polynomial_kernel
end
# compute Kernel
K = [ kernel_func(X1_tr[:,i], X1[:,j], kernel_params...)::Float64 for i=1:n_tr, j=1:n]
prob = zeros(n, n_c)
pred = zeros(n)
for i=1:n
psis = zeros(n_c)
for j = 1:n_const
psis -= alpha[j] * calc_dotlphi( (constraints[j][1], constraints[j][2], i), K, y_train, n_c)
end
psis_id, val = best_psis(psis) # most violated constraints
n_ps = length(psis_id)
for j=1:n_c
if j in psis_id
prob[i,j] = ( (n_ps-1.0)*psis[j] - sum(psis[psis_id[psis_id .!= j]]) + 1.0 ) / n_ps
else
prob[i,j] = 0.0
end
end
pred[i] = indmax(psis)
end
return prob::Matrix{Float64}, pred::Vector{Float64}
end
function test_adv_kernel(model::KernelMultiAdversarialModel, X_test::Matrix, y_test::Vector, X_train::Matrix, y_train::Vector)
n = size(X_test, 1)
y_prob, y_pred = predict_adv_kernel(model, X_test, X_train, y_train)
# calculate testing loss
losses = zeros(n)
losses01 = zeros(n)
for i=1:n
losses[i] = 1.0 - y_prob[i, y_test[i]]
losses01[i] = 1.0 - round(Int, y_pred[i] == y_test[i])
end
loss = sum(losses) / n
loss01 = sum(losses01) / n
return loss::Float64, losses::Vector{Float64}, loss01::Float64, losses01::Vector{Float64},
y_prob::Matrix{Float64}, y_pred::Vector{Float64}
end
| [
3500,
402,
1434,
8482,
198,
3500,
337,
577,
74,
198,
198,
2,
4512,
16907,
36098,
2446,
351,
9720,
1262,
32315,
5270,
198,
8818,
4512,
62,
32225,
62,
33885,
62,
66,
70,
7,
55,
3712,
46912,
11,
331,
3712,
38469,
11,
327,
3712,
15633,
28,
16,
13,
15,
11,
198,
220,
9720,
3712,
13940,
23650,
28,
25,
29127,
11,
9720,
62,
37266,
3712,
38469,
41888,
11208,
198,
220,
22146,
5945,
3712,
15633,
28,
15,
13,
15,
11,
284,
75,
3712,
15633,
28,
16,
68,
12,
21,
11,
279,
21282,
83,
349,
3712,
15633,
28,
16,
68,
12,
21,
11,
26181,
62,
2411,
83,
349,
3712,
15633,
28,
15,
13,
15,
11,
198,
220,
2604,
3712,
15633,
28,
15,
11,
299,
62,
16663,
3712,
5317,
28,
15,
11,
1540,
332,
3712,
13940,
23650,
28,
25,
70,
1434,
8482,
11,
15942,
577,
3712,
33,
970,
28,
7942,
8,
628,
220,
299,
796,
4129,
7,
88,
8,
198,
220,
1303,
751,
530,
198,
220,
1395,
16,
796,
685,
1952,
7,
77,
8,
1395,
49946,
220,
220,
1303,
1007,
3455,
198,
220,
285,
796,
2546,
7,
55,
16,
11,
352,
8,
628,
220,
1303,
1271,
286,
1398,
198,
220,
299,
62,
66,
796,
5415,
7,
88,
8,
198,
220,
299,
62,
69,
796,
299,
62,
66,
1635,
285,
220,
220,
1303,
1271,
286,
3033,
628,
220,
17130,
796,
1976,
27498,
7,
15,
8,
628,
220,
1303,
7177,
286,
46545,
198,
220,
17778,
796,
309,
29291,
90,
46541,
11,
20650,
92,
21737,
628,
220,
1303,
8335,
7448,
410,
945,
198,
220,
4686,
11632,
796,
3975,
7,
72,
4613,
46205,
7,
76,
11,
1312,
828,
2824,
7,
16,
25,
77,
62,
66,
4008,
628,
220,
1303,
9720,
198,
220,
9720,
62,
20786,
796,
14174,
62,
33885,
198,
220,
611,
9720,
6624,
1058,
4908,
31562,
198,
220,
220,
220,
9720,
62,
20786,
796,
31986,
31562,
62,
33885,
198,
220,
2073,
361,
9720,
6624,
1058,
35428,
26601,
498,
198,
220,
220,
220,
9720,
62,
20786,
796,
745,
6213,
49070,
62,
33885,
198,
220,
886,
628,
220,
1303,
662,
5589,
1133,
9720,
198,
220,
509,
796,
47527,
1312,
18189,
474,
5633,
9720,
62,
20786,
7,
55,
16,
58,
45299,
72,
4357,
1395,
16,
58,
45299,
73,
4357,
9720,
62,
37266,
23029,
1058,
657,
13,
15,
1267,
3712,
43879,
2414,
329,
1312,
28,
16,
25,
77,
11,
474,
28,
16,
25,
77,
60,
198,
220,
509,
796,
47527,
1312,
18189,
474,
5633,
509,
58,
72,
11,
73,
60,
1058,
509,
58,
73,
11,
72,
60,
1267,
3712,
43879,
2414,
329,
1312,
28,
16,
25,
77,
11,
474,
28,
16,
25,
77,
60,
628,
220,
611,
1540,
332,
6624,
1058,
70,
1434,
8482,
198,
220,
220,
220,
1303,
915,
305,
8482,
1540,
332,
198,
220,
220,
220,
1303,
915,
305,
8482,
17365,
343,
756,
434,
198,
220,
220,
220,
17365,
796,
402,
1434,
8482,
13,
4834,
85,
3419,
198,
220,
220,
220,
1303,
11789,
1058,
657,
28,
1050,
4402,
2829,
87,
11,
352,
28,
646,
282,
2829,
87,
11,
362,
28,
5657,
5277,
220,
2162,
4277,
329,
1195,
47,
25,
13054,
198,
220,
220,
220,
1303,
14122,
82,
1058,
4277,
796,
657,
357,
1904,
477,
14390,
8,
198,
220,
220,
220,
900,
37266,
0,
7,
24330,
11,
6599,
24544,
349,
28,
862,
28664,
349,
11,
5972,
2514,
47581,
28,
6404,
11,
11789,
28,
17,
11,
14122,
82,
28,
77,
62,
16663,
8,
198,
220,
2073,
361,
1540,
332,
6624,
1058,
76,
577,
74,
198,
220,
220,
220,
1303,
285,
577,
74,
17365,
343,
756,
434,
198,
220,
220,
220,
17365,
796,
787,
24330,
3419,
198,
220,
886,
628,
220,
1303,
42287,
329,
402,
1434,
8482,
198,
220,
1195,
796,
1976,
27498,
7,
15,
11,
15,
8,
198,
220,
14364,
796,
1976,
27498,
7,
15,
8,
198,
220,
317,
796,
599,
9107,
418,
7,
77,
11,
657,
8,
220,
220,
220,
220,
220,
220,
220,
1303,
29877,
17593,
198,
220,
275,
796,
3392,
7,
77,
8,
1635,
327,
628,
220,
1195,
62,
47050,
796,
1976,
27498,
7,
15,
11,
15,
8,
198,
220,
14364,
62,
47050,
796,
1976,
27498,
7,
15,
8,
198,
220,
317,
62,
47050,
796,
599,
9107,
418,
7,
77,
11,
657,
8,
220,
1303,
29877,
17593,
628,
220,
1303,
3613,
37456,
16605,
46231,
62,
72,
198,
220,
299,
62,
75,
862,
796,
299,
1635,
299,
62,
66,
198,
220,
406,
12016,
72,
796,
1976,
27498,
7,
77,
62,
75,
862,
11,
657,
8,
198,
220,
406,
12016,
72,
62,
47050,
796,
1976,
27498,
7,
77,
62,
75,
862,
11,
657,
8,
628,
220,
11629,
796,
657,
198,
220,
10668,
62,
26801,
796,
657,
13,
15,
198,
220,
10668,
62,
26801,
62,
47050,
796,
657,
13,
15,
628,
220,
981,
2081,
198,
220,
220,
220,
11629,
15853,
352,
628,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
44872,
7203,
29993,
341,
1058,
33172,
11629,
8,
198,
220,
220,
220,
220,
220,
256,
291,
9783,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
2180,
17778,
198,
220,
220,
220,
1500,
62,
47050,
796,
4866,
7,
1102,
2536,
6003,
8,
198,
220,
220,
220,
1303,
2180,
17130,
198,
220,
220,
220,
17130,
62,
47050,
796,
4866,
7,
26591,
8,
628,
220,
220,
220,
22492,
751,
284,
17778,
198,
220,
220,
220,
1500,
62,
29373,
796,
309,
29291,
90,
46541,
11,
20650,
92,
21737,
628,
220,
220,
220,
1303,
1064,
32315,
329,
1123,
6291,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
198,
220,
220,
220,
220,
220,
279,
13429,
796,
46231,
62,
4868,
62,
646,
282,
7,
26591,
11,
406,
12016,
72,
11,
1312,
11,
299,
62,
66,
8,
198,
220,
220,
220,
220,
220,
279,
13429,
62,
312,
11,
1188,
796,
1266,
62,
862,
271,
7,
862,
271,
8,
220,
220,
220,
220,
220,
1303,
749,
13998,
17778,
628,
220,
220,
220,
220,
220,
1303,
1459,
2124,
72,
62,
72,
198,
220,
220,
220,
220,
220,
4686,
62,
72,
796,
1064,
7,
87,
4613,
2124,
58,
16,
60,
6624,
1312,
11,
17778,
8,
198,
220,
220,
220,
220,
220,
2124,
72,
62,
72,
62,
4868,
796,
220,
3975,
7,
87,
4613,
2124,
58,
17,
4357,
17778,
58,
312,
62,
72,
12962,
198,
220,
220,
220,
220,
220,
3509,
62,
29992,
62,
72,
796,
657,
198,
220,
220,
220,
220,
220,
329,
474,
796,
352,
25,
13664,
7,
29992,
62,
72,
62,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
257,
796,
42302,
62,
9979,
7,
862,
271,
3712,
38469,
11,
2124,
72,
62,
72,
62,
4868,
58,
73,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
611,
257,
1875,
3509,
62,
29992,
62,
72,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3509,
62,
29992,
62,
72,
796,
257,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
611,
1188,
1875,
3509,
62,
29992,
62,
72,
198,
220,
220,
220,
220,
220,
220,
220,
50115,
796,
357,
72,
11,
3297,
0,
7,
862,
271,
62,
312,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
611,
1064,
11085,
7,
1102,
2536,
6003,
764,
855,
50115,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
1102,
2536,
6003,
11,
50115,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
9979,
62,
29373,
11,
50115,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
611,
645,
17778,
2087,
198,
220,
220,
220,
611,
4129,
7,
9979,
62,
29373,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
886,
628,
220,
220,
220,
299,
62,
9979,
796,
4129,
7,
1102,
2536,
6003,
8,
628,
220,
220,
220,
1303,
21017,
7253,
1195,
47,
44386,
628,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
44872,
7203,
4211,
7253,
1195,
47,
4943,
198,
220,
220,
220,
220,
220,
284,
66,
9783,
198,
220,
220,
220,
220,
220,
256,
291,
9783,
198,
220,
220,
220,
886,
628,
220,
220,
220,
299,
62,
47050,
796,
4129,
7,
9979,
62,
47050,
8,
198,
220,
220,
220,
299,
62,
29373,
796,
4129,
7,
9979,
62,
29373,
8,
628,
220,
220,
220,
1303,
2315,
17130,
351,
2180,
24415,
198,
220,
220,
220,
17130,
796,
1976,
27498,
7,
77,
62,
9979,
8,
198,
220,
220,
220,
17130,
58,
16,
25,
77,
62,
47050,
60,
796,
17130,
62,
47050,
628,
220,
220,
220,
1195,
62,
7493,
796,
685,
357,
42302,
62,
26518,
19510,
9979,
62,
47050,
58,
72,
7131,
16,
4357,
1500,
62,
47050,
58,
72,
7131,
17,
4357,
1500,
62,
29373,
58,
73,
7131,
16,
4357,
1500,
62,
29373,
58,
73,
7131,
17,
46570,
509,
11,
331,
8,
1267,
3712,
43879,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
62,
47050,
11,
474,
28,
16,
25,
77,
62,
29373,
60,
628,
220,
220,
220,
1195,
62,
7493,
62,
10989,
363,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
1312,
18189,
474,
5633,
42302,
62,
26518,
19510,
9979,
62,
29373,
58,
72,
7131,
16,
4357,
1500,
62,
29373,
58,
72,
7131,
17,
4357,
1500,
62,
29373,
58,
73,
7131,
16,
4357,
1500,
62,
29373,
58,
73,
7131,
17,
46570,
509,
11,
331,
8,
1058,
657,
13,
15,
1267,
3712,
43879,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
62,
29373,
11,
474,
28,
16,
25,
77,
62,
29373,
60,
198,
220,
220,
220,
1195,
62,
7493,
62,
10989,
363,
796,
685,
357,
72,
18189,
474,
5633,
1195,
62,
7493,
62,
10989,
363,
58,
72,
11,
73,
60,
1058,
1195,
62,
7493,
62,
10989,
363,
58,
73,
11,
72,
60,
1267,
3712,
43879,
2414,
329,
1312,
28,
16,
25,
77,
62,
29373,
11,
474,
28,
16,
25,
77,
62,
29373,
2361,
628,
220,
220,
220,
1195,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
357,
72,
19841,
299,
62,
47050,
11405,
474,
19841,
299,
62,
47050,
8,
5633,
1195,
62,
47050,
58,
72,
11,
474,
60,
1058,
357,
1312,
19841,
299,
62,
47050,
5633,
1195,
62,
7493,
58,
72,
11,
474,
12,
77,
62,
47050,
60,
1058,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
357,
474,
19841,
299,
62,
47050,
5633,
1195,
62,
7493,
58,
73,
11,
1312,
12,
77,
62,
47050,
60,
1058,
1195,
62,
7493,
62,
10989,
363,
58,
72,
12,
77,
62,
47050,
11,
474,
12,
77,
62,
47050,
60,
1267,
1267,
1267,
3712,
43879,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
62,
9979,
11,
474,
28,
16,
25,
77,
62,
9979,
60,
628,
220,
220,
220,
14364,
62,
7493,
796,
685,
357,
42302,
62,
535,
261,
301,
7,
9979,
62,
29373,
58,
72,
7131,
17,
12962,
1267,
3712,
43879,
2414,
329,
1312,
28,
16,
25,
77,
62,
29373,
2361,
198,
220,
220,
220,
14364,
796,
685,
357,
1312,
19841,
299,
62,
47050,
5633,
14364,
62,
47050,
58,
72,
60,
1058,
14364,
62,
7493,
58,
72,
12,
77,
62,
47050,
60,
1267,
3712,
43879,
2414,
329,
1312,
28,
16,
25,
77,
62,
9979,
60,
628,
220,
220,
220,
317,
62,
7493,
796,
599,
9107,
418,
7,
77,
11,
299,
62,
29373,
8,
198,
220,
220,
220,
329,
474,
796,
352,
25,
77,
62,
29373,
198,
220,
220,
220,
220,
220,
317,
62,
7493,
58,
9979,
62,
29373,
58,
73,
7131,
16,
4357,
474,
60,
796,
352,
13,
15,
198,
220,
220,
220,
886,
198,
220,
220,
220,
317,
796,
685,
32,
62,
47050,
317,
62,
7493,
60,
628,
220,
220,
220,
1303,
4296,
406,
12016,
72,
198,
220,
220,
220,
406,
12016,
72,
62,
7493,
796,
685,
357,
42302,
62,
26518,
19510,
344,
346,
7,
5317,
2414,
11,
1312,
14,
77,
62,
66,
828,
47527,
72,
4,
77,
62,
66,
855,
15,
19427,
299,
62,
66,
25,
72,
4,
77,
62,
66,
4357,
1500,
62,
29373,
58,
73,
7131,
16,
4357,
1500,
62,
29373,
58,
73,
7131,
17,
46570,
509,
11,
331,
8,
1267,
3712,
43879,
2414,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
62,
75,
862,
11,
474,
28,
16,
25,
77,
62,
29373,
60,
198,
220,
220,
220,
406,
12016,
72,
796,
685,
43,
12016,
72,
62,
47050,
406,
12016,
72,
62,
7493,
60,
628,
220,
220,
220,
22492,
751,
22146,
5945,
341,
198,
220,
220,
220,
329,
1312,
28,
16,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
1195,
58,
72,
11,
72,
60,
796,
1195,
58,
72,
11,
72,
60,
1343,
22146,
5945,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
284,
66,
9783,
198,
220,
220,
220,
220,
220,
256,
291,
9783,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
1540,
332,
6624,
1058,
70,
1434,
8482,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
4211,
30011,
7904,
402,
1434,
8482,
4943,
886,
628,
220,
220,
220,
220,
220,
22492,
2315,
2746,
198,
220,
220,
220,
220,
220,
2746,
796,
915,
305,
8482,
62,
19849,
7,
24330,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2565,
796,
1058,
1084,
48439,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
367,
796,
1195,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
796,
532,
28803,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
317,
796,
317,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
275,
796,
275,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18360,
796,
1976,
27498,
7,
77,
62,
9979,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
1303,
12578,
262,
2746,
284,
2198,
29409,
198,
220,
220,
220,
220,
220,
1303,
3601,
7,
19849,
8,
628,
220,
220,
220,
220,
220,
1303,
4294,
303,
351,
402,
1434,
8482,
198,
220,
220,
220,
220,
220,
402,
1434,
8482,
13,
40085,
1096,
7,
19849,
8,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
220,
220,
284,
66,
9783,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
16791,
5268,
1195,
47,
4943,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
10668,
62,
26801,
796,
532,
1136,
62,
26801,
2100,
7,
19849,
8,
198,
220,
220,
220,
220,
220,
1303,
28186,
198,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
10267,
425,
1988,
25,
33172,
10668,
62,
26801,
8,
886,
628,
220,
220,
220,
220,
220,
1303,
651,
17130,
198,
220,
220,
220,
220,
220,
17130,
796,
651,
62,
82,
2122,
7,
19849,
8,
198,
220,
220,
220,
220,
220,
1303,
44872,
7203,
26591,
796,
33172,
17130,
8,
198,
220,
220,
220,
220,
220,
1303,
198,
220,
220,
220,
220,
220,
1303,
44872,
7203,
1102,
2536,
6003,
796,
33172,
17778,
8,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
77,
17778,
796,
33172,
4129,
7,
1102,
2536,
6003,
4008,
886,
628,
220,
220,
220,
220,
220,
44386,
886,
1195,
47,
44386,
628,
220,
220,
220,
2073,
361,
1540,
332,
6624,
1058,
76,
577,
74,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
4211,
30011,
7904,
337,
577,
74,
4943,
886,
628,
220,
220,
220,
220,
220,
4876,
796,
285,
461,
316,
2093,
7,
24330,
8,
628,
220,
220,
220,
220,
220,
1303,
900,
42287,
198,
220,
220,
220,
220,
220,
1234,
600,
17143,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
4061,
1503,
62,
25294,
11,
352,
8,
198,
220,
220,
220,
220,
220,
1234,
600,
17143,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
4061,
1503,
62,
25294,
62,
50084,
62,
10943,
6089,
55,
9050,
11,
352,
8,
198,
220,
220,
220,
220,
220,
1234,
67,
280,
17143,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
6322,
1503,
62,
50084,
62,
10943,
6089,
55,
9050,
62,
16448,
62,
51,
3535,
11,
279,
21282,
83,
349,
8,
628,
220,
220,
220,
220,
220,
1303,
9633,
198,
220,
220,
220,
220,
220,
24443,
85,
945,
7,
35943,
11,
299,
62,
9979,
8,
198,
220,
220,
220,
220,
220,
1303,
5421,
319,
1401,
198,
220,
220,
220,
220,
220,
329,
1312,
3712,
5317,
2624,
796,
352,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
220,
220,
1234,
7784,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
26861,
62,
53,
1503,
11,
1312,
11,
337,
577,
74,
13,
5653,
42,
62,
33,
42,
62,
3861,
11,
657,
13,
15,
11,
327,
8,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
1303,
9432,
198,
220,
220,
220,
220,
220,
1234,
672,
8457,
1072,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
9864,
23680,
9306,
62,
50,
24290,
62,
23678,
3955,
35400,
8,
198,
220,
220,
220,
220,
220,
10662,
72,
796,
1976,
27498,
7,
5317,
2624,
11,
357,
77,
62,
9979,
1635,
357,
77,
62,
9979,
10,
16,
4008,
6184,
115,
362,
1267,
198,
220,
220,
220,
220,
220,
10662,
73,
796,
1976,
27498,
7,
5317,
2624,
11,
357,
77,
62,
9979,
1635,
357,
77,
62,
9979,
10,
16,
4008,
6184,
115,
362,
1267,
198,
220,
220,
220,
220,
220,
10662,
85,
796,
1976,
27498,
7,
43879,
2414,
11,
357,
77,
62,
9979,
1635,
357,
77,
62,
9979,
10,
16,
4008,
6184,
115,
362,
1267,
198,
220,
220,
220,
220,
220,
220,
844,
796,
352,
198,
220,
220,
220,
220,
220,
329,
474,
3712,
5317,
2624,
796,
352,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
3712,
5317,
2624,
796,
474,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10662,
72,
58,
844,
60,
796,
1312,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10662,
73,
58,
844,
60,
796,
474,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10662,
85,
58,
844,
60,
796,
1195,
58,
72,
11,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
844,
15853,
352,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
1234,
80,
26801,
7,
35943,
11,
10662,
72,
11,
10662,
73,
11,
10662,
85,
8,
628,
220,
220,
220,
220,
220,
1234,
565,
396,
7,
35943,
11,
2824,
7,
16,
25,
77,
62,
9979,
828,
532,
28803,
8,
628,
220,
220,
220,
220,
220,
1303,
17778,
198,
220,
220,
220,
220,
220,
22492,
29877,
7177,
198,
220,
220,
220,
220,
220,
24443,
5936,
7,
35943,
11,
299,
8,
198,
220,
220,
220,
220,
220,
329,
1312,
3712,
5317,
2624,
796,
352,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
220,
220,
4686,
62,
27305,
796,
317,
58,
45299,
72,
4083,
27305,
521,
198,
220,
220,
220,
220,
220,
220,
220,
1234,
330,
349,
7,
35943,
11,
1312,
11,
4686,
62,
27305,
11,
3392,
7,
13664,
7,
312,
62,
27305,
22305,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
329,
1312,
3712,
5317,
2624,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
1234,
7784,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
26861,
62,
10943,
11,
1312,
11,
337,
577,
74,
13,
5653,
42,
62,
33,
42,
62,
3861,
11,
657,
13,
15,
11,
327,
8,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
220,
220,
284,
66,
9783,
256,
291,
9783,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
337,
577,
74,
13,
40085,
1096,
7,
35943,
8,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
220,
220,
284,
66,
9783,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
16791,
5268,
1195,
47,
4943,
198,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
1303,
28186,
198,
220,
220,
220,
220,
220,
10668,
62,
26801,
11,
4808,
796,
3011,
2122,
10951,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
50,
3535,
62,
2043,
49,
8,
198,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
10267,
425,
1988,
25,
33172,
532,
646,
282,
62,
26801,
8,
886,
628,
220,
220,
220,
220,
220,
1303,
651,
17130,
198,
220,
220,
220,
220,
220,
17130,
796,
651,
5324,
7,
35943,
11,
337,
577,
74,
13,
5653,
42,
62,
50,
3535,
62,
2043,
49,
8,
628,
220,
220,
220,
220,
220,
611,
15942,
577,
44872,
7203,
77,
17778,
796,
33172,
4129,
7,
1102,
2536,
6003,
4008,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
26181,
62,
2411,
83,
349,
1875,
657,
13,
15,
198,
220,
220,
220,
220,
220,
611,
357,
646,
282,
62,
26801,
532,
10668,
62,
26801,
62,
47050,
8,
1220,
10668,
62,
26801,
62,
47050,
1279,
26181,
62,
2411,
83,
349,
11405,
11629,
1875,
352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
15942,
577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
19510,
646,
282,
62,
26801,
532,
10668,
62,
26801,
62,
47050,
8,
1220,
10668,
62,
26801,
62,
47050,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
44872,
7203,
4211,
40806,
341,
44934,
47,
1961,
930,
37092,
3585,
15621,
1058,
33172,
26181,
62,
2411,
83,
349,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2270,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
15942,
577,
44872,
3419,
886,
628,
220,
220,
220,
1195,
62,
47050,
796,
1195,
198,
220,
220,
220,
14364,
62,
47050,
796,
14364,
198,
220,
220,
220,
317,
62,
47050,
796,
317,
198,
220,
220,
220,
406,
12016,
72,
62,
47050,
796,
406,
12016,
72,
198,
220,
220,
220,
10668,
62,
26801,
62,
47050,
796,
10668,
62,
26801,
198,
220,
886,
628,
220,
1303,
2457,
2890,
9089,
198,
220,
308,
85,
62,
7493,
796,
1976,
27498,
7,
77,
8,
198,
220,
308,
85,
62,
486,
796,
1976,
27498,
7,
77,
8,
198,
220,
300,
62,
32225,
796,
1976,
27498,
7,
77,
8,
198,
220,
300,
62,
486,
796,
1976,
27498,
7,
77,
8,
198,
220,
329,
1312,
28,
16,
25,
77,
198,
220,
220,
220,
279,
13429,
796,
46231,
62,
4868,
62,
646,
282,
7,
26591,
11,
406,
12016,
72,
11,
1312,
11,
299,
62,
66,
8,
198,
220,
220,
220,
279,
13429,
62,
312,
11,
1188,
796,
1266,
62,
862,
271,
7,
862,
271,
8,
220,
220,
220,
220,
220,
1303,
749,
13998,
17778,
198,
220,
220,
220,
299,
62,
862,
796,
4129,
7,
862,
271,
62,
312,
8,
628,
220,
220,
220,
308,
85,
62,
7493,
58,
72,
60,
796,
1188,
628,
220,
220,
220,
1303,
24061,
386,
1443,
198,
220,
220,
220,
279,
62,
5183,
796,
1976,
27498,
7,
77,
62,
66,
8,
198,
220,
220,
220,
279,
62,
9122,
796,
1976,
27498,
7,
77,
62,
66,
8,
198,
220,
220,
220,
329,
474,
28,
16,
25,
77,
62,
66,
198,
220,
220,
220,
220,
220,
611,
474,
287,
279,
13429,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
5183,
58,
73,
60,
796,
357,
357,
77,
62,
862,
12,
16,
13,
15,
27493,
862,
271,
58,
73,
60,
532,
2160,
7,
862,
271,
58,
862,
271,
62,
312,
58,
862,
271,
62,
312,
764,
0,
28,
474,
11907,
8,
1343,
352,
13,
15,
1267,
1220,
299,
62,
862,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
9122,
58,
73,
60,
796,
352,
13,
15,
1220,
299,
62,
862,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
5183,
58,
73,
60,
796,
657,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
279,
62,
9122,
58,
73,
60,
796,
657,
13,
15,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
327,
486,
796,
352,
532,
4151,
7,
77,
62,
66,
8,
220,
220,
220,
1303,
5534,
2994,
17593,
198,
220,
220,
220,
410,
796,
279,
62,
5183,
6,
1635,
327,
486,
1635,
279,
62,
9122,
220,
220,
1303,
262,
1255,
318,
15879,
2546,
352,
407,
257,
1271,
198,
220,
220,
220,
308,
85,
62,
486,
58,
72,
60,
796,
410,
58,
16,
60,
220,
220,
220,
220,
1303,
628,
220,
220,
220,
22492,
3047,
2994,
198,
220,
220,
220,
300,
62,
32225,
58,
72,
60,
796,
352,
13,
15,
532,
279,
62,
5183,
58,
88,
58,
72,
11907,
198,
220,
220,
220,
300,
62,
486,
58,
72,
60,
796,
352,
13,
15,
532,
2835,
7,
5317,
11,
773,
9806,
7,
79,
62,
5183,
8,
6624,
331,
58,
72,
12962,
198,
220,
886,
628,
220,
983,
62,
8367,
62,
486,
796,
1612,
7,
70,
85,
62,
486,
8,
198,
220,
983,
62,
8367,
62,
559,
5154,
276,
796,
1612,
7,
70,
85,
62,
7493,
8,
628,
220,
1303,
2251,
2746,
198,
220,
1354,
62,
19849,
796,
32169,
29800,
2782,
690,
36098,
17633,
7,
33885,
11,
9720,
62,
37266,
11,
17130,
11,
17778,
11,
299,
62,
66,
11,
983,
62,
8367,
62,
486,
11,
983,
62,
8367,
62,
559,
5154,
276,
11,
1612,
7,
75,
62,
32225,
828,
1612,
7,
75,
62,
486,
4008,
628,
220,
1441,
1354,
62,
19849,
3712,
42,
7948,
29800,
2782,
690,
36098,
17633,
198,
437,
198,
198,
8818,
4331,
62,
32225,
62,
33885,
7,
19849,
3712,
42,
7948,
29800,
2782,
690,
36098,
17633,
11,
1395,
62,
9288,
3712,
46912,
11,
1395,
62,
27432,
3712,
46912,
11,
331,
62,
27432,
3712,
38469,
8,
628,
220,
17130,
796,
2746,
13,
26591,
198,
220,
299,
62,
66,
796,
2746,
13,
77,
62,
4871,
198,
220,
299,
796,
2546,
7,
55,
62,
9288,
11,
352,
8,
628,
220,
17778,
796,
2746,
13,
1102,
2536,
6003,
198,
220,
299,
62,
9979,
796,
4129,
7,
26591,
8,
628,
220,
1395,
16,
796,
685,
1952,
7,
77,
8,
1395,
62,
9288,
49946,
220,
220,
1303,
1007,
3455,
198,
220,
285,
796,
2546,
7,
55,
16,
11,
352,
8,
628,
220,
1303,
3047,
1366,
198,
220,
299,
62,
2213,
796,
2546,
7,
55,
62,
27432,
11,
352,
8,
198,
220,
1395,
16,
62,
2213,
796,
685,
1952,
7,
77,
62,
2213,
8,
1395,
62,
27432,
49946,
220,
220,
1303,
1007,
3455,
628,
220,
1303,
9720,
198,
220,
9720,
796,
2746,
13,
33885,
198,
220,
9720,
62,
37266,
796,
2746,
13,
33885,
62,
37266,
198,
220,
1303,
9720,
2163,
198,
220,
9720,
62,
20786,
796,
14174,
62,
33885,
198,
220,
611,
9720,
6624,
1058,
4908,
31562,
198,
220,
220,
220,
9720,
62,
20786,
796,
31986,
31562,
62,
33885,
198,
220,
2073,
361,
9720,
6624,
1058,
35428,
26601,
498,
198,
220,
220,
220,
9720,
62,
20786,
796,
745,
6213,
49070,
62,
33885,
198,
220,
886,
628,
220,
1303,
24061,
32169,
198,
220,
509,
796,
685,
9720,
62,
20786,
7,
55,
16,
62,
2213,
58,
45299,
72,
4357,
1395,
16,
58,
45299,
73,
4357,
9720,
62,
37266,
986,
2599,
25,
43879,
2414,
329,
1312,
28,
16,
25,
77,
62,
2213,
11,
474,
28,
16,
25,
77,
60,
628,
220,
1861,
796,
1976,
27498,
7,
77,
11,
299,
62,
66,
8,
198,
220,
2747,
796,
1976,
27498,
7,
77,
8,
198,
220,
329,
1312,
28,
16,
25,
77,
628,
220,
220,
220,
279,
13429,
796,
1976,
27498,
7,
77,
62,
66,
8,
198,
220,
220,
220,
329,
474,
796,
352,
25,
77,
62,
9979,
198,
220,
220,
220,
220,
220,
279,
13429,
48185,
17130,
58,
73,
60,
1635,
42302,
62,
26518,
75,
34846,
7,
357,
1102,
2536,
6003,
58,
73,
7131,
16,
4357,
17778,
58,
73,
7131,
17,
4357,
1312,
828,
509,
11,
331,
62,
27432,
11,
299,
62,
66,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
279,
13429,
62,
312,
11,
1188,
796,
1266,
62,
862,
271,
7,
862,
271,
8,
220,
220,
220,
220,
220,
1303,
749,
13998,
17778,
198,
220,
220,
220,
299,
62,
862,
796,
4129,
7,
862,
271,
62,
312,
8,
628,
220,
220,
220,
329,
474,
28,
16,
25,
77,
62,
66,
198,
220,
220,
220,
220,
220,
611,
474,
287,
279,
13429,
62,
312,
198,
220,
220,
220,
220,
220,
220,
220,
1861,
58,
72,
11,
73,
60,
796,
357,
357,
77,
62,
862,
12,
16,
13,
15,
27493,
862,
271,
58,
73,
60,
532,
2160,
7,
862,
271,
58,
862,
271,
62,
312,
58,
862,
271,
62,
312,
764,
0,
28,
474,
11907,
8,
1343,
352,
13,
15,
1267,
1220,
299,
62,
862,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1861,
58,
72,
11,
73,
60,
796,
657,
13,
15,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2747,
58,
72,
60,
796,
773,
9806,
7,
862,
271,
8,
628,
220,
886,
628,
220,
1441,
1861,
3712,
46912,
90,
43879,
2414,
5512,
2747,
3712,
38469,
90,
43879,
2414,
92,
198,
437,
198,
198,
8818,
1332,
62,
32225,
62,
33885,
7,
19849,
3712,
42,
7948,
29800,
2782,
690,
36098,
17633,
11,
1395,
62,
9288,
3712,
46912,
11,
331,
62,
9288,
3712,
38469,
11,
1395,
62,
27432,
3712,
46912,
11,
331,
62,
27432,
3712,
38469,
8,
198,
220,
299,
796,
2546,
7,
55,
62,
9288,
11,
352,
8,
628,
220,
331,
62,
1676,
65,
11,
331,
62,
28764,
796,
4331,
62,
32225,
62,
33885,
7,
19849,
11,
1395,
62,
9288,
11,
1395,
62,
27432,
11,
331,
62,
27432,
8,
628,
220,
1303,
15284,
4856,
2994,
198,
220,
9089,
796,
1976,
27498,
7,
77,
8,
198,
220,
9089,
486,
796,
1976,
27498,
7,
77,
8,
198,
220,
329,
1312,
28,
16,
25,
77,
198,
220,
220,
220,
9089,
58,
72,
60,
796,
352,
13,
15,
532,
331,
62,
1676,
65,
58,
72,
11,
331,
62,
9288,
58,
72,
11907,
198,
220,
220,
220,
9089,
486,
58,
72,
60,
796,
352,
13,
15,
532,
2835,
7,
5317,
11,
331,
62,
28764,
58,
72,
60,
6624,
331,
62,
9288,
58,
72,
12962,
198,
220,
886,
628,
220,
2994,
796,
2160,
7,
22462,
274,
8,
1220,
299,
198,
220,
2994,
486,
796,
2160,
7,
22462,
274,
486,
8,
1220,
299,
628,
220,
1441,
2994,
3712,
43879,
2414,
11,
9089,
3712,
38469,
90,
43879,
2414,
5512,
2994,
486,
3712,
43879,
2414,
11,
9089,
486,
3712,
38469,
90,
43879,
2414,
5512,
198,
220,
220,
331,
62,
1676,
65,
3712,
46912,
90,
43879,
2414,
5512,
331,
62,
28764,
3712,
38469,
90,
43879,
2414,
92,
198,
198,
437,
198
] | 2.02935 | 5,213 |
## ----------------------------------------------------------------------------
# proj 2D
let
method = ME_MAX_POL
biom_ider = iJR.BIOMASS_IDER
ps_pool = Dict()
for exp in EXPS
datfile = ME_INDEX[method, :DFILE, exp]
dat = deserialize(datfile)
model = dat[:model]
for Hd_ider in FLX_IDERS
# 2D Projection
p = plot(;title = string("Heerden2013, exp", exp),
xlabel = string(biom_ider), ylabel = string(Hd_ider),
legend = :right
)
proj = DAT[method, :ep, :proj, Hd_ider, exp]
ChP.plot_projection2D!(p, proj; l = 50)
# bounds
lb, ub = DAT[method, :bounds, :flx, Hd_ider, exp]
hline!(p, [lb]; lw = 3,
label = "fva lb",
color = :blue, ls = :solid
)
hline!(p, [ub]; lw = 3,
label = "fva ub",
color = :red, ls = :solid
)
# EXPERIMENTAL FLXS
exp_biom = DAT[method, :Hd, :flx, biom_ider, exp]
exp_exch = DAT[method, :Hd, :flx, Hd_ider, exp]
scatter!(p, [exp_biom], [exp_exch];
m = 8, color = :red, label = "exp"
)
# MAXENT FLXS
ep_biom = DAT[method, :ep, :flx, biom_ider, exp]
ep_biom_err = DAT[method, :eperr, :flx, biom_ider, exp]
ep_exch = DAT[method, :ep, :flx, Hd_ider, exp]
ep_exch_err = DAT[method, :eperr, :flx, Hd_ider, exp]
scatter!(p, [ep_biom], [ep_exch];
xerr = [ep_biom_err], yerr = [ep_exch_err],
m = 8, color = :blue, label = "maxent"
)
# mysavefig(p, "polytope"; Hd_ider, exp, method)
ps_pool[(exp, Hd_ider)] = deepcopy(p)
end
end
# collect
for exp in EXPS
ps = Plots.Plot[ps_pool[(exp, Hd_ider)] for Hd_ider in FLX_IDERS]
mysavefig(ps, "polytope"; exp, method)
end
for Hd_ider in FLX_IDERS
ps = Plots.Plot[ps_pool[(exp, Hd_ider)] for exp in EXPS]
mysavefig(ps, "polytope"; Hd_ider, method)
end
end | [
198,
2235,
16529,
10541,
198,
2,
386,
73,
362,
35,
198,
1616,
198,
220,
220,
220,
2446,
796,
11948,
62,
22921,
62,
45472,
198,
220,
220,
220,
27488,
62,
1304,
796,
1312,
44817,
13,
3483,
2662,
10705,
62,
41237,
628,
220,
220,
220,
26692,
62,
7742,
796,
360,
713,
3419,
198,
220,
220,
220,
329,
1033,
287,
7788,
3705,
628,
220,
220,
220,
220,
220,
220,
220,
4818,
7753,
796,
11948,
62,
12115,
6369,
58,
24396,
11,
1058,
8068,
41119,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
4818,
796,
748,
48499,
1096,
7,
19608,
7753,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
4818,
58,
25,
19849,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
329,
367,
67,
62,
1304,
287,
9977,
55,
62,
2389,
4877,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
362,
35,
4935,
295,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
279,
796,
7110,
7,
26,
7839,
796,
4731,
7203,
1544,
263,
6559,
6390,
11,
1033,
1600,
1033,
828,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
18242,
796,
4731,
7,
8482,
296,
62,
1304,
828,
331,
18242,
796,
4731,
7,
39,
67,
62,
1304,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8177,
796,
1058,
3506,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
386,
73,
796,
360,
1404,
58,
24396,
11,
1058,
538,
11,
1058,
1676,
73,
11,
367,
67,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
609,
47,
13,
29487,
62,
16302,
295,
17,
35,
0,
7,
79,
11,
386,
73,
26,
300,
796,
2026,
8,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
22303,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18360,
11,
20967,
796,
360,
1404,
58,
24396,
11,
1058,
65,
3733,
11,
1058,
2704,
87,
11,
367,
67,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
1370,
0,
7,
79,
11,
685,
23160,
11208,
300,
86,
796,
513,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
796,
366,
69,
6862,
18360,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
796,
1058,
17585,
11,
43979,
796,
1058,
39390,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
289,
1370,
0,
7,
79,
11,
685,
549,
11208,
300,
86,
796,
513,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
6167,
796,
366,
69,
6862,
20967,
1600,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3124,
796,
1058,
445,
11,
43979,
796,
1058,
39390,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
7788,
18973,
3955,
3525,
1847,
9977,
55,
50,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
62,
8482,
296,
796,
360,
1404,
58,
24396,
11,
1058,
39,
67,
11,
1058,
2704,
87,
11,
27488,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
62,
1069,
354,
796,
360,
1404,
58,
24396,
11,
1058,
39,
67,
11,
1058,
2704,
87,
11,
367,
67,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41058,
0,
7,
79,
11,
685,
11201,
62,
8482,
296,
4357,
685,
11201,
62,
1069,
354,
11208,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
796,
807,
11,
3124,
796,
1058,
445,
11,
6167,
796,
366,
11201,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
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,
25882,
3525,
9977,
55,
50,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
8482,
296,
796,
360,
1404,
58,
24396,
11,
1058,
538,
11,
1058,
2704,
87,
11,
27488,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
8482,
296,
62,
8056,
796,
360,
1404,
58,
24396,
11,
1058,
5723,
81,
11,
1058,
2704,
87,
11,
27488,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
1069,
354,
796,
360,
1404,
58,
24396,
11,
1058,
538,
11,
1058,
2704,
87,
11,
367,
67,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2462,
62,
1069,
354,
62,
8056,
796,
360,
1404,
58,
24396,
11,
1058,
5723,
81,
11,
1058,
2704,
87,
11,
367,
67,
62,
1304,
11,
1033,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
41058,
0,
7,
79,
11,
685,
538,
62,
8482,
296,
4357,
685,
538,
62,
1069,
354,
11208,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
8056,
796,
685,
538,
62,
8482,
296,
62,
8056,
4357,
331,
8056,
796,
685,
538,
62,
1069,
354,
62,
8056,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
285,
796,
807,
11,
3124,
796,
1058,
17585,
11,
6167,
796,
366,
9806,
298,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
616,
21928,
5647,
7,
79,
11,
366,
35428,
83,
3008,
8172,
367,
67,
62,
1304,
11,
1033,
11,
2446,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26692,
62,
7742,
58,
7,
11201,
11,
367,
67,
62,
1304,
15437,
796,
2769,
30073,
7,
79,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
2824,
220,
198,
220,
220,
220,
329,
1033,
287,
7788,
3705,
198,
220,
220,
220,
220,
220,
220,
220,
26692,
796,
1345,
1747,
13,
43328,
58,
862,
62,
7742,
58,
7,
11201,
11,
367,
67,
62,
1304,
15437,
329,
367,
67,
62,
1304,
287,
9977,
55,
62,
2389,
4877,
60,
198,
220,
220,
220,
220,
220,
220,
220,
616,
21928,
5647,
7,
862,
11,
366,
35428,
83,
3008,
8172,
1033,
11,
2446,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
367,
67,
62,
1304,
287,
9977,
55,
62,
2389,
4877,
198,
220,
220,
220,
220,
220,
220,
220,
26692,
796,
1345,
1747,
13,
43328,
58,
862,
62,
7742,
58,
7,
11201,
11,
367,
67,
62,
1304,
15437,
329,
1033,
287,
7788,
3705,
60,
198,
220,
220,
220,
220,
220,
220,
220,
616,
21928,
5647,
7,
862,
11,
366,
35428,
83,
3008,
8172,
367,
67,
62,
1304,
11,
2446,
8,
198,
220,
220,
220,
886,
198,
437
] | 1.750794 | 1,260 |
using Base.Iterators
abstract type Part1 end
abstract type Part2 end
function update!(::Type{Part1}, grid::AbstractMatrix{Char})
previous = copy(grid)
updated = false
for j in 1:size(grid, 2), i in 1:size(grid, 1)
middle = previous[i, j]
switch = true
numoccupied = 0
for (δj, δi) in product([-1, 0, 1], [-1, 0, 1])
δi == δj == 0 && continue
try
neighbor = previous[i + δi, j + δj]
if neighbor == '#'
middle == 'L' && (switch = false)
middle == '#' && (numoccupied += 1)
end
catch
end
end
middle == 'L' && switch && (grid[i, j] = '#'; updated = true)
middle == '#' && numoccupied ≥ 4 && (grid[i, j] = 'L'; updated = true)
end
updated
end
const Site = Tuple{Int, Int}
function visibility(init::AbstractMatrix{Char})
N, M = size(init)
visible = Dict{Site, Vector{Site}}()
for j in 1:M, i in 1:N
if init[i, j] != '.'
for (δj, δi) in product([-1, 0, 1], [-1, 0, 1])
δi == δj == 0 && continue
u, v = i + δi, j + δj
try
while init[u, v] == '.'
u += δi
v += δj
end
if haskey(visible, (i, j))
push!(visible[(i, j)], (u, v))
else
visible[(i, j)] = [(u, v)]
end
catch
end
end
end
end
visible
end
function update!(::Type{Part2}, grid::AbstractMatrix{Char}, visible)
previous = copy(grid)
updated = false
for (i, j) in keys(visible)
if previous[i, j] == 'L'
switch = true
for (u, v) in visible[(i, j)]
if previous[u, v] == '#'
switch = false
end
end
switch && (grid[i, j] = '#'; updated = true)
elseif previous[i, j] == '#'
numoccupied = 0
for (u, v) in visible[(i, j)]
if previous[u, v] == '#'
numoccupied += 1
end
end
numoccupied ≥ 5 && (grid[i, j] = 'L'; updated = true)
end
end
updated
end
function part1(grid)
while update!(Part1, grid) end
sum(grid .== '#')
end
function part2(grid)
visible = visibility(grid)
while update!(Part2, grid, visible) end
sum(grid .== '#')
end
let init = hcat(collect.(readlines("input.txt"))...)
@info "Solution" part1(init) part2(init)
end
| [
3500,
7308,
13,
29993,
2024,
198,
198,
397,
8709,
2099,
2142,
16,
886,
198,
397,
8709,
2099,
2142,
17,
886,
198,
198,
8818,
4296,
0,
7,
3712,
6030,
90,
7841,
16,
5512,
10706,
3712,
23839,
46912,
90,
12441,
30072,
198,
220,
220,
220,
2180,
796,
4866,
7,
25928,
8,
198,
220,
220,
220,
6153,
796,
3991,
198,
220,
220,
220,
329,
474,
287,
352,
25,
7857,
7,
25928,
11,
362,
828,
1312,
287,
352,
25,
7857,
7,
25928,
11,
352,
8,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
3504,
796,
2180,
58,
72,
11,
474,
60,
198,
220,
220,
220,
220,
220,
220,
220,
5078,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
997,
28756,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
329,
357,
138,
112,
73,
11,
7377,
112,
72,
8,
287,
1720,
26933,
12,
16,
11,
657,
11,
352,
4357,
25915,
16,
11,
657,
11,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
112,
72,
6624,
7377,
112,
73,
6624,
657,
11405,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4780,
796,
2180,
58,
72,
1343,
7377,
112,
72,
11,
474,
1343,
7377,
112,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4780,
6624,
705,
2,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3504,
6624,
705,
43,
6,
11405,
357,
31943,
796,
3991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3504,
6624,
705,
2,
6,
11405,
357,
22510,
28756,
15853,
352,
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,
4929,
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,
3504,
6624,
705,
43,
6,
11405,
5078,
11405,
357,
25928,
58,
72,
11,
474,
60,
796,
705,
2,
17020,
6153,
796,
2081,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3504,
6624,
705,
2,
6,
11405,
997,
28756,
26870,
604,
11405,
357,
25928,
58,
72,
11,
474,
60,
796,
705,
43,
17020,
6153,
796,
2081,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
6153,
198,
437,
198,
198,
9979,
14413,
796,
309,
29291,
90,
5317,
11,
2558,
92,
198,
198,
8818,
20742,
7,
15003,
3712,
23839,
46912,
90,
12441,
30072,
198,
220,
220,
220,
399,
11,
337,
796,
2546,
7,
15003,
8,
628,
220,
220,
220,
7424,
796,
360,
713,
90,
29123,
11,
20650,
90,
29123,
11709,
3419,
628,
220,
220,
220,
329,
474,
287,
352,
25,
44,
11,
1312,
287,
352,
25,
45,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2315,
58,
72,
11,
474,
60,
14512,
705,
2637,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
138,
112,
73,
11,
7377,
112,
72,
8,
287,
1720,
26933,
12,
16,
11,
657,
11,
352,
4357,
25915,
16,
11,
657,
11,
352,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7377,
112,
72,
6624,
7377,
112,
73,
6624,
657,
11405,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
11,
410,
796,
1312,
1343,
7377,
112,
72,
11,
474,
1343,
7377,
112,
73,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
981,
2315,
58,
84,
11,
410,
60,
6624,
705,
2637,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
15853,
7377,
112,
72,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
410,
15853,
7377,
112,
73,
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,
611,
468,
2539,
7,
23504,
11,
357,
72,
11,
474,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
23504,
58,
7,
72,
11,
474,
8,
4357,
357,
84,
11,
410,
4008,
198,
220,
220,
220,
220,
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,
220,
220,
220,
220,
7424,
58,
7,
72,
11,
474,
15437,
796,
47527,
84,
11,
410,
15437,
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,
4929,
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,
198,
220,
220,
220,
7424,
198,
437,
198,
198,
8818,
4296,
0,
7,
3712,
6030,
90,
7841,
17,
5512,
10706,
3712,
23839,
46912,
90,
12441,
5512,
7424,
8,
198,
220,
220,
220,
2180,
796,
4866,
7,
25928,
8,
198,
220,
220,
220,
6153,
796,
3991,
198,
220,
220,
220,
329,
357,
72,
11,
474,
8,
287,
8251,
7,
23504,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2180,
58,
72,
11,
474,
60,
6624,
705,
43,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5078,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
84,
11,
410,
8,
287,
7424,
58,
7,
72,
11,
474,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2180,
58,
84,
11,
410,
60,
6624,
705,
2,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5078,
796,
3991,
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,
5078,
11405,
357,
25928,
58,
72,
11,
474,
60,
796,
705,
2,
17020,
6153,
796,
2081,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
2180,
58,
72,
11,
474,
60,
6624,
705,
2,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
997,
28756,
796,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
357,
84,
11,
410,
8,
287,
7424,
58,
7,
72,
11,
474,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2180,
58,
84,
11,
410,
60,
6624,
705,
2,
6,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
997,
28756,
15853,
352,
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,
997,
28756,
26870,
642,
11405,
357,
25928,
58,
72,
11,
474,
60,
796,
705,
43,
17020,
6153,
796,
2081,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
6153,
198,
437,
198,
198,
8818,
636,
16,
7,
25928,
8,
198,
220,
220,
220,
981,
4296,
0,
7,
7841,
16,
11,
10706,
8,
886,
198,
220,
220,
220,
2160,
7,
25928,
764,
855,
705,
2,
11537,
198,
437,
198,
198,
8818,
636,
17,
7,
25928,
8,
198,
220,
220,
220,
7424,
796,
20742,
7,
25928,
8,
198,
220,
220,
220,
981,
4296,
0,
7,
7841,
17,
11,
10706,
11,
7424,
8,
886,
198,
220,
220,
220,
2160,
7,
25928,
764,
855,
705,
2,
11537,
198,
437,
198,
198,
1616,
2315,
796,
289,
9246,
7,
33327,
12195,
961,
6615,
7203,
15414,
13,
14116,
48774,
23029,
198,
220,
220,
220,
2488,
10951,
366,
46344,
1,
636,
16,
7,
15003,
8,
636,
17,
7,
15003,
8,
198,
437,
198
] | 1.782034 | 1,514 |
set_global_client()
@testset "Pipeline - Basic" begin
pipe = Pipeline()
@test length(pipe.resp) == 0
for _ in 1:1000
lrange("nothing", 0, -1; client=pipe)
end
@test length(pipe.resp) == 1000
result = execute(pipe)
@test result == fill([], 1000)
@test length(pipe.resp) == 0
end
@testset "Pipeline - Do Block" begin
result = pipeline() do pipe
for _ in 1:1000
lrange("nothing", 0, -1; client=pipe)
end
end
@test result == fill([], 1000)
end
@testset "Pipeline - MULTI/EXEC" begin
no_filter_result = pipeline(; filter_multi_exec=false) do pipe
multi(; client=pipe)
for _ in 1:1000
lrange("nothing", 0, -1; client=pipe)
end
exec(; client=pipe)
end
@test length(no_filter_result) == 1002
@test no_filter_result[1] == "OK"
@test no_filter_result[2:length(no_filter_result)-1] == fill("QUEUED", 1000)
@test no_filter_result[end] == fill([], 1000)
filter_result = pipeline(; filter_multi_exec=true) do pipe
multi_exec(; client=pipe) do
for _ in 1:1000
lrange("nothing", 0, -1; client=pipe)
end
end
end
@test length(filter_result) == 1
@test filter_result[1] == fill([], 1000)
end
flushall() | [
2617,
62,
20541,
62,
16366,
3419,
198,
198,
31,
9288,
2617,
366,
47,
541,
4470,
532,
14392,
1,
2221,
198,
220,
220,
220,
12656,
796,
37709,
3419,
198,
220,
220,
220,
2488,
9288,
4129,
7,
34360,
13,
4363,
8,
6624,
657,
198,
220,
220,
220,
329,
4808,
287,
352,
25,
12825,
198,
220,
220,
220,
220,
220,
220,
220,
300,
9521,
7203,
22366,
1600,
657,
11,
532,
16,
26,
5456,
28,
34360,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
4129,
7,
34360,
13,
4363,
8,
6624,
8576,
198,
220,
220,
220,
1255,
796,
12260,
7,
34360,
8,
198,
220,
220,
220,
2488,
9288,
1255,
6624,
6070,
26933,
4357,
8576,
8,
198,
220,
220,
220,
2488,
9288,
4129,
7,
34360,
13,
4363,
8,
6624,
657,
198,
437,
198,
198,
31,
9288,
2617,
366,
47,
541,
4470,
532,
2141,
9726,
1,
2221,
198,
220,
220,
220,
1255,
796,
11523,
3419,
466,
12656,
198,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
287,
352,
25,
12825,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
9521,
7203,
22366,
1600,
657,
11,
532,
16,
26,
5456,
28,
34360,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
1255,
6624,
6070,
26933,
4357,
8576,
8,
198,
437,
198,
198,
31,
9288,
2617,
366,
47,
541,
4470,
532,
337,
16724,
40,
14,
6369,
2943,
1,
2221,
198,
220,
220,
220,
645,
62,
24455,
62,
20274,
796,
11523,
7,
26,
8106,
62,
41684,
62,
18558,
28,
9562,
8,
466,
12656,
198,
220,
220,
220,
220,
220,
220,
220,
5021,
7,
26,
5456,
28,
34360,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
287,
352,
25,
12825,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
9521,
7203,
22366,
1600,
657,
11,
532,
16,
26,
5456,
28,
34360,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
2452,
7,
26,
5456,
28,
34360,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
9288,
4129,
7,
3919,
62,
24455,
62,
20274,
8,
6624,
1802,
17,
198,
220,
220,
220,
2488,
9288,
645,
62,
24455,
62,
20274,
58,
16,
60,
6624,
366,
11380,
1,
198,
220,
220,
220,
2488,
9288,
645,
62,
24455,
62,
20274,
58,
17,
25,
13664,
7,
3919,
62,
24455,
62,
20274,
13219,
16,
60,
6624,
6070,
7203,
48,
8924,
52,
1961,
1600,
8576,
8,
198,
220,
220,
220,
2488,
9288,
645,
62,
24455,
62,
20274,
58,
437,
60,
6624,
6070,
26933,
4357,
8576,
8,
628,
220,
220,
220,
8106,
62,
20274,
796,
11523,
7,
26,
8106,
62,
41684,
62,
18558,
28,
7942,
8,
466,
12656,
198,
220,
220,
220,
220,
220,
220,
220,
5021,
62,
18558,
7,
26,
5456,
28,
34360,
8,
466,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
4808,
287,
352,
25,
12825,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
9521,
7203,
22366,
1600,
657,
11,
532,
16,
26,
5456,
28,
34360,
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,
886,
198,
220,
220,
220,
2488,
9288,
4129,
7,
24455,
62,
20274,
8,
6624,
352,
198,
220,
220,
220,
2488,
9288,
8106,
62,
20274,
58,
16,
60,
6624,
6070,
26933,
4357,
8576,
8,
198,
437,
198,
198,
25925,
439,
3419
] | 2.213198 | 591 |
#== # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Description
#
# Tests related to IAU-2006 precession-nutation algorithm.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# References
#
# [1] Vallado, D. A (2013). Fundamentals of Astrodynamics and Applications.
# Microcosm Press, Hawthorn, CA, USA.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ==#
# File: ./src/transformations/precession_nutation_iau2006.jl
# ==========================================================
# Function precession_nutation_iau2006
# ------------------------------------
################################################################################
# Test Results
################################################################################
#
# Scenario 01
# ===========
#
# Example 3-14: Performing an IAU-2000 reduction [1, p. 220]
#
# According to this example, using JD_TT = 2453101.828154745, one gets:
#
# X = 80.531880"
# Y = 7.273921"
# s = -0.003027"
#
################################################################################
@testset "Function precession_nutation_iau2006" begin
JD_TT = 2453101.828_154_745
X,Y,s = precession_nutation_iau2006(JD_TT)
@test X*180/pi*3600 ≈ 80.531880 atol = 5e-5
@test Y*180/pi*3600 ≈ 7.273921 atol = 5e-5
@test s*180/pi*3600 ≈ -0.003027 atol = 1e-6
end
| [
2,
855,
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,
198,
2,
220,
220,
30307,
3519,
284,
314,
26830,
12,
13330,
662,
43914,
12,
77,
7094,
11862,
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,
2,
198,
2,
31458,
198,
2,
198,
2,
220,
220,
685,
16,
60,
46929,
4533,
11,
360,
13,
317,
357,
6390,
737,
7557,
3263,
874,
286,
8304,
14892,
4989,
873,
290,
26622,
13,
198,
2,
220,
220,
220,
220,
220,
220,
4527,
6966,
76,
4332,
11,
41457,
1211,
11,
7257,
11,
4916,
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,
6624,
2,
198,
198,
2,
9220,
25,
24457,
10677,
14,
35636,
602,
14,
3866,
43914,
62,
77,
7094,
62,
544,
84,
13330,
13,
20362,
198,
2,
46111,
4770,
2559,
28,
198,
198,
2,
15553,
662,
43914,
62,
77,
7094,
62,
544,
84,
13330,
198,
2,
20368,
650,
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,
6208,
15691,
198,
29113,
29113,
14468,
198,
2,
198,
2,
1446,
39055,
5534,
198,
2,
796,
2559,
855,
198,
2,
198,
2,
17934,
513,
12,
1415,
25,
2448,
15464,
281,
314,
26830,
12,
11024,
7741,
685,
16,
11,
279,
13,
15629,
60,
198,
2,
198,
2,
4784,
284,
428,
1672,
11,
1262,
28591,
62,
15751,
796,
29637,
3132,
486,
13,
23,
2078,
1314,
2857,
2231,
11,
530,
3011,
25,
198,
2,
198,
2,
220,
220,
1395,
796,
4019,
13,
4310,
1507,
1795,
1,
198,
2,
220,
220,
575,
796,
220,
767,
13,
1983,
2670,
2481,
1,
198,
2,
220,
220,
264,
796,
532,
15,
13,
405,
1270,
1983,
1,
198,
2,
198,
29113,
29113,
14468,
198,
198,
31,
9288,
2617,
366,
22203,
662,
43914,
62,
77,
7094,
62,
544,
84,
13330,
1,
2221,
198,
220,
220,
220,
28591,
62,
15751,
796,
29637,
3132,
486,
13,
23,
2078,
62,
21526,
62,
50150,
628,
220,
220,
220,
1395,
11,
56,
11,
82,
796,
662,
43914,
62,
77,
7094,
62,
544,
84,
13330,
7,
37882,
62,
15751,
8,
628,
220,
220,
220,
2488,
9288,
1395,
9,
15259,
14,
14415,
9,
2623,
405,
15139,
230,
4019,
13,
4310,
1507,
1795,
379,
349,
796,
642,
68,
12,
20,
198,
220,
220,
220,
2488,
9288,
575,
9,
15259,
14,
14415,
9,
2623,
405,
15139,
230,
220,
767,
13,
1983,
2670,
2481,
379,
349,
796,
642,
68,
12,
20,
198,
220,
220,
220,
2488,
9288,
264,
9,
15259,
14,
14415,
9,
2623,
405,
15139,
230,
532,
15,
13,
405,
1270,
1983,
379,
349,
796,
352,
68,
12,
21,
198,
437,
198
] | 2.652803 | 553 |
### A Pluto.jl notebook ###
# v0.18.4
using Markdown
using InteractiveUtils
# ╔═╡ 3e14817e-85f8-4d5b-8a8f-075d1799ed27
using AbstractTrees, PlutoUI, Random, Wordlegames
# ╔═╡ ed649770-a53a-11ec-0434-1bbbc561f8cb
# hideall
title = "Wordle games as a tree";
# ╔═╡ 021364a8-f40b-49fe-9a02-406c0044c9ed
"""
+++
title = "$title"
+++
""" |> Base.Text
# ╔═╡ c49e1040-67c8-4386-a6ce-bbbeace8bc90
md"""
# $title
As described in the previous tutorial, strategies such as maximizing the entropy or minimizing the expected pool size for the next stage can be used to select guesses automatically in Wordle or related games.
When doing so the possible games can be represented in a data structure called a [tree](https://en.wikipedia.org/wiki/Tree_(data_structure)).
Some of the terminology used with these structures is based on concepts of a family tree.
First attach some packages that will be used
"""
# ╔═╡ cec480d3-7348-4d14-9628-007893713a07
md"and create an instance of `wordle` where the guesses are chosen to maximize the entropy, which is the default criterion."
# ╔═╡ 9586bcbd-16aa-4598-8faa-8220755566e6
begin
datadir = joinpath(pkgdir(Wordlegames), "data")
wordle = GamePool(collect(readlines(joinpath(datadir, "Wordletargets.txt"))))
end;
# ╔═╡ ddc457c3-f207-4ed1-8a8a-7f1c4cfdaed7
md"Finally, we create a tree from the games for a random selection of 25 targets."
# ╔═╡ 52ed4682-a0d7-44cf-b878-27f1cf9cc91d
gametree25 = tree(wordle, Random.seed!(1234321), 25);
# ╔═╡ 86d0bb82-ed8f-4b03-b90c-31c55e556bae
md"""
## The AbstractTrees package
The [AbstractTrees](https://github.com/JuliaCollections/AbstractTrees.jl) package provides many methods for working with tree data structures.
One of the most useful is `print_tree` which, as the name suggests, prints the tree in a special format.
(Because the content for these tutorials is generated as [Pluto](https://github.com/fonsp/Pluto.jl.git) notebooks, we need to wrap the call to `print_tree` in `with_terminal() do ... end` to have the output displayed.
Outside of Pluto this is not necessary.
"""
# ╔═╡ 30ba17b1-9c0c-4fd6-9f40-3c3c1c986e93
with_terminal() do
print_tree(gametree25; maxdepth=8)
end
# ╔═╡ 384abc84-3fda-4ba3-b52e-2d46052b8ce6
md"""
Each guess in a game constitutes a `"node"` in the tree.
The initial guess in any of the games is `"raise"`, which is the `"root"` node for the tree.
A node can have zero or more `"children"` which are its immediate descendents.
The nodes in this tree are each a `GameNode` struct with a `"children"` field.
"""
# ╔═╡ 0c24b1ca-b36a-46f6-9da7-e5c3e3670d29
typeof(gametree25)
# ╔═╡ 68f9375f-31af-4916-933f-fb41905819f8
fieldnames(GameNode)
# ╔═╡ e1735528-469e-4a17-8b8a-d95dca03f46c
length(gametree25.children) # number of children of the root node
# ╔═╡ 112b0452-7ae4-49b4-bbdd-54fb00ff8bdb
md"""
The `score` field of a `GameNode` is similar to the elements of the `guesses` field of a `GamePool` object but with one important difference.
In a `GameNode` the `score` and `sc` fields are the score that will produce the guess, as opposed to the score for the guess,
That is, the first child of `"raise"` is `"pilot"` which is the next guess in a game in which `"raise"` returns a score of `"🟫🟫🟨🟫🟫"` as tiles or 9 as a decimal number.
"""
# ╔═╡ f8f1521c-fbbb-4648-af9c-0a15c7e787ff
first(gametree25.children).score
# ╔═╡ 1dd5c9fb-820f-41c6-b796-494d68479f1c
md"""
The 16 children of the root node from these 25 games are
"""
# ╔═╡ 8302e26a-53ae-4f9f-9579-26a1c839c865
[child.score.guess for child in gametree25.children]
# ╔═╡ 7f4a7f14-fe77-43fa-b2dd-37ba70cf9da3
md"""
Some of these children have many descendents.
When generating the tree the children of a node are ordered according to the size of the tree rooted at that node.
Because a subtree is exactly the same type of structure as a tree, we can print a subtree with `print_tree`.
"""
# ╔═╡ 088ca1f6-44c3-4d0d-a68b-c71881813410
with_terminal() do
print_tree(first(gametree25.children))
end
# ╔═╡ 785fe89b-4008-437a-ac73-2bdaa26e7cf6
md"""
We see that the size of the tree rooted at `"pilot"` is 10.
"""
# ╔═╡ 8d83a193-aed2-4c1d-8bc5-614a81d16548
md"""
The "leaves" of a tree are the terminal nodes, i.e. the nodes that do not have children.
"""
# ╔═╡ 576d0904-3f3e-49e8-9ce7-ccdd8767bf1b
[leaf.score.guess for leaf in Leaves(gametree25)]
# ╔═╡ 144a9d04-f971-48d9-ace4-dd0156f591c2
md"""
It happens in this case that all of the targets that generated the tree are leaves in this tree, but that is not necessarily the case.
"""
# ╔═╡ 105a0522-729a-49ea-b0a5-62b868ba5e45
length(collect(Leaves(gametree25)))
# ╔═╡ efcb3473-6ea1-459c-9995-32b0a407a2f4
md"""
## Creating the tree structure
As a language Julia gets high marks for "composability" - the ability to adapt one package to use concepts from another package.
The use of generic functions and multiple dispatch is central to this enhanced compositibility.
All that is necessary to use many of the functions in `AbstractTrees.jl` on the trees created from a collection of games using a particular `GamePool` is to define the `GameNode` struct, the method of generating the tree, and methods for `AbstractTrees.children`, `AbstractTrees.nodetype` and `AbstractTrees.printnode`
"""
# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Wordlegames = "1cb69566-e1cf-455f-a587-fd79a2e00f5a"
[compat]
AbstractTrees = "~0.3.4"
PlutoUI = "~0.7.38"
Wordlegames = "~0.3.0"
"""
# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised
julia_version = "1.8.0-beta3"
manifest_format = "2.0"
project_hash = "2c8800ff06b3096b67485eb059a224666198ba30"
[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
git-tree-sha1 = "8eaf9f1b4921132a4cff3f36a1d9ba923b14a481"
uuid = "6e696c72-6542-2067-7265-42206c756150"
version = "1.1.4"
[[deps.AbstractTrees]]
git-tree-sha1 = "03e0550477d86222521d254b741d470ba17ea0b5"
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
version = "0.3.4"
[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "024fe24d83e4a5bf5fc80501a314ce0d1aa35597"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.0"
[[deps.Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "96b0bc6c52df76506efc8a441c6cf1adcb1babc4"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.42.0"
[[deps.CompilerSupportLibraries_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "0.5.2+0"
[[deps.Crayons]]
git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15"
uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f"
version = "4.1.1"
[[deps.DataAPI]]
git-tree-sha1 = "cc70b17275652eb47bc9e5f81635981f13cea5c8"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.9.0"
[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "Future", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
git-tree-sha1 = "ae02104e835f219b8930c7664b8012c93475c340"
uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "1.3.2"
[[deps.DataStructures]]
deps = ["Compat", "InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "3daef5523dd2e769dad2365274f760ff5f282c7d"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.18.11"
[[deps.DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"
[[deps.Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.DelimitedFiles]]
deps = ["Mmap"]
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
[[deps.Downloads]]
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
version = "1.6.0"
[[deps.FileWatching]]
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
[[deps.FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"
[[deps.Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"
[[deps.Future]]
deps = ["Random"]
uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820"
[[deps.Hyperscript]]
deps = ["Test"]
git-tree-sha1 = "8d511d5b81240fc8e6802386302675bdf47737b9"
uuid = "47d2ed2b-36de-50cf-bf87-49c2cf4b8b91"
version = "0.0.4"
[[deps.HypertextLiteral]]
git-tree-sha1 = "2b078b5a615c6c0396c77810d92ee8c6f470d238"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
version = "0.9.3"
[[deps.IOCapture]]
deps = ["Logging", "Random"]
git-tree-sha1 = "f7be53659ab06ddc986428d3a9dcc95f6fa6705a"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.2.2"
[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[deps.InvertedIndices]]
git-tree-sha1 = "bee5f1ef5bf65df56bdd2e40447590b272a5471f"
uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f"
version = "1.1.0"
[[deps.IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"
[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"
[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
version = "0.6.3"
[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
version = "7.81.0+0"
[[deps.LibGit2]]
deps = ["Base64", "NetworkOptions", "Printf", "SHA"]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
[[deps.LibSSH2_jll]]
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
version = "1.10.2+0"
[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
[[deps.LinearAlgebra]]
deps = ["Libdl", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
version = "2.28.0+0"
[[deps.Missings]]
deps = ["DataAPI"]
git-tree-sha1 = "bf210ce90b6c9eed32d25dbcae1ebc565df2687f"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "1.0.2"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2022.2.1"
[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.2.0"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
version = "0.3.20+0"
[[deps.OrderedCollections]]
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.4.1"
[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "621f4f3b4977325b9128d5fae7a8b4829a0c2222"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.2.4"
[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
version = "1.8.0"
[[deps.PlutoUI]]
deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "Markdown", "Random", "Reexport", "UUIDs"]
git-tree-sha1 = "670e559e5c8e191ded66fa9ea89c97f10376bb4c"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
version = "0.7.38"
[[deps.PooledArrays]]
deps = ["DataAPI", "Future"]
git-tree-sha1 = "28ef6c7ce353f0b35d0df0d5930e0d072c1f5b9b"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "1.4.1"
[[deps.PrettyTables]]
deps = ["Crayons", "Formatting", "Markdown", "Reexport", "Tables"]
git-tree-sha1 = "dfb54c4e414caa595a1f2ed759b160f5a3ddcba5"
uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
version = "1.3.1"
[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
[[deps.REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
[[deps.Random]]
deps = ["SHA", "Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"
[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
version = "0.7.0"
[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[deps.SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
[[deps.SortingAlgorithms]]
deps = ["DataStructures"]
git-tree-sha1 = "b3363d7460f7d098ca0912c69b082f75625d7508"
uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
version = "1.0.1"
[[deps.SparseArrays]]
deps = ["LinearAlgebra", "Random"]
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
version = "1.0.0"
[[deps.TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "c06b2f539df1c6efa794486abfb6ed2022561a39"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.1"
[[deps.Tables]]
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"]
git-tree-sha1 = "5ce79ce186cc678bbb5c5681ca3379d1ddae11a1"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "1.7.0"
[[deps.Tar]]
deps = ["ArgTools", "SHA"]
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
version = "1.10.0"
[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
[[deps.Wordlegames]]
deps = ["AbstractTrees", "DataFrames", "Random", "Tables"]
git-tree-sha1 = "4c463de78d2f3f9447b695e241eba43cc945f866"
uuid = "1cb69566-e1cf-455f-a587-fd79a2e00f5a"
version = "0.3.0"
[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
version = "1.2.12+1"
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.1.0+0"
[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
version = "1.41.0+1"
[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
version = "16.2.1+1"
"""
# ╔═╡ Cell order:
# ╟─ed649770-a53a-11ec-0434-1bbbc561f8cb
# ╟─021364a8-f40b-49fe-9a02-406c0044c9ed
# ╟─c49e1040-67c8-4386-a6ce-bbbeace8bc90
# ╠═3e14817e-85f8-4d5b-8a8f-075d1799ed27
# ╟─cec480d3-7348-4d14-9628-007893713a07
# ╠═9586bcbd-16aa-4598-8faa-8220755566e6
# ╟─ddc457c3-f207-4ed1-8a8a-7f1c4cfdaed7
# ╠═52ed4682-a0d7-44cf-b878-27f1cf9cc91d
# ╟─86d0bb82-ed8f-4b03-b90c-31c55e556bae
# ╠═30ba17b1-9c0c-4fd6-9f40-3c3c1c986e93
# ╟─384abc84-3fda-4ba3-b52e-2d46052b8ce6
# ╠═0c24b1ca-b36a-46f6-9da7-e5c3e3670d29
# ╠═68f9375f-31af-4916-933f-fb41905819f8
# ╠═e1735528-469e-4a17-8b8a-d95dca03f46c
# ╟─112b0452-7ae4-49b4-bbdd-54fb00ff8bdb
# ╠═f8f1521c-fbbb-4648-af9c-0a15c7e787ff
# ╟─1dd5c9fb-820f-41c6-b796-494d68479f1c
# ╠═8302e26a-53ae-4f9f-9579-26a1c839c865
# ╟─7f4a7f14-fe77-43fa-b2dd-37ba70cf9da3
# ╠═088ca1f6-44c3-4d0d-a68b-c71881813410
# ╟─785fe89b-4008-437a-ac73-2bdaa26e7cf6
# ╟─8d83a193-aed2-4c1d-8bc5-614a81d16548
# ╠═576d0904-3f3e-49e8-9ce7-ccdd8767bf1b
# ╟─144a9d04-f971-48d9-ace4-dd0156f591c2
# ╠═105a0522-729a-49ea-b0a5-62b868ba5e45
# ╟─efcb3473-6ea1-459c-9995-32b0a407a2f4
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002
| [
21017,
317,
32217,
13,
20362,
20922,
44386,
198,
2,
410,
15,
13,
1507,
13,
19,
198,
198,
3500,
2940,
2902,
198,
3500,
21365,
18274,
4487,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
513,
68,
18294,
1558,
68,
12,
5332,
69,
23,
12,
19,
67,
20,
65,
12,
23,
64,
23,
69,
12,
46396,
67,
1558,
2079,
276,
1983,
198,
3500,
27741,
51,
6037,
11,
32217,
10080,
11,
14534,
11,
9678,
1455,
1047,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
1225,
2414,
5607,
2154,
12,
64,
4310,
64,
12,
1157,
721,
12,
3023,
2682,
12,
16,
11848,
15630,
47915,
69,
23,
21101,
198,
2,
7808,
439,
198,
7839,
796,
366,
26449,
293,
1830,
355,
257,
5509,
8172,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
7816,
1485,
2414,
64,
23,
12,
69,
1821,
65,
12,
2920,
5036,
12,
24,
64,
2999,
12,
29703,
66,
405,
2598,
66,
24,
276,
198,
37811,
198,
45340,
198,
7839,
796,
17971,
7839,
1,
198,
45340,
198,
37811,
930,
29,
7308,
13,
8206,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
269,
2920,
68,
940,
1821,
12,
3134,
66,
23,
12,
19,
21734,
12,
64,
21,
344,
12,
11848,
1350,
558,
23,
15630,
3829,
198,
9132,
37811,
198,
2,
720,
7839,
198,
198,
1722,
3417,
287,
262,
2180,
11808,
11,
10064,
884,
355,
48350,
262,
40709,
393,
41366,
262,
2938,
5933,
2546,
329,
262,
1306,
3800,
460,
307,
973,
284,
2922,
44774,
6338,
287,
9678,
293,
393,
3519,
1830,
13,
198,
198,
2215,
1804,
523,
262,
1744,
1830,
460,
307,
7997,
287,
257,
1366,
4645,
1444,
257,
685,
21048,
16151,
5450,
1378,
268,
13,
31266,
13,
2398,
14,
15466,
14,
27660,
41052,
7890,
62,
301,
5620,
29720,
198,
198,
4366,
286,
262,
29191,
973,
351,
777,
8573,
318,
1912,
319,
10838,
286,
257,
1641,
5509,
13,
198,
198,
5962,
10199,
617,
10392,
326,
481,
307,
973,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
269,
721,
22148,
67,
18,
12,
22,
28978,
12,
19,
67,
1415,
12,
4846,
2078,
12,
405,
40401,
2718,
1485,
64,
2998,
198,
9132,
1,
392,
2251,
281,
4554,
286,
4600,
4775,
293,
63,
810,
262,
44774,
389,
7147,
284,
20487,
262,
40709,
11,
543,
318,
262,
4277,
34054,
526,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
860,
29796,
15630,
17457,
12,
1433,
7252,
12,
2231,
4089,
12,
23,
69,
7252,
12,
6469,
1238,
2425,
2816,
2791,
68,
21,
198,
27471,
198,
197,
19608,
324,
343,
796,
4654,
6978,
7,
35339,
15908,
7,
26449,
1455,
1047,
828,
366,
7890,
4943,
198,
197,
4775,
293,
796,
3776,
27201,
7,
33327,
7,
961,
6615,
7,
22179,
6978,
7,
19608,
324,
343,
11,
366,
26449,
1616,
853,
1039,
13,
14116,
1,
35514,
198,
437,
26,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
288,
17896,
33032,
66,
18,
12,
69,
22745,
12,
19,
276,
16,
12,
23,
64,
23,
64,
12,
22,
69,
16,
66,
19,
12993,
6814,
276,
22,
198,
9132,
1,
11158,
11,
356,
2251,
257,
5509,
422,
262,
1830,
329,
257,
4738,
6356,
286,
1679,
6670,
526,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
6740,
276,
38472,
17,
12,
64,
15,
67,
22,
12,
2598,
12993,
12,
65,
23,
3695,
12,
1983,
69,
16,
12993,
24,
535,
6420,
67,
198,
28483,
316,
631,
1495,
796,
5509,
7,
4775,
293,
11,
14534,
13,
28826,
0,
7,
1065,
32118,
2481,
828,
1679,
1776,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
9849,
67,
15,
11848,
6469,
12,
276,
23,
69,
12,
19,
65,
3070,
12,
65,
3829,
66,
12,
3132,
66,
2816,
68,
37864,
65,
3609,
198,
9132,
37811,
198,
2235,
383,
27741,
51,
6037,
5301,
198,
198,
464,
685,
23839,
51,
6037,
16151,
5450,
1378,
12567,
13,
785,
14,
16980,
544,
5216,
26448,
14,
23839,
51,
6037,
13,
20362,
8,
5301,
3769,
867,
5050,
329,
1762,
351,
5509,
1366,
8573,
13,
198,
3198,
286,
262,
749,
4465,
318,
4600,
4798,
62,
21048,
63,
543,
11,
355,
262,
1438,
5644,
11,
20842,
262,
5509,
287,
257,
2041,
5794,
13,
198,
7,
8128,
262,
2695,
329,
777,
27992,
318,
7560,
355,
685,
3646,
9390,
16151,
5450,
1378,
12567,
13,
785,
14,
69,
684,
79,
14,
3646,
9390,
13,
20362,
13,
18300,
8,
43935,
11,
356,
761,
284,
14441,
262,
869,
284,
4600,
4798,
62,
21048,
63,
287,
4600,
4480,
62,
23705,
282,
3419,
466,
2644,
886,
63,
284,
423,
262,
5072,
9066,
13,
198,
30815,
286,
32217,
428,
318,
407,
3306,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
1542,
7012,
1558,
65,
16,
12,
24,
66,
15,
66,
12,
19,
16344,
21,
12,
24,
69,
1821,
12,
18,
66,
18,
66,
16,
66,
49087,
68,
6052,
198,
4480,
62,
23705,
282,
3419,
466,
198,
197,
4798,
62,
21048,
7,
28483,
316,
631,
1495,
26,
3509,
18053,
28,
23,
8,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
40400,
39305,
5705,
12,
18,
69,
6814,
12,
19,
7012,
18,
12,
65,
4309,
68,
12,
17,
67,
34716,
4309,
65,
23,
344,
21,
198,
9132,
37811,
198,
10871,
4724,
287,
257,
983,
19300,
257,
4600,
1,
17440,
1,
63,
287,
262,
5509,
13,
198,
464,
4238,
4724,
287,
597,
286,
262,
1830,
318,
4600,
1,
40225,
1,
47671,
543,
318,
262,
4600,
1,
15763,
1,
63,
10139,
329,
262,
5509,
13,
198,
32,
10139,
460,
423,
6632,
393,
517,
4600,
1,
17197,
1,
63,
543,
389,
663,
7103,
15350,
658,
13,
198,
198,
464,
13760,
287,
428,
5509,
389,
1123,
257,
4600,
8777,
19667,
63,
2878,
351,
257,
4600,
1,
17197,
1,
63,
2214,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
66,
1731,
65,
16,
6888,
12,
65,
2623,
64,
12,
3510,
69,
21,
12,
24,
6814,
22,
12,
68,
20,
66,
18,
68,
2623,
2154,
67,
1959,
198,
4906,
1659,
7,
28483,
316,
631,
1495,
8,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
8257,
69,
6052,
2425,
69,
12,
3132,
1878,
12,
2920,
1433,
12,
24,
2091,
69,
12,
21855,
45068,
2713,
23,
1129,
69,
23,
198,
3245,
14933,
7,
8777,
19667,
8,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
304,
1558,
28567,
2078,
12,
42947,
68,
12,
19,
64,
1558,
12,
23,
65,
23,
64,
12,
67,
3865,
67,
6888,
3070,
69,
3510,
66,
198,
13664,
7,
28483,
316,
631,
1495,
13,
17197,
8,
220,
1303,
1271,
286,
1751,
286,
262,
6808,
10139,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
13539,
65,
15,
37730,
12,
22,
3609,
19,
12,
2920,
65,
19,
12,
11848,
1860,
12,
4051,
21855,
405,
487,
23,
65,
9945,
198,
9132,
37811,
198,
464,
4600,
26675,
63,
2214,
286,
257,
4600,
8777,
19667,
63,
318,
2092,
284,
262,
4847,
286,
262,
4600,
5162,
44667,
63,
2214,
286,
257,
4600,
8777,
27201,
63,
2134,
475,
351,
530,
1593,
3580,
13,
198,
818,
257,
4600,
8777,
19667,
63,
262,
4600,
26675,
63,
290,
4600,
1416,
63,
7032,
389,
262,
4776,
326,
481,
4439,
262,
4724,
11,
355,
6886,
284,
262,
4776,
329,
262,
4724,
11,
198,
198,
2504,
318,
11,
262,
717,
1200,
286,
4600,
1,
40225,
1,
63,
318,
4600,
1,
79,
23439,
1,
63,
543,
318,
262,
1306,
4724,
287,
257,
983,
287,
543,
4600,
1,
40225,
1,
63,
5860,
257,
4776,
286,
4600,
1,
8582,
253,
104,
8582,
253,
104,
8582,
253,
101,
8582,
253,
104,
8582,
253,
104,
1,
63,
355,
19867,
393,
860,
355,
257,
32465,
1271,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
277,
23,
69,
1314,
2481,
66,
12,
69,
11848,
65,
12,
19,
34287,
12,
1878,
24,
66,
12,
15,
64,
1314,
66,
22,
68,
41019,
487,
198,
11085,
7,
28483,
316,
631,
1495,
13,
17197,
737,
26675,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
352,
1860,
20,
66,
24,
21855,
12,
41739,
69,
12,
3901,
66,
21,
12,
65,
41060,
12,
39449,
67,
3104,
31714,
69,
16,
66,
198,
9132,
37811,
198,
464,
1467,
1751,
286,
262,
6808,
10139,
422,
777,
1679,
1830,
389,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
807,
22709,
68,
2075,
64,
12,
4310,
3609,
12,
19,
69,
24,
69,
12,
24,
41734,
12,
2075,
64,
16,
66,
23,
2670,
66,
23,
2996,
198,
58,
9410,
13,
26675,
13,
5162,
408,
329,
1200,
287,
9106,
316,
631,
1495,
13,
17197,
60,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
767,
69,
19,
64,
22,
69,
1415,
12,
5036,
3324,
12,
3559,
13331,
12,
65,
17,
1860,
12,
2718,
7012,
2154,
12993,
24,
6814,
18,
198,
9132,
37811,
198,
4366,
286,
777,
1751,
423,
867,
15350,
658,
13,
198,
2215,
15453,
262,
5509,
262,
1751,
286,
257,
10139,
389,
6149,
1864,
284,
262,
2546,
286,
262,
5509,
19459,
379,
326,
10139,
13,
198,
198,
8128,
257,
13284,
631,
318,
3446,
262,
976,
2099,
286,
4645,
355,
257,
5509,
11,
356,
460,
3601,
257,
13284,
631,
351,
4600,
4798,
62,
21048,
44646,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
657,
3459,
6888,
16,
69,
21,
12,
2598,
66,
18,
12,
19,
67,
15,
67,
12,
64,
3104,
65,
12,
66,
22,
20356,
1507,
19880,
940,
198,
4480,
62,
23705,
282,
3419,
466,
198,
197,
4798,
62,
21048,
7,
11085,
7,
28483,
316,
631,
1495,
13,
17197,
4008,
198,
437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
767,
5332,
5036,
4531,
65,
12,
7029,
23,
12,
43284,
64,
12,
330,
4790,
12,
17,
43444,
64,
2075,
68,
22,
12993,
21,
198,
9132,
37811,
198,
1135,
766,
326,
262,
2546,
286,
262,
5509,
19459,
379,
4600,
1,
79,
23439,
1,
63,
318,
838,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
807,
67,
5999,
64,
24943,
12,
8432,
17,
12,
19,
66,
16,
67,
12,
23,
15630,
20,
12,
46841,
64,
6659,
67,
20986,
2780,
198,
9132,
37811,
198,
464,
366,
293,
3080,
1,
286,
257,
5509,
389,
262,
12094,
13760,
11,
1312,
13,
68,
13,
262,
13760,
326,
466,
407,
423,
1751,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
642,
4304,
67,
2931,
3023,
12,
18,
69,
18,
68,
12,
2920,
68,
23,
12,
24,
344,
22,
12,
535,
1860,
5774,
3134,
19881,
16,
65,
198,
58,
33201,
13,
26675,
13,
5162,
408,
329,
12835,
287,
46597,
7,
28483,
316,
631,
1495,
15437,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
20224,
64,
24,
67,
3023,
12,
69,
24,
4869,
12,
2780,
67,
24,
12,
558,
19,
12,
1860,
486,
3980,
69,
48952,
66,
17,
198,
9132,
37811,
198,
1026,
4325,
287,
428,
1339,
326,
477,
286,
262,
6670,
326,
7560,
262,
5509,
389,
5667,
287,
428,
5509,
11,
475,
326,
318,
407,
6646,
262,
1339,
13,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
13343,
64,
2713,
1828,
12,
48555,
64,
12,
2920,
18213,
12,
65,
15,
64,
20,
12,
5237,
65,
23,
3104,
7012,
20,
68,
2231,
198,
13664,
7,
33327,
7,
3123,
3080,
7,
28483,
316,
631,
1495,
22305,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
304,
16072,
65,
2682,
4790,
12,
21,
18213,
16,
12,
33459,
66,
12,
2079,
3865,
12,
2624,
65,
15,
64,
30120,
64,
17,
69,
19,
198,
9132,
37811,
198,
2235,
30481,
262,
5509,
4645,
198,
198,
1722,
257,
3303,
22300,
3011,
1029,
8849,
329,
366,
785,
1930,
1799,
1,
532,
262,
2694,
284,
6068,
530,
5301,
284,
779,
10838,
422,
1194,
5301,
13,
198,
464,
779,
286,
14276,
5499,
290,
3294,
27965,
318,
4318,
284,
428,
13105,
552,
7434,
2247,
13,
198,
198,
3237,
326,
318,
3306,
284,
779,
867,
286,
262,
5499,
287,
4600,
23839,
51,
6037,
13,
20362,
63,
319,
262,
7150,
2727,
422,
257,
4947,
286,
1830,
1262,
257,
1948,
4600,
8777,
27201,
63,
318,
284,
8160,
262,
4600,
8777,
19667,
63,
2878,
11,
262,
2446,
286,
15453,
262,
5509,
11,
290,
5050,
329,
4600,
23839,
51,
6037,
13,
17197,
47671,
4600,
23839,
51,
6037,
13,
77,
375,
2963,
431,
63,
290,
4600,
23839,
51,
6037,
13,
4798,
17440,
63,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
27551,
12,
2388,
12,
2388,
12,
2388,
12,
8269,
18005,
198,
6489,
3843,
46,
62,
31190,
23680,
62,
51,
2662,
43,
62,
37815,
15365,
796,
37227,
198,
58,
10378,
82,
60,
198,
23839,
51,
6037,
796,
366,
1314,
1238,
344,
1415,
12,
1899,
66,
16,
12,
20,
69,
1795,
12,
11848,
66,
22,
12,
2816,
891,
6659,
65,
3365,
2327,
66,
1,
198,
3646,
9390,
10080,
796,
366,
22,
69,
24,
3023,
67,
5036,
12,
65,
5332,
68,
12,
19,
487,
21,
12,
65,
38380,
12,
67,
3609,
23539,
1954,
4846,
64,
23,
1,
198,
29531,
796,
366,
24,
64,
18,
69,
23,
30336,
12,
64,
17,
66,
24,
12,
20,
69,
2999,
12,
24,
64,
1157,
12,
23,
33459,
1795,
64,
16,
16344,
20,
66,
1,
198,
26449,
1455,
1047,
796,
366,
16,
21101,
37381,
2791,
12,
68,
16,
12993,
12,
30505,
69,
12,
64,
44617,
12,
16344,
3720,
64,
17,
68,
405,
69,
20,
64,
1,
198,
198,
58,
5589,
265,
60,
198,
23839,
51,
6037,
796,
366,
93,
15,
13,
18,
13,
19,
1,
198,
3646,
9390,
10080,
796,
366,
93,
15,
13,
22,
13,
2548,
1,
198,
26449,
1455,
1047,
796,
366,
93,
15,
13,
18,
13,
15,
1,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
27551,
12,
2388,
12,
2388,
12,
2388,
12,
8269,
34215,
198,
6489,
3843,
46,
62,
10725,
5064,
6465,
62,
51,
2662,
43,
62,
37815,
15365,
796,
37227,
198,
2,
770,
2393,
318,
4572,
12,
27568,
532,
12857,
340,
3264,
318,
407,
13030,
198,
198,
73,
43640,
62,
9641,
796,
366,
16,
13,
23,
13,
15,
12,
31361,
18,
1,
198,
805,
8409,
62,
18982,
796,
366,
17,
13,
15,
1,
198,
16302,
62,
17831,
796,
366,
17,
66,
3459,
405,
487,
3312,
65,
1270,
4846,
65,
3134,
32642,
1765,
46712,
64,
24137,
27310,
22337,
7012,
1270,
1,
198,
198,
30109,
10378,
82,
13,
23839,
3646,
9390,
35,
278,
316,
73,
274,
11907,
198,
10378,
82,
796,
14631,
47,
10025,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
23,
68,
1878,
24,
69,
16,
65,
2920,
21895,
2624,
64,
19,
66,
487,
18,
69,
2623,
64,
16,
67,
24,
7012,
24,
1954,
65,
1415,
64,
40271,
1,
198,
12303,
312,
796,
366,
21,
68,
38205,
66,
4761,
12,
2996,
3682,
12,
1238,
3134,
12,
22,
22980,
12,
3682,
22136,
66,
2425,
5333,
1120,
1,
198,
9641,
796,
366,
16,
13,
16,
13,
19,
1,
198,
198,
30109,
10378,
82,
13,
23839,
51,
6037,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
3070,
68,
2713,
1120,
32883,
67,
4521,
1828,
1495,
2481,
67,
24970,
65,
22,
3901,
67,
27790,
7012,
1558,
18213,
15,
65,
20,
1,
198,
12303,
312,
796,
366,
1314,
1238,
344,
1415,
12,
1899,
66,
16,
12,
20,
69,
1795,
12,
11848,
66,
22,
12,
2816,
891,
6659,
65,
3365,
2327,
66,
1,
198,
9641,
796,
366,
15,
13,
18,
13,
19,
1,
198,
198,
30109,
10378,
82,
13,
28100,
33637,
11907,
198,
12303,
312,
796,
366,
15,
47984,
5705,
66,
20,
12,
67,
14686,
12,
3682,
68,
21,
12,
23,
67,
2078,
12,
891,
1065,
67,
6485,
40401,
69,
1,
198,
9641,
796,
366,
16,
13,
16,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
8001,
37199,
11907,
198,
12303,
312,
796,
366,
3980,
69,
1828,
67,
4761,
12,
16344,
21,
67,
12,
4089,
69,
16,
12,
2999,
69,
15,
12,
2919,
1860,
66,
2931,
2998,
66,
2091,
1,
198,
198,
30109,
10378,
82,
13,
14881,
2414,
11907,
198,
12303,
312,
796,
366,
17,
64,
15,
69,
2598,
68,
18,
12,
21,
66,
5999,
12,
2816,
17457,
12,
5774,
68,
19,
12,
65,
37950,
67,
4089,
17457,
20,
69,
1,
198,
198,
30109,
10378,
82,
13,
10258,
31431,
11907,
198,
10378,
82,
796,
14631,
13715,
12727,
49601,
1600,
366,
29531,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
40839,
5036,
1731,
67,
5999,
68,
19,
64,
20,
19881,
20,
16072,
28256,
486,
64,
33638,
344,
15,
67,
16,
7252,
2327,
43239,
1,
198,
12303,
312,
796,
366,
18,
6814,
21601,
69,
22,
12,
3270,
5705,
12,
20,
64,
1899,
12,
65,
23,
64,
21,
12,
66,
11848,
2791,
66,
15,
65,
20370,
69,
1,
198,
9641,
796,
366,
15,
13,
1157,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
40073,
11907,
198,
10378,
82,
796,
14631,
14881,
2414,
1600,
366,
35,
689,
1600,
366,
13856,
320,
863,
25876,
1600,
366,
20344,
6169,
1600,
366,
9492,
5275,
18274,
4487,
1600,
366,
25835,
38,
270,
17,
1600,
366,
25835,
25404,
1600,
366,
14993,
451,
2348,
29230,
1600,
366,
9704,
2902,
1600,
366,
44,
8899,
1600,
366,
47,
10025,
1600,
366,
18557,
69,
1600,
366,
2200,
6489,
1600,
366,
29531,
1600,
366,
37596,
1600,
366,
32634,
1634,
1600,
366,
2484,
1144,
3163,
20477,
1600,
366,
50,
11603,
1600,
366,
50,
29572,
3163,
20477,
1600,
366,
48346,
1600,
366,
14402,
1600,
366,
52,
27586,
82,
1600,
366,
3118,
291,
1098,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
4846,
65,
15,
15630,
21,
66,
4309,
7568,
4304,
35638,
891,
66,
23,
64,
39710,
66,
21,
12993,
16,
324,
21101,
16,
65,
39305,
19,
1,
198,
12303,
312,
796,
366,
2682,
6814,
17,
21652,
12,
65,
1959,
65,
12,
20,
66,
1485,
12,
65,
15,
66,
22,
12,
330,
69,
1558,
1495,
1485,
67,
1238,
1,
198,
9641,
796,
366,
18,
13,
3682,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
7293,
5329,
15514,
43,
11127,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
68,
2791,
68,
405,
3695,
12,
22,
25150,
12,
4051,
1120,
12,
5892,
69,
22,
12,
1314,
69,
17457,
24,
3553,
69,
17,
3609,
1,
198,
9641,
796,
366,
15,
13,
20,
13,
17,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
34,
2433,
684,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
21626,
5036,
2548,
397,
69,
4304,
67,
2780,
46572,
68,
17,
69,
2231,
3980,
1350,
17457,
23349,
7252,
34125,
68,
1314,
1,
198,
12303,
312,
796,
366,
64,
23,
535,
20,
65,
15,
68,
12,
15,
487,
64,
12,
20,
324,
19,
12,
23,
66,
1415,
12,
24,
1954,
67,
18,
1453,
1558,
2327,
69,
1,
198,
9641,
796,
366,
19,
13,
16,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
6601,
17614,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
535,
2154,
65,
1558,
23195,
43193,
1765,
2857,
15630,
24,
68,
20,
69,
23,
1433,
2327,
4089,
16,
69,
1485,
344,
64,
20,
66,
23,
1,
198,
12303,
312,
796,
366,
24,
64,
4846,
17,
69,
24,
66,
12,
21,
7568,
15,
12,
1157,
68,
24,
12,
15,
68,
20,
67,
12,
66,
49489,
65,
23,
65,
20,
1453,
23,
64,
1,
198,
9641,
796,
366,
16,
13,
24,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
6601,
35439,
11907,
198,
10378,
82,
796,
14631,
40073,
1600,
366,
6601,
17614,
1600,
366,
29783,
1600,
366,
818,
13658,
5497,
1063,
1600,
366,
37787,
39317,
11627,
5736,
1600,
366,
14993,
451,
2348,
29230,
1600,
366,
9704,
2902,
1600,
366,
17140,
654,
1600,
366,
27201,
276,
3163,
20477,
1600,
366,
35700,
51,
2977,
1600,
366,
18557,
69,
1600,
366,
2200,
6489,
1600,
366,
3041,
39344,
1600,
366,
50,
24707,
2348,
7727,
907,
1600,
366,
48346,
1600,
366,
10962,
15721,
896,
1600,
366,
51,
2977,
1600,
366,
3118,
291,
1098,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
3609,
2999,
13464,
68,
23,
2327,
69,
28896,
65,
4531,
1270,
66,
4304,
2414,
65,
23,
30206,
66,
24,
2682,
2425,
66,
23601,
1,
198,
12303,
312,
796,
366,
64,
6052,
66,
21,
69,
405,
12,
68,
3553,
67,
12,
20,
41580,
12,
65,
22,
65,
21,
12,
67,
23,
24943,
69,
18,
68,
3510,
66,
15,
1,
198,
9641,
796,
366,
16,
13,
18,
13,
17,
1,
198,
198,
30109,
10378,
82,
13,
6601,
44909,
942,
11907,
198,
10378,
82,
796,
14631,
40073,
1600,
366,
9492,
5275,
18274,
4487,
1600,
366,
35422,
1068,
5216,
26448,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
18,
6814,
891,
2816,
1954,
1860,
17,
68,
22,
3388,
47984,
1954,
2996,
28857,
69,
40761,
487,
20,
69,
32568,
66,
22,
67,
1,
198,
12303,
312,
796,
366,
39570,
276,
65,
18,
65,
12,
2079,
535,
12,
20,
68,
2425,
12,
23,
67,
17,
67,
12,
23,
1959,
21101,
15,
64,
24,
66,
5036,
23,
1,
198,
9641,
796,
366,
15,
13,
1507,
13,
1157,
1,
198,
198,
30109,
10378,
82,
13,
6601,
11395,
9492,
32186,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
65,
16072,
1157,
5774,
65,
3720,
2078,
4846,
2718,
13331,
15,
891,
21,
67,
2598,
2623,
1765,
67,
5036,
3388,
2713,
66,
17457,
21,
1,
198,
12303,
312,
796,
366,
68,
17,
67,
17279,
64,
15,
12,
24,
67,
2078,
12,
4051,
1350,
12,
1795,
69,
15,
12,
15801,
65,
1350,
1238,
64,
44578,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
35,
689,
11907,
198,
10378,
82,
796,
14631,
18557,
69,
8973,
198,
12303,
312,
796,
366,
671,
17,
6888,
2154,
12,
2548,
6420,
12,
3270,
2231,
12,
4089,
21855,
12,
17896,
15,
42691,
2624,
68,
3312,
64,
1,
198,
198,
30109,
10378,
82,
13,
13856,
320,
863,
25876,
11907,
198,
10378,
82,
796,
14631,
44,
8899,
8973,
198,
12303,
312,
796,
366,
23,
11848,
1415,
1821,
69,
12,
2857,
2327,
12,
41734,
65,
12,
64,
19,
397,
12,
29416,
65,
4089,
7568,
19,
67,
397,
1,
198,
198,
30109,
10378,
82,
13,
20344,
6169,
11907,
198,
10378,
82,
796,
14631,
29531,
1600,
366,
32634,
1634,
1600,
366,
50,
11603,
8973,
198,
12303,
312,
796,
366,
23,
7012,
4531,
68,
1238,
12,
26279,
66,
12,
20,
65,
21,
69,
12,
24,
27277,
12,
24,
2857,
22544,
1238,
1453,
16,
65,
1,
198,
198,
30109,
10378,
82,
13,
10002,
82,
11907,
198,
10378,
82,
796,
14631,
28100,
33637,
1600,
366,
8979,
10723,
278,
1600,
366,
25835,
34,
21886,
1600,
366,
26245,
29046,
8973,
198,
12303,
312,
796,
366,
69,
3559,
64,
28872,
69,
12,
66,
1238,
64,
12,
19,
324,
19,
12,
23,
4309,
66,
12,
69,
21,
65,
1065,
2857,
4521,
16,
66,
21,
1,
198,
9641,
796,
366,
16,
13,
21,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
8979,
10723,
278,
11907,
198,
12303,
312,
796,
366,
22,
65,
16,
69,
1899,
3720,
12,
22,
2718,
64,
12,
3365,
17896,
12,
65,
23,
15630,
12,
22,
64,
17,
6888,
20,
66,
16,
65,
20,
1453,
1,
198,
198,
30109,
10378,
82,
13,
13715,
12727,
49601,
11907,
198,
10378,
82,
796,
14631,
48346,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
27326,
65,
16344,
344,
4134,
5705,
66,
20,
66,
7568,
1433,
64,
324,
66,
30610,
7252,
20,
1860,
16072,
20,
34741,
535,
1,
198,
12303,
312,
796,
366,
4310,
66,
2780,
66,
1558,
12,
19,
64,
22,
67,
12,
20,
6888,
17,
12,
3829,
66,
20,
12,
3720,
65,
3695,
4846,
1453,
64,
6052,
1,
198,
9641,
796,
366,
15,
13,
23,
13,
19,
1,
198,
198,
30109,
10378,
82,
13,
26227,
889,
11907,
198,
10378,
82,
796,
14631,
18557,
69,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
23,
29626,
67,
39132,
3559,
23815,
69,
1860,
18,
1765,
38431,
67,
4521,
66,
24,
2075,
21101,
32568,
3609,
4761,
64,
23,
1,
198,
12303,
312,
796,
366,
3270,
2078,
3324,
4761,
12,
15,
64,
1238,
12,
20,
64,
2670,
12,
65,
6659,
65,
12,
1485,
2791,
38905,
1765,
19,
66,
15,
1,
198,
9641,
796,
366,
15,
13,
19,
13,
17,
1,
198,
198,
30109,
10378,
82,
13,
29783,
11907,
198,
10378,
82,
796,
14631,
29531,
8973,
198,
12303,
312,
796,
366,
24,
13331,
23,
38073,
65,
12,
20370,
65,
12,
20,
35667,
12,
24,
68,
23,
67,
12,
19,
67,
15,
37466,
68,
23,
3695,
1238,
1,
198,
198,
30109,
10378,
82,
13,
49926,
364,
6519,
11907,
198,
10378,
82,
796,
14631,
14402,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
23,
67,
41647,
67,
20,
65,
23,
1065,
1821,
16072,
23,
68,
37397,
1954,
4521,
1270,
2075,
2425,
65,
7568,
32883,
2718,
65,
24,
1,
198,
12303,
312,
796,
366,
2857,
67,
17,
276,
17,
65,
12,
2623,
2934,
12,
1120,
12993,
12,
19881,
5774,
12,
2920,
66,
17,
12993,
19,
65,
23,
65,
6420,
1,
198,
9641,
796,
366,
15,
13,
15,
13,
19,
1,
198,
198,
30109,
10378,
82,
13,
38197,
5239,
43,
270,
1691,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
17,
65,
2998,
23,
65,
20,
64,
47007,
66,
21,
66,
15,
34107,
66,
39761,
940,
67,
5892,
1453,
23,
66,
21,
69,
27790,
67,
23721,
1,
198,
12303,
312,
796,
366,
330,
16315,
17,
64,
23,
12,
69,
19,
65,
18,
12,
19,
65,
5036,
12,
7012,
1828,
12,
1878,
20,
65,
5892,
10210,
18,
397,
17,
1,
198,
9641,
796,
366,
15,
13,
24,
13,
18,
1,
198,
198,
30109,
10378,
82,
13,
40,
4503,
2373,
495,
11907,
198,
10378,
82,
796,
14631,
11187,
2667,
1600,
366,
29531,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
69,
22,
1350,
44468,
3270,
397,
3312,
1860,
66,
4089,
2414,
2078,
67,
18,
64,
24,
67,
535,
3865,
69,
21,
13331,
21,
34801,
64,
1,
198,
12303,
312,
796,
366,
65,
20,
69,
6659,
68,
3270,
12,
35916,
17,
12,
19,
67,
2624,
12,
65,
16,
69,
15,
12,
66,
2998,
16,
65,
46821,
19881,
4531,
1,
198,
9641,
796,
366,
15,
13,
17,
13,
17,
1,
198,
198,
30109,
10378,
82,
13,
9492,
5275,
18274,
4487,
11907,
198,
10378,
82,
796,
14631,
9704,
2902,
8973,
198,
12303,
312,
796,
366,
65,
3324,
68,
15,
64,
19,
66,
12,
67,
33551,
12,
3553,
64,
15,
12,
3829,
68,
23,
12,
23,
9945,
1495,
64,
1983,
64,
16102,
1,
198,
198,
30109,
10378,
82,
13,
818,
13658,
5497,
1063,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
20963,
20,
69,
16,
891,
20,
19881,
2996,
7568,
3980,
65,
1860,
17,
68,
1821,
2598,
2425,
3829,
65,
29807,
64,
20,
38339,
69,
1,
198,
12303,
312,
796,
366,
3901,
397,
1314,
5705,
12,
16,
67,
2548,
12,
20,
11848,
69,
12,
24,
15801,
12,
69,
1157,
66,
21,
66,
3365,
65,
2780,
69,
1,
198,
9641,
796,
366,
16,
13,
16,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
37787,
39317,
11627,
5736,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
64,
18,
69,
1731,
40179,
66,
2481,
69,
20,
65,
1350,
24,
67,
17,
64,
45722,
69,
3865,
67,
10210,
3365,
31496,
21855,
2078,
3980,
1,
198,
12303,
312,
796,
366,
23,
2078,
33438,
940,
12,
2857,
3720,
12,
20,
28645,
12,
23,
4309,
68,
12,
3070,
68,
43690,
12993,
36453,
67,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
40386,
11907,
198,
10378,
82,
796,
14631,
35,
689,
1600,
366,
44,
8899,
1600,
366,
47,
945,
364,
1600,
366,
3118,
291,
1098,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
18,
66,
5999,
2425,
3559,
1860,
65,
44087,
1120,
891,
3682,
69,
2857,
2548,
30995,
34229,
69,
31027,
3720,
67,
19,
68,
1,
198,
12303,
312,
796,
366,
43950,
66,
3312,
64,
15,
12,
2934,
21,
64,
12,
4051,
397,
12,
64,
23726,
12,
66,
23,
65,
16,
12993,
3720,
66,
2934,
21,
1,
198,
9641,
796,
366,
15,
13,
2481,
13,
18,
1,
198,
198,
30109,
10378,
82,
13,
25835,
34,
21886,
11907,
198,
10378,
82,
796,
14631,
25835,
34,
21886,
62,
73,
297,
1600,
366,
44,
8590,
5049,
34,
2246,
861,
82,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
65,
20233,
2624,
66,
17,
12,
64,
18,
68,
22,
12,
1120,
66,
23,
12,
1795,
10210,
12,
17,
67,
2623,
9945,
21101,
16344,
2481,
1,
198,
9641,
796,
366,
15,
13,
21,
13,
18,
1,
198,
198,
30109,
10378,
82,
13,
25835,
34,
21886,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
5432,
39,
17,
62,
73,
297,
1600,
366,
25835,
25404,
1600,
366,
44,
3077,
51,
6561,
62,
73,
297,
1600,
366,
57,
8019,
62,
73,
297,
1600,
366,
77,
456,
29281,
17,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
2934,
330,
24,
65,
2857,
12,
23,
15630,
22,
12,
3270,
3312,
12,
64,
15,
5036,
12,
2327,
330,
3980,
17896,
5705,
66,
15,
1,
198,
9641,
796,
366,
22,
13,
6659,
13,
15,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
25835,
38,
270,
17,
11907,
198,
10378,
82,
796,
14631,
14881,
2414,
1600,
366,
26245,
29046,
1600,
366,
18557,
69,
1600,
366,
37596,
8973,
198,
12303,
312,
796,
366,
4304,
69,
23,
4051,
1120,
12,
20,
24909,
12,
20,
65,
20,
64,
12,
23,
68,
7252,
12,
49721,
324,
40350,
65,
42117,
1,
198,
198,
30109,
10378,
82,
13,
25835,
5432,
39,
17,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
1600,
366,
44,
3077,
51,
6561,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
27728,
1433,
65,
20,
64,
12,
65,
24,
397,
12,
49489,
69,
12,
24,
2091,
66,
12,
276,
324,
1507,
4521,
7568,
64,
23,
1,
198,
9641,
796,
366,
16,
13,
940,
13,
17,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
25835,
25404,
11907,
198,
12303,
312,
796,
366,
23,
69,
28771,
6814,
18,
12,
2327,
3553,
12,
3980,
2425,
12,
65,
20,
487,
12,
21855,
23,
2624,
66,
5607,
21101,
9945,
1,
198,
198,
30109,
10378,
82,
13,
14993,
451,
2348,
29230,
11907,
198,
10378,
82,
796,
14631,
25835,
25404,
1600,
366,
8019,
39806,
81,
696,
14453,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
2718,
68,
17,
68,
3510,
67,
12,
69,
4531,
67,
12,
20,
2670,
67,
12,
65,
19,
1453,
12,
23,
2548,
69,
535,
535,
24,
66,
23,
68,
1,
198,
198,
30109,
10378,
82,
13,
11187,
2667,
11907,
198,
12303,
312,
796,
366,
3980,
1860,
65,
27037,
12,
23,
3553,
65,
12,
4051,
68,
16,
12,
65,
5999,
67,
12,
9945,
19,
67,
3365,
9945,
2816,
3104,
1,
198,
198,
30109,
10378,
82,
13,
9704,
2902,
11907,
198,
10378,
82,
796,
14631,
14881,
2414,
8973,
198,
12303,
312,
796,
366,
67,
21,
69,
19,
32128,
68,
12,
64,
891,
20,
12,
31654,
64,
12,
4846,
66,
16,
12,
24,
66,
44698,
34626,
31980,
64,
1,
198,
198,
30109,
10378,
82,
13,
44,
3077,
51,
6561,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
66,
23,
487,
67,
24,
66,
18,
12,
26073,
67,
12,
3365,
3901,
12,
65,
3695,
68,
12,
2919,
1558,
67,
22,
18781,
13331,
16,
1,
198,
9641,
796,
366,
17,
13,
2078,
13,
15,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
17140,
654,
11907,
198,
10378,
82,
796,
14631,
6601,
17614,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
19881,
21536,
344,
3829,
65,
21,
66,
24,
2308,
2624,
67,
1495,
9945,
66,
3609,
16,
1765,
66,
47372,
7568,
2075,
5774,
69,
1,
198,
12303,
312,
796,
366,
68,
16,
67,
1959,
67,
22,
64,
12,
11848,
17896,
12,
20,
12993,
17,
12,
24,
330,
15,
12,
69,
1065,
2934,
17,
66,
2091,
68,
2078,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
17,
1,
198,
198,
30109,
10378,
82,
13,
44,
8899,
11907,
198,
12303,
312,
796,
366,
64,
5066,
324,
16562,
12,
22,
68,
1485,
12,
1120,
5705,
12,
48372,
69,
12,
5036,
30206,
66,
40179,
36088,
1,
198,
198,
30109,
10378,
82,
13,
44,
8590,
5049,
34,
2246,
861,
82,
62,
73,
297,
11907,
198,
12303,
312,
796,
366,
1415,
64,
15277,
21,
67,
12,
69,
1899,
67,
12,
43918,
68,
12,
24,
19244,
12,
1065,
67,
24,
4761,
10210,
23,
19707,
1,
198,
9641,
796,
366,
1238,
1828,
13,
17,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
26245,
29046,
11907,
198,
12303,
312,
796,
366,
6888,
36189,
45418,
12,
66,
17,
68,
18,
12,
3559,
64,
24,
12,
558,
19,
12,
16,
68,
24,
3459,
65,
17,
66,
1129,
2919,
1,
198,
9641,
796,
366,
16,
13,
17,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
11505,
9148,
1921,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
7293,
5329,
15514,
43,
11127,
62,
73,
297,
1600,
366,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
2231,
32459,
1959,
64,
12,
66,
49351,
12,
20,
65,
1795,
12,
17457,
3510,
12,
69,
1795,
67,
4349,
66,
20,
65,
35447,
1,
198,
9641,
796,
366,
15,
13,
18,
13,
1238,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
35422,
1068,
5216,
26448,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
5332,
69,
23,
68,
2996,
3695,
19881,
16,
69,
24,
1453,
15,
67,
1157,
68,
22,
11848,
16,
65,
18781,
2414,
2327,
31714,
67,
2857,
66,
1,
198,
12303,
312,
796,
366,
65,
330,
40486,
68,
16,
12,
20,
68,
4761,
12,
20,
1765,
66,
12,
23,
39071,
12,
11231,
23,
64,
42947,
69,
2816,
67,
1,
198,
9641,
796,
366,
16,
13,
19,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
47,
945,
364,
11907,
198,
10378,
82,
796,
14631,
35,
689,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
21,
2481,
69,
19,
69,
18,
65,
2920,
3324,
26582,
65,
24,
12762,
67,
20,
69,
3609,
22,
64,
23,
65,
2780,
1959,
64,
15,
66,
1828,
1828,
1,
198,
12303,
312,
796,
366,
3388,
2934,
15,
64,
3388,
12,
16,
1860,
67,
12,
20,
29326,
12,
24,
30743,
12,
17,
19881,
15,
65,
2999,
17896,
24,
69,
15,
1,
198,
9641,
796,
366,
17,
13,
17,
13,
19,
1,
198,
198,
30109,
10378,
82,
13,
47,
10025,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
35,
689,
1600,
366,
10002,
82,
1600,
366,
25835,
38,
270,
17,
1600,
366,
25835,
25404,
1600,
366,
11187,
2667,
1600,
366,
9704,
2902,
1600,
366,
18557,
69,
1600,
366,
2200,
6489,
1600,
366,
29531,
1600,
366,
37596,
1600,
366,
32634,
1634,
1600,
366,
51,
2662,
43,
1600,
366,
47079,
1600,
366,
52,
27586,
82,
1600,
366,
79,
22,
13344,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
2598,
66,
5036,
3865,
64,
12,
16,
1765,
17,
12,
4309,
18213,
12,
65,
43864,
12,
68,
17,
1878,
7568,
3388,
65,
3695,
69,
1,
198,
9641,
796,
366,
16,
13,
23,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
3646,
9390,
10080,
11907,
198,
10378,
82,
796,
14631,
23839,
3646,
9390,
35,
278,
316,
73,
274,
1600,
366,
14881,
2414,
1600,
366,
10258,
31431,
1600,
366,
35,
689,
1600,
366,
49926,
364,
6519,
1600,
366,
38197,
5239,
43,
270,
1691,
1600,
366,
40,
4503,
2373,
495,
1600,
366,
9492,
5275,
18274,
4487,
1600,
366,
40386,
1600,
366,
11187,
2667,
1600,
366,
9704,
2902,
1600,
366,
29531,
1600,
366,
3041,
39344,
1600,
366,
52,
27586,
82,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
43798,
68,
38605,
68,
20,
66,
23,
68,
26492,
9395,
2791,
13331,
24,
18213,
4531,
66,
5607,
69,
940,
32128,
11848,
19,
66,
1,
198,
12303,
312,
796,
366,
22,
69,
24,
3023,
67,
5036,
12,
65,
5332,
68,
12,
19,
487,
21,
12,
65,
38380,
12,
67,
3609,
23539,
1954,
4846,
64,
23,
1,
198,
9641,
796,
366,
15,
13,
22,
13,
2548,
1,
198,
198,
30109,
10378,
82,
13,
27201,
276,
3163,
20477,
11907,
198,
10378,
82,
796,
14631,
6601,
17614,
1600,
366,
29783,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
2078,
891,
21,
66,
22,
344,
33319,
69,
15,
65,
2327,
67,
15,
7568,
15,
67,
3270,
1270,
68,
15,
67,
2998,
17,
66,
16,
69,
20,
65,
24,
65,
1,
198,
12303,
312,
796,
366,
17,
7568,
65,
5066,
1453,
12,
535,
2670,
12,
20,
1860,
20,
12,
3865,
17457,
12,
44980,
19881,
46712,
67,
23906,
1,
198,
9641,
796,
366,
16,
13,
19,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
35700,
51,
2977,
11907,
198,
10378,
82,
796,
14631,
34,
2433,
684,
1600,
366,
26227,
889,
1600,
366,
9704,
2902,
1600,
366,
3041,
39344,
1600,
366,
51,
2977,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
7568,
65,
4051,
66,
19,
68,
37309,
6888,
64,
35124,
64,
16,
69,
17,
276,
38314,
65,
14198,
69,
20,
64,
18,
1860,
66,
7012,
20,
1,
198,
12303,
312,
796,
366,
2919,
11231,
23,
67,
17,
12,
15,
67,
15,
66,
12,
3553,
2920,
12,
324,
13331,
12,
23,
64,
17,
330,
15187,
1878,
15,
67,
1,
198,
9641,
796,
366,
16,
13,
18,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
18557,
69,
11907,
198,
10378,
82,
796,
14631,
3118,
291,
1098,
8973,
198,
12303,
312,
796,
366,
2934,
2919,
3365,
6814,
12,
21,
22572,
12,
20,
68,
3134,
12,
5774,
2598,
12,
4349,
6048,
1453,
1765,
23,
67,
22,
1,
198,
198,
30109,
10378,
82,
13,
2200,
6489,
11907,
198,
10378,
82,
796,
14631,
9492,
5275,
18274,
4487,
1600,
366,
9704,
2902,
1600,
366,
50,
11603,
1600,
366,
3118,
291,
1098,
8973,
198,
12303,
312,
796,
366,
18,
13331,
15,
10210,
4846,
12,
68,
891,
16,
12,
20,
42548,
12,
23,
64,
5333,
12,
65,
18,
65,
31360,
23,
11848,
487,
65,
1,
198,
198,
30109,
10378,
82,
13,
29531,
11907,
198,
10378,
82,
796,
14631,
37596,
1600,
366,
32634,
1634,
8973,
198,
12303,
312,
796,
366,
24,
64,
18,
69,
23,
30336,
12,
64,
17,
66,
24,
12,
20,
69,
2999,
12,
24,
64,
1157,
12,
23,
33459,
1795,
64,
16,
16344,
20,
66,
1,
198,
198,
30109,
10378,
82,
13,
3041,
39344,
11907,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
2231,
68,
40173,
3682,
23055,
1899,
4790,
68,
397,
21,
69,
17,
6814,
20,
66,
24,
67,
26717,
67,
2079,
11848,
1065,
69,
24,
65,
1,
198,
12303,
312,
796,
366,
23362,
64,
2548,
3134,
12,
1270,
1120,
12,
4309,
6814,
12,
64,
23,
2623,
12,
68,
30005,
7012,
3829,
397,
3388,
1,
198,
9641,
796,
366,
16,
13,
17,
13,
17,
1,
198,
198,
30109,
10378,
82,
13,
37596,
11907,
198,
12303,
312,
796,
366,
18213,
23,
68,
24,
1129,
66,
12,
26660,
66,
12,
4349,
1878,
12,
3459,
1495,
12,
46071,
5066,
10210,
22,
2481,
344,
1,
198,
9641,
796,
366,
15,
13,
22,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
32634,
1634,
11907,
198,
12303,
312,
796,
366,
24,
68,
3459,
65,
3682,
64,
12,
69,
23,
1959,
12,
20,
65,
15,
66,
12,
65,
1350,
24,
12,
24,
68,
24,
1954,
22337,
23055,
65,
1,
198,
198,
30109,
10378,
82,
13,
2484,
1144,
3163,
20477,
11907,
198,
10378,
82,
796,
14631,
20344,
6169,
1600,
366,
44,
8899,
1600,
366,
29531,
1600,
366,
32634,
1634,
8973,
198,
12303,
312,
796,
366,
16,
64,
8784,
16,
64,
18,
12,
5705,
2934,
12,
38605,
68,
12,
23,
68,
4531,
12,
64,
1157,
64,
17,
69,
22,
17896,
34741,
1,
198,
198,
30109,
10378,
82,
13,
50,
11603,
11907,
198,
12303,
312,
796,
366,
2414,
5237,
5036,
15,
65,
12,
1731,
2934,
12,
3980,
3132,
12,
23,
40035,
12,
1860,
24,
3901,
69,
3829,
2934,
535,
1,
198,
198,
30109,
10378,
82,
13,
50,
24707,
2348,
7727,
907,
11907,
198,
10378,
82,
796,
14631,
6601,
44909,
942,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
65,
2091,
5066,
67,
4524,
1899,
69,
22,
67,
2931,
23,
6888,
2931,
1065,
66,
3388,
65,
2919,
17,
69,
2425,
26704,
67,
15426,
23,
1,
198,
12303,
312,
796,
366,
64,
17,
1878,
1157,
2791,
12,
64,
2919,
69,
12,
20,
69,
2414,
12,
23,
3510,
66,
12,
5824,
64,
15,
67,
18,
344,
69,
2780,
66,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
50,
29572,
3163,
20477,
11907,
198,
10378,
82,
796,
14631,
14993,
451,
2348,
29230,
1600,
366,
29531,
8973,
198,
12303,
312,
796,
366,
17,
69,
486,
22883,
68,
12,
68,
1828,
65,
12,
20,
7568,
20,
12,
3609,
5066,
12,
67,
6052,
1765,
397,
3388,
68,
1878,
1,
198,
198,
30109,
10378,
82,
13,
48346,
11907,
198,
10378,
82,
796,
14631,
14993,
451,
2348,
29230,
1600,
366,
50,
29572,
3163,
20477,
8973,
198,
12303,
312,
796,
366,
15982,
2231,
65,
1433,
12,
3720,
344,
12,
1157,
68,
23,
12,
1157,
69,
24,
12,
22,
67,
1485,
324,
2624,
64,
18,
65,
17,
1,
198,
198,
30109,
10378,
82,
13,
51,
2662,
43,
11907,
198,
10378,
82,
796,
14631,
35,
689,
8973,
198,
12303,
312,
796,
366,
13331,
25674,
69,
16,
69,
12,
1899,
2920,
12,
19,
69,
1415,
12,
7252,
4051,
12,
2091,
65,
1878,
3609,
16,
276,
4304,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
10962,
15721,
896,
11907,
198,
10378,
82,
796,
14631,
37787,
39317,
11627,
5736,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
66,
3312,
65,
17,
69,
20,
2670,
7568,
16,
66,
21,
891,
64,
3720,
2598,
4521,
397,
21855,
21,
276,
1238,
18182,
5333,
64,
2670,
1,
198,
12303,
312,
796,
366,
2718,
5999,
65,
9945,
23,
12,
19,
64,
4089,
12,
20,
65,
21,
65,
12,
1878,
24,
64,
12,
47372,
69,
1959,
64,
20,
5036,
24,
66,
1,
198,
9641,
796,
366,
16,
13,
15,
13,
16,
1,
198,
198,
30109,
10378,
82,
13,
51,
2977,
11907,
198,
10378,
82,
796,
14631,
6601,
17614,
1600,
366,
6601,
11395,
9492,
32186,
1600,
366,
37787,
39317,
11627,
5736,
1600,
366,
14993,
451,
2348,
29230,
1600,
366,
35422,
1068,
5216,
26448,
1600,
366,
10962,
15721,
896,
1600,
366,
14402,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
20,
344,
3720,
344,
25096,
535,
30924,
11848,
65,
20,
66,
20,
48564,
6888,
2091,
3720,
67,
16,
1860,
3609,
1157,
64,
16,
1,
198,
12303,
312,
796,
366,
17457,
30803,
1878,
21,
12,
64,
721,
16,
12,
20,
324,
15,
12,
65,
1433,
64,
12,
69,
22,
535,
4059,
23,
25948,
66,
1,
198,
9641,
796,
366,
16,
13,
22,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
47079,
11907,
198,
10378,
82,
796,
14631,
28100,
33637,
1600,
366,
37596,
8973,
198,
12303,
312,
796,
366,
64,
19,
68,
20,
3388,
64,
21,
12,
68,
36088,
12,
19,
13331,
19,
12,
65,
15,
69,
18,
12,
68,
891,
22,
64,
16,
67,
20,
65,
1485,
68,
1,
198,
9641,
796,
366,
16,
13,
940,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
14402,
11907,
198,
10378,
82,
796,
14631,
9492,
5275,
18274,
4487,
1600,
366,
11187,
2667,
1600,
366,
29531,
1600,
366,
32634,
1634,
8973,
198,
12303,
312,
796,
366,
23,
7568,
276,
46841,
12,
68,
1828,
66,
12,
20,
68,
2919,
12,
5332,
68,
16,
12,
2996,
66,
20,
24409,
69,
15,
65,
1821,
1,
198,
198,
30109,
10378,
82,
13,
52,
27586,
82,
11907,
198,
10378,
82,
796,
14631,
29531,
1600,
366,
37596,
8973,
198,
12303,
312,
796,
366,
12993,
22,
16817,
64,
22,
12,
3388,
4304,
12,
20,
65,
16,
64,
12,
24,
64,
2670,
12,
22,
324,
66,
4761,
69,
48952,
64,
19,
1,
198,
198,
30109,
10378,
82,
13,
3118,
291,
1098,
11907,
198,
12303,
312,
796,
366,
19,
721,
15,
64,
5999,
68,
12,
43134,
68,
12,
1120,
68,
17,
12,
65,
24,
330,
12,
23,
69,
4761,
330,
69,
20,
64,
23,
69,
20,
1,
198,
198,
30109,
10378,
82,
13,
26449,
1455,
1047,
11907,
198,
10378,
82,
796,
14631,
23839,
51,
6037,
1600,
366,
6601,
35439,
1600,
366,
29531,
1600,
366,
51,
2977,
8973,
198,
18300,
12,
21048,
12,
26270,
16,
796,
366,
19,
66,
38380,
2934,
3695,
67,
17,
69,
18,
69,
24,
34825,
65,
37381,
68,
28872,
1765,
64,
3559,
535,
24,
2231,
69,
42240,
1,
198,
12303,
312,
796,
366,
16,
21101,
37381,
2791,
12,
68,
16,
12993,
12,
30505,
69,
12,
64,
44617,
12,
16344,
3720,
64,
17,
68,
405,
69,
20,
64,
1,
198,
9641,
796,
366,
15,
13,
18,
13,
15,
1,
198,
198,
30109,
10378,
82,
13,
57,
8019,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
23,
2718,
2425,
64,
3365,
12,
16,
69,
16,
67,
12,
48645,
69,
12,
65,
24991,
12,
67,
50055,
4051,
397,
25816,
64,
1,
198,
9641,
796,
366,
16,
13,
17,
13,
1065,
10,
16,
1,
198,
198,
30109,
10378,
82,
13,
8019,
39806,
81,
696,
14453,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
1600,
366,
11505,
9148,
1921,
62,
73,
297,
8973,
198,
12303,
312,
796,
366,
23,
68,
25764,
65,
3829,
12,
4521,
9945,
12,
20,
2682,
66,
12,
64,
15,
67,
18,
12,
1415,
3695,
24096,
66,
22,
67,
6052,
1,
198,
9641,
796,
366,
20,
13,
16,
13,
15,
10,
15,
1,
198,
198,
30109,
10378,
82,
13,
77,
456,
29281,
17,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
23,
68,
25764,
18654,
12,
30610,
23,
12,
20,
29626,
12,
64,
2998,
66,
12,
22709,
330,
67,
17,
64,
1878,
23,
67,
1,
198,
9641,
796,
366,
16,
13,
3901,
13,
15,
10,
16,
1,
198,
198,
30109,
10378,
82,
13,
79,
22,
13344,
62,
73,
297,
11907,
198,
10378,
82,
796,
14631,
8001,
37199,
1600,
366,
25835,
25404,
8973,
198,
12303,
312,
796,
366,
18,
69,
1129,
68,
24,
2091,
12,
2091,
67,
23,
12,
4310,
65,
18,
12,
7252,
397,
12,
17457,
4349,
940,
66,
18,
65,
22,
64,
15,
1,
198,
9641,
796,
366,
1433,
13,
17,
13,
16,
10,
16,
1,
198,
37811,
198,
198,
2,
2343,
243,
242,
28670,
22880,
94,
12440,
1502,
25,
198,
2,
2343,
243,
253,
7280,
276,
2414,
5607,
2154,
12,
64,
4310,
64,
12,
1157,
721,
12,
3023,
2682,
12,
16,
11848,
15630,
47915,
69,
23,
21101,
198,
2,
2343,
243,
253,
7280,
2999,
1485,
2414,
64,
23,
12,
69,
1821,
65,
12,
2920,
5036,
12,
24,
64,
2999,
12,
29703,
66,
405,
2598,
66,
24,
276,
198,
2,
2343,
243,
253,
7280,
66,
2920,
68,
940,
1821,
12,
3134,
66,
23,
12,
19,
21734,
12,
64,
21,
344,
12,
11848,
1350,
558,
23,
15630,
3829,
198,
2,
2343,
243,
254,
28670,
18,
68,
18294,
1558,
68,
12,
5332,
69,
23,
12,
19,
67,
20,
65,
12,
23,
64,
23,
69,
12,
46396,
67,
1558,
2079,
276,
1983,
198,
2,
2343,
243,
253,
7280,
344,
66,
22148,
67,
18,
12,
22,
28978,
12,
19,
67,
1415,
12,
4846,
2078,
12,
405,
40401,
2718,
1485,
64,
2998,
198,
2,
2343,
243,
254,
28670,
24,
29796,
15630,
17457,
12,
1433,
7252,
12,
2231,
4089,
12,
23,
69,
7252,
12,
6469,
1238,
2425,
2816,
2791,
68,
21,
198,
2,
2343,
243,
253,
7280,
1860,
66,
33032,
66,
18,
12,
69,
22745,
12,
19,
276,
16,
12,
23,
64,
23,
64,
12,
22,
69,
16,
66,
19,
12993,
6814,
276,
22,
198,
2,
2343,
243,
254,
28670,
4309,
276,
38472,
17,
12,
64,
15,
67,
22,
12,
2598,
12993,
12,
65,
23,
3695,
12,
1983,
69,
16,
12993,
24,
535,
6420,
67,
198,
2,
2343,
243,
253,
7280,
4521,
67,
15,
11848,
6469,
12,
276,
23,
69,
12,
19,
65,
3070,
12,
65,
3829,
66,
12,
3132,
66,
2816,
68,
37864,
65,
3609,
198,
2,
2343,
243,
254,
28670,
1270,
7012,
1558,
65,
16,
12,
24,
66,
15,
66,
12,
19,
16344,
21,
12,
24,
69,
1821,
12,
18,
66,
18,
66,
16,
66,
49087,
68,
6052,
198,
2,
2343,
243,
253,
7280,
22842,
39305,
5705,
12,
18,
69,
6814,
12,
19,
7012,
18,
12,
65,
4309,
68,
12,
17,
67,
34716,
4309,
65,
23,
344,
21,
198,
2,
2343,
243,
254,
28670,
15,
66,
1731,
65,
16,
6888,
12,
65,
2623,
64,
12,
3510,
69,
21,
12,
24,
6814,
22,
12,
68,
20,
66,
18,
68,
2623,
2154,
67,
1959,
198,
2,
2343,
243,
254,
28670,
3104,
69,
6052,
2425,
69,
12,
3132,
1878,
12,
2920,
1433,
12,
24,
2091,
69,
12,
21855,
45068,
2713,
23,
1129,
69,
23,
198,
2,
2343,
243,
254,
28670,
68,
1558,
28567,
2078,
12,
42947,
68,
12,
19,
64,
1558,
12,
23,
65,
23,
64,
12,
67,
3865,
67,
6888,
3070,
69,
3510,
66,
198,
2,
2343,
243,
253,
7280,
14686,
65,
15,
37730,
12,
22,
3609,
19,
12,
2920,
65,
19,
12,
11848,
1860,
12,
4051,
21855,
405,
487,
23,
65,
9945,
198,
2,
2343,
243,
254,
28670,
69,
23,
69,
1314,
2481,
66,
12,
69,
11848,
65,
12,
19,
34287,
12,
1878,
24,
66,
12,
15,
64,
1314,
66,
22,
68,
41019,
487,
198,
2,
2343,
243,
253,
7280,
16,
1860,
20,
66,
24,
21855,
12,
41739,
69,
12,
3901,
66,
21,
12,
65,
41060,
12,
39449,
67,
3104,
31714,
69,
16,
66,
198,
2,
2343,
243,
254,
28670,
23,
22709,
68,
2075,
64,
12,
4310,
3609,
12,
19,
69,
24,
69,
12,
24,
41734,
12,
2075,
64,
16,
66,
23,
2670,
66,
23,
2996,
198,
2,
2343,
243,
253,
7280,
22,
69,
19,
64,
22,
69,
1415,
12,
5036,
3324,
12,
3559,
13331,
12,
65,
17,
1860,
12,
2718,
7012,
2154,
12993,
24,
6814,
18,
198,
2,
2343,
243,
254,
28670,
46556,
6888,
16,
69,
21,
12,
2598,
66,
18,
12,
19,
67,
15,
67,
12,
64,
3104,
65,
12,
66,
22,
20356,
1507,
19880,
940,
198,
2,
2343,
243,
253,
7280,
41172,
5036,
4531,
65,
12,
7029,
23,
12,
43284,
64,
12,
330,
4790,
12,
17,
43444,
64,
2075,
68,
22,
12993,
21,
198,
2,
2343,
243,
253,
7280,
23,
67,
5999,
64,
24943,
12,
8432,
17,
12,
19,
66,
16,
67,
12,
23,
15630,
20,
12,
46841,
64,
6659,
67,
20986,
2780,
198,
2,
2343,
243,
254,
28670,
37452,
67,
2931,
3023,
12,
18,
69,
18,
68,
12,
2920,
68,
23,
12,
24,
344,
22,
12,
535,
1860,
5774,
3134,
19881,
16,
65,
198,
2,
2343,
243,
253,
7280,
18444,
64,
24,
67,
3023,
12,
69,
24,
4869,
12,
2780,
67,
24,
12,
558,
19,
12,
1860,
486,
3980,
69,
48952,
66,
17,
198,
2,
2343,
243,
254,
28670,
13348,
64,
2713,
1828,
12,
48555,
64,
12,
2920,
18213,
12,
65,
15,
64,
20,
12,
5237,
65,
23,
3104,
7012,
20,
68,
2231,
198,
2,
2343,
243,
253,
7280,
891,
21101,
2682,
4790,
12,
21,
18213,
16,
12,
33459,
66,
12,
2079,
3865,
12,
2624,
65,
15,
64,
30120,
64,
17,
69,
19,
198,
2,
2343,
243,
253,
7280,
8269,
12,
2388,
12,
2388,
12,
2388,
12,
8269,
18005,
198,
2,
2343,
243,
253,
7280,
8269,
12,
2388,
12,
2388,
12,
2388,
12,
8269,
34215,
198
] | 1.986087 | 8,553 |
@doc doc"Abstract Boolean Types: {{true},{false}.{true,false}}" ->
immutable AbstractBool <: Domain{Bool}
v::UInt8
AbstractBool(v::UInt8) = (@assert v == 0x1 || v == 0x2 || v== 0x3; new(v))
end
const t = AbstractBool(0x1)
const f = AbstractBool(0x2)
const tf = AbstractBool(0x3)
promote_rule(::Type{Bool}, ::Type{AbstractBool}) = AbstractBool
convert(::Type{AbstractBool}, b::Bool) = if b t else f end
## AbstractBool Set Operations
## ===========================
subsumes(x::AbstractBool, y::AbstractBool) = x === tf || x === y
subsumes(x::AbstractBool, y::Bool) = subsumes(x,convert(AbstractBool, y))
isintersect(x::AbstractBool, y::AbstractBool) = !((x === t && y === f) || (x === f && y === t))
isintersect(x::AbstractBool, y::Bool) = isintersect(x,convert(AbstractBool, y))
isintersect(x::Bool, y::AbstractBool) = isintersect(convert(AbstractBool, x),y)
isrelational(::Type{AbstractBool}) = false
isabstract(c::Type{Bool}, a::Type{AbstractBool}) = true
isequal(x::AbstractBool, y::AbstractBool) = x.v == y.v
domaineq(x::AbstractBool, y::AbstractBool) = x.v == y.v
⊔(a::AbstractBool) = a
⊔(a::AbstractBool, b::AbstractBool) = a === b ? a : tf
⊔(a::Bool, b::AbstractBool) = ⊔(convert(AbstractBool,a),b)
⊔(a::AbstractBool, b::Bool) = ⊔(a,convert(AbstractBool,b))
⊔(a::Bool, b::Bool) = a === b ? convert(AbstractBool,a) : tf
## =========================
## Lifted Boolean Arithmetic
function !(b::AbstractBool)
if b === t
f
elseif b === f
t
elseif b === tf
tf
end
end
(==)(x::AbstractBool, y::AbstractBool) =
x === tf || y === tf ? tf : x === t && y === t || x === f && y === f
function (==)(x::AbstractBool, y::AbstractBool)
if x === tf || y === tf tf
elseif x === t && y === t t
elseif x === f && y === f t
else f
end
end
(==)(x::AbstractBool, y::Bool) = (==)(promote(x,y)...)
(==)(y::Bool,x::AbstractBool) = (==)(promote(y,x)...)
function (|)(x::AbstractBool, y::AbstractBool)
if x === t || y === t t
elseif x === tf || y === tf tf
else f
end
end
|(x::AbstractBool, y::Bool) = |(x,convert(AbstractBool,y))
|(y::Bool, x::AbstractBool) = |(convert(AbstractBool,y), x)
function (&)(x::AbstractBool, y::AbstractBool)
if x === f || y === f f
elseif x === tf || y === tf tf
else t
end
end
(&)(x::AbstractBool, y::Bool) = x & convert(AbstractBool, y)
(&)(y::Bool, x::AbstractBool) = convert(AbstractBool, y) & x
# When condition is TF we need to evaluate both branches
# and merge with ⊔
function ifelse(c::AbstractBool, x, y)
if c === t
x
elseif c === f
y
elseif c === tf
⊔(x,y)
end
end
## Printing
## ========
string(x::AbstractBool) = ["{true}","{false}","{true,false}"][x.v]
print(io::IO, x::AbstractBool) = print(io, string(x))
show(io::IO, x::AbstractBool) = print(io, string(x))
showcompact(io::IO, x::AbstractBool) = print(io, string(x))
| [
31,
15390,
2205,
1,
23839,
41146,
24897,
25,
22935,
7942,
5512,
90,
9562,
27422,
90,
7942,
11,
9562,
11709,
1,
4613,
198,
8608,
18187,
27741,
33,
970,
1279,
25,
20021,
90,
33,
970,
92,
198,
220,
410,
3712,
52,
5317,
23,
198,
220,
27741,
33,
970,
7,
85,
3712,
52,
5317,
23,
8,
796,
4275,
30493,
410,
6624,
657,
87,
16,
8614,
410,
6624,
657,
87,
17,
8614,
410,
855,
657,
87,
18,
26,
649,
7,
85,
4008,
198,
437,
198,
198,
9979,
256,
796,
27741,
33,
970,
7,
15,
87,
16,
8,
198,
9979,
277,
796,
27741,
33,
970,
7,
15,
87,
17,
8,
198,
9979,
48700,
796,
27741,
33,
970,
7,
15,
87,
18,
8,
198,
198,
16963,
1258,
62,
25135,
7,
3712,
6030,
90,
33,
970,
5512,
7904,
6030,
90,
23839,
33,
970,
30072,
796,
27741,
33,
970,
198,
1102,
1851,
7,
3712,
6030,
90,
23839,
33,
970,
5512,
275,
3712,
33,
970,
8,
796,
611,
275,
256,
2073,
277,
886,
628,
198,
2235,
27741,
33,
970,
5345,
16205,
198,
2235,
36658,
2559,
855,
198,
7266,
82,
8139,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
2124,
24844,
48700,
8614,
2124,
24844,
331,
198,
7266,
82,
8139,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
33,
970,
8,
796,
6352,
8139,
7,
87,
11,
1102,
1851,
7,
23839,
33,
970,
11,
331,
4008,
198,
198,
271,
3849,
8831,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
5145,
19510,
87,
24844,
256,
11405,
331,
24844,
277,
8,
8614,
357,
87,
24844,
277,
11405,
331,
24844,
256,
4008,
198,
271,
3849,
8831,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
33,
970,
8,
796,
318,
3849,
8831,
7,
87,
11,
1102,
1851,
7,
23839,
33,
970,
11,
331,
4008,
198,
271,
3849,
8831,
7,
87,
3712,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
318,
3849,
8831,
7,
1102,
1851,
7,
23839,
33,
970,
11,
2124,
828,
88,
8,
198,
198,
271,
2411,
864,
7,
3712,
6030,
90,
23839,
33,
970,
30072,
796,
3991,
198,
271,
397,
8709,
7,
66,
3712,
6030,
90,
33,
970,
5512,
257,
3712,
6030,
90,
23839,
33,
970,
30072,
796,
2081,
198,
198,
786,
13255,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
2124,
13,
85,
6624,
331,
13,
85,
198,
3438,
5718,
80,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
2124,
13,
85,
6624,
331,
13,
85,
198,
198,
158,
232,
242,
7,
64,
3712,
23839,
33,
970,
8,
796,
257,
198,
158,
232,
242,
7,
64,
3712,
23839,
33,
970,
11,
275,
3712,
23839,
33,
970,
8,
796,
257,
24844,
275,
5633,
257,
1058,
48700,
198,
158,
232,
242,
7,
64,
3712,
33,
970,
11,
275,
3712,
23839,
33,
970,
8,
796,
2343,
232,
242,
7,
1102,
1851,
7,
23839,
33,
970,
11,
64,
828,
65,
8,
198,
158,
232,
242,
7,
64,
3712,
23839,
33,
970,
11,
275,
3712,
33,
970,
8,
796,
2343,
232,
242,
7,
64,
11,
1102,
1851,
7,
23839,
33,
970,
11,
65,
4008,
198,
158,
232,
242,
7,
64,
3712,
33,
970,
11,
275,
3712,
33,
970,
8,
796,
257,
24844,
275,
5633,
10385,
7,
23839,
33,
970,
11,
64,
8,
1058,
48700,
628,
198,
2235,
36658,
2559,
198,
2235,
21073,
1513,
41146,
943,
29848,
198,
198,
8818,
5145,
7,
65,
3712,
23839,
33,
970,
8,
198,
220,
611,
275,
24844,
256,
198,
220,
220,
220,
277,
198,
220,
2073,
361,
275,
24844,
277,
198,
220,
220,
220,
256,
198,
220,
2073,
361,
275,
24844,
48700,
198,
220,
220,
220,
48700,
198,
220,
886,
198,
437,
198,
198,
7,
855,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
796,
198,
220,
2124,
24844,
48700,
8614,
331,
24844,
48700,
5633,
48700,
1058,
2124,
24844,
256,
11405,
331,
24844,
256,
8614,
2124,
24844,
277,
11405,
331,
24844,
277,
198,
198,
8818,
357,
855,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
198,
220,
611,
2124,
24844,
48700,
8614,
331,
24844,
48700,
48700,
198,
220,
2073,
361,
2124,
24844,
256,
11405,
331,
24844,
256,
256,
198,
220,
2073,
361,
2124,
24844,
277,
11405,
331,
24844,
277,
256,
198,
220,
2073,
277,
198,
220,
886,
198,
437,
198,
7,
855,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
33,
970,
8,
796,
357,
855,
5769,
16963,
1258,
7,
87,
11,
88,
8,
23029,
198,
7,
855,
5769,
88,
3712,
33,
970,
11,
87,
3712,
23839,
33,
970,
8,
796,
357,
855,
5769,
16963,
1258,
7,
88,
11,
87,
8,
23029,
198,
198,
8818,
357,
91,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
198,
220,
611,
2124,
24844,
256,
8614,
331,
24844,
256,
256,
198,
220,
2073,
361,
2124,
24844,
48700,
8614,
331,
24844,
48700,
48700,
198,
220,
2073,
277,
198,
220,
886,
198,
437,
198,
91,
7,
87,
3712,
23839,
33,
970,
11,
331,
3712,
33,
970,
8,
796,
930,
7,
87,
11,
1102,
1851,
7,
23839,
33,
970,
11,
88,
4008,
198,
91,
7,
88,
3712,
33,
970,
11,
2124,
3712,
23839,
33,
970,
8,
796,
930,
7,
1102,
1851,
7,
23839,
33,
970,
11,
88,
828,
2124,
8,
198,
198,
8818,
35494,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
23839,
33,
970,
8,
198,
220,
611,
2124,
24844,
277,
8614,
331,
24844,
277,
277,
198,
220,
2073,
361,
2124,
24844,
48700,
8614,
331,
24844,
48700,
48700,
198,
220,
2073,
256,
198,
220,
886,
198,
437,
198,
198,
39434,
5769,
87,
3712,
23839,
33,
970,
11,
331,
3712,
33,
970,
8,
796,
2124,
1222,
10385,
7,
23839,
33,
970,
11,
331,
8,
198,
39434,
5769,
88,
3712,
33,
970,
11,
2124,
3712,
23839,
33,
970,
8,
796,
10385,
7,
23839,
33,
970,
11,
331,
8,
1222,
2124,
198,
198,
2,
1649,
4006,
318,
24958,
356,
761,
284,
13446,
1111,
13737,
198,
2,
290,
20121,
351,
2343,
232,
242,
198,
8818,
611,
17772,
7,
66,
3712,
23839,
33,
970,
11,
2124,
11,
331,
8,
198,
220,
611,
269,
24844,
256,
198,
220,
220,
220,
2124,
198,
220,
2073,
361,
269,
24844,
277,
198,
220,
220,
220,
331,
198,
220,
2073,
361,
269,
24844,
48700,
198,
220,
220,
220,
2343,
232,
242,
7,
87,
11,
88,
8,
198,
220,
886,
198,
437,
198,
198,
2235,
44118,
198,
2235,
29335,
18604,
198,
8841,
7,
87,
3712,
23839,
33,
970,
8,
796,
14631,
90,
7942,
92,
2430,
90,
9562,
92,
2430,
90,
7942,
11,
9562,
36786,
7131,
87,
13,
85,
60,
198,
4798,
7,
952,
3712,
9399,
11,
2124,
3712,
23839,
33,
970,
8,
796,
3601,
7,
952,
11,
4731,
7,
87,
4008,
198,
12860,
7,
952,
3712,
9399,
11,
2124,
3712,
23839,
33,
970,
8,
796,
3601,
7,
952,
11,
4731,
7,
87,
4008,
198,
12860,
5589,
529,
7,
952,
3712,
9399,
11,
2124,
3712,
23839,
33,
970,
8,
796,
3601,
7,
952,
11,
4731,
7,
87,
4008,
198
] | 2.411064 | 1,175 |
"""
ArcSwift()
Arc-Swift transition system for dependency parsing.
Described in [Qi & Manning 2017](https://nlp.stanford.edu/pubs/qi2017arcswift.pdf).
"""
struct ArcSwift <: AbstractTransitionSystem end
initconfig(::ArcSwift, graph::DependencyTree) = ArcSwiftConfig(graph)
initconfig(::ArcSwift, words) = ArcSwiftConfig(words)
transition_space(::ArcSwift, labels=[]; max_k=5) =
isempty(labels) ? [LeftArc.(1:max_k)..., RightArc.(1:max_k)..., Shift()] :
[[LeftArc(k, l) for k in 1:max_k for l in labels]...,
[RightArc(k, l) for k in 1:max_k for l in labels]...,
Shift()]
projective_only(::ArcSwift) = true
struct ArcSwiftConfig <: AbstractParserConfiguration
σ::Vector{Int}
β::Vector{Int}
A::Vector{Token}
end
function ArcSwiftConfig(words)
σ = [0]
β = collect(1:length(words))
A = Token.(words)
ArcSwiftConfig(σ, β, A)
end
function ArcSwiftConfig(gold::DependencyTree)
σ = [0]
β = collect(1:length(gold))
A = [Token(t, head=-1) for t in gold]
ArcSwiftConfig(σ, β, A)
end
stack(cfg::ArcSwiftConfig) = cfg.σ
buffer(cfg::ArcSwiftConfig) = cfg.β
tokens(cfg::ArcSwiftConfig) = cfg.A
tokens(cfg::ArcSwiftConfig, is) = [token(cfg, i) for i in is if 0 <= i <= length(cfg.A)]
function leftarc(cfg::ArcSwiftConfig, k::Int, args...; kwargs...)
# Assert a head-dependent relation between the word at the front
# of the input buffer and the word at the top of the stack; pop
# the stack.
i = length(cfg.σ) - k + 1
s, b = cfg.σ[i], cfg.β[1]
A = copy(cfg.A)
if s > 0
A[s] = Token(A[s]; head=b, kwargs...)
end
ArcSwiftConfig(cfg.σ[1:i-1], cfg.β, A)
end
function rightarc(cfg::ArcSwiftConfig, k::Int, args...; kwargs...)
# Assert a head-dependent relation between the word on the top of
# the σ and the word at front of the input buffer; shift the
# word at the front of the input buffer to the stack.
i = length(cfg.σ) - k + 1
s, b = cfg.σ[i], cfg.β[1]
A = copy(cfg.A)
A[b] = Token(A[b]; head=s, kwargs...)
ArcSwiftConfig([cfg.σ[1:i] ; b], cfg.β[2:end], A)
end
function shift(cfg::ArcSwiftConfig)
# Remove the word from the front of the input buffer and push it
# onto the stack.
ArcSwiftConfig([cfg.σ ; cfg.β[1]], cfg.β[2:end], cfg.A)
end
isfinal(cfg::ArcSwiftConfig) =
all(t -> all(h >= 0 for h in t.head), cfg.A) #&& length(cfg.σ) > 0 && length(cfg.β) > 0
"""
static_oracle(cfg::ArcSwiftConfig, tree, arc)
Oracle function for arc-swift dependency parsing.
Described in [Qi & Manning 2017](https://nlp.stanford.edu/pubs/qi2017arcswift.pdf).
"""
function static_oracle(cfg::ArcSwiftConfig, gold, arc=untyped)
S = length(cfg.σ)
if S >= 1 && length(cfg.β) >= 1
b = cfg.β[1]
for k in 1:S
i = S - k + 1
s = cfg.σ[i]
has_arc(gold, b, s) && return LeftArc(k, arc(gold[s])...)
has_arc(gold, s, b) && return RightArc(k, arc(gold[b])...)
end
end
return Shift()
end
==(cfg1::ArcSwiftConfig, cfg2::ArcSwiftConfig) =
cfg1.σ == cfg2.σ && cfg1.β == cfg2.β && cfg1.A == cfg2.A
# TODO
function possible_transitions(cfg::ArcSwiftConfig, graph::DependencyTree, arc=untyped)
TransitionOperator[static_oracle(cfg, graph, arc)]
end
function Base.show(io::IO, c::ArcSwiftConfig)
A = join(["$i $(t.form) $(t.head)" for (i,t) in enumerate(tokens(c))], ", ")
print(io, "ArcSwiftConfig($(c.σ),$(c.β),$A)")
end
| [
37811,
198,
220,
220,
220,
10173,
10462,
2135,
3419,
198,
198,
24021,
12,
10462,
2135,
6801,
1080,
329,
20203,
32096,
13,
198,
198,
24564,
8725,
287,
685,
48,
72,
1222,
15281,
2177,
16151,
5450,
1378,
21283,
79,
13,
14192,
3841,
13,
15532,
14,
12984,
82,
14,
40603,
5539,
5605,
2032,
2135,
13,
12315,
737,
198,
37811,
198,
7249,
10173,
10462,
2135,
1279,
25,
27741,
8291,
653,
11964,
886,
198,
198,
15003,
11250,
7,
3712,
24021,
10462,
2135,
11,
4823,
3712,
35,
2690,
1387,
27660,
8,
796,
10173,
10462,
2135,
16934,
7,
34960,
8,
198,
15003,
11250,
7,
3712,
24021,
10462,
2135,
11,
2456,
8,
796,
10173,
10462,
2135,
16934,
7,
10879,
8,
198,
198,
7645,
653,
62,
13200,
7,
3712,
24021,
10462,
2135,
11,
14722,
41888,
11208,
3509,
62,
74,
28,
20,
8,
796,
198,
220,
220,
220,
318,
28920,
7,
23912,
1424,
8,
5633,
685,
18819,
24021,
12195,
16,
25,
9806,
62,
74,
26513,
11,
6498,
24021,
12195,
16,
25,
9806,
62,
74,
26513,
11,
15576,
3419,
60,
1058,
198,
220,
220,
220,
16410,
18819,
24021,
7,
74,
11,
300,
8,
329,
479,
287,
352,
25,
9806,
62,
74,
329,
300,
287,
14722,
60,
986,
11,
198,
220,
220,
220,
220,
685,
11028,
24021,
7,
74,
11,
300,
8,
329,
479,
287,
352,
25,
9806,
62,
74,
329,
300,
287,
14722,
60,
986,
11,
198,
220,
220,
220,
220,
15576,
3419,
60,
198,
198,
16302,
425,
62,
8807,
7,
3712,
24021,
10462,
2135,
8,
796,
2081,
198,
198,
7249,
10173,
10462,
2135,
16934,
1279,
25,
27741,
46677,
38149,
198,
220,
220,
220,
18074,
225,
3712,
38469,
90,
5317,
92,
198,
220,
220,
220,
27169,
3712,
38469,
90,
5317,
92,
198,
220,
220,
220,
317,
3712,
38469,
90,
30642,
92,
198,
437,
198,
198,
8818,
10173,
10462,
2135,
16934,
7,
10879,
8,
198,
220,
220,
220,
18074,
225,
796,
685,
15,
60,
198,
220,
220,
220,
27169,
796,
2824,
7,
16,
25,
13664,
7,
10879,
4008,
198,
220,
220,
220,
317,
796,
29130,
12195,
10879,
8,
198,
220,
220,
220,
10173,
10462,
2135,
16934,
7,
38392,
11,
27169,
11,
317,
8,
198,
437,
198,
198,
8818,
10173,
10462,
2135,
16934,
7,
24267,
3712,
35,
2690,
1387,
27660,
8,
198,
220,
220,
220,
18074,
225,
796,
685,
15,
60,
198,
220,
220,
220,
27169,
796,
2824,
7,
16,
25,
13664,
7,
24267,
4008,
198,
220,
220,
220,
317,
796,
685,
30642,
7,
83,
11,
1182,
10779,
16,
8,
329,
256,
287,
3869,
60,
198,
220,
220,
220,
10173,
10462,
2135,
16934,
7,
38392,
11,
27169,
11,
317,
8,
198,
437,
198,
198,
25558,
7,
37581,
3712,
24021,
10462,
2135,
16934,
8,
220,
796,
30218,
70,
13,
38392,
198,
22252,
7,
37581,
3712,
24021,
10462,
2135,
16934,
8,
796,
30218,
70,
13,
26638,
198,
198,
83,
482,
641,
7,
37581,
3712,
24021,
10462,
2135,
16934,
8,
796,
30218,
70,
13,
32,
198,
83,
482,
641,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
318,
8,
796,
685,
30001,
7,
37581,
11,
1312,
8,
329,
1312,
287,
318,
611,
657,
19841,
1312,
19841,
4129,
7,
37581,
13,
32,
15437,
198,
198,
8818,
1364,
5605,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
479,
3712,
5317,
11,
26498,
986,
26,
479,
86,
22046,
23029,
198,
220,
220,
220,
1303,
2195,
861,
257,
1182,
12,
21186,
8695,
1022,
262,
1573,
379,
262,
2166,
198,
220,
220,
220,
1303,
286,
262,
5128,
11876,
290,
262,
1573,
379,
262,
1353,
286,
262,
8931,
26,
1461,
198,
220,
220,
220,
1303,
262,
8931,
13,
198,
220,
220,
220,
1312,
796,
4129,
7,
37581,
13,
38392,
8,
532,
479,
1343,
352,
198,
220,
220,
220,
264,
11,
275,
796,
30218,
70,
13,
38392,
58,
72,
4357,
30218,
70,
13,
26638,
58,
16,
60,
198,
220,
220,
220,
317,
796,
4866,
7,
37581,
13,
32,
8,
198,
220,
220,
220,
611,
264,
1875,
657,
198,
220,
220,
220,
220,
220,
220,
220,
317,
58,
82,
60,
796,
29130,
7,
32,
58,
82,
11208,
1182,
28,
65,
11,
479,
86,
22046,
23029,
198,
220,
220,
220,
886,
198,
220,
220,
220,
10173,
10462,
2135,
16934,
7,
37581,
13,
38392,
58,
16,
25,
72,
12,
16,
4357,
30218,
70,
13,
26638,
11,
317,
8,
198,
437,
198,
198,
8818,
826,
5605,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
479,
3712,
5317,
11,
26498,
986,
26,
479,
86,
22046,
23029,
198,
220,
220,
220,
1303,
2195,
861,
257,
1182,
12,
21186,
8695,
1022,
262,
1573,
319,
262,
1353,
286,
198,
220,
220,
220,
1303,
262,
18074,
225,
290,
262,
1573,
379,
2166,
286,
262,
5128,
11876,
26,
6482,
262,
198,
220,
220,
220,
1303,
1573,
379,
262,
2166,
286,
262,
5128,
11876,
284,
262,
8931,
13,
198,
220,
220,
220,
1312,
796,
4129,
7,
37581,
13,
38392,
8,
532,
479,
1343,
352,
198,
220,
220,
220,
264,
11,
275,
796,
30218,
70,
13,
38392,
58,
72,
4357,
30218,
70,
13,
26638,
58,
16,
60,
198,
220,
220,
220,
317,
796,
4866,
7,
37581,
13,
32,
8,
198,
220,
220,
220,
317,
58,
65,
60,
796,
29130,
7,
32,
58,
65,
11208,
1182,
28,
82,
11,
479,
86,
22046,
23029,
198,
220,
220,
220,
10173,
10462,
2135,
16934,
26933,
37581,
13,
38392,
58,
16,
25,
72,
60,
2162,
275,
4357,
30218,
70,
13,
26638,
58,
17,
25,
437,
4357,
317,
8,
198,
437,
198,
198,
8818,
6482,
7,
37581,
3712,
24021,
10462,
2135,
16934,
8,
198,
220,
220,
220,
1303,
17220,
262,
1573,
422,
262,
2166,
286,
262,
5128,
11876,
290,
4574,
340,
198,
220,
220,
220,
1303,
4291,
262,
8931,
13,
198,
220,
220,
220,
10173,
10462,
2135,
16934,
26933,
37581,
13,
38392,
2162,
30218,
70,
13,
26638,
58,
16,
60,
4357,
30218,
70,
13,
26638,
58,
17,
25,
437,
4357,
30218,
70,
13,
32,
8,
198,
437,
198,
198,
4468,
1292,
7,
37581,
3712,
24021,
10462,
2135,
16934,
8,
796,
198,
220,
220,
220,
477,
7,
83,
4613,
477,
7,
71,
18189,
657,
329,
289,
287,
256,
13,
2256,
828,
30218,
70,
13,
32,
8,
1303,
25226,
4129,
7,
37581,
13,
38392,
8,
1875,
657,
11405,
4129,
7,
37581,
13,
26638,
8,
1875,
657,
628,
198,
37811,
198,
220,
220,
220,
9037,
62,
273,
6008,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
5509,
11,
10389,
8,
198,
198,
48625,
2163,
329,
10389,
12,
2032,
2135,
20203,
32096,
13,
198,
198,
24564,
8725,
287,
685,
48,
72,
1222,
15281,
2177,
16151,
5450,
1378,
21283,
79,
13,
14192,
3841,
13,
15532,
14,
12984,
82,
14,
40603,
5539,
5605,
2032,
2135,
13,
12315,
737,
198,
37811,
198,
8818,
9037,
62,
273,
6008,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
3869,
11,
10389,
28,
403,
774,
9124,
8,
198,
220,
220,
220,
311,
796,
4129,
7,
37581,
13,
38392,
8,
198,
220,
220,
220,
611,
311,
18189,
352,
11405,
4129,
7,
37581,
13,
26638,
8,
18189,
352,
198,
220,
220,
220,
220,
220,
220,
220,
275,
796,
30218,
70,
13,
26638,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
352,
25,
50,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1312,
796,
311,
532,
479,
1343,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
796,
30218,
70,
13,
38392,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
468,
62,
5605,
7,
24267,
11,
275,
11,
264,
8,
11405,
1441,
9578,
24021,
7,
74,
11,
10389,
7,
24267,
58,
82,
12962,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
468,
62,
5605,
7,
24267,
11,
264,
11,
275,
8,
11405,
1441,
6498,
24021,
7,
74,
11,
10389,
7,
24267,
58,
65,
12962,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
15576,
3419,
198,
437,
628,
198,
855,
7,
37581,
16,
3712,
24021,
10462,
2135,
16934,
11,
30218,
70,
17,
3712,
24021,
10462,
2135,
16934,
8,
796,
198,
220,
220,
220,
30218,
70,
16,
13,
38392,
6624,
30218,
70,
17,
13,
38392,
11405,
30218,
70,
16,
13,
26638,
6624,
30218,
70,
17,
13,
26638,
11405,
30218,
70,
16,
13,
32,
6624,
30218,
70,
17,
13,
32,
198,
198,
2,
16926,
46,
198,
8818,
1744,
62,
7645,
1756,
7,
37581,
3712,
24021,
10462,
2135,
16934,
11,
4823,
3712,
35,
2690,
1387,
27660,
11,
10389,
28,
403,
774,
9124,
8,
198,
220,
220,
220,
40658,
18843,
1352,
58,
12708,
62,
273,
6008,
7,
37581,
11,
4823,
11,
10389,
15437,
198,
437,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
269,
3712,
24021,
10462,
2135,
16934,
8,
198,
220,
220,
220,
317,
796,
4654,
7,
14692,
3,
72,
29568,
83,
13,
687,
8,
29568,
83,
13,
2256,
16725,
329,
357,
72,
11,
83,
8,
287,
27056,
378,
7,
83,
482,
641,
7,
66,
4008,
4357,
33172,
366,
8,
198,
220,
220,
220,
3601,
7,
952,
11,
366,
24021,
10462,
2135,
16934,
16763,
7,
66,
13,
38392,
828,
3,
7,
66,
13,
26638,
828,
3,
32,
8,
4943,
198,
437,
198
] | 2.282508 | 1,515 |
include("SSA.jl")
function addSim(sys::System, tauVar::TauVar, n::Int64)
ens = newEnsemble(sys, n)
npoints = length(sys.data.dd)
if sys.routine.ssa == :Direct
for i in 2:npoints
if i == 2 && sys.routine.shoot
reShoot!(sys, ens, i-1)
end
_sim!(sys, ens, i)
for k in eachindex(ens)
for xx in ens[k].x
push!(ens[k].xa,xx)
end
push!(ens[k].ta,sys.times[i])
end
end
elseif sys.routine.ssa == :Tau
for i in 2:npoints
if i == 2 && sys.routine.shoot
reShoot!(sys, ens, i-1)
end
_sim!(sys, ens, i, tauVar)
for k in eachindex(ens)
for xx in ens[k].x
push!(ens[k].xa,xx)
end
push!(ens[k].ta,sys.times[i])
end
end
end
ens
end
function sim(sys::System, θ::Vector{Float64}, σ2::Vector{Float64}, n::Int64)
sys.state.θ = θ
sys.state.σ2 = diagm(σ2)
tauVar = preAllocTauVar(sys)
ens = Ensemble()
append!(ens, addSim(sys, tauVar, n))
ens
end
| [
17256,
7203,
50,
4090,
13,
20362,
4943,
198,
198,
8818,
751,
8890,
7,
17597,
3712,
11964,
11,
256,
559,
19852,
3712,
51,
559,
19852,
11,
299,
3712,
5317,
2414,
8,
198,
220,
220,
220,
3140,
796,
649,
4834,
15140,
7,
17597,
11,
299,
8,
220,
220,
198,
220,
220,
220,
299,
13033,
796,
4129,
7,
17597,
13,
7890,
13,
1860,
8,
198,
220,
220,
220,
611,
25064,
13,
81,
28399,
13,
824,
64,
6624,
1058,
13470,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
362,
25,
77,
13033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
362,
11405,
25064,
13,
81,
28399,
13,
30408,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
302,
2484,
1025,
0,
7,
17597,
11,
3140,
11,
1312,
12,
16,
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,
4808,
14323,
0,
7,
17597,
11,
3140,
11,
1312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
1123,
9630,
7,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
31383,
287,
3140,
58,
74,
4083,
87,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
641,
58,
74,
4083,
27865,
11,
5324,
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,
4574,
0,
7,
641,
58,
74,
4083,
8326,
11,
17597,
13,
22355,
58,
72,
12962,
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,
25064,
13,
81,
28399,
13,
824,
64,
6624,
1058,
51,
559,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
362,
25,
77,
13033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
1312,
6624,
362,
11405,
25064,
13,
81,
28399,
13,
30408,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
302,
2484,
1025,
0,
7,
17597,
11,
3140,
11,
1312,
12,
16,
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,
4808,
14323,
0,
7,
17597,
11,
3140,
11,
1312,
11,
256,
559,
19852,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
479,
287,
1123,
9630,
7,
641,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
329,
31383,
287,
3140,
58,
74,
4083,
87,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
641,
58,
74,
4083,
27865,
11,
5324,
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,
4574,
0,
7,
641,
58,
74,
4083,
8326,
11,
17597,
13,
22355,
58,
72,
12962,
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,
3140,
198,
437,
198,
198,
8818,
985,
7,
17597,
3712,
11964,
11,
7377,
116,
3712,
38469,
90,
43879,
2414,
5512,
18074,
225,
17,
3712,
38469,
90,
43879,
2414,
5512,
299,
3712,
5317,
2414,
8,
198,
220,
220,
220,
25064,
13,
5219,
13,
138,
116,
796,
7377,
116,
198,
220,
220,
220,
25064,
13,
5219,
13,
38392,
17,
796,
2566,
363,
76,
7,
38392,
17,
8,
198,
220,
220,
220,
256,
559,
19852,
796,
662,
3237,
420,
51,
559,
19852,
7,
17597,
8,
198,
220,
220,
220,
3140,
796,
2039,
15140,
3419,
198,
220,
220,
220,
24443,
0,
7,
641,
11,
751,
8890,
7,
17597,
11,
256,
559,
19852,
11,
299,
4008,
198,
220,
220,
220,
3140,
198,
437,
198
] | 1.662031 | 719 |
using CSV
using LinearAlgebra: dot, I
using CairoMakie
using naumer_Dimensionality_2022
const Σ = [1.0 0.1 0.1;
0.1 1.0 0.1;
0.1 0.1 1.0]
const v = [1.0/sqrt(3), 1.0/sqrt(3), 1.0/sqrt(3)]
const σ² = 1
f(x) = abs2(dot(v, Σ * x)) / (dot(x, Σ * x) + σ² * dot(x, x))
# Helper function to compute extra coordinate
function getZ(x,y)
if abs2(x) + abs2(y) > 1 - 10*eps()
return NaN
end
return sqrt(1 - abs2(x) - abs2(y))
end
function rewardPositive(x,y)
return f([x,y,getZ(x,y)])
end
function rewardNegative(x,y)
return f([x,y,-getZ(x,y)])
end
state = zeros(3,100)
state[3,1] = 1
for i in 2:100
state[:,i] .= actiongradientstep_1DApprox(state[:,i-1], v, Σ, σ², 0.1)
end
rewards = zeros(100)
for i in 1:100
rewards[i] = f(state[:,i])
end
# Sample Circle
x = -1.1:0.01:1.1
y = -1.1:0.01:1.1
noto_sans = "./resources/NotoSans-Regular.ttf"
noto_sans_bold = "./resources/NotoSans-Bold.ttf"
tickfontsize = 26
labelfontsize = 28
basewidth = 2
fig = Figure(font=noto_sans, resolution=(1000,500), figure_padding=40)
ax1 = Axis( fig[1,1],
xticklabelsize=tickfontsize,
yticklabelsize=tickfontsize,
yticklabelpad=2,
xlabel="x", ylabel = "y",
xlabelsize=labelfontsize,
ylabelsize=labelfontsize,
titlesize=labelfontsize,
ratio=AxisAspect(1))
hm = heatmap!(ax1,x,y,rewardPositive)
lines!(ax1, state[1,:], state[2,:], color=:black, linewidth=3)
ax2 = Axis( fig[1,3],
xticklabelsize=tickfontsize,
yticklabelsize=tickfontsize,
yticklabelpad=2,
xlabel="Iteration", ylabel = "Objective",
xlabelsize=labelfontsize,
ylabelsize=labelfontsize,
titlesize=labelfontsize,
ratio=AxisAspect(1),
xminorticksvisible = true,
xminorgridvisible = true,
xminorticks = IntervalsBetween(10),
yminorticksvisible = true,
yminorgridvisible = true,
yminorticks = IntervalsBetween(5))
lines!(ax2,1:100, rewards, color=:black, width=2)
xlims!(ax2,(0,100))
Colorbar(fig[1, 2], hm, ticklabelsize=tickfontsize)
colgap!(fig.layout,2,80)
Label(fig[1,1,TopLeft()], "A", font=noto_sans_bold, textsize = 36, halign=:left, valign=:bottom, padding=(25,0,10,0))
Label(fig[1,3,TopLeft()], "B", font=noto_sans_bold, textsize = 36, halign=:left, valign=:bottom, padding=(25,0,10,0))
save("out/OptDescent.pdf",fig)
| [
3500,
44189,
198,
3500,
44800,
2348,
29230,
25,
16605,
11,
314,
198,
3500,
23732,
44,
461,
494,
198,
3500,
12385,
6975,
62,
29271,
3004,
1483,
62,
1238,
1828,
198,
198,
9979,
7377,
96,
796,
685,
16,
13,
15,
220,
657,
13,
16,
220,
657,
13,
16,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
13,
16,
220,
352,
13,
15,
220,
657,
13,
16,
26,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
13,
16,
220,
657,
13,
16,
220,
352,
13,
15,
60,
198,
198,
9979,
410,
796,
685,
16,
13,
15,
14,
31166,
17034,
7,
18,
828,
352,
13,
15,
14,
31166,
17034,
7,
18,
828,
352,
13,
15,
14,
31166,
17034,
7,
18,
15437,
198,
9979,
18074,
225,
31185,
796,
352,
198,
198,
69,
7,
87,
8,
796,
2352,
17,
7,
26518,
7,
85,
11,
7377,
96,
1635,
2124,
4008,
1220,
357,
26518,
7,
87,
11,
7377,
96,
1635,
2124,
8,
1343,
18074,
225,
31185,
1635,
16605,
7,
87,
11,
2124,
4008,
628,
198,
2,
5053,
525,
2163,
284,
24061,
3131,
20435,
198,
8818,
651,
57,
7,
87,
11,
88,
8,
198,
220,
220,
220,
611,
2352,
17,
7,
87,
8,
1343,
2352,
17,
7,
88,
8,
1875,
352,
532,
838,
9,
25386,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
11013,
45,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
19862,
17034,
7,
16,
532,
2352,
17,
7,
87,
8,
532,
2352,
17,
7,
88,
4008,
198,
437,
198,
198,
8818,
6721,
21604,
1800,
7,
87,
11,
88,
8,
198,
220,
220,
220,
1441,
277,
26933,
87,
11,
88,
11,
1136,
57,
7,
87,
11,
88,
8,
12962,
198,
437,
198,
198,
8818,
6721,
32863,
876,
7,
87,
11,
88,
8,
198,
220,
220,
220,
1441,
277,
26933,
87,
11,
88,
12095,
1136,
57,
7,
87,
11,
88,
8,
12962,
198,
437,
628,
198,
5219,
796,
1976,
27498,
7,
18,
11,
3064,
8,
198,
5219,
58,
18,
11,
16,
60,
796,
352,
198,
198,
1640,
1312,
287,
362,
25,
3064,
198,
220,
220,
220,
1181,
58,
45299,
72,
60,
764,
28,
2223,
49607,
9662,
62,
16,
35,
4677,
13907,
7,
5219,
58,
45299,
72,
12,
16,
4357,
410,
11,
7377,
96,
11,
18074,
225,
31185,
11,
657,
13,
16,
8,
198,
437,
198,
198,
260,
2017,
796,
1976,
27498,
7,
3064,
8,
198,
1640,
1312,
287,
352,
25,
3064,
198,
220,
220,
220,
11530,
58,
72,
60,
796,
277,
7,
5219,
58,
45299,
72,
12962,
198,
437,
198,
198,
2,
27565,
16291,
198,
87,
796,
532,
16,
13,
16,
25,
15,
13,
486,
25,
16,
13,
16,
198,
88,
796,
532,
16,
13,
16,
25,
15,
13,
486,
25,
16,
13,
16,
198,
198,
1662,
78,
62,
82,
504,
796,
366,
19571,
37540,
14,
45,
2069,
50,
504,
12,
40164,
13,
926,
69,
1,
198,
1662,
78,
62,
82,
504,
62,
36575,
796,
366,
19571,
37540,
14,
45,
2069,
50,
504,
12,
33,
727,
13,
926,
69,
1,
198,
198,
42298,
10331,
7857,
220,
220,
220,
796,
2608,
198,
23912,
7046,
756,
7857,
220,
220,
796,
2579,
198,
12093,
413,
5649,
796,
362,
198,
198,
5647,
796,
11291,
7,
10331,
28,
1662,
78,
62,
82,
504,
11,
6323,
16193,
12825,
11,
4059,
828,
3785,
62,
39231,
28,
1821,
8,
628,
198,
897,
16,
796,
38349,
7,
2336,
58,
16,
11,
16,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
742,
624,
23912,
1424,
1096,
28,
42298,
10331,
7857,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
42298,
23912,
1424,
1096,
28,
42298,
10331,
7857,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
42298,
18242,
15636,
28,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
18242,
2625,
87,
1600,
331,
18242,
796,
366,
88,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
23912,
1424,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
23912,
1424,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8714,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8064,
28,
31554,
271,
1722,
806,
7,
16,
4008,
628,
198,
23940,
796,
4894,
8899,
0,
7,
897,
16,
11,
87,
11,
88,
11,
260,
904,
21604,
1800,
8,
198,
6615,
0,
7,
897,
16,
11,
1181,
58,
16,
11,
25,
4357,
1181,
58,
17,
11,
25,
4357,
3124,
28,
25,
13424,
11,
9493,
413,
5649,
28,
18,
8,
628,
198,
897,
17,
796,
38349,
7,
2336,
58,
16,
11,
18,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
742,
624,
23912,
1424,
1096,
28,
42298,
10331,
7857,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
42298,
23912,
1424,
1096,
28,
42298,
10331,
7857,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
42298,
18242,
15636,
28,
17,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
18242,
2625,
29993,
341,
1600,
331,
18242,
796,
366,
10267,
425,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
23912,
1424,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
23912,
1424,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8714,
1096,
28,
23912,
7046,
756,
7857,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8064,
28,
31554,
271,
1722,
806,
7,
16,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
1084,
419,
3378,
23504,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
1084,
273,
25928,
23504,
220,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2124,
1084,
419,
3378,
796,
4225,
12786,
25262,
7,
940,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
1084,
419,
3378,
23504,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
1084,
273,
25928,
23504,
220,
796,
2081,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
331,
1084,
419,
3378,
796,
4225,
12786,
25262,
7,
20,
4008,
628,
198,
6615,
0,
7,
897,
17,
11,
16,
25,
3064,
11,
11530,
11,
3124,
28,
25,
13424,
11,
9647,
28,
17,
8,
220,
198,
87,
2475,
82,
0,
7,
897,
17,
11,
7,
15,
11,
3064,
4008,
198,
198,
10258,
5657,
7,
5647,
58,
16,
11,
362,
4357,
289,
76,
11,
4378,
23912,
1424,
1096,
28,
42298,
10331,
7857,
8,
198,
198,
4033,
43554,
0,
7,
5647,
13,
39786,
11,
17,
11,
1795,
8,
198,
198,
33986,
7,
5647,
58,
16,
11,
16,
11,
9126,
18819,
3419,
4357,
366,
32,
1600,
10369,
28,
1662,
78,
62,
82,
504,
62,
36575,
11,
2420,
7857,
796,
4570,
11,
10284,
570,
28,
25,
9464,
11,
1188,
570,
28,
25,
22487,
11,
24511,
16193,
1495,
11,
15,
11,
940,
11,
15,
4008,
198,
33986,
7,
5647,
58,
16,
11,
18,
11,
9126,
18819,
3419,
4357,
366,
33,
1600,
10369,
28,
1662,
78,
62,
82,
504,
62,
36575,
11,
2420,
7857,
796,
4570,
11,
10284,
570,
28,
25,
9464,
11,
1188,
570,
28,
25,
22487,
11,
24511,
16193,
1495,
11,
15,
11,
940,
11,
15,
4008,
628,
198,
21928,
7203,
448,
14,
27871,
5960,
1087,
13,
12315,
1600,
5647,
8,
198
] | 1.926549 | 1,307 |
export load_model, get_device, seisdata2torch, slide, detect, trigger_onset
export get_picks, load_test_data
"""
load_model(phase;device=nothing)
Load generalized-phase-detection model onto device.
# Arguments
- `phase::String`: Seismic phase to load - "P" or "S".
# Keywords
- `device::Union{PyObject,Nothing}`: Pytorch device - specify "gpu" or "cpu".
"""
function load_model(phase::String;device::Union{PyObject,Nothing}=nothing)
# check phase input
if uppercase(phase) ∉ ["P","S"]
error("Only available models are 'P' and 'S'.")
end
# get correct model
model_dir = joinpath(dirname(@__FILE__),"..","deps","downloads")
modelP = joinpath(model_dir,"model_P.pt")
modelS = joinpath(model_dir,"model_S.pt")
model_file = uppercase(phase) == "P" ? modelP : modelS
# load model
if isa(device,Nothing)
device = get_device()
end
model = UNet(3,1).to(device)
checkpoint = torch.load(model_file, map_location=device)
# load state dictionary
state_dict = Dict()
for key in keys(checkpoint["model_state_dict"])
if occursin("tracked",key)
continue
end
state_dict[key] = checkpoint["model_state_dict"][key]
end
model.load_state_dict(state_dict)
model.eval()
return model
end
"""
get_device()
Returns current PyTorch device.
"""
get_device() = torch.device(torch.cuda.is_available() ? "cuda" : "cpu")
"""
seisdata2torch(S)
Convert 3 component `SeisData` struct `S` into Torch tensor.
# Arguments
- `S::SeisData`: 3-component `SeisData` for detection.
- `window_samples::Int`: Number of samples per detection window.
"""
function seisdata2torch(S::SeisData,window_samples::Int)
# check only 3 channels in SeisChannel
@assert S.n == 3
# create sliding windows
X = cat([slide(S[ii].x,window_samples) for ii = 1:S.n]...,dims=3)
X ./= maximum(abs.(X),dims=(1,3))
return torch.from_numpy(X).float().permute(1,2,0)
end
"""
slide(A,window_samples)
Split vector `A` into non-overlapping windows of length `window_samples`.
# Arguments
- `S::SeisData`: 3-component `SeisData` for detection.
- `window_samples::Int`: Number of samples per detection window.
"""
function slide(A::AbstractVector, window_samples::Int)
N = size(A,1)
if N % window_samples == 0
return Array(reshape(A,window_samples,N ÷ window_samples))
else
return Array(reshape(A[1 : N - N % window_samples], window_samples, N ÷ window_samples))
end
end
"""
detect(X,model,batch_size;device=nothing)
Run generalized-phase-detection on tensor `X` in batches of size `batch_size`.
# Arguments
- `X::PyObject`: Torch tensor.
- `model::PyObject`: Torch `UNet` model.
- `batch_size::Int`: Number of windows per detection. Specifying too large a
batch size will cause the GPU to run out of VRAM.
# Keywords
- `device::Union{PyObject,Nothing}`: Pytorch device - specify "gpu" or "cpu".
"""
function detect(X,model,batch_size::Int;device::Union{PyObject,Nothing}=nothing)
# use default device
if isa(device,Nothing)
device = get_device()
end
# run predictions in batches
Y_pred = zeros(Float32, X.size(2),X.size(0))
for ii in 1:batch_size:size(Y_pred,2)
i_start = ii
i_stop = min(size(Y_pred,2),ii+batch_size-1)
X_test = get(X,i_start-1:i_stop-1)
X_test = X_test.to(device)
@pywith torch.no_grad() begin
out = model(X_test)
Y_pred[:,i_start:i_stop] .= out.cpu().permute(2,0,1).numpy()[:,:,1]
end
GC.gc(false)
end
return Y_pred
end
"""
trigger_onset(charfct, thresh1, thresh2; max_len=1e99, max_len_delete=false)
Calculate trigger on and off times.
Given `thresh1` and `thresh2` calculate trigger on and off times from
characteristic function.
# Arguments
- `charfct::AbstractArray`: Characteristic function of e.g. STA/LTA trigger.
- `thresh1::Real`: Value above which trigger (of characteristic function)
is activated (higher threshold).
- `thresh2::Real`: Value below which trigger (of characteristic function)
is deactivated (lower threshold).
# Keywords
- `max_len::Int`: Maximum length of triggered event in samples. A new
event will be triggered as soon as the signal reaches again above thresh1.
- `max_len_delete::Bool`: Do not write events longer than max_len into report file.
"""
function trigger_onset(charfct::AbstractArray, thresh1::Real, thresh2::Real;
max_len::Int=10^10, max_len_delete::Bool=false,
)
ind1 = findall(charfct .> thresh1)
if length(ind1) == 0
return []
end
ind2 = findall(charfct .> thresh2)
on = [ind1[1]]
off = [-1]
# determine the indices where charfct falls below off-threshold
ind2_ = Array{Bool}(undef,length(ind2))
ind2_[1:end-1] .= diff(ind2) .> 1
# last occurence is missed by diff, add it manually
ind2_[end] = true
append!(off,ind2[ind2_])
append!(on,ind1[findall(diff(ind1) .> 1) .+ 1])
# include last pick if trigger is on or drop it
if max_len_delete
# drop it
append!(off,max_len)
append!(on,on[end])
else
# include it
append!(off,ind2[end])
end
pick = []
while on[end] > off[1]
while on[1] <= off[1]
deleteat!(on,1)
end
while off[1] < on[1]
deleteat!(off,1)
end
if off[1] - on[1] > max_len
if max_len_delete
deleteat!(on,1)
continue
end
prepend!(off,on[1] + max_len)
end
push!(pick,[on[1],off[1]])
end
return permutedims(hcat(pick...))
end
"""
get_picks(S,probs,thresh1,thresh2;min_trig_dur=0.)
Get picks from detection probabilities `probs` from SeisData `S`.
# Arguments
- `S::SeisData`: 3-component `SeisData` for detection.
- `probs::AbstractArray`: Array of probabilities of phase detection per window.
- `thresh1::Real`: Probability (0-1) above which trigger is activated (higher threshold).
- `thresh2::Real`: Probability (0-1) below which trigger is deactivated (lower threshold).
# Keywords
`min_trig_dur::Real`: Minimum duration (in seconds) of trigger.
"""
function get_picks(
S::SeisData,
probs::AbstractArray,
thresh1::Real,
thresh2::Real;
min_trig_dur::Real=0.,
)
@assert 0. < thresh2 < thresh1 <= 1.
tt = collect(0:length(probs)-1) ./ S.fs[1]
picks = Array{DateTime}(undef,0)
trigs = trigger_onset(vcat(probs...),thresh1,thresh2)
for ii in 1:size(trigs,1)
if trigs[ii,1] == trigs[ii,2]
continue
end
# check trigger duration
trig_dur = tt[trigs[ii,2]] - tt[trigs[ii,1]]
if trig_dur < min_trig_dur
continue
end
pick = argmax(probs[trigs[ii,1]:trigs[ii,2]]) + trigs[ii,1]
tstamp = u2d(S.t[1][1,2] * 1e-6+ tt[pick])
push!(picks,tstamp)
end
return picks, tt
end
"""
load_test_data()
Load 3-component seismic data from the 2016 Mw 5.2 Anza, California sequence.
"""
function load_test_data()
sacfiles = joinpath(dirname(@__FILE__),"..","deps","downloads","*.SAC")
return read_data("sac",sacfiles)
end
| [
39344,
3440,
62,
19849,
11,
651,
62,
25202,
11,
384,
271,
7890,
17,
13165,
354,
11,
10649,
11,
4886,
11,
7616,
62,
684,
316,
198,
39344,
651,
62,
79,
3378,
11,
3440,
62,
9288,
62,
7890,
198,
198,
37811,
198,
220,
3440,
62,
19849,
7,
40715,
26,
25202,
28,
22366,
8,
198,
198,
8912,
38284,
12,
40715,
12,
15255,
3213,
2746,
4291,
3335,
13,
198,
198,
2,
20559,
2886,
198,
12,
4600,
40715,
3712,
10100,
63,
25,
1001,
1042,
291,
7108,
284,
3440,
532,
366,
47,
1,
393,
366,
50,
1911,
198,
198,
2,
7383,
10879,
198,
12,
4600,
25202,
3712,
38176,
90,
20519,
10267,
11,
18465,
92,
63,
25,
9485,
13165,
354,
3335,
532,
11986,
366,
46999,
1,
393,
366,
36166,
1911,
198,
37811,
198,
8818,
3440,
62,
19849,
7,
40715,
3712,
10100,
26,
25202,
3712,
38176,
90,
20519,
10267,
11,
18465,
92,
28,
22366,
8,
198,
220,
220,
220,
1303,
2198,
7108,
5128,
198,
220,
220,
220,
611,
334,
39921,
589,
7,
40715,
8,
18872,
231,
14631,
47,
2430,
50,
8973,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
10049,
1695,
4981,
389,
705,
47,
6,
290,
705,
50,
6,
19570,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
651,
3376,
2746,
198,
220,
220,
220,
2746,
62,
15908,
796,
4654,
6978,
7,
15908,
3672,
7,
31,
834,
25664,
834,
27267,
492,
2430,
10378,
82,
2430,
15002,
82,
4943,
198,
220,
220,
220,
2746,
47,
796,
4654,
6978,
7,
19849,
62,
15908,
553,
19849,
62,
47,
13,
457,
4943,
198,
220,
220,
220,
2746,
50,
796,
4654,
6978,
7,
19849,
62,
15908,
553,
19849,
62,
50,
13,
457,
4943,
198,
220,
220,
220,
2746,
62,
7753,
796,
334,
39921,
589,
7,
40715,
8,
6624,
366,
47,
1,
5633,
2746,
47,
1058,
2746,
50,
628,
220,
220,
220,
1303,
3440,
2746,
198,
220,
220,
220,
611,
318,
64,
7,
25202,
11,
18465,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3335,
796,
651,
62,
25202,
3419,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2746,
796,
4725,
316,
7,
18,
11,
16,
737,
1462,
7,
25202,
8,
198,
220,
220,
220,
26954,
796,
28034,
13,
2220,
7,
19849,
62,
7753,
11,
3975,
62,
24886,
28,
25202,
8,
628,
220,
220,
220,
1303,
3440,
1181,
22155,
198,
220,
220,
220,
1181,
62,
11600,
796,
360,
713,
3419,
198,
220,
220,
220,
329,
1994,
287,
8251,
7,
9122,
4122,
14692,
19849,
62,
5219,
62,
11600,
8973,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
8833,
259,
7203,
2213,
6021,
1600,
2539,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1181,
62,
11600,
58,
2539,
60,
796,
26954,
14692,
19849,
62,
5219,
62,
11600,
1,
7131,
2539,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2746,
13,
2220,
62,
5219,
62,
11600,
7,
5219,
62,
11600,
8,
198,
220,
220,
220,
2746,
13,
18206,
3419,
198,
220,
220,
220,
1441,
2746,
198,
437,
198,
198,
37811,
198,
220,
651,
62,
25202,
3419,
198,
198,
35561,
1459,
9485,
15884,
354,
3335,
13,
198,
37811,
198,
1136,
62,
25202,
3419,
796,
28034,
13,
25202,
7,
13165,
354,
13,
66,
15339,
13,
271,
62,
15182,
3419,
5633,
366,
66,
15339,
1,
1058,
366,
36166,
4943,
198,
198,
37811,
198,
220,
384,
271,
7890,
17,
13165,
354,
7,
50,
8,
198,
198,
3103,
1851,
513,
7515,
4600,
4653,
271,
6601,
63,
2878,
4600,
50,
63,
656,
34868,
11192,
273,
13,
198,
198,
2,
20559,
2886,
198,
12,
4600,
50,
3712,
4653,
271,
6601,
63,
25,
513,
12,
42895,
4600,
4653,
271,
6601,
63,
329,
13326,
13,
198,
12,
4600,
17497,
62,
82,
12629,
3712,
5317,
63,
25,
7913,
286,
8405,
583,
13326,
4324,
13,
198,
37811,
198,
8818,
384,
271,
7890,
17,
13165,
354,
7,
50,
3712,
4653,
271,
6601,
11,
17497,
62,
82,
12629,
3712,
5317,
8,
198,
220,
220,
220,
1303,
2198,
691,
513,
9619,
287,
1001,
271,
29239,
198,
220,
220,
220,
2488,
30493,
311,
13,
77,
6624,
513,
198,
220,
220,
220,
1303,
2251,
22292,
9168,
198,
220,
220,
220,
1395,
796,
3797,
26933,
6649,
485,
7,
50,
58,
4178,
4083,
87,
11,
17497,
62,
82,
12629,
8,
329,
21065,
796,
352,
25,
50,
13,
77,
60,
986,
11,
67,
12078,
28,
18,
8,
198,
220,
220,
220,
1395,
24457,
28,
5415,
7,
8937,
12195,
55,
828,
67,
12078,
16193,
16,
11,
18,
4008,
198,
220,
220,
220,
1441,
28034,
13,
6738,
62,
77,
32152,
7,
55,
737,
22468,
22446,
16321,
1133,
7,
16,
11,
17,
11,
15,
8,
198,
437,
198,
198,
37811,
198,
220,
10649,
7,
32,
11,
17497,
62,
82,
12629,
8,
198,
198,
41205,
15879,
4600,
32,
63,
656,
1729,
12,
2502,
75,
5912,
9168,
286,
4129,
4600,
17497,
62,
82,
12629,
44646,
198,
198,
2,
20559,
2886,
198,
12,
4600,
50,
3712,
4653,
271,
6601,
63,
25,
513,
12,
42895,
4600,
4653,
271,
6601,
63,
329,
13326,
13,
198,
12,
4600,
17497,
62,
82,
12629,
3712,
5317,
63,
25,
7913,
286,
8405,
583,
13326,
4324,
13,
198,
37811,
198,
8818,
10649,
7,
32,
3712,
23839,
38469,
11,
4324,
62,
82,
12629,
3712,
5317,
8,
198,
220,
220,
220,
399,
796,
2546,
7,
32,
11,
16,
8,
198,
220,
220,
220,
611,
399,
4064,
4324,
62,
82,
12629,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
15690,
7,
3447,
1758,
7,
32,
11,
17497,
62,
82,
12629,
11,
45,
6184,
115,
4324,
62,
82,
12629,
4008,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
15690,
7,
3447,
1758,
7,
32,
58,
16,
1058,
399,
532,
399,
4064,
4324,
62,
82,
12629,
4357,
4324,
62,
82,
12629,
11,
399,
6184,
115,
4324,
62,
82,
12629,
4008,
198,
220,
220,
220,
886,
198,
437,
198,
198,
37811,
198,
220,
4886,
7,
55,
11,
19849,
11,
43501,
62,
7857,
26,
25202,
28,
22366,
8,
198,
198,
10987,
38284,
12,
40715,
12,
15255,
3213,
319,
11192,
273,
4600,
55,
63,
287,
37830,
286,
2546,
4600,
43501,
62,
7857,
44646,
198,
198,
2,
20559,
2886,
198,
12,
4600,
55,
3712,
20519,
10267,
63,
25,
34868,
11192,
273,
13,
198,
12,
4600,
19849,
3712,
20519,
10267,
63,
25,
34868,
4600,
4944,
316,
63,
2746,
13,
198,
12,
4600,
43501,
62,
7857,
3712,
5317,
63,
25,
7913,
286,
9168,
583,
13326,
13,
18291,
4035,
1165,
1588,
257,
198,
220,
220,
220,
15458,
2546,
481,
2728,
262,
11362,
284,
1057,
503,
286,
6453,
2390,
13,
198,
198,
2,
7383,
10879,
198,
12,
4600,
25202,
3712,
38176,
90,
20519,
10267,
11,
18465,
92,
63,
25,
9485,
13165,
354,
3335,
532,
11986,
366,
46999,
1,
393,
366,
36166,
1911,
198,
37811,
198,
8818,
4886,
7,
55,
11,
19849,
11,
43501,
62,
7857,
3712,
5317,
26,
25202,
3712,
38176,
90,
20519,
10267,
11,
18465,
92,
28,
22366,
8,
198,
220,
220,
220,
1303,
779,
4277,
3335,
198,
220,
220,
220,
611,
318,
64,
7,
25202,
11,
18465,
8,
198,
220,
220,
220,
220,
220,
220,
220,
3335,
796,
651,
62,
25202,
3419,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
1057,
16277,
287,
37830,
198,
220,
220,
220,
575,
62,
28764,
796,
1976,
27498,
7,
43879,
2624,
11,
1395,
13,
7857,
7,
17,
828,
55,
13,
7857,
7,
15,
4008,
198,
220,
220,
220,
329,
21065,
287,
352,
25,
43501,
62,
7857,
25,
7857,
7,
56,
62,
28764,
11,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
9688,
796,
21065,
198,
220,
220,
220,
220,
220,
220,
220,
1312,
62,
11338,
796,
949,
7,
7857,
7,
56,
62,
28764,
11,
17,
828,
4178,
10,
43501,
62,
7857,
12,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
9288,
796,
651,
7,
55,
11,
72,
62,
9688,
12,
16,
25,
72,
62,
11338,
12,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
62,
9288,
796,
1395,
62,
9288,
13,
1462,
7,
25202,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9078,
4480,
28034,
13,
3919,
62,
9744,
3419,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
503,
796,
2746,
7,
55,
62,
9288,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
575,
62,
28764,
58,
45299,
72,
62,
9688,
25,
72,
62,
11338,
60,
764,
28,
503,
13,
36166,
22446,
16321,
1133,
7,
17,
11,
15,
11,
16,
737,
77,
32152,
3419,
58,
45299,
45299,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
20145,
13,
36484,
7,
9562,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
575,
62,
28764,
198,
437,
198,
198,
37811,
198,
220,
7616,
62,
684,
316,
7,
10641,
69,
310,
11,
294,
3447,
16,
11,
294,
3447,
17,
26,
3509,
62,
11925,
28,
16,
68,
2079,
11,
3509,
62,
11925,
62,
33678,
28,
9562,
8,
198,
198,
9771,
3129,
378,
7616,
319,
290,
572,
1661,
13,
198,
198,
15056,
4600,
400,
3447,
16,
63,
290,
4600,
400,
3447,
17,
63,
15284,
7616,
319,
290,
572,
1661,
422,
198,
22769,
2569,
2163,
13,
198,
198,
2,
20559,
2886,
198,
12,
4600,
10641,
69,
310,
3712,
23839,
19182,
63,
25,
15684,
2569,
2163,
286,
304,
13,
70,
13,
47550,
14,
43,
5603,
7616,
13,
198,
12,
4600,
400,
3447,
16,
3712,
15633,
63,
25,
11052,
2029,
543,
7616,
357,
1659,
16704,
2163,
8,
198,
220,
220,
220,
318,
13906,
357,
46503,
11387,
737,
198,
12,
4600,
400,
3447,
17,
3712,
15633,
63,
25,
11052,
2174,
543,
7616,
357,
1659,
16704,
2163,
8,
198,
220,
220,
220,
318,
390,
33106,
357,
21037,
11387,
737,
198,
198,
2,
7383,
10879,
198,
12,
4600,
9806,
62,
11925,
3712,
5317,
63,
25,
22246,
4129,
286,
13973,
1785,
287,
8405,
13,
317,
649,
198,
220,
220,
220,
1785,
481,
307,
13973,
355,
2582,
355,
262,
6737,
12229,
757,
2029,
294,
3447,
16,
13,
198,
12,
4600,
9806,
62,
11925,
62,
33678,
3712,
33,
970,
63,
25,
2141,
407,
3551,
2995,
2392,
621,
3509,
62,
11925,
656,
989,
2393,
13,
198,
37811,
198,
8818,
7616,
62,
684,
316,
7,
10641,
69,
310,
3712,
23839,
19182,
11,
294,
3447,
16,
3712,
15633,
11,
294,
3447,
17,
3712,
15633,
26,
198,
220,
220,
220,
3509,
62,
11925,
3712,
5317,
28,
940,
61,
940,
11,
3509,
62,
11925,
62,
33678,
3712,
33,
970,
28,
9562,
11,
198,
8,
198,
220,
220,
220,
773,
16,
796,
1064,
439,
7,
10641,
69,
310,
764,
29,
294,
3447,
16,
8,
198,
220,
220,
220,
611,
4129,
7,
521,
16,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
17635,
198,
220,
220,
220,
886,
198,
220,
220,
220,
773,
17,
796,
1064,
439,
7,
10641,
69,
310,
764,
29,
294,
3447,
17,
8,
628,
220,
220,
220,
319,
796,
685,
521,
16,
58,
16,
11907,
198,
220,
220,
220,
572,
796,
25915,
16,
60,
628,
220,
220,
220,
1303,
5004,
262,
36525,
810,
1149,
69,
310,
8953,
2174,
572,
12,
400,
10126,
198,
220,
220,
220,
773,
17,
62,
796,
15690,
90,
33,
970,
92,
7,
917,
891,
11,
13664,
7,
521,
17,
4008,
198,
220,
220,
220,
773,
17,
62,
58,
16,
25,
437,
12,
16,
60,
764,
28,
814,
7,
521,
17,
8,
764,
29,
352,
198,
220,
220,
220,
1303,
938,
1609,
495,
1198,
318,
6825,
416,
814,
11,
751,
340,
14500,
198,
220,
220,
220,
773,
17,
62,
58,
437,
60,
796,
2081,
198,
220,
220,
220,
24443,
0,
7,
2364,
11,
521,
17,
58,
521,
17,
62,
12962,
198,
220,
220,
220,
24443,
0,
7,
261,
11,
521,
16,
58,
19796,
439,
7,
26069,
7,
521,
16,
8,
764,
29,
352,
8,
764,
10,
352,
12962,
198,
220,
220,
220,
1303,
2291,
938,
2298,
611,
7616,
318,
319,
393,
4268,
340,
198,
220,
220,
220,
611,
3509,
62,
11925,
62,
33678,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
4268,
340,
198,
220,
220,
220,
220,
220,
220,
220,
24443,
0,
7,
2364,
11,
9806,
62,
11925,
8,
198,
220,
220,
220,
220,
220,
220,
220,
24443,
0,
7,
261,
11,
261,
58,
437,
12962,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
2291,
340,
198,
220,
220,
220,
220,
220,
220,
220,
24443,
0,
7,
2364,
11,
521,
17,
58,
437,
12962,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2298,
796,
17635,
198,
220,
220,
220,
981,
319,
58,
437,
60,
1875,
572,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
981,
319,
58,
16,
60,
19841,
572,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12233,
265,
0,
7,
261,
11,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
981,
572,
58,
16,
60,
1279,
319,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12233,
265,
0,
7,
2364,
11,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
611,
572,
58,
16,
60,
532,
319,
58,
16,
60,
1875,
3509,
62,
11925,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
3509,
62,
11925,
62,
33678,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12233,
265,
0,
7,
261,
11,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
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,
3143,
437,
0,
7,
2364,
11,
261,
58,
16,
60,
1343,
3509,
62,
11925,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
27729,
17414,
261,
58,
16,
4357,
2364,
58,
16,
11907,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
9943,
7241,
12078,
7,
71,
9246,
7,
27729,
986,
4008,
198,
437,
198,
198,
37811,
198,
220,
651,
62,
79,
3378,
7,
50,
11,
1676,
1443,
11,
400,
3447,
16,
11,
400,
3447,
17,
26,
1084,
62,
2213,
328,
62,
67,
333,
28,
15,
2014,
198,
198,
3855,
11103,
422,
13326,
39522,
4600,
1676,
1443,
63,
422,
1001,
271,
6601,
4600,
50,
44646,
198,
198,
2,
20559,
2886,
198,
12,
4600,
50,
3712,
4653,
271,
6601,
63,
25,
513,
12,
42895,
4600,
4653,
271,
6601,
63,
329,
13326,
13,
198,
12,
4600,
1676,
1443,
3712,
23839,
19182,
63,
25,
15690,
286,
39522,
286,
7108,
13326,
583,
4324,
13,
198,
12,
4600,
400,
3447,
16,
3712,
15633,
63,
25,
30873,
1799,
357,
15,
12,
16,
8,
2029,
543,
7616,
318,
13906,
357,
46503,
11387,
737,
198,
12,
4600,
400,
3447,
17,
3712,
15633,
63,
25,
30873,
1799,
357,
15,
12,
16,
8,
2174,
543,
7616,
318,
390,
33106,
357,
21037,
11387,
737,
198,
198,
2,
7383,
10879,
198,
63,
1084,
62,
2213,
328,
62,
67,
333,
3712,
15633,
63,
25,
26265,
9478,
357,
259,
4201,
8,
286,
7616,
13,
198,
198,
37811,
198,
8818,
651,
62,
79,
3378,
7,
198,
220,
220,
220,
311,
3712,
4653,
271,
6601,
11,
198,
220,
220,
220,
386,
1443,
3712,
23839,
19182,
11,
198,
220,
220,
220,
294,
3447,
16,
3712,
15633,
11,
198,
220,
220,
220,
294,
3447,
17,
3712,
15633,
26,
198,
220,
220,
220,
949,
62,
2213,
328,
62,
67,
333,
3712,
15633,
28,
15,
1539,
198,
8,
198,
220,
220,
220,
2488,
30493,
657,
13,
1279,
294,
3447,
17,
1279,
294,
3447,
16,
19841,
352,
13,
198,
220,
220,
220,
256,
83,
796,
2824,
7,
15,
25,
13664,
7,
1676,
1443,
13219,
16,
8,
24457,
311,
13,
9501,
58,
16,
60,
198,
220,
220,
220,
11103,
796,
15690,
90,
10430,
7575,
92,
7,
917,
891,
11,
15,
8,
198,
220,
220,
220,
5192,
82,
796,
7616,
62,
684,
316,
7,
85,
9246,
7,
1676,
1443,
986,
828,
400,
3447,
16,
11,
400,
3447,
17,
8,
198,
220,
220,
220,
329,
21065,
287,
352,
25,
7857,
7,
2213,
9235,
11,
16,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5192,
82,
58,
4178,
11,
16,
60,
6624,
5192,
82,
58,
4178,
11,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
2198,
7616,
9478,
198,
220,
220,
220,
220,
220,
220,
220,
5192,
62,
67,
333,
796,
256,
83,
58,
2213,
9235,
58,
4178,
11,
17,
11907,
532,
256,
83,
58,
2213,
9235,
58,
4178,
11,
16,
11907,
198,
220,
220,
220,
220,
220,
220,
220,
611,
5192,
62,
67,
333,
1279,
949,
62,
2213,
328,
62,
67,
333,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
2298,
796,
1822,
9806,
7,
1676,
1443,
58,
2213,
9235,
58,
4178,
11,
16,
5974,
2213,
9235,
58,
4178,
11,
17,
11907,
8,
1343,
5192,
82,
58,
4178,
11,
16,
60,
628,
220,
220,
220,
220,
220,
220,
220,
256,
301,
696,
796,
334,
17,
67,
7,
50,
13,
83,
58,
16,
7131,
16,
11,
17,
60,
1635,
352,
68,
12,
21,
10,
256,
83,
58,
27729,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
4574,
0,
7,
79,
3378,
11,
83,
301,
696,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
11103,
11,
256,
83,
198,
437,
198,
198,
37811,
198,
220,
3440,
62,
9288,
62,
7890,
3419,
198,
198,
8912,
513,
12,
42895,
37463,
1366,
422,
262,
1584,
337,
86,
642,
13,
17,
1052,
4496,
11,
3442,
8379,
13,
198,
37811,
198,
8818,
3440,
62,
9288,
62,
7890,
3419,
198,
220,
220,
220,
5360,
16624,
796,
4654,
6978,
7,
15908,
3672,
7,
31,
834,
25664,
834,
27267,
492,
2430,
10378,
82,
2430,
15002,
82,
2430,
24620,
50,
2246,
4943,
198,
220,
220,
220,
1441,
1100,
62,
7890,
7203,
30584,
1600,
30584,
16624,
8,
198,
437,
198
] | 2.350408 | 3,065 |
#=
https://github.com/JuliaArrays/EndpointRanges.jl
by Tim Holy
[this has minor edits for v0.7-DEV]
=#
module EndpointRanges
#using Compat
import Base: +, -, *, /, ÷, %
using Base: ViewIndex, tail, indices1
export ibegin, iend
abstract type Endpoint end
struct IBegin <: Endpoint end
struct IEnd <: Endpoint end
const ibegin = IBegin()
const iend = IEnd()
(::IBegin)(b::Integer, e::Integer) = b
(::IEnd )(b::Integer, e::Integer) = e
(::IBegin)(r::AbstractRange) = first(r)
(::IEnd )(r::AbstractRange) = last(r)
struct IndexFunction{F<:Function} <: Endpoint
index::F
end
(f::IndexFunction)(r::AbstractRange) = f.index(r)
for op in (:+, :-)
@eval $op(x::Endpoint) = IndexFunction(r->x(r))
end
for op in (:+, :-, :*, :/, :÷, :%)
@eval $op(x::Endpoint, y::Endpoint) = IndexFunction(r->$op(x(r), y(r)))
@eval $op(x::Endpoint, y::Number) = IndexFunction(r->$op(x(r), y))
@eval $op(x::Number, y::Endpoint) = IndexFunction(r->$op(x, y(r)))
end
# deliberately not <: AbstractUnitRange{Int}
abstract type EndpointRange{T} end
struct EndpointUnitRange{F<:Union{Int,Endpoint},L<:Union{Int,Endpoint}} <: EndpointRange{Int}
start::F
stop::L
end
struct EndpointStepRange{F<:Union{Int,Endpoint},L<:Union{Int,Endpoint}} <: EndpointRange{Int}
start::F
step::Int
stop::L
end
(r::EndpointUnitRange)(s::AbstractRange) = r.start(s):r.stop(s)
(r::EndpointUnitRange{Int,E})(s::AbstractRange) where {E<:Endpoint} = r.start:r.stop(s)
(r::EndpointUnitRange{E,Int})(s::AbstractRange) where {E<:Endpoint} = r.start(s):r.stop
(r::EndpointStepRange)(s::AbstractRange) = r.start(s):r.step:r.stop(s)
(r::EndpointStepRange{Int,E})(s::AbstractRange) where {E<:Endpoint} = r.start:r.step:r.stop(s)
(r::EndpointStepRange{E,Int})(s::AbstractRange) where {E<:Endpoint} = r.start(s):r.step:r.stop
Base.colon(start::Endpoint, stop::Endpoint) = EndpointUnitRange(start, stop)
Base.colon(start::Endpoint, stop::Int) = EndpointUnitRange(start, stop)
Base.colon(start::Int, stop::Endpoint) = EndpointUnitRange(start, stop)
Base.colon(start::Endpoint, step::Int, stop::Endpoint) = EndpointStepRange(start, step, stop)
Base.colon(start::Endpoint, step::Int, stop::Int) = EndpointStepRange(start, step, stop)
Base.colon(start::Int, step::Int, stop::Endpoint) = EndpointStepRange(start, step, stop)
function Base.getindex(r::UnitRange, s::EndpointRange)
getindex(r, newindex(indices1(r), s))
end
function Base.getindex(r::AbstractUnitRange, s::EndpointRange)
getindex(r, newindex(indices1(r), s))
end
function Base.getindex(r::StepRange, s::EndpointRange)
getindex(r, newindex(indices1(r), s))
end
function Base.getindex(r::StepRangeLen, s::EndpointRange)
getindex(r, newindex(indices1(r), s))
end
function Base.getindex(r::LinRange, s::EndpointRange)
getindex(r, newindex(indices1(r), s))
end
@inline function Base.to_indices(A, inds, I::Tuple{Union{Endpoint, EndpointRange}, Vararg{Any}})
(newindex(inds[1], I[1]), to_indices(A, Base._maybetail(inds), Base.tail(I))...)
end
@inline newindices(indsA, inds) = (newindex(indsA[1], inds[1]), newindices(tail(indsA), tail(inds))...)
newindices(::Tuple{}, ::Tuple{}) = ()
newindex(indA, i::Union{Real, AbstractArray, Colon}) = i
newindex(indA, i::EndpointRange) = i(indA)
newindex(indA, i::IBegin) = first(indA)
newindex(indA, i::IEnd) = last(indA)
end # module
| [
2,
28,
198,
220,
220,
220,
3740,
1378,
12567,
13,
785,
14,
16980,
544,
3163,
20477,
14,
12915,
4122,
49,
6231,
13,
20362,
198,
220,
220,
220,
416,
5045,
7439,
198,
220,
220,
220,
685,
5661,
468,
4159,
31671,
329,
410,
15,
13,
22,
12,
39345,
60,
198,
46249,
198,
198,
21412,
5268,
4122,
49,
6231,
198,
198,
2,
3500,
3082,
265,
198,
198,
11748,
7308,
25,
1343,
11,
532,
11,
1635,
11,
1220,
11,
6184,
115,
11,
4064,
198,
3500,
7308,
25,
3582,
15732,
11,
7894,
11,
36525,
16,
198,
198,
39344,
24283,
1533,
259,
11,
1312,
437,
198,
198,
397,
8709,
2099,
5268,
4122,
886,
198,
7249,
314,
44140,
1279,
25,
5268,
4122,
886,
198,
7249,
314,
12915,
220,
220,
1279,
25,
5268,
4122,
886,
198,
9979,
24283,
1533,
259,
796,
314,
44140,
3419,
198,
9979,
1312,
437,
220,
220,
796,
314,
12915,
3419,
198,
198,
7,
3712,
9865,
1533,
259,
5769,
65,
3712,
46541,
11,
304,
3712,
46541,
8,
796,
275,
198,
7,
3712,
10008,
358,
220,
1267,
7,
65,
3712,
46541,
11,
304,
3712,
46541,
8,
796,
304,
198,
7,
3712,
9865,
1533,
259,
5769,
81,
3712,
23839,
17257,
8,
796,
717,
7,
81,
8,
198,
7,
3712,
10008,
358,
220,
1267,
7,
81,
3712,
23839,
17257,
8,
796,
938,
7,
81,
8,
198,
198,
7249,
12901,
22203,
90,
37,
27,
25,
22203,
92,
1279,
25,
5268,
4122,
198,
220,
220,
220,
6376,
3712,
37,
198,
437,
198,
7,
69,
3712,
15732,
22203,
5769,
81,
3712,
23839,
17257,
8,
796,
277,
13,
9630,
7,
81,
8,
198,
198,
1640,
1034,
287,
357,
25,
28200,
47226,
198,
220,
220,
220,
2488,
18206,
720,
404,
7,
87,
3712,
12915,
4122,
8,
796,
12901,
22203,
7,
81,
3784,
87,
7,
81,
4008,
198,
437,
198,
1640,
1034,
287,
357,
25,
28200,
1058,
20995,
1058,
25666,
1058,
47454,
1058,
127,
115,
11,
1058,
4407,
198,
220,
220,
220,
2488,
18206,
720,
404,
7,
87,
3712,
12915,
4122,
11,
331,
3712,
12915,
4122,
8,
796,
12901,
22203,
7,
81,
3784,
3,
404,
7,
87,
7,
81,
828,
331,
7,
81,
22305,
198,
220,
220,
220,
2488,
18206,
720,
404,
7,
87,
3712,
12915,
4122,
11,
331,
3712,
15057,
8,
796,
12901,
22203,
7,
81,
3784,
3,
404,
7,
87,
7,
81,
828,
331,
4008,
198,
220,
220,
220,
2488,
18206,
720,
404,
7,
87,
3712,
15057,
11,
331,
3712,
12915,
4122,
8,
796,
12901,
22203,
7,
81,
3784,
3,
404,
7,
87,
11,
331,
7,
81,
22305,
198,
437,
198,
198,
2,
14593,
407,
1279,
25,
27741,
26453,
17257,
90,
5317,
92,
198,
397,
8709,
2099,
5268,
4122,
17257,
90,
51,
92,
886,
198,
7249,
5268,
4122,
26453,
17257,
90,
37,
27,
25,
38176,
90,
5317,
11,
12915,
4122,
5512,
43,
27,
25,
38176,
90,
5317,
11,
12915,
4122,
11709,
1279,
25,
5268,
4122,
17257,
90,
5317,
92,
198,
220,
220,
220,
923,
3712,
37,
198,
220,
220,
220,
2245,
3712,
43,
198,
437,
198,
7249,
5268,
4122,
8600,
17257,
90,
37,
27,
25,
38176,
90,
5317,
11,
12915,
4122,
5512,
43,
27,
25,
38176,
90,
5317,
11,
12915,
4122,
11709,
1279,
25,
5268,
4122,
17257,
90,
5317,
92,
198,
220,
220,
220,
923,
3712,
37,
198,
220,
220,
220,
2239,
3712,
5317,
198,
220,
220,
220,
2245,
3712,
43,
198,
437,
198,
198,
7,
81,
3712,
12915,
4122,
26453,
17257,
5769,
82,
3712,
23839,
17257,
8,
796,
374,
13,
9688,
7,
82,
2599,
81,
13,
11338,
7,
82,
8,
198,
7,
81,
3712,
12915,
4122,
26453,
17257,
90,
5317,
11,
36,
92,
5769,
82,
3712,
23839,
17257,
8,
810,
1391,
36,
27,
25,
12915,
4122,
92,
796,
374,
13,
9688,
25,
81,
13,
11338,
7,
82,
8,
198,
7,
81,
3712,
12915,
4122,
26453,
17257,
90,
36,
11,
5317,
92,
5769,
82,
3712,
23839,
17257,
8,
810,
1391,
36,
27,
25,
12915,
4122,
92,
796,
374,
13,
9688,
7,
82,
2599,
81,
13,
11338,
198,
198,
7,
81,
3712,
12915,
4122,
8600,
17257,
5769,
82,
3712,
23839,
17257,
8,
796,
374,
13,
9688,
7,
82,
2599,
81,
13,
9662,
25,
81,
13,
11338,
7,
82,
8,
198,
7,
81,
3712,
12915,
4122,
8600,
17257,
90,
5317,
11,
36,
92,
5769,
82,
3712,
23839,
17257,
8,
810,
1391,
36,
27,
25,
12915,
4122,
92,
796,
374,
13,
9688,
25,
81,
13,
9662,
25,
81,
13,
11338,
7,
82,
8,
198,
7,
81,
3712,
12915,
4122,
8600,
17257,
90,
36,
11,
5317,
92,
5769,
82,
3712,
23839,
17257,
8,
810,
1391,
36,
27,
25,
12915,
4122,
92,
796,
374,
13,
9688,
7,
82,
2599,
81,
13,
9662,
25,
81,
13,
11338,
198,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
12915,
4122,
11,
2245,
3712,
12915,
4122,
8,
796,
5268,
4122,
26453,
17257,
7,
9688,
11,
2245,
8,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
12915,
4122,
11,
2245,
3712,
5317,
8,
796,
5268,
4122,
26453,
17257,
7,
9688,
11,
2245,
8,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
5317,
11,
2245,
3712,
12915,
4122,
8,
796,
5268,
4122,
26453,
17257,
7,
9688,
11,
2245,
8,
198,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
12915,
4122,
11,
2239,
3712,
5317,
11,
2245,
3712,
12915,
4122,
8,
796,
5268,
4122,
8600,
17257,
7,
9688,
11,
2239,
11,
2245,
8,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
12915,
4122,
11,
2239,
3712,
5317,
11,
2245,
3712,
5317,
8,
796,
5268,
4122,
8600,
17257,
7,
9688,
11,
2239,
11,
2245,
8,
198,
14881,
13,
4033,
261,
7,
9688,
3712,
5317,
11,
2239,
3712,
5317,
11,
2245,
3712,
12915,
4122,
8,
796,
5268,
4122,
8600,
17257,
7,
9688,
11,
2239,
11,
2245,
8,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
81,
3712,
26453,
17257,
11,
264,
3712,
12915,
4122,
17257,
8,
198,
220,
220,
220,
651,
9630,
7,
81,
11,
649,
9630,
7,
521,
1063,
16,
7,
81,
828,
264,
4008,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
81,
3712,
23839,
26453,
17257,
11,
264,
3712,
12915,
4122,
17257,
8,
198,
220,
220,
220,
651,
9630,
7,
81,
11,
649,
9630,
7,
521,
1063,
16,
7,
81,
828,
264,
4008,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
81,
3712,
8600,
17257,
11,
264,
3712,
12915,
4122,
17257,
8,
198,
220,
220,
220,
651,
9630,
7,
81,
11,
649,
9630,
7,
521,
1063,
16,
7,
81,
828,
264,
4008,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
81,
3712,
8600,
17257,
30659,
11,
264,
3712,
12915,
4122,
17257,
8,
198,
220,
220,
220,
651,
9630,
7,
81,
11,
649,
9630,
7,
521,
1063,
16,
7,
81,
828,
264,
4008,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
81,
3712,
14993,
17257,
11,
264,
3712,
12915,
4122,
17257,
8,
198,
220,
220,
220,
651,
9630,
7,
81,
11,
649,
9630,
7,
521,
1063,
16,
7,
81,
828,
264,
4008,
198,
437,
628,
198,
31,
45145,
2163,
7308,
13,
1462,
62,
521,
1063,
7,
32,
11,
773,
82,
11,
314,
3712,
51,
29291,
90,
38176,
90,
12915,
4122,
11,
5268,
4122,
17257,
5512,
12372,
853,
90,
7149,
11709,
8,
198,
220,
220,
220,
357,
3605,
9630,
7,
521,
82,
58,
16,
4357,
314,
58,
16,
46570,
284,
62,
521,
1063,
7,
32,
11,
7308,
13557,
11261,
11181,
603,
7,
521,
82,
828,
7308,
13,
13199,
7,
40,
4008,
23029,
198,
437,
198,
198,
31,
45145,
649,
521,
1063,
7,
521,
82,
32,
11,
773,
82,
8,
796,
357,
3605,
9630,
7,
521,
82,
32,
58,
16,
4357,
773,
82,
58,
16,
46570,
649,
521,
1063,
7,
13199,
7,
521,
82,
32,
828,
7894,
7,
521,
82,
4008,
23029,
198,
3605,
521,
1063,
7,
3712,
51,
29291,
90,
5512,
7904,
51,
29291,
90,
30072,
796,
7499,
198,
198,
3605,
9630,
7,
521,
32,
11,
1312,
3712,
38176,
90,
15633,
11,
27741,
19182,
11,
14049,
30072,
796,
1312,
198,
3605,
9630,
7,
521,
32,
11,
1312,
3712,
12915,
4122,
17257,
8,
796,
1312,
7,
521,
32,
8,
198,
3605,
9630,
7,
521,
32,
11,
1312,
3712,
9865,
1533,
259,
8,
796,
717,
7,
521,
32,
8,
198,
3605,
9630,
7,
521,
32,
11,
1312,
3712,
10008,
358,
8,
220,
220,
796,
938,
7,
521,
32,
8,
198,
198,
437,
1303,
8265,
198
] | 2.446221 | 1,376 |
lines = readlines("input.txt")
re = r"(\w+)"
function main()
#=
Solve using frequency analysis (i.e.: for digits 0 to 9, we see segment 'a' 8 times)
For 1: we need c and f, i.e. 8 + 9 = 17. for 7, a + c + f = 8 + 8 + 9 = 25
This works, because the distribution for the number of times each segment lights
up for digits 0 to 9 is unique
=#
segmentmap = Dict(
0 => collect("abcefg"),
1 => collect("cf"),
2 => collect("acdeg"),
3 => collect("acdfg"),
4 => collect("bcdf"),
5 => collect("abdfg"),
6 => collect("abdefg"),
7 => collect("acf"),
8 => collect("abcdefg"),
9 => collect("abcdfg")
)
freq = X -> Dict([(x, count(==(x), X)) for x = unique(X)])
X = freq(reduce(vcat, values(segmentmap)))
numbers = Dict([(i,sum([X[c] for c = set])) for (i,set) = pairs(segmentmap)])
inverse = Dict(value => key for (key, value) = numbers)
sumdigits = N -> sum(n * 10^e for (n,e) = zip(N, length(N)-1:-1:0))
Σ = 0
for line = lines
input, output = split(line, '|')
signals = [m.match for m = eachmatch(re, input)]
X = freq(reduce(vcat, collect.(signals)))
Y = [m.match for m = eachmatch(re, output)]
Σ_Y = map(s -> sum([X[c] for c = collect(s)]), Y)
N = map(n -> inverse[n], Σ_Y)
Σ += sumdigits(N)
println(sumdigits(N))
end
println("====")
println(Σ)
end
main()
| [
6615,
796,
1100,
6615,
7203,
15414,
13,
14116,
4943,
198,
260,
796,
374,
18109,
59,
86,
10,
16725,
198,
198,
8818,
1388,
3419,
198,
220,
220,
220,
1303,
28,
198,
220,
220,
220,
4294,
303,
1262,
8373,
3781,
357,
72,
13,
68,
11207,
329,
19561,
657,
284,
860,
11,
356,
766,
10618,
705,
64,
6,
807,
1661,
8,
198,
220,
220,
220,
1114,
352,
25,
356,
761,
269,
290,
277,
11,
1312,
13,
68,
13,
807,
1343,
860,
796,
1596,
13,
329,
767,
11,
257,
1343,
269,
1343,
277,
796,
807,
1343,
807,
1343,
860,
796,
1679,
198,
220,
220,
220,
770,
2499,
11,
780,
262,
6082,
329,
262,
1271,
286,
1661,
1123,
10618,
7588,
198,
220,
220,
220,
510,
329,
19561,
657,
284,
860,
318,
3748,
198,
220,
220,
220,
796,
2,
198,
220,
220,
220,
10618,
8899,
796,
360,
713,
7,
198,
220,
220,
220,
220,
220,
220,
220,
657,
5218,
2824,
7203,
397,
344,
40616,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
352,
5218,
2824,
7203,
12993,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
362,
5218,
2824,
7203,
330,
13500,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
513,
5218,
2824,
7203,
330,
7568,
70,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
604,
5218,
2824,
7203,
15630,
7568,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
642,
5218,
2824,
7203,
397,
7568,
70,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
718,
5218,
2824,
7203,
397,
4299,
70,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
767,
5218,
2824,
7203,
330,
69,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
807,
5218,
2824,
7203,
39305,
4299,
70,
12340,
198,
220,
220,
220,
220,
220,
220,
220,
860,
5218,
2824,
7203,
39305,
7568,
70,
4943,
198,
220,
220,
220,
1267,
198,
220,
220,
220,
2030,
80,
796,
1395,
4613,
360,
713,
26933,
7,
87,
11,
954,
7,
855,
7,
87,
828,
1395,
4008,
329,
2124,
796,
3748,
7,
55,
8,
12962,
198,
220,
220,
220,
1395,
796,
2030,
80,
7,
445,
7234,
7,
85,
9246,
11,
3815,
7,
325,
5154,
8899,
22305,
198,
220,
220,
220,
3146,
796,
360,
713,
26933,
7,
72,
11,
16345,
26933,
55,
58,
66,
60,
329,
269,
796,
900,
60,
4008,
329,
357,
72,
11,
2617,
8,
796,
14729,
7,
325,
5154,
8899,
8,
12962,
198,
220,
220,
220,
34062,
796,
360,
713,
7,
8367,
5218,
1994,
329,
357,
2539,
11,
1988,
8,
796,
3146,
8,
198,
220,
220,
220,
2160,
12894,
896,
796,
399,
4613,
2160,
7,
77,
1635,
838,
61,
68,
329,
357,
77,
11,
68,
8,
796,
19974,
7,
45,
11,
4129,
7,
45,
13219,
16,
21912,
16,
25,
15,
4008,
198,
220,
220,
220,
220,
198,
220,
220,
220,
7377,
96,
796,
657,
198,
220,
220,
220,
329,
1627,
796,
3951,
198,
220,
220,
220,
220,
220,
220,
220,
5128,
11,
5072,
796,
6626,
7,
1370,
11,
705,
91,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
10425,
796,
685,
76,
13,
15699,
329,
285,
796,
1123,
15699,
7,
260,
11,
5128,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
796,
2030,
80,
7,
445,
7234,
7,
85,
9246,
11,
2824,
12195,
12683,
874,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
575,
796,
685,
76,
13,
15699,
329,
285,
796,
1123,
15699,
7,
260,
11,
5072,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
7377,
96,
62,
56,
796,
3975,
7,
82,
4613,
2160,
26933,
55,
58,
66,
60,
329,
269,
796,
2824,
7,
82,
15437,
828,
575,
8,
198,
220,
220,
220,
220,
220,
220,
220,
399,
796,
3975,
7,
77,
4613,
34062,
58,
77,
4357,
7377,
96,
62,
56,
8,
198,
220,
220,
220,
220,
220,
220,
220,
7377,
96,
15853,
2160,
12894,
896,
7,
45,
8,
198,
220,
220,
220,
220,
220,
220,
220,
44872,
7,
16345,
12894,
896,
7,
45,
4008,
198,
220,
220,
220,
886,
198,
220,
220,
220,
44872,
7203,
1421,
4943,
198,
220,
220,
220,
44872,
7,
138,
96,
8,
198,
437,
198,
198,
12417,
3419,
198
] | 2.153959 | 682 |
########################################################################################################
## Details
# This file implements the MAP estimation proceedure for UQ inference problems.
# Note, we convert the named tuple p.x into a vector for use in GalacticOptim.
# For the conversion, we use TransformVariables.
#########################################################################################################
function MAP(p :: ArbitraryDistribution{T}) where T<: AbstractFloat
# Setup optimization utilities
trans, x0 = namedtp_to_vec(p.x)
f = distribution_wrapper(p, trans)
params = p.p
# Define problem
g = OptimizationFunction(f, GalacticOptim.AutoForwardDiff())
prob = OptimizationProblem(g, x0, p.p)
# Solve
sol = solve(prob, BFGS())
# return solution
xf = sol.u
p.x = transform(trans, xf)
return p
end | [
29113,
29113,
29113,
7804,
198,
2235,
14890,
198,
2,
770,
2393,
23986,
262,
34645,
31850,
5120,
495,
329,
471,
48,
32278,
2761,
13,
198,
2,
220,
220,
220,
220,
220,
220,
5740,
11,
356,
10385,
262,
3706,
46545,
279,
13,
87,
656,
257,
15879,
329,
779,
287,
23509,
27871,
320,
13,
198,
2,
220,
220,
220,
220,
220,
220,
1114,
262,
11315,
11,
356,
779,
26981,
23907,
2977,
13,
198,
29113,
29113,
29113,
7804,
2,
198,
198,
8818,
34645,
7,
79,
7904,
33619,
11619,
20344,
3890,
90,
51,
30072,
810,
309,
27,
25,
27741,
43879,
628,
220,
220,
220,
1303,
31122,
23989,
20081,
198,
220,
220,
220,
1007,
11,
2124,
15,
796,
3706,
34788,
62,
1462,
62,
35138,
7,
79,
13,
87,
8,
198,
220,
220,
220,
277,
796,
6082,
62,
48553,
7,
79,
11,
1007,
8,
198,
220,
220,
220,
42287,
796,
279,
13,
79,
220,
628,
220,
220,
220,
1303,
2896,
500,
1917,
198,
220,
220,
220,
308,
796,
30011,
1634,
22203,
7,
69,
11,
23509,
27871,
320,
13,
27722,
39746,
28813,
28955,
198,
220,
220,
220,
1861,
796,
30011,
1634,
40781,
7,
70,
11,
2124,
15,
11,
279,
13,
79,
8,
628,
220,
220,
220,
1303,
4294,
303,
198,
220,
220,
220,
1540,
796,
8494,
7,
1676,
65,
11,
41646,
14313,
28955,
628,
220,
220,
220,
1303,
1441,
4610,
198,
220,
220,
220,
2124,
69,
796,
1540,
13,
84,
220,
198,
220,
220,
220,
279,
13,
87,
796,
6121,
7,
7645,
11,
2124,
69,
8,
198,
220,
220,
220,
1441,
279,
198,
198,
437
] | 3.501946 | 257 |
################################################################################
#
# Parent
#
################################################################################
parent(a::AlgAssElem) = a.parent
################################################################################
#
# Special elements
#
################################################################################
zero(A::AlgAss) = A()
one(A::AlgAss) = A(A.one)
################################################################################
#
# Unary operations
#
################################################################################
function -(a::AlgAssElem{T}) where {T}
coeffs = [ -a.coeffs[i] for i = 1:dim(parent(a)) ]
return AlgAssElem{T}(parent(a), coeffs)
end
################################################################################
#
# Binary operations
#
################################################################################
function +(a::AlgAssElem{T}, b::AlgAssElem{T}) where {T}
parent(a) != parent(b) && error("Parents don't match.")
coeffs = Array{T, 1}(dim(parent(a)))
for i = 1:dim(parent(a))
coeffs[i] = a.coeffs[i] + b.coeffs[i]
end
return AlgAssElem{T}(parent(a), coeffs)
end
function -(a::AlgAssElem{T}, b::AlgAssElem{T}) where {T}
parent(a) != parent(b) && error("Parents don't match.")
coeffs = Array{T, 1}(dim(parent(a)))
for i = 1:dim(parent(a))
coeffs[i] = a.coeffs[i] - b.coeffs[i]
end
return AlgAssElem{T}(parent(a), coeffs)
end
function *(a::AlgAssElem{T}, b::AlgAssElem{T}) where {T}
parent(a) != parent(b) && error("Parents don't match.")
A = parent(a)
n = dim(A)
c = A()
t = base_ring(A)()
for i = 1:n
if iszero(a.coeffs[i])
continue
end
for j = 1:n
t = a.coeffs[i]*b.coeffs[j]
if iszero(t)
continue
end
for k = 1:n
c.coeffs[k] += A.mult_table[i, j, k]*t
end
end
end
return c
end
function mul!(c::AlgAssElem{T}, a::AlgAssElem{T}, b::AlgAssElem{T}) where {T}
A = parent(a)
n = dim(A)
t = base_ring(A)()
s = base_ring(A)()
if c === a || c === b
z = parent(a)()
mul!(z, a, b)
return z
end
for k in 1:n
c.coeffs[k] = zero!(c.coeffs[k])
end
for i = 1:n
if iszero(a.coeffs[i])
continue
end
for j = 1:n
t = a.coeffs[i]*b.coeffs[j]
if iszero(t)
continue
end
for k = 1:n
s = mul!(s, A.mult_table[i, j, k], t)
c.coeffs[k] = add!(c.coeffs[k], c.coeffs[k], s)
#c.coeffs[k] += A.mult_table[i, j, k]*t
end
end
end
#@assert c == a * b
return c
end
################################################################################
#
# Ad hoc operations
#
################################################################################
function *(a::AlgAssElem{T}, b::T) where { T <: RingElem }
return AlgAssElem{T}(parent(a), a.coeffs.*b)
end
*(b::T, a::AlgAssElem{T}) where { T <: RingElem } = a*b
*(a::AlgAssElem{T}, b::Union{Integer, fmpz}) where {T} = a*base_ring(parent(a))(b)
*(b::Union{Integer, fmpz}, a::AlgAssElem{T}) where {T} = a*b
dot(a::AlgAssElem{T}, b::T) where {T} = a*b
dot(b::T, a::AlgAssElem{T}) where {T} = b*a
dot(a::AlgAssElem{T}, b::Union{Integer, fmpz}) where {T} = a*b
dot(b::Union{Integer, fmpz}, a::AlgAssElem{T}) where {T} = b*a
################################################################################
#
# Exponentiation
#
################################################################################
function ^(a::AlgAssElem, b::Int)
if b == 0
return one(parent(a))
elseif b == 1
return deepcopy(a)
else
if b < 0
error("Not implemented yet")
#a = inv(a)
#b = -b
end
bit = ~((~UInt(0)) >> 1)
while (UInt(bit) & b) == 0
bit >>= 1
end
z = deepcopy(a)
bit >>= 1
while bit != 0
z = mul!(z, z, z)
if (UInt(bit) & b) != 0
z = mul!(z, z, a)
end
bit >>= 1
end
return z
end
end
function ^(a::AlgAssElem, b::fmpz)
if nbits(b) < 64
return a^Int(b)
end
if b < 0
error("Not implemented yet")
elseif b == 0
return one(parent(a))
elseif b == 1
return deepcopy(a)
elseif mod(b, 2) == 0
c = a^(div(b, 2))
return c*c
elseif mod(b, 2) == 1
return a^(b - 1)*a
end
end
################################################################################
#
# Parent object overloading
#
################################################################################
(A::AlgAss{T})() where {T} = AlgAssElem{T}(A)
function (A::AlgAss{T})(c::Array{T, 1}) where {T}
length(c) != dim(A) && error("Dimensions don't match.")
return AlgAssElem{T}(A, c)
end
function Base.getindex(A::AlgAss{T}, i::Int) where {T}
(i < 1 || i > dim(A)) && error("Index must be in range $(1:dim(A))")
n = dim(A)
v = Vector{T}(n)
for j in 1:n
v[j] = zero(base_ring(A))
end
v[i] = one(base_ring(A))
return A(v)
end
################################################################################
#
# String I/O
#
################################################################################
function show(io::IO, a::AlgAssElem)
print(io, "Element of ")
print(io, parent(a))
print(io, " with coefficients ")
print(io, a.coeffs)
end
################################################################################
#
# Deepcopy
#
################################################################################
function Base.deepcopy_internal(a::AlgAssElem{T}, dict::ObjectIdDict) where {T}
b = parent(a)()
for x in fieldnames(a)
if x != :parent && isdefined(a, x)
setfield!(b, x, Base.deepcopy_internal(getfield(a, x), dict))
end
end
return b
end
################################################################################
#
# Equality
#
################################################################################
function ==(a::AlgAssElem{T}, b::AlgAssElem{T}) where {T}
parent(a) != parent(b) && return false
return a.coeffs == b.coeffs
end
################################################################################
#
# Minpoly
#
################################################################################
function Generic.minpoly(a::AlgAssElem)
M = representation_matrix(a)
R = PolynomialRing(base_ring(parent(a)), "x", cached=false)[1]
return minpoly(R, M)
end
################################################################################
#
# Representation matrix
#
################################################################################
function elem_to_mat_row!(M::MatElem{T}, i::Int, a::AlgAssElem{T}) where T
for c = 1:cols(M)
M[i, c] = deepcopy(a.coeffs[c])
end
return nothing
end
function elem_from_mat_row(A::AlgAss{T}, M::MatElem{T}, i::Int) where T
a = A()
for c = 1:cols(M)
a.coeffs[c] = deepcopy(M[i, c])
end
return a
end
function representation_matrix(a::AlgAssElem, action::Symbol=:left)
A = parent(a)
M = zero_matrix(base_ring(A), dim(A), dim(A))
if action==:left
for i = 1:dim(A)
if iszero(a.coeffs[i])
continue
end
for j = 1:dim(A)
for k = 1:dim(A)
M[j, k] += a.coeffs[i]*A.mult_table[i, j, k]
end
end
end
elseif action==:right
for i = 1:dim(A)
if iszero(a.coeffs[i])
continue
end
for j = 1:dim(A)
for k = 1:dim(A)
M[j, k] += a.coeffs[i]*A.mult_table[j, i, k]
end
end
end
else
error("Not yet implemented")
end
return M
end
################################################################################
#
# isone/iszero
#
################################################################################
isone(a::AlgAssElem) = a == one(parent(a))
iszero(a::AlgAssElem) = all(i -> i == 0, a.coeffs)
| [
29113,
29113,
14468,
198,
2,
198,
2,
220,
16774,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8000,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
8,
796,
257,
13,
8000,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
6093,
4847,
198,
2,
198,
29113,
29113,
14468,
198,
198,
22570,
7,
32,
3712,
2348,
70,
8021,
8,
796,
317,
3419,
198,
198,
505,
7,
32,
3712,
2348,
70,
8021,
8,
796,
317,
7,
32,
13,
505,
8,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
791,
560,
4560,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
532,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
763,
14822,
82,
796,
685,
532,
64,
13,
1073,
14822,
82,
58,
72,
60,
329,
1312,
796,
352,
25,
27740,
7,
8000,
7,
64,
4008,
2361,
198,
220,
1441,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
8000,
7,
64,
828,
763,
14822,
82,
8,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
45755,
4560,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
1343,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
2560,
7,
64,
8,
14512,
2560,
7,
65,
8,
11405,
4049,
7203,
42969,
836,
470,
2872,
19570,
198,
220,
763,
14822,
82,
796,
15690,
90,
51,
11,
352,
92,
7,
27740,
7,
8000,
7,
64,
22305,
198,
220,
329,
1312,
796,
352,
25,
27740,
7,
8000,
7,
64,
4008,
198,
220,
220,
220,
763,
14822,
82,
58,
72,
60,
796,
257,
13,
1073,
14822,
82,
58,
72,
60,
1343,
275,
13,
1073,
14822,
82,
58,
72,
60,
198,
220,
886,
198,
220,
1441,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
8000,
7,
64,
828,
763,
14822,
82,
8,
198,
437,
198,
198,
8818,
532,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
2560,
7,
64,
8,
14512,
2560,
7,
65,
8,
11405,
4049,
7203,
42969,
836,
470,
2872,
19570,
198,
220,
763,
14822,
82,
796,
15690,
90,
51,
11,
352,
92,
7,
27740,
7,
8000,
7,
64,
22305,
198,
220,
329,
1312,
796,
352,
25,
27740,
7,
8000,
7,
64,
4008,
198,
220,
220,
220,
763,
14822,
82,
58,
72,
60,
796,
257,
13,
1073,
14822,
82,
58,
72,
60,
532,
275,
13,
1073,
14822,
82,
58,
72,
60,
198,
220,
886,
198,
220,
1441,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
8000,
7,
64,
828,
763,
14822,
82,
8,
198,
437,
198,
198,
8818,
1635,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
2560,
7,
64,
8,
14512,
2560,
7,
65,
8,
11405,
4049,
7203,
42969,
836,
470,
2872,
19570,
628,
220,
317,
796,
2560,
7,
64,
8,
198,
220,
299,
796,
5391,
7,
32,
8,
198,
220,
269,
796,
317,
3419,
198,
220,
256,
796,
2779,
62,
1806,
7,
32,
8,
3419,
198,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
611,
318,
22570,
7,
64,
13,
1073,
14822,
82,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
886,
198,
220,
220,
220,
329,
474,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
256,
796,
257,
13,
1073,
14822,
82,
58,
72,
60,
9,
65,
13,
1073,
14822,
82,
58,
73,
60,
198,
220,
220,
220,
220,
220,
611,
318,
22570,
7,
83,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
269,
13,
1073,
14822,
82,
58,
74,
60,
15853,
317,
13,
16680,
62,
11487,
58,
72,
11,
474,
11,
479,
60,
9,
83,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
1441,
269,
198,
437,
198,
198,
8818,
35971,
0,
7,
66,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
317,
796,
2560,
7,
64,
8,
198,
220,
299,
796,
5391,
7,
32,
8,
198,
220,
256,
796,
2779,
62,
1806,
7,
32,
8,
3419,
198,
220,
264,
796,
2779,
62,
1806,
7,
32,
8,
3419,
628,
220,
611,
269,
24844,
257,
8614,
269,
24844,
275,
198,
220,
220,
220,
1976,
796,
2560,
7,
64,
8,
3419,
198,
220,
220,
220,
35971,
0,
7,
89,
11,
257,
11,
275,
8,
198,
220,
220,
220,
1441,
1976,
198,
220,
886,
628,
220,
329,
479,
287,
352,
25,
77,
198,
220,
220,
220,
269,
13,
1073,
14822,
82,
58,
74,
60,
796,
6632,
0,
7,
66,
13,
1073,
14822,
82,
58,
74,
12962,
198,
220,
886,
628,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
611,
318,
22570,
7,
64,
13,
1073,
14822,
82,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
886,
198,
220,
220,
220,
329,
474,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
256,
796,
257,
13,
1073,
14822,
82,
58,
72,
60,
9,
65,
13,
1073,
14822,
82,
58,
73,
60,
198,
220,
220,
220,
220,
220,
611,
318,
22570,
7,
83,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
35971,
0,
7,
82,
11,
317,
13,
16680,
62,
11487,
58,
72,
11,
474,
11,
479,
4357,
256,
8,
198,
220,
220,
220,
220,
220,
220,
220,
269,
13,
1073,
14822,
82,
58,
74,
60,
796,
751,
0,
7,
66,
13,
1073,
14822,
82,
58,
74,
4357,
269,
13,
1073,
14822,
82,
58,
74,
4357,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
66,
13,
1073,
14822,
82,
58,
74,
60,
15853,
317,
13,
16680,
62,
11487,
58,
72,
11,
474,
11,
479,
60,
9,
83,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
1303,
31,
30493,
269,
6624,
257,
1635,
275,
198,
220,
1441,
269,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
1215,
39158,
4560,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
1635,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
51,
8,
810,
1391,
309,
1279,
25,
12569,
36,
10671,
1782,
198,
220,
1441,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
8000,
7,
64,
828,
257,
13,
1073,
14822,
82,
15885,
65,
8,
198,
437,
198,
198,
9,
7,
65,
3712,
51,
11,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
309,
1279,
25,
12569,
36,
10671,
1782,
796,
257,
9,
65,
198,
198,
9,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
38176,
90,
46541,
11,
277,
3149,
89,
30072,
810,
1391,
51,
92,
796,
257,
9,
8692,
62,
1806,
7,
8000,
7,
64,
4008,
7,
65,
8,
198,
198,
9,
7,
65,
3712,
38176,
90,
46541,
11,
277,
3149,
89,
5512,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
796,
257,
9,
65,
198,
198,
26518,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
51,
8,
810,
1391,
51,
92,
796,
257,
9,
65,
198,
198,
26518,
7,
65,
3712,
51,
11,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
796,
275,
9,
64,
198,
198,
26518,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
38176,
90,
46541,
11,
277,
3149,
89,
30072,
810,
1391,
51,
92,
796,
257,
9,
65,
198,
198,
26518,
7,
65,
3712,
38176,
90,
46541,
11,
277,
3149,
89,
5512,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
796,
275,
9,
64,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
5518,
3471,
3920,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
10563,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
11,
275,
3712,
5317,
8,
198,
220,
611,
275,
6624,
657,
198,
220,
220,
220,
1441,
530,
7,
8000,
7,
64,
4008,
198,
220,
2073,
361,
275,
6624,
352,
198,
220,
220,
220,
1441,
2769,
30073,
7,
64,
8,
198,
220,
2073,
198,
220,
220,
220,
611,
275,
1279,
657,
198,
220,
220,
220,
220,
220,
4049,
7203,
3673,
9177,
1865,
4943,
198,
220,
220,
220,
220,
220,
1303,
64,
796,
800,
7,
64,
8,
198,
220,
220,
220,
220,
220,
1303,
65,
796,
532,
65,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1643,
796,
5299,
19510,
93,
52,
5317,
7,
15,
4008,
9609,
352,
8,
198,
220,
220,
220,
981,
357,
52,
5317,
7,
2545,
8,
1222,
275,
8,
6624,
657,
198,
220,
220,
220,
220,
220,
1643,
9609,
28,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1976,
796,
2769,
30073,
7,
64,
8,
198,
220,
220,
220,
1643,
9609,
28,
352,
198,
220,
220,
220,
981,
1643,
14512,
657,
198,
220,
220,
220,
220,
220,
1976,
796,
35971,
0,
7,
89,
11,
1976,
11,
1976,
8,
198,
220,
220,
220,
220,
220,
611,
357,
52,
5317,
7,
2545,
8,
1222,
275,
8,
14512,
657,
198,
220,
220,
220,
220,
220,
220,
220,
1976,
796,
35971,
0,
7,
89,
11,
1976,
11,
257,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
1643,
9609,
28,
352,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
1976,
198,
220,
886,
198,
437,
198,
198,
8818,
10563,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
11,
275,
3712,
69,
3149,
89,
8,
198,
220,
611,
299,
9895,
7,
65,
8,
1279,
5598,
198,
220,
220,
220,
1441,
257,
61,
5317,
7,
65,
8,
198,
220,
886,
198,
220,
611,
275,
1279,
657,
198,
220,
220,
220,
4049,
7203,
3673,
9177,
1865,
4943,
198,
220,
2073,
361,
275,
6624,
657,
198,
220,
220,
220,
1441,
530,
7,
8000,
7,
64,
4008,
198,
220,
2073,
361,
275,
6624,
352,
198,
220,
220,
220,
1441,
2769,
30073,
7,
64,
8,
198,
220,
2073,
361,
953,
7,
65,
11,
362,
8,
6624,
657,
198,
220,
220,
220,
269,
796,
257,
61,
7,
7146,
7,
65,
11,
362,
4008,
198,
220,
220,
220,
1441,
269,
9,
66,
198,
220,
2073,
361,
953,
7,
65,
11,
362,
8,
6624,
352,
198,
220,
220,
220,
1441,
257,
61,
7,
65,
532,
352,
27493,
64,
198,
220,
886,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
16774,
2134,
625,
25138,
198,
2,
198,
29113,
29113,
14468,
198,
198,
7,
32,
3712,
2348,
70,
8021,
90,
51,
30072,
3419,
810,
1391,
51,
92,
796,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
32,
8,
198,
198,
8818,
357,
32,
3712,
2348,
70,
8021,
90,
51,
92,
5769,
66,
3712,
19182,
90,
51,
11,
352,
30072,
810,
1391,
51,
92,
198,
220,
4129,
7,
66,
8,
14512,
5391,
7,
32,
8,
11405,
4049,
7203,
29271,
5736,
836,
470,
2872,
19570,
198,
220,
1441,
978,
70,
8021,
36,
10671,
90,
51,
92,
7,
32,
11,
269,
8,
198,
437,
198,
198,
8818,
7308,
13,
1136,
9630,
7,
32,
3712,
2348,
70,
8021,
90,
51,
5512,
1312,
3712,
5317,
8,
810,
1391,
51,
92,
198,
220,
357,
72,
1279,
352,
8614,
1312,
1875,
5391,
7,
32,
4008,
11405,
4049,
7203,
15732,
1276,
307,
287,
2837,
29568,
16,
25,
27740,
7,
32,
4008,
4943,
198,
220,
299,
796,
5391,
7,
32,
8,
198,
220,
410,
796,
20650,
90,
51,
92,
7,
77,
8,
198,
220,
329,
474,
287,
352,
25,
77,
198,
220,
220,
220,
410,
58,
73,
60,
796,
6632,
7,
8692,
62,
1806,
7,
32,
4008,
198,
220,
886,
198,
220,
410,
58,
72,
60,
796,
530,
7,
8692,
62,
1806,
7,
32,
4008,
198,
220,
1441,
317,
7,
85,
8,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
10903,
314,
14,
46,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
905,
7,
952,
3712,
9399,
11,
257,
3712,
2348,
70,
8021,
36,
10671,
8,
198,
220,
3601,
7,
952,
11,
366,
20180,
286,
366,
8,
198,
220,
3601,
7,
952,
11,
2560,
7,
64,
4008,
198,
220,
3601,
7,
952,
11,
366,
351,
44036,
366,
8,
198,
220,
3601,
7,
952,
11,
257,
13,
1073,
14822,
82,
8,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
10766,
30073,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
7308,
13,
22089,
30073,
62,
32538,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
8633,
3712,
10267,
7390,
35,
713,
8,
810,
1391,
51,
92,
198,
220,
275,
796,
2560,
7,
64,
8,
3419,
198,
220,
329,
2124,
287,
2214,
14933,
7,
64,
8,
198,
220,
220,
220,
611,
2124,
14512,
1058,
8000,
11405,
318,
23211,
7,
64,
11,
2124,
8,
198,
220,
220,
220,
220,
220,
900,
3245,
0,
7,
65,
11,
2124,
11,
7308,
13,
22089,
30073,
62,
32538,
7,
1136,
3245,
7,
64,
11,
2124,
828,
8633,
4008,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
1441,
275,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
31428,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
6624,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
5512,
275,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
2560,
7,
64,
8,
14512,
2560,
7,
65,
8,
11405,
1441,
3991,
198,
220,
1441,
257,
13,
1073,
14822,
82,
6624,
275,
13,
1073,
14822,
82,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
1855,
35428,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
42044,
13,
1084,
35428,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
8,
198,
220,
337,
796,
10552,
62,
6759,
8609,
7,
64,
8,
198,
220,
371,
796,
12280,
26601,
498,
39687,
7,
8692,
62,
1806,
7,
8000,
7,
64,
36911,
366,
87,
1600,
39986,
28,
9562,
38381,
16,
60,
198,
220,
1441,
949,
35428,
7,
49,
11,
337,
8,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
10858,
341,
17593,
198,
2,
198,
29113,
29113,
14468,
198,
198,
8818,
9766,
76,
62,
1462,
62,
6759,
62,
808,
0,
7,
44,
3712,
19044,
36,
10671,
90,
51,
5512,
1312,
3712,
5317,
11,
257,
3712,
2348,
70,
8021,
36,
10671,
90,
51,
30072,
810,
309,
198,
220,
329,
269,
796,
352,
25,
4033,
82,
7,
44,
8,
198,
220,
220,
220,
337,
58,
72,
11,
269,
60,
796,
2769,
30073,
7,
64,
13,
1073,
14822,
82,
58,
66,
12962,
198,
220,
886,
198,
220,
1441,
2147,
198,
437,
198,
198,
8818,
9766,
76,
62,
6738,
62,
6759,
62,
808,
7,
32,
3712,
2348,
70,
8021,
90,
51,
5512,
337,
3712,
19044,
36,
10671,
90,
51,
5512,
1312,
3712,
5317,
8,
810,
309,
198,
220,
257,
796,
317,
3419,
198,
220,
329,
269,
796,
352,
25,
4033,
82,
7,
44,
8,
198,
220,
220,
220,
257,
13,
1073,
14822,
82,
58,
66,
60,
796,
2769,
30073,
7,
44,
58,
72,
11,
269,
12962,
198,
220,
886,
198,
220,
1441,
257,
198,
437,
198,
198,
8818,
10552,
62,
6759,
8609,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
11,
2223,
3712,
13940,
23650,
28,
25,
9464,
8,
198,
220,
317,
796,
2560,
7,
64,
8,
198,
220,
337,
796,
6632,
62,
6759,
8609,
7,
8692,
62,
1806,
7,
32,
828,
5391,
7,
32,
828,
5391,
7,
32,
4008,
198,
220,
611,
2223,
855,
25,
9464,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
611,
318,
22570,
7,
64,
13,
1073,
14822,
82,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
329,
474,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
58,
73,
11,
479,
60,
15853,
257,
13,
1073,
14822,
82,
58,
72,
60,
9,
32,
13,
16680,
62,
11487,
58,
72,
11,
474,
11,
479,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
2073,
361,
2223,
855,
25,
3506,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
611,
318,
22570,
7,
64,
13,
1073,
14822,
82,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
2555,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
329,
474,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
479,
796,
352,
25,
27740,
7,
32,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
337,
58,
73,
11,
479,
60,
15853,
257,
13,
1073,
14822,
82,
58,
72,
60,
9,
32,
13,
16680,
62,
11487,
58,
73,
11,
1312,
11,
479,
60,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
2073,
198,
220,
220,
220,
4049,
7203,
3673,
1865,
9177,
4943,
198,
220,
886,
198,
220,
1441,
337,
198,
437,
198,
198,
29113,
29113,
14468,
198,
2,
198,
2,
220,
318,
505,
14,
271,
22570,
198,
2,
198,
29113,
29113,
14468,
198,
198,
271,
505,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
8,
796,
257,
6624,
530,
7,
8000,
7,
64,
4008,
198,
198,
271,
22570,
7,
64,
3712,
2348,
70,
8021,
36,
10671,
8,
796,
477,
7,
72,
4613,
1312,
6624,
657,
11,
257,
13,
1073,
14822,
82,
8,
198
] | 2.56984 | 3,057 |
using Test
using MathOptInterface
const MOI = MathOptInterface
const MOIU = MOI.Utilities
@test sprint(MOIU.print_with_acronym, "MathOptInterface") == "MOI"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.MathOptInterface") ==
"MOI.MOI"
@test sprint(
MOIU.print_with_acronym,
"MathOptInterface.Utilities.MathOptInterface",
) == "MOIU.MOI"
@test sprint(MOIU.print_with_acronym, "MathOptInterfaceXXBridges") ==
"MOIXXBridges"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.BridgesXX") == "MOIBXX"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.Test.x") == "MOIT.x"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.x.Test") == "MOI.x.Test"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") ==
"MOIU.Test"
@test sprint(MOIU.print_with_acronym, "MathOptInterface.Utilities.Test") ==
"MOIU.Test"
| [
3500,
6208,
198,
3500,
16320,
27871,
39317,
198,
9979,
13070,
40,
796,
16320,
27871,
39317,
198,
9979,
13070,
44958,
796,
13070,
40,
13,
18274,
2410,
198,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
4943,
6624,
366,
11770,
40,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
37372,
27871,
39317,
4943,
6624,
198,
220,
220,
220,
220,
220,
366,
11770,
40,
13,
11770,
40,
1,
198,
31,
9288,
18553,
7,
198,
220,
220,
220,
13070,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
198,
220,
220,
220,
366,
37372,
27871,
39317,
13,
18274,
2410,
13,
37372,
27871,
39317,
1600,
198,
8,
6624,
366,
11770,
44958,
13,
11770,
40,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
8051,
33,
32124,
4943,
6624,
198,
220,
220,
220,
220,
220,
366,
11770,
40,
8051,
33,
32124,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
33,
32124,
8051,
4943,
6624,
366,
11770,
9865,
8051,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
14402,
13,
87,
4943,
6624,
366,
11770,
2043,
13,
87,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
87,
13,
14402,
4943,
6624,
366,
11770,
40,
13,
87,
13,
14402,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
18274,
2410,
13,
14402,
4943,
6624,
198,
220,
220,
220,
220,
220,
366,
11770,
44958,
13,
14402,
1,
198,
31,
9288,
18553,
7,
11770,
44958,
13,
4798,
62,
4480,
62,
330,
1313,
4948,
11,
366,
37372,
27871,
39317,
13,
18274,
2410,
13,
14402,
4943,
6624,
198,
220,
220,
220,
220,
220,
366,
11770,
44958,
13,
14402,
1,
198
] | 2.504274 | 351 |
export PyPtr, PyObject, Py_NULL, METH_O, METH_NOARGS, METH_FASTCALL
export Py_ssize_t, Addr
export PyMethodDef
export Py_LE, Py_LT, Py_NE, Py_EQ, Py_GE, Py_GT
const Py_ssize_t = Cssize_t
const Py_hash_t = Py_ssize_t
const Addr = UInt64
# Ref: https://github.com/python/cpython/blob/3.8/Include/object.h#L104
struct PyObject
ob_refcnt::Py_ssize_t
ob_type::Ptr{PyObject}
end
const PyPtr = Ptr{PyObject}
const Py_NULL = reinterpret(PyPtr, C_NULL)
const METH_VARARGS = 0x0001
const METH_KEYWORDS = 0x0002
const METH_NOARGS = 0x0004
const METH_O = 0x0008
const METH_FASTCALL = 0x0080
# Ref: https://github.com/python/cpython/blob/3.8/Include/methodobject.h#L51
mutable struct PyMethodDef
ml_name::Cstring
ml_meth::Ptr{Nothing}
ml_flags::Cint
ml_doc::Cstring # may be NULL
end
# Ref: https://github.com/python/cpython/blob/3.8/Include/descrobject.h#L11
struct PyGetSetDef
name::Ptr{UInt8}
get::Ptr{Cvoid}
set::Ptr{Cvoid} # may be NULL for read-only members
doc::Ptr{UInt8} # may be NULL
closure::Ptr{Cvoid} # pass-through thunk, may be NULL
end
# (o, o) -> p
# struct binaryfunc
# unbox::Ptr{Nothing}
# end
# function (f::binaryfunc)(o1::PyPtr, o2::PyPtr)
# ccall(f.unbox, PyPtr, (PyPtr, PyPtr), o1, o2)
# end
# DIO_ExceptCode(::binaryfunc) = Py_NULL
# (o) -> p
# struct unaryfunc
# unbox::Ptr{Nothing}
# end
# function (f::unaryfunc)(o)
# ccall(f.unbox, PyPtr, (PyPtr,), o)
# end
# DIO_ExceptCode(::unaryfunc) = Py_NULL
# # (o, o, o) -> p
# struct ternaryfunc
# unbox::Ptr{Nothing}
# end
# function (f::ternaryfunc)(o1::PyPtr, o2::PyPtr, o3::PyPtr)
# ccall(f.unbox, PyPtr, (PyPtr, PyPtr, PyPtr), o1, o2, o3)
# end
# DIO_ExceptCode(::ternaryfunc) = Py_NULL
const binaryfunc = Ptr{Nothing}
const unaryfunc = Ptr{Nothing}
const ternaryfunc = Ptr{Nothing}
# Ref: https://github.com/python/cpython/blob/3.8/Include/cpython/object.h#L95
struct PyNumberMethods
nb_add::binaryfunc
nb_subtract::binaryfunc
nb_multiply::binaryfunc
nb_remainder::binaryfunc
nb_divmod::binaryfunc
nb_power::ternaryfunc
nb_negative::unaryfunc
nb_positive::unaryfunc
nb_absolute::unaryfunc
nb_bool::Ptr{Nothing}
nb_invert::unaryfunc
nb_lshift::binaryfunc
nb_rshift::binaryfunc
nb_and::binaryfunc
nb_xor::binaryfunc
nb_or::binaryfunc
nb_int::unaryfunc
nb_reserved::Ptr{Nothing}
nb_float::unaryfunc
nb_inplace_add::binaryfunc
nb_inplace_subtract::binaryfunc
nb_inplace_multiply::binaryfunc
nb_inplace_remainder::binaryfunc
nb_inplace_power::ternaryfunc
nb_inplace_lshift::binaryfunc
nb_inplace_rshift::binaryfunc
nb_inplace_and::binaryfunc
nb_inplace_xor::binaryfunc
nb_inplace_or::binaryfunc
nb_floor_divide::binaryfunc
nb_true_divide::binaryfunc
nb_inplace_floor_divide::binaryfunc
nb_inplace_true_divide::binaryfunc
nb_index::unaryfunc
nb_matrix_multiply::binaryfunc
nb_inplace_matrix_multiply::binaryfunc
end
struct PyMemberDef
name::Ptr{UInt8}
typ::Cint
offset::Int # warning: was Cint for Python <= 2.4
flags::Cint
doc::Ptr{UInt8}
end
# Ref: https://github.com/python/cpython/blob/3.8/Include/cpython/object.h#L177
mutable struct PyTypeObject
# PyObject_HEAD (for non-Py_TRACE_REFS build):
ob_refcnt::Py_ssize_t
ob_type::PyPtr
ob_size::Py_ssize_t # PyObject_VAR_HEAD
# PyTypeObject fields:
tp_name::Ptr{UInt8} # required, should be in format "<module>.<name>"
# warning: these two were Cint for Python <= 2.4
tp_basicsize::Int # required, = sizeof(instance)
tp_itemsize::Int
tp_dealloc::Ptr{Cvoid}
tp_vectorcall_offset :: Addr
tp_getattr::Ptr{Cvoid}
tp_setattr::Ptr{Cvoid}
tp_as_async::Ptr{Cvoid}
tp_repr::Ptr{Cvoid}
tp_as_number::Ptr{PyNumberMethods}
tp_as_sequence::Ptr{Cvoid}
tp_as_mapping::Ptr{Cvoid}
tp_hash::Ptr{Cvoid}
tp_call::Ptr{Cvoid}
tp_str::Ptr{Cvoid}
tp_getattro::Ptr{Cvoid}
tp_setattro::Ptr{Cvoid}
tp_as_buffer::Ptr{Cvoid}
tp_flags::Clong # Required, should default to Py_TPFLAGS_DEFAULT
tp_doc::Ptr{UInt8} # normally set in example code, but may be NULL
tp_traverse::Ptr{Cvoid}
tp_clear::Ptr{Cvoid}
tp_richcompare::Ptr{Cvoid}
tp_weaklistoffset::Int
# added in Python 2.2:
tp_iter::Ptr{Cvoid}
tp_iternext::Ptr{Cvoid}
tp_methods::Ptr{PyMethodDef}
tp_members::Ptr{PyMemberDef}
tp_getset::Ptr{PyGetSetDef}
tp_base::Ptr{Cvoid}
tp_dict::PyPtr
tp_descr_get::Ptr{Cvoid}
tp_descr_set::Ptr{Cvoid}
tp_dictoffset::Int
tp_init::Ptr{Cvoid}
tp_alloc::Ptr{Cvoid}
tp_new::Ptr{Cvoid}
tp_free::Ptr{Cvoid}
tp_is_gc::Ptr{Cvoid}
tp_bases::PyPtr
tp_mro::PyPtr
tp_cache::PyPtr
tp_subclasses::PyPtr
tp_weaklist::PyPtr
tp_del::Ptr{Cvoid}
# added in Python 2.6:
tp_version_tag::Cuint
# only used for COUNT_ALLOCS builds of Python
tp_allocs::Int
tp_frees::Int
tp_maxalloc::Int
tp_prev::Ptr{Cvoid}
tp_next::Ptr{Cvoid}
end
const Py_LT = Cint(0)
const Py_LE = Cint(1)
const Py_EQ = Cint(2)
const Py_NE = Cint(3)
const Py_GT = Cint(4)
const Py_GE = Cint(5)
| [
39344,
9485,
46745,
11,
9485,
10267,
11,
9485,
62,
33991,
11,
337,
20702,
62,
46,
11,
337,
20702,
62,
15285,
1503,
14313,
11,
337,
20702,
62,
37,
1921,
4825,
7036,
198,
39344,
9485,
62,
824,
1096,
62,
83,
11,
3060,
81,
198,
39344,
9485,
17410,
7469,
198,
39344,
9485,
62,
2538,
11,
9485,
62,
27734,
11,
9485,
62,
12161,
11,
9485,
62,
36,
48,
11,
9485,
62,
8264,
11,
9485,
62,
19555,
198,
198,
9979,
9485,
62,
824,
1096,
62,
83,
796,
327,
824,
1096,
62,
83,
198,
9979,
9485,
62,
17831,
62,
83,
796,
9485,
62,
824,
1096,
62,
83,
198,
9979,
3060,
81,
796,
471,
5317,
2414,
198,
198,
2,
6524,
25,
3740,
1378,
12567,
13,
785,
14,
29412,
14,
13155,
7535,
14,
2436,
672,
14,
18,
13,
23,
14,
818,
9152,
14,
15252,
13,
71,
2,
43,
13464,
198,
7249,
9485,
10267,
198,
220,
220,
220,
909,
62,
5420,
66,
429,
3712,
20519,
62,
824,
1096,
62,
83,
198,
220,
220,
220,
909,
62,
4906,
3712,
46745,
90,
20519,
10267,
92,
198,
437,
198,
198,
9979,
9485,
46745,
796,
350,
2213,
90,
20519,
10267,
92,
198,
9979,
9485,
62,
33991,
796,
302,
27381,
7,
20519,
46745,
11,
327,
62,
33991,
8,
198,
198,
9979,
337,
20702,
62,
53,
1503,
1503,
14313,
796,
657,
87,
18005,
198,
9979,
337,
20702,
62,
20373,
45359,
5258,
796,
657,
87,
34215,
198,
9979,
337,
20702,
62,
15285,
1503,
14313,
796,
657,
87,
830,
19,
198,
9979,
337,
20702,
62,
46,
796,
657,
87,
830,
23,
198,
9979,
337,
20702,
62,
37,
1921,
4825,
7036,
796,
657,
87,
405,
1795,
198,
198,
2,
6524,
25,
3740,
1378,
12567,
13,
785,
14,
29412,
14,
13155,
7535,
14,
2436,
672,
14,
18,
13,
23,
14,
818,
9152,
14,
24396,
15252,
13,
71,
2,
43,
4349,
198,
76,
18187,
2878,
9485,
17410,
7469,
198,
220,
220,
220,
25962,
62,
3672,
3712,
34,
8841,
198,
220,
220,
220,
25962,
62,
76,
2788,
3712,
46745,
90,
18465,
92,
198,
220,
220,
220,
25962,
62,
33152,
3712,
34,
600,
198,
220,
220,
220,
25962,
62,
15390,
3712,
34,
8841,
1303,
743,
307,
15697,
198,
437,
198,
198,
2,
6524,
25,
3740,
1378,
12567,
13,
785,
14,
29412,
14,
13155,
7535,
14,
2436,
672,
14,
18,
13,
23,
14,
818,
9152,
14,
20147,
22609,
752,
13,
71,
2,
43,
1157,
198,
7249,
9485,
3855,
7248,
7469,
198,
220,
220,
220,
1438,
3712,
46745,
90,
52,
5317,
23,
92,
198,
220,
220,
220,
651,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
900,
3712,
46745,
90,
34,
19382,
92,
1303,
743,
307,
15697,
329,
1100,
12,
8807,
1866,
198,
220,
220,
220,
2205,
3712,
46745,
90,
52,
5317,
23,
92,
1303,
743,
307,
15697,
198,
220,
220,
220,
16512,
3712,
46745,
90,
34,
19382,
92,
1303,
1208,
12,
9579,
294,
2954,
11,
743,
307,
15697,
198,
437,
198,
198,
2,
357,
78,
11,
267,
8,
4613,
279,
198,
2,
2878,
13934,
20786,
198,
2,
220,
220,
220,
220,
555,
3524,
3712,
46745,
90,
18465,
92,
198,
2,
886,
198,
2,
2163,
357,
69,
3712,
39491,
20786,
5769,
78,
16,
3712,
20519,
46745,
11,
267,
17,
3712,
20519,
46745,
8,
198,
2,
220,
220,
220,
220,
269,
13345,
7,
69,
13,
403,
3524,
11,
9485,
46745,
11,
357,
20519,
46745,
11,
9485,
46745,
828,
267,
16,
11,
267,
17,
8,
198,
2,
886,
198,
2,
360,
9399,
62,
30313,
10669,
7,
3712,
39491,
20786,
8,
796,
9485,
62,
33991,
198,
2,
357,
78,
8,
4613,
279,
198,
2,
2878,
555,
560,
20786,
198,
2,
220,
220,
220,
220,
555,
3524,
3712,
46745,
90,
18465,
92,
198,
2,
886,
198,
2,
2163,
357,
69,
3712,
403,
560,
20786,
5769,
78,
8,
198,
2,
220,
220,
220,
220,
269,
13345,
7,
69,
13,
403,
3524,
11,
9485,
46745,
11,
357,
20519,
46745,
11,
828,
267,
8,
198,
2,
886,
198,
2,
360,
9399,
62,
30313,
10669,
7,
3712,
403,
560,
20786,
8,
796,
9485,
62,
33991,
198,
2,
1303,
357,
78,
11,
267,
11,
267,
8,
4613,
279,
198,
2,
2878,
1059,
77,
560,
20786,
198,
2,
220,
220,
220,
220,
555,
3524,
3712,
46745,
90,
18465,
92,
198,
2,
886,
198,
2,
2163,
357,
69,
3712,
759,
560,
20786,
5769,
78,
16,
3712,
20519,
46745,
11,
267,
17,
3712,
20519,
46745,
11,
267,
18,
3712,
20519,
46745,
8,
198,
2,
220,
220,
220,
220,
269,
13345,
7,
69,
13,
403,
3524,
11,
9485,
46745,
11,
357,
20519,
46745,
11,
9485,
46745,
11,
9485,
46745,
828,
267,
16,
11,
267,
17,
11,
267,
18,
8,
198,
2,
886,
198,
2,
360,
9399,
62,
30313,
10669,
7,
3712,
759,
560,
20786,
8,
796,
9485,
62,
33991,
198,
198,
9979,
13934,
20786,
796,
350,
2213,
90,
18465,
92,
198,
9979,
555,
560,
20786,
796,
350,
2213,
90,
18465,
92,
198,
9979,
1059,
77,
560,
20786,
796,
350,
2213,
90,
18465,
92,
198,
198,
2,
6524,
25,
3740,
1378,
12567,
13,
785,
14,
29412,
14,
13155,
7535,
14,
2436,
672,
14,
18,
13,
23,
14,
818,
9152,
14,
13155,
7535,
14,
15252,
13,
71,
2,
43,
3865,
198,
7249,
9485,
15057,
46202,
198,
220,
220,
220,
299,
65,
62,
2860,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
7266,
83,
974,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
16680,
541,
306,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
2787,
391,
1082,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
7146,
4666,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
6477,
3712,
759,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
31591,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
24561,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
48546,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
30388,
3712,
46745,
90,
18465,
92,
198,
220,
220,
220,
299,
65,
62,
259,
1851,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
75,
30846,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
81,
30846,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
392,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
87,
273,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
273,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
600,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
411,
8520,
3712,
46745,
90,
18465,
92,
198,
220,
220,
220,
299,
65,
62,
22468,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
2860,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
7266,
83,
974,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
16680,
541,
306,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
2787,
391,
1082,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
6477,
3712,
759,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
75,
30846,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
81,
30846,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
392,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
87,
273,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
273,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
28300,
62,
7146,
485,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
7942,
62,
7146,
485,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
28300,
62,
7146,
485,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
7942,
62,
7146,
485,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
9630,
3712,
403,
560,
20786,
198,
220,
220,
220,
299,
65,
62,
6759,
8609,
62,
16680,
541,
306,
3712,
39491,
20786,
198,
220,
220,
220,
299,
65,
62,
259,
5372,
62,
6759,
8609,
62,
16680,
541,
306,
3712,
39491,
20786,
198,
437,
198,
198,
7249,
9485,
27608,
7469,
198,
220,
220,
220,
1438,
3712,
46745,
90,
52,
5317,
23,
92,
198,
220,
220,
220,
2170,
3712,
34,
600,
198,
220,
220,
220,
11677,
3712,
5317,
1303,
6509,
25,
373,
327,
600,
329,
11361,
19841,
362,
13,
19,
198,
220,
220,
220,
9701,
3712,
34,
600,
198,
220,
220,
220,
2205,
3712,
46745,
90,
52,
5317,
23,
92,
198,
437,
198,
198,
2,
6524,
25,
3740,
1378,
12567,
13,
785,
14,
29412,
14,
13155,
7535,
14,
2436,
672,
14,
18,
13,
23,
14,
818,
9152,
14,
13155,
7535,
14,
15252,
13,
71,
2,
43,
22413,
198,
76,
18187,
2878,
9485,
6030,
10267,
198,
220,
220,
220,
1303,
9485,
10267,
62,
37682,
357,
1640,
1729,
12,
20519,
62,
5446,
11598,
62,
2200,
10652,
1382,
2599,
198,
220,
220,
220,
909,
62,
5420,
66,
429,
3712,
20519,
62,
824,
1096,
62,
83,
198,
220,
220,
220,
909,
62,
4906,
3712,
20519,
46745,
198,
220,
220,
220,
909,
62,
7857,
3712,
20519,
62,
824,
1096,
62,
83,
1303,
9485,
10267,
62,
53,
1503,
62,
37682,
628,
220,
220,
220,
1303,
9485,
6030,
10267,
7032,
25,
198,
220,
220,
220,
256,
79,
62,
3672,
3712,
46745,
90,
52,
5317,
23,
92,
1303,
2672,
11,
815,
307,
287,
5794,
33490,
21412,
28401,
27,
3672,
24618,
628,
220,
220,
220,
1303,
6509,
25,
777,
734,
547,
327,
600,
329,
11361,
19841,
362,
13,
19,
198,
220,
220,
220,
256,
79,
62,
12093,
873,
1096,
3712,
5317,
1303,
2672,
11,
796,
39364,
7,
39098,
8,
198,
220,
220,
220,
256,
79,
62,
23814,
1096,
3712,
5317,
628,
220,
220,
220,
256,
79,
62,
2934,
32332,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
31364,
13345,
62,
28968,
7904,
3060,
81,
198,
220,
220,
220,
256,
79,
62,
1136,
35226,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
2617,
35226,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
292,
62,
292,
13361,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
260,
1050,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
292,
62,
17618,
3712,
46745,
90,
20519,
15057,
46202,
92,
198,
220,
220,
220,
256,
79,
62,
292,
62,
43167,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
292,
62,
76,
5912,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
17831,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
13345,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
2536,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
1136,
1078,
305,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
2617,
1078,
305,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
292,
62,
22252,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
33152,
3712,
2601,
506,
1303,
20906,
11,
815,
4277,
284,
9485,
62,
7250,
38948,
50,
62,
7206,
38865,
628,
220,
220,
220,
256,
79,
62,
15390,
3712,
46745,
90,
52,
5317,
23,
92,
1303,
7685,
900,
287,
1672,
2438,
11,
475,
743,
307,
15697,
628,
220,
220,
220,
256,
79,
62,
9535,
4399,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
20063,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
7527,
5589,
533,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
38695,
4868,
28968,
3712,
5317,
628,
220,
220,
220,
1303,
2087,
287,
11361,
362,
13,
17,
25,
198,
220,
220,
220,
256,
79,
62,
2676,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
2676,
19545,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
24396,
82,
3712,
46745,
90,
20519,
17410,
7469,
92,
198,
220,
220,
220,
256,
79,
62,
30814,
3712,
46745,
90,
20519,
27608,
7469,
92,
198,
220,
220,
220,
256,
79,
62,
11407,
316,
3712,
46745,
90,
20519,
3855,
7248,
7469,
92,
198,
220,
220,
220,
256,
79,
62,
8692,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
11600,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
20147,
81,
62,
1136,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
20147,
81,
62,
2617,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
11600,
28968,
3712,
5317,
628,
220,
220,
220,
256,
79,
62,
15003,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
32332,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
3605,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
5787,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
271,
62,
36484,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
256,
79,
62,
65,
1386,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
76,
305,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
23870,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
7266,
37724,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
38695,
4868,
3712,
20519,
46745,
198,
220,
220,
220,
256,
79,
62,
12381,
3712,
46745,
90,
34,
19382,
92,
628,
220,
220,
220,
1303,
2087,
287,
11361,
362,
13,
21,
25,
198,
220,
220,
220,
256,
79,
62,
9641,
62,
12985,
3712,
34,
28611,
628,
220,
220,
220,
1303,
691,
973,
329,
327,
28270,
62,
7036,
4503,
50,
12188,
286,
11361,
198,
220,
220,
220,
256,
79,
62,
32332,
82,
3712,
5317,
198,
220,
220,
220,
256,
79,
62,
69,
6037,
3712,
5317,
198,
220,
220,
220,
256,
79,
62,
9806,
32332,
3712,
5317,
198,
220,
220,
220,
256,
79,
62,
47050,
3712,
46745,
90,
34,
19382,
92,
198,
220,
220,
220,
256,
79,
62,
19545,
3712,
46745,
90,
34,
19382,
92,
198,
437,
198,
198,
9979,
9485,
62,
27734,
796,
327,
600,
7,
15,
8,
198,
9979,
9485,
62,
2538,
796,
327,
600,
7,
16,
8,
198,
9979,
9485,
62,
36,
48,
796,
327,
600,
7,
17,
8,
198,
9979,
9485,
62,
12161,
796,
327,
600,
7,
18,
8,
198,
9979,
9485,
62,
19555,
796,
327,
600,
7,
19,
8,
198,
9979,
9485,
62,
8264,
796,
327,
600,
7,
20,
8,
198
] | 2.14092 | 2,434 |
# Author: Gabrio Rizzuti, grizzuti3@gatech.edu
# Date: September 2020
using InvertibleNetworks, LinearAlgebra, Test, Statistics, Random
# Random seed
Random.seed!(1);
###############################################################################
# Initialization
# Input
nx = 28
ny = 28*2
nc = 4
n_hidden = 64
batchsize = 5
X = rand(Float32, nx, ny, nc, batchsize)
# Layers and initialization
logdet = true
N1 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N2 = ActNorm(nc; logdet=logdet)
N3 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N = Composition(N1, N2, N3)
###############################################################################
# Test coherency of composition and manual composition
Y = copy(X)
Y, l3 = N3.forward(Y)
Y, l2 = N2.forward(Y)
Y, l1 = N1.forward(Y)
l = l1+l2+l3
Y_, l_ = N.forward(X)
@test isapprox(Y, Y_; rtol=1f-3)
@test isapprox(l, l_; rtol=1f-3)
###############################################################################
# Test coherency of composition and ∘
# Composition with ∘
N_ = N1∘N2∘N3
Y, l = N.forward(X)
Y_, l_ = N_.forward(X)
@test isapprox(Y, Y_; rtol=1f-3)
@test isapprox(l, l_; rtol=1f-3)
###############################################################################
# Test invertibility
@test isapprox(X, N.inverse(N.forward(X)[1]); rtol=1f-3)
@test isapprox(X, N.forward(N.inverse(X))[1]; rtol=1f-3)
###############################################################################
# Gradient Test
function loss(N, X, Y)
# Forward pass
Y_, lgdet = N.forward(X)
# Residual and function value
ΔY = Y_ - Y
f = 0.5f0/batchsize*norm(ΔY)^2f0-lgdet
# Back propagation
ΔX, _ = N.backward(ΔY./batchsize, Y_)
return f, ΔX, deepcopy(get_grads(N))
end
# Initializing nets
N1 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N2 = ActNorm(nc; logdet=logdet)
N3 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N0 = Composition(N1, N2, N3); N0.forward(rand(Float32, nx, ny, nc, batchsize))
θ0 = deepcopy(get_params(N0))
N1 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N2 = ActNorm(nc; logdet=logdet)
N3 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N = Composition(N1, N2, N3); N.forward(rand(Float32, nx, ny, nc, batchsize))
θ = deepcopy(get_params(N))
# Inputs
X = rand(Float32, nx, ny, nc, batchsize)
X0 = rand(Float32, nx, ny, nc, batchsize)
dX = rand(Float32, nx, ny, nc, batchsize)
Y = rand(Float32, nx, ny, nc, batchsize)
dθ = θ-θ0
for i = 1:length(dθ)
(norm(θ0[i].data) != 0f0) && (dθ[i].data .*= norm(θ0[i].data)/norm(dθ[i].data))
end
# Gradient test (input)
set_params!(N0, θ0)
f0, ΔX, Δθ = loss(N0, X, Y)
h = 0.1f0
maxiter = 5
err1 = zeros(Float32, maxiter)
err2 = zeros(Float32, maxiter)
print("\nGradient test sequential network: input\n")
for j=1:maxiter
f = loss(N0, X+h*dX, Y)[1]
err1[j] = abs(f - f0)
err2[j] = abs(f - f0 - h*dot(dX, ΔX))
print(err1[j], "; ", err2[j], "\n")
global h /= 2f0
end
@test isapprox(err1[end] / (err1[1]/2^(maxiter-1)), 1f0; atol=1f1)
@test isapprox(err2[end] / (err2[1]/4^(maxiter-1)), 1f0; atol=1f1)
# Gradient test (parameters)
h = 0.1f0
maxiter = 5
err3 = zeros(Float32, maxiter)
err4 = zeros(Float32, maxiter)
print("\nGradient test sequential network: parameters\n")
for j=1:maxiter
set_params!(N0, θ0+h*dθ)
f = loss(N0, X, Y)[1]
err3[j] = abs(f - f0)
err4[j] = abs(f - f0 - h*dot(dθ, Δθ))
print(err3[j], "; ", err4[j], "\n")
global h /= 2f0
end
@test isapprox(err3[end] / (err3[1]/2^(maxiter-1)), 1f0; atol=1f1)
@test isapprox(err4[end] / (err4[1]/4^(maxiter-1)), 1f0; atol=1f1)
###################################################################################################
# Jacobian-related tests
# Gradient test
# Initializing nets
N1 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N2 = ActNorm(nc; logdet=logdet)
N3 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N0 = Composition(N1, N2, N3); N0.forward(rand(Float32, nx, ny, nc, batchsize))
θ0 = deepcopy(get_params(N0))
N1 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N2 = ActNorm(nc; logdet=logdet)
N3 = CouplingLayerHINT(nc, n_hidden; permute="full", logdet=logdet)
N = Composition(N1, N2, N3); N.forward(rand(Float32, nx, ny, nc, batchsize))
θ = deepcopy(get_params(N))
X = randn(Float32, nx, ny, nc, batchsize)
# Perturbation (normalized)
dθ = θ-θ0; dθ .*= norm.(θ0)./(norm.(dθ).+1f-10)
dX = randn(Float32, nx, ny, nc, batchsize); dX *= norm(X)/norm(dX)
# Jacobian eval
dY, Y, _, _ = N.jacobian(dX, dθ, X)
# Test
print("\nJacobian test\n")
h = 0.1f0
maxiter = 5
err5 = zeros(Float32, maxiter)
err6 = zeros(Float32, maxiter)
for j=1:maxiter
set_params!(N, θ+h*dθ)
Y_loc, _ = N.forward(X+h*dX)
err5[j] = norm(Y_loc - Y)
err6[j] = norm(Y_loc - Y - h*dY)
print(err5[j], "; ", err6[j], "\n")
global h = h/2f0
end
@test isapprox(err5[end] / (err5[1]/2^(maxiter-1)), 1f0; atol=1f1)
@test isapprox(err6[end] / (err6[1]/4^(maxiter-1)), 1f0; atol=1f1)
# Adjoint test
set_params!(N, θ)
dY, Y, _, _ = N.jacobian(dX, dθ, X)
dY_ = randn(Float32, size(dY))
dX_, dθ_, _, _ = N.adjointJacobian(dY_, Y)
a = dot(dY, dY_)
b = dot(dX, dX_)+dot(dθ, dθ_)
@test isapprox(a, b; rtol=1f-3) | [
2,
6434,
25,
12300,
27250,
371,
6457,
47966,
11,
46307,
47966,
18,
31,
10494,
354,
13,
15532,
198,
2,
7536,
25,
2693,
12131,
198,
198,
3500,
554,
1851,
856,
7934,
5225,
11,
44800,
2348,
29230,
11,
6208,
11,
14370,
11,
14534,
198,
198,
2,
14534,
9403,
198,
29531,
13,
28826,
0,
7,
16,
1776,
628,
198,
29113,
29113,
7804,
4242,
21017,
198,
2,
20768,
1634,
198,
198,
2,
23412,
198,
77,
87,
796,
2579,
198,
3281,
796,
2579,
9,
17,
198,
10782,
796,
604,
198,
77,
62,
30342,
796,
5598,
198,
43501,
7857,
796,
642,
198,
55,
796,
43720,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
198,
2,
406,
6962,
290,
37588,
198,
6404,
15255,
796,
2081,
198,
45,
16,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
17,
796,
2191,
35393,
7,
10782,
26,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
18,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
796,
955,
9150,
7,
45,
16,
11,
399,
17,
11,
399,
18,
8,
628,
198,
29113,
29113,
7804,
4242,
21017,
198,
2,
6208,
763,
258,
5227,
286,
11742,
290,
10107,
11742,
198,
198,
56,
796,
4866,
7,
55,
8,
198,
56,
11,
300,
18,
796,
399,
18,
13,
11813,
7,
56,
8,
198,
56,
11,
300,
17,
796,
399,
17,
13,
11813,
7,
56,
8,
198,
56,
11,
300,
16,
796,
399,
16,
13,
11813,
7,
56,
8,
198,
75,
796,
300,
16,
10,
75,
17,
10,
75,
18,
198,
198,
56,
62,
11,
300,
62,
796,
399,
13,
11813,
7,
55,
8,
198,
198,
31,
9288,
318,
1324,
13907,
7,
56,
11,
575,
62,
26,
374,
83,
349,
28,
16,
69,
12,
18,
8,
198,
31,
9288,
318,
1324,
13907,
7,
75,
11,
300,
62,
26,
374,
83,
349,
28,
16,
69,
12,
18,
8,
628,
198,
29113,
29113,
7804,
4242,
21017,
198,
2,
6208,
763,
258,
5227,
286,
11742,
290,
18872,
246,
198,
198,
2,
955,
9150,
351,
18872,
246,
198,
45,
62,
796,
399,
16,
24861,
246,
45,
17,
24861,
246,
45,
18,
198,
198,
56,
11,
300,
796,
399,
13,
11813,
7,
55,
8,
198,
56,
62,
11,
300,
62,
796,
399,
44807,
11813,
7,
55,
8,
198,
198,
31,
9288,
318,
1324,
13907,
7,
56,
11,
575,
62,
26,
374,
83,
349,
28,
16,
69,
12,
18,
8,
198,
31,
9288,
318,
1324,
13907,
7,
75,
11,
300,
62,
26,
374,
83,
349,
28,
16,
69,
12,
18,
8,
628,
198,
29113,
29113,
7804,
4242,
21017,
198,
2,
6208,
287,
1851,
2247,
198,
198,
31,
9288,
318,
1324,
13907,
7,
55,
11,
399,
13,
259,
4399,
7,
45,
13,
11813,
7,
55,
38381,
16,
36563,
374,
83,
349,
28,
16,
69,
12,
18,
8,
198,
31,
9288,
318,
1324,
13907,
7,
55,
11,
399,
13,
11813,
7,
45,
13,
259,
4399,
7,
55,
4008,
58,
16,
11208,
374,
83,
349,
28,
16,
69,
12,
18,
8,
628,
198,
29113,
29113,
7804,
4242,
21017,
198,
2,
17701,
1153,
6208,
198,
198,
8818,
2994,
7,
45,
11,
1395,
11,
575,
8,
628,
220,
220,
220,
1303,
19530,
1208,
198,
220,
220,
220,
575,
62,
11,
300,
70,
15255,
796,
399,
13,
11813,
7,
55,
8,
628,
220,
220,
220,
1303,
1874,
312,
723,
290,
2163,
1988,
198,
220,
220,
220,
37455,
56,
796,
575,
62,
532,
575,
198,
220,
220,
220,
277,
796,
657,
13,
20,
69,
15,
14,
43501,
7857,
9,
27237,
7,
138,
242,
56,
8,
61,
17,
69,
15,
12,
75,
70,
15255,
628,
220,
220,
220,
1303,
5157,
43594,
198,
220,
220,
220,
37455,
55,
11,
4808,
796,
399,
13,
1891,
904,
7,
138,
242,
56,
19571,
43501,
7857,
11,
575,
62,
8,
628,
220,
220,
220,
1441,
277,
11,
37455,
55,
11,
2769,
30073,
7,
1136,
62,
2164,
5643,
7,
45,
4008,
198,
198,
437,
198,
198,
2,
20768,
2890,
31720,
198,
45,
16,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
17,
796,
2191,
35393,
7,
10782,
26,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
18,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
15,
796,
955,
9150,
7,
45,
16,
11,
399,
17,
11,
399,
18,
1776,
399,
15,
13,
11813,
7,
25192,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
4008,
198,
138,
116,
15,
796,
2769,
30073,
7,
1136,
62,
37266,
7,
45,
15,
4008,
198,
45,
16,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
17,
796,
2191,
35393,
7,
10782,
26,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
18,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
796,
955,
9150,
7,
45,
16,
11,
399,
17,
11,
399,
18,
1776,
399,
13,
11813,
7,
25192,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
4008,
198,
138,
116,
796,
2769,
30073,
7,
1136,
62,
37266,
7,
45,
4008,
198,
198,
2,
23412,
82,
198,
55,
796,
43720,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
55,
15,
796,
43720,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
67,
55,
796,
43720,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
56,
796,
43720,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
67,
138,
116,
796,
7377,
116,
12,
138,
116,
15,
198,
1640,
1312,
796,
352,
25,
13664,
7,
67,
138,
116,
8,
198,
220,
220,
220,
357,
27237,
7,
138,
116,
15,
58,
72,
4083,
7890,
8,
14512,
657,
69,
15,
8,
11405,
357,
67,
138,
116,
58,
72,
4083,
7890,
764,
9,
28,
2593,
7,
138,
116,
15,
58,
72,
4083,
7890,
20679,
27237,
7,
67,
138,
116,
58,
72,
4083,
7890,
4008,
198,
437,
198,
198,
2,
17701,
1153,
1332,
357,
15414,
8,
198,
2617,
62,
37266,
0,
7,
45,
15,
11,
7377,
116,
15,
8,
198,
69,
15,
11,
37455,
55,
11,
37455,
138,
116,
796,
2994,
7,
45,
15,
11,
1395,
11,
575,
8,
198,
71,
796,
657,
13,
16,
69,
15,
198,
9806,
2676,
796,
642,
198,
8056,
16,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
8056,
17,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
4798,
7203,
59,
77,
42731,
1153,
1332,
35582,
3127,
25,
5128,
59,
77,
4943,
198,
1640,
474,
28,
16,
25,
9806,
2676,
198,
220,
220,
220,
277,
796,
2994,
7,
45,
15,
11,
1395,
10,
71,
9,
67,
55,
11,
575,
38381,
16,
60,
198,
220,
220,
220,
11454,
16,
58,
73,
60,
796,
2352,
7,
69,
532,
277,
15,
8,
198,
220,
220,
220,
11454,
17,
58,
73,
60,
796,
2352,
7,
69,
532,
277,
15,
532,
289,
9,
26518,
7,
67,
55,
11,
37455,
55,
4008,
198,
220,
220,
220,
3601,
7,
8056,
16,
58,
73,
4357,
366,
26,
33172,
11454,
17,
58,
73,
4357,
37082,
77,
4943,
198,
220,
220,
220,
3298,
289,
1220,
28,
362,
69,
15,
198,
437,
198,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
16,
58,
437,
60,
1220,
357,
8056,
16,
58,
16,
60,
14,
17,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
17,
58,
437,
60,
1220,
357,
8056,
17,
58,
16,
60,
14,
19,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
198,
198,
2,
17701,
1153,
1332,
357,
17143,
7307,
8,
198,
71,
796,
657,
13,
16,
69,
15,
198,
9806,
2676,
796,
642,
198,
8056,
18,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
8056,
19,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
4798,
7203,
59,
77,
42731,
1153,
1332,
35582,
3127,
25,
10007,
59,
77,
4943,
198,
1640,
474,
28,
16,
25,
9806,
2676,
198,
220,
220,
220,
900,
62,
37266,
0,
7,
45,
15,
11,
7377,
116,
15,
10,
71,
9,
67,
138,
116,
8,
198,
220,
220,
220,
277,
796,
2994,
7,
45,
15,
11,
1395,
11,
575,
38381,
16,
60,
198,
220,
220,
220,
11454,
18,
58,
73,
60,
796,
2352,
7,
69,
532,
277,
15,
8,
198,
220,
220,
220,
11454,
19,
58,
73,
60,
796,
2352,
7,
69,
532,
277,
15,
532,
289,
9,
26518,
7,
67,
138,
116,
11,
37455,
138,
116,
4008,
198,
220,
220,
220,
3601,
7,
8056,
18,
58,
73,
4357,
366,
26,
33172,
11454,
19,
58,
73,
4357,
37082,
77,
4943,
198,
220,
220,
220,
3298,
289,
1220,
28,
362,
69,
15,
198,
437,
198,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
18,
58,
437,
60,
1220,
357,
8056,
18,
58,
16,
60,
14,
17,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
19,
58,
437,
60,
1220,
357,
8056,
19,
58,
16,
60,
14,
19,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
628,
198,
29113,
29113,
29113,
21017,
198,
2,
12806,
666,
12,
5363,
5254,
198,
198,
2,
17701,
1153,
1332,
198,
198,
2,
20768,
2890,
31720,
198,
45,
16,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
17,
796,
2191,
35393,
7,
10782,
26,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
18,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
15,
796,
955,
9150,
7,
45,
16,
11,
399,
17,
11,
399,
18,
1776,
399,
15,
13,
11813,
7,
25192,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
4008,
198,
138,
116,
15,
796,
2769,
30073,
7,
1136,
62,
37266,
7,
45,
15,
4008,
198,
45,
16,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
17,
796,
2191,
35393,
7,
10782,
26,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
18,
796,
15062,
11347,
49925,
39,
12394,
7,
10782,
11,
299,
62,
30342,
26,
9943,
1133,
2625,
12853,
1600,
2604,
15255,
28,
6404,
15255,
8,
198,
45,
796,
955,
9150,
7,
45,
16,
11,
399,
17,
11,
399,
18,
1776,
399,
13,
11813,
7,
25192,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
4008,
198,
138,
116,
796,
2769,
30073,
7,
1136,
62,
37266,
7,
45,
4008,
198,
55,
796,
43720,
77,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
8,
198,
198,
2,
350,
861,
5945,
341,
357,
11265,
1143,
8,
198,
67,
138,
116,
796,
7377,
116,
12,
138,
116,
15,
26,
288,
138,
116,
764,
9,
28,
2593,
12195,
138,
116,
15,
737,
29006,
27237,
12195,
67,
138,
116,
737,
10,
16,
69,
12,
940,
8,
198,
67,
55,
796,
43720,
77,
7,
43879,
2624,
11,
299,
87,
11,
299,
88,
11,
299,
66,
11,
15458,
7857,
1776,
288,
55,
1635,
28,
2593,
7,
55,
20679,
27237,
7,
67,
55,
8,
198,
198,
2,
12806,
666,
5418,
198,
67,
56,
11,
575,
11,
4808,
11,
4808,
796,
399,
13,
30482,
672,
666,
7,
67,
55,
11,
288,
138,
116,
11,
1395,
8,
198,
198,
2,
6208,
198,
4798,
7203,
59,
77,
46751,
666,
1332,
59,
77,
4943,
198,
71,
796,
657,
13,
16,
69,
15,
198,
9806,
2676,
796,
642,
198,
8056,
20,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
8056,
21,
796,
1976,
27498,
7,
43879,
2624,
11,
3509,
2676,
8,
198,
1640,
474,
28,
16,
25,
9806,
2676,
198,
220,
220,
220,
900,
62,
37266,
0,
7,
45,
11,
7377,
116,
10,
71,
9,
67,
138,
116,
8,
198,
220,
220,
220,
575,
62,
17946,
11,
4808,
796,
399,
13,
11813,
7,
55,
10,
71,
9,
67,
55,
8,
198,
220,
220,
220,
11454,
20,
58,
73,
60,
796,
2593,
7,
56,
62,
17946,
532,
575,
8,
198,
220,
220,
220,
11454,
21,
58,
73,
60,
796,
2593,
7,
56,
62,
17946,
532,
575,
532,
289,
9,
67,
56,
8,
198,
220,
220,
220,
3601,
7,
8056,
20,
58,
73,
4357,
366,
26,
33172,
11454,
21,
58,
73,
4357,
37082,
77,
4943,
198,
220,
220,
220,
3298,
289,
796,
289,
14,
17,
69,
15,
198,
437,
198,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
20,
58,
437,
60,
1220,
357,
8056,
20,
58,
16,
60,
14,
17,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
198,
31,
9288,
318,
1324,
13907,
7,
8056,
21,
58,
437,
60,
1220,
357,
8056,
21,
58,
16,
60,
14,
19,
61,
7,
9806,
2676,
12,
16,
36911,
352,
69,
15,
26,
379,
349,
28,
16,
69,
16,
8,
198,
198,
2,
1215,
73,
1563,
1332,
198,
198,
2617,
62,
37266,
0,
7,
45,
11,
7377,
116,
8,
198,
67,
56,
11,
575,
11,
4808,
11,
4808,
796,
399,
13,
30482,
672,
666,
7,
67,
55,
11,
288,
138,
116,
11,
1395,
8,
198,
67,
56,
62,
796,
43720,
77,
7,
43879,
2624,
11,
2546,
7,
67,
56,
4008,
198,
67,
55,
62,
11,
288,
138,
116,
62,
11,
4808,
11,
4808,
796,
399,
13,
41255,
1563,
46751,
666,
7,
67,
56,
62,
11,
575,
8,
198,
64,
796,
16605,
7,
67,
56,
11,
288,
56,
62,
8,
198,
65,
796,
16605,
7,
67,
55,
11,
288,
55,
62,
47762,
26518,
7,
67,
138,
116,
11,
288,
138,
116,
62,
8,
198,
31,
9288,
318,
1324,
13907,
7,
64,
11,
275,
26,
374,
83,
349,
28,
16,
69,
12,
18,
8
] | 2.178586 | 2,447 |
# introduce embedding between matrices (vectors) of different dimensions
"""
mat_embed(X, dim; zero_pos = -1, tpin = "her", tpout = "her")
This function embeds X into new dimensions dim, with the Cartesian
order of the entries are preserved. Fill in zeros at zero_pos if necessary.
# Arguments
- `X`: a Hermitian or rectangular matrice
- `dim`: target dimension, array-like [Nnew,Mnew]
- `zero_pos`: an array of user specify Cartesian position for zeros. if
it is -1, then use randomly generated position.
- `tpin`: the type of input matrix, valid options are "her" and "rec".
- `tpout`: the type of ouput matrix, valid options are "her" and "rec"
# Outputs
- `Xnew`: a matrix of dimension dim and the type tpin. The entries
Xnew are from X, with possible extra zeros at zero_pos,
"""
function mat_embed(X, dim; zero_pos = -1, tpin = "her", tpout = "her")
# get the original dimension
X = X[:,:]
N, M = size(X)
# get the target dimension
Nnew, Mnew = dim
# check the input dimension if mat is Hermitian
if (tpin == "her") & (N != M)
error("Input dimension is not for a Hermitian matrix!")
end
# reshape X into vector according to type in
if tpin == "her"
in_size = N*(N + 1)/2
Xvec = [X[i,j] for i=1:N for j=i:N]
elseif tpin == "rec"
in_size = N*M
Xvec = vec(X)
end
# check whether there is enough room in the target shape
if tpout == "her"
out_size = Int((Nnew - 1)*Nnew/2)
elseif tpout == "rec"
out_size = Nnew*Mnew
end
if out_size < in_size
error("The target dimension is too small!")
end
# if the position of zeros are not preset, generate one
if zero_pos == -1
zero_pos = sample(1:out_size, out_size - in_size, replace=false)
end
# Construct Xnewvec
Xnewvec = zeros(out_size)
Xnewvec[[i for i in 1: out_size if ~(i in zero_pos)]] = Xvec
# reshape Xnewvec to Xnew
if tpout == "her"
k = 0
Xnew = [i < j ? (k += 1; Xnewvec[k]) : 0 for i = 1: Nnew, j = 1: Mnew]
Xnew = Xnew + Xnew'
elseif tpout == "rec"
Xnew = reshape(Xnewvec, (Nnew, Mnew))
end
return convert(Array{typeof(X[1,1]), 2}, Xnew)
end | [
2,
10400,
11525,
12083,
1022,
2603,
45977,
357,
303,
5217,
8,
286,
1180,
15225,
198,
198,
37811,
198,
220,
220,
220,
2603,
62,
20521,
7,
55,
11,
5391,
26,
6632,
62,
1930,
796,
532,
16,
11,
256,
11635,
796,
366,
372,
1600,
256,
79,
448,
796,
366,
372,
4943,
198,
198,
1212,
2163,
11525,
82,
1395,
656,
649,
15225,
5391,
11,
351,
262,
13690,
35610,
198,
2875,
286,
262,
12784,
389,
17232,
13,
27845,
287,
1976,
27498,
379,
6632,
62,
1930,
611,
3306,
13,
220,
220,
198,
198,
2,
20559,
2886,
220,
220,
220,
220,
220,
220,
220,
198,
12,
220,
220,
4600,
55,
63,
25,
257,
2332,
2781,
666,
393,
36954,
2603,
20970,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
12,
220,
220,
4600,
27740,
63,
25,
2496,
15793,
11,
7177,
12,
2339,
685,
45,
3605,
11,
44,
3605,
60,
198,
12,
220,
220,
4600,
22570,
62,
1930,
63,
25,
281,
7177,
286,
2836,
11986,
13690,
35610,
2292,
329,
1976,
27498,
13,
611,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
340,
318,
532,
16,
11,
788,
779,
15456,
7560,
2292,
13,
198,
12,
220,
220,
4600,
83,
11635,
63,
25,
262,
2099,
286,
5128,
17593,
11,
4938,
3689,
389,
366,
372,
1,
290,
366,
8344,
1911,
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,
12,
220,
220,
4600,
34788,
448,
63,
25,
262,
2099,
286,
267,
929,
315,
17593,
11,
4938,
3689,
389,
366,
372,
1,
290,
366,
8344,
1,
198,
220,
220,
220,
220,
220,
220,
198,
2,
25235,
82,
220,
220,
220,
220,
220,
198,
12,
220,
220,
4600,
55,
3605,
63,
25,
257,
17593,
286,
15793,
5391,
290,
262,
2099,
256,
11635,
13,
383,
12784,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1395,
3605,
389,
422,
1395,
11,
351,
1744,
3131,
1976,
27498,
379,
6632,
62,
1930,
11,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
37811,
198,
8818,
2603,
62,
20521,
7,
55,
11,
5391,
26,
6632,
62,
1930,
796,
532,
16,
11,
256,
11635,
796,
366,
372,
1600,
256,
79,
448,
796,
366,
372,
4943,
628,
220,
220,
220,
1303,
651,
262,
2656,
15793,
198,
220,
220,
220,
1395,
796,
1395,
58,
45299,
47715,
198,
220,
220,
220,
399,
11,
337,
796,
2546,
7,
55,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
651,
262,
2496,
15793,
198,
220,
220,
220,
399,
3605,
11,
337,
3605,
796,
5391,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
2198,
262,
5128,
15793,
611,
2603,
318,
2332,
2781,
666,
198,
220,
220,
220,
611,
357,
83,
11635,
6624,
366,
372,
4943,
1222,
357,
45,
14512,
337,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
20560,
15793,
318,
407,
329,
257,
2332,
2781,
666,
17593,
2474,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
27179,
1758,
1395,
656,
15879,
1864,
284,
2099,
287,
198,
220,
220,
220,
611,
256,
11635,
6624,
366,
372,
1,
198,
220,
220,
220,
220,
220,
220,
220,
287,
62,
7857,
796,
399,
9,
7,
45,
1343,
352,
20679,
17,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
35138,
796,
685,
55,
58,
72,
11,
73,
60,
329,
1312,
28,
16,
25,
45,
329,
474,
28,
72,
25,
45,
60,
198,
220,
220,
220,
2073,
361,
256,
11635,
6624,
366,
8344,
1,
198,
220,
220,
220,
220,
220,
220,
220,
287,
62,
7857,
796,
399,
9,
44,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
35138,
796,
43030,
7,
55,
8,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
2198,
1771,
612,
318,
1576,
2119,
287,
262,
2496,
5485,
198,
220,
220,
220,
611,
256,
79,
448,
6624,
366,
372,
1,
198,
220,
220,
220,
220,
220,
220,
220,
503,
62,
7857,
796,
2558,
19510,
45,
3605,
532,
352,
27493,
45,
3605,
14,
17,
8,
198,
220,
220,
220,
2073,
361,
256,
79,
448,
6624,
366,
8344,
1,
198,
220,
220,
220,
220,
220,
220,
220,
503,
62,
7857,
796,
399,
3605,
9,
44,
3605,
198,
220,
220,
220,
886,
628,
220,
220,
220,
611,
503,
62,
7857,
1279,
287,
62,
7857,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
464,
2496,
15793,
318,
1165,
1402,
2474,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
611,
262,
2292,
286,
1976,
27498,
389,
407,
38266,
11,
7716,
530,
198,
220,
220,
220,
611,
6632,
62,
1930,
6624,
532,
16,
198,
220,
220,
220,
220,
220,
220,
220,
6632,
62,
1930,
796,
6291,
7,
16,
25,
448,
62,
7857,
11,
503,
62,
7857,
532,
287,
62,
7857,
11,
6330,
28,
9562,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
198,
220,
220,
220,
1303,
28407,
1395,
3605,
35138,
198,
220,
220,
220,
1395,
3605,
35138,
796,
1976,
27498,
7,
448,
62,
7857,
8,
198,
220,
220,
220,
1395,
3605,
35138,
30109,
72,
329,
1312,
287,
352,
25,
503,
62,
7857,
611,
5299,
7,
72,
287,
6632,
62,
1930,
8,
11907,
796,
1395,
35138,
628,
220,
220,
220,
1303,
27179,
1758,
1395,
3605,
35138,
284,
1395,
3605,
198,
220,
220,
220,
611,
256,
79,
448,
6624,
366,
372,
1,
198,
220,
220,
220,
220,
220,
220,
220,
479,
796,
657,
220,
220,
220,
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,
1395,
3605,
796,
685,
72,
1279,
474,
5633,
357,
74,
15853,
352,
26,
1395,
3605,
35138,
58,
74,
12962,
1058,
657,
329,
1312,
796,
352,
25,
399,
3605,
11,
474,
796,
352,
25,
337,
3605,
60,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
3605,
796,
1395,
3605,
1343,
1395,
3605,
6,
198,
220,
220,
220,
2073,
361,
256,
79,
448,
6624,
366,
8344,
1,
198,
220,
220,
220,
220,
220,
220,
220,
1395,
3605,
796,
27179,
1758,
7,
55,
3605,
35138,
11,
357,
45,
3605,
11,
337,
3605,
4008,
198,
220,
220,
220,
886,
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,
198,
220,
220,
220,
1441,
10385,
7,
19182,
90,
4906,
1659,
7,
55,
58,
16,
11,
16,
46570,
362,
5512,
1395,
3605,
8,
198,
437
] | 2.162544 | 1,132 |
using BayesianMixtures
using Statistics
n_total = 1000 # total number of MCMC sweeps to run
# _____________________________________________________________________________________
# Check samplers on univariate data
n = 50
x = randn(n)
for mode_ in ["Normal","NormalNonoptimized"]
for model_type_ in ["MFM","DPM"]
# Run MCMC sampler
options = BayesianMixtures.options(mode_,model_type_,x,n_total)
result = BayesianMixtures.run_sampler(options)
end
end
# _____________________________________________________________________________________
# Check samplers on multivariate data
d = 3
n = 50
x = randn(n,d)
x = (x .- mean(x,dims=1))./std(x,dims=1; corrected=false)
x = [x[i,:] for i=1:n]
for mode_ in ["MVN","MVNaaC","MVNaaN","MVNaaRJ"]
for model_type_ in ["MFM","DPM"]
if model_type_=="DPM" && mode_=="MVNaaRJ"; continue; end
# Run MCMC sampler
options = BayesianMixtures.options(mode_,model_type_,x,n_total)
result = BayesianMixtures.run_sampler(options)
end
end
# _____________________________________________________________________________________
# Check other functions using univariate data
# Settings
mode = "Normal"
model_type = "MFM"
n = 100
B = BayesianMixtures
# Generate data and run sampler
x = randn(n)
options = B.options(mode,model_type,x,n_total)
result = B.run_sampler(options)
# Save and load
B.save_result("temp.jld",result)
result2 = B.load_result("temp.jld")
B.t_running(result)
B.t_posterior(result)
B.k_posterior(result)
B.plot_density_estimate(result)
k,a,w,theta = B.sample_mixture_parameters(result,50)
loglik = B.log_likelihoods(x,w,theta,mode)
B.open_figure(1)
B.traceplot(result.t); P.pause(0.5); P.clf()
B.traceplot_timewise(result,1); P.pause(0.5); P.clf()
B.plot_t_running(result); P.pause(0.5); P.clf()
B.plot_autocorrelation(result,20); P.pause(0.5); P.clf()
B.plot_t_posterior(result); P.pause(0.5); P.clf()
B.plot_t_posterior_average([result]); P.pause(0.5); P.clf()
B.plot_k_posterior(result); P.pause(0.5); P.clf()
B.plot_k_posterior_average([result]); P.pause(0.5); P.clf()
B.plot_similarity_matrix(result); P.pause(0.5); P.clf()
B.plot_clusters(x,result.z[:,end]); P.pause(0.5); P.clf()
B.rug_plot(x); P.pause(0.5); P.clf()
B.plot_density_estimate(result); P.pause(0.5); P.clf()
# _____________________________________________________________________________________
# Check other functions using multivariate data
# Settings
mode = "MVN"
model_type = "MFM"
d = 2
n = 100
B = BayesianMixtures
# Generate data and run sampler
x = randn(n,d)
x = (x .- mean(x,dims=1))./std(x,dims=1; corrected=false)
x = [x[i,:] for i=1:n]
options = B.options(mode,model_type,x,n_total)
result = B.run_sampler(options)
# Save and load
B.save_result("temp.jld",result)
result2 = B.load_result("temp.jld")
B.t_running(result)
B.t_posterior(result)
B.k_posterior(result)
B.plot_density_estimate(result)
k,a,w,theta = B.sample_mixture_parameters(result,50)
loglik = B.log_likelihoods(x,w,theta,mode)
B.open_figure(1)
B.traceplot(result.t); P.pause(0.5); P.clf()
B.traceplot_timewise(result,1); P.pause(0.5); P.clf()
B.plot_t_running(result); P.pause(0.5); P.clf()
B.plot_autocorrelation(result,20); P.pause(0.5); P.clf()
B.plot_t_posterior(result); P.pause(0.5); P.clf()
B.plot_t_posterior_average([result]); P.pause(0.5); P.clf()
B.plot_k_posterior(result); P.pause(0.5); P.clf()
B.plot_k_posterior_average([result]); P.pause(0.5); P.clf()
B.plot_similarity_matrix(result); P.pause(0.5); P.clf()
B.plot_clusters(x,result.z[:,end]); P.pause(0.5); P.clf()
B.plot_density_estimate(result); P.pause(0.5); P.clf()
| [
198,
198,
3500,
4696,
35610,
44,
25506,
198,
3500,
14370,
198,
198,
77,
62,
23350,
796,
8576,
220,
1303,
2472,
1271,
286,
13122,
9655,
46778,
284,
1057,
628,
198,
2,
220,
27193,
4841,
29343,
198,
2,
6822,
6072,
489,
364,
319,
555,
42524,
1366,
198,
198,
77,
796,
2026,
198,
87,
796,
43720,
77,
7,
77,
8,
198,
1640,
4235,
62,
287,
14631,
26447,
2430,
26447,
15419,
40085,
1143,
8973,
198,
197,
1640,
2746,
62,
4906,
62,
287,
14631,
44,
23264,
2430,
35,
5868,
8973,
198,
197,
197,
2,
5660,
13122,
9655,
6072,
20053,
198,
197,
197,
25811,
796,
4696,
35610,
44,
25506,
13,
25811,
7,
14171,
62,
11,
19849,
62,
4906,
62,
11,
87,
11,
77,
62,
23350,
8,
198,
197,
197,
20274,
796,
4696,
35610,
44,
25506,
13,
5143,
62,
37687,
20053,
7,
25811,
8,
198,
197,
437,
198,
437,
628,
198,
2,
220,
27193,
4841,
29343,
198,
2,
6822,
6072,
489,
364,
319,
1963,
42524,
1366,
198,
198,
67,
796,
513,
198,
77,
796,
2026,
198,
87,
796,
43720,
77,
7,
77,
11,
67,
8,
198,
87,
796,
357,
87,
764,
12,
1612,
7,
87,
11,
67,
12078,
28,
16,
29720,
14,
19282,
7,
87,
11,
67,
12078,
28,
16,
26,
19267,
28,
9562,
8,
198,
87,
796,
685,
87,
58,
72,
11,
47715,
329,
1312,
28,
16,
25,
77,
60,
198,
1640,
4235,
62,
287,
14631,
44,
53,
45,
2430,
44,
53,
45,
7252,
34,
2430,
44,
53,
45,
7252,
45,
2430,
44,
53,
45,
7252,
49,
41,
8973,
198,
197,
1640,
2746,
62,
4906,
62,
287,
14631,
44,
23264,
2430,
35,
5868,
8973,
198,
197,
197,
361,
2746,
62,
4906,
62,
855,
1,
35,
5868,
1,
11405,
4235,
62,
855,
1,
44,
53,
45,
7252,
49,
41,
8172,
2555,
26,
886,
198,
197,
197,
2,
5660,
13122,
9655,
6072,
20053,
198,
197,
197,
25811,
796,
4696,
35610,
44,
25506,
13,
25811,
7,
14171,
62,
11,
19849,
62,
4906,
62,
11,
87,
11,
77,
62,
23350,
8,
198,
197,
197,
20274,
796,
4696,
35610,
44,
25506,
13,
5143,
62,
37687,
20053,
7,
25811,
8,
198,
197,
437,
198,
437,
628,
198,
198,
2,
220,
27193,
4841,
29343,
198,
2,
6822,
584,
5499,
1262,
555,
42524,
1366,
198,
198,
2,
16163,
198,
14171,
796,
366,
26447,
1,
198,
19849,
62,
4906,
796,
366,
44,
23264,
1,
198,
77,
796,
1802,
198,
33,
796,
4696,
35610,
44,
25506,
198,
198,
2,
2980,
378,
1366,
290,
1057,
6072,
20053,
198,
87,
796,
43720,
77,
7,
77,
8,
198,
25811,
796,
347,
13,
25811,
7,
14171,
11,
19849,
62,
4906,
11,
87,
11,
77,
62,
23350,
8,
198,
20274,
796,
347,
13,
5143,
62,
37687,
20053,
7,
25811,
8,
198,
198,
2,
12793,
290,
3440,
198,
33,
13,
21928,
62,
20274,
7203,
29510,
13,
73,
335,
1600,
20274,
8,
198,
20274,
17,
796,
347,
13,
2220,
62,
20274,
7203,
29510,
13,
73,
335,
4943,
198,
198,
33,
13,
83,
62,
20270,
7,
20274,
8,
198,
33,
13,
83,
62,
79,
6197,
1504,
7,
20274,
8,
198,
33,
13,
74,
62,
79,
6197,
1504,
7,
20274,
8,
198,
198,
33,
13,
29487,
62,
43337,
62,
395,
1920,
7,
20274,
8,
628,
198,
74,
11,
64,
11,
86,
11,
1169,
8326,
796,
347,
13,
39873,
62,
76,
9602,
62,
17143,
7307,
7,
20274,
11,
1120,
8,
198,
6404,
46965,
796,
347,
13,
6404,
62,
2339,
11935,
82,
7,
87,
11,
86,
11,
1169,
8326,
11,
14171,
8,
198,
198,
33,
13,
9654,
62,
26875,
7,
16,
8,
198,
33,
13,
40546,
29487,
7,
20274,
13,
83,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
40546,
29487,
62,
16514,
413,
786,
7,
20274,
11,
16,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
20270,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
2306,
420,
273,
49501,
7,
20274,
11,
1238,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
79,
6197,
1504,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
79,
6197,
1504,
62,
23913,
26933,
20274,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
74,
62,
79,
6197,
1504,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
74,
62,
79,
6197,
1504,
62,
23913,
26933,
20274,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
38610,
414,
62,
6759,
8609,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
565,
13654,
7,
87,
11,
20274,
13,
89,
58,
45299,
437,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
2143,
62,
29487,
7,
87,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
43337,
62,
395,
1920,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
628,
198,
198,
2,
220,
27193,
4841,
29343,
198,
2,
6822,
584,
5499,
1262,
1963,
42524,
1366,
628,
198,
2,
16163,
198,
14171,
796,
366,
44,
53,
45,
1,
198,
19849,
62,
4906,
796,
366,
44,
23264,
1,
198,
67,
796,
362,
198,
77,
796,
1802,
198,
33,
796,
4696,
35610,
44,
25506,
198,
198,
2,
2980,
378,
1366,
290,
1057,
6072,
20053,
198,
87,
796,
43720,
77,
7,
77,
11,
67,
8,
198,
87,
796,
357,
87,
764,
12,
1612,
7,
87,
11,
67,
12078,
28,
16,
29720,
14,
19282,
7,
87,
11,
67,
12078,
28,
16,
26,
19267,
28,
9562,
8,
198,
87,
796,
685,
87,
58,
72,
11,
47715,
329,
1312,
28,
16,
25,
77,
60,
198,
25811,
796,
347,
13,
25811,
7,
14171,
11,
19849,
62,
4906,
11,
87,
11,
77,
62,
23350,
8,
198,
20274,
796,
347,
13,
5143,
62,
37687,
20053,
7,
25811,
8,
198,
198,
2,
12793,
290,
3440,
198,
33,
13,
21928,
62,
20274,
7203,
29510,
13,
73,
335,
1600,
20274,
8,
198,
20274,
17,
796,
347,
13,
2220,
62,
20274,
7203,
29510,
13,
73,
335,
4943,
198,
198,
33,
13,
83,
62,
20270,
7,
20274,
8,
198,
33,
13,
83,
62,
79,
6197,
1504,
7,
20274,
8,
198,
33,
13,
74,
62,
79,
6197,
1504,
7,
20274,
8,
198,
198,
33,
13,
29487,
62,
43337,
62,
395,
1920,
7,
20274,
8,
628,
198,
74,
11,
64,
11,
86,
11,
1169,
8326,
796,
347,
13,
39873,
62,
76,
9602,
62,
17143,
7307,
7,
20274,
11,
1120,
8,
198,
6404,
46965,
796,
347,
13,
6404,
62,
2339,
11935,
82,
7,
87,
11,
86,
11,
1169,
8326,
11,
14171,
8,
628,
198,
33,
13,
9654,
62,
26875,
7,
16,
8,
198,
33,
13,
40546,
29487,
7,
20274,
13,
83,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
40546,
29487,
62,
16514,
413,
786,
7,
20274,
11,
16,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
20270,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
2306,
420,
273,
49501,
7,
20274,
11,
1238,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
79,
6197,
1504,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
83,
62,
79,
6197,
1504,
62,
23913,
26933,
20274,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
74,
62,
79,
6197,
1504,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
74,
62,
79,
6197,
1504,
62,
23913,
26933,
20274,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
38610,
414,
62,
6759,
8609,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
565,
13654,
7,
87,
11,
20274,
13,
89,
58,
45299,
437,
36563,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
198,
33,
13,
29487,
62,
43337,
62,
395,
1920,
7,
20274,
1776,
350,
13,
32125,
7,
15,
13,
20,
1776,
350,
13,
565,
69,
3419,
628,
628,
628,
628,
198
] | 2.428281 | 1,478 |
function Kprec( pw_grid::PWGrid, psi::Array{ComplexF64,2} )
Ncol = size(psi)[2]
G2 = pw_grid.G2
Npoints = pw_grid.Npoints
Kpsi = zeros( ComplexF64, size(psi) )
for ic = 1:Ncol
for ip = 1:Npoints
Kpsi[ip,ic] = psi[ip,ic] / ( 1.0 + G2[ip] )
end
end
return Kpsi
end
function Kprec(psi)
return psi
end
| [
8818,
509,
3866,
66,
7,
279,
86,
62,
25928,
3712,
47,
54,
41339,
11,
46231,
3712,
19182,
90,
5377,
11141,
37,
2414,
11,
17,
92,
1267,
198,
220,
220,
220,
399,
4033,
796,
2546,
7,
862,
72,
38381,
17,
60,
198,
220,
220,
220,
402,
17,
796,
279,
86,
62,
25928,
13,
38,
17,
198,
220,
220,
220,
399,
13033,
796,
279,
86,
62,
25928,
13,
45,
13033,
198,
220,
220,
220,
509,
862,
72,
796,
1976,
27498,
7,
19157,
37,
2414,
11,
2546,
7,
862,
72,
8,
1267,
198,
220,
220,
220,
329,
14158,
796,
352,
25,
45,
4033,
198,
220,
220,
220,
220,
220,
220,
220,
329,
20966,
796,
352,
25,
45,
13033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
509,
862,
72,
58,
541,
11,
291,
60,
796,
46231,
58,
541,
11,
291,
60,
1220,
357,
352,
13,
15,
1343,
402,
17,
58,
541,
60,
1267,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
509,
862,
72,
198,
437,
198,
198,
8818,
509,
3866,
66,
7,
862,
72,
8,
198,
220,
1441,
46231,
198,
437,
198
] | 1.839378 | 193 |
#!/usr/bin/env julia
# test polygon simplification
using Luxor
using Test
using Random
Random.seed!(42)
function sinecurves()
gsave()
translate(100, 100)
setline(0.25)
sethue(0, 0, 0)
x_vals = collect(0:pi/180: 40pi)
# generate array of Points
plist = [Point(d * 2pi , -sin(d) * cos(20 * d) * 8 * sin(d/10)) for d in x_vals]
prettypoly(plist, :stroke, () -> (gsave(); randomhue(); circle(O, 0.5, :stroke); grestore()))
text("original " * string(length(plist)) * " vertices" , 0, -15)
for detail in [0.01, 0.05, 0.1, 0.2, 0.5, 0.75, 1.0, 2.0]
translate(0, 50)
simplified = simplify(plist, detail)
prettypoly(simplified, :stroke, () -> (gsave(); randomhue(); circle(O, 0.5, :stroke); grestore()))
text("detail $(detail), " * string(length(simplified)) * " vertices" , 0, -15)
end
grestore()
end
function test(pagewidth, pageheight)
translate(100, pageheight/2)
g = GridRect(O, 0, 60)
setline(0.25)
sethue(0, 0, 0)
x_vals = collect(0:pi/100: 4pi)
polyline = [Point(d * 20pi, 5 * -sin(d) * cos(12 * d) * 8 * sin(d/10)) for d in x_vals]
poly(polyline, :stroke)
prettypoly(polyline)
text("original " * string(length(polyline)) * " vertices" , 0, -30)
for detail in [0.01, 0.05, 0.075, 0.1, 0.2, 0.5, 0.75, 1.0, 2.0]
gsave()
translate(nextgridpoint(g))
polysimple = simplify(polyline, detail)
prettypoly(polysimple, :stroke, () -> (gsave(); randomhue(); circle(O, 2, :stroke); grestore()))
text(" detail ($detail), " * string(length(polysimple)) * " vertices" , 0, -20)
grestore()
end
end
function simplify_poly(fname)
pagewidth = 1190.0 # points
pageheight = 1684.0 # points
Drawing(pagewidth, pageheight, fname)
sinecurves()
test(pagewidth, pageheight)
@test finish() == true
println("...finished test: output in $(fname)")
end
function simplify_square()
poly = Point[Point(-1.0, 0.0), Point(-1.0, -1.0), Point(0.0, -1.0), Point(1.0, -1.0), Point(1.0, 0.0), Point(1.0, 1.0), Point(0.0, 1.0), Point(-1.0, 1.0)]
poly = simplify(poly, 0.01)
@test poly == Point[Point(-1.0, 0.0), Point(-1.0, -1.0), Point(1.0, -1.0), Point(1.0, 1.0), Point(-1.0, 1.0)]
end
simplify_poly("simplify-poly.pdf")
simplify_square()
| [
2,
48443,
14629,
14,
8800,
14,
24330,
474,
43640,
198,
198,
2,
1332,
7514,
14520,
7106,
2649,
198,
198,
3500,
17145,
273,
198,
198,
3500,
6208,
198,
198,
3500,
14534,
198,
29531,
13,
28826,
0,
7,
3682,
8,
198,
198,
8818,
264,
500,
22019,
1158,
3419,
198,
220,
220,
220,
308,
21928,
3419,
198,
220,
220,
220,
15772,
7,
3064,
11,
1802,
8,
198,
220,
220,
220,
900,
1370,
7,
15,
13,
1495,
8,
198,
220,
220,
220,
900,
71,
518,
7,
15,
11,
657,
11,
657,
8,
198,
220,
220,
220,
2124,
62,
12786,
796,
2824,
7,
15,
25,
14415,
14,
15259,
25,
2319,
14415,
8,
198,
220,
220,
220,
1303,
7716,
7177,
286,
11045,
198,
220,
220,
220,
458,
396,
796,
685,
12727,
7,
67,
1635,
362,
14415,
837,
532,
31369,
7,
67,
8,
1635,
8615,
7,
1238,
1635,
288,
8,
1635,
807,
1635,
7813,
7,
67,
14,
940,
4008,
329,
288,
287,
2124,
62,
12786,
60,
198,
220,
220,
220,
2495,
35428,
7,
489,
396,
11,
1058,
30757,
11,
7499,
4613,
357,
14542,
1015,
9783,
4738,
71,
518,
9783,
9197,
7,
46,
11,
657,
13,
20,
11,
1058,
30757,
1776,
308,
2118,
382,
3419,
4008,
198,
220,
220,
220,
2420,
7203,
14986,
366,
1635,
4731,
7,
13664,
7,
489,
396,
4008,
1635,
366,
9421,
1063,
1,
837,
657,
11,
532,
1314,
8,
198,
220,
220,
220,
329,
3703,
287,
685,
15,
13,
486,
11,
657,
13,
2713,
11,
657,
13,
16,
11,
657,
13,
17,
11,
657,
13,
20,
11,
657,
13,
2425,
11,
352,
13,
15,
11,
362,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
15772,
7,
15,
11,
2026,
8,
198,
220,
220,
220,
220,
220,
220,
220,
27009,
796,
30276,
7,
489,
396,
11,
3703,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2495,
35428,
7,
14323,
489,
1431,
11,
1058,
30757,
11,
7499,
4613,
357,
14542,
1015,
9783,
4738,
71,
518,
9783,
9197,
7,
46,
11,
657,
13,
20,
11,
1058,
30757,
1776,
308,
2118,
382,
3419,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
7203,
49170,
220,
29568,
49170,
828,
366,
1635,
4731,
7,
13664,
7,
14323,
489,
1431,
4008,
1635,
366,
9421,
1063,
1,
837,
657,
11,
532,
1314,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
308,
2118,
382,
3419,
198,
437,
198,
198,
8818,
1332,
7,
79,
363,
413,
5649,
11,
2443,
17015,
8,
198,
220,
220,
220,
15772,
7,
3064,
11,
2443,
17015,
14,
17,
8,
198,
220,
220,
220,
308,
796,
24846,
45474,
7,
46,
11,
657,
11,
3126,
8,
198,
220,
220,
220,
900,
1370,
7,
15,
13,
1495,
8,
198,
220,
220,
220,
900,
71,
518,
7,
15,
11,
657,
11,
657,
8,
198,
220,
220,
220,
2124,
62,
12786,
796,
2824,
7,
15,
25,
14415,
14,
3064,
25,
604,
14415,
8,
198,
220,
220,
220,
7514,
1370,
796,
685,
12727,
7,
67,
1635,
1160,
14415,
11,
642,
1635,
532,
31369,
7,
67,
8,
1635,
8615,
7,
1065,
1635,
288,
8,
1635,
807,
1635,
7813,
7,
67,
14,
940,
4008,
329,
288,
287,
2124,
62,
12786,
60,
198,
220,
220,
220,
7514,
7,
35428,
1370,
11,
1058,
30757,
8,
198,
220,
220,
220,
2495,
35428,
7,
35428,
1370,
8,
198,
220,
220,
220,
2420,
7203,
14986,
366,
1635,
4731,
7,
13664,
7,
35428,
1370,
4008,
1635,
366,
9421,
1063,
1,
837,
657,
11,
532,
1270,
8,
198,
220,
220,
220,
329,
3703,
287,
685,
15,
13,
486,
11,
657,
13,
2713,
11,
657,
13,
46396,
11,
657,
13,
16,
11,
657,
13,
17,
11,
657,
13,
20,
11,
657,
13,
2425,
11,
352,
13,
15,
11,
362,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
308,
21928,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
15772,
7,
19545,
25928,
4122,
7,
70,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
7514,
36439,
796,
30276,
7,
35428,
1370,
11,
3703,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2495,
35428,
7,
35428,
36439,
11,
1058,
30757,
11,
7499,
4613,
357,
14542,
1015,
9783,
4738,
71,
518,
9783,
9197,
7,
46,
11,
362,
11,
1058,
30757,
1776,
308,
2118,
382,
3419,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
2420,
7203,
3703,
7198,
49170,
828,
366,
1635,
4731,
7,
13664,
7,
35428,
36439,
4008,
1635,
366,
9421,
1063,
1,
837,
657,
11,
532,
1238,
8,
198,
220,
220,
220,
220,
220,
220,
220,
308,
2118,
382,
3419,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
30276,
62,
35428,
7,
69,
3672,
8,
198,
220,
220,
220,
42208,
413,
5649,
220,
796,
15136,
15,
13,
15,
1303,
1849,
13033,
198,
220,
220,
220,
2443,
17015,
796,
1467,
5705,
13,
15,
1303,
2173,
198,
220,
220,
220,
40027,
7,
79,
363,
413,
5649,
11,
2443,
17015,
11,
277,
3672,
8,
198,
220,
220,
220,
264,
500,
22019,
1158,
3419,
198,
220,
220,
220,
1332,
7,
79,
363,
413,
5649,
11,
2443,
17015,
8,
198,
220,
220,
220,
2488,
9288,
5461,
3419,
6624,
2081,
198,
220,
220,
220,
44872,
7203,
986,
43952,
1332,
25,
5072,
287,
29568,
69,
3672,
8,
4943,
198,
437,
198,
198,
8818,
30276,
62,
23415,
3419,
198,
220,
220,
220,
7514,
796,
6252,
58,
12727,
32590,
16,
13,
15,
11,
657,
13,
15,
828,
6252,
32590,
16,
13,
15,
11,
532,
16,
13,
15,
828,
6252,
7,
15,
13,
15,
11,
532,
16,
13,
15,
828,
6252,
7,
16,
13,
15,
11,
532,
16,
13,
15,
828,
6252,
7,
16,
13,
15,
11,
657,
13,
15,
828,
6252,
7,
16,
13,
15,
11,
352,
13,
15,
828,
6252,
7,
15,
13,
15,
11,
352,
13,
15,
828,
6252,
32590,
16,
13,
15,
11,
352,
13,
15,
15437,
628,
220,
220,
220,
7514,
796,
30276,
7,
35428,
11,
657,
13,
486,
8,
198,
220,
220,
220,
2488,
9288,
7514,
6624,
6252,
58,
12727,
32590,
16,
13,
15,
11,
657,
13,
15,
828,
6252,
32590,
16,
13,
15,
11,
532,
16,
13,
15,
828,
6252,
7,
16,
13,
15,
11,
532,
16,
13,
15,
828,
6252,
7,
16,
13,
15,
11,
352,
13,
15,
828,
6252,
32590,
16,
13,
15,
11,
352,
13,
15,
15437,
198,
437,
198,
198,
14323,
489,
1958,
62,
35428,
7203,
14323,
489,
1958,
12,
35428,
13,
12315,
4943,
198,
198,
14323,
489,
1958,
62,
23415,
3419,
198
] | 2.189266 | 1,062 |
using RBNF
using MLStyle
using PrettyPrint
@as_record Token
@as_record Struct_mainprogram
@as_record Struct_ifstmt
@as_record Struct_gate
@as_record Struct_gatedecl
@as_record Struct_decl
@as_record Struct_barrier_ids
@as_record Struct_reset
@as_record Struct_measure
@as_record Struct_iduop
@as_record Struct_u
@as_record Struct_cx
@as_record Struct_h
@as_record Struct_x
@as_record Struct_y
@as_record Struct_z
@as_record Struct_s
@as_record Struct_sdg
@as_record Struct_t
@as_record Struct_tdg
@as_record Struct_rx
@as_record Struct_ry
@as_record Struct_rz
@as_record Struct_ch
@as_record Struct_crx
@as_record Struct_cry
@as_record Struct_crz
@as_record Struct_idlist
@as_record Struct_mixedlist
@as_record Struct_argument
@as_record Struct_explist
@as_record Struct_pi
@as_record Struct_fnexp
@as_record Struct_neg
@as_record Struct_bin
function rec(ctx_tokens)
function app(op, args...)
args = map(rec, args)
op = Symbol(op)
:($op($(args...)))
end
@match ctx_tokens begin
Struct_pi(_) => Base.pi
Token{:id}(str=str) => Symbol(str)
Token{:nnreal}(str=str) => parse(Float64, str)
Token{:nninteger}(str=str) => parse(Int64, str)
Struct_neg(value=value) => :(-$(rec(value)))
Struct_bin(l=l, op=Token(str=op), r=r) => app(op, l, r)
Struct_idlist(hd=Token(str=hd), tl=nothing) => [Symbol(hd)]
Struct_idlist(hd=Token(str=hd), tl=tl) => [Symbol(hd), rec(tl)...]
Struct_explist(hd=hd, tl=nothing) => [rec(hd)]
Struct_explist(hd=hd, tl=tl) => [rec(hd), rec(tl)...]
Struct_mixedlist(hd=hd, tl=nothing) => [rec(hd)]
Struct_mixedlist(hd=hd, tl=tl) => [rec(hd), rec(tl)...]
Struct_argument(id=Token(str=id), arg=nothing) => Symbol(id)
Struct_argument(id=Token(str=id), arg=Token(str=int)) =>
let ind = parse(Int, int) + 1 # due to julia 1-based index
:($(Symbol(id))[$ind])
end
Struct_fnexp(fn = Token(str=fn), arg=arg) =>
let fn = @match fn begin
"sin" => sin
"cos" => cos
"tan" => tan
"exp" => exp
"ln" => log
"sqrt"=> sqrt
_ => error("not impl yet")
end
app(fn, arg)
end
_ => nothing
end
end
function trans_reg(ctx_tokens, qregs)
function app(op, args...)
args = map(rec, args)
op = Symbol(op)
:($op($(args...)))
end
@match ctx_tokens begin
Struct_decl(
regtype = Token(str=regtype),
id = Token(str=id),
int = Token(str = n)
) =>
let id = Symbol(id),
n = parse(Int, n)
return :($id = qreg($n); push!($qregs, $id))
end
Struct_mainprogram(
prog = stmts
) =>
let stmts = trans_reg.(stmts, qregs)
stmts
end
_ => nothing
end
end
function trans_gates(ctx_tokens, qasm_cgc, N)
function app(op, args...)
args = map(rec, args)
op = Symbol(op)
:($op($(args...)))
end
@match ctx_tokens begin
Struct_iduop(gate_name = Token(str=gate_name), args=nothing, outs=outs) =>
let refs = rec(outs),
gate_name = Symbol("custom_gate_"*gate_name)
:($gate_name(nothing, $(refs...); qasm_cgc=$qasm_cgc, N=$N))
end
Struct_iduop(gate_name = Token(str=gate_name), args=exprlist, outs=outs) =>
let refs = rec(outs),
exprs = Expr(:tuple, rec(exprlist)...),
gate_name = Symbol("custom_gate_"*gate_name)
:($gate_name($exprs, $(refs...); qasm_cgc=$qasm_cgc, N=$N))
end
Struct_cx(out1=out1, out2=out2) =>
let ref1 = rec(out1),
ref2 = rec(out2)
:(append!($qasm_cgc, [circuit_gate(($ref2), X, ($ref1))]))
end
Struct_ch(out1=out1, out2=out2) =>
let ref1 = rec(out1),
ref2 = rec(out2)
:(append!($qasm_cgc, [circuit_gate(($ref2), HadamardGate(), ($ref1))]))
end
Struct_u(in1=in1, in2=in2, in3=in3, out=out) =>
let (a, b, c) = map(rec, (in1, in2, in3)),
ref = :($(rec(out))[1])
:(append!($qasm_cgc, [circuit_gate(($ref), RzGate($a)),
circuit_gate(($ref), RyGate($b)),
circuit_gate(($ref), RzGate($c)),]))
end
Struct_x(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), X)]))
end
Struct_y(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), Y)]))
end
Struct_z(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), Z)]))
end
Struct_h(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), HadamardGate())]))
end
Struct_t(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), TGate())]))
end
Struct_tdg(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), TdagGate())]))
end
Struct_s(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), SGate())]))
end
Struct_sdg(out=out) =>
let ref = :($(rec(out)))
:(append!($qasm_cgc, [circuit_gate(($ref), SdagGate())]))
end
Struct_rx(in=in, out=out) =>
let ref = :($(rec(out))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($ref), RxGate($arg))]))
end
Struct_ry(in=in, out=out) =>
let ref = :($(rec(out))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($ref), RyGate($arg))]))
end
Struct_rz(in=in, out=out) =>
let ref = :($(rec(out))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($ref), RzGate($arg))]))
end
Struct_crx(in=in, out1=out1, out2=out2) =>
let out = :($(rec(out2))),
cntrl = :($(rec(out1))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($out), RxGate($arg), ($cntrl))]))
end
Struct_cry(in=in, out1=out1, out2=out2) =>
let out = :($(rec(out2))),
cntrl = :($(rec(out1))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($out), RyGate($arg), ($cntrl))]))
end
Struct_crz(in=in, out1=out1, out2=out2) =>
let out = :($(rec(out2))),
cntrl = :($(rec(out1))),
arg = :($(rec(in)))
:(append!($qasm_cgc, [circuit_gate(($out), RzGate($arg), ($cntrl))]))
end
Struct_gate(
decl = Struct_gatedecl(
id=Token(str=fid),
args=args,
outs=outs
),
goplist=goplist
) =>
let out_ids :: Vector{Symbol} = rec(outs),
fid = Symbol("custom_gate_"*fid),
args = rec(args),
goplist = trans_gates.(goplist, Ref(qasm_cgc), Ref(N))
if isnothing(goplist)
goplist=[]
end
if isnothing(args)
args=[]
end
quote
function $fid(($(args...), ), $(out_ids...); qasm_cgc=$qasm_cgc, N=$N)
$(goplist...)
end
end
end
# Struct_ifstmt(l=Token(str=l), r=r, gate_name=Token(str=gate_name), args=nothing, outs=outs) =>
# let l = Symbol(l),
# r = rec(r),
# refs = rec(outs),
# gate_name = Symbol("custom_gate_"*gate_name)
# :($gate_name(nothing, reg_check($l,$r), $(refs...); qasm_cgc=$qasm_cgc, N=$N))
# end
# Struct_ifstmt(l=Token(str=l), r=r, gate_name=Token(str=gate_name), args=exprlist, outs=outs) =>
# let l = Symbol(l),
# r = rec(r),
# refs = rec(outs),
# exprs = Expr(:tuple, rec(exprlist)...),
# gate_name = Symbol("custom_gate_"*gate_name)
# :($gate_name($exprs, reg_check($l,$r), $(refs...); qasm_cgc=$qasm_cgc, N=$N))
# end
Struct_mainprogram(
prog = stmts
) =>
let stmts = trans_gates.(stmts, qasm_cgc, N)
stmts
end
_ => nothing
end
end
function transform_qasm(ctx_tokens)
qregs = Qaintessent.QRegister[]
reg_declr = trans_reg(ctx_tokens, Ref(qregs))
eval.(reg_declr)
qasm_cgc = Circuit(qregs...)
N = num_wires(qasm_cgc)
gates_declr = trans_gates(ctx_tokens, Ref(qasm_cgc), Ref(N))
eval.(gates_declr)
qasm_cgc
end
"""
qasm2cgc(txt::String)
converts OpenQASM 2.0 text to Circuit{N} object
"""
function qasm2cgc(txt::String)
qasmlex = lex(txt)
qasmparse = parse_qasm(qasmlex)
qasm_cgc = transform_qasm(qasmparse)
end
function Base.:(==)(dcl1::Struct_gate, dcl2::Struct_gate)
dcl1.decl == dcl2.decl && dcl1.goplist == dcl2.goplist
end
| [
3500,
371,
15766,
37,
198,
3500,
13981,
774,
293,
198,
3500,
20090,
18557,
628,
198,
31,
292,
62,
22105,
29130,
198,
31,
292,
62,
22105,
32112,
62,
12417,
23065,
198,
31,
292,
62,
22105,
32112,
62,
361,
301,
16762,
198,
31,
292,
62,
22105,
32112,
62,
10494,
198,
31,
292,
62,
22105,
32112,
62,
70,
515,
68,
565,
198,
31,
292,
62,
22105,
32112,
62,
32446,
198,
31,
292,
62,
22105,
32112,
62,
5657,
5277,
62,
2340,
198,
31,
292,
62,
22105,
32112,
62,
42503,
198,
31,
292,
62,
22105,
32112,
62,
1326,
5015,
198,
31,
292,
62,
22105,
32112,
62,
312,
84,
404,
198,
31,
292,
62,
22105,
32112,
62,
84,
198,
31,
292,
62,
22105,
32112,
62,
66,
87,
198,
31,
292,
62,
22105,
32112,
62,
71,
198,
31,
292,
62,
22105,
32112,
62,
87,
198,
31,
292,
62,
22105,
32112,
62,
88,
198,
31,
292,
62,
22105,
32112,
62,
89,
198,
31,
292,
62,
22105,
32112,
62,
82,
198,
31,
292,
62,
22105,
32112,
62,
21282,
70,
198,
31,
292,
62,
22105,
32112,
62,
83,
198,
31,
292,
62,
22105,
32112,
62,
8671,
70,
198,
31,
292,
62,
22105,
32112,
62,
40914,
198,
31,
292,
62,
22105,
32112,
62,
563,
198,
31,
292,
62,
22105,
32112,
62,
81,
89,
198,
31,
292,
62,
22105,
32112,
62,
354,
198,
31,
292,
62,
22105,
32112,
62,
6098,
87,
198,
31,
292,
62,
22105,
32112,
62,
20470,
198,
31,
292,
62,
22105,
32112,
62,
6098,
89,
198,
31,
292,
62,
22105,
32112,
62,
312,
4868,
198,
31,
292,
62,
22105,
32112,
62,
76,
2966,
4868,
198,
31,
292,
62,
22105,
32112,
62,
49140,
198,
31,
292,
62,
22105,
32112,
62,
20676,
396,
198,
31,
292,
62,
22105,
32112,
62,
14415,
198,
31,
292,
62,
22105,
32112,
62,
69,
12413,
79,
198,
31,
292,
62,
22105,
32112,
62,
12480,
198,
31,
292,
62,
22105,
32112,
62,
8800,
198,
198,
8818,
664,
7,
49464,
62,
83,
482,
641,
8,
198,
220,
220,
220,
2163,
598,
7,
404,
11,
26498,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
3975,
7,
8344,
11,
26498,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1034,
796,
38357,
7,
404,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
404,
16763,
7,
22046,
986,
22305,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
15699,
269,
17602,
62,
83,
482,
641,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
14415,
28264,
8,
5218,
7308,
13,
14415,
198,
220,
220,
220,
220,
220,
220,
220,
29130,
90,
25,
312,
92,
7,
2536,
28,
2536,
8,
5218,
38357,
7,
2536,
8,
198,
220,
220,
220,
220,
220,
220,
220,
29130,
90,
25,
20471,
5305,
92,
7,
2536,
28,
2536,
8,
5218,
21136,
7,
43879,
2414,
11,
965,
8,
198,
220,
220,
220,
220,
220,
220,
220,
29130,
90,
25,
20471,
41433,
92,
7,
2536,
28,
2536,
8,
5218,
21136,
7,
5317,
2414,
11,
965,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
12480,
7,
8367,
28,
8367,
8,
5218,
36147,
22799,
7,
8344,
7,
8367,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
8800,
7,
75,
28,
75,
11,
1034,
28,
30642,
7,
2536,
28,
404,
828,
374,
28,
81,
8,
5218,
598,
7,
404,
11,
300,
11,
374,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
312,
4868,
7,
31298,
28,
30642,
7,
2536,
28,
31298,
828,
256,
75,
28,
22366,
8,
5218,
685,
13940,
23650,
7,
31298,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
312,
4868,
7,
31298,
28,
30642,
7,
2536,
28,
31298,
828,
256,
75,
28,
28781,
8,
5218,
685,
13940,
23650,
7,
31298,
828,
664,
7,
28781,
8,
22345,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
20676,
396,
7,
31298,
28,
31298,
11,
256,
75,
28,
22366,
8,
5218,
685,
8344,
7,
31298,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
20676,
396,
7,
31298,
28,
31298,
11,
256,
75,
28,
28781,
8,
5218,
685,
8344,
7,
31298,
828,
664,
7,
28781,
8,
22345,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
76,
2966,
4868,
7,
31298,
28,
31298,
11,
256,
75,
28,
22366,
8,
5218,
685,
8344,
7,
31298,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
76,
2966,
4868,
7,
31298,
28,
31298,
11,
256,
75,
28,
28781,
8,
5218,
685,
8344,
7,
31298,
828,
664,
7,
28781,
8,
22345,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
49140,
7,
312,
28,
30642,
7,
2536,
28,
312,
828,
1822,
28,
22366,
8,
5218,
38357,
7,
312,
8,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
49140,
7,
312,
28,
30642,
7,
2536,
28,
312,
828,
1822,
28,
30642,
7,
2536,
28,
600,
4008,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
773,
796,
21136,
7,
5317,
11,
493,
8,
1343,
352,
1303,
2233,
284,
474,
43640,
352,
12,
3106,
6376,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
7,
13940,
23650,
7,
312,
4008,
58,
3,
521,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
69,
12413,
79,
7,
22184,
796,
29130,
7,
2536,
28,
22184,
828,
1822,
28,
853,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
24714,
796,
2488,
15699,
24714,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
31369,
1,
5218,
7813,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
6966,
1,
5218,
8615,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
38006,
1,
5218,
25706,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
11201,
1,
5218,
1033,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
18755,
1,
220,
5218,
2604,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
366,
31166,
17034,
1,
14804,
19862,
17034,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4808,
220,
220,
220,
220,
5218,
4049,
7203,
1662,
4114,
1865,
4943,
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,
598,
7,
22184,
11,
1822,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
2147,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
1007,
62,
2301,
7,
49464,
62,
83,
482,
641,
11,
10662,
2301,
82,
8,
198,
220,
220,
220,
2163,
598,
7,
404,
11,
26498,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
3975,
7,
8344,
11,
26498,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1034,
796,
38357,
7,
404,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
404,
16763,
7,
22046,
986,
22305,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
15699,
269,
17602,
62,
83,
482,
641,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
32446,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
842,
4906,
796,
29130,
7,
2536,
28,
2301,
4906,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
796,
29130,
7,
2536,
28,
312,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
493,
796,
29130,
7,
2536,
796,
299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
4686,
796,
38357,
7,
312,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
299,
796,
21136,
7,
5317,
11,
299,
8,
198,
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,
1441,
1058,
16763,
312,
796,
10662,
2301,
16763,
77,
1776,
4574,
0,
16763,
80,
2301,
82,
11,
720,
312,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
12417,
23065,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1172,
796,
336,
76,
912,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
336,
76,
912,
796,
1007,
62,
2301,
12195,
301,
76,
912,
11,
10662,
2301,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
76,
912,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
2147,
198,
220,
220,
220,
886,
198,
437,
198,
198,
8818,
1007,
62,
70,
689,
7,
49464,
62,
83,
482,
641,
11,
10662,
8597,
62,
66,
36484,
11,
220,
399,
8,
198,
220,
220,
220,
2163,
598,
7,
404,
11,
26498,
23029,
198,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
3975,
7,
8344,
11,
26498,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1034,
796,
38357,
7,
404,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
404,
16763,
7,
22046,
986,
22305,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2488,
15699,
269,
17602,
62,
83,
482,
641,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
312,
84,
404,
7,
10494,
62,
3672,
796,
29130,
7,
2536,
28,
10494,
62,
3672,
828,
26498,
28,
22366,
11,
12198,
28,
5269,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
82,
796,
664,
7,
5269,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8946,
62,
3672,
796,
38357,
7203,
23144,
62,
10494,
62,
1,
9,
10494,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
10494,
62,
3672,
7,
22366,
11,
29568,
5420,
82,
986,
1776,
10662,
8597,
62,
66,
36484,
43641,
80,
8597,
62,
66,
36484,
11,
399,
43641,
45,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
312,
84,
404,
7,
10494,
62,
3672,
796,
29130,
7,
2536,
28,
10494,
62,
3672,
828,
26498,
28,
31937,
4868,
11,
12198,
28,
5269,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
82,
796,
664,
7,
5269,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
3808,
796,
1475,
1050,
7,
25,
83,
29291,
11,
664,
7,
31937,
4868,
26513,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
8946,
62,
3672,
796,
38357,
7203,
23144,
62,
10494,
62,
1,
9,
10494,
62,
3672,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
10494,
62,
3672,
16763,
31937,
82,
11,
29568,
5420,
82,
986,
1776,
10662,
8597,
62,
66,
36484,
43641,
80,
8597,
62,
66,
36484,
11,
399,
43641,
45,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
66,
87,
7,
448,
16,
28,
448,
16,
11,
503,
17,
28,
448,
17,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
16,
796,
664,
7,
448,
16,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
17,
796,
664,
7,
448,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
17,
828,
1395,
11,
7198,
5420,
16,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
354,
7,
448,
16,
28,
448,
16,
11,
503,
17,
28,
448,
17,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
16,
796,
664,
7,
448,
16,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
17,
796,
664,
7,
448,
17,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
17,
828,
11161,
321,
446,
22628,
22784,
7198,
5420,
16,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
84,
7,
259,
16,
28,
259,
16,
11,
287,
17,
28,
259,
17,
11,
287,
18,
28,
259,
18,
11,
503,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
357,
64,
11,
275,
11,
269,
8,
796,
3975,
7,
8344,
11,
357,
259,
16,
11,
287,
17,
11,
287,
18,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
4008,
58,
16,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
371,
89,
22628,
16763,
64,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10349,
62,
10494,
7,
16763,
5420,
828,
11089,
22628,
16763,
65,
36911,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
10349,
62,
10494,
7,
16763,
5420,
828,
371,
89,
22628,
16763,
66,
36911,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
87,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
1395,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
88,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
575,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
89,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
1168,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
71,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
11161,
321,
446,
22628,
3419,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
83,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
309,
22628,
3419,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
8671,
70,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
309,
67,
363,
22628,
3419,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
82,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
311,
22628,
3419,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
21282,
70,
7,
448,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
311,
67,
363,
22628,
3419,
15437,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
40914,
7,
259,
28,
259,
11,
503,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
49715,
22628,
16763,
853,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
563,
7,
259,
28,
259,
11,
503,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
11089,
22628,
16763,
853,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
81,
89,
7,
259,
28,
259,
11,
503,
28,
448,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
1006,
796,
1058,
16763,
7,
8344,
7,
448,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
5420,
828,
371,
89,
22628,
16763,
853,
4008,
60,
4008,
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,
32112,
62,
6098,
87,
7,
259,
28,
259,
11,
503,
16,
28,
448,
16,
11,
503,
17,
28,
448,
17,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
503,
796,
1058,
16763,
7,
8344,
7,
448,
17,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
429,
45895,
796,
1058,
16763,
7,
8344,
7,
448,
16,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
448,
828,
49715,
22628,
16763,
853,
828,
7198,
66,
429,
45895,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
20470,
7,
259,
28,
259,
11,
503,
16,
28,
448,
16,
11,
503,
17,
28,
448,
17,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
503,
796,
1058,
16763,
7,
8344,
7,
448,
17,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
429,
45895,
796,
1058,
16763,
7,
8344,
7,
448,
16,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
448,
828,
11089,
22628,
16763,
853,
828,
7198,
66,
429,
45895,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
6098,
89,
7,
259,
28,
259,
11,
503,
16,
28,
448,
16,
11,
503,
17,
28,
448,
17,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
503,
796,
1058,
16763,
7,
8344,
7,
448,
17,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
269,
429,
45895,
796,
1058,
16763,
7,
8344,
7,
448,
16,
4008,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1822,
796,
1058,
16763,
7,
8344,
7,
259,
22305,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
36147,
33295,
0,
16763,
80,
8597,
62,
66,
36484,
11,
685,
21170,
5013,
62,
10494,
7,
16763,
448,
828,
371,
89,
22628,
16763,
853,
828,
7198,
66,
429,
45895,
4008,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
10494,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2377,
796,
32112,
62,
70,
515,
68,
565,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4686,
28,
30642,
7,
2536,
28,
69,
312,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
28,
22046,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
12198,
28,
5269,
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,
308,
404,
4868,
28,
70,
404,
4868,
198,
220,
220,
220,
220,
220,
220,
220,
220,
1267,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
503,
62,
2340,
7904,
20650,
90,
13940,
23650,
92,
796,
664,
7,
5269,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
49909,
796,
38357,
7203,
23144,
62,
10494,
62,
1,
9,
69,
312,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
796,
664,
7,
22046,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
404,
4868,
796,
1007,
62,
70,
689,
12195,
70,
404,
4868,
11,
6524,
7,
80,
8597,
62,
66,
36484,
828,
6524,
7,
45,
4008,
628,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
318,
22366,
7,
70,
404,
4868,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
308,
404,
4868,
28,
21737,
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,
611,
318,
22366,
7,
22046,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
26498,
28,
21737,
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,
9577,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2163,
720,
69,
312,
7,
16763,
7,
22046,
986,
828,
10612,
29568,
448,
62,
2340,
986,
1776,
10662,
8597,
62,
66,
36484,
43641,
80,
8597,
62,
66,
36484,
11,
399,
43641,
45,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
29568,
70,
404,
4868,
23029,
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,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
32112,
62,
361,
301,
16762,
7,
75,
28,
30642,
7,
2536,
28,
75,
828,
374,
28,
81,
11,
8946,
62,
3672,
28,
30642,
7,
2536,
28,
10494,
62,
3672,
828,
26498,
28,
22366,
11,
12198,
28,
5269,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1309,
300,
796,
38357,
7,
75,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
664,
7,
81,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
82,
796,
664,
7,
5269,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
8946,
62,
3672,
796,
38357,
7203,
23144,
62,
10494,
62,
1,
9,
10494,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
10494,
62,
3672,
7,
22366,
11,
842,
62,
9122,
16763,
75,
11,
3,
81,
828,
29568,
5420,
82,
986,
1776,
10662,
8597,
62,
66,
36484,
43641,
80,
8597,
62,
66,
36484,
11,
399,
43641,
45,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
32112,
62,
361,
301,
16762,
7,
75,
28,
30642,
7,
2536,
28,
75,
828,
374,
28,
81,
11,
8946,
62,
3672,
28,
30642,
7,
2536,
28,
10494,
62,
3672,
828,
26498,
28,
31937,
4868,
11,
12198,
28,
5269,
8,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
1309,
300,
796,
38357,
7,
75,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
374,
796,
664,
7,
81,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
82,
796,
664,
7,
5269,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
1033,
3808,
796,
1475,
1050,
7,
25,
83,
29291,
11,
664,
7,
31937,
4868,
26513,
828,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
8946,
62,
3672,
796,
38357,
7203,
23144,
62,
10494,
62,
1,
9,
10494,
62,
3672,
8,
628,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
220,
220,
220,
220,
1058,
16763,
10494,
62,
3672,
16763,
31937,
82,
11,
842,
62,
9122,
16763,
75,
11,
3,
81,
828,
29568,
5420,
82,
986,
1776,
10662,
8597,
62,
66,
36484,
43641,
80,
8597,
62,
66,
36484,
11,
399,
43641,
45,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
220,
220,
220,
220,
886,
628,
220,
220,
220,
220,
220,
220,
220,
32112,
62,
12417,
23065,
7,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1172,
796,
336,
76,
912,
198,
220,
220,
220,
220,
220,
220,
220,
1267,
5218,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1309,
336,
76,
912,
796,
1007,
62,
70,
689,
12195,
301,
76,
912,
11,
10662,
8597,
62,
66,
36484,
11,
399,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
76,
912,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
4808,
5218,
2147,
198,
220,
220,
220,
886,
198,
437,
628,
198,
8818,
6121,
62,
80,
8597,
7,
49464,
62,
83,
482,
641,
8,
628,
220,
220,
220,
10662,
2301,
82,
796,
1195,
2913,
408,
298,
13,
48,
38804,
21737,
198,
220,
220,
220,
842,
62,
32446,
81,
796,
1007,
62,
2301,
7,
49464,
62,
83,
482,
641,
11,
6524,
7,
80,
2301,
82,
4008,
198,
220,
220,
220,
5418,
12195,
2301,
62,
32446,
81,
8,
628,
220,
220,
220,
10662,
8597,
62,
66,
36484,
796,
13588,
7,
80,
2301,
82,
23029,
198,
220,
220,
220,
399,
796,
997,
62,
86,
2387,
7,
80,
8597,
62,
66,
36484,
8,
628,
220,
220,
220,
17435,
62,
32446,
81,
796,
1007,
62,
70,
689,
7,
49464,
62,
83,
482,
641,
11,
6524,
7,
80,
8597,
62,
66,
36484,
828,
6524,
7,
45,
4008,
628,
220,
220,
220,
5418,
12195,
70,
689,
62,
32446,
81,
8,
198,
220,
220,
220,
220,
198,
220,
220,
220,
10662,
8597,
62,
66,
36484,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
10662,
8597,
17,
66,
36484,
7,
14116,
3712,
10100,
8,
198,
198,
1102,
24040,
4946,
48,
1921,
44,
362,
13,
15,
2420,
284,
13588,
90,
45,
92,
2134,
198,
37811,
198,
8818,
10662,
8597,
17,
66,
36484,
7,
14116,
3712,
10100,
8,
198,
220,
220,
220,
10662,
8597,
2588,
796,
31191,
7,
14116,
8,
198,
220,
220,
220,
10662,
8597,
29572,
796,
21136,
62,
80,
8597,
7,
80,
8597,
2588,
8,
198,
220,
220,
220,
10662,
8597,
62,
66,
36484,
796,
6121,
62,
80,
8597,
7,
80,
8597,
29572,
8,
198,
437,
628,
198,
8818,
7308,
11207,
7,
855,
5769,
67,
565,
16,
3712,
44909,
62,
10494,
11,
288,
565,
17,
3712,
44909,
62,
10494,
8,
198,
220,
220,
220,
288,
565,
16,
13,
32446,
6624,
288,
565,
17,
13,
32446,
11405,
288,
565,
16,
13,
70,
404,
4868,
6624,
288,
565,
17,
13,
70,
404,
4868,
198,
437,
198
] | 1.755901 | 5,592 |
using Pkg if isfile("Project.toml") && isfile("Manifest.toml") Pkg.activate(".") end | [
3500,
350,
10025,
611,
318,
7753,
7203,
16775,
13,
39532,
75,
4943,
11405,
318,
7753,
7203,
5124,
8409,
13,
39532,
75,
4943,
350,
10025,
13,
39022,
7203,
19570,
886
] | 2.896552 | 29 |
export time_modeling
# Setup time-domain linear or nonlinear foward and adjoint modeling and interface to devito
function time_modeling(model_full::Model, srcGeometry, srcData, recGeometry, recData, dm, op::Char, mode::Int64, options)
# Load full geometry for out-of-core geometry containers
recGeometry = Geometry(recGeometry)
srcGeometry = Geometry(srcGeometry)
# Reutrn directly for J*0
if op=='J' && mode == 1
if norm(dm) == 0 && options.return_array == false
return judiVector(recGeometry, zeros(Float32, recGeometry.nt[1], length(recGeometry.xloc[1])))
elseif norm(dm) == 0 && options.return_array == true
return vec(zeros(Float32, recGeometry.nt[1], length(recGeometry.xloc[1])))
end
end
# limit model to area with sources/receivers
if options.limit_m == true
model = deepcopy(model_full)
model, dm = limit_model_to_receiver_area(srcGeometry, recGeometry, model, options.buffer_size; pert=dm)
else
model = model_full
end
# Set up Python model structure
modelPy = devito_model(model, options; dm=dm)
# Load shot record if stored on disk
typeof(recData) == SegyIO.SeisCon && (recData = convert(Array{Float32,2}, recData[1].data))
# Remove receivers outside the modeling domain (otherwise leads to segmentation faults)
recGeometry, recData = remove_out_of_bounds_receivers(recGeometry, recData, model)
# Devito interface
argout = devito_interface(modelPy, model, srcGeometry, srcData, recGeometry, recData, dm, options)
# Extend gradient back to original model size
if op=='J' && mode==-1 && options.limit_m==true
argout = extend_gradient(model_full, model, argout)
end
return argout
end
# Function instance without options
time_modeling(model::Model, srcGeometry::Geometry, srcData, recGeometry::Geometry, recData, perturbation, srcnum::Int64, op::Char, mode::Int64) =
time_modeling(model, srcGeometry, srcData, recGeometry, recData, perturbation, srcnum, op, mode, Options())
| [
198,
39344,
640,
62,
4666,
10809,
198,
198,
2,
31122,
640,
12,
27830,
14174,
393,
1729,
29127,
277,
46138,
290,
9224,
1563,
21128,
290,
7071,
284,
1614,
10094,
198,
8818,
640,
62,
4666,
10809,
7,
19849,
62,
12853,
3712,
17633,
11,
12351,
10082,
15748,
11,
12351,
6601,
11,
664,
10082,
15748,
11,
664,
6601,
11,
288,
76,
11,
1034,
3712,
12441,
11,
4235,
3712,
5317,
2414,
11,
3689,
8,
198,
220,
220,
220,
1303,
8778,
1336,
22939,
329,
503,
12,
1659,
12,
7295,
22939,
16472,
198,
220,
220,
220,
664,
10082,
15748,
796,
2269,
15748,
7,
8344,
10082,
15748,
8,
198,
220,
220,
220,
12351,
10082,
15748,
796,
2269,
15748,
7,
10677,
10082,
15748,
8,
628,
220,
220,
220,
1303,
797,
315,
35906,
3264,
329,
449,
9,
15,
198,
220,
220,
220,
611,
1034,
855,
6,
41,
6,
11405,
4235,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
611,
2593,
7,
36020,
8,
6624,
657,
11405,
3689,
13,
7783,
62,
18747,
6624,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
2553,
72,
38469,
7,
8344,
10082,
15748,
11,
1976,
27498,
7,
43879,
2624,
11,
664,
10082,
15748,
13,
429,
58,
16,
4357,
4129,
7,
8344,
10082,
15748,
13,
87,
17946,
58,
16,
60,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
2593,
7,
36020,
8,
6624,
657,
11405,
3689,
13,
7783,
62,
18747,
6624,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
43030,
7,
9107,
418,
7,
43879,
2624,
11,
664,
10082,
15748,
13,
429,
58,
16,
4357,
4129,
7,
8344,
10082,
15748,
13,
87,
17946,
58,
16,
60,
22305,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
4179,
2746,
284,
1989,
351,
4237,
14,
260,
344,
1191,
198,
220,
220,
220,
611,
3689,
13,
32374,
62,
76,
6624,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
2769,
30073,
7,
19849,
62,
12853,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
11,
288,
76,
796,
4179,
62,
19849,
62,
1462,
62,
260,
39729,
62,
20337,
7,
10677,
10082,
15748,
11,
664,
10082,
15748,
11,
2746,
11,
3689,
13,
22252,
62,
7857,
26,
22146,
28,
36020,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
2746,
796,
2746,
62,
12853,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
5345,
510,
11361,
2746,
4645,
198,
220,
220,
220,
2746,
20519,
796,
1614,
10094,
62,
19849,
7,
19849,
11,
3689,
26,
288,
76,
28,
36020,
8,
628,
220,
220,
220,
1303,
8778,
2823,
1700,
611,
8574,
319,
11898,
198,
220,
220,
220,
2099,
1659,
7,
8344,
6601,
8,
6624,
1001,
1360,
9399,
13,
4653,
271,
3103,
11405,
357,
8344,
6601,
796,
10385,
7,
19182,
90,
43879,
2624,
11,
17,
5512,
664,
6601,
58,
16,
4083,
7890,
4008,
628,
220,
220,
220,
1303,
17220,
19137,
2354,
262,
21128,
7386,
357,
847,
3083,
5983,
284,
10618,
341,
31025,
8,
198,
220,
220,
220,
664,
10082,
15748,
11,
664,
6601,
796,
4781,
62,
448,
62,
1659,
62,
65,
3733,
62,
260,
344,
1191,
7,
8344,
10082,
15748,
11,
664,
6601,
11,
2746,
8,
628,
220,
220,
220,
1303,
6245,
10094,
7071,
198,
220,
220,
220,
1822,
448,
796,
1614,
10094,
62,
39994,
7,
19849,
20519,
11,
2746,
11,
12351,
10082,
15748,
11,
12351,
6601,
11,
664,
10082,
15748,
11,
664,
6601,
11,
288,
76,
11,
3689,
8,
628,
220,
220,
220,
1303,
46228,
31312,
736,
284,
2656,
2746,
2546,
198,
220,
220,
220,
611,
1034,
855,
6,
41,
6,
11405,
4235,
855,
12,
16,
11405,
3689,
13,
32374,
62,
76,
855,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
1822,
448,
796,
9117,
62,
49607,
7,
19849,
62,
12853,
11,
2746,
11,
1822,
448,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1441,
1822,
448,
198,
437,
198,
198,
2,
15553,
4554,
1231,
3689,
198,
2435,
62,
4666,
10809,
7,
19849,
3712,
17633,
11,
12351,
10082,
15748,
3712,
10082,
15748,
11,
12351,
6601,
11,
664,
10082,
15748,
3712,
10082,
15748,
11,
664,
6601,
11,
22146,
5945,
341,
11,
12351,
22510,
3712,
5317,
2414,
11,
1034,
3712,
12441,
11,
4235,
3712,
5317,
2414,
8,
796,
198,
220,
220,
220,
640,
62,
4666,
10809,
7,
19849,
11,
12351,
10082,
15748,
11,
12351,
6601,
11,
664,
10082,
15748,
11,
664,
6601,
11,
22146,
5945,
341,
11,
12351,
22510,
11,
1034,
11,
4235,
11,
18634,
28955,
198
] | 2.753333 | 750 |
type BayesTreeNodeData
frontalIDs::Vector{Int}
conditIDs::Vector{Int}
inmsgIDs::Vector{Int}
potIDs::Vector{Int} # this is likely redundant TODO -- remove
potentials::Vector{Int}
cliqAssocMat::Array{Bool,2}
cliqMsgMat::Array{Bool,2}
directvarIDs::Vector{Int}
directFrtlMsgIDs::Vector{Int}
msgskipIDs::Vector{Int}
itervarIDs::Vector{Int}
directPriorMsgIDs::Vector{Int}
debug
debugDwn
BayesTreeNodeData() = new()
BayesTreeNodeData(x...) = new(x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14])
end
# TODO -- this should be a constructor
function emptyBTNodeData()
BayesTreeNodeData(Int[],Int[],Int[],
Int[],Int[],Array{Bool}(0,0),
Array{Bool}(0,0),Int[],Int[],
Int[],Int[],Int[],
nothing, nothing)
end
# BayesTree declarations
type BayesTree
bt
btid::Int
cliques::Dict{Int,Graphs.ExVertex}
frontals::Dict{String,Int}
end
function emptyBayesTree()
bt = BayesTree(Graphs.inclist(Graphs.ExVertex,is_directed=true),
0,
Dict{Int,Graphs.ExVertex}(),
#[],
Dict{AbstractString, Int}())
return bt
end
# create a new clique
function addClique!(bt::BayesTree, fg::FactorGraph, varID::Int, condIDs::Array{Int}=Int[])
bt.btid += 1
clq = Graphs.add_vertex!(bt.bt, ExVertex(bt.btid,string("Clique",bt.btid)))
bt.cliques[bt.btid] = clq
clq.attributes["label"] = ""
# Specific data container
clq.attributes["data"] = emptyBTNodeData()
appendClique!(bt, bt.btid, fg, varID, condIDs)
return clq
end
# generate the label for particular clique -- graphviz drawing
function makeCliqueLabel(fgl::FactorGraph, bt::BayesTree, clqID::Int)
clq = bt.cliques[clqID]
flbl = ""
clbl = ""
for fr in clq.attributes["data"].frontalIDs
flbl = string(flbl,localapi.getvertex(fgl,fr).attributes["label"], ",") #fgl.v[fr].
end
for cond in clq.attributes["data"].conditIDs
clbl = string(clbl, localapi.getvertex(fgl,cond).attributes["label"], ",") # fgl.v[cond].
end
clq.attributes["label"] = string(flbl, ": ", clbl)
end
# add a conditional ID to clique
function appendConditional(bt::BayesTree, clqID::Int, condIDs::Array{Int,1})
clq = bt.cliques[clqID]
clq.attributes["data"].conditIDs = union(clq.attributes["data"].conditIDs, condIDs)
end
# Add a new frontal variable to clique
function appendClique!(bt::BayesTree, clqID::Int, fg::FactorGraph, varID::Int, condIDs::Array{Int,1}=Int[])
clq = bt.cliques[clqID]
var = localapi.getvertex(fg, varID) # fg.v[varID]
# add frontal variable
push!(clq.attributes["data"].frontalIDs,varID)
# total dictionary of frontals for easy access
bt.frontals[var.attributes["label"]] = clqID#bt.btid
appendConditional(bt, clqID, condIDs)
makeCliqueLabel(fg, bt, clqID)
nothing
end
# instantiate a new child clique in the tree
function newChildClique!(bt::BayesTree, fg::FactorGraph, CpID::Int, varID::Int, Sepj::Array{Int,1})
chclq = addClique!(bt, fg, varID, Sepj)
parent = bt.cliques[CpID]
# Staying with Graphs.jl for tree in first stage
edge = Graphs.make_edge(bt.bt, parent, chclq)
Graphs.add_edge!(bt.bt, edge)
return chclq
end
# post order tree traversal and build potential functions
function findCliqueFromFrontal(bt::BayesTree, frtlID::Int)
for cliqPair in bt.cliques
id = cliqPair[1]
cliq = cliqPair[2]
for frtl in cliq.attributes["data"].frontalIDs
if frtl == frtlID
return cliq
end
end
end
error("Clique with desired frontal ID not found")
end
# eliminate a variable for new
function newPotential(tree::BayesTree, fg::FactorGraph, var::Int, prevVar::Int, p::Array{Int,1})
firvert = localapi.getvertex(fg,var)
if (length(getData(firvert).separator) == 0)
# warn("newPotential -- sep length is 0")
if (length(tree.cliques) == 0)
addClique!(tree, fg, var)
else
appendClique!(tree, 1, fg, var) # add to root
end
else
Sj = getData(firvert).separator
# find parent clique Cp that containts the first eliminated variable of Sj as frontal
firstelim = 99999999999
for s in Sj
temp = findfirst(p, s)
if (temp < firstelim)
firstelim = temp
end
end
felbl = localapi.getvertex(fg, p[firstelim]).attributes["label"]
CpID = tree.frontals[felbl]
# look to add this conditional to the tree
unFC = union(tree.cliques[CpID].attributes["data"].frontalIDs, tree.cliques[CpID].attributes["data"].conditIDs)
if (sort(unFC) == sort(Sj))
appendClique!(tree, CpID, fg, var)
else
newChildClique!(tree, fg, CpID, var, Sj)
end
end
end
# build the whole tree in batch format
function buildTree!(tree::BayesTree, fg::FactorGraph, p::Array{Int,1})
rp = flipdim(p,1)
prevVar = 0
for var in rp
newPotential(tree, fg, var, prevVar, p)
prevVar = var
end
end
## Find batch belief propagation solution
function prepBatchTree!(fg::FactorGraph; ordering::Symbol=:qr,drawpdf::Bool=false)
p = IncrementalInference.getEliminationOrder(fg, ordering=ordering)
println()
fge = deepcopy(fg)
println("Building Bayes net...")
buildBayesNet!(fge, p)
tree = emptyBayesTree()
buildTree!(tree, fge, p)
println("Bayes Net")
# sleep(0.1)
#fid = open("bn.dot","w+")
#write(fid,to_dot(fge.bn))
#close(fid)
# Michael reference -- x2->x1, x2->x3, x2->x4, x2->l1, x4->x3, l1->x3, l1->x4
println("Bayes Tree")
if drawpdf
fid = open("bt.dot","w+")
write(fid,to_dot(tree.bt))
close(fid)
run(`dot bt.dot -Tpdf -o bt.pdf`)
end
# GraphViz.Graph(to_dot(tree.bt))
#Michael reference 3sig -- x2l1x4x3 x1|x2
println("Find potential functions for each clique")
cliq = tree.cliques[1] # start at the root
buildCliquePotentials(fg, tree, cliq); # fg does not have the marginals as fge does
# now update all factor graph vertices used for this tree
for v in vertices(fg.g)
dlapi.updatevertex!(fg, v)
end
return tree
end
function resetData!(vdata::VariableNodeData)
vdata.eliminated = false
vdata.BayesNetOutVertIDs = Int[]
vdata.BayesNetVertID = 0
vdata.separator = Int[]
nothing
end
function resetData!(vdata::FunctionNodeData)
vdata.eliminated = false
vdata.potentialused = false
nothing
end
function resetFactorGraphNewTree!(fg::FactorGraph)
for v in vertices(fg.g)
resetData!(getData(v))
localapi.updatevertex!(fg, v)
end
nothing
end
function wipeBuildNewTree!(fg::FactorGraph; ordering=:qr,drawpdf=false)
resetFactorGraphNewTree!(fg);
return prepBatchTree!(fg, ordering=ordering, drawpdf=drawpdf);
end
function whichCliq{T <: AbstractString}(bt::BayesTree, frt::T)
bt.cliques[bt.frontals[frt]]
end
whichCliq(bt::BayesTree, frt::Symbol) = whichCliq(bt, string(frt))
function appendUseFcts!(usefcts, lblid::Int, fct::Graphs.ExVertex, fid::Int)
for tp in usefcts
if tp == fct.index
return nothing
end
end
tpl = fct.index
push!(usefcts, tpl )
nothing
end
function getCliquePotentials!(fg::FactorGraph, bt::BayesTree, cliq::Graphs.ExVertex)
frtl = cliq.attributes["data"].frontalIDs
cond = cliq.attributes["data"].conditIDs
allids = [frtl;cond]
alldimIDs = Int[]
for fid in frtl
alldimIDs = [alldimIDs; getData(localapi.getvertex(fg,fid)).dimIDs]
end
for cid in cond
alldimIDs = [alldimIDs; getData(localapi.getvertex(fg,cid)).dimIDs]
end
for fid in frtl
usefcts = []
for fct in localapi.outneighbors(fg, localapi.getvertex(fg,fid))
if getData(fct).potentialused!=true
loutn = localapi.outneighbors(fg, fct)
if length(loutn)==1
appendUseFcts!(usefcts, fg.IDs[Symbol(loutn[1].label)], fct, fid)
# TODO -- make update vertex call
fct.attributes["data"].potentialused = true
localapi.updatevertex!(fg, fct)
end
for sepSearch in loutn
sslbl = Symbol(sepSearch.label)
if (fg.IDs[sslbl] == fid)
continue # skip the fid itself
end
sea = findmin(abs.(allids-fg.IDs[sslbl]))
if sea[1]==0.0
appendUseFcts!(usefcts, fg.IDs[sslbl], fct, fid)
# usefcts = [usefcts;(fg.IDs[sslbl], fct, fid)]
fct.attributes["data"].potentialused = true #fct.attributes["potentialused"] = true
localapi.updatevertex!(fg, fct)
end
end
end
end
cliq.attributes["data"].potentials=union(cliq.attributes["data"].potentials,usefcts)
end
return nothing
end
function getCliquePotentials!(fg::FactorGraph, bt::BayesTree, chkcliq::Int)
getCliquePotentials!(fg, bt.cliques[chkcliq])
end
function cliqPotentialIDs(cliq::Graphs.ExVertex)
potIDs = Int[]
for idfct in cliq.attributes["data"].potentials
push!(potIDs,idfct)
end
return potIDs
end
function collectSeparators(bt::BayesTree, cliq::Graphs.ExVertex)
allseps = Int[]
for child in out_neighbors(cliq, bt.bt)#tree
allseps = [allseps; child.attributes["data"].conditIDs]
end
return allseps
end
function compCliqAssocMatrices!(fgl::FactorGraph, bt::BayesTree, cliq::Graphs.ExVertex)
frtl = cliq.attributes["data"].frontalIDs
cond = cliq.attributes["data"].conditIDs
inmsgIDs = collectSeparators(bt, cliq)
potIDs = cliqPotentialIDs(cliq)
# Construct associations matrix here
# matrix has variables are columns, and messages/constraints as rows
cols = [frtl;cond]
cliq.attributes["data"].inmsgIDs = inmsgIDs
cliq.attributes["data"].potIDs = potIDs
cliqAssocMat = Array{Bool,2}(length(potIDs), length(cols))
cliqMsgMat = Array{Bool,2}(length(inmsgIDs), length(cols))
fill!(cliqAssocMat, false)
fill!(cliqMsgMat, false)
for j in 1:length(cols)
for i in 1:length(inmsgIDs)
if cols[j] == inmsgIDs[i]
cliqMsgMat[i,j] = true
end
end
for i in 1:length(potIDs)
idfct = cliq.attributes["data"].potentials[i]
if idfct == potIDs[i] # sanity check on clique potentials ordering
for vertidx in getData(getVert(fgl, idfct, api=localapi)).fncargvID
# for vertidx in getData(getVertNode(fgl, idfct)).fncargvID
if vertidx == cols[j]
cliqAssocMat[i,j] = true
end
end
else
prtslperr("compCliqAssocMatrices! -- potential ID ordering was lost")
end
end
end
cliq.attributes["data"].cliqAssocMat = cliqAssocMat
cliq.attributes["data"].cliqMsgMat = cliqMsgMat
nothing
end
function getCliqAssocMat(cliq::Graphs.ExVertex)
cliq.attributes["data"].cliqAssocMat
end
function getCliqMsgMat(cliq::Graphs.ExVertex)
cliq.attributes["data"].cliqMsgMat
end
function getCliqMat(cliq::Graphs.ExVertex; showmsg=true)
assocMat = getCliqAssocMat(cliq)
msgMat = getCliqMsgMat(cliq)
mat = showmsg ? [assocMat;msgMat] : assocMat
return mat
end
# function spyCliqMat(cliq::Graphs.ExVertex; showmsg=true)
# mat = deepcopy(getCliqMat(cliq, showmsg=showmsg))
# # TODO -- add improved visualization here, iter vs skip
# mat = map(Float64, mat)*2.0-1.0
# numlcl = size(getCliqAssocMat(cliq),1)
# mat[(numlcl+1):end,:] *= 0.9
# mat[(numlcl+1):end,:] -= 0.1
# numfrtl1 = floor(Int,length(cliq.attributes["data"].frontalIDs)+1)
# mat[:,numfrtl1:end] *= 0.9
# mat[:,numfrtl1:end] -= 0.1
# @show cliq.attributes["data"].itervarIDs
# @show cliq.attributes["data"].directvarIDs
# @show cliq.attributes["data"].msgskipIDs
# @show cliq.attributes["data"].directFrtlMsgIDs
# @show cliq.attributes["data"].directPriorMsgIDs
# sp = Gadfly.spy(mat)
# push!(sp.guides, Gadfly.Guide.title("$(cliq.attributes["label"]) || $(cliq.attributes["data"].frontalIDs) :$(cliq.attributes["data"].conditIDs)"))
# push!(sp.guides, Gadfly.Guide.xlabel("fmcmcs $(cliq.attributes["data"].itervarIDs)"))
# push!(sp.guides, Gadfly.Guide.ylabel("lcl=$(numlcl) || msg=$(size(getCliqMsgMat(cliq),1))" ))
# return sp
# end
# function spyCliqMat(bt::BayesTree, lbl::Symbol; showmsg=true)
# spyCliqMat(whichCliq(bt,lbl), showmsg=showmsg)
# end
function countSkips(bt::BayesTree)
skps = 0
for cliq in bt.cliques
m = getCliqMat(cliq[2])
mi = map(Int,m)
skps += sum(map(Int,sum(mi,1) .== 1))
end
return skps
end
function skipThroughMsgsIDs(cliq::Graphs.ExVertex)
numfrtl1 = floor(Int,length(cliq.attributes["data"].frontalIDs)+1)
condAssocMat = cliq.attributes["data"].cliqAssocMat[:,numfrtl1:end]
condMsgMat = cliq.attributes["data"].cliqMsgMat[:,numfrtl1:end]
mat = [condAssocMat;condMsgMat];
mab = sum(map(Int,mat),1) .== 1
mabM = sum(map(Int,condMsgMat),1) .== 1
mab = mab .& mabM
# rang = 1:size(condMsgMat,2)
msgidx = cliq.attributes["data"].conditIDs[vec(collect(mab))]
return msgidx
end
function directPriorMsgIDs(cliq::Graphs.ExVertex)
frtl = cliq.attributes["data"].frontalIDs
cond = cliq.attributes["data"].conditIDs
cols = [frtl;cond]
mat = getCliqMat(cliq, showmsg=true)
singr = sum(map(Int,mat),2) .== 1
rerows = collect(1:length(singr))
b = vec(collect(singr))
rerows2 = rerows[b]
sumsrAc = sum(map(Int,mat[rerows2,:]),1)
sumc = sum(map(Int,mat),1)
pmSkipCols = (sumsrAc - sumc) .== 0
return cols[vec(collect(pmSkipCols))]
end
function directFrtlMsgIDs(cliq::Graphs.ExVertex)
numfrtl = length(cliq.attributes["data"].frontalIDs)
frntAssocMat = cliq.attributes["data"].cliqAssocMat[:,1:numfrtl]
frtlMsgMat = cliq.attributes["data"].cliqMsgMat[:,1:numfrtl]
mat = [frntAssocMat; frtlMsgMat];
mab = sum(map(Int,mat),1) .== 1
mabM = sum(map(Int,frtlMsgMat),1) .== 1
mab = mab .& mabM
return cliq.attributes["data"].frontalIDs[vec(collect(mab))]
end
function directAssignmentIDs(cliq::Graphs.ExVertex)
# NOTE -- old version been included in iterated variable stack
assocMat = cliq.attributes["data"].cliqAssocMat
msgMat = cliq.attributes["data"].cliqMsgMat
mat = [assocMat;msgMat];
mab = sum(map(Int,mat),1) .== 1
mabA = sum(map(Int,assocMat),1) .== 1
mab = mab .& mabA
frtl = cliq.attributes["data"].frontalIDs
cond = cliq.attributes["data"].conditIDs
cols = [frtl;cond]
return cols[vec(collect(mab))]
# also calculate how which are conditionals
end
function mcmcIterationIDs(cliq::Graphs.ExVertex)
assocMat = cliq.attributes["data"].cliqAssocMat
msgMat = cliq.attributes["data"].cliqMsgMat
mat = [assocMat;msgMat];
sum(sum(map(Int,mat),1)) == 0 ? error("mcmcIterationIDs -- unaccounted variables") : nothing
mab = 1 .< sum(map(Int,mat),1)
frtl = cliq.attributes["data"].frontalIDs
cond = cliq.attributes["data"].conditIDs
cols = [frtl;cond]
# dev code
# prioritize prior'ed variables, then high degree next
# get all prior type rows, should be prioritized
# TODO -- maybe sort according to decreasing degree
# singleperrows = 1 .== sum(map(Int,mat),2)
# singleperrows = collect(singleperrows)
# prioredvarsum = sum(map(Int,mat[singleperrows]),1)
# prioredperm = sortperm(prioredvarsum, rev=true) # decreasing count
#end dev code
# final output
return cols[vec(collect(mab))]
end
function setCliqMCIDs!(cliq::Graphs.ExVertex)
cliq.attributes["data"].directPriorMsgIDs = directPriorMsgIDs(cliq)
# NOTE -- combined larger iter group
cliq.attributes["data"].directvarIDs = directAssignmentIDs(cliq)
# cliq.attributes["data"].itervarIDs = mcmcIterationIDs(cliq)
# NOTE -- fix direct vs itervar issue, DirectVarIDs against Iters should also Iter
usset = union(mcmcIterationIDs(cliq), directAssignmentIDs(cliq))
cliq.attributes["data"].itervarIDs = setdiff(usset, cliq.attributes["data"].directPriorMsgIDs)
cliq.attributes["data"].msgskipIDs = skipThroughMsgsIDs(cliq)
cliq.attributes["data"].directFrtlMsgIDs = directFrtlMsgIDs(cliq)
nothing
end
# post order tree traversal and build potential functions
function buildCliquePotentials(fg::FactorGraph, bt::BayesTree, cliq::Graphs.ExVertex)
for child in out_neighbors(cliq, bt.bt)#tree
buildCliquePotentials(fg, bt, child)
end
println("Get potentials $(cliq.attributes["label"])");
getCliquePotentials!(fg, bt, cliq);
compCliqAssocMatrices!(fg, bt, cliq);
setCliqMCIDs!(cliq);
nothing
end
| [
198,
4906,
4696,
274,
27660,
19667,
6601,
198,
220,
30424,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
1779,
270,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
287,
19662,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
1787,
47954,
3712,
38469,
90,
5317,
92,
1303,
428,
318,
1884,
30806,
16926,
46,
1377,
4781,
198,
220,
2785,
82,
3712,
38469,
90,
5317,
92,
198,
220,
537,
25011,
8021,
420,
19044,
3712,
19182,
90,
33,
970,
11,
17,
92,
198,
220,
537,
25011,
50108,
19044,
3712,
19182,
90,
33,
970,
11,
17,
92,
198,
220,
1277,
7785,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
1277,
6732,
28781,
50108,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
31456,
48267,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
340,
712,
283,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
1277,
22442,
50108,
47954,
3712,
38469,
90,
5317,
92,
198,
220,
14257,
198,
220,
14257,
35,
675,
198,
220,
4696,
274,
27660,
19667,
6601,
3419,
796,
649,
3419,
198,
220,
4696,
274,
27660,
19667,
6601,
7,
87,
23029,
796,
649,
7,
87,
58,
16,
4357,
87,
58,
17,
4357,
87,
58,
18,
4357,
87,
58,
19,
4357,
87,
58,
20,
4357,
87,
58,
21,
4357,
87,
58,
22,
4357,
87,
58,
23,
4357,
87,
58,
24,
4357,
87,
58,
940,
4357,
87,
58,
1157,
4357,
87,
58,
1065,
4357,
87,
58,
1485,
4357,
87,
58,
1415,
12962,
198,
437,
198,
198,
2,
16926,
46,
1377,
428,
815,
307,
257,
23772,
198,
8818,
6565,
19313,
19667,
6601,
3419,
198,
220,
4696,
274,
27660,
19667,
6601,
7,
5317,
58,
4357,
5317,
58,
4357,
5317,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2558,
58,
4357,
5317,
58,
4357,
19182,
90,
33,
970,
92,
7,
15,
11,
15,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
15690,
90,
33,
970,
92,
7,
15,
11,
15,
828,
5317,
58,
4357,
5317,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2558,
58,
4357,
5317,
58,
4357,
5317,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2147,
11,
2147,
8,
198,
437,
198,
198,
2,
4696,
274,
27660,
31713,
198,
4906,
4696,
274,
27660,
198,
220,
275,
83,
198,
220,
275,
83,
312,
3712,
5317,
198,
220,
537,
6368,
3712,
35,
713,
90,
5317,
11,
37065,
82,
13,
3109,
13414,
16886,
92,
198,
220,
2166,
874,
3712,
35,
713,
90,
10100,
11,
5317,
92,
198,
437,
198,
198,
8818,
6565,
15262,
274,
27660,
3419,
198,
220,
220,
220,
275,
83,
796,
220,
220,
4696,
274,
27660,
7,
37065,
82,
13,
259,
565,
396,
7,
37065,
82,
13,
3109,
13414,
16886,
11,
271,
62,
34762,
28,
7942,
828,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
657,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
360,
713,
90,
5317,
11,
37065,
82,
13,
3109,
13414,
16886,
92,
22784,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
58,
4357,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
360,
713,
90,
23839,
10100,
11,
2558,
92,
28955,
198,
220,
220,
220,
1441,
275,
83,
198,
437,
198,
198,
2,
2251,
257,
649,
537,
2350,
198,
8818,
751,
2601,
2350,
0,
7,
18347,
3712,
15262,
274,
27660,
11,
277,
70,
3712,
41384,
37065,
11,
1401,
2389,
3712,
5317,
11,
1779,
47954,
3712,
19182,
90,
5317,
92,
28,
5317,
58,
12962,
198,
220,
275,
83,
13,
18347,
312,
15853,
352,
198,
220,
537,
80,
796,
29681,
82,
13,
2860,
62,
332,
16886,
0,
7,
18347,
13,
18347,
11,
1475,
13414,
16886,
7,
18347,
13,
18347,
312,
11,
8841,
7203,
2601,
2350,
1600,
18347,
13,
18347,
312,
22305,
198,
220,
275,
83,
13,
565,
6368,
58,
18347,
13,
18347,
312,
60,
796,
537,
80,
628,
220,
537,
80,
13,
1078,
7657,
14692,
18242,
8973,
796,
13538,
198,
220,
1303,
17377,
1366,
9290,
198,
220,
537,
80,
13,
1078,
7657,
14692,
7890,
8973,
796,
6565,
19313,
19667,
6601,
3419,
628,
220,
24443,
2601,
2350,
0,
7,
18347,
11,
275,
83,
13,
18347,
312,
11,
277,
70,
11,
1401,
2389,
11,
1779,
47954,
8,
198,
220,
1441,
537,
80,
198,
437,
198,
198,
2,
7716,
262,
6167,
329,
1948,
537,
2350,
1377,
4823,
85,
528,
8263,
198,
8818,
787,
2601,
2350,
33986,
7,
69,
4743,
3712,
41384,
37065,
11,
275,
83,
3712,
15262,
274,
27660,
11,
537,
80,
2389,
3712,
5317,
8,
198,
220,
537,
80,
796,
275,
83,
13,
565,
6368,
58,
565,
80,
2389,
60,
198,
220,
781,
2436,
796,
13538,
198,
220,
537,
2436,
796,
13538,
198,
220,
329,
1216,
287,
537,
80,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
220,
220,
781,
2436,
796,
4731,
7,
2704,
2436,
11,
12001,
15042,
13,
1136,
332,
16886,
7,
69,
4743,
11,
8310,
737,
1078,
7657,
14692,
18242,
33116,
366,
553,
8,
1303,
69,
4743,
13,
85,
58,
8310,
4083,
198,
220,
886,
198,
220,
329,
1779,
287,
537,
80,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
220,
220,
537,
2436,
796,
4731,
7,
565,
2436,
11,
1957,
15042,
13,
1136,
332,
16886,
7,
69,
4743,
11,
17561,
737,
1078,
7657,
14692,
18242,
33116,
366,
553,
8,
1303,
277,
4743,
13,
85,
58,
17561,
4083,
198,
220,
886,
198,
220,
537,
80,
13,
1078,
7657,
14692,
18242,
8973,
796,
4731,
7,
2704,
2436,
11,
366,
25,
33172,
537,
2436,
8,
198,
437,
198,
198,
2,
751,
257,
26340,
4522,
284,
537,
2350,
198,
8818,
24443,
25559,
1859,
7,
18347,
3712,
15262,
274,
27660,
11,
537,
80,
2389,
3712,
5317,
11,
1779,
47954,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
220,
537,
80,
796,
275,
83,
13,
565,
6368,
58,
565,
80,
2389,
60,
198,
220,
537,
80,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
796,
6441,
7,
565,
80,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
11,
1779,
47954,
8,
198,
437,
198,
198,
2,
3060,
257,
649,
30424,
7885,
284,
537,
2350,
198,
8818,
24443,
2601,
2350,
0,
7,
18347,
3712,
15262,
274,
27660,
11,
537,
80,
2389,
3712,
5317,
11,
277,
70,
3712,
41384,
37065,
11,
1401,
2389,
3712,
5317,
11,
1779,
47954,
3712,
19182,
90,
5317,
11,
16,
92,
28,
5317,
58,
12962,
198,
220,
537,
80,
796,
275,
83,
13,
565,
6368,
58,
565,
80,
2389,
60,
198,
220,
1401,
796,
1957,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
1401,
2389,
8,
1303,
277,
70,
13,
85,
58,
7785,
2389,
60,
198,
220,
1303,
751,
30424,
7885,
198,
220,
4574,
0,
7,
565,
80,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
11,
7785,
2389,
8,
198,
220,
1303,
2472,
22155,
286,
2166,
874,
329,
2562,
1895,
198,
220,
275,
83,
13,
8534,
874,
58,
7785,
13,
1078,
7657,
14692,
18242,
8973,
60,
796,
537,
80,
2389,
2,
18347,
13,
18347,
312,
628,
220,
24443,
25559,
1859,
7,
18347,
11,
537,
80,
2389,
11,
1779,
47954,
8,
198,
220,
787,
2601,
2350,
33986,
7,
40616,
11,
275,
83,
11,
537,
80,
2389,
8,
198,
220,
2147,
198,
437,
628,
198,
2,
9113,
9386,
257,
649,
1200,
537,
2350,
287,
262,
5509,
198,
8818,
649,
16424,
2601,
2350,
0,
7,
18347,
3712,
15262,
274,
27660,
11,
277,
70,
3712,
41384,
37065,
11,
327,
79,
2389,
3712,
5317,
11,
1401,
2389,
3712,
5317,
11,
8621,
73,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
220,
442,
565,
80,
796,
751,
2601,
2350,
0,
7,
18347,
11,
277,
70,
11,
1401,
2389,
11,
8621,
73,
8,
198,
220,
2560,
796,
275,
83,
13,
565,
6368,
58,
34,
79,
2389,
60,
198,
220,
1303,
520,
8369,
351,
29681,
82,
13,
20362,
329,
5509,
287,
717,
3800,
198,
220,
5743,
796,
29681,
82,
13,
15883,
62,
14907,
7,
18347,
13,
18347,
11,
2560,
11,
442,
565,
80,
8,
198,
220,
29681,
82,
13,
2860,
62,
14907,
0,
7,
18347,
13,
18347,
11,
5743,
8,
628,
220,
1441,
442,
565,
80,
198,
437,
198,
198,
2,
1281,
1502,
5509,
33038,
282,
290,
1382,
2785,
5499,
198,
8818,
1064,
2601,
2350,
4863,
25886,
282,
7,
18347,
3712,
15262,
274,
27660,
11,
1216,
28781,
2389,
3712,
5317,
8,
198,
220,
329,
537,
25011,
47,
958,
287,
275,
83,
13,
565,
6368,
198,
220,
220,
220,
4686,
796,
537,
25011,
47,
958,
58,
16,
60,
198,
220,
220,
220,
537,
25011,
796,
537,
25011,
47,
958,
58,
17,
60,
198,
220,
220,
220,
329,
1216,
28781,
287,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
220,
220,
220,
220,
611,
1216,
28781,
6624,
1216,
28781,
2389,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
537,
25011,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
4049,
7203,
2601,
2350,
351,
10348,
30424,
4522,
407,
1043,
4943,
198,
437,
628,
198,
2,
11005,
257,
7885,
329,
649,
198,
8818,
649,
25396,
1843,
7,
21048,
3712,
15262,
274,
27660,
11,
277,
70,
3712,
41384,
37065,
11,
1401,
3712,
5317,
11,
8654,
19852,
3712,
5317,
11,
279,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
220,
220,
220,
37979,
1851,
796,
1957,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
7785,
8,
198,
220,
220,
220,
611,
357,
13664,
7,
1136,
6601,
7,
69,
343,
1851,
737,
25512,
1352,
8,
6624,
657,
8,
198,
220,
220,
220,
220,
220,
1303,
9828,
7203,
3605,
25396,
1843,
1377,
41767,
4129,
318,
657,
4943,
198,
220,
220,
220,
220,
220,
611,
357,
13664,
7,
21048,
13,
565,
6368,
8,
6624,
657,
8,
198,
220,
220,
220,
220,
220,
220,
220,
751,
2601,
2350,
0,
7,
21048,
11,
277,
70,
11,
1401,
8,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
24443,
2601,
2350,
0,
7,
21048,
11,
352,
11,
277,
70,
11,
1401,
8,
1303,
751,
284,
6808,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
311,
73,
796,
651,
6601,
7,
69,
343,
1851,
737,
25512,
1352,
198,
220,
220,
220,
220,
220,
1303,
1064,
2560,
537,
2350,
327,
79,
326,
3994,
912,
262,
717,
15254,
7885,
286,
311,
73,
355,
30424,
198,
220,
220,
220,
220,
220,
717,
417,
320,
796,
860,
24214,
24214,
2079,
198,
220,
220,
220,
220,
220,
329,
264,
287,
311,
73,
198,
220,
220,
220,
220,
220,
220,
220,
20218,
796,
1064,
11085,
7,
79,
11,
264,
8,
198,
220,
220,
220,
220,
220,
220,
220,
611,
357,
29510,
1279,
717,
417,
320,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
717,
417,
320,
796,
20218,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
10756,
2436,
796,
1957,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
279,
58,
11085,
417,
320,
35944,
1078,
7657,
14692,
18242,
8973,
198,
220,
220,
220,
220,
220,
327,
79,
2389,
796,
5509,
13,
8534,
874,
58,
69,
417,
2436,
60,
198,
220,
220,
220,
220,
220,
1303,
804,
284,
751,
428,
26340,
284,
262,
5509,
198,
220,
220,
220,
220,
220,
555,
4851,
796,
6441,
7,
21048,
13,
565,
6368,
58,
34,
79,
2389,
4083,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
11,
5509,
13,
565,
6368,
58,
34,
79,
2389,
4083,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
8,
198,
220,
220,
220,
220,
220,
611,
357,
30619,
7,
403,
4851,
8,
6624,
3297,
7,
50,
73,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
24443,
2601,
2350,
0,
7,
21048,
11,
327,
79,
2389,
11,
277,
70,
11,
1401,
8,
198,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
649,
16424,
2601,
2350,
0,
7,
21048,
11,
277,
70,
11,
327,
79,
2389,
11,
1401,
11,
311,
73,
8,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
1382,
262,
2187,
5509,
287,
15458,
5794,
198,
8818,
1382,
27660,
0,
7,
21048,
3712,
15262,
274,
27660,
11,
277,
70,
3712,
41384,
37065,
11,
279,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
220,
374,
79,
796,
14283,
27740,
7,
79,
11,
16,
8,
198,
220,
8654,
19852,
796,
657,
198,
220,
329,
1401,
287,
374,
79,
198,
220,
220,
220,
649,
25396,
1843,
7,
21048,
11,
277,
70,
11,
1401,
11,
8654,
19852,
11,
279,
8,
198,
220,
220,
220,
8654,
19852,
796,
1401,
198,
220,
886,
198,
437,
628,
198,
2235,
9938,
15458,
4901,
43594,
4610,
198,
8818,
3143,
33,
963,
27660,
0,
7,
40616,
3712,
41384,
37065,
26,
16216,
3712,
13940,
23650,
28,
25,
80,
81,
11,
19334,
12315,
3712,
33,
970,
28,
9562,
8,
198,
220,
279,
796,
10791,
37098,
818,
4288,
13,
1136,
36,
2475,
1883,
18743,
7,
40616,
11,
16216,
28,
34555,
8,
198,
220,
44872,
3419,
198,
220,
277,
469,
796,
2769,
30073,
7,
40616,
8,
198,
220,
44872,
7203,
25954,
4696,
274,
2010,
9313,
8,
198,
220,
1382,
15262,
274,
7934,
0,
7,
69,
469,
11,
279,
8,
628,
220,
5509,
796,
6565,
15262,
274,
27660,
3419,
198,
220,
1382,
27660,
0,
7,
21048,
11,
277,
469,
11,
279,
8,
628,
220,
44872,
7203,
15262,
274,
3433,
4943,
198,
220,
1303,
3993,
7,
15,
13,
16,
8,
198,
220,
1303,
69,
312,
796,
1280,
7203,
9374,
13,
26518,
2430,
86,
10,
4943,
198,
220,
1303,
13564,
7,
69,
312,
11,
1462,
62,
26518,
7,
69,
469,
13,
9374,
4008,
198,
220,
1303,
19836,
7,
69,
312,
8,
628,
220,
1303,
3899,
4941,
1377,
2124,
17,
3784,
87,
16,
11,
2124,
17,
3784,
87,
18,
11,
2124,
17,
3784,
87,
19,
11,
2124,
17,
3784,
75,
16,
11,
2124,
19,
3784,
87,
18,
11,
300,
16,
3784,
87,
18,
11,
300,
16,
3784,
87,
19,
198,
220,
44872,
7203,
15262,
274,
12200,
4943,
198,
220,
611,
3197,
12315,
198,
220,
220,
220,
49909,
796,
1280,
7203,
18347,
13,
26518,
2430,
86,
10,
4943,
198,
220,
220,
220,
3551,
7,
69,
312,
11,
1462,
62,
26518,
7,
21048,
13,
18347,
4008,
198,
220,
220,
220,
1969,
7,
69,
312,
8,
198,
220,
220,
220,
1057,
7,
63,
26518,
275,
83,
13,
26518,
532,
51,
12315,
532,
78,
275,
83,
13,
12315,
63,
8,
198,
220,
886,
628,
220,
1303,
29681,
53,
528,
13,
37065,
7,
1462,
62,
26518,
7,
21048,
13,
18347,
4008,
198,
220,
1303,
13256,
4941,
513,
82,
328,
1377,
2124,
17,
75,
16,
87,
19,
87,
18,
220,
220,
220,
2124,
16,
91,
87,
17,
628,
220,
44872,
7203,
16742,
2785,
5499,
329,
1123,
537,
2350,
4943,
198,
220,
537,
25011,
796,
5509,
13,
565,
6368,
58,
16,
60,
1303,
923,
379,
262,
6808,
198,
220,
1382,
2601,
2350,
25396,
14817,
7,
40616,
11,
5509,
11,
537,
25011,
1776,
1303,
277,
70,
857,
407,
423,
262,
6145,
6897,
355,
277,
469,
857,
628,
220,
1303,
783,
4296,
477,
5766,
4823,
9421,
1063,
973,
329,
428,
5509,
198,
220,
329,
410,
287,
9421,
1063,
7,
40616,
13,
70,
8,
198,
220,
220,
220,
288,
75,
15042,
13,
929,
67,
3587,
16886,
0,
7,
40616,
11,
410,
8,
198,
220,
886,
628,
220,
1441,
5509,
198,
437,
198,
198,
8818,
13259,
6601,
0,
7,
85,
7890,
3712,
43015,
19667,
6601,
8,
198,
220,
410,
7890,
13,
417,
320,
3898,
796,
3991,
198,
220,
410,
7890,
13,
15262,
274,
7934,
7975,
42369,
47954,
796,
2558,
21737,
198,
220,
410,
7890,
13,
15262,
274,
7934,
42369,
2389,
796,
657,
198,
220,
410,
7890,
13,
25512,
1352,
796,
2558,
21737,
198,
220,
2147,
198,
437,
198,
198,
8818,
13259,
6601,
0,
7,
85,
7890,
3712,
22203,
19667,
6601,
8,
198,
220,
410,
7890,
13,
417,
320,
3898,
796,
3991,
198,
220,
410,
7890,
13,
13059,
1843,
1484,
796,
3991,
198,
220,
2147,
198,
437,
198,
198,
8818,
13259,
41384,
37065,
3791,
27660,
0,
7,
40616,
3712,
41384,
37065,
8,
198,
220,
329,
410,
287,
9421,
1063,
7,
40616,
13,
70,
8,
198,
220,
220,
220,
13259,
6601,
0,
7,
1136,
6601,
7,
85,
4008,
198,
220,
220,
220,
1957,
15042,
13,
929,
67,
3587,
16886,
0,
7,
40616,
11,
410,
8,
198,
220,
886,
628,
220,
2147,
198,
437,
198,
198,
8818,
19916,
15580,
3791,
27660,
0,
7,
40616,
3712,
41384,
37065,
26,
16216,
28,
25,
80,
81,
11,
19334,
12315,
28,
9562,
8,
198,
220,
13259,
41384,
37065,
3791,
27660,
0,
7,
40616,
1776,
198,
220,
1441,
3143,
33,
963,
27660,
0,
7,
40616,
11,
16216,
28,
34555,
11,
3197,
12315,
28,
19334,
12315,
1776,
198,
437,
198,
198,
8818,
543,
2601,
25011,
90,
51,
1279,
25,
27741,
10100,
92,
7,
18347,
3712,
15262,
274,
27660,
11,
1216,
83,
3712,
51,
8,
198,
220,
220,
220,
275,
83,
13,
565,
6368,
58,
18347,
13,
8534,
874,
58,
8310,
83,
11907,
198,
437,
198,
4758,
2601,
25011,
7,
18347,
3712,
15262,
274,
27660,
11,
1216,
83,
3712,
13940,
23650,
8,
796,
543,
2601,
25011,
7,
18347,
11,
4731,
7,
8310,
83,
4008,
628,
198,
8818,
24443,
11041,
37,
310,
82,
0,
7,
1904,
69,
310,
82,
11,
300,
2436,
312,
3712,
5317,
11,
277,
310,
3712,
37065,
82,
13,
3109,
13414,
16886,
11,
49909,
3712,
5317,
8,
198,
220,
329,
256,
79,
287,
779,
69,
310,
82,
198,
220,
220,
220,
611,
256,
79,
6624,
277,
310,
13,
9630,
198,
220,
220,
220,
220,
220,
1441,
2147,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
256,
489,
796,
277,
310,
13,
9630,
198,
220,
4574,
0,
7,
1904,
69,
310,
82,
11,
256,
489,
1267,
198,
220,
2147,
198,
437,
628,
198,
198,
8818,
651,
2601,
2350,
25396,
14817,
0,
7,
40616,
3712,
41384,
37065,
11,
275,
83,
3712,
15262,
274,
27660,
11,
537,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
220,
220,
1216,
28781,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
220,
220,
1779,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
220,
220,
477,
2340,
796,
685,
8310,
28781,
26,
17561,
60,
198,
220,
220,
220,
477,
27740,
47954,
796,
2558,
21737,
198,
220,
220,
220,
329,
49909,
287,
1216,
28781,
198,
220,
220,
220,
220,
220,
477,
27740,
47954,
796,
685,
282,
335,
320,
47954,
26,
651,
6601,
7,
12001,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
69,
312,
29720,
27740,
47954,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
329,
269,
312,
287,
1779,
198,
220,
220,
220,
220,
220,
477,
27740,
47954,
796,
685,
282,
335,
320,
47954,
26,
651,
6601,
7,
12001,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
66,
312,
29720,
27740,
47954,
60,
198,
220,
220,
220,
886,
628,
220,
220,
220,
329,
49909,
287,
1216,
28781,
198,
220,
220,
220,
220,
220,
220,
220,
779,
69,
310,
82,
796,
17635,
198,
220,
220,
220,
220,
220,
220,
220,
329,
277,
310,
287,
1957,
15042,
13,
448,
710,
394,
32289,
7,
40616,
11,
1957,
15042,
13,
1136,
332,
16886,
7,
40616,
11,
69,
312,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
651,
6601,
7,
69,
310,
737,
13059,
1843,
1484,
0,
28,
7942,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
300,
448,
77,
796,
1957,
15042,
13,
448,
710,
394,
32289,
7,
40616,
11,
277,
310,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
4129,
7,
75,
448,
77,
8,
855,
16,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24443,
11041,
37,
310,
82,
0,
7,
1904,
69,
310,
82,
11,
277,
70,
13,
47954,
58,
13940,
23650,
7,
75,
448,
77,
58,
16,
4083,
18242,
8,
4357,
277,
310,
11,
49909,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
16926,
46,
1377,
787,
4296,
37423,
869,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
310,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
1843,
1484,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1957,
15042,
13,
929,
67,
3587,
16886,
0,
7,
40616,
11,
277,
310,
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,
329,
41767,
18243,
287,
300,
448,
77,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
6649,
2436,
796,
38357,
7,
325,
79,
18243,
13,
18242,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
357,
40616,
13,
47954,
58,
45163,
2436,
60,
6624,
49909,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2555,
1303,
14267,
262,
49909,
2346,
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,
5417,
796,
1064,
1084,
7,
8937,
12195,
439,
2340,
12,
40616,
13,
47954,
58,
45163,
2436,
60,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
5417,
58,
16,
60,
855,
15,
13,
15,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
24443,
11041,
37,
310,
82,
0,
7,
1904,
69,
310,
82,
11,
277,
70,
13,
47954,
58,
45163,
2436,
4357,
277,
310,
11,
49909,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
779,
69,
310,
82,
796,
685,
1904,
69,
310,
82,
26,
7,
40616,
13,
47954,
58,
45163,
2436,
4357,
277,
310,
11,
49909,
15437,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
277,
310,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
1843,
1484,
796,
2081,
1303,
69,
310,
13,
1078,
7657,
14692,
13059,
1843,
1484,
8973,
796,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1957,
15042,
13,
929,
67,
3587,
16886,
0,
7,
40616,
11,
277,
310,
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,
220,
220,
220,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
14817,
28,
24592,
7,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
14817,
11,
1904,
69,
310,
82,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2147,
198,
437,
198,
198,
8818,
651,
2601,
2350,
25396,
14817,
0,
7,
40616,
3712,
41384,
37065,
11,
275,
83,
3712,
15262,
274,
27660,
11,
442,
74,
565,
25011,
3712,
5317,
8,
198,
220,
220,
220,
651,
2601,
2350,
25396,
14817,
0,
7,
40616,
11,
275,
83,
13,
565,
6368,
58,
354,
74,
565,
25011,
12962,
198,
437,
198,
198,
8818,
537,
25011,
25396,
1843,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
1787,
47954,
796,
2558,
21737,
198,
220,
329,
4686,
69,
310,
287,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
14817,
198,
220,
220,
220,
4574,
0,
7,
13059,
47954,
11,
312,
69,
310,
8,
198,
220,
886,
198,
220,
1441,
1787,
47954,
198,
437,
198,
198,
8818,
2824,
19117,
283,
2024,
7,
18347,
3712,
15262,
274,
27660,
11,
537,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
477,
325,
862,
796,
2558,
21737,
198,
220,
329,
1200,
287,
503,
62,
710,
394,
32289,
7,
565,
25011,
11,
275,
83,
13,
18347,
8,
2,
21048,
198,
220,
220,
220,
220,
220,
477,
325,
862,
796,
685,
439,
325,
862,
26,
1200,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
60,
198,
220,
886,
198,
220,
1441,
477,
325,
862,
198,
437,
198,
198,
8818,
552,
2601,
25011,
8021,
420,
19044,
45977,
0,
7,
69,
4743,
3712,
41384,
37065,
11,
275,
83,
3712,
15262,
274,
27660,
11,
537,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
1216,
28781,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
1779,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
287,
19662,
47954,
796,
2824,
19117,
283,
2024,
7,
18347,
11,
537,
25011,
8,
198,
220,
1787,
47954,
796,
537,
25011,
25396,
1843,
47954,
7,
565,
25011,
8,
198,
220,
1303,
28407,
15814,
17593,
994,
198,
220,
1303,
17593,
468,
9633,
389,
15180,
11,
290,
6218,
14,
1102,
2536,
6003,
355,
15274,
198,
220,
951,
82,
796,
685,
8310,
28781,
26,
17561,
60,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
259,
19662,
47954,
796,
287,
19662,
47954,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
47954,
796,
1787,
47954,
198,
220,
537,
25011,
8021,
420,
19044,
796,
15690,
90,
33,
970,
11,
17,
92,
7,
13664,
7,
13059,
47954,
828,
4129,
7,
4033,
82,
4008,
198,
220,
537,
25011,
50108,
19044,
796,
15690,
90,
33,
970,
11,
17,
92,
7,
13664,
7,
259,
19662,
47954,
828,
4129,
7,
4033,
82,
4008,
198,
220,
6070,
0,
7,
565,
25011,
8021,
420,
19044,
11,
3991,
8,
198,
220,
6070,
0,
7,
565,
25011,
50108,
19044,
11,
3991,
8,
198,
220,
329,
474,
287,
352,
25,
13664,
7,
4033,
82,
8,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
13664,
7,
259,
19662,
47954,
8,
198,
220,
220,
220,
220,
220,
611,
951,
82,
58,
73,
60,
6624,
287,
19662,
47954,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
537,
25011,
50108,
19044,
58,
72,
11,
73,
60,
796,
2081,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
329,
1312,
287,
352,
25,
13664,
7,
13059,
47954,
8,
198,
220,
220,
220,
220,
220,
4686,
69,
310,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
13059,
14817,
58,
72,
60,
198,
220,
220,
220,
220,
220,
611,
4686,
69,
310,
6624,
1787,
47954,
58,
72,
60,
1303,
34182,
2198,
319,
537,
2350,
2785,
82,
16216,
198,
220,
220,
220,
220,
220,
220,
220,
329,
9421,
312,
87,
287,
651,
6601,
7,
1136,
42369,
7,
69,
4743,
11,
4686,
69,
310,
11,
40391,
28,
12001,
15042,
29720,
69,
10782,
853,
85,
2389,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
329,
9421,
312,
87,
287,
651,
6601,
7,
1136,
42369,
19667,
7,
69,
4743,
11,
4686,
69,
310,
29720,
69,
10782,
853,
85,
2389,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
9421,
312,
87,
6624,
951,
82,
58,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
537,
25011,
8021,
420,
19044,
58,
72,
11,
73,
60,
796,
2081,
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,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
778,
912,
75,
525,
81,
7203,
5589,
2601,
25011,
8021,
420,
19044,
45977,
0,
1377,
2785,
4522,
16216,
373,
2626,
4943,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
796,
537,
25011,
8021,
420,
19044,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
796,
537,
25011,
50108,
19044,
198,
220,
2147,
198,
437,
198,
198,
8818,
651,
2601,
25011,
8021,
420,
19044,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
198,
437,
198,
8818,
651,
2601,
25011,
50108,
19044,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
198,
437,
198,
8818,
651,
2601,
25011,
19044,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
26,
905,
19662,
28,
7942,
8,
198,
220,
840,
420,
19044,
796,
651,
2601,
25011,
8021,
420,
19044,
7,
565,
25011,
8,
198,
220,
31456,
19044,
796,
651,
2601,
25011,
50108,
19044,
7,
565,
25011,
8,
198,
220,
2603,
796,
905,
19662,
5633,
685,
562,
420,
19044,
26,
19662,
19044,
60,
1058,
840,
420,
19044,
198,
220,
1441,
2603,
198,
437,
198,
198,
2,
2163,
13997,
2601,
25011,
19044,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
26,
905,
19662,
28,
7942,
8,
198,
2,
220,
220,
2603,
796,
2769,
30073,
7,
1136,
2601,
25011,
19044,
7,
565,
25011,
11,
905,
19662,
28,
12860,
19662,
4008,
198,
2,
220,
220,
1303,
16926,
46,
1377,
751,
6596,
32704,
994,
11,
11629,
3691,
14267,
198,
2,
220,
220,
2603,
796,
3975,
7,
43879,
2414,
11,
2603,
27493,
17,
13,
15,
12,
16,
13,
15,
198,
2,
220,
220,
997,
75,
565,
796,
2546,
7,
1136,
2601,
25011,
8021,
420,
19044,
7,
565,
25011,
828,
16,
8,
198,
2,
220,
220,
2603,
58,
7,
22510,
75,
565,
10,
16,
2599,
437,
11,
47715,
1635,
28,
657,
13,
24,
198,
2,
220,
220,
2603,
58,
7,
22510,
75,
565,
10,
16,
2599,
437,
11,
47715,
48185,
657,
13,
16,
198,
2,
220,
220,
997,
8310,
28781,
16,
796,
4314,
7,
5317,
11,
13664,
7,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
47762,
16,
8,
198,
2,
220,
220,
2603,
58,
45299,
22510,
8310,
28781,
16,
25,
437,
60,
1635,
28,
657,
13,
24,
198,
2,
220,
220,
2603,
58,
45299,
22510,
8310,
28781,
16,
25,
437,
60,
48185,
657,
13,
16,
198,
2,
220,
220,
2488,
12860,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
270,
712,
283,
47954,
198,
2,
220,
220,
2488,
12860,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
7785,
47954,
198,
2,
220,
220,
2488,
12860,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
19662,
48267,
47954,
198,
2,
220,
220,
2488,
12860,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
6732,
28781,
50108,
47954,
198,
2,
220,
220,
2488,
12860,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
22442,
50108,
47954,
198,
2,
220,
220,
599,
796,
20925,
12254,
13,
2777,
88,
7,
6759,
8,
198,
2,
220,
220,
4574,
0,
7,
2777,
13,
5162,
1460,
11,
20925,
12254,
13,
47889,
13,
7839,
7203,
3,
7,
565,
25011,
13,
1078,
7657,
14692,
18242,
8973,
8,
8614,
29568,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
8,
1058,
3,
7,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
16725,
4008,
198,
2,
220,
220,
4574,
0,
7,
2777,
13,
5162,
1460,
11,
20925,
12254,
13,
47889,
13,
87,
18242,
7203,
38353,
11215,
6359,
29568,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
270,
712,
283,
47954,
16725,
4008,
198,
2,
220,
220,
4574,
0,
7,
2777,
13,
5162,
1460,
11,
20925,
12254,
13,
47889,
13,
2645,
9608,
7203,
75,
565,
43641,
7,
22510,
75,
565,
8,
8614,
31456,
43641,
7,
7857,
7,
1136,
2601,
25011,
50108,
19044,
7,
565,
25011,
828,
16,
4008,
1,
15306,
198,
2,
220,
220,
1441,
599,
198,
2,
886,
198,
2,
2163,
13997,
2601,
25011,
19044,
7,
18347,
3712,
15262,
274,
27660,
11,
300,
2436,
3712,
13940,
23650,
26,
905,
19662,
28,
7942,
8,
198,
2,
220,
220,
13997,
2601,
25011,
19044,
7,
4758,
2601,
25011,
7,
18347,
11,
75,
2436,
828,
905,
19662,
28,
12860,
19662,
8,
198,
2,
886,
198,
198,
8818,
954,
15739,
2419,
7,
18347,
3712,
15262,
274,
27660,
8,
198,
220,
1341,
862,
796,
657,
198,
220,
329,
537,
25011,
287,
275,
83,
13,
565,
6368,
198,
220,
220,
220,
285,
796,
651,
2601,
25011,
19044,
7,
565,
25011,
58,
17,
12962,
198,
220,
220,
220,
21504,
796,
3975,
7,
5317,
11,
76,
8,
198,
220,
220,
220,
1341,
862,
15853,
2160,
7,
8899,
7,
5317,
11,
16345,
7,
11632,
11,
16,
8,
764,
855,
352,
4008,
198,
220,
886,
198,
220,
1441,
1341,
862,
198,
437,
198,
198,
8818,
14267,
15046,
10128,
14542,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
997,
8310,
28781,
16,
796,
4314,
7,
5317,
11,
13664,
7,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
47762,
16,
8,
198,
220,
1779,
8021,
420,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
58,
45299,
22510,
8310,
28781,
16,
25,
437,
60,
198,
220,
1779,
50108,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
58,
45299,
22510,
8310,
28781,
16,
25,
437,
60,
198,
220,
2603,
796,
685,
17561,
8021,
420,
19044,
26,
17561,
50108,
19044,
11208,
198,
220,
285,
397,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
44,
796,
2160,
7,
8899,
7,
5317,
11,
17561,
50108,
19044,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
796,
285,
397,
764,
5,
285,
397,
44,
198,
220,
1303,
28077,
796,
352,
25,
7857,
7,
17561,
50108,
19044,
11,
17,
8,
198,
220,
31456,
312,
87,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
58,
35138,
7,
33327,
7,
76,
397,
4008,
60,
198,
220,
1441,
31456,
312,
87,
198,
437,
198,
198,
8818,
1277,
22442,
50108,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
1216,
28781,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
1779,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
951,
82,
796,
685,
8310,
28781,
26,
17561,
60,
198,
220,
2603,
796,
651,
2601,
25011,
19044,
7,
565,
25011,
11,
905,
19662,
28,
7942,
8,
198,
220,
1702,
81,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
17,
8,
764,
855,
352,
198,
220,
302,
8516,
796,
2824,
7,
16,
25,
13664,
7,
12215,
81,
4008,
198,
220,
275,
796,
43030,
7,
33327,
7,
12215,
81,
4008,
198,
220,
302,
8516,
17,
796,
302,
8516,
58,
65,
60,
198,
220,
21784,
81,
12832,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
58,
260,
8516,
17,
11,
25,
46570,
16,
8,
198,
220,
2160,
66,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
16,
8,
198,
220,
9114,
50232,
5216,
82,
796,
357,
82,
5700,
81,
12832,
532,
2160,
66,
8,
764,
855,
657,
198,
220,
1441,
951,
82,
58,
35138,
7,
33327,
7,
4426,
50232,
5216,
82,
4008,
60,
198,
437,
198,
198,
8818,
1277,
6732,
28781,
50108,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
997,
8310,
28781,
796,
4129,
7,
565,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
8,
198,
220,
1216,
429,
8021,
420,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
58,
45299,
16,
25,
22510,
8310,
28781,
60,
198,
220,
1216,
28781,
50108,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
58,
45299,
16,
25,
22510,
8310,
28781,
60,
198,
220,
2603,
796,
685,
8310,
429,
8021,
420,
19044,
26,
1216,
28781,
50108,
19044,
11208,
198,
220,
285,
397,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
44,
796,
2160,
7,
8899,
7,
5317,
11,
8310,
28781,
50108,
19044,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
796,
285,
397,
764,
5,
285,
397,
44,
198,
220,
1441,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
58,
35138,
7,
33327,
7,
76,
397,
4008,
60,
198,
437,
198,
198,
8818,
1277,
8021,
16747,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
1303,
24550,
1377,
1468,
2196,
587,
3017,
287,
11629,
515,
7885,
8931,
198,
220,
840,
420,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
198,
220,
31456,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
198,
220,
2603,
796,
685,
562,
420,
19044,
26,
19662,
19044,
11208,
198,
220,
285,
397,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
32,
796,
2160,
7,
8899,
7,
5317,
11,
562,
420,
19044,
828,
16,
8,
764,
855,
352,
198,
220,
285,
397,
796,
285,
397,
764,
5,
285,
397,
32,
198,
220,
1216,
28781,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
1779,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
951,
82,
796,
685,
8310,
28781,
26,
17561,
60,
198,
220,
1441,
951,
82,
58,
35138,
7,
33327,
7,
76,
397,
4008,
60,
198,
220,
1303,
635,
15284,
703,
543,
389,
4006,
874,
198,
437,
198,
198,
8818,
285,
11215,
66,
29993,
341,
47954,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
840,
420,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
8021,
420,
19044,
198,
220,
31456,
19044,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
565,
25011,
50108,
19044,
198,
220,
2603,
796,
685,
562,
420,
19044,
26,
19662,
19044,
11208,
198,
220,
2160,
7,
16345,
7,
8899,
7,
5317,
11,
6759,
828,
16,
4008,
6624,
657,
5633,
4049,
7203,
76,
11215,
66,
29993,
341,
47954,
1377,
48422,
276,
9633,
4943,
1058,
2147,
198,
220,
285,
397,
796,
352,
764,
27,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
16,
8,
198,
220,
1216,
28781,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
8534,
282,
47954,
198,
220,
1779,
796,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
17561,
270,
47954,
198,
220,
951,
82,
796,
685,
8310,
28781,
26,
17561,
60,
198,
220,
1303,
1614,
2438,
198,
220,
1303,
32980,
3161,
6,
276,
9633,
11,
788,
1029,
4922,
1306,
198,
220,
1303,
651,
477,
3161,
2099,
15274,
11,
815,
307,
19086,
1143,
198,
220,
1303,
16926,
46,
1377,
3863,
3297,
1864,
284,
24030,
4922,
198,
220,
1303,
2060,
525,
8516,
796,
352,
764,
855,
2160,
7,
8899,
7,
5317,
11,
6759,
828,
17,
8,
198,
220,
1303,
2060,
525,
8516,
796,
2824,
7,
29762,
525,
8516,
8,
198,
220,
1303,
1293,
1850,
85,
945,
388,
796,
2160,
7,
8899,
7,
5317,
11,
6759,
58,
29762,
525,
8516,
46570,
16,
8,
198,
220,
1303,
1293,
1850,
16321,
796,
3297,
16321,
7,
3448,
1850,
85,
945,
388,
11,
2710,
28,
7942,
8,
1303,
24030,
954,
628,
220,
1303,
437,
1614,
2438,
198,
220,
1303,
2457,
5072,
198,
220,
1441,
951,
82,
58,
35138,
7,
33327,
7,
76,
397,
4008,
60,
198,
437,
198,
198,
8818,
900,
2601,
25011,
9655,
47954,
0,
7,
565,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
22442,
50108,
47954,
796,
1277,
22442,
50108,
47954,
7,
565,
25011,
8,
628,
220,
1303,
24550,
1377,
5929,
4025,
11629,
1448,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
7785,
47954,
796,
1277,
8021,
16747,
47954,
7,
565,
25011,
8,
198,
220,
1303,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
270,
712,
283,
47954,
796,
285,
11215,
66,
29993,
341,
47954,
7,
565,
25011,
8,
198,
220,
1303,
24550,
1377,
4259,
1277,
3691,
340,
712,
283,
2071,
11,
4128,
19852,
47954,
1028,
314,
1010,
815,
635,
40806,
198,
220,
514,
2617,
796,
6441,
7,
76,
11215,
66,
29993,
341,
47954,
7,
565,
25011,
828,
1277,
8021,
16747,
47954,
7,
565,
25011,
4008,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
270,
712,
283,
47954,
796,
900,
26069,
7,
1046,
316,
11,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
22442,
50108,
47954,
8,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
19662,
48267,
47954,
796,
14267,
15046,
10128,
14542,
47954,
7,
565,
25011,
8,
198,
220,
537,
25011,
13,
1078,
7657,
14692,
7890,
1,
4083,
12942,
6732,
28781,
50108,
47954,
796,
1277,
6732,
28781,
50108,
47954,
7,
565,
25011,
8,
628,
198,
220,
2147,
198,
437,
628,
198,
2,
1281,
1502,
5509,
33038,
282,
290,
1382,
2785,
5499,
198,
8818,
1382,
2601,
2350,
25396,
14817,
7,
40616,
3712,
41384,
37065,
11,
275,
83,
3712,
15262,
274,
27660,
11,
537,
25011,
3712,
37065,
82,
13,
3109,
13414,
16886,
8,
198,
220,
220,
220,
329,
1200,
287,
503,
62,
710,
394,
32289,
7,
565,
25011,
11,
275,
83,
13,
18347,
8,
2,
21048,
198,
220,
220,
220,
220,
220,
220,
220,
1382,
2601,
2350,
25396,
14817,
7,
40616,
11,
275,
83,
11,
1200,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
44872,
7203,
3855,
2785,
82,
29568,
565,
25011,
13,
1078,
7657,
14692,
18242,
8973,
8,
15341,
198,
220,
220,
220,
651,
2601,
2350,
25396,
14817,
0,
7,
40616,
11,
275,
83,
11,
537,
25011,
1776,
628,
220,
220,
220,
552,
2601,
25011,
8021,
420,
19044,
45977,
0,
7,
40616,
11,
275,
83,
11,
537,
25011,
1776,
198,
220,
220,
220,
900,
2601,
25011,
9655,
47954,
0,
7,
565,
25011,
1776,
628,
220,
220,
220,
2147,
198,
437,
198
] | 2.293324 | 7,190 |
function intersects_geometry(m::AbstractAccretionGeometry{T}, line_element) where {T}
if in_nearby_region(m, line_element)
return has_intersect(m, line_element)
end
false
end
in_nearby_region(d::AbstractAccretionGeometry{T}, line_element) where {T} =
error("Not implemented for $(typeof(d))")
has_intersect(d::AbstractAccretionGeometry{T}, line_element) where {T} =
error("Not implemented for $(typeof(d))")
# Jiménez, Segura, Feito. Computation Geometry 43 (2010) 474-492
function jsr_algorithm(V₁::T, V₂::T, V₃::T, Q₁::V, Q₂::V; ϵ = 1e-8) where {T,V}
A = Q₁ .- V₃
B = V₁ .- V₃
C = V₂ .- V₃
W₁ = B × C
w = A ⋅ W₁
if w > ϵ
D = Q₂ .- V₃
s = D ⋅ W₁
s > ϵ && return false
W₂ = A × D
t = W₂ ⋅ C
t < -ϵ && return false
u = -W₂ ⋅ B
u < -ϵ && return false
w < s + t + u && return false
elseif w < -ϵ
return false
else # w == 0
D = Q₂ .- V₃
s = D ⋅ W₁
if s > ϵ
return false
elseif s < -ϵ
W₂ = D × A
t = W₂ ⋅ C
t > ϵ && return false
u = -W₂ ⋅ B
u > ϵ && return false
-s > t + u && return false
else
return false
end
end
true
end
| [
198,
8818,
36177,
82,
62,
469,
15748,
7,
76,
3712,
23839,
17320,
12307,
10082,
15748,
90,
51,
5512,
1627,
62,
30854,
8,
810,
1391,
51,
92,
198,
220,
220,
220,
611,
287,
62,
40093,
1525,
62,
36996,
7,
76,
11,
1627,
62,
30854,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
468,
62,
3849,
8831,
7,
76,
11,
1627,
62,
30854,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
3991,
198,
437,
198,
198,
259,
62,
40093,
1525,
62,
36996,
7,
67,
3712,
23839,
17320,
12307,
10082,
15748,
90,
51,
5512,
1627,
62,
30854,
8,
810,
1391,
51,
92,
796,
198,
220,
220,
220,
4049,
7203,
3673,
9177,
329,
29568,
4906,
1659,
7,
67,
4008,
4943,
198,
10134,
62,
3849,
8831,
7,
67,
3712,
23839,
17320,
12307,
10082,
15748,
90,
51,
5512,
1627,
62,
30854,
8,
810,
1391,
51,
92,
796,
198,
220,
220,
220,
4049,
7203,
3673,
9177,
329,
29568,
4906,
1659,
7,
67,
4008,
4943,
198,
198,
2,
5395,
2634,
710,
89,
11,
31220,
5330,
11,
5452,
10094,
13,
22476,
341,
2269,
15748,
5946,
357,
10333,
8,
604,
4524,
12,
40256,
198,
8818,
474,
27891,
62,
282,
42289,
7,
53,
158,
224,
223,
3712,
51,
11,
569,
158,
224,
224,
3712,
51,
11,
569,
158,
224,
225,
3712,
51,
11,
1195,
158,
224,
223,
3712,
53,
11,
1195,
158,
224,
224,
3712,
53,
26,
18074,
113,
796,
352,
68,
12,
23,
8,
810,
1391,
51,
11,
53,
92,
198,
220,
220,
220,
317,
796,
1195,
158,
224,
223,
764,
12,
569,
158,
224,
225,
198,
220,
220,
220,
347,
796,
569,
158,
224,
223,
764,
12,
569,
158,
224,
225,
198,
220,
220,
220,
327,
796,
569,
158,
224,
224,
764,
12,
569,
158,
224,
225,
198,
220,
220,
220,
370,
158,
224,
223,
796,
347,
13958,
327,
198,
220,
220,
220,
266,
796,
317,
2343,
233,
227,
370,
158,
224,
223,
198,
220,
220,
220,
611,
266,
1875,
18074,
113,
198,
220,
220,
220,
220,
220,
220,
220,
360,
796,
1195,
158,
224,
224,
764,
12,
569,
158,
224,
225,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
360,
2343,
233,
227,
370,
158,
224,
223,
198,
220,
220,
220,
220,
220,
220,
220,
264,
1875,
18074,
113,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
370,
158,
224,
224,
796,
317,
13958,
360,
198,
220,
220,
220,
220,
220,
220,
220,
256,
796,
370,
158,
224,
224,
2343,
233,
227,
327,
198,
220,
220,
220,
220,
220,
220,
220,
256,
1279,
532,
139,
113,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
334,
796,
532,
54,
158,
224,
224,
2343,
233,
227,
347,
198,
220,
220,
220,
220,
220,
220,
220,
334,
1279,
532,
139,
113,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
266,
1279,
264,
1343,
256,
1343,
334,
11405,
1441,
3991,
198,
220,
220,
220,
2073,
361,
266,
1279,
532,
139,
113,
198,
220,
220,
220,
220,
220,
220,
220,
1441,
3991,
198,
220,
220,
220,
2073,
1303,
1849,
86,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
360,
796,
1195,
158,
224,
224,
764,
12,
569,
158,
224,
225,
198,
220,
220,
220,
220,
220,
220,
220,
264,
796,
360,
2343,
233,
227,
370,
158,
224,
223,
198,
220,
220,
220,
220,
220,
220,
220,
611,
264,
1875,
18074,
113,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
361,
264,
1279,
532,
139,
113,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
370,
158,
224,
224,
796,
360,
13958,
317,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
796,
370,
158,
224,
224,
2343,
233,
227,
327,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
1875,
18074,
113,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
796,
532,
54,
158,
224,
224,
2343,
233,
227,
347,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
334,
1875,
18074,
113,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
532,
82,
1875,
256,
1343,
334,
11405,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
3991,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2081,
198,
437,
198
] | 1.72346 | 763 |
module Sodium
typealias size_t Csize_t
typealias uint32_t Uint32
typealias uint8_t Uint8
include("ls_exports_h.jl")
include("ls_common_h.jl")
include("ls_sodium_h.jl")
include("ls_defines_h.jl")
end
| [
21412,
47942,
198,
198,
4906,
26011,
2546,
62,
83,
327,
7857,
62,
83,
198,
4906,
26011,
20398,
2624,
62,
83,
471,
600,
2624,
198,
4906,
26011,
20398,
23,
62,
83,
471,
600,
23,
198,
198,
17256,
7203,
7278,
62,
1069,
3742,
62,
71,
13,
20362,
4943,
198,
17256,
7203,
7278,
62,
11321,
62,
71,
13,
20362,
4943,
198,
17256,
7203,
7278,
62,
82,
12664,
62,
71,
13,
20362,
4943,
198,
17256,
7203,
7278,
62,
4299,
1127,
62,
71,
13,
20362,
4943,
198,
198,
437,
198
] | 2.376471 | 85 |
using Flux, Flux.Tracker
using NeuralProcesses, NeuralProcesses.Experiment
using Distributions
using Plots
using Random
using PyCall
@pyimport pickle
function save(path, obj)
out = open(path, "w")
pickle.dump(obj, out)
close(out)
end
convcnp = NeuralProcesses.untrack(best_model("models/convcnp/loglik/sawtooth.bson"))
convnp = NeuralProcesses.untrack(best_model("models/convnp/loglik/sawtooth.bson"))
p = Sawtooth()
xt = collect(range(-2, 2, length=600))
yt = reshape(rand(p(xt, 1e-10)), :)
inds = sort(randperm(length(xt))[1:7])
xc = xt[inds]
yc = yt[inds]
save("sawtooth/data.pickle", Dict(
"xc" => xc,
"yc" => yc,
"xt" => xt,
"yt" => yt
))
xc = reshape(xc, :, 1, 1)
yc = reshape(yc, :, 1, 1)
xt = reshape(xt, :, 1, 1)
yt = reshape(yt, :, 1, 1)
# Embedding:
xz = convcnp.encoder.disc(xc, xt, margin=16f0)
xz, z = code(convcnp.encoder.coder[1], xc, yc, xz)
inds = reshape((xz .>= -2) .& (xz .<= 2), :)
plot(xz[inds, 1, 1], z[inds, 1, 1])
save("sawtooth/embedding.pickle", Dict(
"xz" => xz[inds, 1, 1],
"z1" => z[inds, 1, 1],
"z2" => z[inds, 2, 1]
))
xz, z = code(convcnp.encoder.coder[2], xz, z, xz)
z = NeuralProcesses.sample(z, num_samples=1)
# CNN:
xz, z = code(convcnp.decoder[1], xz, z, xt)
save("sawtooth/embedding_cnn.pickle", Dict(
"xz" => xz[inds, 1, 1],
"z1" => z[inds, 1, 1],
"z2" => z[inds, 2, 1]
))
xz, z = code(convcnp.decoder[2], xz, z, xt)
xz, z = code(convcnp.decoder[3], xz, z, xt)
xc = reshape(xc, :)
yc = reshape(yc, :)
xt = reshape(xt, :)
yt = reshape(yt, :)
μ = reshape(mean(z), :)
σ = reshape(std(z), :)
# Prediction:
save("sawtooth/pred.pickle", Dict(
"xt" => xt,
"mu" => μ,
"std" => σ
))
# Also predict with ConvNP:
_, _, _, samples = predict(convnp, xc, yc, xt; margin=16f0)
save("sawtooth/pred_convnp.pickle", Dict(
"xt" => xt,
"samples" => samples
))
| [
3500,
1610,
2821,
11,
1610,
2821,
13,
35694,
198,
3500,
47986,
18709,
274,
11,
47986,
18709,
274,
13,
20468,
3681,
198,
3500,
46567,
507,
198,
3500,
1345,
1747,
198,
3500,
14534,
198,
3500,
9485,
14134,
198,
198,
31,
9078,
11748,
2298,
293,
198,
198,
8818,
3613,
7,
6978,
11,
26181,
8,
198,
220,
220,
220,
503,
796,
1280,
7,
6978,
11,
366,
86,
4943,
198,
220,
220,
220,
2298,
293,
13,
39455,
7,
26801,
11,
503,
8,
198,
220,
220,
220,
1969,
7,
448,
8,
198,
437,
198,
198,
1102,
28435,
37659,
796,
47986,
18709,
274,
13,
403,
11659,
7,
13466,
62,
19849,
7203,
27530,
14,
1102,
28435,
37659,
14,
6404,
46965,
14,
43439,
1462,
849,
13,
1443,
261,
48774,
198,
42946,
37659,
796,
47986,
18709,
274,
13,
403,
11659,
7,
13466,
62,
19849,
7203,
27530,
14,
42946,
37659,
14,
6404,
46965,
14,
43439,
1462,
849,
13,
1443,
261,
48774,
198,
198,
79,
796,
19882,
1462,
849,
3419,
198,
198,
742,
796,
2824,
7,
9521,
32590,
17,
11,
362,
11,
4129,
28,
8054,
4008,
198,
20760,
796,
27179,
1758,
7,
25192,
7,
79,
7,
742,
11,
352,
68,
12,
940,
36911,
14373,
198,
521,
82,
796,
3297,
7,
25192,
16321,
7,
13664,
7,
742,
4008,
58,
16,
25,
22,
12962,
198,
25306,
796,
220,
742,
58,
521,
82,
60,
198,
88,
66,
796,
331,
83,
58,
521,
82,
60,
198,
198,
21928,
7203,
43439,
1462,
849,
14,
7890,
13,
27729,
293,
1600,
360,
713,
7,
198,
220,
220,
220,
366,
25306,
1,
5218,
2124,
66,
11,
198,
220,
220,
220,
366,
88,
66,
1,
5218,
331,
66,
11,
198,
220,
220,
220,
366,
742,
1,
5218,
220,
742,
11,
198,
220,
220,
220,
366,
20760,
1,
5218,
331,
83,
198,
4008,
198,
198,
25306,
796,
27179,
1758,
7,
25306,
11,
1058,
11,
352,
11,
352,
8,
198,
88,
66,
796,
27179,
1758,
7,
88,
66,
11,
1058,
11,
352,
11,
352,
8,
198,
742,
796,
27179,
1758,
7,
742,
11,
1058,
11,
352,
11,
352,
8,
198,
20760,
796,
27179,
1758,
7,
20760,
11,
1058,
11,
352,
11,
352,
8,
198,
198,
2,
13302,
6048,
278,
25,
198,
87,
89,
796,
3063,
31522,
79,
13,
12685,
12342,
13,
15410,
7,
25306,
11,
220,
742,
11,
10330,
28,
1433,
69,
15,
8,
198,
87,
89,
11,
1976,
796,
2438,
7,
1102,
28435,
37659,
13,
12685,
12342,
13,
66,
12342,
58,
16,
4357,
2124,
66,
11,
331,
66,
11,
2124,
89,
8,
198,
198,
521,
82,
796,
27179,
1758,
19510,
87,
89,
764,
29,
28,
532,
17,
8,
764,
5,
357,
87,
89,
764,
27,
28,
362,
828,
14373,
198,
29487,
7,
87,
89,
58,
521,
82,
11,
352,
11,
352,
4357,
1976,
58,
521,
82,
11,
352,
11,
352,
12962,
198,
21928,
7203,
43439,
1462,
849,
14,
20521,
12083,
13,
27729,
293,
1600,
360,
713,
7,
198,
220,
220,
220,
366,
87,
89,
1,
5218,
2124,
89,
58,
521,
82,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
366,
89,
16,
1,
5218,
1976,
58,
521,
82,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
366,
89,
17,
1,
5218,
1976,
58,
521,
82,
11,
362,
11,
352,
60,
198,
4008,
198,
198,
87,
89,
11,
1976,
796,
2438,
7,
1102,
28435,
37659,
13,
12685,
12342,
13,
66,
12342,
58,
17,
4357,
2124,
89,
11,
1976,
11,
2124,
89,
8,
198,
89,
796,
47986,
18709,
274,
13,
39873,
7,
89,
11,
997,
62,
82,
12629,
28,
16,
8,
198,
198,
2,
8100,
25,
198,
87,
89,
11,
1976,
796,
2438,
7,
1102,
28435,
37659,
13,
12501,
12342,
58,
16,
4357,
2124,
89,
11,
1976,
11,
220,
742,
8,
198,
21928,
7203,
43439,
1462,
849,
14,
20521,
12083,
62,
66,
20471,
13,
27729,
293,
1600,
360,
713,
7,
198,
220,
220,
220,
366,
87,
89,
1,
5218,
2124,
89,
58,
521,
82,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
366,
89,
16,
1,
5218,
1976,
58,
521,
82,
11,
352,
11,
352,
4357,
198,
220,
220,
220,
366,
89,
17,
1,
5218,
1976,
58,
521,
82,
11,
362,
11,
352,
60,
198,
4008,
198,
198,
87,
89,
11,
1976,
796,
2438,
7,
1102,
28435,
37659,
13,
12501,
12342,
58,
17,
4357,
2124,
89,
11,
1976,
11,
220,
742,
8,
198,
87,
89,
11,
1976,
796,
2438,
7,
1102,
28435,
37659,
13,
12501,
12342,
58,
18,
4357,
2124,
89,
11,
1976,
11,
220,
742,
8,
198,
198,
25306,
796,
27179,
1758,
7,
25306,
11,
14373,
198,
88,
66,
796,
27179,
1758,
7,
88,
66,
11,
14373,
198,
742,
796,
27179,
1758,
7,
742,
11,
14373,
198,
20760,
796,
27179,
1758,
7,
20760,
11,
14373,
198,
198,
34703,
796,
27179,
1758,
7,
32604,
7,
89,
828,
14373,
198,
38392,
796,
27179,
1758,
7,
19282,
7,
89,
828,
14373,
198,
198,
2,
46690,
25,
198,
21928,
7203,
43439,
1462,
849,
14,
28764,
13,
27729,
293,
1600,
360,
713,
7,
198,
220,
220,
220,
366,
742,
1,
5218,
220,
742,
11,
198,
220,
220,
220,
366,
30300,
1,
5218,
18919,
11,
198,
220,
220,
220,
366,
19282,
1,
5218,
18074,
225,
198,
4008,
198,
198,
2,
4418,
4331,
351,
34872,
22182,
25,
198,
62,
11,
4808,
11,
4808,
11,
8405,
796,
4331,
7,
42946,
37659,
11,
2124,
66,
11,
331,
66,
11,
220,
742,
26,
10330,
28,
1433,
69,
15,
8,
198,
21928,
7203,
43439,
1462,
849,
14,
28764,
62,
42946,
37659,
13,
27729,
293,
1600,
360,
713,
7,
198,
220,
220,
220,
366,
742,
1,
5218,
220,
742,
11,
198,
220,
220,
220,
366,
82,
12629,
1,
5218,
8405,
198,
4008,
628
] | 2.008593 | 931 |
__precompile__()
module Configs
include("utils.jl")
using JSON, Memoize
export getconfig,
setconfig!,
hasconfig,
initconfig
configs = nothing
const configs_defaultorder = [
"default.json",
"custom-environment-variables.json"
]
function initconfig(;deployment_key = "DEPLOYMENT", configs_directory = "configs")::NamedTuple
global configs = Dict{String, Any}()
configs_order = copy(configs_defaultorder)
configs_directory = parseenvkey("CONFIGS_DIRECTORY", configs_directory)
deployment_key = parseenvkey("DEPLOYMENT_KEY", deployment_key)
configs_files = getfiles(configs_directory)
deployment = parseenvkey(deployment_key, false)
deployment != false && insert!(configs_order, 2, lowercase(deployment) * ".json")
filter!((file)-> file in configs_files, configs_order)
for file in configs_order
open(joinpath(configs_directory, file), "r") do filepath
file_content = String(read(filepath))
newtree = JSON.parse(file_content)
if file === "custom-environment-variables.json"
parsecustomenv!(newtree)
end
override!(configs, newtree)
end
end
(; configs_directory = configs_directory, deployment_key = deployment_key, configs_order = configs_order)
end
@memoize Dict{Tuple{String}, Any} function getconfig(path::String = "")
global configs
configs === nothing && initconfig()
configs isa Dict && (configs = makeimmutable(configs))
path === "" && return configs
epath = Meta.parse("configs.$path")
try
eval(epath)
catch err
throw(Configserror("no such config: " * path))
end
end
function setconfig!(path::String, value::String)
try
value = JSON.parse(value)
catch err
end
value = pathtodict(path, value)
setconfig!(value)
end
function setconfig!(path::String, value)
value = pathtodict(path, value)
setconfig!(value)
end
function setconfig!(path::String, value::Union{Tuple, AbstractArray, NamedTuple, Dict})
value = json(value) |> JSON.parse
value = pathtodict(path, value)
setconfig!(value)
end
function setconfig!(value::Dict)
configs === nothing && initconfig()
configs isa NamedTuple && throw(Configserror("""config is immutable. Please set all values before calling "get" """))
override!(configs, value)
end
function hasconfig(path::String)::Bool
path === "" && throw(Configserror("a path is required to query a config"))
configs === nothing && initconfig()
subpaths = split(path, ".")
ref = configs
for i in eachindex(subpaths)
subpath = Symbol(subpaths[i])
if haskey(ref, subpath)
length(subpaths) === i && return true
ref = ref[subpath]
else
return false
end
end
end
end
| [
834,
3866,
5589,
576,
834,
3419,
198,
198,
21412,
17056,
82,
198,
220,
220,
220,
2291,
7203,
26791,
13,
20362,
4943,
198,
220,
220,
220,
1262,
19449,
11,
4942,
78,
1096,
198,
220,
220,
220,
10784,
220,
651,
11250,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
900,
11250,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
468,
11250,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2315,
11250,
628,
220,
220,
220,
4566,
82,
796,
2147,
198,
220,
220,
220,
1500,
4566,
82,
62,
12286,
2875,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
366,
12286,
13,
17752,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
366,
23144,
12,
38986,
12,
25641,
2977,
13,
17752,
1,
198,
220,
220,
220,
2361,
628,
220,
220,
220,
2163,
2315,
11250,
7,
26,
2934,
1420,
434,
62,
2539,
796,
366,
7206,
6489,
21414,
10979,
1600,
4566,
82,
62,
34945,
796,
366,
11250,
82,
1,
2599,
25,
45,
2434,
51,
29291,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
4566,
82,
796,
360,
713,
90,
10100,
11,
4377,
92,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
62,
2875,
796,
4866,
7,
11250,
82,
62,
12286,
2875,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
62,
34945,
796,
1582,
15898,
85,
2539,
7203,
10943,
16254,
50,
62,
17931,
23988,
15513,
1600,
4566,
82,
62,
34945,
8,
198,
220,
220,
220,
220,
220,
220,
220,
14833,
62,
2539,
796,
1582,
15898,
85,
2539,
7203,
7206,
6489,
21414,
10979,
62,
20373,
1600,
14833,
62,
2539,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
62,
16624,
796,
651,
16624,
7,
11250,
82,
62,
34945,
8,
198,
220,
220,
220,
220,
220,
220,
220,
14833,
796,
1582,
15898,
85,
2539,
7,
2934,
1420,
434,
62,
2539,
11,
3991,
8,
198,
220,
220,
220,
220,
220,
220,
220,
14833,
14512,
3991,
11405,
7550,
0,
7,
11250,
82,
62,
2875,
11,
362,
11,
2793,
7442,
7,
2934,
1420,
434,
8,
1635,
27071,
17752,
4943,
628,
220,
220,
220,
220,
220,
220,
220,
8106,
0,
19510,
7753,
8,
3784,
2393,
287,
4566,
82,
62,
16624,
11,
4566,
82,
62,
2875,
8,
198,
220,
220,
220,
220,
220,
220,
220,
329,
2393,
287,
4566,
82,
62,
2875,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1280,
7,
22179,
6978,
7,
11250,
82,
62,
34945,
11,
2393,
828,
366,
81,
4943,
466,
2393,
6978,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2393,
62,
11299,
796,
10903,
7,
961,
7,
7753,
6978,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
649,
21048,
796,
19449,
13,
29572,
7,
7753,
62,
11299,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
2393,
24844,
366,
23144,
12,
38986,
12,
25641,
2977,
13,
17752,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1582,
2363,
1824,
24330,
0,
7,
3605,
21048,
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,
20957,
0,
7,
11250,
82,
11,
649,
21048,
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,
357,
26,
4566,
82,
62,
34945,
796,
4566,
82,
62,
34945,
11,
14833,
62,
2539,
796,
14833,
62,
2539,
11,
4566,
82,
62,
2875,
796,
4566,
82,
62,
2875,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
11883,
78,
1096,
360,
713,
90,
51,
29291,
90,
10100,
5512,
4377,
92,
2163,
651,
11250,
7,
6978,
3712,
10100,
796,
366,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
3298,
4566,
82,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
24844,
2147,
11405,
2315,
11250,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
318,
64,
360,
713,
11405,
357,
11250,
82,
796,
787,
8608,
18187,
7,
11250,
82,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
24844,
13538,
11405,
1441,
4566,
82,
198,
220,
220,
220,
220,
220,
220,
220,
2462,
776,
796,
30277,
13,
29572,
7203,
11250,
82,
48082,
6978,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5418,
7,
538,
776,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4929,
11454,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3714,
7,
16934,
2655,
1472,
7203,
3919,
884,
4566,
25,
366,
1635,
3108,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
900,
11250,
0,
7,
6978,
3712,
10100,
11,
1988,
3712,
10100,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1949,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
19449,
13,
29572,
7,
8367,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4929,
11454,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
3108,
83,
375,
713,
7,
6978,
11,
1988,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
11250,
0,
7,
8367,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2163,
900,
11250,
0,
7,
6978,
3712,
10100,
11,
1988,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
3108,
83,
375,
713,
7,
6978,
11,
1988,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
11250,
0,
7,
8367,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2163,
900,
11250,
0,
7,
6978,
3712,
10100,
11,
1988,
3712,
38176,
90,
51,
29291,
11,
27741,
19182,
11,
34441,
51,
29291,
11,
360,
713,
30072,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
33918,
7,
8367,
8,
930,
29,
19449,
13,
29572,
198,
220,
220,
220,
220,
220,
220,
220,
1988,
796,
3108,
83,
375,
713,
7,
6978,
11,
1988,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
11250,
0,
7,
8367,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2163,
900,
11250,
0,
7,
8367,
3712,
35,
713,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
24844,
2147,
11405,
2315,
11250,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
318,
64,
34441,
51,
29291,
11405,
3714,
7,
16934,
2655,
1472,
7203,
15931,
11250,
318,
40139,
13,
4222,
900,
477,
3815,
878,
4585,
366,
1136,
1,
37227,
4008,
198,
220,
220,
220,
220,
220,
220,
220,
20957,
0,
7,
11250,
82,
11,
1988,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2163,
468,
11250,
7,
6978,
3712,
10100,
2599,
25,
33,
970,
198,
220,
220,
220,
220,
220,
220,
220,
3108,
24844,
13538,
11405,
3714,
7,
16934,
2655,
1472,
7203,
64,
3108,
318,
2672,
284,
12405,
257,
4566,
48774,
198,
220,
220,
220,
220,
220,
220,
220,
4566,
82,
24844,
2147,
11405,
2315,
11250,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
850,
6978,
82,
796,
6626,
7,
6978,
11,
366,
19570,
198,
220,
220,
220,
220,
220,
220,
220,
1006,
796,
4566,
82,
198,
220,
220,
220,
220,
220,
220,
220,
329,
1312,
287,
1123,
9630,
7,
7266,
6978,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
850,
6978,
796,
38357,
7,
7266,
6978,
82,
58,
72,
12962,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
468,
2539,
7,
5420,
11,
850,
6978,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4129,
7,
7266,
6978,
82,
8,
24844,
1312,
11405,
1441,
2081,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1006,
796,
1006,
58,
7266,
6978,
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,
1441,
3991,
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,
437,
198
] | 2.220588 | 1,428 |
"""
function cudaAdapt_(code)
Function that adapts vector declarations and math functions to CUDA.
"""
function cudaAdapt_(code::Expr)
#Subs all math
l = [i for i in names(Base.Math) if isdefined(CUDA,i) && i != :(^)]
for i in l
code = subs_(code,i,Meta.parse(string("CUDA.","$i")))
end
#Subs power
code = postwalk(x->@capture(x, a_^b_) && typeof(b) != Int ? :(Float32($a)^$b) : x, code)
#Subs vectors
for i in [:zeros,:ones]
code = subs_(code,i,Meta.parse(string("CUDA.","$i")))
end
code = subs_(code,:Array,Meta.parse(string("CUDA.CuArray")))
code = subs_(code,INT,INTCUDA)
code = subs_(code,FLOAT,FLOATCUDA)
return code
end | [
37811,
198,
220,
220,
220,
2163,
269,
15339,
48003,
41052,
8189,
8,
198,
198,
22203,
326,
6068,
82,
15879,
31713,
290,
10688,
5499,
284,
29369,
5631,
13,
198,
37811,
198,
8818,
269,
15339,
48003,
41052,
8189,
3712,
3109,
1050,
8,
628,
220,
220,
220,
1303,
7004,
82,
477,
10688,
198,
220,
220,
220,
300,
796,
685,
72,
329,
1312,
287,
3891,
7,
14881,
13,
37372,
8,
611,
318,
23211,
7,
43633,
5631,
11,
72,
8,
11405,
1312,
14512,
36147,
61,
15437,
198,
220,
220,
220,
329,
1312,
287,
300,
198,
220,
220,
220,
220,
220,
220,
220,
2438,
796,
6352,
41052,
8189,
11,
72,
11,
48526,
13,
29572,
7,
8841,
7203,
43633,
5631,
41424,
3,
72,
1,
22305,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1303,
7004,
82,
1176,
198,
220,
220,
220,
2438,
796,
1281,
11152,
7,
87,
3784,
31,
27144,
495,
7,
87,
11,
257,
62,
61,
65,
62,
8,
11405,
2099,
1659,
7,
65,
8,
14512,
2558,
5633,
36147,
43879,
2624,
16763,
64,
8,
61,
3,
65,
8,
1058,
2124,
11,
2438,
8,
628,
220,
220,
220,
1303,
7004,
82,
30104,
198,
220,
220,
220,
329,
1312,
287,
685,
25,
9107,
418,
11,
25,
1952,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2438,
796,
6352,
41052,
8189,
11,
72,
11,
48526,
13,
29572,
7,
8841,
7203,
43633,
5631,
41424,
3,
72,
1,
22305,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2438,
796,
6352,
41052,
8189,
11,
25,
19182,
11,
48526,
13,
29572,
7,
8841,
7203,
43633,
5631,
13,
46141,
19182,
1,
22305,
198,
220,
220,
220,
2438,
796,
6352,
41052,
8189,
11,
12394,
11,
1268,
4825,
52,
5631,
8,
198,
220,
220,
220,
2438,
796,
6352,
41052,
8189,
11,
3697,
46,
1404,
11,
3697,
46,
1404,
43633,
5631,
8,
628,
220,
220,
220,
1441,
2438,
198,
437
] | 2.294118 | 306 |
module LiquidsStructureGrids
### Imports
using Reexport
@reexport using ApproximationGrids
@reexport using LiquidsStructure
import ApproximationGrids: ApproximationGrid
### Exports
export StructureFactorGrid
### Implemetation
struct StructureFactorGrid{S <: StructureFactor, G <: ApproximationGrid}
f::S
grid::G
end
function Base.show(io::IO, ::MIME"text/plain", s::StructureFactorGrid)
print(io, "$(s.f),$(s.grid)")
end
end # module
| [
21412,
35515,
2340,
1273,
5620,
8642,
2340,
628,
198,
21017,
1846,
3742,
198,
3500,
797,
39344,
198,
31,
631,
87,
634,
1262,
2034,
13907,
18991,
8642,
2340,
198,
31,
631,
87,
634,
1262,
35515,
2340,
1273,
5620,
198,
198,
11748,
2034,
13907,
18991,
8642,
2340,
25,
2034,
13907,
18991,
41339,
628,
198,
21017,
1475,
3742,
198,
39344,
32522,
41384,
41339,
628,
198,
21017,
1846,
1154,
4164,
341,
198,
7249,
32522,
41384,
41339,
90,
50,
1279,
25,
32522,
41384,
11,
402,
1279,
25,
2034,
13907,
18991,
41339,
92,
198,
220,
220,
220,
277,
3712,
50,
198,
220,
220,
220,
10706,
3712,
38,
198,
437,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
7904,
44,
12789,
1,
5239,
14,
25638,
1600,
264,
3712,
1273,
5620,
41384,
41339,
8,
198,
220,
220,
220,
3601,
7,
952,
11,
17971,
7,
82,
13,
69,
828,
3,
7,
82,
13,
25928,
8,
4943,
198,
437,
628,
198,
437,
1303,
8265,
198
] | 2.886076 | 158 |
""" :( """
function DryBubble_θ_liq_ice(::Type{FT}) where {FT}
z_in = FT[
25., 75., 125., 175., 225., 275., 325., 375., 425.,
475., 525., 575., 625., 675., 725., 775., 825., 875.,
925., 975., 1025., 1075., 1125., 1175., 1225., 1275., 1325.,
1375., 1425., 1475., 1525., 1575., 1625., 1675., 1725., 1775.,
1825., 1875., 1925., 1975., 2025., 2075., 2125., 2175., 2225.,
2275., 2325., 2375., 2425., 2475., 2525., 2575., 2625., 2675.,
2725., 2775., 2825., 2875., 2925., 2975., 3025., 3075., 3125.,
3175., 3225., 3275., 3325., 3375., 3425., 3475., 3525., 3575.,
3625., 3675., 3725., 3775., 3825., 3875., 3925., 3975., 4025.,
4075., 4125., 4175., 4225., 4275., 4325., 4375., 4425., 4475.,
4525., 4575., 4625., 4675., 4725., 4775., 4825., 4875., 4925.,
4975., 5025., 5075., 5125., 5175., 5225., 5275., 5325., 5375.,
5425., 5475., 5525., 5575., 5625., 5675., 5725., 5775., 5825.,
5875., 5925., 5975., 6025., 6075., 6125., 6175., 6225., 6275.,
6325., 6375., 6425., 6475., 6525., 6575., 6625., 6675., 6725.,
6775., 6825., 6875., 6925., 6975., 7025., 7075., 7125., 7175.,
7225., 7275., 7325., 7375., 7425., 7475., 7525., 7575., 7625.,
7675., 7725., 7775., 7825., 7875., 7925., 7975., 8025., 8075.,
8125., 8175., 8225., 8275., 8325., 8375., 8425., 8475., 8525.,
8575., 8625., 8675., 8725., 8775., 8825., 8875., 8925., 8975.,
9025., 9075., 9125., 9175., 9225., 9275., 9325., 9375., 9425.,
9475., 9525., 9575., 9625., 9675., 9725., 9775., 9825., 9875.,
9925., 9975.
]
θ_liq_ice_in = FT[
299.9834, 299.9836, 299.9841, 299.985 , 299.9864, 299.9883,
299.9907, 299.9936, 299.9972, 300.0012, 300.0058, 300.011 ,
300.0166, 300.0228, 300.0293, 300.0363, 300.0436, 300.0512,
300.0591, 300.0672, 300.0755, 300.0838, 300.0921, 300.1004,
300.1086, 300.1167, 300.1245, 300.132 , 300.1393, 300.1461,
300.1525, 300.1583, 300.1637, 300.1685, 300.1726, 300.1762,
300.179 , 300.1812, 300.1826, 300.1833, 300.1833, 300.1826,
300.1812, 300.179 , 300.1762, 300.1727, 300.1685, 300.1637,
300.1584, 300.1525, 300.1461, 300.1393, 300.1321, 300.1245,
300.1167, 300.1087, 300.1005, 300.0922, 300.0838, 300.0755,
300.0673, 300.0592, 300.0513, 300.0437, 300.0364, 300.0294,
300.0228, 300.0167, 300.0111, 300.0059, 300.0013, 299.9972,
299.9937, 299.9908, 299.9884, 299.9865, 299.9851, 299.9842,
299.9837, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9835, 299.9835, 299.9835, 299.9835, 299.9835, 299.9835,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9836, 299.9836,
299.9836, 299.9836, 299.9836, 299.9836, 299.9837, 299.9837,
299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837,
299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837,
299.9837, 299.9837, 299.9837, 299.9837, 299.9837, 299.9837,
299.9837, 299.9837
]
profile = Dierckx.Spline1D(z_in, θ_liq_ice_in; k = 1)
return profile
end
""" :( """
function DryBubble_updrafts_z(::Type{FT}) where {FT}
z_in = FT[
75., 125., 175., 225., 275., 325., 375., 425., 475.,
525., 575., 625., 675., 725., 775., 825., 875., 925.,
975., 1025., 1075., 1125., 1175., 1225., 1275., 1325., 1375.,
1425., 1475., 1525., 1575., 1625., 1675., 1725., 1775., 1825.,
1875., 1925., 1975., 2025., 2075., 2125., 2175., 2225., 2275.,
2325., 2375., 2425., 2475., 2525., 2575., 2625., 2675., 2725.,
2775., 2825., 2875., 2925., 2975., 3025., 3075., 3125., 3175.,
3225., 3275., 3325., 3375., 3425., 3475., 3525., 3575., 3625.,
3675., 3725., 3775., 3825., 3875., 3925.]
return z_in
end
""" :( """
function DryBubble_updrafts_θ_liq_ice(::Type{FT}) where {FT}
z_in = DryBubble_updrafts_z(FT)
θ_liq_in = FT[
299.9882, 299.996 , 300.0063, 300.0205, 300.04 , 300.0594,
300.0848, 300.1131, 300.1438, 300.1766, 300.2198, 300.2567,
300.2946, 300.3452, 300.3849, 300.4245, 300.4791, 300.5182,
300.574 , 300.6305, 300.6668, 300.7222, 300.7771, 300.8074,
300.8591, 300.9092, 300.9574, 300.9758, 301.0182, 301.0579,
301.0944, 301.1276, 301.1572, 301.1515, 301.1729, 301.1902,
301.2033, 301.2122, 301.2167, 301.2169, 301.2127, 301.2041,
301.1913, 301.1743, 301.1533, 301.1593, 301.1299, 301.097 ,
301.0606, 301.0212, 300.9788, 300.9607, 300.9125, 300.8625,
300.8108, 300.7806, 300.7256, 300.6701, 300.6338, 300.5772,
300.5212, 300.482 , 300.4272, 300.3875, 300.3354, 300.2968,
300.2587, 300.2216, 300.1782, 300.1452, 300.1143, 300.0859,
300.0603, 300.0408, 300.0211, 300.0067, 299.9963, 299.9884]
profile = Dierckx.Spline1D(z_in, θ_liq_in; k = 1)
return profile
end
""" :( """
function DryBubble_updrafts_area(::Type{FT}) where {FT}
z_in = DryBubble_updrafts_z(FT)
Area_in = FT[
0.04 , 0.055, 0.07 , 0.08 , 0.085, 0.095, 0.1 , 0.105, 0.11 ,
0.115, 0.115, 0.12 , 0.125, 0.125, 0.13 , 0.135, 0.135, 0.14 ,
0.14 , 0.14 , 0.145, 0.145, 0.145, 0.15 , 0.15 , 0.15 , 0.15 ,
0.155, 0.155, 0.155, 0.155, 0.155, 0.155, 0.16 , 0.16 , 0.16 ,
0.16 , 0.16 , 0.16 , 0.16 , 0.16 , 0.16 , 0.16 , 0.16 , 0.16 ,
0.155, 0.155, 0.155, 0.155, 0.155, 0.155, 0.15 , 0.15 , 0.15 ,
0.15 , 0.145, 0.145, 0.145, 0.14 , 0.14 , 0.14 , 0.135, 0.135,
0.13 , 0.13 , 0.125, 0.12 , 0.115, 0.115, 0.11 , 0.105, 0.1 ,
0.095, 0.085, 0.08 , 0.07 , 0.055, 0.04]
profile = Dierckx.Spline1D(z_in, Area_in; k = 1)
return profile
end
""" :( """
function DryBubble_updrafts_w(::Type{FT}) where {FT}
z_in = DryBubble_updrafts_z(FT)
W_in = FT[
0.017 , 0.0266, 0.0344, 0.0417, 0.0495, 0.0546, 0.061 , 0.0668,
0.0721, 0.0768, 0.0849, 0.0887, 0.092 , 0.0996, 0.1019, 0.1037,
0.1106, 0.1114, 0.1179, 0.1243, 0.1238, 0.1297, 0.1355, 0.1335,
0.1387, 0.1437, 0.1485, 0.1448, 0.1489, 0.1527, 0.1564, 0.1597,
0.1628, 0.1565, 0.1588, 0.1609, 0.1626, 0.1641, 0.1652, 0.166 ,
0.1665, 0.1667, 0.1666, 0.1662, 0.1655, 0.1736, 0.1722, 0.1706,
0.1686, 0.1664, 0.1639, 0.1698, 0.1667, 0.1634, 0.1599, 0.1641,
0.1601, 0.1559, 0.1589, 0.1543, 0.1496, 0.1514, 0.1464, 0.1475,
0.1422, 0.1425, 0.1424, 0.1419, 0.1361, 0.135 , 0.1335, 0.1316,
0.1294, 0.1302, 0.1271, 0.1264, 0.1269, 0.1256]
profile = Dierckx.Spline1D(z_in, W_in; k = 1)
return profile
end
""" :( """
function DryBubble_updrafts_T(::Type{FT}) where {FT}
z_in = DryBubble_updrafts_z(FT)
T_in = FT[
299.2557, 298.775 , 298.2969, 297.8227, 297.3536, 296.8843,
296.421 , 295.9603, 295.502 , 295.0456, 294.5994, 294.1468,
293.6951, 293.2556, 292.8054, 292.3549, 291.9188, 291.4677,
291.0325, 290.5978, 290.1434, 289.7073, 289.2706, 288.81 ,
288.3698, 287.928 , 287.4842, 287.0118, 286.5622, 286.1099,
285.6544, 285.1957, 284.7335, 284.2379, 283.7677, 283.2937,
282.8157, 282.3337, 281.8476, 281.3574, 280.8631, 280.3649,
279.8626, 279.3565, 278.8467, 278.362 , 277.8447, 277.3241,
276.8006, 276.2742, 275.7454, 275.2388, 274.705 , 274.1694,
273.6327, 273.1155, 272.576 , 272.0363, 271.514 , 270.9736,
270.4339, 269.9094, 269.3711, 268.8465, 268.311 , 267.7877,
267.2649, 266.7432, 266.2159, 265.698 , 265.1821, 264.6685,
264.1574, 263.6518, 263.1461, 262.6451, 262.1476, 261.6524]
profile = Dierckx.Spline1D(z_in, T_in; k = 1)
return profile
end
| [
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
138,
116,
62,
4528,
80,
62,
501,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1679,
1539,
220,
220,
5441,
1539,
220,
13151,
1539,
220,
19038,
1539,
220,
18500,
1539,
220,
25829,
1539,
220,
29524,
1539,
220,
29414,
1539,
220,
36959,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
220,
45881,
1539,
220,
45719,
1539,
220,
642,
2425,
1539,
220,
48868,
1539,
220,
718,
2425,
1539,
220,
767,
1495,
1539,
220,
767,
2425,
1539,
220,
807,
1495,
1539,
220,
807,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
220,
860,
1495,
1539,
220,
860,
2425,
1539,
838,
1495,
1539,
838,
2425,
1539,
352,
11623,
1539,
1367,
2425,
1539,
1105,
1495,
1539,
1105,
2425,
1539,
1511,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
1511,
2425,
1539,
1478,
1495,
1539,
1478,
2425,
1539,
1315,
1495,
1539,
1315,
2425,
1539,
1467,
1495,
1539,
1467,
2425,
1539,
1596,
1495,
1539,
1596,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
1248,
1495,
1539,
1248,
2425,
1539,
36864,
1539,
15231,
1539,
32190,
1539,
1160,
2425,
1539,
362,
11623,
1539,
362,
17430,
1539,
2534,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
362,
23195,
1539,
2242,
1495,
1539,
2242,
2425,
1539,
1987,
1495,
1539,
1987,
2425,
1539,
1679,
1495,
1539,
1679,
2425,
1539,
2608,
1495,
1539,
2608,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
2681,
1495,
1539,
2681,
2425,
1539,
2579,
1495,
1539,
2579,
2425,
1539,
2808,
1495,
1539,
2808,
2425,
1539,
1542,
1495,
1539,
1542,
2425,
1539,
513,
11623,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
513,
17430,
1539,
3933,
1495,
1539,
513,
23195,
1539,
4747,
1495,
1539,
4747,
2425,
1539,
4974,
1495,
1539,
4974,
2425,
1539,
3439,
1495,
1539,
3439,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
4570,
1495,
1539,
4570,
2425,
1539,
5214,
1495,
1539,
5214,
2425,
1539,
4353,
1495,
1539,
4353,
2425,
1539,
5014,
1495,
1539,
5014,
2425,
1539,
2319,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
2319,
2425,
1539,
604,
11623,
1539,
604,
17430,
1539,
5433,
1495,
1539,
604,
23195,
1539,
5946,
1495,
1539,
5946,
2425,
1539,
5846,
1495,
1539,
5846,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
4153,
1495,
1539,
4153,
2425,
1539,
6337,
1495,
1539,
6337,
2425,
1539,
6298,
1495,
1539,
6298,
2425,
1539,
4764,
1495,
1539,
4764,
2425,
1539,
5125,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
5125,
2425,
1539,
2026,
1495,
1539,
2026,
2425,
1539,
642,
11623,
1539,
642,
17430,
1539,
6740,
1495,
1539,
642,
23195,
1539,
7192,
1495,
1539,
7192,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
7175,
1495,
1539,
7175,
2425,
1539,
5996,
1495,
1539,
5996,
2425,
1539,
7265,
1495,
1539,
7265,
2425,
1539,
7632,
1495,
1539,
7632,
2425,
1539,
7618,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
7618,
2425,
1539,
7863,
1495,
1539,
7863,
2425,
1539,
3126,
1495,
1539,
3126,
2425,
1539,
718,
11623,
1539,
718,
17430,
1539,
8190,
1495,
1539,
718,
23195,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
8093,
1495,
1539,
8093,
2425,
1539,
5598,
1495,
1539,
5598,
2425,
1539,
6135,
1495,
1539,
6135,
2425,
1539,
7930,
1495,
1539,
7930,
2425,
1539,
8275,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
8275,
2425,
1539,
8257,
1495,
1539,
8257,
2425,
1539,
8644,
1495,
1539,
8644,
2425,
1539,
4317,
1495,
1539,
4317,
2425,
1539,
767,
11623,
1539,
767,
17430,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
7724,
1495,
1539,
767,
23195,
1539,
8854,
1495,
1539,
8854,
2425,
1539,
8915,
1495,
1539,
8915,
2425,
1539,
5441,
1495,
1539,
5441,
2425,
1539,
8684,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
8684,
2425,
1539,
8541,
1495,
1539,
8541,
2425,
1539,
8699,
1495,
1539,
8699,
2425,
1539,
9225,
1495,
1539,
9225,
2425,
1539,
4019,
1495,
1539,
4019,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
807,
11623,
1539,
807,
17430,
1539,
9415,
1495,
1539,
807,
23195,
1539,
9698,
1495,
1539,
9698,
2425,
1539,
9508,
1495,
1539,
9508,
2425,
1539,
7600,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
7600,
2425,
1539,
9849,
1495,
1539,
9849,
2425,
1539,
10083,
1495,
1539,
10083,
2425,
1539,
9193,
1495,
1539,
9193,
2425,
1539,
9919,
1495,
1539,
9919,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
4101,
1495,
1539,
4101,
2425,
1539,
860,
11623,
1539,
860,
17430,
1539,
10190,
1495,
1539,
860,
23195,
1539,
10261,
1495,
1539,
10261,
2425,
1539,
10048,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
10048,
2425,
1539,
6957,
1495,
1539,
6957,
2425,
1539,
9907,
1495,
1539,
9907,
2425,
1539,
10111,
1495,
1539,
10111,
2425,
1539,
9661,
1495,
1539,
9661,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
7388,
1495,
1539,
7388,
2425,
13,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
7377,
116,
62,
4528,
80,
62,
501,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2682,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
3901,
11,
31011,
13,
42250,
837,
31011,
13,
4089,
2414,
11,
31011,
13,
24,
49287,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
2079,
2998,
11,
31011,
13,
2079,
2623,
11,
31011,
13,
2079,
4761,
11,
5867,
13,
405,
1065,
11,
5867,
13,
405,
3365,
11,
5867,
13,
28555,
837,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
486,
2791,
11,
5867,
13,
15,
23815,
11,
5867,
13,
15,
31675,
11,
5867,
13,
15,
35447,
11,
5867,
13,
3023,
2623,
11,
5867,
13,
2713,
1065,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
2713,
6420,
11,
5867,
13,
15,
43864,
11,
5867,
13,
15,
38172,
11,
5867,
13,
2919,
2548,
11,
5867,
13,
2931,
2481,
11,
5867,
13,
3064,
19,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
940,
4521,
11,
5867,
13,
1157,
3134,
11,
5867,
13,
1065,
2231,
11,
5867,
13,
19924,
837,
5867,
13,
1485,
6052,
11,
5867,
13,
1415,
5333,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1314,
1495,
11,
5867,
13,
1314,
5999,
11,
5867,
13,
1433,
2718,
11,
5867,
13,
1433,
5332,
11,
5867,
13,
1558,
2075,
11,
5867,
13,
1558,
5237,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
21738,
837,
5867,
13,
1507,
1065,
11,
5867,
13,
1507,
2075,
11,
5867,
13,
1507,
2091,
11,
5867,
13,
1507,
2091,
11,
5867,
13,
1507,
2075,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1507,
1065,
11,
5867,
13,
21738,
837,
5867,
13,
1558,
5237,
11,
5867,
13,
1558,
1983,
11,
5867,
13,
1433,
5332,
11,
5867,
13,
1433,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1314,
5705,
11,
5867,
13,
1314,
1495,
11,
5867,
13,
1415,
5333,
11,
5867,
13,
1485,
6052,
11,
5867,
13,
1485,
2481,
11,
5867,
13,
1065,
2231,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1157,
3134,
11,
5867,
13,
940,
5774,
11,
5867,
13,
3064,
20,
11,
5867,
13,
2931,
1828,
11,
5867,
13,
2919,
2548,
11,
5867,
13,
15,
38172,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
15,
45758,
11,
5867,
13,
2713,
5892,
11,
5867,
13,
2713,
1485,
11,
5867,
13,
3023,
2718,
11,
5867,
13,
3070,
2414,
11,
5867,
13,
15,
27696,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
15,
23815,
11,
5867,
13,
486,
3134,
11,
5867,
13,
486,
1157,
11,
5867,
13,
405,
3270,
11,
5867,
13,
405,
1485,
11,
31011,
13,
2079,
4761,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
2079,
2718,
11,
31011,
13,
2079,
2919,
11,
31011,
13,
24,
40353,
11,
31011,
13,
4089,
2996,
11,
31011,
13,
4089,
4349,
11,
31011,
13,
4089,
3682,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
31011,
13,
4089,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2623,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
4089,
2718,
11,
31011,
13,
4089,
2718,
198,
220,
220,
220,
2361,
198,
220,
220,
220,
7034,
796,
360,
959,
694,
87,
13,
26568,
500,
16,
35,
7,
89,
62,
259,
11,
7377,
116,
62,
4528,
80,
62,
501,
62,
259,
26,
479,
796,
352,
8,
198,
220,
220,
220,
1441,
7034,
198,
437,
198,
198,
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
89,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5441,
1539,
220,
13151,
1539,
220,
19038,
1539,
220,
18500,
1539,
220,
25829,
1539,
220,
29524,
1539,
220,
29414,
1539,
220,
36959,
1539,
220,
45881,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
220,
45719,
1539,
220,
642,
2425,
1539,
220,
48868,
1539,
220,
718,
2425,
1539,
220,
767,
1495,
1539,
220,
767,
2425,
1539,
220,
807,
1495,
1539,
220,
807,
2425,
1539,
220,
860,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
220,
860,
2425,
1539,
838,
1495,
1539,
838,
2425,
1539,
352,
11623,
1539,
1367,
2425,
1539,
1105,
1495,
1539,
1105,
2425,
1539,
1511,
1495,
1539,
1511,
2425,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
1478,
1495,
1539,
1478,
2425,
1539,
1315,
1495,
1539,
1315,
2425,
1539,
1467,
1495,
1539,
1467,
2425,
1539,
1596,
1495,
1539,
1596,
2425,
1539,
1248,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
1248,
2425,
1539,
36864,
1539,
15231,
1539,
32190,
1539,
1160,
2425,
1539,
362,
11623,
1539,
362,
17430,
1539,
2534,
1495,
1539,
362,
23195,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
2242,
1495,
1539,
2242,
2425,
1539,
1987,
1495,
1539,
1987,
2425,
1539,
1679,
1495,
1539,
1679,
2425,
1539,
2608,
1495,
1539,
2608,
2425,
1539,
2681,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
2681,
2425,
1539,
2579,
1495,
1539,
2579,
2425,
1539,
2808,
1495,
1539,
2808,
2425,
1539,
1542,
1495,
1539,
1542,
2425,
1539,
513,
11623,
1539,
513,
17430,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
3933,
1495,
1539,
513,
23195,
1539,
4747,
1495,
1539,
4747,
2425,
1539,
4974,
1495,
1539,
4974,
2425,
1539,
3439,
1495,
1539,
3439,
2425,
1539,
4570,
1495,
1539,
198,
220,
220,
220,
220,
220,
220,
220,
4570,
2425,
1539,
5214,
1495,
1539,
5214,
2425,
1539,
4353,
1495,
1539,
4353,
2425,
1539,
5014,
1495,
8183,
198,
220,
220,
220,
1441,
1976,
62,
259,
198,
437,
198,
198,
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
138,
116,
62,
4528,
80,
62,
501,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
89,
7,
9792,
8,
198,
220,
220,
220,
7377,
116,
62,
4528,
80,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
24,
42980,
11,
31011,
13,
38565,
837,
5867,
13,
405,
5066,
11,
5867,
13,
15,
21261,
11,
5867,
13,
3023,
220,
837,
5867,
13,
2713,
5824,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
2919,
2780,
11,
5867,
13,
1157,
3132,
11,
5867,
13,
1415,
2548,
11,
5867,
13,
1558,
2791,
11,
5867,
13,
17,
22337,
11,
5867,
13,
1495,
3134,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1959,
3510,
11,
5867,
13,
27712,
17,
11,
5867,
13,
2548,
2920,
11,
5867,
13,
19,
22995,
11,
5867,
13,
2857,
6420,
11,
5867,
13,
20,
24294,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
46900,
837,
5867,
13,
21,
22515,
11,
5867,
13,
2791,
3104,
11,
5867,
13,
22,
23148,
11,
5867,
13,
3324,
4869,
11,
5867,
13,
1795,
4524,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
23,
48952,
11,
5867,
13,
44675,
17,
11,
5867,
13,
24,
46900,
11,
5867,
13,
24,
38569,
11,
25643,
13,
486,
6469,
11,
25643,
13,
2713,
3720,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25643,
13,
2931,
2598,
11,
25643,
13,
1065,
4304,
11,
25643,
13,
1314,
4761,
11,
25643,
13,
1314,
1314,
11,
25643,
13,
1558,
1959,
11,
25643,
13,
1129,
2999,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25643,
13,
1238,
2091,
11,
25643,
13,
17,
18376,
11,
25643,
13,
20666,
22,
11,
25643,
13,
20666,
24,
11,
25643,
13,
17,
16799,
11,
25643,
13,
1238,
3901,
11,
198,
220,
220,
220,
220,
220,
220,
220,
25643,
13,
1129,
1485,
11,
25643,
13,
1558,
3559,
11,
25643,
13,
1314,
2091,
11,
25643,
13,
1314,
6052,
11,
25643,
13,
1065,
2079,
11,
25643,
13,
2931,
22,
837,
198,
220,
220,
220,
220,
220,
220,
220,
25643,
13,
15,
33206,
11,
25643,
13,
2999,
1065,
11,
5867,
13,
5607,
3459,
11,
5867,
13,
24,
31980,
11,
5867,
13,
24,
11623,
11,
5867,
13,
4521,
1495,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
23,
15711,
11,
5867,
13,
22,
37988,
11,
5867,
13,
22,
11645,
11,
5867,
13,
3134,
486,
11,
5867,
13,
21,
28460,
11,
5867,
13,
20,
43571,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
4309,
1065,
11,
5867,
13,
40149,
837,
5867,
13,
19,
29807,
11,
5867,
13,
2548,
2425,
11,
5867,
13,
2091,
4051,
11,
5867,
13,
1959,
3104,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
1495,
5774,
11,
5867,
13,
1828,
1433,
11,
5867,
13,
1558,
6469,
11,
5867,
13,
1415,
4309,
11,
5867,
13,
1157,
3559,
11,
5867,
13,
2919,
3270,
11,
198,
220,
220,
220,
220,
220,
220,
220,
5867,
13,
15,
35642,
11,
5867,
13,
15,
26200,
11,
5867,
13,
2999,
1157,
11,
5867,
13,
405,
3134,
11,
31011,
13,
2079,
5066,
11,
31011,
13,
24,
40353,
60,
198,
220,
220,
220,
7034,
796,
360,
959,
694,
87,
13,
26568,
500,
16,
35,
7,
89,
62,
259,
11,
7377,
116,
62,
4528,
80,
62,
259,
26,
479,
796,
352,
8,
198,
220,
220,
220,
1441,
7034,
198,
437,
198,
198,
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
20337,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
89,
7,
9792,
8,
198,
220,
220,
220,
9498,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
3023,
837,
657,
13,
47838,
11,
657,
13,
2998,
837,
657,
13,
2919,
837,
657,
13,
2919,
20,
11,
657,
13,
2931,
20,
11,
657,
13,
16,
220,
837,
657,
13,
13348,
11,
657,
13,
1157,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
15363,
11,
657,
13,
15363,
11,
657,
13,
1065,
837,
657,
13,
11623,
11,
657,
13,
11623,
11,
657,
13,
1485,
837,
657,
13,
17059,
11,
657,
13,
17059,
11,
657,
13,
1415,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1415,
837,
657,
13,
1415,
837,
657,
13,
18781,
11,
657,
13,
18781,
11,
657,
13,
18781,
11,
657,
13,
1314,
837,
657,
13,
1314,
837,
657,
13,
1314,
837,
657,
13,
1314,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
657,
13,
1433,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
18742,
11,
657,
13,
1314,
837,
657,
13,
1314,
837,
657,
13,
1314,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1314,
837,
657,
13,
18781,
11,
657,
13,
18781,
11,
657,
13,
18781,
11,
657,
13,
1415,
837,
657,
13,
1415,
837,
657,
13,
1415,
837,
657,
13,
17059,
11,
657,
13,
17059,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1485,
837,
657,
13,
1485,
837,
657,
13,
11623,
11,
657,
13,
1065,
837,
657,
13,
15363,
11,
657,
13,
15363,
11,
657,
13,
1157,
837,
657,
13,
13348,
11,
657,
13,
16,
220,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
2931,
20,
11,
657,
13,
2919,
20,
11,
657,
13,
2919,
837,
657,
13,
2998,
837,
657,
13,
47838,
11,
657,
13,
3023,
60,
198,
220,
220,
220,
7034,
796,
360,
959,
694,
87,
13,
26568,
500,
16,
35,
7,
89,
62,
259,
11,
9498,
62,
259,
26,
479,
796,
352,
8,
198,
220,
220,
220,
1441,
7034,
198,
437,
198,
198,
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
86,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
89,
7,
9792,
8,
198,
220,
220,
220,
370,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
29326,
837,
657,
13,
15,
25540,
11,
657,
13,
3070,
2598,
11,
657,
13,
3023,
1558,
11,
657,
13,
15,
33781,
11,
657,
13,
2713,
3510,
11,
657,
13,
3312,
16,
837,
657,
13,
15,
35809,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
2998,
2481,
11,
657,
13,
2998,
3104,
11,
657,
13,
2919,
2920,
11,
657,
13,
2919,
5774,
11,
657,
13,
2931,
17,
837,
657,
13,
15,
38565,
11,
657,
13,
8784,
24,
11,
657,
13,
940,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
11442,
21,
11,
657,
13,
1157,
1415,
11,
657,
13,
1157,
3720,
11,
657,
13,
1065,
3559,
11,
657,
13,
1065,
2548,
11,
657,
13,
1065,
5607,
11,
657,
13,
1485,
2816,
11,
657,
13,
1485,
2327,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1485,
5774,
11,
657,
13,
1415,
2718,
11,
657,
13,
1415,
5332,
11,
657,
13,
1415,
2780,
11,
657,
13,
1415,
4531,
11,
657,
13,
1314,
1983,
11,
657,
13,
1314,
2414,
11,
657,
13,
1314,
5607,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1433,
2078,
11,
657,
13,
1314,
2996,
11,
657,
13,
1314,
3459,
11,
657,
13,
1433,
2931,
11,
657,
13,
1433,
2075,
11,
657,
13,
1433,
3901,
11,
657,
13,
1433,
4309,
11,
657,
13,
23055,
837,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1433,
2996,
11,
657,
13,
1433,
3134,
11,
657,
13,
1433,
2791,
11,
657,
13,
1433,
5237,
11,
657,
13,
1433,
2816,
11,
657,
13,
1558,
2623,
11,
657,
13,
1558,
1828,
11,
657,
13,
1558,
3312,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1433,
4521,
11,
657,
13,
1433,
2414,
11,
657,
13,
1433,
2670,
11,
657,
13,
1433,
4089,
11,
657,
13,
1433,
3134,
11,
657,
13,
1433,
2682,
11,
657,
13,
1314,
2079,
11,
657,
13,
1433,
3901,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1433,
486,
11,
657,
13,
1314,
3270,
11,
657,
13,
1314,
4531,
11,
657,
13,
1314,
3559,
11,
657,
13,
1415,
4846,
11,
657,
13,
1314,
1415,
11,
657,
13,
1415,
2414,
11,
657,
13,
1415,
2425,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1415,
1828,
11,
657,
13,
1415,
1495,
11,
657,
13,
1415,
1731,
11,
657,
13,
1415,
1129,
11,
657,
13,
1485,
5333,
11,
657,
13,
17059,
837,
657,
13,
1485,
2327,
11,
657,
13,
1485,
1433,
11,
198,
220,
220,
220,
220,
220,
220,
220,
657,
13,
1065,
5824,
11,
657,
13,
12952,
17,
11,
657,
13,
1065,
4869,
11,
657,
13,
1065,
2414,
11,
657,
13,
1065,
3388,
11,
657,
13,
1065,
3980,
60,
198,
220,
220,
220,
7034,
796,
360,
959,
694,
87,
13,
26568,
500,
16,
35,
7,
89,
62,
259,
11,
370,
62,
259,
26,
479,
796,
352,
8,
198,
220,
220,
220,
1441,
7034,
198,
437,
198,
198,
37811,
36147,
37227,
198,
8818,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
51,
7,
3712,
6030,
90,
9792,
30072,
810,
1391,
9792,
92,
198,
220,
220,
220,
1976,
62,
259,
796,
22408,
33,
549,
903,
62,
929,
35679,
82,
62,
89,
7,
9792,
8,
198,
220,
220,
220,
309,
62,
259,
796,
19446,
58,
198,
220,
220,
220,
220,
220,
220,
220,
31011,
13,
1495,
3553,
11,
37576,
13,
34483,
837,
37576,
13,
1959,
3388,
11,
41103,
13,
23,
24403,
11,
41103,
13,
2327,
2623,
11,
41922,
13,
3459,
3559,
11,
198,
220,
220,
220,
220,
220,
220,
220,
41922,
13,
46636,
837,
34772,
13,
24,
35642,
11,
34772,
13,
35126,
837,
34772,
13,
15,
29228,
11,
41235,
13,
20,
42691,
11,
41235,
13,
1415,
3104,
11,
198,
220,
220,
220,
220,
220,
220,
220,
37224,
13,
3388,
4349,
11,
37224,
13,
1495,
3980,
11,
41569,
13,
1795,
4051,
11,
41569,
13,
2327,
2920,
11,
43336,
13,
24,
20356,
11,
43336,
13,
24669,
22,
11,
198,
220,
220,
220,
220,
220,
220,
220,
43336,
13,
3070,
1495,
11,
26481,
13,
3270,
3695,
11,
26481,
13,
1415,
2682,
11,
38902,
13,
2154,
4790,
11,
38902,
13,
1983,
3312,
11,
35419,
13,
6659,
220,
837,
198,
220,
220,
220,
220,
220,
220,
220,
35419,
13,
2623,
4089,
11,
38721,
13,
24,
2078,
837,
38721,
13,
2780,
3682,
11,
38721,
13,
486,
1507,
11,
39697,
13,
3980,
1828,
11,
39697,
13,
940,
2079,
11,
198,
220,
220,
220,
220,
220,
220,
220,
33015,
13,
2996,
2598,
11,
33015,
13,
1129,
3553,
11,
40654,
13,
22,
27326,
11,
40654,
13,
1954,
3720,
11,
42032,
13,
32059,
22,
11,
42032,
13,
1959,
2718,
11,
198,
220,
220,
220,
220,
220,
220,
220,
41810,
13,
23,
18458,
11,
41810,
13,
2091,
2718,
11,
39882,
13,
23,
35435,
11,
39882,
13,
2327,
4524,
11,
21355,
13,
4521,
3132,
11,
21355,
13,
26780,
24,
11,
198,
220,
220,
220,
220,
220,
220,
220,
39466,
13,
4521,
2075,
11,
39466,
13,
2327,
2996,
11,
39174,
13,
5705,
3134,
11,
39174,
13,
35667,
837,
38703,
13,
23,
34825,
11,
38703,
13,
18,
28872,
11,
198,
220,
220,
220,
220,
220,
220,
220,
38147,
13,
7410,
21,
11,
38147,
13,
1983,
3682,
11,
25829,
13,
22,
34229,
11,
25829,
13,
1954,
3459,
11,
39768,
13,
34801,
837,
39768,
13,
1433,
5824,
11,
198,
220,
220,
220,
220,
220,
220,
220,
38549,
13,
5066,
1983,
11,
38549,
13,
1157,
2816,
11,
38107,
13,
37452,
837,
38107,
13,
15,
35447,
11,
33797,
13,
47396,
837,
20479,
13,
5607,
2623,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20479,
13,
19,
29626,
11,
38249,
13,
44675,
19,
11,
38249,
13,
2718,
1157,
11,
36678,
13,
5705,
2996,
11,
36678,
13,
36244,
837,
37364,
13,
3695,
3324,
11,
198,
220,
220,
220,
220,
220,
220,
220,
37364,
13,
2075,
2920,
11,
37737,
13,
4524,
2624,
11,
37737,
13,
17,
19707,
11,
32090,
13,
39357,
837,
32090,
13,
1507,
2481,
11,
32158,
13,
2791,
5332,
11,
198,
220,
220,
220,
220,
220,
220,
220,
32158,
13,
1314,
4524,
11,
39135,
13,
2996,
1507,
11,
39135,
13,
1415,
5333,
11,
35404,
13,
21,
36330,
11,
35404,
13,
1415,
4304,
11,
39166,
13,
2996,
1731,
60,
198,
220,
220,
220,
7034,
796,
360,
959,
694,
87,
13,
26568,
500,
16,
35,
7,
89,
62,
259,
11,
309,
62,
259,
26,
479,
796,
352,
8,
198,
220,
220,
220,
1441,
7034,
198,
437,
198
] | 1.820021 | 4,745 |
const ElectronSite = TagType"Electron"
function siteinds(::ElectronSite,
N::Int; kwargs...)
conserve_qns = get(kwargs,:conserve_qns,false)
conserve_sz = get(kwargs,:conserve_sz,conserve_qns)
conserve_nf = get(kwargs,:conserve_nf,conserve_qns)
conserve_parity = get(kwargs,:conserve_parity,conserve_qns)
if conserve_sz && conserve_nf
em = QN(("Nf",0,-1),("Sz", 0)) => 1
up = QN(("Nf",1,-1),("Sz",+1)) => 1
dn = QN(("Nf",1,-1),("Sz",-1)) => 1
ud = QN(("Nf",2,-1),("Sz", 0)) => 1
return [Index(em,up,dn,ud;tags="Site,Electron,n=$n") for n=1:N]
elseif conserve_nf
zer = QN("Nf",0,-1) => 1
one = QN("Nf",1,-1) => 2
two = QN("Nf",2,-1) => 1
return [Index(zer,one,two;tags="Site,Electron,n=$n") for n=1:N]
elseif conserve_sz
em = QN(("Sz", 0),("Pf",0,-2)) => 1
up = QN(("Sz",+1),("Pf",1,-2)) => 1
dn = QN(("Sz",-1),("Pf",1,-2)) => 1
ud = QN(("Sz", 0),("Pf",0,-2)) => 1
return [Index(em,up,dn,ud;tags="Site,Electron,n=$n") for n=1:N]
elseif conserve_parity
zer = QN("Pf",0,-2) => 1
one = QN("Pf",1,-2) => 2
two = QN("Pf",0,-2) => 1
return [Index(zer,one,two;tags="Site,Electron,n=$n") for n=1:N]
end
return [Index(4,"Site,Electron,n=$n") for n=1:N]
end
function state(::ElectronSite,
st::AbstractString)
if st == "Emp" || st == "0"
return 1
elseif st == "Up" || st == "↑"
return 2
elseif st == "Dn" || st == "↓"
return 3
elseif st == "UpDn" || st == "↑↓"
return 4
end
throw(ArgumentError("State string \"$st\" not recognized for Electron site"))
return 0
end
function op(::ElectronSite,
s::Index,
opname::AbstractString)::ITensor
Emp = s(1)
EmpP = s'(1)
Up = s(2)
UpP = s'(2)
Dn = s(3)
DnP = s'(3)
UpDn = s(4)
UpDnP = s'(4)
Op = emptyITensor(s',dag(s))
if opname == "Nup"
Op[UpP, Up] = 1.
Op[UpDnP, UpDn] = 1.
elseif opname == "Ndn"
Op[DnP, Dn] = 1.
Op[UpDnP, UpDn] = 1.
elseif opname == "Nupdn"
Op[UpDnP, UpDn] = 1.
elseif opname == "Ntot"
Op[UpP, Up] = 1.
Op[DnP, Dn] = 1.
Op[UpDnP, UpDn] = 2.
elseif opname == "Cup"
Op[EmpP, Up] = +1.
Op[DnP, UpDn] = +1.
elseif opname == "Cdagup"
Op[UpP, Emp] = +1.
Op[UpDnP, Dn] = +1.
elseif opname == "Cdn"
Op[EmpP, Dn] = +1.
Op[UpP, UpDn] = -1.
elseif opname == "Cdagdn"
Op[DnP, Emp] = +1.
Op[UpDnP, Up] = -1.
# Aup,Adagup,Adn,Adagdn below
# are "bosonic" versions of
# the creation/annihilation
# C operators defined above
elseif opname == "Aup"
Op[EmpP, Up] = 1.
Op[DnP, UpDn] = 1.
elseif opname == "Adagup"
Op[UpP, Emp] = 1.
Op[UpDnP, Dn] = 1.
elseif opname == "Adn"
Op[EmpP, Dn] = 1.
Op[UpP, UpDn] = 1.
elseif opname == "Adagdn"
Op[DnP, Emp] = 1.
Op[UpDnP, Up] = 1.
elseif opname=="F" || opname=="FermiPhase" || opname=="FP"
Op[UpP, Up] = -1.
Op[EmpP, Emp] = 1.
Op[DnP, Dn] = -1.
Op[UpDnP, UpDn] = 1.
elseif opname == "Fup"
Op[EmpP, Emp] = 1.
Op[UpP, Up] = -1.
Op[DnP, Dn] = 1.
Op[UpDnP, UpDn] = -1.
elseif opname == "Fdn"
Op[EmpP, Emp] = 1.
Op[UpP, Up] = 1.
Op[DnP, Dn] = -1.
Op[UpDnP, UpDn] = -1.
elseif opname == "Sᶻ" || opname == "Sz"
Op[UpP, Up] = 0.5
Op[DnP, Dn] = -0.5
elseif opname == "Sˣ" || opname == "Sx"
Op[DnP, Up] = 0.5
Op[UpP, Dn] = 0.5
elseif opname=="S+" || opname=="Sp" || opname == "S⁺" || opname == "Splus"
Op[UpP, Dn] = 1.0
elseif opname=="S-" || opname=="Sm" || opname == "S⁻" || opname == "Sminus"
Op[DnP, Up] = 1.0
elseif opname == "Emp" || opname == "0"
pEmp = emptyITensor(s)
pEmp[Emp] = 1.0
return pEmp
elseif opname == "Up" || opname == "↑"
pU = emptyITensor(s)
pU[Up] = 1.0
return pU
elseif opname == "Dn" || opname == "↓"
pD = emptyITensor(s)
pD[Dn] = 1.0
return pD
elseif opname == "UpDn" || opname == "↑↓"
pUD = emptyITensor(s)
pUD[UpDn] = 1.0
return pUD
else
throw(ArgumentError("Operator name $opname not recognized for ElectronSite"))
end
return Op
end
function has_fermion_string(::ElectronSite,
s::Index,
opname::AbstractString)::Bool
if opname=="Cup" || opname=="Cdagup" || opname=="Cdn" || opname=="Cdagdn"
return true
end
return false
end
| [
198,
9979,
5903,
1313,
29123,
796,
17467,
6030,
1,
19453,
1313,
1,
198,
198,
8818,
2524,
521,
82,
7,
3712,
19453,
1313,
29123,
11,
220,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
399,
3712,
5317,
26,
479,
86,
22046,
23029,
198,
220,
45075,
62,
80,
5907,
796,
651,
7,
46265,
22046,
11,
25,
5936,
3760,
62,
80,
5907,
11,
9562,
8,
198,
220,
45075,
62,
82,
89,
796,
651,
7,
46265,
22046,
11,
25,
5936,
3760,
62,
82,
89,
11,
5936,
3760,
62,
80,
5907,
8,
198,
220,
45075,
62,
77,
69,
796,
651,
7,
46265,
22046,
11,
25,
5936,
3760,
62,
77,
69,
11,
5936,
3760,
62,
80,
5907,
8,
198,
220,
45075,
62,
1845,
414,
796,
651,
7,
46265,
22046,
11,
25,
5936,
3760,
62,
1845,
414,
11,
5936,
3760,
62,
80,
5907,
8,
198,
220,
611,
45075,
62,
82,
89,
11405,
45075,
62,
77,
69,
198,
220,
220,
220,
795,
796,
1195,
45,
7,
7203,
45,
69,
1600,
15,
12095,
16,
828,
7203,
50,
89,
1600,
657,
4008,
5218,
352,
198,
220,
220,
220,
510,
796,
1195,
45,
7,
7203,
45,
69,
1600,
16,
12095,
16,
828,
7203,
50,
89,
1600,
10,
16,
4008,
5218,
352,
198,
220,
220,
220,
288,
77,
796,
1195,
45,
7,
7203,
45,
69,
1600,
16,
12095,
16,
828,
7203,
50,
89,
1600,
12,
16,
4008,
5218,
352,
198,
220,
220,
220,
334,
67,
796,
1195,
45,
7,
7203,
45,
69,
1600,
17,
12095,
16,
828,
7203,
50,
89,
1600,
657,
4008,
5218,
352,
198,
220,
220,
220,
1441,
685,
15732,
7,
368,
11,
929,
11,
32656,
11,
463,
26,
31499,
2625,
29123,
11,
19453,
1313,
11,
77,
43641,
77,
4943,
329,
299,
28,
16,
25,
45,
60,
198,
220,
2073,
361,
45075,
62,
77,
69,
198,
220,
220,
220,
1976,
263,
796,
1195,
45,
7203,
45,
69,
1600,
15,
12095,
16,
8,
5218,
352,
198,
220,
220,
220,
530,
796,
1195,
45,
7203,
45,
69,
1600,
16,
12095,
16,
8,
5218,
362,
198,
220,
220,
220,
734,
796,
1195,
45,
7203,
45,
69,
1600,
17,
12095,
16,
8,
5218,
352,
198,
220,
220,
220,
1441,
685,
15732,
7,
9107,
11,
505,
11,
11545,
26,
31499,
2625,
29123,
11,
19453,
1313,
11,
77,
43641,
77,
4943,
329,
299,
28,
16,
25,
45,
60,
198,
220,
2073,
361,
45075,
62,
82,
89,
198,
220,
220,
220,
795,
796,
1195,
45,
7,
7203,
50,
89,
1600,
657,
828,
7203,
47,
69,
1600,
15,
12095,
17,
4008,
5218,
352,
198,
220,
220,
220,
510,
796,
1195,
45,
7,
7203,
50,
89,
1600,
10,
16,
828,
7203,
47,
69,
1600,
16,
12095,
17,
4008,
5218,
352,
198,
220,
220,
220,
288,
77,
796,
1195,
45,
7,
7203,
50,
89,
1600,
12,
16,
828,
7203,
47,
69,
1600,
16,
12095,
17,
4008,
5218,
352,
198,
220,
220,
220,
334,
67,
796,
1195,
45,
7,
7203,
50,
89,
1600,
657,
828,
7203,
47,
69,
1600,
15,
12095,
17,
4008,
5218,
352,
198,
220,
220,
220,
1441,
685,
15732,
7,
368,
11,
929,
11,
32656,
11,
463,
26,
31499,
2625,
29123,
11,
19453,
1313,
11,
77,
43641,
77,
4943,
329,
299,
28,
16,
25,
45,
60,
198,
220,
2073,
361,
45075,
62,
1845,
414,
198,
220,
220,
220,
1976,
263,
796,
1195,
45,
7203,
47,
69,
1600,
15,
12095,
17,
8,
5218,
352,
198,
220,
220,
220,
530,
796,
1195,
45,
7203,
47,
69,
1600,
16,
12095,
17,
8,
5218,
362,
198,
220,
220,
220,
734,
796,
1195,
45,
7203,
47,
69,
1600,
15,
12095,
17,
8,
5218,
352,
198,
220,
220,
220,
1441,
685,
15732,
7,
9107,
11,
505,
11,
11545,
26,
31499,
2625,
29123,
11,
19453,
1313,
11,
77,
43641,
77,
4943,
329,
299,
28,
16,
25,
45,
60,
198,
220,
886,
198,
220,
1441,
685,
15732,
7,
19,
553,
29123,
11,
19453,
1313,
11,
77,
43641,
77,
4943,
329,
299,
28,
16,
25,
45,
60,
198,
437,
198,
198,
8818,
1181,
7,
3712,
19453,
1313,
29123,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
336,
3712,
23839,
10100,
8,
198,
220,
611,
336,
6624,
366,
36,
3149,
1,
8614,
336,
6624,
366,
15,
1,
198,
220,
220,
220,
1441,
352,
198,
220,
2073,
361,
336,
6624,
366,
4933,
1,
8614,
336,
6624,
366,
48541,
1,
198,
220,
220,
220,
1441,
362,
198,
220,
2073,
361,
336,
6624,
366,
35,
77,
1,
8614,
336,
6624,
366,
29705,
241,
1,
198,
220,
220,
220,
1441,
513,
198,
220,
2073,
361,
336,
6624,
366,
4933,
35,
77,
1,
8614,
336,
6624,
366,
48541,
29705,
241,
1,
198,
220,
220,
220,
1441,
604,
198,
220,
886,
198,
220,
3714,
7,
28100,
1713,
12331,
7203,
9012,
4731,
19990,
3,
301,
7879,
407,
8018,
329,
5903,
1313,
2524,
48774,
198,
220,
1441,
657,
198,
437,
198,
198,
8818,
1034,
7,
3712,
19453,
1313,
29123,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
3712,
15732,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
3672,
3712,
23839,
10100,
2599,
25,
2043,
22854,
198,
220,
2295,
79,
220,
220,
796,
264,
7,
16,
8,
198,
220,
2295,
79,
47,
220,
796,
264,
6,
7,
16,
8,
198,
220,
3205,
220,
220,
220,
796,
264,
7,
17,
8,
198,
220,
3205,
47,
220,
220,
796,
264,
6,
7,
17,
8,
198,
220,
360,
77,
220,
220,
220,
796,
264,
7,
18,
8,
198,
220,
360,
77,
47,
220,
220,
796,
264,
6,
7,
18,
8,
198,
220,
3205,
35,
77,
220,
796,
264,
7,
19,
8,
198,
220,
3205,
35,
77,
47,
796,
264,
6,
7,
19,
8,
628,
220,
8670,
796,
6565,
2043,
22854,
7,
82,
3256,
67,
363,
7,
82,
4008,
628,
220,
611,
1034,
3672,
6624,
366,
45,
929,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
45,
32656,
1,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
45,
929,
32656,
1,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
45,
83,
313,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
362,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
34,
929,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
3205,
60,
220,
796,
1343,
16,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
1343,
16,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
34,
67,
363,
929,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
2295,
79,
60,
220,
796,
1343,
16,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
360,
77,
60,
796,
1343,
16,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
34,
32656,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
360,
77,
60,
220,
796,
1343,
16,
13,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
35,
77,
60,
796,
532,
16,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
34,
67,
363,
32656,
1,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
2295,
79,
60,
220,
796,
1343,
16,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
60,
796,
532,
16,
13,
198,
220,
1303,
317,
929,
11,
2782,
363,
929,
11,
2782,
77,
11,
2782,
363,
32656,
2174,
198,
220,
1303,
389,
366,
39565,
9229,
1,
6300,
286,
198,
220,
1303,
262,
6282,
14,
1236,
33299,
198,
220,
1303,
327,
12879,
5447,
2029,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
32,
929,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
3205,
60,
220,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
2782,
363,
929,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
2295,
79,
60,
220,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
360,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
2782,
77,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
360,
77,
60,
220,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
2782,
363,
32656,
1,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
2295,
79,
60,
220,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
855,
1,
37,
1,
8614,
1034,
3672,
855,
1,
37,
7780,
72,
35645,
1,
8614,
1034,
3672,
855,
1,
5837,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
532,
16,
13,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
2295,
79,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
532,
16,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
352,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
37,
929,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
2295,
79,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
532,
16,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
532,
16,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
37,
32656,
1,
198,
220,
220,
220,
8670,
58,
36,
3149,
47,
11,
2295,
79,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
352,
13,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
532,
16,
13,
198,
220,
220,
220,
8670,
58,
4933,
35,
77,
47,
11,
3205,
35,
77,
60,
796,
532,
16,
13,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
50,
157,
114,
119,
1,
8614,
1034,
3672,
6624,
366,
50,
89,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
3205,
60,
796,
657,
13,
20,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
360,
77,
60,
796,
532,
15,
13,
20,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
50,
135,
96,
1,
8614,
1034,
3672,
6624,
366,
50,
87,
1,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
3205,
60,
796,
657,
13,
20,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
360,
77,
60,
796,
657,
13,
20,
220,
198,
220,
2073,
361,
1034,
3672,
855,
1,
50,
10,
1,
8614,
1034,
3672,
855,
1,
4561,
1,
8614,
1034,
3672,
6624,
366,
50,
46256,
118,
1,
8614,
1034,
3672,
6624,
366,
50,
9541,
1,
198,
220,
220,
220,
8670,
58,
4933,
47,
11,
360,
77,
60,
796,
352,
13,
15,
198,
220,
2073,
361,
1034,
3672,
855,
1,
50,
21215,
8614,
1034,
3672,
855,
1,
7556,
1,
8614,
1034,
3672,
6624,
366,
50,
46256,
119,
1,
8614,
1034,
3672,
6624,
366,
50,
40191,
1,
198,
220,
220,
220,
8670,
58,
35,
77,
47,
11,
3205,
60,
796,
352,
13,
15,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
36,
3149,
1,
8614,
1034,
3672,
6624,
366,
15,
1,
198,
220,
220,
220,
279,
36,
3149,
796,
6565,
2043,
22854,
7,
82,
8,
198,
220,
220,
220,
279,
36,
3149,
58,
36,
3149,
60,
796,
352,
13,
15,
198,
220,
220,
220,
1441,
279,
36,
3149,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
4933,
1,
8614,
1034,
3672,
6624,
366,
48541,
1,
198,
220,
220,
220,
279,
52,
796,
6565,
2043,
22854,
7,
82,
8,
198,
220,
220,
220,
279,
52,
58,
4933,
60,
796,
352,
13,
15,
198,
220,
220,
220,
1441,
279,
52,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
35,
77,
1,
8614,
1034,
3672,
6624,
366,
29705,
241,
1,
198,
220,
220,
220,
279,
35,
796,
6565,
2043,
22854,
7,
82,
8,
198,
220,
220,
220,
279,
35,
58,
35,
77,
60,
796,
352,
13,
15,
198,
220,
220,
220,
1441,
279,
35,
198,
220,
2073,
361,
1034,
3672,
6624,
366,
4933,
35,
77,
1,
8614,
1034,
3672,
6624,
366,
48541,
29705,
241,
1,
198,
220,
220,
220,
279,
8322,
796,
6565,
2043,
22854,
7,
82,
8,
198,
220,
220,
220,
279,
8322,
58,
4933,
35,
77,
60,
796,
352,
13,
15,
198,
220,
220,
220,
1441,
279,
8322,
198,
220,
2073,
198,
220,
220,
220,
3714,
7,
28100,
1713,
12331,
7203,
18843,
1352,
1438,
720,
404,
3672,
407,
8018,
329,
5903,
1313,
29123,
48774,
198,
220,
886,
198,
220,
1441,
8670,
198,
437,
198,
198,
8818,
468,
62,
2232,
76,
295,
62,
8841,
7,
3712,
19453,
1313,
29123,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
264,
3712,
15732,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1034,
3672,
3712,
23839,
10100,
2599,
25,
33,
970,
198,
220,
611,
1034,
3672,
855,
1,
34,
929,
1,
8614,
1034,
3672,
855,
1,
34,
67,
363,
929,
1,
8614,
1034,
3672,
855,
1,
34,
32656,
1,
8614,
1034,
3672,
855,
1,
34,
67,
363,
32656,
1,
198,
220,
220,
220,
1441,
2081,
198,
220,
886,
198,
220,
1441,
3991,
198,
437,
198
] | 1.843063 | 2,364 |
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.util.ArrayList;
import accrue.cryptoerase.runtime.CryptoLibrary;
public class Log {
private final SimpleIRCClient parent;
private static final OpenOption[] defaultOpenOptions = { StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE };
// ANNOTATION: key declaration
private PrivateKey PRIVKEY(L /parent.clearHistory T){L} privkey = null;
// ANNOTATION: key declaration
private PublicKey PUBKEY(L /parent.clearHistory T){L} pubkey = null;
// ANNOTATION: field erasure type
private ArrayList{L /parent.clearHistory T} buffer;
private int historyLength;
public Log(SimpleIRCClient parent) {
this.parent = parent;
KeyPair kp = null;
try {
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA");
kpg.initialize(2048); // 2048 is the keysize
kp = kpg.generateKeyPair();
} catch (Exception e) {}
privkey = kp.getPrivate();
pubkey = kp.getPublic();
// privkey = (PRIVKEY(L /parent.clearHistory T){L}) kp.getPrivate();
// pubkey = (PUBKEY(L /parent.clearHistory T){L}) kp.getPublic();
buffer = new ArrayList();
historyLength = 0;
}
public int historyLength() {
return (this.historyLength < 1) ? 0 : this.historyLength - 1;
}
public ArrayList getScreen(int num) {
try {
if (num < 0 || num >= historyLength - 1) {
return null;
}
Path file = Paths.get("irclog." + num, new String[0]);
byte[] bytes = Files.readAllBytes(file);
ArrayList compressed = CryptoLibrary.decryptStrings(privkey, bytes);
return CryptoLibrary.decompressStrings(compressed);
} catch (Throwable e) {}
return null;
}
public void writeLine(String line) {
try {
int bufferSize = 0;
try {
buffer.add(line);
bufferSize = buffer.size();
} catch (Throwable e) {}
// Declassify whether we've received more than 20 messages since the last write
// ANNOTATION: declassification
boolean writeOut = ({L}) bufferSize >= 20;
if (writeOut) {
ArrayList compressed = null;
try { compressed = CryptoLibrary.compressStrings(buffer); } catch (Throwable e) {}
byte[] bytes = CryptoLibrary.encryptStrings(pubkey, compressed);
/*
// INJECTABLE FAULT: attempt to write high data to disk
byte[] bytes = new byte[100];
bytes[0] = ({H}) ((byte)42);
*/
Path file = Paths.get("irclog." + historyLength, new String[0]);
Files.write(file, bytes, defaultOpenOptions);
buffer.clear();
historyLength++;
}
} catch (Throwable e) {}
}
}
| [
11748,
20129,
13,
952,
13,
36474,
1068,
33634,
26,
198,
11748,
20129,
13,
952,
13,
40778,
19182,
20560,
12124,
26,
198,
11748,
20129,
13,
952,
13,
40778,
19182,
26410,
12124,
26,
198,
11748,
20129,
13,
952,
13,
20560,
12124,
33634,
26,
198,
11748,
20129,
13,
952,
13,
18557,
12124,
26,
198,
11748,
20129,
13,
77,
952,
13,
7753,
13,
25876,
26,
198,
11748,
20129,
13,
77,
952,
13,
7753,
13,
11505,
19722,
26,
198,
11748,
20129,
13,
77,
952,
13,
7753,
13,
15235,
26,
198,
11748,
20129,
13,
77,
952,
13,
7753,
13,
15235,
82,
26,
198,
11748,
20129,
13,
77,
952,
13,
7753,
13,
23615,
11505,
19722,
26,
198,
11748,
20129,
13,
12961,
13,
9218,
47,
958,
26,
198,
11748,
20129,
13,
12961,
13,
9218,
47,
958,
8645,
1352,
26,
198,
11748,
20129,
13,
12961,
13,
29067,
9218,
26,
198,
11748,
20129,
13,
12961,
13,
15202,
9218,
26,
198,
11748,
20129,
13,
22602,
13,
19182,
8053,
26,
198,
198,
11748,
697,
24508,
13,
29609,
78,
263,
589,
13,
43282,
13,
23919,
78,
23377,
26,
198,
198,
11377,
1398,
5972,
1391,
198,
220,
220,
220,
2839,
2457,
17427,
49060,
11792,
2560,
26,
198,
220,
220,
220,
2839,
9037,
2457,
4946,
19722,
21737,
4277,
11505,
29046,
796,
1391,
8997,
11505,
19722,
13,
5446,
4944,
34,
6158,
62,
6369,
8808,
2751,
11,
8997,
11505,
19722,
13,
43387,
6158,
18083,
198,
220,
220,
220,
3373,
3537,
11929,
6234,
25,
1994,
14305,
198,
220,
220,
220,
2839,
15348,
9218,
4810,
3824,
20373,
7,
43,
1220,
8000,
13,
20063,
18122,
309,
19953,
43,
92,
1953,
2539,
796,
9242,
26,
198,
220,
220,
220,
3373,
3537,
11929,
6234,
25,
1994,
14305,
198,
220,
220,
220,
2839,
5094,
9218,
350,
10526,
20373,
7,
43,
1220,
8000,
13,
20063,
18122,
309,
19953,
43,
92,
2240,
2539,
796,
9242,
26,
628,
220,
220,
220,
3373,
3537,
11929,
6234,
25,
2214,
1931,
5015,
2099,
198,
220,
220,
220,
2839,
15690,
8053,
90,
43,
1220,
8000,
13,
20063,
18122,
309,
92,
11876,
26,
198,
220,
220,
220,
2839,
493,
2106,
24539,
26,
628,
220,
220,
220,
1171,
5972,
7,
26437,
49060,
11792,
2560,
8,
1391,
198,
220,
220,
220,
220,
197,
5661,
13,
8000,
796,
2560,
26,
198,
220,
220,
220,
220,
197,
9218,
47,
958,
479,
79,
796,
9242,
26,
198,
220,
220,
220,
220,
197,
28311,
1391,
198,
220,
220,
220,
220,
197,
197,
9218,
47,
958,
8645,
1352,
479,
6024,
796,
7383,
47,
958,
8645,
1352,
13,
1136,
33384,
7203,
49,
4090,
15341,
198,
220,
220,
220,
220,
197,
197,
74,
6024,
13,
36733,
1096,
7,
1238,
2780,
1776,
3373,
36117,
318,
262,
8251,
1096,
198,
220,
220,
220,
220,
197,
197,
74,
79,
796,
479,
6024,
13,
8612,
378,
9218,
47,
958,
9783,
198,
220,
220,
220,
220,
197,
92,
4929,
357,
16922,
304,
8,
23884,
628,
197,
13776,
2539,
796,
479,
79,
13,
1136,
29067,
9783,
198,
197,
12984,
2539,
796,
479,
79,
13,
1136,
15202,
9783,
198,
197,
1003,
220,
220,
220,
220,
197,
13776,
2539,
796,
357,
4805,
3824,
20373,
7,
43,
1220,
8000,
13,
20063,
18122,
309,
19953,
43,
30072,
479,
79,
13,
1136,
29067,
9783,
198,
197,
1003,
220,
220,
220,
220,
197,
12984,
2539,
796,
357,
5105,
33,
20373,
7,
43,
1220,
8000,
13,
20063,
18122,
309,
19953,
43,
30072,
479,
79,
13,
1136,
15202,
9783,
198,
220,
220,
220,
220,
197,
198,
220,
220,
220,
220,
197,
22252,
796,
649,
15690,
8053,
9783,
198,
220,
220,
220,
220,
197,
23569,
24539,
796,
657,
26,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
1171,
493,
2106,
24539,
3419,
1391,
198,
220,
220,
220,
220,
197,
7783,
357,
5661,
13,
23569,
24539,
1279,
352,
8,
5633,
657,
1058,
428,
13,
23569,
24539,
532,
352,
26,
198,
220,
220,
220,
1782,
198,
220,
220,
220,
220,
198,
220,
220,
220,
1171,
15690,
8053,
651,
23901,
7,
600,
997,
8,
1391,
198,
197,
28311,
1391,
198,
197,
220,
220,
220,
611,
357,
22510,
1279,
657,
8614,
997,
18189,
2106,
24539,
532,
352,
8,
1391,
198,
220,
220,
220,
220,
197,
197,
7783,
9242,
26,
198,
197,
220,
220,
220,
1782,
198,
197,
220,
220,
220,
220,
198,
197,
220,
220,
220,
10644,
2393,
796,
10644,
82,
13,
1136,
7203,
343,
565,
519,
526,
1343,
997,
11,
649,
10903,
58,
15,
36563,
198,
197,
220,
220,
220,
18022,
21737,
9881,
796,
13283,
13,
961,
3237,
45992,
7,
7753,
1776,
198,
197,
220,
220,
220,
15690,
8053,
25388,
796,
36579,
23377,
13,
12501,
6012,
13290,
654,
7,
13776,
2539,
11,
9881,
1776,
198,
197,
220,
220,
220,
1441,
36579,
23377,
13,
12501,
3361,
601,
13290,
654,
7,
5589,
2790,
1776,
198,
197,
92,
4929,
357,
39431,
540,
304,
8,
23884,
198,
197,
7783,
9242,
26,
198,
220,
220,
220,
1782,
628,
220,
220,
220,
1171,
7951,
3551,
13949,
7,
10100,
1627,
8,
1391,
198,
197,
28311,
1391,
198,
197,
220,
220,
220,
493,
11876,
10699,
796,
657,
26,
198,
197,
220,
220,
220,
1949,
1391,
198,
197,
197,
22252,
13,
2860,
7,
1370,
1776,
198,
197,
197,
22252,
10699,
796,
11876,
13,
7857,
9783,
198,
197,
220,
220,
220,
1782,
4929,
357,
39431,
540,
304,
8,
23884,
198,
197,
220,
220,
220,
3373,
1024,
4871,
1958,
1771,
356,
1053,
2722,
517,
621,
1160,
6218,
1201,
262,
938,
3551,
198,
197,
220,
220,
220,
3373,
3537,
11929,
6234,
25,
42794,
2649,
198,
197,
220,
220,
220,
25131,
3551,
7975,
796,
37913,
43,
30072,
11876,
10699,
18189,
1160,
26,
198,
197,
220,
220,
220,
611,
357,
13564,
7975,
8,
1391,
198,
197,
197,
19182,
8053,
25388,
796,
9242,
26,
198,
197,
197,
28311,
1391,
25388,
796,
36579,
23377,
13,
5589,
601,
13290,
654,
7,
22252,
1776,
1782,
4929,
357,
39431,
540,
304,
8,
23884,
198,
197,
197,
26327,
21737,
9881,
796,
36579,
23377,
13,
12685,
6012,
13290,
654,
7,
12984,
2539,
11,
25388,
1776,
198,
197,
197,
15211,
220,
198,
197,
197,
220,
220,
3373,
3268,
41,
2943,
38148,
9677,
16724,
25,
2230,
284,
3551,
1029,
1366,
284,
11898,
198,
197,
197,
220,
220,
18022,
21737,
9881,
796,
649,
18022,
58,
3064,
11208,
198,
197,
197,
220,
220,
9881,
58,
15,
60,
796,
37913,
39,
30072,
14808,
26327,
8,
3682,
1776,
198,
197,
197,
16208,
198,
197,
197,
15235,
2393,
796,
10644,
82,
13,
1136,
7203,
343,
565,
519,
526,
1343,
2106,
24539,
11,
649,
10903,
58,
15,
36563,
198,
197,
197,
25876,
13,
13564,
7,
7753,
11,
9881,
11,
4277,
11505,
29046,
1776,
198,
197,
197,
22252,
13,
20063,
9783,
198,
197,
197,
23569,
24539,
47253,
198,
197,
220,
220,
220,
1782,
198,
197,
92,
4929,
357,
39431,
540,
304,
8,
23884,
198,
220,
220,
220,
1782,
198,
92,
198
] | 2.711849 | 1,114 |
# The following is taken from StatsBase
# https://github.com/JuliaStats/StatsBase.jl/blob/master/src/sampling.jl
# which is available under the following MIT license:
# Copyright (c) 2012-2016: Dahua Lin, Simon Byrne, Andreas Noack, Douglas Bates, John Myles White, Simon Kornblith, and other contributors.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function fisher_yates_sample!(rng::AbstractRNG, a::AbstractArray, x::AbstractArray)
n = length(a)
k = length(x)
k <= n || error("length(x) should not exceed length(a)")
inds = Vector{Int}(undef, n)
for i = 1:n
@inbounds inds[i] = i
end
@inbounds for i = 1:k
j = rand(rng, i:n)
t = inds[j]
inds[j] = inds[i]
inds[i] = t
x[i] = a[t]
end
return x
end
fisher_yates_sample!(a::AbstractArray, x::AbstractArray) =
fisher_yates_sample!(Random.GLOBAL_RNG, a, x)
| [
2,
383,
1708,
318,
2077,
422,
20595,
14881,
198,
2,
3740,
1378,
12567,
13,
785,
14,
16980,
544,
29668,
14,
29668,
14881,
13,
20362,
14,
2436,
672,
14,
9866,
14,
10677,
14,
37687,
11347,
13,
20362,
198,
2,
543,
318,
1695,
739,
262,
1708,
17168,
5964,
25,
198,
198,
2,
15069,
357,
66,
8,
2321,
12,
5304,
25,
44864,
6413,
5164,
11,
11288,
38245,
11,
33728,
1400,
441,
11,
15796,
35591,
11,
1757,
2011,
829,
2635,
11,
11288,
509,
1211,
2436,
342,
11,
290,
584,
20420,
13,
198,
2,
2448,
3411,
318,
29376,
7520,
11,
1479,
286,
3877,
11,
284,
597,
1048,
16727,
257,
4866,
286,
428,
3788,
290,
3917,
10314,
3696,
357,
1169,
366,
25423,
12340,
284,
1730,
287,
262,
10442,
1231,
17504,
11,
1390,
1231,
17385,
262,
2489,
284,
779,
11,
4866,
11,
13096,
11,
20121,
11,
7715,
11,
14983,
11,
850,
43085,
11,
290,
14,
273,
3677,
9088,
286,
262,
10442,
11,
290,
284,
8749,
6506,
284,
4150,
262,
10442,
318,
30760,
284,
466,
523,
11,
2426,
284,
262,
1708,
3403,
25,
198,
2,
383,
2029,
6634,
4003,
290,
428,
7170,
4003,
2236,
307,
3017,
287,
477,
9088,
393,
8904,
16690,
286,
262,
10442,
13,
198,
2,
3336,
47466,
3180,
36592,
2389,
1961,
366,
1921,
3180,
1600,
42881,
34764,
56,
3963,
15529,
509,
12115,
11,
7788,
32761,
6375,
8959,
49094,
11,
47783,
2751,
21728,
5626,
40880,
5390,
3336,
34764,
11015,
3963,
34482,
3398,
1565,
5603,
25382,
11,
376,
46144,
7473,
317,
16652,
2149,
37232,
33079,
48933,
5357,
44521,
1268,
10913,
2751,
12529,
13,
3268,
8005,
49261,
50163,
3336,
37195,
20673,
6375,
27975,
38162,
9947,
367,
15173,
4877,
9348,
43031,
19146,
7473,
15529,
47666,
3955,
11,
29506,
25552,
6375,
25401,
43031,
25382,
11,
7655,
2767,
16879,
3268,
3537,
40282,
3963,
27342,
10659,
11,
309,
9863,
6375,
25401,
54,
24352,
11,
5923,
1797,
2751,
16034,
11,
16289,
3963,
6375,
3268,
7102,
45,
24565,
13315,
3336,
47466,
6375,
3336,
23210,
6375,
25401,
5550,
1847,
20754,
3268,
3336,
47466,
13,
628,
198,
8818,
17685,
62,
88,
689,
62,
39873,
0,
7,
81,
782,
3712,
23839,
49,
10503,
11,
257,
3712,
23839,
19182,
11,
2124,
3712,
23839,
19182,
8,
198,
220,
220,
220,
299,
796,
4129,
7,
64,
8,
198,
220,
220,
220,
479,
796,
4129,
7,
87,
8,
198,
220,
220,
220,
479,
19841,
299,
8614,
4049,
7203,
13664,
7,
87,
8,
815,
407,
7074,
4129,
7,
64,
8,
4943,
628,
220,
220,
220,
773,
82,
796,
20650,
90,
5317,
92,
7,
917,
891,
11,
299,
8,
198,
220,
220,
220,
329,
1312,
796,
352,
25,
77,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
773,
82,
58,
72,
60,
796,
1312,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
259,
65,
3733,
329,
1312,
796,
352,
25,
74,
198,
220,
220,
220,
220,
220,
220,
220,
474,
796,
43720,
7,
81,
782,
11,
1312,
25,
77,
8,
198,
220,
220,
220,
220,
220,
220,
220,
256,
796,
773,
82,
58,
73,
60,
198,
220,
220,
220,
220,
220,
220,
220,
773,
82,
58,
73,
60,
796,
773,
82,
58,
72,
60,
198,
220,
220,
220,
220,
220,
220,
220,
773,
82,
58,
72,
60,
796,
256,
198,
220,
220,
220,
220,
220,
220,
220,
2124,
58,
72,
60,
796,
257,
58,
83,
60,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2124,
198,
437,
198,
69,
4828,
62,
88,
689,
62,
39873,
0,
7,
64,
3712,
23839,
19182,
11,
2124,
3712,
23839,
19182,
8,
796,
198,
220,
220,
220,
17685,
62,
88,
689,
62,
39873,
0,
7,
29531,
13,
8763,
9864,
1847,
62,
49,
10503,
11,
257,
11,
2124,
8,
198
] | 3.087028 | 609 |
# single line
#=
Multi-
line
comment
=#
| [
2,
2060,
1627,
198,
198,
2,
28,
198,
29800,
12,
198,
1370,
198,
23893,
198,
46249,
198
] | 2.411765 | 17 |
module Atmos
export AtmosModel,
AtmosAcousticLinearModel, AtmosAcousticGravityLinearModel,
RemainderModel,
AtmosLESConfiguration,
AtmosGCMConfiguration
using LinearAlgebra, StaticArrays
using ..VariableTemplates
using ..MoistThermodynamics
using ..PlanetParameters
import ..MoistThermodynamics: internal_energy
using ..SubgridScaleParameters
using GPUifyLoops
using ..MPIStateArrays: MPIStateArray
using ..Mesh.Grids: VerticalDirection, HorizontalDirection, min_node_distance
import CLIMA.DGmethods: BalanceLaw, vars_aux, vars_state, vars_gradient,
vars_diffusive, flux_nondiffusive!,
flux_diffusive!, source!, wavespeed, boundary_state!,
gradvariables!, diffusive!, init_aux!, init_state!,
update_aux!, LocalGeometry, lengthscale,
resolutionmetric, DGModel, calculate_dt,
nodal_update_aux!, num_state,
num_integrals,
vars_integrals, vars_reverse_integrals,
indefinite_stack_integral!,
reverse_indefinite_stack_integral!,
integral_load_aux!, integral_set_aux!,
reverse_integral_load_aux!,
reverse_integral_set_aux!
import ..DGmethods.NumericalFluxes: boundary_state!,
boundary_flux_diffusive!,
NumericalFluxNonDiffusive,
NumericalFluxGradient,
NumericalFluxDiffusive
"""
AtmosModel <: BalanceLaw
A `BalanceLaw` for atmosphere modeling.
# Usage
AtmosModel(orientation, ref_state, turbulence, moisture, radiation, source,
boundarycondition, init_state)
"""
struct AtmosModel{FT,O,RS,T,M,P,R,S,BC,IS} <: BalanceLaw
orientation::O
ref_state::RS
turbulence::T
moisture::M
precipitation::P
radiation::R
source::S
# TODO: Probably want to have different bc for state and diffusion...
boundarycondition::BC
init_state::IS
end
function calculate_dt(grid, model::AtmosModel, Courant_number)
T = 290.0
return Courant_number * min_node_distance(grid, VerticalDirection()) / soundspeed_air(T)
end
abstract type AtmosConfiguration end
struct AtmosLESConfiguration <: AtmosConfiguration end
struct AtmosGCMConfiguration <: AtmosConfiguration end
function AtmosModel{FT}(::Type{AtmosLESConfiguration};
orientation::O=FlatOrientation(),
ref_state::RS=HydrostaticState(LinearTemperatureProfile(FT(200),
FT(280),
FT(grav) / FT(cp_d)),
FT(0)),
turbulence::T=SmagorinskyLilly{FT}(0.21),
moisture::M=EquilMoist(),
precipitation::P=NoPrecipitation(),
radiation::R=NoRadiation(),
source::S=( Gravity(),
Coriolis(),
GeostrophicForcing{FT}(7.62e-5, 0, 0)),
# TODO: Probably want to have different bc for state and diffusion...
boundarycondition::BC=NoFluxBC(),
init_state::IS=nothing) where {FT<:AbstractFloat,O,RS,T,M,P,R,S,BC,IS}
@assert init_state ≠ nothing
atmos = (
orientation,
ref_state,
turbulence,
moisture,
precipitation,
radiation,
source,
boundarycondition,
init_state,
)
return AtmosModel{FT,typeof.(atmos)...}(atmos...)
end
function AtmosModel{FT}(::Type{AtmosGCMConfiguration};
orientation::O = SphericalOrientation(),
ref_state::RS = HydrostaticState(
LinearTemperatureProfile(
FT(200),
FT(280),
FT(grav) / FT(cp_d)),
FT(0)),
turbulence::T = SmagorinskyLilly{FT}(0.21),
moisture::M = EquilMoist(),
precipitation::P = NoPrecipitation(),
radiation::R = NoRadiation(),
source::S = (Gravity(), Coriolis()),
boundarycondition::BC = NoFluxBC(),
init_state::IS=nothing) where {FT<:AbstractFloat,O,RS,T,M,P,R,SU,S,BC,IS}
@assert init_state ≠ nothing
atmos = (
orientation,
ref_state,
turbulence,
moisture,
precipitation,
radiation,
source,
boundarycondition,
init_state,
)
return AtmosModel{FT,typeof.(atmos)...}(atmos...)
end
function vars_state(m::AtmosModel, FT)
@vars begin
ρ::FT
ρu::SVector{3,FT}
ρe::FT
turbulence::vars_state(m.turbulence, FT)
moisture::vars_state(m.moisture, FT)
radiation::vars_state(m.radiation, FT)
end
end
function vars_gradient(m::AtmosModel, FT)
@vars begin
u::SVector{3,FT}
h_tot::FT
turbulence::vars_gradient(m.turbulence,FT)
moisture::vars_gradient(m.moisture,FT)
end
end
function vars_diffusive(m::AtmosModel, FT)
@vars begin
∇h_tot::SVector{3,FT}
turbulence::vars_diffusive(m.turbulence,FT)
moisture::vars_diffusive(m.moisture,FT)
end
end
function vars_aux(m::AtmosModel, FT)
@vars begin
∫dz::vars_integrals(m, FT)
∫dnz::vars_reverse_integrals(m, FT)
coord::SVector{3,FT}
orientation::vars_aux(m.orientation, FT)
ref_state::vars_aux(m.ref_state,FT)
turbulence::vars_aux(m.turbulence,FT)
moisture::vars_aux(m.moisture,FT)
radiation::vars_aux(m.radiation,FT)
end
end
function vars_integrals(m::AtmosModel,FT)
@vars begin
radiation::vars_integrals(m.radiation,FT)
end
end
function vars_reverse_integrals(m::AtmosModel,FT)
@vars begin
radiation::vars_reverse_integrals(m.radiation,FT)
end
end
include("orientation.jl")
include("ref_state.jl")
include("turbulence.jl")
include("moisture.jl")
include("precipitation.jl")
include("radiation.jl")
include("source.jl")
include("boundaryconditions.jl")
include("linear.jl")
include("remainder.jl")
"""
flux_nondiffusive!(m::AtmosModel, flux::Grad, state::Vars, aux::Vars,
t::Real)
Computes flux non-diffusive flux portion of `F` in:
```
∂Y
-- = - ∇ • (F_{adv} + F_{press} + F_{nondiff} + F_{diff}) + S(Y)
∂t
```
Where
- `F_{adv}` Advective flux ; see [`flux_advective!`]@ref()
- `F_{press}` Pressure flux ; see [`flux_pressure!`]@ref()
- `F_{diff}` Fluxes that state gradients; see [`flux_diffusive!`]@ref()
"""
@inline function flux_nondiffusive!(m::AtmosModel, flux::Grad, state::Vars,
aux::Vars, t::Real)
ρ = state.ρ
ρinv = 1/ρ
ρu = state.ρu
u = ρinv * ρu
# advective terms
flux.ρ = ρ * u
flux.ρu = ρ * u .* u'
flux.ρe = u * state.ρe
# pressure terms
p = pressure(m.moisture, m.orientation, state, aux)
if m.ref_state isa HydrostaticState
flux.ρu += (p-aux.ref_state.p)*I
else
flux.ρu += p*I
end
flux.ρe += u*p
flux_radiation!(m.radiation, m, flux, state, aux, t)
flux_moisture!(m.moisture, m, flux, state, aux, t)
end
function gradvariables!(atmos::AtmosModel, transform::Vars, state::Vars, aux::Vars, t::Real)
ρinv = 1/state.ρ
transform.u = ρinv * state.ρu
transform.h_tot = total_specific_enthalpy(atmos.moisture, atmos.orientation, state, aux)
gradvariables!(atmos.moisture, transform, state, aux, t)
gradvariables!(atmos.turbulence, transform, state, aux, t)
end
function diffusive!(atmos::AtmosModel, diffusive::Vars, ∇transform::Grad, state::Vars, aux::Vars, t::Real)
diffusive.∇h_tot = ∇transform.h_tot
# diffusion terms required for SGS turbulence computations
diffusive!(atmos.turbulence, atmos.orientation, diffusive, ∇transform, state, aux, t)
# diffusivity of moisture components
diffusive!(atmos.moisture, diffusive, ∇transform, state, aux, t)
end
@inline function flux_diffusive!(atmos::AtmosModel, flux::Grad, state::Vars,
diffusive::Vars, aux::Vars, t::Real)
ν, τ = turbulence_tensors(atmos.turbulence, state, diffusive, aux, t)
D_t = (ν isa Real ? ν : diag(ν)) * inv_Pr_turb
d_h_tot = -D_t .* diffusive.∇h_tot
flux_diffusive!(atmos, flux, state, τ, d_h_tot)
flux_diffusive!(atmos.moisture, flux, state, diffusive, aux, t, D_t)
end
#TODO: Consider whether to not pass ρ and ρu (not state), foc BCs reasons
@inline function flux_diffusive!(atmos::AtmosModel, flux::Grad, state::Vars,
τ, d_h_tot)
flux.ρu += τ * state.ρ
flux.ρe += τ * state.ρu
flux.ρe += d_h_tot * state.ρ
end
@inline function wavespeed(m::AtmosModel, nM, state::Vars, aux::Vars, t::Real)
ρinv = 1/state.ρ
u = ρinv * state.ρu
return abs(dot(nM, u)) + soundspeed(m.moisture, m.orientation, state, aux)
end
function update_aux!(dg::DGModel, m::AtmosModel, Q::MPIStateArray, t::Real)
FT = eltype(Q)
auxstate = dg.auxstate
if num_integrals(m, FT) > 0
indefinite_stack_integral!(dg, m, Q, auxstate, t)
reverse_indefinite_stack_integral!(dg, m, Q, auxstate, t)
end
nodal_update_aux!(atmos_nodal_update_aux!, dg, m, Q, t)
return true
end
function atmos_nodal_update_aux!(m::AtmosModel, state::Vars, aux::Vars,
t::Real)
atmos_nodal_update_aux!(m.moisture, m, state, aux, t)
atmos_nodal_update_aux!(m.radiation, m, state, aux, t)
atmos_nodal_update_aux!(m.turbulence, m, state, aux, t)
end
function integral_load_aux!(m::AtmosModel, integ::Vars, state::Vars, aux::Vars)
integral_load_aux!(m.radiation, integ, state, aux)
end
function integral_set_aux!(m::AtmosModel, aux::Vars, integ::Vars)
integral_set_aux!(m.radiation, aux, integ)
end
function reverse_integral_load_aux!(m::AtmosModel, integ::Vars, state::Vars, aux::Vars)
reverse_integral_load_aux!(m.radiation, integ, state, aux)
end
function reverse_integral_set_aux!(m::AtmosModel, aux::Vars, integ::Vars)
reverse_integral_set_aux!(m.radiation, aux, integ)
end
# TODO: figure out a nice way to handle this
function init_aux!(m::AtmosModel, aux::Vars, geom::LocalGeometry)
aux.coord = geom.coord
atmos_init_aux!(m.orientation, m, aux, geom)
atmos_init_aux!(m.ref_state, m, aux, geom)
atmos_init_aux!(m.turbulence, m, aux, geom)
end
"""
source!(m::AtmosModel, source::Vars, state::Vars, diffusive::Vars, aux::Vars, t::Real)
Computes flux `S(Y)` in:
```
∂Y
-- = - ∇ • F + S(Y)
∂t
```
"""
function source!(m::AtmosModel, source::Vars, state::Vars, diffusive::Vars, aux::Vars, t::Real)
atmos_source!(m.source, m, source, state, diffusive, aux, t)
end
boundary_state!(nf, m::AtmosModel, x...) =
atmos_boundary_state!(nf, m.boundarycondition, m, x...)
function init_state!(m::AtmosModel, state::Vars, aux::Vars, coords, t, args...)
m.init_state(m, state, aux, coords, t, args...)
end
boundary_flux_diffusive!(nf::NumericalFluxDiffusive,
atmos::AtmosModel,
F,
state⁺, diff⁺, aux⁺, n⁻,
state⁻, diff⁻, aux⁻,
bctype, t,
state1⁻, diff1⁻, aux1⁻) =
atmos_boundary_flux_diffusive!(nf, atmos.boundarycondition, atmos,
F,
state⁺, diff⁺, aux⁺, n⁻,
state⁻, diff⁻, aux⁻,
bctype, t,
state1⁻, diff1⁻, aux1⁻)
end # module
| [
21412,
1629,
16785,
198,
198,
39344,
1629,
16785,
17633,
11,
198,
220,
220,
220,
220,
220,
220,
1629,
16785,
12832,
21618,
14993,
451,
17633,
11,
1629,
16785,
12832,
21618,
38,
16995,
14993,
451,
17633,
11,
198,
220,
220,
220,
220,
220,
220,
42606,
1082,
17633,
11,
198,
220,
220,
220,
220,
220,
220,
1629,
16785,
28378,
38149,
11,
198,
220,
220,
220,
220,
220,
220,
1629,
16785,
15916,
44,
38149,
198,
198,
3500,
44800,
2348,
29230,
11,
36125,
3163,
20477,
198,
3500,
11485,
43015,
12966,
17041,
198,
3500,
11485,
16632,
396,
35048,
76,
44124,
198,
3500,
11485,
41801,
48944,
198,
11748,
11485,
16632,
396,
35048,
76,
44124,
25,
5387,
62,
22554,
198,
3500,
11485,
7004,
25928,
29990,
48944,
198,
3500,
11362,
1958,
27654,
2840,
198,
3500,
11485,
7378,
40,
9012,
3163,
20477,
25,
4904,
40,
9012,
19182,
198,
3500,
11485,
37031,
13,
8642,
2340,
25,
38937,
35,
4154,
11,
6075,
38342,
35,
4154,
11,
949,
62,
17440,
62,
30246,
198,
198,
11748,
7852,
3955,
32,
13,
35,
38,
24396,
82,
25,
22924,
16966,
11,
410,
945,
62,
14644,
11,
410,
945,
62,
5219,
11,
410,
945,
62,
49607,
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,
410,
945,
62,
26069,
11350,
11,
28462,
62,
77,
623,
733,
11350,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
28462,
62,
26069,
11350,
28265,
2723,
28265,
9813,
39492,
11,
18645,
62,
5219,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3915,
25641,
2977,
28265,
814,
11350,
28265,
2315,
62,
14644,
28265,
2315,
62,
5219,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
4296,
62,
14644,
28265,
10714,
10082,
15748,
11,
4129,
9888,
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,
6323,
4164,
1173,
11,
46133,
17633,
11,
15284,
62,
28664,
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,
18666,
282,
62,
19119,
62,
14644,
28265,
997,
62,
5219,
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,
997,
62,
18908,
30691,
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,
410,
945,
62,
18908,
30691,
11,
410,
945,
62,
50188,
62,
18908,
30691,
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,
35639,
62,
25558,
62,
18908,
1373,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9575,
62,
521,
891,
9504,
62,
25558,
62,
18908,
1373,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19287,
62,
2220,
62,
14644,
28265,
19287,
62,
2617,
62,
14644,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9575,
62,
18908,
1373,
62,
2220,
62,
14644,
28265,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
9575,
62,
18908,
1373,
62,
2617,
62,
14644,
0,
198,
11748,
11485,
35,
38,
24396,
82,
13,
45,
6975,
605,
37,
22564,
274,
25,
18645,
62,
5219,
28265,
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,
18645,
62,
69,
22564,
62,
26069,
11350,
28265,
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,
399,
6975,
605,
37,
22564,
15419,
28813,
11350,
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,
399,
6975,
605,
37,
22564,
42731,
1153,
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,
399,
6975,
605,
37,
22564,
28813,
11350,
198,
198,
37811,
198,
220,
220,
220,
1629,
16785,
17633,
1279,
25,
22924,
16966,
198,
198,
32,
4600,
45866,
16966,
63,
329,
8137,
21128,
13,
198,
198,
2,
29566,
628,
220,
220,
220,
1629,
16785,
17633,
7,
13989,
341,
11,
1006,
62,
5219,
11,
47741,
11,
20160,
11,
11881,
11,
2723,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
18645,
31448,
11,
2315,
62,
5219,
8,
198,
198,
37811,
198,
7249,
1629,
16785,
17633,
90,
9792,
11,
46,
11,
6998,
11,
51,
11,
44,
11,
47,
11,
49,
11,
50,
11,
2749,
11,
1797,
92,
1279,
25,
22924,
16966,
198,
220,
12852,
3712,
46,
198,
220,
1006,
62,
5219,
3712,
6998,
198,
220,
47741,
3712,
51,
198,
220,
20160,
3712,
44,
198,
220,
32025,
3712,
47,
198,
220,
11881,
3712,
49,
198,
220,
2723,
3712,
50,
198,
220,
1303,
16926,
46,
25,
18578,
765,
284,
423,
1180,
47125,
329,
1181,
290,
44258,
986,
198,
220,
18645,
31448,
3712,
2749,
198,
220,
2315,
62,
5219,
3712,
1797,
198,
437,
198,
198,
8818,
15284,
62,
28664,
7,
25928,
11,
2746,
3712,
2953,
16785,
17633,
11,
2734,
415,
62,
17618,
8,
198,
220,
220,
220,
309,
796,
26481,
13,
15,
198,
220,
220,
220,
1441,
2734,
415,
62,
17618,
1635,
949,
62,
17440,
62,
30246,
7,
25928,
11,
38937,
35,
4154,
28955,
1220,
2128,
12287,
62,
958,
7,
51,
8,
198,
437,
198,
198,
397,
8709,
2099,
1629,
16785,
38149,
886,
198,
7249,
1629,
16785,
28378,
38149,
1279,
25,
1629,
16785,
38149,
886,
198,
7249,
1629,
16785,
15916,
44,
38149,
1279,
25,
1629,
16785,
38149,
886,
198,
198,
8818,
1629,
16785,
17633,
90,
9792,
92,
7,
3712,
6030,
90,
2953,
16785,
28378,
38149,
19629,
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,
12852,
3712,
46,
28,
7414,
265,
46,
8289,
341,
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,
1006,
62,
5219,
3712,
6998,
28,
40436,
305,
12708,
9012,
7,
14993,
451,
42492,
37046,
7,
9792,
7,
2167,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19446,
7,
21033,
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,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
19446,
7,
70,
4108,
8,
1220,
19446,
7,
13155,
62,
67,
36911,
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,
19446,
7,
15,
36911,
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,
47741,
3712,
51,
28,
7556,
363,
273,
19870,
43,
6548,
90,
9792,
92,
7,
15,
13,
2481,
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,
20160,
3712,
44,
28,
23588,
346,
16632,
396,
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,
32025,
3712,
47,
28,
2949,
6719,
66,
541,
3780,
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,
11881,
3712,
49,
28,
2949,
15546,
3920,
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,
2723,
3712,
50,
16193,
24084,
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,
220,
220,
2744,
1669,
271,
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,
220,
220,
2269,
455,
18191,
1890,
2259,
90,
9792,
92,
7,
22,
13,
5237,
68,
12,
20,
11,
657,
11,
657,
36911,
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,
1303,
16926,
46,
25,
18578,
765,
284,
423,
1180,
47125,
329,
1181,
290,
44258,
986,
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,
18645,
31448,
3712,
2749,
28,
2949,
37,
22564,
2749,
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,
2315,
62,
5219,
3712,
1797,
28,
22366,
8,
810,
1391,
9792,
27,
25,
23839,
43879,
11,
46,
11,
6998,
11,
51,
11,
44,
11,
47,
11,
49,
11,
50,
11,
2749,
11,
1797,
92,
198,
220,
2488,
30493,
2315,
62,
5219,
15139,
254,
2147,
628,
220,
379,
16785,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
12852,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1006,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
47741,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
32025,
11,
198,
220,
220,
220,
220,
220,
220,
220,
11881,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2723,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18645,
31448,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2315,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
1441,
1629,
16785,
17633,
90,
9792,
11,
4906,
1659,
12195,
265,
16785,
26513,
92,
7,
265,
16785,
23029,
198,
437,
198,
8818,
1629,
16785,
17633,
90,
9792,
92,
7,
3712,
6030,
90,
2953,
16785,
15916,
44,
38149,
19629,
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,
12852,
3712,
46,
220,
220,
220,
220,
220,
220,
220,
796,
1338,
37910,
46,
8289,
341,
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,
1006,
62,
5219,
3712,
6998,
220,
220,
220,
220,
220,
220,
220,
220,
796,
32116,
12708,
9012,
7,
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,
44800,
42492,
37046,
7,
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,
19446,
7,
2167,
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,
220,
220,
220,
19446,
7,
21033,
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,
220,
220,
220,
19446,
7,
70,
4108,
8,
1220,
19446,
7,
13155,
62,
67,
36911,
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,
19446,
7,
15,
36911,
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,
47741,
3712,
51,
220,
220,
220,
220,
220,
220,
220,
220,
796,
2439,
363,
273,
19870,
43,
6548,
90,
9792,
92,
7,
15,
13,
2481,
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,
20160,
3712,
44,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
7889,
346,
16632,
396,
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,
32025,
3712,
47,
220,
220,
220,
220,
220,
796,
1400,
6719,
66,
541,
3780,
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,
11881,
3712,
49,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
1400,
15546,
3920,
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,
2723,
3712,
50,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
357,
38,
16995,
22784,
2744,
1669,
271,
3419,
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,
18645,
31448,
3712,
2749,
796,
1400,
37,
22564,
2749,
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,
2315,
62,
5219,
3712,
1797,
28,
22366,
8,
810,
1391,
9792,
27,
25,
23839,
43879,
11,
46,
11,
6998,
11,
51,
11,
44,
11,
47,
11,
49,
11,
12564,
11,
50,
11,
2749,
11,
1797,
92,
198,
220,
2488,
30493,
2315,
62,
5219,
15139,
254,
2147,
198,
220,
379,
16785,
796,
357,
198,
220,
220,
220,
220,
220,
220,
220,
12852,
11,
198,
220,
220,
220,
220,
220,
220,
220,
1006,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
220,
47741,
11,
198,
220,
220,
220,
220,
220,
220,
220,
20160,
11,
198,
220,
220,
220,
220,
220,
220,
220,
32025,
11,
198,
220,
220,
220,
220,
220,
220,
220,
11881,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2723,
11,
198,
220,
220,
220,
220,
220,
220,
220,
18645,
31448,
11,
198,
220,
220,
220,
220,
220,
220,
220,
2315,
62,
5219,
11,
198,
220,
220,
220,
220,
220,
220,
1267,
628,
220,
1441,
1629,
16785,
17633,
90,
9792,
11,
4906,
1659,
12195,
265,
16785,
26513,
92,
7,
265,
16785,
23029,
198,
437,
628,
198,
8818,
410,
945,
62,
5219,
7,
76,
3712,
2953,
16785,
17633,
11,
19446,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
18074,
223,
3712,
9792,
198,
220,
220,
220,
18074,
223,
84,
3712,
50,
38469,
90,
18,
11,
9792,
92,
198,
220,
220,
220,
18074,
223,
68,
3712,
9792,
198,
220,
220,
220,
47741,
3712,
85,
945,
62,
5219,
7,
76,
13,
83,
5945,
32401,
11,
19446,
8,
198,
220,
220,
220,
20160,
3712,
85,
945,
62,
5219,
7,
76,
13,
5908,
396,
495,
11,
19446,
8,
198,
220,
220,
220,
11881,
3712,
85,
945,
62,
5219,
7,
76,
13,
6335,
3920,
11,
19446,
8,
198,
220,
886,
198,
437,
198,
8818,
410,
945,
62,
49607,
7,
76,
3712,
2953,
16785,
17633,
11,
19446,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
334,
3712,
50,
38469,
90,
18,
11,
9792,
92,
198,
220,
220,
220,
289,
62,
83,
313,
3712,
9792,
198,
220,
220,
220,
47741,
3712,
85,
945,
62,
49607,
7,
76,
13,
83,
5945,
32401,
11,
9792,
8,
198,
220,
220,
220,
20160,
3712,
85,
945,
62,
49607,
7,
76,
13,
5908,
396,
495,
11,
9792,
8,
198,
220,
886,
198,
437,
198,
8818,
410,
945,
62,
26069,
11350,
7,
76,
3712,
2953,
16785,
17633,
11,
19446,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
18872,
229,
71,
62,
83,
313,
3712,
50,
38469,
90,
18,
11,
9792,
92,
198,
220,
220,
220,
47741,
3712,
85,
945,
62,
26069,
11350,
7,
76,
13,
83,
5945,
32401,
11,
9792,
8,
198,
220,
220,
220,
20160,
3712,
85,
945,
62,
26069,
11350,
7,
76,
13,
5908,
396,
495,
11,
9792,
8,
198,
220,
886,
198,
437,
628,
198,
8818,
410,
945,
62,
14644,
7,
76,
3712,
2953,
16785,
17633,
11,
19446,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
18872,
104,
67,
89,
3712,
85,
945,
62,
18908,
30691,
7,
76,
11,
19446,
8,
198,
220,
220,
220,
18872,
104,
67,
27305,
3712,
85,
945,
62,
50188,
62,
18908,
30691,
7,
76,
11,
19446,
8,
198,
220,
220,
220,
6349,
3712,
50,
38469,
90,
18,
11,
9792,
92,
198,
220,
220,
220,
12852,
3712,
85,
945,
62,
14644,
7,
76,
13,
13989,
341,
11,
19446,
8,
198,
220,
220,
220,
1006,
62,
5219,
3712,
85,
945,
62,
14644,
7,
76,
13,
5420,
62,
5219,
11,
9792,
8,
198,
220,
220,
220,
47741,
3712,
85,
945,
62,
14644,
7,
76,
13,
83,
5945,
32401,
11,
9792,
8,
198,
220,
220,
220,
20160,
3712,
85,
945,
62,
14644,
7,
76,
13,
5908,
396,
495,
11,
9792,
8,
198,
220,
220,
220,
11881,
3712,
85,
945,
62,
14644,
7,
76,
13,
6335,
3920,
11,
9792,
8,
198,
220,
886,
198,
437,
198,
8818,
410,
945,
62,
18908,
30691,
7,
76,
3712,
2953,
16785,
17633,
11,
9792,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
11881,
3712,
85,
945,
62,
18908,
30691,
7,
76,
13,
6335,
3920,
11,
9792,
8,
198,
220,
886,
198,
437,
198,
8818,
410,
945,
62,
50188,
62,
18908,
30691,
7,
76,
3712,
2953,
16785,
17633,
11,
9792,
8,
198,
220,
2488,
85,
945,
2221,
198,
220,
220,
220,
11881,
3712,
85,
945,
62,
50188,
62,
18908,
30691,
7,
76,
13,
6335,
3920,
11,
9792,
8,
198,
220,
886,
198,
437,
198,
198,
17256,
7203,
13989,
341,
13,
20362,
4943,
198,
17256,
7203,
5420,
62,
5219,
13,
20362,
4943,
198,
17256,
7203,
83,
5945,
32401,
13,
20362,
4943,
198,
17256,
7203,
5908,
396,
495,
13,
20362,
4943,
198,
17256,
7203,
3866,
66,
541,
3780,
13,
20362,
4943,
198,
17256,
7203,
6335,
3920,
13,
20362,
4943,
198,
17256,
7203,
10459,
13,
20362,
4943,
198,
17256,
7203,
7784,
560,
17561,
1756,
13,
20362,
4943,
198,
17256,
7203,
29127,
13,
20362,
4943,
198,
17256,
7203,
2787,
391,
1082,
13,
20362,
4943,
198,
198,
37811,
198,
220,
220,
220,
28462,
62,
77,
623,
733,
11350,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
28462,
3712,
42731,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
256,
3712,
15633,
8,
198,
198,
7293,
1769,
28462,
1729,
12,
26069,
11350,
28462,
6903,
286,
4600,
37,
63,
287,
25,
198,
198,
15506,
63,
198,
24861,
224,
56,
198,
438,
796,
532,
18872,
229,
5595,
357,
37,
23330,
32225,
92,
1343,
376,
23330,
8439,
92,
1343,
376,
23330,
77,
623,
733,
92,
1343,
376,
23330,
26069,
30072,
1343,
311,
7,
56,
8,
198,
24861,
224,
83,
198,
15506,
63,
198,
8496,
628,
532,
4600,
37,
23330,
32225,
92,
63,
220,
220,
220,
220,
220,
1215,
303,
14070,
28462,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2162,
766,
685,
63,
69,
22564,
62,
324,
303,
14070,
0,
63,
60,
31,
5420,
3419,
198,
532,
4600,
37,
23330,
8439,
92,
63,
220,
220,
220,
30980,
28462,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2162,
766,
685,
63,
69,
22564,
62,
36151,
0,
63,
60,
31,
5420,
3419,
198,
532,
4600,
37,
23330,
26069,
92,
63,
220,
220,
220,
220,
1610,
2821,
274,
326,
1181,
3915,
2334,
26,
766,
685,
63,
69,
22564,
62,
26069,
11350,
0,
63,
60,
31,
5420,
3419,
198,
37811,
198,
31,
45145,
2163,
28462,
62,
77,
623,
733,
11350,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
28462,
3712,
42731,
11,
1181,
3712,
53,
945,
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,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
18074,
223,
796,
1181,
13,
33643,
198,
220,
18074,
223,
16340,
796,
352,
14,
33643,
198,
220,
18074,
223,
84,
796,
1181,
13,
33643,
84,
198,
220,
334,
796,
18074,
223,
16340,
1635,
18074,
223,
84,
628,
220,
1303,
512,
303,
14070,
2846,
198,
220,
28462,
13,
33643,
220,
220,
796,
18074,
223,
1635,
334,
198,
220,
28462,
13,
33643,
84,
220,
796,
18074,
223,
1635,
334,
764,
9,
334,
6,
198,
220,
28462,
13,
33643,
68,
220,
796,
334,
1635,
1181,
13,
33643,
68,
628,
220,
1303,
3833,
2846,
198,
220,
279,
796,
3833,
7,
76,
13,
5908,
396,
495,
11,
285,
13,
13989,
341,
11,
1181,
11,
27506,
8,
628,
220,
611,
285,
13,
5420,
62,
5219,
318,
64,
32116,
12708,
9012,
198,
220,
220,
220,
28462,
13,
33643,
84,
15853,
357,
79,
12,
14644,
13,
5420,
62,
5219,
13,
79,
27493,
40,
198,
220,
2073,
198,
220,
220,
220,
28462,
13,
33643,
84,
15853,
279,
9,
40,
198,
220,
886,
198,
220,
28462,
13,
33643,
68,
15853,
334,
9,
79,
198,
220,
28462,
62,
6335,
3920,
0,
7,
76,
13,
6335,
3920,
11,
285,
11,
28462,
11,
1181,
11,
27506,
11,
256,
8,
198,
220,
28462,
62,
5908,
396,
495,
0,
7,
76,
13,
5908,
396,
495,
11,
285,
11,
28462,
11,
1181,
11,
27506,
11,
256,
8,
198,
437,
198,
198,
8818,
3915,
25641,
2977,
0,
7,
265,
16785,
3712,
2953,
16785,
17633,
11,
6121,
3712,
53,
945,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
18074,
223,
16340,
796,
352,
14,
5219,
13,
33643,
198,
220,
6121,
13,
84,
796,
18074,
223,
16340,
1635,
1181,
13,
33643,
84,
198,
220,
6121,
13,
71,
62,
83,
313,
796,
2472,
62,
11423,
62,
34728,
9078,
7,
265,
16785,
13,
5908,
396,
495,
11,
379,
16785,
13,
13989,
341,
11,
1181,
11,
27506,
8,
628,
220,
3915,
25641,
2977,
0,
7,
265,
16785,
13,
5908,
396,
495,
11,
6121,
11,
1181,
11,
27506,
11,
256,
8,
198,
220,
3915,
25641,
2977,
0,
7,
265,
16785,
13,
83,
5945,
32401,
11,
6121,
11,
1181,
11,
27506,
11,
256,
8,
198,
437,
198,
198,
8818,
814,
11350,
0,
7,
265,
16785,
3712,
2953,
16785,
17633,
11,
814,
11350,
3712,
53,
945,
11,
18872,
229,
35636,
3712,
42731,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
814,
11350,
13,
24861,
229,
71,
62,
83,
313,
796,
18872,
229,
35636,
13,
71,
62,
83,
313,
628,
220,
1303,
44258,
2846,
2672,
329,
311,
14313,
47741,
2653,
602,
198,
220,
814,
11350,
0,
7,
265,
16785,
13,
83,
5945,
32401,
11,
379,
16785,
13,
13989,
341,
11,
814,
11350,
11,
18872,
229,
35636,
11,
1181,
11,
27506,
11,
256,
8,
198,
220,
1303,
814,
385,
3458,
286,
20160,
6805,
198,
220,
814,
11350,
0,
7,
265,
16785,
13,
5908,
396,
495,
11,
814,
11350,
11,
18872,
229,
35636,
11,
1181,
11,
27506,
11,
256,
8,
198,
437,
198,
198,
31,
45145,
2163,
28462,
62,
26069,
11350,
0,
7,
265,
16785,
3712,
2953,
16785,
17633,
11,
28462,
3712,
42731,
11,
1181,
3712,
53,
945,
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,
814,
11350,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
7377,
121,
11,
46651,
796,
47741,
62,
83,
641,
669,
7,
265,
16785,
13,
83,
5945,
32401,
11,
1181,
11,
814,
11350,
11,
27506,
11,
256,
8,
198,
220,
360,
62,
83,
796,
357,
26180,
318,
64,
6416,
5633,
7377,
121,
1058,
2566,
363,
7,
26180,
4008,
1635,
800,
62,
6836,
62,
83,
5945,
198,
220,
288,
62,
71,
62,
83,
313,
796,
532,
35,
62,
83,
764,
9,
814,
11350,
13,
24861,
229,
71,
62,
83,
313,
198,
220,
28462,
62,
26069,
11350,
0,
7,
265,
16785,
11,
28462,
11,
1181,
11,
46651,
11,
288,
62,
71,
62,
83,
313,
8,
198,
220,
28462,
62,
26069,
11350,
0,
7,
265,
16785,
13,
5908,
396,
495,
11,
28462,
11,
1181,
11,
814,
11350,
11,
27506,
11,
256,
11,
360,
62,
83,
8,
198,
437,
198,
198,
2,
51,
3727,
46,
25,
12642,
1771,
284,
407,
1208,
18074,
223,
290,
18074,
223,
84,
357,
1662,
1181,
828,
2133,
11843,
82,
3840,
198,
31,
45145,
2163,
28462,
62,
26069,
11350,
0,
7,
265,
16785,
3712,
2953,
16785,
17633,
11,
28462,
3712,
42731,
11,
1181,
3712,
53,
945,
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,
46651,
11,
288,
62,
71,
62,
83,
313,
8,
198,
220,
28462,
13,
33643,
84,
15853,
46651,
1635,
1181,
13,
33643,
198,
220,
28462,
13,
33643,
68,
15853,
46651,
1635,
1181,
13,
33643,
84,
198,
220,
28462,
13,
33643,
68,
15853,
288,
62,
71,
62,
83,
313,
1635,
1181,
13,
33643,
198,
437,
198,
198,
31,
45145,
2163,
9813,
39492,
7,
76,
3712,
2953,
16785,
17633,
11,
299,
44,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
18074,
223,
16340,
796,
352,
14,
5219,
13,
33643,
198,
220,
334,
796,
18074,
223,
16340,
1635,
1181,
13,
33643,
84,
198,
220,
1441,
2352,
7,
26518,
7,
77,
44,
11,
334,
4008,
1343,
2128,
12287,
7,
76,
13,
5908,
396,
495,
11,
285,
13,
13989,
341,
11,
1181,
11,
27506,
8,
198,
437,
628,
198,
8818,
4296,
62,
14644,
0,
7,
67,
70,
3712,
35,
38,
17633,
11,
285,
3712,
2953,
16785,
17633,
11,
1195,
3712,
7378,
40,
9012,
19182,
11,
256,
3712,
15633,
8,
198,
220,
19446,
796,
1288,
4906,
7,
48,
8,
198,
220,
27506,
5219,
796,
288,
70,
13,
14644,
5219,
628,
220,
611,
997,
62,
18908,
30691,
7,
76,
11,
19446,
8,
1875,
657,
198,
220,
220,
220,
35639,
62,
25558,
62,
18908,
1373,
0,
7,
67,
70,
11,
285,
11,
1195,
11,
27506,
5219,
11,
256,
8,
198,
220,
220,
220,
9575,
62,
521,
891,
9504,
62,
25558,
62,
18908,
1373,
0,
7,
67,
70,
11,
285,
11,
1195,
11,
27506,
5219,
11,
256,
8,
198,
220,
886,
628,
220,
18666,
282,
62,
19119,
62,
14644,
0,
7,
265,
16785,
62,
77,
375,
282,
62,
19119,
62,
14644,
28265,
288,
70,
11,
285,
11,
1195,
11,
256,
8,
628,
220,
1441,
2081,
198,
437,
198,
198,
8818,
379,
16785,
62,
77,
375,
282,
62,
19119,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
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,
256,
3712,
15633,
8,
198,
220,
379,
16785,
62,
77,
375,
282,
62,
19119,
62,
14644,
0,
7,
76,
13,
5908,
396,
495,
11,
285,
11,
1181,
11,
27506,
11,
256,
8,
198,
220,
379,
16785,
62,
77,
375,
282,
62,
19119,
62,
14644,
0,
7,
76,
13,
6335,
3920,
11,
285,
11,
1181,
11,
27506,
11,
256,
8,
198,
220,
379,
16785,
62,
77,
375,
282,
62,
19119,
62,
14644,
0,
7,
76,
13,
83,
5945,
32401,
11,
285,
11,
1181,
11,
27506,
11,
256,
8,
198,
437,
198,
198,
8818,
19287,
62,
2220,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
4132,
3712,
53,
945,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
8,
198,
220,
19287,
62,
2220,
62,
14644,
0,
7,
76,
13,
6335,
3920,
11,
4132,
11,
1181,
11,
27506,
8,
198,
437,
198,
198,
8818,
19287,
62,
2617,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
27506,
3712,
53,
945,
11,
4132,
3712,
53,
945,
8,
198,
220,
19287,
62,
2617,
62,
14644,
0,
7,
76,
13,
6335,
3920,
11,
27506,
11,
4132,
8,
198,
437,
198,
198,
8818,
9575,
62,
18908,
1373,
62,
2220,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
4132,
3712,
53,
945,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
8,
198,
220,
9575,
62,
18908,
1373,
62,
2220,
62,
14644,
0,
7,
76,
13,
6335,
3920,
11,
4132,
11,
1181,
11,
27506,
8,
198,
437,
198,
198,
8818,
9575,
62,
18908,
1373,
62,
2617,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
27506,
3712,
53,
945,
11,
4132,
3712,
53,
945,
8,
198,
220,
9575,
62,
18908,
1373,
62,
2617,
62,
14644,
0,
7,
76,
13,
6335,
3920,
11,
27506,
11,
4132,
8,
198,
437,
198,
198,
2,
16926,
46,
25,
3785,
503,
257,
3621,
835,
284,
5412,
428,
198,
8818,
2315,
62,
14644,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
27506,
3712,
53,
945,
11,
4903,
296,
3712,
14565,
10082,
15748,
8,
198,
220,
27506,
13,
37652,
796,
4903,
296,
13,
37652,
198,
220,
379,
16785,
62,
15003,
62,
14644,
0,
7,
76,
13,
13989,
341,
11,
285,
11,
27506,
11,
4903,
296,
8,
198,
220,
379,
16785,
62,
15003,
62,
14644,
0,
7,
76,
13,
5420,
62,
5219,
11,
285,
11,
27506,
11,
4903,
296,
8,
198,
220,
379,
16785,
62,
15003,
62,
14644,
0,
7,
76,
13,
83,
5945,
32401,
11,
285,
11,
27506,
11,
4903,
296,
8,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
2723,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
2723,
3712,
53,
945,
11,
1181,
3712,
53,
945,
11,
814,
11350,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
7293,
1769,
28462,
4600,
50,
7,
56,
8,
63,
287,
25,
198,
15506,
63,
198,
24861,
224,
56,
198,
438,
796,
532,
18872,
229,
5595,
376,
1343,
311,
7,
56,
8,
198,
24861,
224,
83,
198,
15506,
63,
198,
37811,
198,
8818,
2723,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
2723,
3712,
53,
945,
11,
1181,
3712,
53,
945,
11,
814,
11350,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
256,
3712,
15633,
8,
198,
220,
379,
16785,
62,
10459,
0,
7,
76,
13,
10459,
11,
285,
11,
2723,
11,
1181,
11,
814,
11350,
11,
27506,
11,
256,
8,
198,
437,
198,
198,
7784,
560,
62,
5219,
0,
7,
77,
69,
11,
285,
3712,
2953,
16785,
17633,
11,
2124,
23029,
796,
198,
220,
379,
16785,
62,
7784,
560,
62,
5219,
0,
7,
77,
69,
11,
285,
13,
7784,
560,
31448,
11,
285,
11,
2124,
23029,
198,
198,
8818,
2315,
62,
5219,
0,
7,
76,
3712,
2953,
16785,
17633,
11,
1181,
3712,
53,
945,
11,
27506,
3712,
53,
945,
11,
763,
3669,
11,
256,
11,
26498,
23029,
198,
220,
285,
13,
15003,
62,
5219,
7,
76,
11,
1181,
11,
27506,
11,
763,
3669,
11,
256,
11,
26498,
23029,
198,
437,
198,
198,
7784,
560,
62,
69,
22564,
62,
26069,
11350,
0,
7,
77,
69,
3712,
45,
6975,
605,
37,
22564,
28813,
11350,
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,
379,
16785,
3712,
2953,
16785,
17633,
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,
376,
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,
1181,
46256,
118,
11,
814,
46256,
118,
11,
27506,
46256,
118,
11,
299,
46256,
119,
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,
1181,
46256,
119,
11,
814,
46256,
119,
11,
27506,
46256,
119,
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,
275,
310,
2981,
11,
256,
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,
1181,
16,
46256,
119,
11,
814,
16,
46256,
119,
11,
27506,
16,
46256,
119,
8,
796,
198,
220,
379,
16785,
62,
7784,
560,
62,
69,
22564,
62,
26069,
11350,
0,
7,
77,
69,
11,
379,
16785,
13,
7784,
560,
31448,
11,
379,
16785,
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,
376,
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,
1181,
46256,
118,
11,
814,
46256,
118,
11,
27506,
46256,
118,
11,
299,
46256,
119,
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,
1181,
46256,
119,
11,
814,
46256,
119,
11,
27506,
46256,
119,
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,
275,
310,
2981,
11,
256,
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,
1181,
16,
46256,
119,
11,
814,
16,
46256,
119,
11,
27506,
16,
46256,
119,
8,
198,
198,
437,
1303,
8265,
198
] | 1.97395 | 6,142 |
using ApproxFun, LinearAlgebra, Test
import ApproxFun: Infinity, ∞
@testset "Helper" begin
@testset "interlace" begin
@test ApproxFun.interlace!([-1.0],0) == [-1.0]
@test ApproxFun.interlace!([1.0,2.0],0) == [2.0,1.0]
@test ApproxFun.interlace!([1,2,3],0) == [2,1,3]
@test ApproxFun.interlace!([1,2,3,4],0) == [3,1,4,2]
@test ApproxFun.interlace!([-1.0],1) == [-1.0]
@test ApproxFun.interlace!([1.0,2.0],1) == [1.0,2.0]
@test ApproxFun.interlace!([1,2,3],1) == [1,3,2]
@test ApproxFun.interlace!([1,2,3,4],1) == [1,3,2,4]
@test ApproxFun.interlace(collect(6:10),collect(1:5)) == ApproxFun.interlace!(collect(1:10),0)
@test ApproxFun.interlace(collect(1:5),collect(6:10)) == ApproxFun.interlace!(collect(1:10),1)
end
@testset "Iterators" begin
@test cache(ApproxFun.BlockInterlacer((1:∞,[2],[2])))[1:6] ==
[(1,1),(2,1),(2,2),(3,1),(3,2),(1,2)]
@test collect(ApproxFun.BlockInterlacer(([2],[2],[2]))) ==
[(1,1),(1,2),(2,1),(2,2),(3,1),(3,2)]
end
# TODO: Tensorizer tests
end
@testset "Domain" begin
@test 0.45-0.65im ∉ Segment(-1,1)
@test reverseorientation(Arc(1,2,(0.1,0.2))) == Arc(1,2,(0.2,0.1))
@test 0.1 ∈ PeriodicSegment(2π,0)
@test 100.0 ∈ PeriodicSegment(0,2π)
@test -100.0 ∈ PeriodicSegment(0,2π)
@test ApproxFun.AnySegment() == ApproxFun.AnySegment()
@test 10.0 ∈ PeriodicLine()
@test -10.0 ∈ PeriodicLine()
@test -10.0+im ∉ PeriodicLine()
@test ApproxFun.Vec(0,0.5) ∈ PeriodicSegment(ApproxFun.Vec(0.0,0), ApproxFun.Vec(0,1))
@test ApproxFun.dimension(Domain{Float64}) == 1
@test ApproxFun.dimension(Segment{Float64}) == 1
@test ApproxFun.dimension(ChebyshevInterval()) == 1
@test ApproxFun.dimension(ChebyshevInterval()^2) == 2
@test ApproxFun.dimension(ChebyshevInterval()^3) == 3
@test ApproxFun.Vec(1,0) ∈ Circle((0.,0.),1.)
@test isambiguous(convert(ApproxFun.Point,ApproxFun.AnyDomain()))
@test isambiguous(ApproxFun.Point(ApproxFun.AnyDomain()))
@test_skip ApproxFun.Point(NaN) == ApproxFun.Point(NaN)
end
@time include("MatrixTest.jl")
@time include("ClenshawTest.jl")
@time include("ChebyshevTest.jl")
@time include("FourierTest.jl")
@time include("ComplexTest.jl")
@time include("NumberTypeTest.jl")
@time include("broadcastingtest.jl")
@time include("OperatorTest.jl")
@time include("ODETest.jl")
@time include("VectorTest.jl")
@time include("SingularitiesTest.jl")
@time include("IntegralEquationsTest.jl")
@time include("SpacesTest.jl")
@time include("JacobiTest.jl")
@time include("LaguerreTest.jl")
@time include("HermiteTest.jl")
@time include("ETDRK4Test.jl")
@time include("MultivariateTest.jl")
@time include("PDETest.jl")
@time include("ExtrasTest.jl")
| [
3500,
2034,
13907,
24629,
11,
44800,
2348,
29230,
11,
6208,
198,
220,
220,
220,
1330,
2034,
13907,
24629,
25,
22385,
11,
18872,
252,
198,
198,
31,
9288,
2617,
366,
47429,
1,
2221,
198,
220,
220,
220,
2488,
9288,
2617,
366,
3849,
27077,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
12,
16,
13,
15,
4357,
15,
8,
6624,
25915,
16,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
13,
15,
11,
17,
13,
15,
4357,
15,
8,
6624,
685,
17,
13,
15,
11,
16,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
11,
17,
11,
18,
4357,
15,
8,
6624,
685,
17,
11,
16,
11,
18,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
11,
17,
11,
18,
11,
19,
4357,
15,
8,
6624,
685,
18,
11,
16,
11,
19,
11,
17,
60,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
12,
16,
13,
15,
4357,
16,
8,
6624,
25915,
16,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
13,
15,
11,
17,
13,
15,
4357,
16,
8,
6624,
685,
16,
13,
15,
11,
17,
13,
15,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
11,
17,
11,
18,
4357,
16,
8,
6624,
685,
16,
11,
18,
11,
17,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
0,
26933,
16,
11,
17,
11,
18,
11,
19,
4357,
16,
8,
6624,
685,
16,
11,
18,
11,
17,
11,
19,
60,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
7,
33327,
7,
21,
25,
940,
828,
33327,
7,
16,
25,
20,
4008,
6624,
2034,
13907,
24629,
13,
3849,
27077,
0,
7,
33327,
7,
16,
25,
940,
828,
15,
8,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
3849,
27077,
7,
33327,
7,
16,
25,
20,
828,
33327,
7,
21,
25,
940,
4008,
6624,
2034,
13907,
24629,
13,
3849,
27077,
0,
7,
33327,
7,
16,
25,
940,
828,
16,
8,
198,
220,
220,
220,
886,
628,
220,
220,
220,
2488,
9288,
2617,
366,
29993,
2024,
1,
2221,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
12940,
7,
4677,
13907,
24629,
13,
12235,
9492,
75,
11736,
19510,
16,
25,
24861,
252,
17414,
17,
38430,
17,
60,
22305,
58,
16,
25,
21,
60,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47527,
16,
11,
16,
828,
7,
17,
11,
16,
828,
7,
17,
11,
17,
828,
7,
18,
11,
16,
828,
7,
18,
11,
17,
828,
7,
16,
11,
17,
15437,
628,
220,
220,
220,
220,
220,
220,
220,
2488,
9288,
2824,
7,
4677,
13907,
24629,
13,
12235,
9492,
75,
11736,
19510,
58,
17,
38430,
17,
38430,
17,
60,
22305,
6624,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
47527,
16,
11,
16,
828,
7,
16,
11,
17,
828,
7,
17,
11,
16,
828,
7,
17,
11,
17,
828,
7,
18,
11,
16,
828,
7,
18,
11,
17,
15437,
198,
220,
220,
220,
886,
628,
220,
220,
220,
1303,
16926,
46,
25,
309,
22854,
7509,
5254,
198,
437,
198,
198,
31,
9288,
2617,
366,
43961,
1,
2221,
198,
220,
220,
220,
2488,
9288,
657,
13,
2231,
12,
15,
13,
2996,
320,
18872,
231,
1001,
5154,
32590,
16,
11,
16,
8,
628,
220,
220,
220,
2488,
9288,
9575,
13989,
341,
7,
24021,
7,
16,
11,
17,
11,
7,
15,
13,
16,
11,
15,
13,
17,
22305,
6624,
10173,
7,
16,
11,
17,
11,
7,
15,
13,
17,
11,
15,
13,
16,
4008,
198,
220,
220,
220,
2488,
9288,
657,
13,
16,
18872,
230,
18581,
291,
41030,
434,
7,
17,
46582,
11,
15,
8,
198,
220,
220,
220,
2488,
9288,
1802,
13,
15,
18872,
230,
18581,
291,
41030,
434,
7,
15,
11,
17,
46582,
8,
198,
220,
220,
220,
2488,
9288,
532,
3064,
13,
15,
18872,
230,
18581,
291,
41030,
434,
7,
15,
11,
17,
46582,
8,
628,
198,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
7149,
41030,
434,
3419,
6624,
2034,
13907,
24629,
13,
7149,
41030,
434,
3419,
628,
220,
220,
220,
2488,
9288,
838,
13,
15,
18872,
230,
18581,
291,
13949,
3419,
198,
220,
220,
220,
2488,
9288,
532,
940,
13,
15,
18872,
230,
18581,
291,
13949,
3419,
198,
220,
220,
220,
2488,
9288,
532,
940,
13,
15,
10,
320,
18872,
231,
18581,
291,
13949,
3419,
628,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
53,
721,
7,
15,
11,
15,
13,
20,
8,
18872,
230,
18581,
291,
41030,
434,
7,
4677,
13907,
24629,
13,
53,
721,
7,
15,
13,
15,
11,
15,
828,
2034,
13907,
24629,
13,
53,
721,
7,
15,
11,
16,
4008,
628,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
46156,
7,
43961,
90,
43879,
2414,
30072,
6624,
352,
198,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
46156,
7,
41030,
434,
90,
43879,
2414,
30072,
6624,
352,
198,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
46156,
7,
7376,
48209,
258,
85,
9492,
2100,
28955,
6624,
352,
198,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
46156,
7,
7376,
48209,
258,
85,
9492,
2100,
3419,
61,
17,
8,
6624,
362,
198,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
46156,
7,
7376,
48209,
258,
85,
9492,
2100,
3419,
61,
18,
8,
6624,
513,
628,
220,
220,
220,
2488,
9288,
2034,
13907,
24629,
13,
53,
721,
7,
16,
11,
15,
8,
18872,
230,
16291,
19510,
15,
1539,
15,
12179,
16,
2014,
628,
220,
220,
220,
2488,
9288,
318,
4131,
29709,
7,
1102,
1851,
7,
4677,
13907,
24629,
13,
12727,
11,
4677,
13907,
24629,
13,
7149,
43961,
3419,
4008,
198,
220,
220,
220,
2488,
9288,
318,
4131,
29709,
7,
4677,
13907,
24629,
13,
12727,
7,
4677,
13907,
24629,
13,
7149,
43961,
3419,
4008,
628,
220,
220,
220,
2488,
9288,
62,
48267,
2034,
13907,
24629,
13,
12727,
7,
26705,
45,
8,
6624,
2034,
13907,
24629,
13,
12727,
7,
26705,
45,
8,
198,
437,
198,
198,
31,
2435,
2291,
7203,
46912,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
2601,
641,
26615,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
7376,
48209,
258,
85,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
37,
280,
5277,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
5377,
11141,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
15057,
6030,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
36654,
19913,
9288,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
18843,
1352,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
3727,
2767,
395,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
38469,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
29974,
934,
871,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
34500,
1373,
23588,
602,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
4561,
2114,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
28821,
13411,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
43,
11433,
263,
260,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
48523,
578,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
2767,
7707,
42,
19,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
15205,
42524,
14402,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
5760,
2767,
395,
13,
20362,
4943,
198,
31,
2435,
2291,
7203,
11627,
8847,
14402,
13,
20362,
4943,
198
] | 2.15103 | 1,311 |
"""
CartInd(i1, i2, is...)
Represents a "scalar" index of a multidimensional associative (`Assoc`/`Arr`).
"""
struct CartInd{N, T <: NTuple{N,Any}}
inds::T
end
CartInd(inds::T) where {N, T <: NTuple{N, Any}} = CartInd{N, T}(inds)
CartInd{N}(inds::T) where {N, T <: NTuple{N, Any}} = CartInd{N, T}(inds)
CartInd(inds...) = CartInd(inds)
"""
CartProd(indices1, indices2, ...)
Represents the Cartesian product of the index sets `indices1`, `indices2`, ect. The elements
are `CartInd(first(indices1), first(indices2), ...)` and so-on.
"""
struct CartProd{N, I <: CartInd{N}, T <: CartInd{N}, Inds <: NTuple{N,Any}} <: Associative{I, T}
indices::Inds
end
# TODO constructors that `collect` on `KeyIterator`s and so-on?
# The indices of a Cartesian product are another Cartesian Product.
# e.g. if c = CartProd(([:a,:b,:c], 2:4)), then indices(c) = CartProd(OneTo(3), OneTo(3))
indices(c::CartProd) = CartProd(map(indices, c.indices))
IndexStyle(c::CartProd) = IndexDirect()
@propagate_inbounds function getindex(c::CartProd{N}, i::CartInd{N})
CartInd(map(getindex, c.indices, i.inds))
end
# Eventually this falls back to a Cartesian range
start(c::CartProd{N, NTuple{N, OneTo}}) = map(start, c.indices)
function next(c::CartProd{N}, inds::NTuple{N, Any})
end
done(c::CartProd{N}, inds::NTuple{N, Any}) = all(map(done, c.indices, i))
# TODO CartSlice - may be a mixture of ranges and scalars, dimensions following APL rules | [
37811,
198,
220,
220,
220,
13690,
5497,
7,
72,
16,
11,
1312,
17,
11,
318,
23029,
198,
198,
6207,
6629,
257,
366,
1416,
282,
283,
1,
6376,
286,
257,
1963,
312,
16198,
2570,
876,
357,
63,
8021,
420,
63,
14,
63,
3163,
81,
63,
737,
198,
37811,
198,
7249,
13690,
5497,
90,
45,
11,
309,
1279,
25,
24563,
29291,
90,
45,
11,
7149,
11709,
198,
220,
220,
220,
773,
82,
3712,
51,
198,
437,
198,
43476,
5497,
7,
521,
82,
3712,
51,
8,
810,
1391,
45,
11,
309,
1279,
25,
24563,
29291,
90,
45,
11,
4377,
11709,
796,
13690,
5497,
90,
45,
11,
309,
92,
7,
521,
82,
8,
198,
43476,
5497,
90,
45,
92,
7,
521,
82,
3712,
51,
8,
810,
1391,
45,
11,
309,
1279,
25,
24563,
29291,
90,
45,
11,
4377,
11709,
796,
13690,
5497,
90,
45,
11,
309,
92,
7,
521,
82,
8,
198,
43476,
5497,
7,
521,
82,
23029,
796,
13690,
5497,
7,
521,
82,
8,
198,
198,
37811,
198,
220,
220,
220,
13690,
2964,
67,
7,
521,
1063,
16,
11,
36525,
17,
11,
2644,
8,
198,
198,
6207,
6629,
262,
13690,
35610,
1720,
286,
262,
6376,
5621,
4600,
521,
1063,
16,
47671,
4600,
521,
1063,
17,
47671,
46080,
13,
383,
4847,
198,
533,
4600,
43476,
5497,
7,
11085,
7,
521,
1063,
16,
828,
717,
7,
521,
1063,
17,
828,
2644,
8,
63,
290,
523,
12,
261,
13,
198,
37811,
198,
7249,
13690,
2964,
67,
90,
45,
11,
314,
1279,
25,
13690,
5497,
90,
45,
5512,
309,
1279,
25,
13690,
5497,
90,
45,
5512,
1423,
82,
1279,
25,
24563,
29291,
90,
45,
11,
7149,
11709,
1279,
25,
3928,
876,
90,
40,
11,
309,
92,
198,
220,
220,
220,
36525,
3712,
5497,
82,
198,
437,
198,
2,
16926,
46,
5678,
669,
326,
4600,
33327,
63,
319,
4600,
9218,
37787,
63,
82,
290,
523,
12,
261,
30,
198,
198,
2,
383,
36525,
286,
257,
13690,
35610,
1720,
389,
1194,
13690,
35610,
8721,
13,
198,
2,
304,
13,
70,
13,
611,
269,
796,
13690,
2964,
67,
19510,
58,
25,
64,
11,
25,
65,
11,
25,
66,
4357,
362,
25,
19,
36911,
788,
36525,
7,
66,
8,
796,
13690,
2964,
67,
7,
3198,
2514,
7,
18,
828,
1881,
2514,
7,
18,
4008,
198,
521,
1063,
7,
66,
3712,
43476,
2964,
67,
8,
796,
13690,
2964,
67,
7,
8899,
7,
521,
1063,
11,
269,
13,
521,
1063,
4008,
198,
15732,
21466,
7,
66,
3712,
43476,
2964,
67,
8,
796,
12901,
13470,
3419,
198,
31,
22930,
37861,
62,
259,
65,
3733,
2163,
651,
9630,
7,
66,
3712,
43476,
2964,
67,
90,
45,
5512,
1312,
3712,
43476,
5497,
90,
45,
30072,
198,
220,
220,
220,
13690,
5497,
7,
8899,
7,
1136,
9630,
11,
269,
13,
521,
1063,
11,
1312,
13,
521,
82,
4008,
198,
437,
198,
198,
2,
16178,
428,
8953,
736,
284,
257,
13690,
35610,
2837,
198,
9688,
7,
66,
3712,
43476,
2964,
67,
90,
45,
11,
24563,
29291,
90,
45,
11,
1881,
2514,
11709,
8,
796,
3975,
7,
9688,
11,
269,
13,
521,
1063,
8,
198,
8818,
1306,
7,
66,
3712,
43476,
2964,
67,
90,
45,
5512,
773,
82,
3712,
11251,
29291,
90,
45,
11,
4377,
30072,
198,
198,
437,
198,
28060,
7,
66,
3712,
43476,
2964,
67,
90,
45,
5512,
773,
82,
3712,
11251,
29291,
90,
45,
11,
4377,
30072,
796,
477,
7,
8899,
7,
28060,
11,
269,
13,
521,
1063,
11,
1312,
4008,
628,
198,
198,
2,
16926,
46,
13690,
11122,
501,
532,
743,
307,
257,
11710,
286,
16069,
290,
16578,
945,
11,
15225,
1708,
3486,
43,
3173
] | 2.450847 | 590 |
type Subplots <: PlotWidget
widget::PyObject
plots::Vector{Plot}
n::Int
nrowsOverride::Int
ncolsOverride::Int
nrows::Int
ncols::Int
Subplots() = new(PLOT.SubplotWidget(), [], 0, 0, 0)
end
function updateGrid(sp::Subplots)
if sp.nrowsOverride == 0
if sp.ncolsOverride == 0
sp.nrows = round(Int, sqrt(sp.n))
sp.ncols = ceil(Int, sp.n / sp.nrows)
else
sp.ncols = sp.ncolsOverride
sp.nrows = ceil(Int, sp.n / sp.ncols)
end
else
sp.nrows = sp.nrowsOverride
sp.ncols = ceil(Int, sp.n / sp.nrows)
end
end
function getplot(sp::Subplots, c::Int)
while c > length(sp.plots)
push!(sp.plots, Plot())
sp.n += 1
updateGrid(sp)
end
sp.plots[c]
end
function refresh(sp::Subplots)
for plt in sp.plots
refresh(plt)
end
widgets = reshape([[plt.widget for plt in sp.plots] ; fill(nothing, sp.nrows*sp.ncols - sp.n)], sp.ncols, sp.nrows)'
sp.widget[:addFigures](widgets)
nothing
end
subplot(y; kvs...) = subplot(; y = y, kvs...)
subplot(x, y; kvs...) = subplot(; x = x, y = y, kvs...)
function subplot(; kvs...)
sp = Subplots()
resizewidget(sp, 800, 600)
moveToLastScreen(sp)
d = Dict(kvs)
sp.nrowsOverride = get(d, :nrows, 0)
sp.ncolsOverride = get(d, :ncols, 0)
if !((:show, false) in kvs)
push!(kvs, (:show, true))
end
oplot(sp; kvs...)
sp
end
| [
198,
198,
4906,
3834,
489,
1747,
1279,
25,
28114,
38300,
198,
220,
26295,
3712,
20519,
10267,
198,
220,
21528,
3712,
38469,
90,
43328,
92,
198,
220,
299,
3712,
5317,
198,
220,
299,
8516,
37961,
3712,
5317,
198,
220,
299,
4033,
82,
37961,
3712,
5317,
198,
220,
299,
8516,
3712,
5317,
198,
220,
299,
4033,
82,
3712,
5317,
628,
220,
3834,
489,
1747,
3419,
796,
649,
7,
6489,
2394,
13,
7004,
29487,
38300,
22784,
685,
4357,
657,
11,
657,
11,
657,
8,
198,
437,
198,
198,
8818,
4296,
41339,
7,
2777,
3712,
7004,
489,
1747,
8,
198,
220,
611,
599,
13,
77,
8516,
37961,
6624,
657,
198,
220,
220,
220,
611,
599,
13,
77,
4033,
82,
37961,
6624,
657,
198,
220,
220,
220,
220,
220,
599,
13,
77,
8516,
796,
2835,
7,
5317,
11,
19862,
17034,
7,
2777,
13,
77,
4008,
198,
220,
220,
220,
220,
220,
599,
13,
77,
4033,
82,
796,
2906,
346,
7,
5317,
11,
599,
13,
77,
1220,
599,
13,
77,
8516,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
599,
13,
77,
4033,
82,
796,
599,
13,
77,
4033,
82,
37961,
198,
220,
220,
220,
220,
220,
599,
13,
77,
8516,
796,
2906,
346,
7,
5317,
11,
599,
13,
77,
1220,
599,
13,
77,
4033,
82,
8,
198,
220,
220,
220,
886,
198,
220,
2073,
198,
220,
220,
220,
599,
13,
77,
8516,
796,
599,
13,
77,
8516,
37961,
198,
220,
220,
220,
599,
13,
77,
4033,
82,
796,
2906,
346,
7,
5317,
11,
599,
13,
77,
1220,
599,
13,
77,
8516,
8,
198,
220,
886,
198,
437,
198,
198,
8818,
651,
29487,
7,
2777,
3712,
7004,
489,
1747,
11,
269,
3712,
5317,
8,
198,
220,
981,
269,
1875,
4129,
7,
2777,
13,
489,
1747,
8,
198,
220,
220,
220,
4574,
0,
7,
2777,
13,
489,
1747,
11,
28114,
28955,
198,
220,
220,
220,
599,
13,
77,
15853,
352,
198,
220,
220,
220,
4296,
41339,
7,
2777,
8,
198,
220,
886,
198,
220,
599,
13,
489,
1747,
58,
66,
60,
198,
437,
628,
198,
8818,
14976,
7,
2777,
3712,
7004,
489,
1747,
8,
198,
220,
329,
458,
83,
287,
599,
13,
489,
1747,
198,
220,
220,
220,
14976,
7,
489,
83,
8,
198,
220,
886,
198,
220,
40803,
796,
27179,
1758,
26933,
58,
489,
83,
13,
42655,
329,
458,
83,
287,
599,
13,
489,
1747,
60,
2162,
6070,
7,
22366,
11,
599,
13,
77,
8516,
9,
2777,
13,
77,
4033,
82,
532,
599,
13,
77,
8,
4357,
599,
13,
77,
4033,
82,
11,
599,
13,
77,
8516,
33047,
198,
220,
599,
13,
42655,
58,
25,
2860,
14989,
942,
16151,
28029,
11407,
8,
198,
220,
2147,
198,
437,
628,
198,
7266,
29487,
7,
88,
26,
479,
14259,
23029,
796,
850,
29487,
7,
26,
331,
796,
331,
11,
479,
14259,
23029,
198,
7266,
29487,
7,
87,
11,
331,
26,
479,
14259,
23029,
796,
850,
29487,
7,
26,
2124,
796,
2124,
11,
331,
796,
331,
11,
479,
14259,
23029,
198,
198,
8818,
850,
29487,
7,
26,
479,
14259,
23029,
198,
220,
599,
796,
3834,
489,
1747,
3419,
198,
220,
581,
528,
413,
17484,
7,
2777,
11,
10460,
11,
10053,
8,
198,
220,
1445,
2514,
5956,
23901,
7,
2777,
8,
198,
220,
220,
198,
220,
288,
796,
360,
713,
7,
74,
14259,
8,
198,
220,
599,
13,
77,
8516,
37961,
796,
651,
7,
67,
11,
1058,
77,
8516,
11,
657,
8,
198,
220,
599,
13,
77,
4033,
82,
37961,
796,
651,
7,
67,
11,
1058,
77,
4033,
82,
11,
657,
8,
628,
220,
611,
5145,
19510,
25,
12860,
11,
3991,
8,
287,
479,
14259,
8,
198,
220,
220,
220,
4574,
0,
7,
74,
14259,
11,
357,
25,
12860,
11,
2081,
4008,
198,
220,
886,
628,
220,
267,
29487,
7,
2777,
26,
479,
14259,
23029,
198,
220,
599,
198,
437,
198
] | 2.149842 | 634 |
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.
mutable struct VirtualMachineScaleSetVMNetworkProfileConfiguration <: SwaggerModel
networkInterfaceConfigurations::Any # spec type: Union{ Nothing, Vector{VirtualMachineScaleSetNetworkConfiguration} } # spec name: networkInterfaceConfigurations
function VirtualMachineScaleSetVMNetworkProfileConfiguration(;networkInterfaceConfigurations=nothing)
o = new()
validate_property(VirtualMachineScaleSetVMNetworkProfileConfiguration, Symbol("networkInterfaceConfigurations"), networkInterfaceConfigurations)
setfield!(o, Symbol("networkInterfaceConfigurations"), networkInterfaceConfigurations)
o
end
end # type VirtualMachineScaleSetVMNetworkProfileConfiguration
const _property_map_VirtualMachineScaleSetVMNetworkProfileConfiguration = Dict{Symbol,Symbol}(Symbol("networkInterfaceConfigurations")=>Symbol("networkInterfaceConfigurations"))
const _property_types_VirtualMachineScaleSetVMNetworkProfileConfiguration = Dict{Symbol,String}(Symbol("networkInterfaceConfigurations")=>"Vector{VirtualMachineScaleSetNetworkConfiguration}")
Base.propertynames(::Type{ VirtualMachineScaleSetVMNetworkProfileConfiguration }) = collect(keys(_property_map_VirtualMachineScaleSetVMNetworkProfileConfiguration))
Swagger.property_type(::Type{ VirtualMachineScaleSetVMNetworkProfileConfiguration }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_VirtualMachineScaleSetVMNetworkProfileConfiguration[name]))}
Swagger.field_name(::Type{ VirtualMachineScaleSetVMNetworkProfileConfiguration }, property_name::Symbol) = _property_map_VirtualMachineScaleSetVMNetworkProfileConfiguration[property_name]
function check_required(o::VirtualMachineScaleSetVMNetworkProfileConfiguration)
true
end
function validate_property(::Type{ VirtualMachineScaleSetVMNetworkProfileConfiguration }, name::Symbol, val)
end
| [
2,
770,
2393,
373,
7560,
416,
262,
22300,
2451,
7928,
6127,
35986,
198,
2,
2141,
407,
13096,
428,
2393,
3264,
13,
3401,
1958,
262,
1509,
7928,
20855,
2427,
13,
628,
198,
76,
18187,
2878,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
1279,
25,
2451,
7928,
17633,
198,
220,
220,
220,
3127,
39317,
16934,
20074,
3712,
7149,
1303,
1020,
2099,
25,
4479,
90,
10528,
11,
20650,
90,
37725,
37573,
29990,
7248,
26245,
38149,
92,
1782,
1303,
1020,
1438,
25,
3127,
39317,
16934,
20074,
628,
220,
220,
220,
2163,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
7,
26,
27349,
39317,
16934,
20074,
28,
22366,
8,
198,
220,
220,
220,
220,
220,
220,
220,
267,
796,
649,
3419,
198,
220,
220,
220,
220,
220,
220,
220,
26571,
62,
26745,
7,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
11,
38357,
7203,
27349,
39317,
16934,
20074,
12340,
3127,
39317,
16934,
20074,
8,
198,
220,
220,
220,
220,
220,
220,
220,
900,
3245,
0,
7,
78,
11,
38357,
7203,
27349,
39317,
16934,
20074,
12340,
3127,
39317,
16934,
20074,
8,
198,
220,
220,
220,
220,
220,
220,
220,
267,
198,
220,
220,
220,
886,
198,
437,
1303,
2099,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
198,
198,
9979,
4808,
26745,
62,
8899,
62,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
796,
360,
713,
90,
13940,
23650,
11,
13940,
23650,
92,
7,
13940,
23650,
7203,
27349,
39317,
16934,
20074,
4943,
14804,
13940,
23650,
7203,
27349,
39317,
16934,
20074,
48774,
198,
9979,
4808,
26745,
62,
19199,
62,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
796,
360,
713,
90,
13940,
23650,
11,
10100,
92,
7,
13940,
23650,
7203,
27349,
39317,
16934,
20074,
4943,
14804,
1,
38469,
90,
37725,
37573,
29990,
7248,
26245,
38149,
92,
4943,
198,
14881,
13,
26745,
14933,
7,
3712,
6030,
90,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
32092,
796,
2824,
7,
13083,
28264,
26745,
62,
8899,
62,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
4008,
198,
10462,
7928,
13,
26745,
62,
4906,
7,
3712,
6030,
90,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
8964,
1438,
3712,
13940,
23650,
8,
796,
4479,
90,
18465,
11,
18206,
7,
14881,
13,
48526,
13,
29572,
28264,
26745,
62,
19199,
62,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
58,
3672,
60,
4008,
92,
198,
10462,
7928,
13,
3245,
62,
3672,
7,
3712,
6030,
90,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
8964,
3119,
62,
3672,
3712,
13940,
23650,
8,
796,
220,
4808,
26745,
62,
8899,
62,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
58,
26745,
62,
3672,
60,
198,
198,
8818,
2198,
62,
35827,
7,
78,
3712,
37725,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
8,
198,
220,
220,
220,
2081,
198,
437,
198,
198,
8818,
26571,
62,
26745,
7,
3712,
6030,
90,
15595,
37573,
29990,
7248,
15996,
26245,
37046,
38149,
8964,
1438,
3712,
13940,
23650,
11,
1188,
8,
198,
437,
198
] | 4.122153 | 483 |
import Base.+, Base.-, Base./, Base.*, Base.^
import SchumakerSpline.evaluate
function evaluate(f::Undefined_Function, point::Union{Real,Date,DateTime,DatePeriod})
missing
end
function (s::Undefined_Function)(x::Union{Real,Date,DateTime,DatePeriod})
return missing
end
"""
derivative(f::UnivariateFunction)
This calculates the derivative of the function and returns it as a `UnivariateFunction`.
### Inputs
* `f` - A `UnivariateFunction`.
### Returns
* A `UnivariateFunction`.
"""
function derivative(f::Undefined_Function)
return f
end
"""
indefinite_integral(f::UnivariateFunction)
This calculates the indefinite integral of a `UnivariateFunction`.
### Inputs
* `f` - A `UnivariateFunction`.
### Returns
* A `UnivariateFunction`.
"""
function indefinite_integral(f::Undefined_Function)
return f
end
function +(f::Undefined_Function, number::Real)
return f
end
function -(f::Undefined_Function, number::Real)
return f
end
function *(f::Undefined_Function, number::Real)
return f
end
function /(f::Undefined_Function, number::Real)
return f
end
function ^(f::Undefined_Function, number::Integer)
return f
end
function +(f1::Undefined_Function, f2::Undefined_Function)
return f1
end
function +(f1::Undefined_Function, f2::PE_Function)
return f1
end
function +(f1::Undefined_Function, f2::Sum_Of_Functions)
return f1
end
function +(f1::Undefined_Function, f2::Piecewise_Function)
return f1
end
function +(f1::PE_Function, f2::Undefined_Function)
return +(f2,f1)
end
function +(f1::Sum_Of_Functions, f2::Undefined_Function)
return +(f2,f1)
end
function +(f1::Piecewise_Function, f2::Undefined_Function)
return +(f2,f1)
end
function -(f1::Undefined_Function, f2::Undefined_Function)
return f1
end
function -(f1::Undefined_Function, f2::PE_Function)
return f1
end
function -(f1::Undefined_Function, f2::Sum_Of_Functions)
return f1
end
function -(f1::Undefined_Function, f2::Piecewise_Function)
return f1
end
function -(f1::PE_Function, f2::Undefined_Function)
return -(f2,f1)
end
function -(f1::Sum_Of_Functions, f2::Undefined_Function)
return -(f2,f1)
end
function -(f1::Piecewise_Function, f2::Undefined_Function)
return -(f2,f1)
end
function *(f1::Undefined_Function, f2::Undefined_Function)
return f1
end
function *(f1::Undefined_Function, f2::PE_Function)
return f1
end
function *(f1::Undefined_Function, f2::Sum_Of_Functions)
return f1
end
function *(f1::Undefined_Function, f2::Piecewise_Function)
return f1
end
function *(f1::PE_Function, f2::Undefined_Function)
return *(f2,f1)
end
function *(f1::Sum_Of_Functions, f2::Undefined_Function)
return *(f2,f1)
end
function *(f1::Piecewise_Function, f2::Undefined_Function)
return *(f2,f1)
end
function /(f1::Undefined_Function, f2::Undefined_Function)
return f1
end
function /(f1::Undefined_Function, f2::PE_Function)
return f1
end
function /(f1::Undefined_Function, f2::Sum_Of_Functions)
return f1
end
function /(f1::Undefined_Function, f2::Piecewise_Function)
return f1
end
function /(f1::PE_Function, f2::Undefined_Function)
return /(f2,f1)
end
function /(f1::Sum_Of_Functions, f2::Undefined_Function)
return /(f2,f1)
end
function /(f1::Piecewise_Function, f2::Undefined_Function)
return /(f2,f1)
end
| [
11748,
7308,
13,
28200,
7308,
7874,
11,
7308,
19571,
11,
7308,
15885,
11,
7308,
13,
61,
198,
11748,
3059,
388,
3110,
26568,
500,
13,
49786,
198,
8818,
13446,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
966,
3712,
38176,
90,
15633,
11,
10430,
11,
10430,
7575,
11,
10430,
5990,
2101,
30072,
198,
220,
220,
220,
4814,
198,
437,
198,
8818,
357,
82,
3712,
31319,
18156,
62,
22203,
5769,
87,
3712,
38176,
90,
15633,
11,
10430,
11,
10430,
7575,
11,
10430,
5990,
2101,
30072,
198,
220,
220,
220,
1441,
4814,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
27255,
7,
69,
3712,
3118,
42524,
22203,
8,
198,
1212,
43707,
262,
27255,
286,
262,
2163,
290,
5860,
340,
355,
257,
4600,
3118,
42524,
22203,
44646,
198,
198,
21017,
23412,
82,
198,
9,
4600,
69,
63,
532,
317,
4600,
3118,
42524,
22203,
44646,
198,
21017,
16409,
198,
9,
317,
4600,
3118,
42524,
22203,
44646,
198,
37811,
198,
8818,
27255,
7,
69,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
35639,
62,
18908,
1373,
7,
69,
3712,
3118,
42524,
22203,
8,
198,
1212,
43707,
262,
35639,
19287,
286,
257,
4600,
3118,
42524,
22203,
44646,
198,
198,
21017,
23412,
82,
198,
9,
4600,
69,
63,
532,
317,
4600,
3118,
42524,
22203,
44646,
198,
21017,
16409,
198,
9,
317,
4600,
3118,
42524,
22203,
44646,
198,
37811,
198,
8818,
35639,
62,
18908,
1373,
7,
69,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
198,
8818,
1343,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
1271,
3712,
15633,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
8818,
532,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
1271,
3712,
15633,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
8818,
1635,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
1271,
3712,
15633,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
8818,
1220,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
1271,
3712,
15633,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
8818,
10563,
7,
69,
3712,
31319,
18156,
62,
22203,
11,
1271,
3712,
46541,
8,
198,
220,
220,
220,
1441,
277,
198,
437,
198,
198,
8818,
1343,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1343,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
11401,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1343,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
13065,
62,
5189,
62,
24629,
2733,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1343,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
47,
8535,
3083,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
198,
8818,
1343,
7,
69,
16,
3712,
11401,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1343,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1343,
7,
69,
16,
3712,
13065,
62,
5189,
62,
24629,
2733,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1343,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1343,
7,
69,
16,
3712,
47,
8535,
3083,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1343,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
198,
8818,
532,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
532,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
11401,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
532,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
13065,
62,
5189,
62,
24629,
2733,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
532,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
47,
8535,
3083,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
198,
8818,
532,
7,
69,
16,
3712,
11401,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
532,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
532,
7,
69,
16,
3712,
13065,
62,
5189,
62,
24629,
2733,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
532,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
532,
7,
69,
16,
3712,
47,
8535,
3083,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
532,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
198,
8818,
1635,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1635,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
11401,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1635,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
13065,
62,
5189,
62,
24629,
2733,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1635,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
47,
8535,
3083,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
198,
8818,
1635,
7,
69,
16,
3712,
11401,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1635,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1635,
7,
69,
16,
3712,
13065,
62,
5189,
62,
24629,
2733,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1635,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1635,
7,
69,
16,
3712,
47,
8535,
3083,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1635,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
198,
8818,
1220,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1220,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
11401,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1220,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
13065,
62,
5189,
62,
24629,
2733,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
8818,
1220,
7,
69,
16,
3712,
31319,
18156,
62,
22203,
11,
277,
17,
3712,
47,
8535,
3083,
62,
22203,
8,
198,
220,
220,
220,
1441,
277,
16,
198,
437,
198,
198,
8818,
1220,
7,
69,
16,
3712,
11401,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1220,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1220,
7,
69,
16,
3712,
13065,
62,
5189,
62,
24629,
2733,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1220,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198,
8818,
1220,
7,
69,
16,
3712,
47,
8535,
3083,
62,
22203,
11,
277,
17,
3712,
31319,
18156,
62,
22203,
8,
198,
220,
220,
220,
1441,
1220,
7,
69,
17,
11,
69,
16,
8,
198,
437,
198
] | 2.593286 | 1,281 |
__precompile__(true)
module cNODE
# libraries
using Distributed
using Flux
using Flux.Optimise: update!, apply!
using DiffEqFlux
using Zygote: gradient
using MLDataPattern: eachbatch, splitobs, shuffleobs
using DifferentialEquations: ODEProblem, solve, Tsit5
using Distributions: Normal, Uniform
using Statistics, LinearAlgebra
using SparseArrays, SharedArrays
using DelimitedFiles
# functions
include("./module/generator.jl")
export getParameters, getIC, getGLV
export getSteadyState, getRewiredNetwork
export generate_data
include("./module/trainer.jl")
export FitnessLayer
export getModel
export predict
export loss
export train_reptile
include("./module/loader.jl")
export import_data
export split_data
# Parameters for module
const synthetic_data = ["Strength","Connectivity","Universality","Noise","Rewiring"]
const real_data = ["Drosophila_Gut","Soil_Vitro","Soil_Vivo","Human_Gut","Human_Oral","Ocean"]
const S = [.1,.15,.2]
const C = [0.5,0.75,1]
const U = [0.1,1,2]
const E = [.001,.01,.025]
const R = [.01,.1,.25]
export synthetic_data, real_data
export S, C, U, E, R
end
| [
834,
3866,
5589,
576,
834,
7,
7942,
8,
198,
21412,
269,
45,
16820,
628,
220,
220,
220,
1303,
12782,
198,
220,
220,
220,
1262,
4307,
6169,
198,
220,
220,
220,
1262,
1610,
2821,
198,
220,
220,
220,
1262,
1610,
2821,
13,
27871,
320,
786,
25,
4296,
28265,
4174,
0,
198,
220,
220,
220,
1262,
10631,
36,
80,
37,
22564,
198,
220,
220,
220,
1262,
1168,
35641,
1258,
25,
31312,
198,
220,
220,
220,
1262,
10373,
6601,
47546,
25,
1123,
43501,
11,
6626,
8158,
11,
36273,
8158,
198,
220,
220,
220,
1262,
20615,
498,
23588,
602,
25,
440,
7206,
40781,
11,
8494,
11,
13146,
270,
20,
198,
220,
220,
220,
1262,
46567,
507,
25,
14435,
11,
35712,
198,
220,
220,
220,
1262,
14370,
11,
44800,
2348,
29230,
198,
220,
220,
220,
1262,
1338,
17208,
3163,
20477,
11,
39403,
3163,
20477,
198,
220,
220,
220,
1262,
4216,
320,
863,
25876,
628,
220,
220,
220,
1303,
5499,
198,
220,
220,
220,
2291,
7,
1911,
14,
21412,
14,
8612,
1352,
13,
20362,
4943,
198,
220,
220,
220,
10784,
651,
48944,
11,
651,
2149,
11,
651,
8763,
53,
198,
220,
220,
220,
10784,
651,
7447,
4597,
9012,
11,
651,
30003,
1202,
26245,
198,
220,
220,
220,
10784,
7716,
62,
7890,
628,
220,
220,
220,
2291,
7,
1911,
14,
21412,
14,
2213,
10613,
13,
20362,
4943,
198,
220,
220,
220,
10784,
34545,
49925,
198,
220,
220,
220,
10784,
651,
17633,
198,
220,
220,
220,
10784,
4331,
198,
220,
220,
220,
10784,
2994,
198,
220,
220,
220,
10784,
4512,
62,
260,
457,
576,
628,
220,
220,
220,
2291,
7,
1911,
14,
21412,
14,
29356,
13,
20362,
4943,
198,
220,
220,
220,
10784,
1330,
62,
7890,
198,
220,
220,
220,
10784,
6626,
62,
7890,
628,
220,
220,
220,
1303,
40117,
329,
8265,
198,
220,
220,
220,
1500,
18512,
62,
7890,
796,
14631,
45027,
2430,
13313,
3458,
2430,
3118,
1191,
1483,
2430,
2949,
786,
2430,
30003,
3428,
8973,
198,
220,
220,
220,
1500,
1103,
62,
7890,
796,
14631,
35,
4951,
2522,
10102,
62,
38,
315,
2430,
2396,
346,
62,
53,
270,
305,
2430,
2396,
346,
62,
53,
23593,
2430,
20490,
62,
38,
315,
2430,
20490,
62,
46,
1373,
2430,
46607,
8973,
198,
220,
220,
220,
1500,
311,
796,
685,
13,
16,
38508,
1314,
38508,
17,
60,
198,
220,
220,
220,
1500,
327,
796,
685,
15,
13,
20,
11,
15,
13,
2425,
11,
16,
60,
198,
220,
220,
220,
1500,
471,
796,
685,
15,
13,
16,
11,
16,
11,
17,
60,
198,
220,
220,
220,
1500,
412,
796,
685,
13,
8298,
38508,
486,
38508,
36629,
60,
198,
220,
220,
220,
1500,
371,
796,
685,
13,
486,
38508,
16,
38508,
1495,
60,
198,
220,
220,
220,
10784,
18512,
62,
7890,
11,
1103,
62,
7890,
198,
220,
220,
220,
10784,
311,
11,
327,
11,
471,
11,
412,
11,
371,
198,
198,
437,
198
] | 2.617834 | 471 |
function survive(blood_type, donated_blood)
# Your code goes here!
return true
end
| [
8818,
7866,
7,
18041,
62,
4906,
11,
15863,
62,
18041,
8,
198,
220,
220,
220,
1303,
3406,
2438,
2925,
994,
0,
198,
220,
220,
220,
1441,
2081,
198,
437,
198
] | 3.033333 | 30 |
function metapop()
# make metapopulation
mp = ZTMetaPopulation{LanguageDynamics.MomentumSelector}(7, 2.5)
# add speakers
for i = 1:200
inject!(LanguageDynamics.MomentumSelector(0.01, 0.02, 1.0, 4, 0.1), mp)
end
# Travel + rendezvous
while mp.nactions < 0.5*200*100#_000
travel!(mp)
rendezvous!(mp)
end
end
| [
8818,
1138,
499,
404,
3419,
198,
220,
1303,
787,
1138,
499,
404,
1741,
198,
220,
29034,
796,
1168,
51,
48526,
45251,
90,
32065,
35,
4989,
873,
13,
29252,
298,
388,
17563,
273,
92,
7,
22,
11,
362,
13,
20,
8,
628,
220,
1303,
751,
11636,
198,
220,
329,
1312,
796,
352,
25,
2167,
198,
220,
220,
220,
8677,
0,
7,
32065,
35,
4989,
873,
13,
29252,
298,
388,
17563,
273,
7,
15,
13,
486,
11,
657,
13,
2999,
11,
352,
13,
15,
11,
604,
11,
657,
13,
16,
828,
29034,
8,
198,
220,
886,
628,
220,
1303,
13524,
1343,
9851,
50063,
198,
220,
981,
29034,
13,
77,
4658,
1279,
657,
13,
20,
9,
2167,
9,
3064,
2,
62,
830,
198,
220,
220,
220,
3067,
0,
7,
3149,
8,
198,
220,
220,
220,
9851,
50063,
0,
7,
3149,
8,
198,
220,
886,
198,
437,
198
] | 2.333333 | 144 |
using MAVs, NLOptControl, BenchmarkTools, JLD, FileIO, DataFrames
#'''
#This function creates the benchmark tests
#'''
function bench(;baseBench::Bool=false)
if baseBench
name="master.jld"
else
name="pr.jld"
master=load("master.jld", "results")
m1=median(master["psMethods"])
end
# create a DataFrame
fname = joinpath(dirname(@__FILE__), "data.jld")
df = DataFrames.DataFrame()
# Define a parent BenchmarkGroup to contain our suite
const suite = BenchmarkGroup()
# Add some child groups to our benchmark suite.
suite["psMethods"] = BenchmarkGroup(["integrationScheme","Nck"])
for scheme in (:lgrExplicit,:lgrImplicit)
for Nck in ([10,8,6],[12,10,8,6])
c=defineCase(;(:mode=>:autoBench));
setMisc!(c;integrationScheme=scheme,Nck=Nck,max_cpu_time=20.0)
n=initializeAutonomousControl(c);
suite["psMethods"][scheme,Nck] = @benchmarkable optimize!($n) samples=10
end
end
paramspath = joinpath(dirname(@__FILE__), "params.jld")
if isfile(paramspath)
loadparams!(suite, BenchmarkTools.load(paramspath, "suite"), :evals);
else
tune!(suite)
BenchmarkTools.save(paramspath, "suite", params(suite));
end
results=run(suite,verbose=true); # run all benchmarks
BenchmarkTools.save(name, "results", results) # save results to JLD file
m2=median(results["psMethods"]);
# save the data
file = jldopen(fname, "w")
write(file, "df", df)
close(file)
if !baseBench
return m2, judge(m2,m1)
else
return m2
end
end
paramspath = joinpath(Pkg.dir("MAVs/examples/Benchmarks/"), "params.jld")
loadparams!(suite, BenchmarkTools.load(paramspath, "suite"), :evals);
master=load("master.jld", "results")
###########
file = joinpath(Pkg.dir("MAVs/examples/Benchmarks/"), "temp.jld")
res=master;
writeresults(file,res)
#https://github.com/JuliaCI/PkgBenchmark.jl/blob/master/src/runbenchmark.jl
function writeresults(file, res)
save(File(format"JLD", file), "time", time(), "trials", res)
end
#https://github.com/JuliaCI/PkgBenchmark.jl/blob/master/src/runbenchmark.jl
function readresults(file)
JLD.jldopen(file,"r") do f
read(f, "trials")
end
end
#=
if saveresults
tosave = if promptsave
print("File results of this run? (commit=$(sha[1:6]), resultsdir=$resultsdir) (Y/n) ")
response = readline() |> strip
response == "" || lowercase(response) == "y"
else true end
if tosave
!isdir(resultsdir) && mkpath(resultsdir)
resfile = joinpath(resultsdir, sha*".jld")
writeresults(resfile, res)
info("Results of the benchmark were written to $resfile")
end
=#
#=
m=median(run(suite,verbose=true,seconds=10));
save("m2.jld","m",params(m));
# compare
tempDict=load("m1.jld")
m_temp=get(tempDict,"m1",0)
judge(m_temp,m)
##################OLD
#'''
# schemes=[:lgrExplicit,:lgrImplicit]
# m1=benchMark(schemes[1])
# m2=benchMark(schemes[2])
# judge(m1,m2)
#'''
function benchMark(scheme)
c=defineCase(;(:mode=>:autoBench));
setMisc!(c;integrationScheme=scheme)
n=initializeAutonomousControl(c);
b=@benchmark optimize!($n) samples=10
return median(b)
end
=#
| [
3500,
8779,
23266,
11,
399,
21982,
457,
15988,
11,
25187,
4102,
33637,
11,
449,
11163,
11,
9220,
9399,
11,
6060,
35439,
198,
198,
2,
7061,
6,
198,
2,
1212,
2163,
8075,
262,
18335,
5254,
198,
2,
7061,
6,
198,
8818,
7624,
7,
26,
8692,
44199,
3712,
33,
970,
28,
9562,
8,
198,
220,
611,
2779,
44199,
198,
220,
220,
220,
1438,
2625,
9866,
13,
73,
335,
1,
198,
220,
2073,
198,
220,
220,
220,
1438,
2625,
1050,
13,
73,
335,
1,
198,
220,
220,
220,
4958,
28,
2220,
7203,
9866,
13,
73,
335,
1600,
366,
43420,
4943,
198,
220,
220,
220,
285,
16,
28,
1150,
666,
7,
9866,
14692,
862,
46202,
8973,
8,
198,
220,
886,
198,
220,
1303,
2251,
257,
6060,
19778,
198,
220,
277,
3672,
796,
4654,
6978,
7,
15908,
3672,
7,
31,
834,
25664,
834,
828,
366,
7890,
13,
73,
335,
4943,
198,
220,
47764,
796,
6060,
35439,
13,
6601,
19778,
3419,
628,
220,
1303,
2896,
500,
257,
2560,
25187,
4102,
13247,
284,
3994,
674,
18389,
198,
220,
1500,
18389,
796,
25187,
4102,
13247,
3419,
628,
220,
1303,
3060,
617,
1200,
2628,
284,
674,
18335,
18389,
13,
198,
220,
18389,
14692,
862,
46202,
8973,
796,
25187,
4102,
13247,
7,
14692,
18908,
1358,
27054,
1326,
2430,
45,
694,
8973,
8,
198,
220,
329,
7791,
287,
357,
25,
75,
2164,
18438,
3628,
11,
25,
75,
2164,
29710,
3628,
8,
198,
220,
220,
220,
329,
399,
694,
287,
29565,
940,
11,
23,
11,
21,
38430,
1065,
11,
940,
11,
23,
11,
21,
12962,
198,
220,
220,
220,
220,
220,
269,
28,
13086,
20448,
7,
26,
7,
25,
14171,
14804,
25,
23736,
44199,
18125,
198,
220,
220,
220,
220,
220,
900,
44,
2304,
0,
7,
66,
26,
18908,
1358,
27054,
1326,
28,
15952,
1326,
11,
45,
694,
28,
45,
694,
11,
9806,
62,
36166,
62,
2435,
28,
1238,
13,
15,
8,
198,
220,
220,
220,
220,
220,
299,
28,
36733,
1096,
16541,
38175,
15988,
7,
66,
1776,
198,
220,
220,
220,
220,
220,
18389,
14692,
862,
46202,
1,
7131,
15952,
1326,
11,
45,
694,
60,
796,
2488,
26968,
4102,
540,
27183,
0,
16763,
77,
8,
8405,
28,
940,
198,
220,
220,
220,
886,
198,
220,
886,
628,
220,
5772,
2777,
776,
796,
4654,
6978,
7,
15908,
3672,
7,
31,
834,
25664,
834,
828,
366,
37266,
13,
73,
335,
4943,
198,
220,
611,
318,
7753,
7,
17143,
2777,
776,
8,
198,
220,
220,
220,
220,
220,
3440,
37266,
0,
7,
2385,
578,
11,
25187,
4102,
33637,
13,
2220,
7,
17143,
2777,
776,
11,
366,
2385,
578,
12340,
1058,
1990,
874,
1776,
198,
220,
2073,
198,
220,
220,
220,
220,
220,
14009,
0,
7,
2385,
578,
8,
198,
220,
220,
220,
220,
220,
25187,
4102,
33637,
13,
21928,
7,
17143,
2777,
776,
11,
366,
2385,
578,
1600,
42287,
7,
2385,
578,
18125,
198,
220,
886,
198,
220,
2482,
28,
5143,
7,
2385,
578,
11,
19011,
577,
28,
7942,
1776,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1303,
1057,
477,
31747,
198,
220,
25187,
4102,
33637,
13,
21928,
7,
3672,
11,
366,
43420,
1600,
2482,
8,
1303,
3613,
2482,
284,
449,
11163,
2393,
628,
220,
285,
17,
28,
1150,
666,
7,
43420,
14692,
862,
46202,
8973,
1776,
628,
220,
1303,
3613,
262,
1366,
198,
220,
2393,
796,
474,
335,
9654,
7,
69,
3672,
11,
366,
86,
4943,
198,
220,
3551,
7,
7753,
11,
366,
7568,
1600,
47764,
8,
198,
220,
1969,
7,
7753,
8,
628,
220,
611,
5145,
8692,
44199,
198,
220,
220,
220,
1441,
285,
17,
11,
5052,
7,
76,
17,
11,
76,
16,
8,
198,
220,
2073,
198,
220,
220,
220,
1441,
285,
17,
198,
220,
886,
198,
437,
198,
198,
17143,
2777,
776,
796,
4654,
6978,
7,
47,
10025,
13,
15908,
7203,
5673,
23266,
14,
1069,
12629,
14,
44199,
14306,
14,
12340,
366,
37266,
13,
73,
335,
4943,
198,
198,
2220,
37266,
0,
7,
2385,
578,
11,
25187,
4102,
33637,
13,
2220,
7,
17143,
2777,
776,
11,
366,
2385,
578,
12340,
1058,
1990,
874,
1776,
628,
198,
9866,
28,
2220,
7203,
9866,
13,
73,
335,
1600,
366,
43420,
4943,
198,
198,
7804,
21017,
198,
7753,
796,
4654,
6978,
7,
47,
10025,
13,
15908,
7203,
5673,
23266,
14,
1069,
12629,
14,
44199,
14306,
14,
12340,
366,
29510,
13,
73,
335,
4943,
198,
411,
28,
9866,
26,
198,
13564,
43420,
7,
7753,
11,
411,
8,
198,
2,
5450,
1378,
12567,
13,
785,
14,
16980,
544,
25690,
14,
47,
10025,
44199,
4102,
13,
20362,
14,
2436,
672,
14,
9866,
14,
10677,
14,
5143,
26968,
4102,
13,
20362,
198,
8818,
3551,
43420,
7,
7753,
11,
581,
8,
198,
220,
220,
220,
3613,
7,
8979,
7,
18982,
1,
41,
11163,
1600,
2393,
828,
366,
2435,
1600,
640,
22784,
366,
28461,
874,
1600,
581,
8,
198,
437,
198,
198,
2,
5450,
1378,
12567,
13,
785,
14,
16980,
544,
25690,
14,
47,
10025,
44199,
4102,
13,
20362,
14,
2436,
672,
14,
9866,
14,
10677,
14,
5143,
26968,
4102,
13,
20362,
198,
8818,
1100,
43420,
7,
7753,
8,
198,
220,
220,
220,
449,
11163,
13,
73,
335,
9654,
7,
7753,
553,
81,
4943,
466,
277,
198,
220,
220,
220,
220,
220,
220,
220,
1100,
7,
69,
11,
366,
28461,
874,
4943,
198,
220,
220,
220,
886,
198,
437,
198,
198,
2,
28,
198,
361,
3613,
43420,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
284,
21928,
796,
611,
6152,
21928,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
8979,
2482,
286,
428,
1057,
30,
357,
41509,
43641,
7,
26270,
58,
16,
25,
21,
46570,
2482,
15908,
43641,
43420,
15908,
8,
357,
56,
14,
77,
8,
366,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2882,
796,
1100,
1370,
3419,
930,
29,
10283,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2882,
6624,
13538,
8614,
2793,
7442,
7,
26209,
8,
6624,
366,
88,
1,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
2073,
2081,
886,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
611,
284,
21928,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
5145,
9409,
343,
7,
43420,
15908,
8,
11405,
33480,
6978,
7,
43420,
15908,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
581,
7753,
796,
4654,
6978,
7,
43420,
15908,
11,
427,
64,
9,
1911,
73,
335,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3551,
43420,
7,
411,
7753,
11,
581,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
7508,
7203,
25468,
286,
262,
18335,
547,
3194,
284,
720,
411,
7753,
4943,
198,
437,
198,
46249,
198,
2,
28,
198,
76,
28,
1150,
666,
7,
5143,
7,
2385,
578,
11,
19011,
577,
28,
7942,
11,
43012,
28,
940,
18125,
198,
21928,
7203,
76,
17,
13,
73,
335,
2430,
76,
1600,
37266,
7,
76,
18125,
198,
198,
2,
8996,
198,
29510,
35,
713,
28,
2220,
7203,
76,
16,
13,
73,
335,
4943,
198,
76,
62,
29510,
28,
1136,
7,
29510,
35,
713,
553,
76,
16,
1600,
15,
8,
198,
198,
10456,
469,
7,
76,
62,
29510,
11,
76,
8,
628,
198,
14468,
2235,
15173,
198,
2,
7061,
6,
198,
2,
16546,
41888,
25,
75,
2164,
18438,
3628,
11,
25,
75,
2164,
29710,
3628,
60,
198,
2,
285,
16,
28,
26968,
9704,
7,
1416,
4411,
274,
58,
16,
12962,
198,
2,
285,
17,
28,
26968,
9704,
7,
1416,
4411,
274,
58,
17,
12962,
198,
2,
5052,
7,
76,
16,
11,
76,
17,
8,
198,
2,
7061,
6,
198,
8818,
7624,
9704,
7,
15952,
1326,
8,
198,
220,
269,
28,
13086,
20448,
7,
26,
7,
25,
14171,
14804,
25,
23736,
44199,
18125,
198,
220,
900,
44,
2304,
0,
7,
66,
26,
18908,
1358,
27054,
1326,
28,
15952,
1326,
8,
198,
220,
299,
28,
36733,
1096,
16541,
38175,
15988,
7,
66,
1776,
198,
220,
275,
28,
31,
26968,
4102,
27183,
0,
16763,
77,
8,
8405,
28,
940,
198,
220,
1441,
14288,
7,
65,
8,
198,
437,
198,
46249,
198
] | 2.325053 | 1,409 |
using DelayedKalmanFilter
using Documenter
makedocs(;
modules=[DelayedKalmanFilter],
authors="Joshua Burton",
repo="https://github.com/burtonjosh/DelayedKalmanFilter.jl/blob/{commit}{path}#L{line}",
sitename="DelayedKalmanFilter.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://burtonjosh.github.io/DelayedKalmanFilter.jl",
assets=String[],
),
pages=[
"Home" => "index.md",
],
)
deploydocs(;
repo="github.com/burtonjosh/DelayedKalmanFilter.jl",
)
| [
3500,
4216,
16548,
41428,
805,
22417,
198,
3500,
16854,
263,
198,
198,
76,
4335,
420,
82,
7,
26,
198,
220,
220,
220,
13103,
41888,
13856,
16548,
41428,
805,
22417,
4357,
198,
220,
220,
220,
7035,
2625,
47740,
27209,
1600,
198,
220,
220,
220,
29924,
2625,
5450,
1378,
12567,
13,
785,
14,
6236,
1122,
73,
3768,
14,
13856,
16548,
41428,
805,
22417,
13,
20362,
14,
2436,
672,
14,
90,
41509,
18477,
6978,
92,
2,
43,
90,
1370,
92,
1600,
198,
220,
220,
220,
1650,
12453,
2625,
13856,
16548,
41428,
805,
22417,
13,
20362,
1600,
198,
220,
220,
220,
5794,
28,
24941,
263,
13,
28656,
7,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2495,
6371,
82,
28,
1136,
7,
1677,
53,
11,
366,
25690,
1600,
366,
9562,
4943,
6624,
366,
7942,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
40091,
2625,
5450,
1378,
6236,
1122,
73,
3768,
13,
12567,
13,
952,
14,
13856,
16548,
41428,
805,
22417,
13,
20362,
1600,
198,
220,
220,
220,
220,
220,
220,
220,
6798,
28,
10100,
58,
4357,
198,
220,
220,
220,
10612,
198,
220,
220,
220,
5468,
41888,
198,
220,
220,
220,
220,
220,
220,
220,
366,
16060,
1,
5218,
366,
9630,
13,
9132,
1600,
198,
220,
220,
220,
16589,
198,
8,
198,
198,
2934,
1420,
31628,
7,
26,
198,
220,
220,
220,
29924,
2625,
12567,
13,
785,
14,
6236,
1122,
73,
3768,
14,
13856,
16548,
41428,
805,
22417,
13,
20362,
1600,
198,
8,
198
] | 2.326446 | 242 |
# tests for the policy and coord tables types and related functions.
# using Base.Test
# push!(LOAD_PATH, ".")
# include("includes.jl")
function get_test_policy()
q_table = zeros(4^7, 36)
range = collect(1:4)
q_grid = RectangleGrid(range, range, range, range, range, range, range)
policy = PolicyTable(q_table, q_grid, 4^7)
end
function get_test_coordination_table()
c_table = zeros(4^7)
c_table[1] = 1
c_table[2] = -1
range = collect(1:4)
c_grid = RectangleGrid(range, range, range, range, range, range, range)
coordination_table = CoordinationTable(c_table, c_grid, 4^7)
end
# policy table tests
function test_policy_table_constructor()
get_test_policy()
end
function test_get_utilities()
policy = get_test_policy()
policy.q_table[1, 1] = 10
policy.q_table[2, 2] = 9
belief = spzeros(policy.num_states, 1)
belief[1] = .5
belief[2] = .5
utilities = get_utilities(policy, belief)
expected_utilities = zeros(size(policy.q_table, 2))
expected_utilities[1] = .5 * 10
expected_utilities[2] = .5 * 9
@test utilities == expected_utilities
end
function test_make_coordination_table()
q_table = zeros(2, 36)
q_table[1, 1] = 1
q_table[2, 36] = 2
q_table[2, 4] = 1
joint_actions = get_joint_actions(ACTIONS)
c_table = make_coordination_table(q_table, joint_actions)
@test c_table[1] == 1
end
function test_get_sense_action_parameters()
a1 = -10.
a2 = +10.
sense = get_action_sense(a1, a2)
@test sense == :different_sense
a1 = 0.
sense = get_action_sense(a1, a2)
@test sense == :neither_sense
a1 = +10.
sense = get_action_sense(a1, a2)
@test sense == :same_sense
end
function test_get_sense_coord_table_parameters()
c_table = get_test_coordination_table()
belief = spzeros(c_table.num_states, 1)
belief[1] = .6
belief[2] = .4
sense = get_coordination_sense(c_table, belief)
@test sense == :same_sense
belief[1] = .4
belief[2] = .6
sense = get_coordination_sense(c_table, belief)
@test sense == :different_sense
belief[1] = .3
belief[2] = .3
belief[3] = .4
sense = get_coordination_sense(c_table, belief)
@test sense == :neither_sense
end
tic()
# policy tests
test_policy_table_constructor()
test_get_utilities()
# coord tests
test_make_coordination_table()
test_get_sense_action_parameters()
test_get_sense_coord_table_parameters()
toc() | [
2,
5254,
329,
262,
2450,
290,
6349,
8893,
3858,
290,
3519,
5499,
13,
198,
198,
2,
1262,
7308,
13,
14402,
198,
198,
2,
4574,
0,
7,
35613,
62,
34219,
11,
366,
19570,
198,
2,
2291,
7203,
42813,
13,
20362,
4943,
198,
198,
8818,
651,
62,
9288,
62,
30586,
3419,
198,
220,
220,
220,
10662,
62,
11487,
796,
1976,
27498,
7,
19,
61,
22,
11,
4570,
8,
198,
220,
220,
220,
2837,
796,
2824,
7,
16,
25,
19,
8,
198,
220,
220,
220,
10662,
62,
25928,
796,
48599,
9248,
41339,
7,
9521,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
8,
198,
220,
220,
220,
2450,
796,
7820,
10962,
7,
80,
62,
11487,
11,
10662,
62,
25928,
11,
604,
61,
22,
8,
198,
437,
198,
198,
8818,
651,
62,
9288,
62,
37652,
1883,
62,
11487,
3419,
198,
220,
220,
220,
269,
62,
11487,
796,
1976,
27498,
7,
19,
61,
22,
8,
198,
220,
220,
220,
269,
62,
11487,
58,
16,
60,
796,
352,
198,
220,
220,
220,
269,
62,
11487,
58,
17,
60,
796,
532,
16,
198,
220,
220,
220,
2837,
796,
2824,
7,
16,
25,
19,
8,
198,
220,
220,
220,
269,
62,
25928,
796,
48599,
9248,
41339,
7,
9521,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
11,
2837,
8,
198,
220,
220,
220,
19877,
62,
11487,
796,
22819,
1883,
10962,
7,
66,
62,
11487,
11,
269,
62,
25928,
11,
604,
61,
22,
8,
198,
437,
198,
198,
2,
2450,
3084,
5254,
198,
8818,
1332,
62,
30586,
62,
11487,
62,
41571,
273,
3419,
198,
220,
220,
220,
651,
62,
9288,
62,
30586,
3419,
198,
437,
198,
198,
8818,
1332,
62,
1136,
62,
315,
2410,
3419,
198,
220,
220,
220,
2450,
796,
651,
62,
9288,
62,
30586,
3419,
198,
220,
220,
220,
2450,
13,
80,
62,
11487,
58,
16,
11,
352,
60,
796,
838,
198,
220,
220,
220,
2450,
13,
80,
62,
11487,
58,
17,
11,
362,
60,
796,
860,
198,
220,
220,
220,
4901,
796,
599,
9107,
418,
7,
30586,
13,
22510,
62,
27219,
11,
352,
8,
198,
220,
220,
220,
4901,
58,
16,
60,
796,
764,
20,
198,
220,
220,
220,
4901,
58,
17,
60,
796,
764,
20,
628,
220,
220,
220,
20081,
796,
651,
62,
315,
2410,
7,
30586,
11,
4901,
8,
198,
220,
220,
220,
2938,
62,
315,
2410,
796,
1976,
27498,
7,
7857,
7,
30586,
13,
80,
62,
11487,
11,
362,
4008,
198,
220,
220,
220,
2938,
62,
315,
2410,
58,
16,
60,
796,
764,
20,
1635,
838,
198,
220,
220,
220,
2938,
62,
315,
2410,
58,
17,
60,
796,
764,
20,
1635,
860,
198,
220,
220,
220,
2488,
9288,
20081,
6624,
2938,
62,
315,
2410,
198,
437,
198,
198,
8818,
1332,
62,
15883,
62,
37652,
1883,
62,
11487,
3419,
198,
220,
220,
220,
10662,
62,
11487,
796,
1976,
27498,
7,
17,
11,
4570,
8,
198,
220,
220,
220,
10662,
62,
11487,
58,
16,
11,
352,
60,
796,
352,
198,
220,
220,
220,
10662,
62,
11487,
58,
17,
11,
4570,
60,
796,
362,
198,
220,
220,
220,
10662,
62,
11487,
58,
17,
11,
604,
60,
796,
352,
198,
220,
220,
220,
6466,
62,
4658,
796,
651,
62,
73,
1563,
62,
4658,
7,
10659,
11053,
8,
198,
220,
220,
220,
269,
62,
11487,
796,
787,
62,
37652,
1883,
62,
11487,
7,
80,
62,
11487,
11,
6466,
62,
4658,
8,
198,
220,
220,
220,
2488,
9288,
269,
62,
11487,
58,
16,
60,
6624,
352,
198,
437,
198,
198,
8818,
1332,
62,
1136,
62,
33819,
62,
2673,
62,
17143,
7307,
3419,
198,
220,
220,
220,
257,
16,
796,
532,
940,
13,
198,
220,
220,
220,
257,
17,
796,
1343,
940,
13,
198,
220,
220,
220,
2565,
796,
651,
62,
2673,
62,
33819,
7,
64,
16,
11,
257,
17,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
39799,
62,
33819,
198,
220,
220,
220,
257,
16,
796,
657,
13,
198,
220,
220,
220,
2565,
796,
651,
62,
2673,
62,
33819,
7,
64,
16,
11,
257,
17,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
710,
1555,
62,
33819,
198,
220,
220,
220,
257,
16,
796,
1343,
940,
13,
198,
220,
220,
220,
2565,
796,
651,
62,
2673,
62,
33819,
7,
64,
16,
11,
257,
17,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
31642,
62,
33819,
198,
437,
198,
198,
8818,
1332,
62,
1136,
62,
33819,
62,
37652,
62,
11487,
62,
17143,
7307,
3419,
198,
220,
220,
220,
269,
62,
11487,
796,
651,
62,
9288,
62,
37652,
1883,
62,
11487,
3419,
198,
220,
220,
220,
4901,
796,
599,
9107,
418,
7,
66,
62,
11487,
13,
22510,
62,
27219,
11,
352,
8,
198,
220,
220,
220,
4901,
58,
16,
60,
796,
764,
21,
198,
220,
220,
220,
4901,
58,
17,
60,
796,
764,
19,
198,
220,
220,
220,
2565,
796,
651,
62,
37652,
1883,
62,
33819,
7,
66,
62,
11487,
11,
4901,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
31642,
62,
33819,
628,
220,
220,
220,
4901,
58,
16,
60,
796,
764,
19,
198,
220,
220,
220,
4901,
58,
17,
60,
796,
764,
21,
198,
220,
220,
220,
2565,
796,
651,
62,
37652,
1883,
62,
33819,
7,
66,
62,
11487,
11,
4901,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
39799,
62,
33819,
628,
220,
220,
220,
4901,
58,
16,
60,
796,
764,
18,
198,
220,
220,
220,
4901,
58,
17,
60,
796,
764,
18,
198,
220,
220,
220,
4901,
58,
18,
60,
796,
764,
19,
198,
220,
220,
220,
2565,
796,
651,
62,
37652,
1883,
62,
33819,
7,
66,
62,
11487,
11,
4901,
8,
198,
220,
220,
220,
2488,
9288,
2565,
6624,
1058,
710,
1555,
62,
33819,
198,
437,
198,
13370,
3419,
198,
2,
2450,
5254,
198,
9288,
62,
30586,
62,
11487,
62,
41571,
273,
3419,
198,
9288,
62,
1136,
62,
315,
2410,
3419,
198,
198,
2,
6349,
5254,
198,
9288,
62,
15883,
62,
37652,
1883,
62,
11487,
3419,
198,
9288,
62,
1136,
62,
33819,
62,
2673,
62,
17143,
7307,
3419,
198,
9288,
62,
1136,
62,
33819,
62,
37652,
62,
11487,
62,
17143,
7307,
3419,
198,
40301,
3419
] | 2.416339 | 1,016 |
# v0.6.0
function printlyrics()
const gifts = split("""
A partridge in a pear tree.
Two turtle doves
Three french hens
Four calling birds
Five golden rings
Six geese a-laying
Seven swans a-swimming
Eight maids a-milking
Nine ladies dancing
Ten lords a-leaping
Eleven pipers piping
Twelve drummers drumming
""", '\n')
const days = split("""
first second third fourth fifth
sixth seventh eighth ninth tenth
eleventh twelfth""")
for (n, day) in enumerate(days)
g = gifts[n:-1:1]
print("\nOn the $day day of Christmas\nMy true love gave to me:\n")
if n == 1
print(join(g[1:end], '\n'), '\n')
else
print(join(g[1:end-1], '\n'), " and\n", g[end], '\n')
end
end
end
printlyrics()
| [
2,
410,
15,
13,
21,
13,
15,
198,
198,
8818,
3601,
306,
10466,
3419,
198,
220,
220,
220,
1500,
13201,
796,
6626,
7203,
15931,
198,
220,
220,
220,
317,
636,
12818,
287,
257,
25286,
5509,
13,
198,
220,
220,
220,
4930,
28699,
466,
1158,
198,
220,
220,
220,
7683,
48718,
339,
5907,
198,
220,
220,
220,
6675,
4585,
10087,
198,
220,
220,
220,
10579,
10861,
13917,
198,
220,
220,
220,
9699,
4903,
2771,
257,
12,
75,
8369,
198,
220,
220,
220,
13723,
1509,
504,
257,
12,
2032,
27428,
198,
220,
220,
220,
18087,
25920,
82,
257,
12,
25433,
3364,
198,
220,
220,
220,
16431,
17308,
15360,
198,
220,
220,
220,
9368,
33200,
257,
12,
293,
9269,
198,
220,
220,
220,
37339,
7347,
364,
48426,
198,
220,
220,
220,
30775,
13026,
11056,
13026,
2229,
198,
220,
220,
220,
13538,
1600,
705,
59,
77,
11537,
198,
220,
220,
220,
1500,
1528,
796,
6626,
7203,
15931,
198,
220,
220,
220,
717,
1218,
2368,
5544,
8150,
198,
220,
220,
220,
11695,
14024,
16974,
19646,
24395,
198,
220,
220,
220,
9766,
20987,
665,
44659,
15931,
4943,
198,
220,
220,
220,
329,
357,
77,
11,
1110,
8,
287,
27056,
378,
7,
12545,
8,
198,
220,
220,
220,
220,
220,
220,
220,
308,
796,
13201,
58,
77,
21912,
16,
25,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
3601,
7203,
59,
77,
2202,
262,
720,
820,
1110,
286,
6786,
59,
77,
3666,
2081,
1842,
2921,
284,
502,
7479,
77,
4943,
198,
220,
220,
220,
220,
220,
220,
220,
611,
299,
6624,
352,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
22179,
7,
70,
58,
16,
25,
437,
4357,
705,
59,
77,
33809,
705,
59,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
3601,
7,
22179,
7,
70,
58,
16,
25,
437,
12,
16,
4357,
705,
59,
77,
33809,
366,
290,
59,
77,
1600,
308,
58,
437,
4357,
705,
59,
77,
11537,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
437,
198,
198,
4798,
306,
10466,
3419,
198
] | 2.275 | 360 |
using DiffEqBase: remake, solve, ODEProblem, EnsembleProblem, EnsembleThreads
####################################################################################################
# this function takes into accound a parameter passed to the vector field
# Putting the options `save_start = false` seems to give bugs with Sundials
function flowTimeSol(x, p, tm, pb::ODEProblem; alg = Euler(), kwargs...)
_prob = remake(pb; u0 = x, tspan = (zero(eltype(tm)), tm), p = p)
# the use of concrete_solve makes it compatible with Zygote
sol = solve(_prob, alg; save_everystep = false, kwargs...)
return (t = sol.t[end], u = sol[end])
end
# this function is a bit different from the previous one as it is geared towards parallel computing of the flow.
function flowTimeSol(x::AbstractMatrix, p, tm, epb::EnsembleProblem; alg = Euler(), kwargs...)
# modify the function which asigns new initial conditions
# see docs at https://docs.sciml.ai/dev/features/ensemble/#Performing-an-Ensemble-Simulation-1
_prob_func = (prob, ii, repeat) -> prob = remake(prob, u0 = x[:, ii], tspan = (zero(eltype(tm[ii])), tm[ii]), p = p)
_epb = setproperties(epb, output_func = (sol, i) -> ((t = sol.t[end], u = sol[end]), false), prob_func = _prob_func)
sol = solve(_epb, alg, EnsembleThreads(); trajectories = size(x, 2), save_everystep = false, kwargs...)
# sol.u contains a vector of tuples (sol_i.t[end], sol_i[end])
return sol.u
end
flow(x, p, tm, pb::ODEProblem; alg = Euler(), kwargs...) = flowTimeSol(x, p, tm, pb; alg = alg, kwargs...).u
flow(x, p, tm, pb::EnsembleProblem; alg = Euler(), kwargs...) = flowTimeSol(x, p, tm, pb; alg = alg, kwargs...)
flow(x, tm, pb::Union{ODEProblem, EnsembleProblem}; alg = Euler(), kwargs...) = flow(x, nothing, tm, pb; alg = alg, kwargs...)
####################################################################################################
# function used to compute the derivative of the flow, so pb encodes the variational equation
function dflow(x::AbstractVector, p, dx, tm, pb::ODEProblem; alg = Euler(), kwargs...)
n = length(x)
_prob = remake(pb; u0 = vcat(x, dx), tspan = (zero(eltype(tm)), tm), p = p)
# the use of concrete_solve makes it compatible with Zygote
sol = solve(_prob, alg, save_everystep = false; kwargs...)[end]
return (t = tm, u = sol[1:n], du = sol[n+1:end])
end
# same for Parallel computing
function dflow(x::AbstractMatrix, p, dx, tm, epb::EnsembleProblem; alg = Euler(), kwargs...)
N = size(x,1)
_prob_func = (prob, ii, repeat) -> prob = remake(prob, u0 = vcat(x[:, ii], dx[:, ii]), tspan = (zero(eltype(tm[ii])), tm[ii]), p = p)
_epb = setproperties(epb, output_func = (sol,i) -> ((t = sol.t[end], u = sol[end][1:N], du = sol[end][N+1:end]), false), prob_func = _prob_func)
sol = solve(_epb, alg, EnsembleThreads(); trajectories = size(x, 2), save_everystep = false, kwargs...)
return sol.u
end
dflow(x, dx, tspan, pb::Union{ODEProblem, EnsembleProblem}; alg = Euler(), kwargs...) = dflow(x, nothing, dx, tspan, pb; alg = alg, kwargs...)
####################################################################################################
# this function takes into accound a parameter passed to the vector field
function dflow_fd(x, p, dx, tm, pb::ODEProblem; alg = Euler(), δ = 1e-9, kwargs...)
sol1 = flow(x .+ δ .* dx, p, tm, pb; alg = alg, kwargs...)
sol2 = flow(x , p, tm, pb; alg = alg, kwargs...)
return (t = tm, u = sol2, du = (sol1 .- sol2) ./ δ)
end
function dflow_fd(x, p, dx, tm, pb::EnsembleProblem; alg = Euler(), δ = 1e-9, kwargs...)
sol1 = flow(x .+ δ .* dx, p, tm, pb; alg = alg, kwargs...)
sol2 = flow(x , p, tm, pb; alg = alg, kwargs...)
return [(t = sol1[ii][1], u = sol2[ii][2], du = (sol1[ii][2] .- sol2[ii][2]) ./ δ) for ii = 1:size(x,2) ]
end
dflow_fd(x, dx, tm, pb::Union{ODEProblem, EnsembleProblem}; alg = Euler(), δ = 1e-9, kwargs...) = dflow_fd(x, nothing, dx, tm, pb; alg = alg, δ = δ, kwargs...)
####################################################################################################
# this gives access to the full solution, convenient for Poincaré shooting
# this function takes into accound a parameter passed to the vector field and returns the full solution from the ODE solver. This is useful in Poincare Shooting to extract the period.
function flowFull(x, p, tm, pb::ODEProblem; alg = Euler(), kwargs...)
_prob = remake(pb; u0 = x, tspan = (zero(tm), tm), p = p)
sol = solve(_prob, alg; kwargs...)
end
function flowFull(x, p, tm, epb::EnsembleProblem; alg = Euler(), kwargs...)
_prob_func = (prob, ii, repeat) -> prob = remake(prob, u0 = x[:, ii], tspan = (zero(eltype(tm[ii])), tm[ii]), p = p)
_epb = setproperties(epb, prob_func = _prob_func)
sol = solve(_epb, alg, EnsembleThreads(); trajectories = size(x, 2), kwargs...)
end
flowFull(x, tm, pb::Union{ODEProblem, EnsembleProblem}; alg = Euler(), kwargs...) = flowFull(x, nothing, tm, pb; alg = alg, kwargs...)
####################################################################################################
# Structures related to computing ODE/PDE Flows
"""
$(TYPEDEF)
$(TYPEDFIELDS)
# Simplified constructor(s)
We provide a simple constructor where you only pass the vector field `F`, the flow `ϕ` and its differential `dϕ`:
fl = Flow(F, ϕ, dϕ)
# Simplified constructors for DifferentialEquations.jl
There are some simple constructors for which you only have to pass a `prob::ODEProblem` or `prob::EnsembleProblem` (for parallel computation) from `DifferentialEquations.jl` and an ODE time stepper like `Tsit5()`. Hence, you can do for example
fl = Flow(F, prob, Tsit5(); kwargs...)
where `kwargs` is passed to `DiffEqBase::solve`. If your vector field depends on parameters `p`, you can define a `Flow` using
fl = Flow(F, p, prob, Tsit5(); kwargs...)
Finally, you can pass two `ODEProblem` where the second one is used to compute the variational equation:
fl = Flow(F, p, prob1::ODEProblem, alg1, prob2::ODEProblem, alg2; kwargs...)
"""
@with_kw struct Flow{TF, Tf, Tts, Tff, Td, Tse, Tprob, TprobMono, Tfs}
"The vector field `(x, p) -> F(x, p)` associated to a Cauchy problem,"
F::TF = nothing
"The flow (or semigroup) associated to the Cauchy problem `(x, p, t) -> flow(x, p, t)`. Only the last time point must be returned."
flow::Tf = nothing
"Flow which returns the tuple (t, u(t)). Optional, mainly used for plotting on the user side. Please use `nothing` as default."
flowTimeSol::Tts = nothing
"The flow (or semigroup) associated to the Cauchy problem `(x, p, t) -> flow(x, p, t)`. The whole solution on the time interval [0,t] must be returned. It is not strictly necessary to provide this, mainly used for plotting on the user side. Please use `nothing` as default."
flowFull::Tff = nothing
"The differential `dflow` of the flow w.r.t. `x`, `(x, p, dx, t) -> dflow(x, p, dx, t)`. One important thing is that we require `dflow(x, dx, t)` to return a Named Tuple: `(t = t, u = flow(x, p, t), du = dflow(x, p, dx, t))`, the last component being the value of the derivative of the flow."
dflow::Td = nothing
"Serial version of dflow. Used internally when using parallel multiple shooting. Please use `nothing` as default."
dfSerial::Tse = nothing
"[Internal] store the ODEProblem associated to the flow of the Cauchy problem"
prob::Tprob = nothing
"[Internal] store the ODEProblem associated to the flow of the variational problem"
probMono::TprobMono = nothing
"[Internal] Serial version of the flow"
flowSerial::Tfs = nothing
end
# constructors
Flow(F, fl, df = nothing) = Flow(F = F, flow = fl, dflow = df, dfSerial = df)
# callable struct
(fl::Flow)(x, p, t; k...) = fl.flow(x, p, t; k...)
(fl::Flow)(x, p, dx, t; k...) = fl.dflow(x, p, dx, t; k...)
(fl::Flow)(::Val{:Full}, x, p, t; k...) = fl.flowFull(x, p, t; k...)
(fl::Flow)(::Val{:TimeSol}, x, p, t; k...) = fl.flowTimeSol(x, p, t; k...)
(fl::Flow)(::Val{:SerialTimeSol}, x, p, t; k...) = fl.flowSerial(x, p, t; k...)
(fl::Flow)(::Val{:SerialdFlow}, x, p, dx, t; k...) = fl.dfSerial(x, p, dx, t; k...)
"""
Creates a Flow variable based on a `prob::ODEProblem` and ODE solver `alg`. The vector field `F` has to be passed, this will be resolved in the future as it can be recovered from `prob`. Also, the derivative of the flow is estimated with finite differences.
"""
# this constructor takes into accound a parameter passed to the vector field
function Flow(F, p, prob::Union{ODEProblem, EnsembleProblem}, alg; kwargs...)
probserial = prob isa EnsembleProblem ? prob.prob : prob
return Flow(F = F,
flow = (x, p, t; kw2...) -> flow(x, p, t, prob; alg = alg, kwargs..., kw2...),
flowTimeSol = (x, p, t; kw2...) -> flowTimeSol(x, p, t, prob; alg = alg, kwargs..., kw2...),
flowFull = (x, p, t; kw2...) -> flowFull(x, p, t, prob; alg = alg, kwargs..., kw2...),
dflow = (x, p, dx, t; kw2...) -> dflow_fd(x, p, dx, t, prob; alg = alg, kwargs..., kw2...),
# serial version of dflow. Used for the computation of Floquet coefficients
dfSerial = (x, p, dx, t; kw2...) -> dflow_fd(x, p, dx, t, probserial; alg = alg, kwargs..., kw2...),
flowSerial = (x, p, t; kw2...) -> flowTimeSol(x, p, t, probserial; alg = alg, kwargs..., kw2...),
prob = prob, probMono = nothing,
)
end
function Flow(F, p, prob1::Union{ODEProblem, EnsembleProblem}, alg1, prob2::Union{ODEProblem, EnsembleProblem}, alg2; kwargs...)
probserial1 = prob1 isa EnsembleProblem ? prob1.prob : prob1
probserial2 = prob2 isa EnsembleProblem ? prob2.prob : prob2
return Flow(F = F,
flow = (x, p, t; kw2...) -> flow(x, p, t, prob1, alg = alg1; kwargs..., kw2...),
flowTimeSol = (x, p, t; kw2...) -> flowTimeSol(x, p, t, prob1; alg = alg1, kwargs..., kw2...),
flowFull = (x, p, t; kw2...) -> flowFull(x, p, t, prob1, alg = alg1; kwargs..., kw2...),
dflow = (x, p, dx, t; kw2...) -> dflow(x, p, dx, t, prob2; alg = alg2, kwargs..., kw2...),
# serial version of dflow. Used for the computation of Floquet coefficients
dfSerial = (x, p, dx, t; kw2...) -> dflow(x, p, dx, t, probserial2; alg = alg2, kwargs..., kw2...),
flowSerial = (x, p, t; kw2...) -> flowTimeSol(x, p, t, probserial1; alg = alg1, kwargs..., kw2...),
prob = prob1, probMono = prob2,
)
end
| [
3500,
10631,
36,
80,
14881,
25,
28763,
11,
8494,
11,
440,
7206,
40781,
11,
2039,
15140,
40781,
11,
2039,
15140,
16818,
82,
198,
198,
29113,
29113,
29113,
4242,
198,
2,
428,
2163,
2753,
656,
697,
633,
257,
11507,
3804,
284,
262,
15879,
2214,
198,
2,
39956,
262,
3689,
4600,
21928,
62,
9688,
796,
3991,
63,
2331,
284,
1577,
11316,
351,
3309,
8231,
198,
8818,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
3712,
16820,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
62,
1676,
65,
796,
28763,
7,
40842,
26,
334,
15,
796,
2124,
11,
256,
12626,
796,
357,
22570,
7,
417,
4906,
7,
17209,
36911,
256,
76,
828,
279,
796,
279,
8,
198,
197,
2,
262,
779,
286,
10017,
62,
82,
6442,
1838,
340,
11670,
351,
1168,
35641,
1258,
198,
197,
34453,
796,
8494,
28264,
1676,
65,
11,
435,
70,
26,
3613,
62,
16833,
9662,
796,
3991,
11,
479,
86,
22046,
23029,
198,
197,
7783,
357,
83,
796,
1540,
13,
83,
58,
437,
4357,
334,
796,
1540,
58,
437,
12962,
198,
437,
198,
198,
2,
428,
2163,
318,
257,
1643,
1180,
422,
262,
2180,
530,
355,
340,
318,
31394,
3371,
10730,
14492,
286,
262,
5202,
13,
198,
8818,
5202,
7575,
36949,
7,
87,
3712,
23839,
46912,
11,
279,
11,
256,
76,
11,
2462,
65,
3712,
4834,
15140,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
2,
13096,
262,
2163,
543,
355,
570,
82,
649,
4238,
3403,
198,
197,
2,
766,
34165,
379,
3740,
1378,
31628,
13,
1416,
320,
75,
13,
1872,
14,
7959,
14,
40890,
14,
1072,
11306,
31113,
5990,
15464,
12,
272,
12,
4834,
15140,
12,
8890,
1741,
12,
16,
198,
197,
62,
1676,
65,
62,
20786,
796,
357,
1676,
65,
11,
21065,
11,
9585,
8,
4613,
1861,
796,
28763,
7,
1676,
65,
11,
334,
15,
796,
2124,
58,
45299,
21065,
4357,
256,
12626,
796,
357,
22570,
7,
417,
4906,
7,
17209,
58,
4178,
12962,
828,
256,
76,
58,
4178,
46570,
279,
796,
279,
8,
198,
197,
62,
538,
65,
796,
900,
48310,
7,
538,
65,
11,
5072,
62,
20786,
796,
357,
34453,
11,
1312,
8,
4613,
14808,
83,
796,
1540,
13,
83,
58,
437,
4357,
334,
796,
1540,
58,
437,
46570,
3991,
828,
1861,
62,
20786,
796,
4808,
1676,
65,
62,
20786,
8,
198,
197,
34453,
796,
8494,
28264,
538,
65,
11,
435,
70,
11,
2039,
15140,
16818,
82,
9783,
20134,
1749,
796,
2546,
7,
87,
11,
362,
828,
3613,
62,
16833,
9662,
796,
3991,
11,
479,
86,
22046,
23029,
198,
197,
2,
1540,
13,
84,
4909,
257,
15879,
286,
12777,
2374,
357,
34453,
62,
72,
13,
83,
58,
437,
4357,
1540,
62,
72,
58,
437,
12962,
198,
197,
7783,
1540,
13,
84,
198,
437,
198,
198,
11125,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
3712,
16820,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
796,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
737,
84,
198,
11125,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
3712,
4834,
15140,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
796,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
11125,
7,
87,
11,
256,
76,
11,
279,
65,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
19629,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
796,
220,
5202,
7,
87,
11,
2147,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
29113,
29113,
29113,
4242,
198,
2,
2163,
973,
284,
24061,
262,
27255,
286,
262,
5202,
11,
523,
279,
65,
2207,
4147,
262,
5553,
864,
16022,
198,
8818,
288,
11125,
7,
87,
3712,
23839,
38469,
11,
279,
11,
44332,
11,
256,
76,
11,
279,
65,
3712,
16820,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
77,
796,
4129,
7,
87,
8,
198,
197,
62,
1676,
65,
796,
28763,
7,
40842,
26,
334,
15,
796,
410,
9246,
7,
87,
11,
44332,
828,
256,
12626,
796,
357,
22570,
7,
417,
4906,
7,
17209,
36911,
256,
76,
828,
279,
796,
279,
8,
198,
197,
2,
262,
779,
286,
10017,
62,
82,
6442,
1838,
340,
11670,
351,
1168,
35641,
1258,
198,
197,
34453,
796,
8494,
28264,
1676,
65,
11,
435,
70,
11,
3613,
62,
16833,
9662,
796,
3991,
26,
479,
86,
22046,
23029,
58,
437,
60,
198,
197,
7783,
357,
83,
796,
256,
76,
11,
334,
796,
1540,
58,
16,
25,
77,
4357,
7043,
796,
1540,
58,
77,
10,
16,
25,
437,
12962,
198,
437,
198,
198,
2,
976,
329,
42945,
14492,
198,
8818,
288,
11125,
7,
87,
3712,
23839,
46912,
11,
279,
11,
44332,
11,
256,
76,
11,
2462,
65,
3712,
4834,
15140,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
45,
796,
2546,
7,
87,
11,
16,
8,
198,
197,
62,
1676,
65,
62,
20786,
796,
357,
1676,
65,
11,
21065,
11,
9585,
8,
4613,
1861,
796,
28763,
7,
1676,
65,
11,
334,
15,
796,
410,
9246,
7,
87,
58,
45299,
21065,
4357,
44332,
58,
45299,
21065,
46570,
256,
12626,
796,
357,
22570,
7,
417,
4906,
7,
17209,
58,
4178,
12962,
828,
256,
76,
58,
4178,
46570,
279,
796,
279,
8,
198,
197,
62,
538,
65,
796,
900,
48310,
7,
538,
65,
11,
5072,
62,
20786,
796,
357,
34453,
11,
72,
8,
4613,
14808,
83,
796,
1540,
13,
83,
58,
437,
4357,
334,
796,
1540,
58,
437,
7131,
16,
25,
45,
4357,
7043,
796,
1540,
58,
437,
7131,
45,
10,
16,
25,
437,
46570,
3991,
828,
1861,
62,
20786,
796,
4808,
1676,
65,
62,
20786,
8,
198,
197,
34453,
796,
8494,
28264,
538,
65,
11,
435,
70,
11,
2039,
15140,
16818,
82,
9783,
20134,
1749,
796,
2546,
7,
87,
11,
362,
828,
3613,
62,
16833,
9662,
796,
3991,
11,
479,
86,
22046,
23029,
198,
197,
7783,
1540,
13,
84,
198,
437,
198,
198,
67,
11125,
7,
87,
11,
44332,
11,
256,
12626,
11,
279,
65,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
19629,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
796,
288,
11125,
7,
87,
11,
2147,
11,
44332,
11,
256,
12626,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
29113,
29113,
29113,
4242,
198,
2,
428,
2163,
2753,
656,
697,
633,
257,
11507,
3804,
284,
262,
15879,
2214,
198,
8818,
288,
11125,
62,
16344,
7,
87,
11,
279,
11,
44332,
11,
256,
76,
11,
279,
65,
3712,
16820,
40781,
26,
435,
70,
796,
412,
18173,
22784,
7377,
112,
796,
352,
68,
12,
24,
11,
479,
86,
22046,
23029,
198,
197,
34453,
16,
796,
5202,
7,
87,
764,
10,
7377,
112,
764,
9,
44332,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
197,
34453,
17,
796,
5202,
7,
87,
220,
197,
197,
197,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
197,
7783,
357,
83,
796,
256,
76,
11,
334,
796,
1540,
17,
11,
7043,
796,
357,
34453,
16,
764,
12,
1540,
17,
8,
24457,
7377,
112,
8,
198,
437,
198,
198,
8818,
288,
11125,
62,
16344,
7,
87,
11,
279,
11,
44332,
11,
256,
76,
11,
279,
65,
3712,
4834,
15140,
40781,
26,
435,
70,
796,
412,
18173,
22784,
7377,
112,
796,
352,
68,
12,
24,
11,
479,
86,
22046,
23029,
198,
197,
34453,
16,
796,
5202,
7,
87,
764,
10,
7377,
112,
764,
9,
44332,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
197,
34453,
17,
796,
5202,
7,
87,
220,
197,
197,
197,
11,
279,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
197,
7783,
47527,
83,
796,
1540,
16,
58,
4178,
7131,
16,
4357,
334,
796,
1540,
17,
58,
4178,
7131,
17,
4357,
7043,
796,
357,
34453,
16,
58,
4178,
7131,
17,
60,
764,
12,
1540,
17,
58,
4178,
7131,
17,
12962,
24457,
7377,
112,
8,
329,
21065,
796,
352,
25,
7857,
7,
87,
11,
17,
8,
2361,
198,
437,
198,
67,
11125,
62,
16344,
7,
87,
11,
44332,
11,
256,
76,
11,
279,
65,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
19629,
435,
70,
796,
412,
18173,
22784,
7377,
112,
796,
352,
68,
12,
24,
11,
479,
86,
22046,
23029,
796,
288,
11125,
62,
16344,
7,
87,
11,
2147,
11,
44332,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
7377,
112,
796,
7377,
112,
11,
479,
86,
22046,
23029,
198,
29113,
29113,
29113,
4242,
198,
2,
428,
3607,
1895,
284,
262,
1336,
4610,
11,
11282,
329,
7695,
1939,
283,
2634,
4395,
198,
2,
428,
2163,
2753,
656,
697,
633,
257,
11507,
3804,
284,
262,
15879,
2214,
290,
5860,
262,
1336,
4610,
422,
262,
440,
7206,
1540,
332,
13,
770,
318,
4465,
287,
7695,
1939,
533,
25360,
284,
7925,
262,
2278,
13,
198,
8818,
5202,
13295,
7,
87,
11,
279,
11,
256,
76,
11,
279,
65,
3712,
16820,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
62,
1676,
65,
796,
28763,
7,
40842,
26,
334,
15,
796,
2124,
11,
256,
12626,
796,
357,
22570,
7,
17209,
828,
256,
76,
828,
279,
796,
279,
8,
198,
197,
34453,
796,
8494,
28264,
1676,
65,
11,
435,
70,
26,
479,
86,
22046,
23029,
198,
437,
198,
198,
8818,
5202,
13295,
7,
87,
11,
279,
11,
256,
76,
11,
2462,
65,
3712,
4834,
15140,
40781,
26,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
198,
197,
62,
1676,
65,
62,
20786,
796,
357,
1676,
65,
11,
21065,
11,
9585,
8,
4613,
1861,
796,
28763,
7,
1676,
65,
11,
334,
15,
796,
2124,
58,
45299,
21065,
4357,
256,
12626,
796,
357,
22570,
7,
417,
4906,
7,
17209,
58,
4178,
12962,
828,
256,
76,
58,
4178,
46570,
279,
796,
279,
8,
198,
197,
62,
538,
65,
796,
900,
48310,
7,
538,
65,
11,
1861,
62,
20786,
796,
4808,
1676,
65,
62,
20786,
8,
198,
197,
34453,
796,
8494,
28264,
538,
65,
11,
435,
70,
11,
2039,
15140,
16818,
82,
9783,
20134,
1749,
796,
2546,
7,
87,
11,
362,
828,
479,
86,
22046,
23029,
198,
437,
198,
11125,
13295,
7,
87,
11,
256,
76,
11,
279,
65,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
19629,
435,
70,
796,
412,
18173,
22784,
479,
86,
22046,
23029,
796,
5202,
13295,
7,
87,
11,
2147,
11,
256,
76,
11,
279,
65,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
23029,
198,
29113,
29113,
29113,
4242,
198,
2,
32112,
942,
3519,
284,
14492,
440,
7206,
14,
5760,
36,
1610,
1666,
198,
37811,
198,
3,
7,
9936,
47,
1961,
25425,
8,
198,
3,
7,
9936,
47,
1961,
11674,
3698,
5258,
8,
198,
198,
2,
45157,
1431,
23772,
7,
82,
8,
198,
1135,
2148,
257,
2829,
23772,
810,
345,
691,
1208,
262,
15879,
2214,
4600,
37,
47671,
262,
5202,
4600,
139,
243,
63,
290,
663,
22577,
4600,
67,
139,
243,
63,
25,
628,
197,
2704,
796,
27782,
7,
37,
11,
18074,
243,
11,
288,
139,
243,
8,
198,
198,
2,
45157,
1431,
5678,
669,
329,
20615,
498,
23588,
602,
13,
20362,
198,
198,
1858,
389,
617,
2829,
5678,
669,
329,
543,
345,
691,
423,
284,
1208,
257,
4600,
1676,
65,
3712,
16820,
40781,
63,
393,
4600,
1676,
65,
3712,
4834,
15140,
40781,
63,
357,
1640,
10730,
29964,
8,
422,
4600,
40341,
498,
23588,
602,
13,
20362,
63,
290,
281,
440,
7206,
640,
2876,
2848,
588,
4600,
33758,
270,
20,
3419,
44646,
16227,
11,
345,
460,
466,
329,
1672,
628,
197,
2704,
796,
27782,
7,
37,
11,
1861,
11,
13146,
270,
20,
9783,
479,
86,
22046,
23029,
198,
198,
3003,
4600,
46265,
22046,
63,
318,
3804,
284,
4600,
28813,
36,
80,
14881,
3712,
82,
6442,
44646,
1002,
534,
15879,
2214,
8338,
319,
10007,
4600,
79,
47671,
345,
460,
8160,
257,
4600,
37535,
63,
1262,
628,
197,
2704,
796,
27782,
7,
37,
11,
279,
11,
1861,
11,
13146,
270,
20,
9783,
479,
86,
22046,
23029,
198,
198,
11158,
11,
345,
460,
1208,
734,
4600,
16820,
40781,
63,
810,
262,
1218,
530,
318,
973,
284,
24061,
262,
5553,
864,
16022,
25,
628,
197,
2704,
796,
27782,
7,
37,
11,
279,
11,
1861,
16,
3712,
16820,
40781,
11,
435,
70,
16,
11,
1861,
17,
3712,
16820,
40781,
11,
435,
70,
17,
26,
479,
86,
22046,
23029,
198,
198,
37811,
198,
31,
4480,
62,
46265,
2878,
27782,
90,
10234,
11,
309,
69,
11,
309,
912,
11,
309,
487,
11,
309,
67,
11,
309,
325,
11,
309,
1676,
65,
11,
309,
1676,
65,
9069,
78,
11,
309,
9501,
92,
198,
197,
1,
464,
15879,
2214,
4600,
7,
87,
11,
279,
8,
4613,
376,
7,
87,
11,
279,
8,
63,
3917,
284,
257,
327,
559,
29658,
1917,
553,
198,
197,
37,
3712,
10234,
796,
2147,
628,
197,
1,
464,
5202,
357,
273,
5026,
47875,
8,
3917,
284,
262,
327,
559,
29658,
1917,
4600,
7,
87,
11,
279,
11,
256,
8,
4613,
5202,
7,
87,
11,
279,
11,
256,
8,
44646,
5514,
262,
938,
640,
966,
1276,
307,
4504,
526,
198,
197,
11125,
3712,
51,
69,
796,
2147,
628,
197,
1,
37535,
543,
5860,
262,
46545,
357,
83,
11,
334,
7,
83,
29720,
32233,
11,
8384,
973,
329,
29353,
319,
262,
2836,
1735,
13,
4222,
779,
4600,
22366,
63,
355,
4277,
526,
198,
197,
11125,
7575,
36949,
3712,
51,
912,
796,
2147,
628,
197,
1,
464,
5202,
357,
273,
5026,
47875,
8,
3917,
284,
262,
327,
559,
29658,
1917,
4600,
7,
87,
11,
279,
11,
256,
8,
4613,
5202,
7,
87,
11,
279,
11,
256,
8,
44646,
383,
2187,
4610,
319,
262,
640,
16654,
685,
15,
11,
83,
60,
1276,
307,
4504,
13,
632,
318,
407,
14084,
3306,
284,
2148,
428,
11,
8384,
973,
329,
29353,
319,
262,
2836,
1735,
13,
4222,
779,
4600,
22366,
63,
355,
4277,
526,
198,
197,
11125,
13295,
3712,
51,
487,
796,
2147,
628,
197,
1,
464,
22577,
4600,
67,
11125,
63,
286,
262,
5202,
266,
13,
81,
13,
83,
13,
4600,
87,
47671,
4600,
7,
87,
11,
279,
11,
44332,
11,
256,
8,
4613,
288,
11125,
7,
87,
11,
279,
11,
44332,
11,
256,
8,
44646,
1881,
1593,
1517,
318,
326,
356,
2421,
4600,
67,
11125,
7,
87,
11,
44332,
11,
256,
8,
63,
284,
1441,
257,
34441,
309,
29291,
25,
4600,
7,
83,
796,
256,
11,
334,
796,
5202,
7,
87,
11,
279,
11,
256,
828,
7043,
796,
288,
11125,
7,
87,
11,
279,
11,
44332,
11,
256,
4008,
47671,
262,
938,
7515,
852,
262,
1988,
286,
262,
27255,
286,
262,
5202,
526,
198,
197,
67,
11125,
3712,
51,
67,
796,
2147,
628,
197,
1,
32634,
2196,
286,
288,
11125,
13,
16718,
20947,
618,
1262,
10730,
3294,
4395,
13,
4222,
779,
4600,
22366,
63,
355,
4277,
526,
198,
197,
7568,
32634,
3712,
51,
325,
796,
2147,
628,
197,
17912,
37693,
60,
3650,
262,
440,
7206,
40781,
3917,
284,
262,
5202,
286,
262,
327,
559,
29658,
1917,
1,
198,
197,
1676,
65,
3712,
51,
1676,
65,
796,
2147,
628,
197,
17912,
37693,
60,
3650,
262,
440,
7206,
40781,
3917,
284,
262,
5202,
286,
262,
5553,
864,
1917,
1,
198,
197,
1676,
65,
9069,
78,
3712,
51,
1676,
65,
9069,
78,
796,
2147,
628,
197,
17912,
37693,
60,
23283,
2196,
286,
262,
5202,
1,
198,
197,
11125,
32634,
3712,
51,
9501,
796,
2147,
198,
437,
198,
198,
2,
5678,
669,
198,
37535,
7,
37,
11,
781,
11,
47764,
796,
2147,
8,
796,
27782,
7,
37,
796,
376,
11,
5202,
796,
781,
11,
288,
11125,
796,
47764,
11,
47764,
32634,
796,
47764,
8,
198,
198,
2,
869,
540,
2878,
198,
7,
2704,
3712,
37535,
5769,
87,
11,
279,
11,
256,
26,
479,
23029,
220,
220,
220,
220,
220,
197,
197,
197,
220,
220,
197,
197,
197,
28,
781,
13,
11125,
7,
87,
11,
279,
11,
256,
26,
479,
23029,
198,
7,
2704,
3712,
37535,
5769,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
23029,
220,
197,
220,
220,
197,
197,
197,
197,
197,
28,
781,
13,
67,
11125,
7,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
23029,
198,
7,
2704,
3712,
37535,
5769,
3712,
7762,
90,
25,
13295,
5512,
2124,
11,
279,
11,
256,
26,
479,
23029,
220,
197,
220,
220,
197,
197,
28,
781,
13,
11125,
13295,
7,
87,
11,
279,
11,
256,
26,
479,
23029,
198,
7,
2704,
3712,
37535,
5769,
3712,
7762,
90,
25,
7575,
36949,
5512,
2124,
11,
279,
11,
256,
26,
479,
23029,
220,
220,
197,
197,
28,
781,
13,
11125,
7575,
36949,
7,
87,
11,
279,
11,
256,
26,
479,
23029,
198,
7,
2704,
3712,
37535,
5769,
3712,
7762,
90,
25,
32634,
7575,
36949,
5512,
2124,
11,
279,
11,
256,
26,
479,
23029,
220,
220,
220,
197,
28,
781,
13,
11125,
32634,
7,
87,
11,
279,
11,
256,
26,
479,
23029,
198,
7,
2704,
3712,
37535,
5769,
3712,
7762,
90,
25,
32634,
67,
37535,
5512,
2124,
11,
279,
11,
44332,
11,
256,
26,
479,
23029,
220,
796,
781,
13,
7568,
32634,
7,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
23029,
198,
198,
37811,
198,
16719,
274,
257,
27782,
7885,
1912,
319,
257,
4600,
1676,
65,
3712,
16820,
40781,
63,
290,
440,
7206,
1540,
332,
4600,
14016,
44646,
383,
15879,
2214,
4600,
37,
63,
468,
284,
307,
3804,
11,
428,
481,
307,
12939,
287,
262,
2003,
355,
340,
460,
307,
11911,
422,
4600,
1676,
65,
44646,
4418,
11,
262,
27255,
286,
262,
5202,
318,
6108,
351,
27454,
5400,
13,
198,
37811,
198,
2,
428,
23772,
2753,
656,
697,
633,
257,
11507,
3804,
284,
262,
15879,
2214,
198,
8818,
27782,
7,
37,
11,
279,
11,
1861,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
5512,
435,
70,
26,
479,
86,
22046,
23029,
198,
197,
1676,
1443,
48499,
796,
1861,
318,
64,
2039,
15140,
40781,
5633,
1861,
13,
1676,
65,
1058,
1861,
198,
197,
7783,
27782,
7,
37,
796,
376,
11,
198,
197,
197,
11125,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7,
87,
11,
279,
11,
256,
11,
1861,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
7575,
36949,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
11,
1861,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
13295,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
13295,
7,
87,
11,
279,
11,
256,
11,
1861,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
67,
11125,
796,
357,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
86,
17,
23029,
4613,
288,
11125,
62,
16344,
7,
87,
11,
279,
11,
44332,
11,
256,
11,
1861,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
2,
11389,
2196,
286,
288,
11125,
13,
16718,
329,
262,
29964,
286,
29075,
21108,
44036,
198,
197,
197,
7568,
32634,
796,
357,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
86,
17,
23029,
4613,
288,
11125,
62,
16344,
7,
87,
11,
279,
11,
44332,
11,
256,
11,
386,
1443,
48499,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
32634,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
11,
386,
1443,
48499,
26,
435,
70,
796,
435,
70,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
1676,
65,
796,
1861,
11,
1861,
9069,
78,
796,
2147,
11,
198,
197,
197,
8,
198,
437,
198,
198,
8818,
27782,
7,
37,
11,
279,
11,
1861,
16,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
5512,
435,
70,
16,
11,
1861,
17,
3712,
38176,
90,
16820,
40781,
11,
2039,
15140,
40781,
5512,
435,
70,
17,
26,
479,
86,
22046,
23029,
198,
197,
1676,
1443,
48499,
16,
796,
1861,
16,
318,
64,
2039,
15140,
40781,
5633,
1861,
16,
13,
1676,
65,
1058,
1861,
16,
198,
197,
1676,
1443,
48499,
17,
796,
1861,
17,
318,
64,
2039,
15140,
40781,
5633,
1861,
17,
13,
1676,
65,
1058,
1861,
17,
198,
197,
7783,
27782,
7,
37,
796,
376,
11,
198,
197,
197,
11125,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7,
87,
11,
279,
11,
256,
11,
1861,
16,
11,
435,
70,
796,
435,
70,
16,
26,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
7575,
36949,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
11,
1861,
16,
26,
435,
70,
796,
435,
70,
16,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
13295,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
13295,
7,
87,
11,
279,
11,
256,
11,
1861,
16,
11,
435,
70,
796,
435,
70,
16,
26,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
67,
11125,
796,
357,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
86,
17,
23029,
4613,
288,
11125,
7,
87,
11,
279,
11,
44332,
11,
256,
11,
1861,
17,
26,
435,
70,
796,
435,
70,
17,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
2,
11389,
2196,
286,
288,
11125,
13,
16718,
329,
262,
29964,
286,
29075,
21108,
44036,
198,
197,
197,
7568,
32634,
796,
357,
87,
11,
279,
11,
44332,
11,
256,
26,
479,
86,
17,
23029,
4613,
288,
11125,
7,
87,
11,
279,
11,
44332,
11,
256,
11,
386,
1443,
48499,
17,
26,
435,
70,
796,
435,
70,
17,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
11125,
32634,
796,
357,
87,
11,
279,
11,
256,
26,
479,
86,
17,
23029,
4613,
5202,
7575,
36949,
7,
87,
11,
279,
11,
256,
11,
386,
1443,
48499,
16,
26,
435,
70,
796,
435,
70,
16,
11,
479,
86,
22046,
986,
11,
479,
86,
17,
986,
828,
628,
197,
197,
1676,
65,
796,
1861,
16,
11,
1861,
9069,
78,
796,
1861,
17,
11,
198,
197,
197,
8,
198,
437,
198
] | 2.678478 | 3,810 |
# This shows how to plot a 3D seismic tomography model
# The paper that describes it is:
#
# Zhao, L., Paul, A., Malusà, M.G., Xu, X., Zheng, T., Solarino, S., Guillot, S., Schwartz, S., Dumont, T., Salimbeni, S., Aubert, C., Pondrelli, S., Wang, Q., Zhu, R., 2016. Continuity of the Alpine slab unraveled by high-resolution P wave tomography. Journal of Geophysical Research: Solid Earth 121, 8720–8737. doi:10.1002/2016JB013310
#
# You will need to download the file `Zhao_etal_JGR_2016_Pwave_Alps_3D_k60.txt` from:
# https://seafile.rlp.net/d/a50881f45aa34cdeb3c0/
#
# And make sure that you are in the same directory as the data file
using DelimitedFiles, GeophysicalModelGenerator
# Load data:
data=readdlm("Zhao_etal_JGR_2016_Pwave_Alps_3D_k60.txt",' ',Float64,'\n', skipstart=0,header=false)
lon = data[:,1];
lat = data[:,2];
depth = data[:,3];
dVp_perc = data[:,4];
# Create 3D regular grid:
resolution = (length(unique(lon)), length(unique(lat)), length(unique(depth)))
Lon = reshape(lon, resolution);
Lat = reshape(lat, resolution);
Depth = reshape(depth, resolution);
dVp_perc_3D = reshape(dVp_perc, resolution);
# save paraview file
Data_set = GeoData(Lon,Lat,Depth,(dVp_Percentage=dVp_perc_3D,))
Write_Paraview(Data_set, "Zhao_etal_2016_dVp_percentage")
# extract cross-sections
Data_cross = CrossSection(Data_set, Depth_level=-100km)
Write_Paraview(Data_cross, "Zhao_CrossSection_100km")
Data_cross = CrossSection(Data_set, Lon_level=10)
Write_Paraview(Data_cross, "Zhao_CrossSection_Lon10")
Data_cross = CrossSection(Data_set, Lon_level=10, Interpolate=true)
Write_Paraview(Data_cross, "Zhao_CrossSection_Lon10_interpolated");
Data_cross = CrossSection(Data_set, Start=(1.0,39), End=(18,50))
Write_Paraview(Data_cross, "Zhao_CrossSection_diagonal")
# Extract a 3D subset of the data
Data_subset = ExtractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45))
Write_Paraview(Data_subset, "Zhao_Subset")
Data_subset_interp = ExtractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45), Interpolate=true)
Write_Paraview(Data_subset, "Zhao_Subset_interp")
| [
2,
770,
2523,
703,
284,
7110,
257,
513,
35,
37463,
16667,
4867,
2746,
220,
198,
2,
383,
3348,
326,
8477,
340,
318,
25,
198,
2,
198,
2,
29436,
11,
406,
1539,
3362,
11,
317,
1539,
4434,
385,
24247,
11,
337,
13,
38,
1539,
33591,
11,
1395,
1539,
44583,
11,
309,
1539,
12347,
2879,
11,
311,
1539,
1962,
359,
313,
11,
311,
1539,
28672,
11,
311,
1539,
30933,
756,
11,
309,
1539,
4849,
320,
11722,
72,
11,
311,
1539,
40666,
4835,
11,
327,
1539,
41598,
11252,
72,
11,
311,
1539,
15233,
11,
1195,
1539,
33144,
11,
371,
1539,
1584,
13,
6389,
14834,
286,
262,
46994,
38677,
30282,
276,
416,
1029,
12,
29268,
350,
6769,
16667,
4867,
13,
4913,
286,
2269,
41789,
4992,
25,
15831,
3668,
20416,
11,
10083,
1238,
1906,
5774,
2718,
13,
23899,
25,
940,
13,
3064,
17,
14,
5304,
47858,
486,
2091,
940,
198,
2,
198,
2,
921,
481,
761,
284,
4321,
262,
2393,
4600,
57,
23778,
62,
316,
282,
62,
41,
10761,
62,
5304,
62,
47,
19204,
62,
2348,
862,
62,
18,
35,
62,
74,
1899,
13,
14116,
63,
422,
25,
198,
2,
220,
220,
3740,
1378,
325,
1878,
576,
13,
81,
34431,
13,
3262,
14,
67,
14,
64,
1120,
3459,
16,
69,
2231,
7252,
2682,
10210,
1765,
18,
66,
15,
14,
198,
2,
198,
2,
843,
787,
1654,
326,
345,
389,
287,
262,
976,
8619,
355,
262,
1366,
2393,
198,
198,
3500,
4216,
320,
863,
25876,
11,
2269,
41789,
17633,
8645,
1352,
198,
198,
2,
8778,
1366,
25,
198,
7890,
28,
961,
25404,
76,
7203,
57,
23778,
62,
316,
282,
62,
41,
10761,
62,
5304,
62,
47,
19204,
62,
2348,
862,
62,
18,
35,
62,
74,
1899,
13,
14116,
1600,
6,
46083,
43879,
2414,
4032,
59,
77,
3256,
14267,
9688,
28,
15,
11,
25677,
28,
9562,
8,
198,
14995,
220,
220,
220,
220,
220,
220,
220,
796,
1366,
58,
45299,
16,
11208,
198,
15460,
220,
220,
220,
220,
220,
220,
220,
796,
1366,
58,
45299,
17,
11208,
198,
18053,
220,
220,
220,
220,
220,
796,
1366,
58,
45299,
18,
11208,
198,
67,
53,
79,
62,
525,
66,
220,
220,
796,
1366,
58,
45299,
19,
11208,
198,
198,
2,
13610,
513,
35,
3218,
10706,
25,
198,
29268,
796,
220,
357,
13664,
7,
34642,
7,
14995,
36911,
4129,
7,
34642,
7,
15460,
36911,
4129,
7,
34642,
7,
18053,
22305,
198,
43,
261,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
27179,
1758,
7,
14995,
11,
220,
220,
220,
220,
220,
6323,
1776,
198,
24220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
796,
27179,
1758,
7,
15460,
11,
220,
220,
220,
220,
220,
6323,
1776,
198,
48791,
220,
220,
220,
220,
220,
220,
220,
796,
27179,
1758,
7,
18053,
11,
220,
220,
220,
6323,
1776,
198,
67,
53,
79,
62,
525,
66,
62,
18,
35,
220,
796,
27179,
1758,
7,
67,
53,
79,
62,
525,
66,
11,
6323,
1776,
198,
198,
2,
3613,
1582,
615,
769,
2393,
198,
6601,
62,
2617,
220,
220,
220,
796,
220,
220,
32960,
6601,
7,
43,
261,
11,
24220,
11,
48791,
11,
7,
67,
53,
79,
62,
31905,
496,
28,
67,
53,
79,
62,
525,
66,
62,
18,
35,
11,
4008,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
2617,
11,
366,
57,
23778,
62,
316,
282,
62,
5304,
62,
67,
53,
79,
62,
25067,
496,
4943,
198,
198,
2,
7925,
3272,
12,
23946,
220,
198,
6601,
62,
19692,
220,
796,
220,
220,
6372,
16375,
7,
6601,
62,
2617,
11,
36350,
62,
5715,
10779,
3064,
13276,
8,
220,
220,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
19692,
11,
366,
57,
23778,
62,
21544,
16375,
62,
3064,
13276,
4943,
198,
198,
6601,
62,
19692,
220,
796,
220,
220,
6372,
16375,
7,
6601,
62,
2617,
11,
39295,
62,
5715,
28,
940,
8,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
19692,
11,
366,
57,
23778,
62,
21544,
16375,
62,
43,
261,
940,
4943,
198,
198,
6601,
62,
19692,
220,
796,
220,
220,
6372,
16375,
7,
6601,
62,
2617,
11,
39295,
62,
5715,
28,
940,
11,
4225,
16104,
378,
28,
7942,
8,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
19692,
11,
366,
57,
23778,
62,
21544,
16375,
62,
43,
261,
940,
62,
3849,
16104,
515,
15341,
198,
198,
6601,
62,
19692,
220,
796,
220,
220,
6372,
16375,
7,
6601,
62,
2617,
11,
7253,
16193,
16,
13,
15,
11,
2670,
828,
5268,
16193,
1507,
11,
1120,
4008,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
19692,
11,
366,
57,
23778,
62,
21544,
16375,
62,
10989,
27923,
4943,
198,
198,
2,
29677,
257,
513,
35,
24637,
286,
262,
1366,
198,
6601,
62,
7266,
2617,
220,
220,
220,
220,
796,
220,
220,
29677,
7004,
29048,
7,
6601,
62,
2617,
11,
43,
261,
62,
5715,
16193,
20,
11,
1065,
828,
5476,
62,
5715,
16193,
1821,
11,
2231,
4008,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
7266,
2617,
11,
366,
57,
23778,
62,
7004,
2617,
4943,
198,
198,
6601,
62,
7266,
2617,
62,
3849,
79,
220,
220,
220,
220,
796,
220,
220,
29677,
7004,
29048,
7,
6601,
62,
2617,
11,
43,
261,
62,
5715,
16193,
20,
11,
1065,
828,
5476,
62,
5715,
16193,
1821,
11,
2231,
828,
4225,
16104,
378,
28,
7942,
8,
198,
16594,
62,
10044,
615,
769,
7,
6601,
62,
7266,
2617,
11,
366,
57,
23778,
62,
7004,
2617,
62,
3849,
79,
4943,
198
] | 2.428571 | 896 |
module SSLTestTiling
using SimpleSDMLayers
using Test
# hcat / vcat
l1 = SimpleSDMPredictor(WorldClim, BioClim, 1; left=0.0, right=10.0, bottom=0.0, top=10.0)
l2 = SimpleSDMPredictor(WorldClim, BioClim, 1; left=0.0, right=10.0, bottom=10.0, top=20.0)
l3 = SimpleSDMPredictor(WorldClim, BioClim, 1; left=10.0, right=20.0, bottom=0.0, top=10.0)
l4 = SimpleSDMPredictor(WorldClim, BioClim, 1; left=10.0, right=20.0, bottom=10.0, top=20.0)
l5 = SimpleSDMPredictor(WorldClim, BioClim, 1; left=0.0, right=20.0, bottom=0.0, top=20.0)
ml1 = hcat(l1, l3)
vl1 = vcat(l1, l2)
ml2 = hcat(l2, l4)
vl2 = vcat(l3, l4)
vml = vcat(ml1, ml2)
mvl = hcat(vl1, vl2)
@test all(vml.grid == mvl.grid)
for l in (vml, mvl)
@test all(l.grid == l5.grid)
@test size(l) == size(l5)
@test stride(l) == stride(l5)
@test longitudes(l) == longitudes(l5)
@test latitudes(l) == latitudes(l5)
@test l.left == l5.left
@test l.right == l5.right
@test l.bottom == l5.bottom
@test l.top == l5.top
end
end | [
21412,
25952,
14402,
51,
4386,
198,
3500,
17427,
10305,
5805,
6962,
198,
3500,
6208,
198,
198,
2,
289,
9246,
1220,
410,
9246,
198,
75,
16,
796,
17427,
10305,
7378,
17407,
273,
7,
10603,
34,
2475,
11,
16024,
34,
2475,
11,
352,
26,
1364,
28,
15,
13,
15,
11,
826,
28,
940,
13,
15,
11,
4220,
28,
15,
13,
15,
11,
1353,
28,
940,
13,
15,
8,
198,
75,
17,
796,
17427,
10305,
7378,
17407,
273,
7,
10603,
34,
2475,
11,
16024,
34,
2475,
11,
352,
26,
1364,
28,
15,
13,
15,
11,
826,
28,
940,
13,
15,
11,
4220,
28,
940,
13,
15,
11,
1353,
28,
1238,
13,
15,
8,
198,
75,
18,
796,
17427,
10305,
7378,
17407,
273,
7,
10603,
34,
2475,
11,
16024,
34,
2475,
11,
352,
26,
1364,
28,
940,
13,
15,
11,
826,
28,
1238,
13,
15,
11,
4220,
28,
15,
13,
15,
11,
1353,
28,
940,
13,
15,
8,
198,
75,
19,
796,
17427,
10305,
7378,
17407,
273,
7,
10603,
34,
2475,
11,
16024,
34,
2475,
11,
352,
26,
1364,
28,
940,
13,
15,
11,
826,
28,
1238,
13,
15,
11,
4220,
28,
940,
13,
15,
11,
1353,
28,
1238,
13,
15,
8,
198,
75,
20,
796,
17427,
10305,
7378,
17407,
273,
7,
10603,
34,
2475,
11,
16024,
34,
2475,
11,
352,
26,
1364,
28,
15,
13,
15,
11,
826,
28,
1238,
13,
15,
11,
4220,
28,
15,
13,
15,
11,
1353,
28,
1238,
13,
15,
8,
198,
198,
4029,
16,
796,
289,
9246,
7,
75,
16,
11,
300,
18,
8,
198,
19279,
16,
796,
410,
9246,
7,
75,
16,
11,
300,
17,
8,
198,
4029,
17,
796,
289,
9246,
7,
75,
17,
11,
300,
19,
8,
198,
19279,
17,
796,
410,
9246,
7,
75,
18,
11,
300,
19,
8,
198,
198,
85,
4029,
796,
410,
9246,
7,
4029,
16,
11,
25962,
17,
8,
198,
76,
19279,
796,
289,
9246,
7,
19279,
16,
11,
410,
75,
17,
8,
198,
198,
31,
9288,
477,
7,
85,
4029,
13,
25928,
6624,
285,
19279,
13,
25928,
8,
198,
198,
1640,
300,
287,
357,
85,
4029,
11,
285,
19279,
8,
198,
220,
220,
2488,
9288,
477,
7,
75,
13,
25928,
6624,
300,
20,
13,
25928,
8,
198,
220,
220,
2488,
9288,
2546,
7,
75,
8,
6624,
2546,
7,
75,
20,
8,
198,
220,
220,
2488,
9288,
33769,
7,
75,
8,
6624,
33769,
7,
75,
20,
8,
198,
220,
220,
2488,
9288,
890,
10455,
7,
75,
8,
6624,
890,
10455,
7,
75,
20,
8,
198,
220,
220,
2488,
9288,
3042,
10455,
7,
75,
8,
6624,
3042,
10455,
7,
75,
20,
8,
198,
220,
220,
2488,
9288,
300,
13,
9464,
6624,
300,
20,
13,
9464,
198,
220,
220,
2488,
9288,
300,
13,
3506,
6624,
300,
20,
13,
3506,
198,
220,
220,
2488,
9288,
300,
13,
22487,
6624,
300,
20,
13,
22487,
198,
220,
220,
2488,
9288,
300,
13,
4852,
6624,
300,
20,
13,
4852,
198,
437,
198,
198,
437
] | 2.040984 | 488 |
"String for unit multiplier in option line"
const unitstrings = Dict{ Float64, String }(
1e0 => "Hz",
1e3 => "kHz",
1e6 => "MHz",
1e9 => "GHz"
)
"Default unit value to use in option line."
const default_unit_value = 1e9
"Strings for parameter format symbols in option line."
const parameterstrings = Dict{ Symbol, String }(
:ScatteringParameters => "S",
:AdmittanceParameters => "Y",
:ImpedanceParameters => "Z",
:HybridHParameters => "H",
:HybridGParameters => "G",
)
"Defaoult parameter format symbo to use in option line."
const default_parameter_symbol = :ScatteringParameters
"String for data format symbols in option line."
const formatstrings = Dict{ Symbol, String }(
:DecibelAngle => "dB",
:MagnitudeAngle => "MA",
:RealImaginary => "RI"
)
"Default data format symbol to use in option line."
const default_format_symbol = :MagnitudeAngle
"Default characteristic iimpedance to use in option line."
const default_resistance_string = "50"
"""
write_comment_line( comment )
Returns a comment line string for a comment.
"""
write_comment_line( comment ) = "!" * comment
"""
write_frequency_unit_option( [ value ] )
Returns an option line string for a valid frequency unit multiplier.
"""
write_frequency_unit_option( value = default_unit_value ) = unitstrings[ value ]
"""
write_parameter_option( [ symbol ] )
Returns an option line string for a valid parameter option symbol.
"""
write_parameter_option( symbol = default_parameter_symbol ) = parameterstrings[ symbol ]
"""
write_format_option( [ symbol ] )
Returns an option line string for a valid data format symbol.
"""
write_format_option( symbol = default_format_symbol ) = formatstrings[ symbol ]
"""
write_resistance_option( [ resistance ] )
Returns an option line string for the characteristic impedance.
"""
write_resistance_option( resistance = 50 ) = string( resistance )
"""
write_option_line( [ options ] )
Returns the option line string for an option structure.
"""
function write_option_line( options::Options = Options() )
"# " *
write_frequency_unit_option( options.unit ) * " " *
write_parameter_option( options.parameter ) * " " *
write_format_option( options.format ) * " " *
"R " * write_resistance_option( options.resistance )
end
"""
compstring( z )
Returns a pair with the real and imaginary components of a complex number.
"""
compstring( z ) = string( real( z ) ) * " " * string( imag( z ) )
"""
comp2ma( z )
Returns a pair with the linear magnitude and angle in degrees of a complex number.
"""
comp2ma( z ) = ( abs( z ), rad2deg( angle( z ) ) )
"""
comp2da( z )
Returns a pair with the magnitude in dB and angle in degrees of a complex number.
"""
function comp2da( z )
m, a = comp2ma( z )
20log10( m ), a
end
"""
pairstring( pair )
Returns a string combining the components of a pair.
"""
pairstring( pair ) = string( pair[ 1 ] ) * " " * string( pair[ 2 ] )
"""
mastring( z )
Returns a string in magnitude / angle format of a complex number.
"""
mastring( z ) = pairstring( comp2ma( z ) )
"""
dastring( z )
Returns a string in dB / angle format of a complex number.
"""
dastring( z ) = pairstring( comp2da( z ) )
"Holds conversion functions for parameter format symbols when writing."
const WriteConversions = Dict{ Symbol, Function }(
:RealImaginary => compstring,
:MagnitudeAngle => mastring,
:DecibelAngle => dastring
)
"""
write_data( data, N [ options ] )
Returns a string for N-port Touchstone formated lines for a data point.
"""
function write_data( data::DataPoint, N::Integer, options::Options = Options() )
freqstring = string( data.frequency / options.unit )
if N == 2
paras = reshape( data.parameter, 1, 4 )
lines = 1
else
paras = data.parameter
lines = N
end
if options.parameter == :ImpedanceParameters
paras = map( x -> x / options.resistance, paras )
end
if options.parameter == :AdmittanceParameters
paras = map( x -> x * options.resistance, paras )
end
if N == 2
if options.parameter == :HybridGParameters
paras[ 1 ] *= options.resistance
paras[ 4 ] /= options.resistance
end
if options.parameter == :HybridHParameters
paras[ 1 ] /= options.resistance
paras[ 4 ] *= options.resistance
end
end
strings = map( snn -> WriteConversions[ options.format ]( snn ), paras )
datastrings = ones( String, lines )
for row in 1:lines
# V 1.0 not more than 4 pairs ( + freq ) in a line
if N > 4
for col in 1:N
if col > 0 && col % 4 == 0
strings[ row, col ] *= "\n"
end
end
end
datastrings[ row ] = replace( join( strings[ row, : ], " " ), "\n " => "\n" )
end
datastrings[ 1 ] = freqstring * " " * datastrings[ 1 ]
datastring = join( datastrings, "\n" )
if datastring[ end ] == "\n"
return datastring
else
return datastring * "\n"
end
end
function writeNoiseData( nd::NoiseDataPoint, options::Options = Options(), version = 1 )
freqstring = string( nd.frequency / options.unit )
noisefigstring = 20log10( nd.minNoiseFigure )
reflcoeffstring = mastring( nd.reflCoeff )
effnoiseresstring = version == 1 ? string( nd.effNoiseRes / options.resistance ) : string( nd.effNoiseRes )
res = "$freqstring $noisefigstring $reflcoeffstring $effnoiseresstring\n"
return res
end
"""
write_touchstone_stream( stream, ts )
Writes formated Touchstone data for a TouchstoneData structure to a stream.
"""
function write_touchstone_stream( stream::IO, ts::TouchstoneData )
for comment in ts.comments
write( stream, write_comment_line( comment ) )
write( stream, "\n" )
end
write( stream, write_option_line( ts.options ) )
write( stream, "\n" )
#
# ports = -1
# if size( ts.data, 1 ) > 0
# ports = size( ts.data[ 1 ].parameter, 1 )
# end
#
for datapoint in ts.data
write( stream, write_data( datapoint, ports( ts ), ts.options ) )
end
for ndp in ts.noiseData
write( stream, writeNoiseData( ndp, ts.options ) )
end
end
"""
write_touchstone_string( ts )
Returns a string with formated Touchstone data for a TouchstoneData structure.
"""
function write_touchstone_string( ts::TouchstoneData )
buffer = IOBuffer()
write_touchstone_stream( buffer, ts )
String( take!( copy( buffer ) ) )
end
"""
write_touchstone_file( filename, ts )
Writes formated Touchstone data for a TouchstoneData structure to a file.
"""
function write_touchstone_file( filename::String, ts::TouchstoneData )
open( filename, "w" ) do io
write_touchstone_stream( io, ts )
end
end
| [
1,
10100,
329,
4326,
33090,
287,
3038,
1627,
1,
198,
9979,
4326,
37336,
796,
360,
713,
90,
48436,
2414,
11,
10903,
1782,
7,
198,
220,
352,
68,
15,
5218,
366,
7399,
1600,
198,
220,
352,
68,
18,
5218,
366,
44191,
1600,
198,
220,
352,
68,
21,
5218,
366,
25983,
1600,
198,
220,
352,
68,
24,
5218,
366,
23741,
1,
198,
8,
198,
1,
19463,
4326,
1988,
284,
779,
287,
3038,
1627,
526,
198,
9979,
4277,
62,
20850,
62,
8367,
796,
352,
68,
24,
198,
198,
1,
13290,
654,
329,
11507,
5794,
14354,
287,
3038,
1627,
526,
198,
9979,
11507,
37336,
796,
360,
713,
90,
38357,
11,
10903,
1782,
7,
198,
220,
1058,
3351,
16475,
48944,
220,
220,
5218,
366,
50,
1600,
198,
220,
1058,
2782,
20124,
590,
48944,
220,
220,
5218,
366,
56,
1600,
198,
220,
1058,
26950,
276,
590,
48944,
220,
220,
220,
5218,
366,
57,
1600,
198,
220,
1058,
21217,
10236,
39,
48944,
220,
220,
220,
220,
220,
5218,
366,
39,
1600,
198,
220,
1058,
21217,
10236,
38,
48944,
220,
220,
220,
220,
220,
5218,
366,
38,
1600,
198,
8,
198,
1,
7469,
64,
25955,
11507,
5794,
5307,
78,
284,
779,
287,
3038,
1627,
526,
198,
9979,
4277,
62,
17143,
2357,
62,
1837,
23650,
796,
1058,
3351,
16475,
48944,
198,
198,
1,
10100,
329,
1366,
5794,
14354,
287,
3038,
1627,
526,
198,
9979,
5794,
37336,
796,
360,
713,
90,
38357,
11,
10903,
1782,
7,
198,
1058,
10707,
43837,
13450,
293,
220,
220,
220,
220,
220,
5218,
366,
36077,
1600,
198,
1058,
48017,
3984,
13450,
293,
220,
220,
220,
5218,
366,
5673,
1600,
198,
1058,
15633,
3546,
363,
3219,
220,
220,
220,
220,
5218,
366,
7112,
1,
198,
8,
198,
1,
19463,
1366,
5794,
6194,
284,
779,
287,
3038,
1627,
526,
198,
9979,
4277,
62,
18982,
62,
1837,
23650,
796,
1058,
48017,
3984,
13450,
293,
198,
198,
1,
19463,
16704,
1312,
320,
9124,
590,
284,
779,
287,
3038,
1627,
526,
198,
9979,
4277,
62,
411,
9311,
62,
8841,
796,
366,
1120,
1,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
23893,
62,
1370,
7,
2912,
1267,
198,
198,
35561,
257,
2912,
1627,
4731,
329,
257,
2912,
13,
198,
37811,
198,
13564,
62,
23893,
62,
1370,
7,
2912,
1267,
796,
366,
2474,
1635,
2912,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
35324,
62,
20850,
62,
18076,
7,
685,
1988,
2361,
1267,
198,
198,
35561,
281,
3038,
1627,
4731,
329,
257,
4938,
8373,
4326,
33090,
13,
198,
37811,
198,
13564,
62,
35324,
62,
20850,
62,
18076,
7,
1988,
796,
4277,
62,
20850,
62,
8367,
1267,
796,
4326,
37336,
58,
1988,
2361,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
17143,
2357,
62,
18076,
7,
685,
6194,
2361,
1267,
198,
198,
35561,
281,
3038,
1627,
4731,
329,
257,
4938,
11507,
3038,
6194,
13,
198,
37811,
198,
13564,
62,
17143,
2357,
62,
18076,
7,
6194,
796,
4277,
62,
17143,
2357,
62,
1837,
23650,
1267,
796,
11507,
37336,
58,
6194,
2361,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
18982,
62,
18076,
7,
685,
6194,
2361,
1267,
198,
198,
35561,
281,
3038,
1627,
4731,
329,
257,
4938,
1366,
5794,
6194,
13,
198,
37811,
198,
13564,
62,
18982,
62,
18076,
7,
6194,
796,
4277,
62,
18982,
62,
1837,
23650,
1267,
796,
5794,
37336,
58,
6194,
2361,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
411,
9311,
62,
18076,
7,
685,
6625,
2361,
1267,
198,
198,
35561,
281,
3038,
1627,
4731,
329,
262,
16704,
47472,
13,
198,
37811,
198,
13564,
62,
411,
9311,
62,
18076,
7,
6625,
796,
2026,
1267,
796,
4731,
7,
6625,
1267,
628,
198,
37811,
198,
220,
220,
220,
220,
3551,
62,
18076,
62,
1370,
7,
685,
3689,
2361,
1267,
198,
198,
35561,
262,
3038,
1627,
4731,
329,
281,
3038,
4645,
13,
198,
37811,
198,
8818,
3551,
62,
18076,
62,
1370,
7,
3689,
3712,
29046,
796,
18634,
3419,
1267,
198,
220,
25113,
366,
1635,
198,
220,
3551,
62,
35324,
62,
20850,
62,
18076,
7,
3689,
13,
20850,
1267,
1635,
366,
366,
1635,
198,
220,
3551,
62,
17143,
2357,
62,
18076,
7,
3689,
13,
17143,
2357,
1267,
1635,
366,
366,
1635,
198,
220,
3551,
62,
18982,
62,
18076,
7,
3689,
13,
18982,
1267,
1635,
366,
366,
1635,
198,
220,
366,
49,
366,
1635,
3551,
62,
411,
9311,
62,
18076,
7,
3689,
13,
411,
9311,
1267,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
552,
8841,
7,
1976,
1267,
198,
198,
35561,
257,
5166,
351,
262,
1103,
290,
26726,
6805,
286,
257,
3716,
1271,
13,
198,
37811,
198,
5589,
8841,
7,
1976,
1267,
796,
4731,
7,
1103,
7,
1976,
1267,
1267,
1635,
366,
366,
1635,
4731,
7,
3590,
7,
1976,
1267,
1267,
198,
198,
37811,
198,
220,
220,
220,
552,
17,
2611,
7,
1976,
1267,
198,
198,
35561,
257,
5166,
351,
262,
14174,
14735,
290,
9848,
287,
7370,
286,
257,
3716,
1271,
13,
198,
37811,
198,
5589,
17,
2611,
7,
1976,
1267,
796,
357,
2352,
7,
1976,
10612,
2511,
17,
13500,
7,
9848,
7,
1976,
1267,
1267,
1267,
198,
198,
37811,
198,
220,
220,
220,
552,
17,
6814,
7,
1976,
1267,
198,
198,
35561,
257,
5166,
351,
262,
14735,
287,
30221,
290,
9848,
287,
7370,
286,
257,
3716,
1271,
13,
198,
37811,
198,
8818,
552,
17,
6814,
7,
1976,
1267,
198,
220,
285,
11,
257,
796,
552,
17,
2611,
7,
1976,
1267,
198,
220,
1160,
6404,
940,
7,
285,
10612,
257,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
14187,
667,
1806,
7,
5166,
1267,
198,
198,
35561,
257,
4731,
19771,
262,
6805,
286,
257,
5166,
13,
198,
37811,
198,
8957,
667,
1806,
7,
5166,
1267,
796,
4731,
7,
5166,
58,
352,
2361,
1267,
1635,
366,
366,
1635,
4731,
7,
5166,
58,
362,
2361,
1267,
198,
198,
37811,
198,
220,
220,
220,
17288,
1806,
7,
1976,
1267,
198,
198,
35561,
257,
4731,
287,
14735,
1220,
9848,
5794,
286,
257,
3716,
1271,
13,
198,
37811,
198,
47616,
1806,
7,
1976,
1267,
796,
14187,
667,
1806,
7,
552,
17,
2611,
7,
1976,
1267,
1267,
198,
198,
37811,
198,
220,
220,
220,
288,
459,
1806,
7,
1976,
1267,
198,
198,
35561,
257,
4731,
287,
30221,
1220,
9848,
5794,
286,
257,
3716,
1271,
13,
198,
37811,
198,
67,
459,
1806,
7,
1976,
1267,
796,
14187,
667,
1806,
7,
552,
17,
6814,
7,
1976,
1267,
1267,
198,
198,
1,
39,
10119,
11315,
5499,
329,
11507,
5794,
14354,
618,
3597,
526,
198,
9979,
19430,
3103,
47178,
796,
360,
713,
90,
38357,
11,
15553,
1782,
7,
198,
220,
1058,
15633,
3546,
363,
3219,
220,
5218,
552,
8841,
11,
198,
220,
1058,
48017,
3984,
13450,
293,
5218,
17288,
1806,
11,
198,
220,
1058,
10707,
43837,
13450,
293,
220,
220,
5218,
288,
459,
1806,
198,
8,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
7890,
7,
1366,
11,
399,
685,
3689,
2361,
1267,
198,
198,
35561,
257,
4731,
329,
399,
12,
634,
15957,
6440,
1296,
515,
3951,
329,
257,
1366,
966,
13,
198,
37811,
198,
8818,
3551,
62,
7890,
7,
1366,
3712,
6601,
12727,
11,
399,
3712,
46541,
11,
3689,
3712,
29046,
796,
18634,
3419,
1267,
198,
220,
2030,
80,
8841,
796,
4731,
7,
1366,
13,
35324,
1220,
3689,
13,
20850,
1267,
198,
220,
611,
399,
6624,
362,
198,
220,
220,
220,
17850,
796,
27179,
1758,
7,
1366,
13,
17143,
2357,
11,
352,
11,
604,
1267,
198,
220,
220,
220,
3951,
796,
352,
198,
220,
2073,
198,
220,
220,
220,
17850,
796,
1366,
13,
17143,
2357,
198,
220,
220,
220,
3951,
796,
399,
198,
220,
886,
198,
220,
611,
3689,
13,
17143,
2357,
6624,
1058,
26950,
276,
590,
48944,
198,
220,
220,
220,
17850,
796,
3975,
7,
2124,
4613,
2124,
1220,
3689,
13,
411,
9311,
11,
17850,
1267,
198,
220,
886,
198,
220,
611,
3689,
13,
17143,
2357,
6624,
1058,
2782,
20124,
590,
48944,
198,
220,
220,
220,
17850,
796,
3975,
7,
2124,
4613,
2124,
1635,
3689,
13,
411,
9311,
11,
17850,
1267,
198,
220,
886,
198,
220,
611,
399,
6624,
362,
198,
220,
220,
220,
611,
3689,
13,
17143,
2357,
6624,
1058,
21217,
10236,
38,
48944,
198,
220,
220,
220,
220,
220,
17850,
58,
352,
2361,
1635,
28,
3689,
13,
411,
9311,
198,
220,
220,
220,
220,
220,
17850,
58,
604,
2361,
1220,
28,
3689,
13,
411,
9311,
198,
220,
220,
220,
886,
198,
220,
220,
220,
611,
3689,
13,
17143,
2357,
6624,
1058,
21217,
10236,
39,
48944,
198,
220,
220,
220,
220,
220,
17850,
58,
352,
2361,
1220,
28,
3689,
13,
411,
9311,
198,
220,
220,
220,
220,
220,
17850,
58,
604,
2361,
1635,
28,
3689,
13,
411,
9311,
198,
220,
220,
220,
886,
198,
220,
886,
198,
220,
13042,
796,
3975,
7,
3013,
77,
4613,
19430,
3103,
47178,
58,
3689,
13,
18982,
2361,
7,
3013,
77,
10612,
17850,
1267,
198,
220,
4818,
459,
33173,
796,
3392,
7,
10903,
11,
3951,
1267,
198,
220,
329,
5752,
287,
352,
25,
6615,
198,
220,
220,
220,
1303,
569,
352,
13,
15,
407,
517,
621,
604,
14729,
357,
1343,
2030,
80,
1267,
287,
257,
1627,
198,
220,
220,
220,
611,
399,
1875,
604,
198,
220,
220,
220,
220,
220,
329,
951,
287,
352,
25,
45,
198,
220,
220,
220,
220,
220,
220,
220,
611,
951,
1875,
657,
11405,
951,
4064,
604,
6624,
657,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
13042,
58,
5752,
11,
951,
2361,
1635,
28,
37082,
77,
1,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
4818,
459,
33173,
58,
5752,
2361,
796,
6330,
7,
4654,
7,
13042,
58,
5752,
11,
1058,
16589,
366,
366,
10612,
37082,
77,
366,
5218,
37082,
77,
1,
1267,
198,
220,
886,
198,
220,
4818,
459,
33173,
58,
352,
2361,
796,
2030,
80,
8841,
1635,
366,
366,
1635,
4818,
459,
33173,
58,
352,
2361,
198,
220,
4818,
459,
1806,
796,
4654,
7,
4818,
459,
33173,
11,
37082,
77,
1,
1267,
198,
220,
611,
4818,
459,
1806,
58,
886,
2361,
6624,
37082,
77,
1,
198,
220,
220,
220,
1441,
4818,
459,
1806,
198,
220,
2073,
198,
220,
220,
220,
1441,
4818,
459,
1806,
1635,
37082,
77,
1,
198,
220,
886,
198,
437,
198,
198,
8818,
3551,
2949,
786,
6601,
7,
299,
67,
3712,
2949,
786,
6601,
12727,
11,
3689,
3712,
29046,
796,
18634,
22784,
2196,
796,
352,
1267,
198,
220,
2030,
80,
8841,
796,
4731,
7,
299,
67,
13,
35324,
1220,
3689,
13,
20850,
1267,
198,
220,
7838,
5647,
8841,
796,
1160,
6404,
940,
7,
299,
67,
13,
1084,
2949,
786,
11337,
1267,
198,
220,
1006,
75,
1073,
14822,
8841,
796,
17288,
1806,
7,
299,
67,
13,
260,
2704,
34,
2577,
487,
1267,
198,
220,
914,
3919,
786,
411,
8841,
796,
2196,
6624,
352,
5633,
4731,
7,
299,
67,
13,
14822,
2949,
786,
4965,
1220,
3689,
13,
411,
9311,
1267,
1058,
4731,
7,
299,
67,
13,
14822,
2949,
786,
4965,
1267,
198,
220,
581,
796,
17971,
19503,
80,
8841,
720,
3919,
786,
5647,
8841,
720,
260,
2704,
1073,
14822,
8841,
720,
14822,
3919,
786,
411,
8841,
59,
77,
1,
198,
220,
1441,
581,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
29332,
6440,
62,
5532,
7,
4269,
11,
40379,
1267,
198,
198,
20257,
274,
1296,
515,
15957,
6440,
1366,
329,
257,
15957,
6440,
6601,
4645,
284,
257,
4269,
13,
198,
37811,
198,
8818,
3551,
62,
29332,
6440,
62,
5532,
7,
4269,
3712,
9399,
11,
40379,
3712,
35211,
6440,
6601,
1267,
198,
220,
329,
2912,
287,
40379,
13,
15944,
198,
220,
220,
220,
3551,
7,
4269,
11,
3551,
62,
23893,
62,
1370,
7,
2912,
1267,
1267,
198,
220,
220,
220,
3551,
7,
4269,
11,
37082,
77,
1,
1267,
198,
220,
886,
628,
220,
3551,
7,
4269,
11,
3551,
62,
18076,
62,
1370,
7,
40379,
13,
25811,
1267,
1267,
198,
220,
3551,
7,
4269,
11,
37082,
77,
1,
1267,
198,
220,
1303,
198,
220,
1303,
14090,
796,
532,
16,
198,
220,
1303,
611,
2546,
7,
40379,
13,
7890,
11,
352,
1267,
1875,
657,
198,
220,
1303,
220,
220,
14090,
796,
2546,
7,
40379,
13,
7890,
58,
352,
20740,
17143,
2357,
11,
352,
1267,
198,
220,
1303,
886,
198,
220,
1303,
198,
220,
329,
4818,
499,
1563,
287,
40379,
13,
7890,
198,
220,
220,
220,
3551,
7,
4269,
11,
3551,
62,
7890,
7,
4818,
499,
1563,
11,
14090,
7,
40379,
10612,
40379,
13,
25811,
1267,
1267,
198,
220,
886,
198,
220,
329,
299,
26059,
287,
40379,
13,
3919,
786,
6601,
198,
220,
220,
220,
3551,
7,
4269,
11,
3551,
2949,
786,
6601,
7,
299,
26059,
11,
40379,
13,
25811,
1267,
1267,
198,
220,
886,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
29332,
6440,
62,
8841,
7,
40379,
1267,
198,
198,
35561,
257,
4731,
351,
1296,
515,
15957,
6440,
1366,
329,
257,
15957,
6440,
6601,
4645,
13,
198,
37811,
198,
8818,
3551,
62,
29332,
6440,
62,
8841,
7,
40379,
3712,
35211,
6440,
6601,
1267,
198,
220,
11876,
796,
314,
9864,
13712,
3419,
198,
220,
3551,
62,
29332,
6440,
62,
5532,
7,
11876,
11,
40379,
1267,
198,
220,
10903,
7,
1011,
0,
7,
4866,
7,
11876,
1267,
1267,
1267,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
3551,
62,
29332,
6440,
62,
7753,
7,
29472,
11,
40379,
1267,
198,
198,
20257,
274,
1296,
515,
15957,
6440,
1366,
329,
257,
15957,
6440,
6601,
4645,
284,
257,
2393,
13,
198,
37811,
198,
8818,
3551,
62,
29332,
6440,
62,
7753,
7,
29472,
3712,
10100,
11,
40379,
3712,
35211,
6440,
6601,
1267,
198,
220,
1280,
7,
29472,
11,
366,
86,
1,
1267,
466,
33245,
198,
220,
220,
220,
3551,
62,
29332,
6440,
62,
5532,
7,
33245,
11,
40379,
1267,
198,
220,
886,
198,
437,
198
] | 2.926269 | 2,265 |
using Decimals
using Compat.Test
@testset "Decimal constructor" begin
@test isa(d, Array{Decimal,1})
end
| [
3500,
4280,
320,
874,
198,
3500,
3082,
265,
13,
14402,
198,
198,
31,
9288,
2617,
366,
10707,
4402,
23772,
1,
2221,
198,
198,
31,
9288,
318,
64,
7,
67,
11,
15690,
90,
10707,
4402,
11,
16,
30072,
198,
198,
437,
198
] | 2.634146 | 41 |
"""
gcmarray{T, N}
gcmarray data structure. Available constructors:
```
gcmarray{T,N}(grid::gcmgrid,f::Array{Array{T,2},N},
fSize::Array{NTuple{N, Int}},fIndex::Array{Int,1})
gcmarray(grid::gcmgrid,f::Array{Array{T,2},N}) where {T,N}
gcmarray(grid::gcmgrid,f::Array{Array{T,N},1}) where {T,N}
gcmarray(grid::gcmgrid,fSize::Array{NTuple{N, Int}},fIndex::Array{Int,1})
gcmarray(<same as above>,n3::Int)
gcmarray(<same as above>,n3::Int,n4::Int)
gcmarray(grid::gcmgrid)
gcmarray(grid::gcmgrid,::Type{T})
gcmarray(grid::gcmgrid,::Type{T},n3::Int)
gcmarray(grid::gcmgrid,::Type{T},n3::Int,n4::Int)
```
"""
struct gcmarray{T, N} <: AbstractMeshArray{T, N}
grid::gcmgrid
f::Array{Array{T,2},N}
fSize::Array{NTuple{2, Int}}
fIndex::Array{Int,1}
end
function gcmarray(grid::gcmgrid,f::Array{Array{T,2},N}) where {T, N}
gcmarray{T,N}(grid,f,grid.fSize,collect(1:grid.nFaces))
end
function gcmarray(grid::gcmgrid,f::Array{Array{T,N},1}) where {T, N}
nFaces=grid.nFaces
if N>2
n3=size(f[1],3); n4=size(f[1],4);
g=Array{Array{T,2},3}(undef,nFaces,n3,n4)
for I in eachindex(view(g,1:nFaces,1:n3,1:n4))
g[I]=view(f[I[1]],:,:,I[2],I[3])
end
n4==1 ? g=dropdims(g,dims=3) : nothing
gcmarray{T,ndims(g)}(grid,g,grid.fSize,collect(1:nFaces))
else
gcmarray{T,1}(grid,f,grid.fSize,collect(1:nFaces))
end
end
function gcmarray(grid::gcmgrid,::Type{T},
fSize::Union{Array{NTuple{2, Int},1},NTuple{2, Int}},
fIndex::Union{Array{Int,1},Int}) where {T}
nFaces=length(fIndex)
f=Array{Array{T,2},1}(undef,nFaces)
isa(fSize,NTuple) ? fSize=[fSize] : nothing
isa(fIndex,Int) ? fIndex=[fIndex] : nothing
for a=1:nFaces
f[a]=Array{T}(undef,fSize[a])
end
gcmarray{T,1}(grid,f,fSize,fIndex)
end
function gcmarray(grid::gcmgrid,::Type{T},
fSize::Union{Array{NTuple{2, Int},1},NTuple{2, Int}},
fIndex::Union{Array{Int,1},Int},n3::Int) where {T}
nFaces=length(fIndex)
f=Array{Array{T,2},2}(undef,nFaces,n3)
isa(fSize,NTuple) ? fSize=[fSize] : nothing
isa(fIndex,Int) ? fIndex=[fIndex] : nothing
for a=1:nFaces; for i3=1:n3;
f[a,i3]=Array{T}(undef,fSize[a]...)
end; end;
gcmarray{T,2}(grid,f,fSize,fIndex)
end
function gcmarray(grid::gcmgrid,::Type{T},
fSize::Union{Array{NTuple{2, Int},1},NTuple{2, Int}},
fIndex::Union{Array{Int,1},Int},n3::Int,n4::Int) where {T}
nFaces=length(fIndex)
f=Array{Array{T,2},3}(undef,nFaces,n3,n4)
isa(fSize,NTuple) ? fSize=[fSize] : nothing
isa(fIndex,Int) ? fIndex=[fIndex] : nothing
for a=1:nFaces; for i4=1:n4; for i3=1:n3;
f[a,i3,i4]=Array{T}(undef,fSize[a]...)
end; end; end;
gcmarray{T,3}(grid,f,fSize,fIndex)
end
# +
function gcmarray(grid::gcmgrid)
nFaces=grid.nFaces
fSize=grid.fSize
fIndex=collect(1:grid.nFaces)
T=grid.ioPrec
gcmarray(grid,T,fSize,fIndex)
end
function gcmarray(grid::gcmgrid,::Type{T}) where {T}
nFaces=grid.nFaces
fSize=grid.fSize
fIndex=collect(1:grid.nFaces)
gcmarray(grid,T,fSize,fIndex)
end
function gcmarray(grid::gcmgrid,::Type{T},n3::Int) where {T}
nFaces=grid.nFaces
fSize=grid.fSize
fIndex=collect(1:grid.nFaces)
gcmarray(grid,T,fSize,fIndex,n3)
end
function gcmarray(grid::gcmgrid,::Type{T},n3::Int,n4::Int) where {T}
nFaces=grid.nFaces
fSize=grid.fSize
fIndex=collect(1:grid.nFaces)
gcmarray(grid,T,fSize,fIndex,n3,n4)
end
# -
# # Interface Methods
# +
Base.size(A::gcmarray) = size(A.f)
Base.size(A::gcmarray, dim::Integer) = size(A)[dim]
# +
function Base.getindex(A::gcmarray{T, N}, I::Vararg{Union{Int,Array{Int},AbstractUnitRange,Colon}, N}) where {T,N}
J=1:length(A.fIndex)
!isa(I[1],Colon) ? J=J[I[1]] : nothing
nFaces=length(J)
tmpf=A.f[I...]
if isa(tmpf,Array{eltype(A),2})
tmp=tmpf
else
n3=Int(length(tmpf)/nFaces)
K=(A.grid,eltype(A),A.fSize[J],A.fIndex[J])
n3>1 ? tmp=gcmarray(K...,n3) : tmp=gcmarray(K...)
for I in eachindex(tmpf); tmp.f[I] = view(tmpf[I],:,:); end
end
return tmp
end
"""
getindexetc(A::gcmarray, I::Vararg{_}) where {T,N}
Same as getindex but also returns the face size and index
"""
function getindexetc(A::gcmarray{T, N}, I::Vararg{Union{Int,Array{Int},AbstractUnitRange,Colon}, N}) where {T,N}
f=A[I...]
fSize=A.fSize[I[1]]
fIndex=A.fIndex[I[1]]
return f,fSize,fIndex
end
# -
function Base.setindex!(A::gcmarray{T, N}, v, I::Vararg{Int, N}) where {T,N}
return (A.f[I...] = v)
end
function Base.view(A::gcmarray{T, N}, I::Vararg{Union{Int,AbstractUnitRange,Colon}, N}) where {T,N}
J=1:length(A.fIndex)
!isa(I[1],Colon) ? J=J[I[1]] : nothing
nFaces=length(J)
tmpf=view(A.f,I...)
n3=Int(length(tmpf)/nFaces) #length(tmpf)>nFaces ? n3=Int(length(tmpf)/nFaces) : n3=1
K=(A.grid,eltype(A),A.fSize[J],A.fIndex[J])
n3>1 ? tmp=gcmarray(K...,n3) : tmp=gcmarray(K...)
for I in eachindex(tmpf); tmp.f[I] = view(tmpf[I],:,:); end
return tmp
end
# ### Custom pretty-printing, similar, and broadcast
function Base.show(io::IO, z::gcmarray{T, N}) where {T,N}
printstyled(io, " gcmarray \n",color=:normal)
printstyled(io, " grid type = ",color=:normal)
printstyled(io, "$(z.grid.class)\n",color=:blue)
printstyled(io, " data type = ",color=:normal)
printstyled(io, "$(eltype(z))\n",color=:blue)
printstyled(io, " tile array = ",color=:normal)
printstyled(io, "$(size(z))\n",color=:blue)
printstyled(io, " tile sizes = ",color=:normal)
printstyled(io, "$(size(z[1]))\n",color=:blue)
for iFace=2:length(z.fIndex)
printstyled(io, " ",color=:normal)
printstyled(io, "$(size(z[iFace]))\n",color=:blue)
end
return
end
function Base.similar(A::gcmarray)
if ndims(A)==1
B=gcmarray(A.grid,eltype(A),A.fSize,A.fIndex)
else
B=gcmarray(A.grid,eltype(A),A.fSize,A.fIndex,size(A,2))
end
return B
end
# ### Customize broadcasting
Base.BroadcastStyle(::Type{<:gcmarray}) = Broadcast.ArrayStyle{gcmarray}()
function Base.similar(bc::Broadcast.Broadcasted{Broadcast.ArrayStyle{gcmarray}}, ::Type{ElType}) where ElType
# Scan the inputs for the gcmarray:
A = find_gcmarray(bc)
# Create the gcmarray output:
if ndims(A)==1
B=gcmarray(A.grid,ElType,A.fSize,A.fIndex)
else
B=gcmarray(A.grid,ElType,A.fSize,A.fIndex,size(A,2))
end
return B
end
find_gcmarray(bc::Base.Broadcast.Broadcasted) = find_gcmarray(bc.args)
find_gcmarray(args::Tuple) = find_gcmarray(find_gcmarray(args[1]), Base.tail(args))
find_gcmarray(x) = x
find_gcmarray(a::gcmarray, rest) = a
find_gcmarray(::Any, rest) = find_gcmarray(rest)
####
import Base: copyto!
# Specialize this method if all you want to do is specialize on typeof(dest)
@inline function copyto!(dest::MeshArrays.gcmarray, bc::Broadcast.Broadcasted{Nothing})
axes(dest) == axes(bc) || throwdm(axes(dest), axes(bc))
# Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
if bc.f === identity && bc.args isa Tuple{AbstractArray} # only a single input argument to broadcast!
A = bc.args[1]
if axes(dest) == axes(A)
return copyto!(dest, A)
end
end
bc′ = Broadcast.preprocess(dest, bc)
@simd for I in eachindex(bc′)
#@inbounds dest[I] = bc′[I]
@inbounds dest[I] = gcmarray_getindex_evalf(bc′,I)
end
return dest
end
function gcmarray_getindex_evalf(bc,I)
@boundscheck checkbounds(bc, I)
args = Broadcast._getindex(bc.args, I)
return bc.f.(args...)
end
###
"""
nFacesEtc(a::gcmarray)
Return nFaces, n3 (1 in 2D case; >1 otherwise)
"""
function nFacesEtc(a::gcmarray)
nFaces=length(a.fIndex)
ndims(a.f)>1 ? n3=size(a.f,2) : n3=1
ndims(a.f)>2 ? n4=size(a.f,3) : n4=1
return nFaces, n3, n4
end
| [
198,
37811,
198,
220,
220,
220,
308,
66,
3876,
2433,
90,
51,
11,
399,
92,
198,
198,
36484,
3876,
2433,
1366,
4645,
13,
14898,
5678,
669,
25,
198,
198,
15506,
63,
198,
36484,
3876,
2433,
90,
51,
11,
45,
92,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
3712,
19182,
90,
19182,
90,
51,
11,
17,
5512,
45,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
220,
277,
10699,
3712,
19182,
90,
11251,
29291,
90,
45,
11,
2558,
92,
5512,
69,
15732,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
3712,
19182,
90,
19182,
90,
51,
11,
17,
5512,
45,
30072,
810,
1391,
51,
11,
45,
92,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
3712,
19182,
90,
19182,
90,
51,
11,
45,
5512,
16,
30072,
810,
1391,
51,
11,
45,
92,
198,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
10699,
3712,
19182,
90,
11251,
29291,
90,
45,
11,
2558,
92,
5512,
69,
15732,
3712,
19182,
90,
5317,
11,
16,
30072,
198,
36484,
3876,
2433,
7,
27,
31642,
355,
2029,
22330,
77,
18,
3712,
5317,
8,
198,
36484,
3876,
2433,
7,
27,
31642,
355,
2029,
22330,
77,
18,
3712,
5317,
11,
77,
19,
3712,
5317,
8,
198,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
8,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
30072,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
77,
18,
3712,
5317,
8,
198,
36484,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
77,
18,
3712,
5317,
11,
77,
19,
3712,
5317,
8,
198,
15506,
63,
198,
37811,
198,
7249,
308,
66,
3876,
2433,
90,
51,
11,
399,
92,
1279,
25,
27741,
37031,
19182,
90,
51,
11,
399,
92,
198,
220,
220,
10706,
3712,
70,
11215,
25928,
198,
220,
220,
277,
3712,
19182,
90,
19182,
90,
51,
11,
17,
5512,
45,
92,
198,
220,
220,
277,
10699,
3712,
19182,
90,
11251,
29291,
90,
17,
11,
2558,
11709,
198,
220,
220,
277,
15732,
3712,
19182,
90,
5317,
11,
16,
92,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
3712,
19182,
90,
19182,
90,
51,
11,
17,
5512,
45,
30072,
810,
1391,
51,
11,
399,
92,
198,
220,
308,
66,
3876,
2433,
90,
51,
11,
45,
92,
7,
25928,
11,
69,
11,
25928,
13,
69,
10699,
11,
33327,
7,
16,
25,
25928,
13,
77,
37,
2114,
4008,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
69,
3712,
19182,
90,
19182,
90,
51,
11,
45,
5512,
16,
30072,
810,
1391,
51,
11,
399,
92,
198,
220,
299,
37,
2114,
28,
25928,
13,
77,
37,
2114,
198,
220,
611,
399,
29,
17,
198,
220,
220,
220,
299,
18,
28,
7857,
7,
69,
58,
16,
4357,
18,
1776,
299,
19,
28,
7857,
7,
69,
58,
16,
4357,
19,
1776,
198,
220,
220,
220,
308,
28,
19182,
90,
19182,
90,
51,
11,
17,
5512,
18,
92,
7,
917,
891,
11,
77,
37,
2114,
11,
77,
18,
11,
77,
19,
8,
198,
220,
220,
220,
329,
314,
287,
1123,
9630,
7,
1177,
7,
70,
11,
16,
25,
77,
37,
2114,
11,
16,
25,
77,
18,
11,
16,
25,
77,
19,
4008,
198,
220,
220,
220,
220,
220,
308,
58,
40,
22241,
1177,
7,
69,
58,
40,
58,
16,
60,
4357,
45299,
45299,
40,
58,
17,
4357,
40,
58,
18,
12962,
198,
220,
220,
220,
886,
198,
220,
220,
220,
299,
19,
855,
16,
5633,
308,
28,
14781,
67,
12078,
7,
70,
11,
67,
12078,
28,
18,
8,
1058,
2147,
198,
220,
220,
220,
308,
66,
3876,
2433,
90,
51,
11,
358,
12078,
7,
70,
38165,
7,
25928,
11,
70,
11,
25928,
13,
69,
10699,
11,
33327,
7,
16,
25,
77,
37,
2114,
4008,
198,
220,
2073,
198,
220,
220,
220,
308,
66,
3876,
2433,
90,
51,
11,
16,
92,
7,
25928,
11,
69,
11,
25928,
13,
69,
10699,
11,
33327,
7,
16,
25,
77,
37,
2114,
4008,
198,
220,
886,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
10699,
3712,
38176,
90,
19182,
90,
11251,
29291,
90,
17,
11,
2558,
5512,
16,
5512,
11251,
29291,
90,
17,
11,
2558,
92,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
15732,
3712,
38176,
90,
19182,
90,
5317,
11,
16,
5512,
5317,
30072,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
13664,
7,
69,
15732,
8,
198,
220,
277,
28,
19182,
90,
19182,
90,
51,
11,
17,
5512,
16,
92,
7,
917,
891,
11,
77,
37,
2114,
8,
198,
220,
318,
64,
7,
69,
10699,
11,
11251,
29291,
8,
5633,
277,
10699,
41888,
69,
10699,
60,
1058,
2147,
198,
220,
318,
64,
7,
69,
15732,
11,
5317,
8,
5633,
277,
15732,
41888,
69,
15732,
60,
1058,
2147,
198,
220,
329,
257,
28,
16,
25,
77,
37,
2114,
198,
220,
220,
220,
277,
58,
64,
22241,
19182,
90,
51,
92,
7,
917,
891,
11,
69,
10699,
58,
64,
12962,
198,
220,
886,
198,
220,
308,
66,
3876,
2433,
90,
51,
11,
16,
92,
7,
25928,
11,
69,
11,
69,
10699,
11,
69,
15732,
8,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
10699,
3712,
38176,
90,
19182,
90,
11251,
29291,
90,
17,
11,
2558,
5512,
16,
5512,
11251,
29291,
90,
17,
11,
2558,
92,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
15732,
3712,
38176,
90,
19182,
90,
5317,
11,
16,
5512,
5317,
5512,
77,
18,
3712,
5317,
8,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
13664,
7,
69,
15732,
8,
198,
220,
277,
28,
19182,
90,
19182,
90,
51,
11,
17,
5512,
17,
92,
7,
917,
891,
11,
77,
37,
2114,
11,
77,
18,
8,
198,
220,
318,
64,
7,
69,
10699,
11,
11251,
29291,
8,
5633,
277,
10699,
41888,
69,
10699,
60,
1058,
2147,
198,
220,
318,
64,
7,
69,
15732,
11,
5317,
8,
5633,
277,
15732,
41888,
69,
15732,
60,
1058,
2147,
198,
220,
329,
257,
28,
16,
25,
77,
37,
2114,
26,
329,
1312,
18,
28,
16,
25,
77,
18,
26,
198,
220,
220,
220,
277,
58,
64,
11,
72,
18,
22241,
19182,
90,
51,
92,
7,
917,
891,
11,
69,
10699,
58,
64,
60,
23029,
198,
220,
886,
26,
886,
26,
198,
220,
308,
66,
3876,
2433,
90,
51,
11,
17,
92,
7,
25928,
11,
69,
11,
69,
10699,
11,
69,
15732,
8,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
10699,
3712,
38176,
90,
19182,
90,
11251,
29291,
90,
17,
11,
2558,
5512,
16,
5512,
11251,
29291,
90,
17,
11,
2558,
92,
5512,
198,
220,
220,
220,
220,
220,
220,
220,
277,
15732,
3712,
38176,
90,
19182,
90,
5317,
11,
16,
5512,
5317,
5512,
77,
18,
3712,
5317,
11,
77,
19,
3712,
5317,
8,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
13664,
7,
69,
15732,
8,
198,
220,
277,
28,
19182,
90,
19182,
90,
51,
11,
17,
5512,
18,
92,
7,
917,
891,
11,
77,
37,
2114,
11,
77,
18,
11,
77,
19,
8,
198,
220,
318,
64,
7,
69,
10699,
11,
11251,
29291,
8,
5633,
277,
10699,
41888,
69,
10699,
60,
1058,
2147,
198,
220,
318,
64,
7,
69,
15732,
11,
5317,
8,
5633,
277,
15732,
41888,
69,
15732,
60,
1058,
2147,
198,
220,
329,
257,
28,
16,
25,
77,
37,
2114,
26,
329,
1312,
19,
28,
16,
25,
77,
19,
26,
329,
1312,
18,
28,
16,
25,
77,
18,
26,
198,
220,
220,
220,
277,
58,
64,
11,
72,
18,
11,
72,
19,
22241,
19182,
90,
51,
92,
7,
917,
891,
11,
69,
10699,
58,
64,
60,
23029,
198,
220,
886,
26,
886,
26,
886,
26,
198,
220,
308,
66,
3876,
2433,
90,
51,
11,
18,
92,
7,
25928,
11,
69,
11,
69,
10699,
11,
69,
15732,
8,
198,
437,
198,
198,
2,
1343,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
8,
198,
220,
299,
37,
2114,
28,
25928,
13,
77,
37,
2114,
198,
220,
277,
10699,
28,
25928,
13,
69,
10699,
198,
220,
277,
15732,
28,
33327,
7,
16,
25,
25928,
13,
77,
37,
2114,
8,
198,
220,
309,
28,
25928,
13,
952,
6719,
66,
198,
220,
308,
66,
3876,
2433,
7,
25928,
11,
51,
11,
69,
10699,
11,
69,
15732,
8,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
30072,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
25928,
13,
77,
37,
2114,
198,
220,
277,
10699,
28,
25928,
13,
69,
10699,
198,
220,
277,
15732,
28,
33327,
7,
16,
25,
25928,
13,
77,
37,
2114,
8,
198,
220,
308,
66,
3876,
2433,
7,
25928,
11,
51,
11,
69,
10699,
11,
69,
15732,
8,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
77,
18,
3712,
5317,
8,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
25928,
13,
77,
37,
2114,
198,
220,
277,
10699,
28,
25928,
13,
69,
10699,
198,
220,
277,
15732,
28,
33327,
7,
16,
25,
25928,
13,
77,
37,
2114,
8,
198,
220,
308,
66,
3876,
2433,
7,
25928,
11,
51,
11,
69,
10699,
11,
69,
15732,
11,
77,
18,
8,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
7,
25928,
3712,
70,
11215,
25928,
11,
3712,
6030,
90,
51,
5512,
77,
18,
3712,
5317,
11,
77,
19,
3712,
5317,
8,
810,
1391,
51,
92,
198,
220,
299,
37,
2114,
28,
25928,
13,
77,
37,
2114,
198,
220,
277,
10699,
28,
25928,
13,
69,
10699,
198,
220,
277,
15732,
28,
33327,
7,
16,
25,
25928,
13,
77,
37,
2114,
8,
198,
220,
308,
66,
3876,
2433,
7,
25928,
11,
51,
11,
69,
10699,
11,
69,
15732,
11,
77,
18,
11,
77,
19,
8,
198,
437,
198,
198,
2,
532,
198,
198,
2,
1303,
26491,
25458,
198,
198,
2,
1343,
198,
14881,
13,
7857,
7,
32,
3712,
36484,
3876,
2433,
8,
796,
2546,
7,
32,
13,
69,
8,
198,
14881,
13,
7857,
7,
32,
3712,
36484,
3876,
2433,
11,
5391,
3712,
46541,
8,
796,
2546,
7,
32,
38381,
27740,
60,
198,
198,
2,
1343,
198,
8818,
7308,
13,
1136,
9630,
7,
32,
3712,
36484,
3876,
2433,
90,
51,
11,
399,
5512,
314,
3712,
19852,
853,
90,
38176,
90,
5317,
11,
19182,
90,
5317,
5512,
23839,
26453,
17257,
11,
5216,
261,
5512,
399,
30072,
810,
1391,
51,
11,
45,
92,
198,
220,
449,
28,
16,
25,
13664,
7,
32,
13,
69,
15732,
8,
198,
220,
5145,
9160,
7,
40,
58,
16,
4357,
5216,
261,
8,
5633,
449,
28,
41,
58,
40,
58,
16,
11907,
1058,
2147,
198,
220,
299,
37,
2114,
28,
13664,
7,
41,
8,
628,
220,
45218,
69,
28,
32,
13,
69,
58,
40,
22345,
198,
220,
611,
318,
64,
7,
22065,
69,
11,
19182,
90,
417,
4906,
7,
32,
828,
17,
30072,
198,
220,
220,
220,
45218,
28,
22065,
69,
198,
220,
2073,
198,
220,
220,
220,
299,
18,
28,
5317,
7,
13664,
7,
22065,
69,
20679,
77,
37,
2114,
8,
198,
220,
220,
220,
509,
16193,
32,
13,
25928,
11,
417,
4906,
7,
32,
828,
32,
13,
69,
10699,
58,
41,
4357,
32,
13,
69,
15732,
58,
41,
12962,
198,
220,
220,
220,
299,
18,
29,
16,
5633,
45218,
28,
36484,
3876,
2433,
7,
42,
986,
11,
77,
18,
8,
1058,
45218,
28,
36484,
3876,
2433,
7,
42,
23029,
198,
220,
220,
220,
329,
314,
287,
1123,
9630,
7,
22065,
69,
1776,
45218,
13,
69,
58,
40,
60,
796,
1570,
7,
22065,
69,
58,
40,
4357,
45299,
25,
1776,
886,
198,
220,
886,
628,
220,
1441,
45218,
198,
437,
198,
198,
37811,
198,
220,
220,
220,
651,
9630,
14784,
7,
32,
3712,
36484,
3876,
2433,
11,
314,
3712,
19852,
853,
90,
62,
30072,
810,
1391,
51,
11,
45,
92,
198,
198,
30556,
355,
651,
9630,
475,
635,
5860,
262,
1986,
2546,
290,
6376,
198,
37811,
198,
8818,
651,
9630,
14784,
7,
32,
3712,
36484,
3876,
2433,
90,
51,
11,
399,
5512,
314,
3712,
19852,
853,
90,
38176,
90,
5317,
11,
19182,
90,
5317,
5512,
23839,
26453,
17257,
11,
5216,
261,
5512,
399,
30072,
810,
1391,
51,
11,
45,
92,
198,
220,
220,
220,
277,
28,
32,
58,
40,
22345,
198,
220,
220,
220,
277,
10699,
28,
32,
13,
69,
10699,
58,
40,
58,
16,
11907,
198,
220,
220,
220,
277,
15732,
28,
32,
13,
69,
15732,
58,
40,
58,
16,
11907,
198,
220,
220,
220,
1441,
277,
11,
69,
10699,
11,
69,
15732,
198,
437,
198,
2,
532,
198,
198,
8818,
7308,
13,
2617,
9630,
0,
7,
32,
3712,
36484,
3876,
2433,
90,
51,
11,
399,
5512,
410,
11,
314,
3712,
19852,
853,
90,
5317,
11,
399,
30072,
810,
1391,
51,
11,
45,
92,
198,
220,
1441,
357,
32,
13,
69,
58,
40,
22345,
796,
410,
8,
198,
437,
198,
198,
8818,
7308,
13,
1177,
7,
32,
3712,
36484,
3876,
2433,
90,
51,
11,
399,
5512,
314,
3712,
19852,
853,
90,
38176,
90,
5317,
11,
23839,
26453,
17257,
11,
5216,
261,
5512,
399,
30072,
810,
1391,
51,
11,
45,
92,
198,
220,
449,
28,
16,
25,
13664,
7,
32,
13,
69,
15732,
8,
198,
220,
5145,
9160,
7,
40,
58,
16,
4357,
5216,
261,
8,
5633,
449,
28,
41,
58,
40,
58,
16,
11907,
1058,
2147,
198,
220,
299,
37,
2114,
28,
13664,
7,
41,
8,
628,
220,
45218,
69,
28,
1177,
7,
32,
13,
69,
11,
40,
23029,
198,
220,
299,
18,
28,
5317,
7,
13664,
7,
22065,
69,
20679,
77,
37,
2114,
8,
1303,
13664,
7,
22065,
69,
8,
29,
77,
37,
2114,
5633,
299,
18,
28,
5317,
7,
13664,
7,
22065,
69,
20679,
77,
37,
2114,
8,
1058,
299,
18,
28,
16,
628,
220,
509,
16193,
32,
13,
25928,
11,
417,
4906,
7,
32,
828,
32,
13,
69,
10699,
58,
41,
4357,
32,
13,
69,
15732,
58,
41,
12962,
198,
220,
299,
18,
29,
16,
5633,
45218,
28,
36484,
3876,
2433,
7,
42,
986,
11,
77,
18,
8,
1058,
45218,
28,
36484,
3876,
2433,
7,
42,
23029,
198,
220,
329,
314,
287,
1123,
9630,
7,
22065,
69,
1776,
45218,
13,
69,
58,
40,
60,
796,
1570,
7,
22065,
69,
58,
40,
4357,
45299,
25,
1776,
886,
628,
220,
1441,
45218,
198,
437,
198,
198,
2,
44386,
8562,
2495,
12,
4798,
278,
11,
2092,
11,
290,
7025,
198,
198,
8818,
7308,
13,
12860,
7,
952,
3712,
9399,
11,
1976,
3712,
36484,
3876,
2433,
90,
51,
11,
399,
30072,
810,
1391,
51,
11,
45,
92,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
308,
66,
3876,
2433,
3467,
77,
1600,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
220,
10706,
2099,
220,
220,
796,
33172,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
17971,
7,
89,
13,
25928,
13,
4871,
19415,
77,
1600,
8043,
28,
25,
17585,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
220,
1366,
2099,
220,
220,
796,
33172,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
17971,
7,
417,
4906,
7,
89,
4008,
59,
77,
1600,
8043,
28,
25,
17585,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
220,
17763,
7177,
220,
796,
33172,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
17971,
7,
7857,
7,
89,
4008,
59,
77,
1600,
8043,
28,
25,
17585,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
220,
17763,
10620,
220,
796,
33172,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
17971,
7,
7857,
7,
89,
58,
16,
60,
4008,
59,
77,
1600,
8043,
28,
25,
17585,
8,
198,
220,
220,
220,
329,
1312,
32388,
28,
17,
25,
13664,
7,
89,
13,
69,
15732,
8,
198,
220,
220,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
366,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
33172,
8043,
28,
25,
11265,
8,
198,
220,
220,
220,
220,
220,
3601,
34365,
992,
7,
952,
11,
17971,
7,
7857,
7,
89,
58,
72,
32388,
60,
4008,
59,
77,
1600,
8043,
28,
25,
17585,
8,
198,
220,
220,
220,
886,
198,
220,
1441,
198,
437,
198,
198,
8818,
7308,
13,
38610,
7,
32,
3712,
36484,
3876,
2433,
8,
198,
220,
220,
220,
611,
299,
67,
12078,
7,
32,
8,
855,
16,
198,
220,
220,
220,
220,
220,
220,
220,
347,
28,
36484,
3876,
2433,
7,
32,
13,
25928,
11,
417,
4906,
7,
32,
828,
32,
13,
69,
10699,
11,
32,
13,
69,
15732,
8,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
347,
28,
36484,
3876,
2433,
7,
32,
13,
25928,
11,
417,
4906,
7,
32,
828,
32,
13,
69,
10699,
11,
32,
13,
69,
15732,
11,
7857,
7,
32,
11,
17,
4008,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
347,
198,
437,
198,
198,
2,
44386,
8562,
1096,
22978,
198,
198,
14881,
13,
30507,
2701,
21466,
7,
3712,
6030,
90,
27,
25,
36484,
3876,
2433,
30072,
796,
44244,
13,
19182,
21466,
90,
36484,
3876,
2433,
92,
3419,
198,
198,
8818,
7308,
13,
38610,
7,
15630,
3712,
30507,
2701,
13,
30507,
2701,
276,
90,
30507,
2701,
13,
19182,
21466,
90,
36484,
3876,
2433,
92,
5512,
7904,
6030,
90,
9527,
6030,
30072,
810,
2574,
6030,
198,
220,
1303,
20937,
262,
17311,
329,
262,
308,
66,
3876,
2433,
25,
198,
220,
317,
796,
1064,
62,
36484,
3876,
2433,
7,
15630,
8,
198,
220,
1303,
13610,
262,
308,
66,
3876,
2433,
5072,
25,
198,
220,
611,
299,
67,
12078,
7,
32,
8,
855,
16,
198,
220,
220,
220,
220,
220,
220,
220,
347,
28,
36484,
3876,
2433,
7,
32,
13,
25928,
11,
9527,
6030,
11,
32,
13,
69,
10699,
11,
32,
13,
69,
15732,
8,
198,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
347,
28,
36484,
3876,
2433,
7,
32,
13,
25928,
11,
9527,
6030,
11,
32,
13,
69,
10699,
11,
32,
13,
69,
15732,
11,
7857,
7,
32,
11,
17,
4008,
198,
220,
886,
198,
220,
1441,
347,
198,
437,
198,
198,
19796,
62,
36484,
3876,
2433,
7,
15630,
3712,
14881,
13,
30507,
2701,
13,
30507,
2701,
276,
8,
796,
1064,
62,
36484,
3876,
2433,
7,
15630,
13,
22046,
8,
198,
19796,
62,
36484,
3876,
2433,
7,
22046,
3712,
51,
29291,
8,
796,
1064,
62,
36484,
3876,
2433,
7,
19796,
62,
36484,
3876,
2433,
7,
22046,
58,
16,
46570,
7308,
13,
13199,
7,
22046,
4008,
198,
19796,
62,
36484,
3876,
2433,
7,
87,
8,
796,
2124,
198,
19796,
62,
36484,
3876,
2433,
7,
64,
3712,
36484,
3876,
2433,
11,
1334,
8,
796,
257,
198,
19796,
62,
36484,
3876,
2433,
7,
3712,
7149,
11,
1334,
8,
796,
1064,
62,
36484,
3876,
2433,
7,
2118,
8,
198,
198,
4242,
198,
198,
11748,
7308,
25,
4866,
1462,
0,
198,
198,
2,
6093,
1096,
428,
2446,
611,
477,
345,
765,
284,
466,
318,
39868,
319,
2099,
1659,
7,
16520,
8,
198,
31,
45145,
2163,
4866,
1462,
0,
7,
16520,
3712,
37031,
3163,
20477,
13,
36484,
3876,
2433,
11,
47125,
3712,
30507,
2701,
13,
30507,
2701,
276,
90,
18465,
30072,
198,
220,
220,
220,
34197,
7,
16520,
8,
6624,
34197,
7,
15630,
8,
8614,
3714,
36020,
7,
897,
274,
7,
16520,
828,
34197,
7,
15630,
4008,
198,
220,
220,
220,
1303,
15193,
23989,
25,
7025,
0,
7,
738,
414,
11,
2244,
11,
317,
8,
318,
7548,
284,
4866,
1462,
0,
7,
16520,
11,
317,
8,
611,
36525,
2872,
198,
220,
220,
220,
611,
47125,
13,
69,
24844,
5369,
11405,
47125,
13,
22046,
318,
64,
309,
29291,
90,
23839,
19182,
92,
1303,
691,
257,
2060,
5128,
4578,
284,
7025,
0,
198,
220,
220,
220,
220,
220,
220,
220,
317,
796,
47125,
13,
22046,
58,
16,
60,
198,
220,
220,
220,
220,
220,
220,
220,
611,
34197,
7,
16520,
8,
6624,
34197,
7,
32,
8,
198,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
220,
1441,
4866,
1462,
0,
7,
16520,
11,
317,
8,
198,
220,
220,
220,
220,
220,
220,
220,
886,
198,
220,
220,
220,
886,
198,
220,
220,
220,
47125,
17478,
796,
44244,
13,
3866,
14681,
7,
16520,
11,
47125,
8,
198,
220,
220,
220,
2488,
14323,
67,
329,
314,
287,
1123,
9630,
7,
15630,
17478,
8,
198,
220,
220,
220,
220,
220,
220,
220,
1303,
31,
259,
65,
3733,
2244,
58,
40,
60,
796,
47125,
17478,
58,
40,
60,
198,
220,
220,
220,
220,
220,
220,
220,
2488,
259,
65,
3733,
2244,
58,
40,
60,
796,
308,
66,
3876,
2433,
62,
1136,
9630,
62,
1990,
1604,
7,
15630,
17478,
11,
40,
8,
198,
220,
220,
220,
886,
198,
220,
220,
220,
1441,
2244,
198,
437,
198,
198,
8818,
308,
66,
3876,
2433,
62,
1136,
9630,
62,
1990,
1604,
7,
15630,
11,
40,
8,
198,
220,
2488,
7784,
15952,
694,
2198,
65,
3733,
7,
15630,
11,
314,
8,
198,
220,
26498,
796,
44244,
13557,
1136,
9630,
7,
15630,
13,
22046,
11,
314,
8,
198,
220,
1441,
47125,
13,
69,
12195,
22046,
23029,
198,
437,
198,
198,
21017,
198,
198,
37811,
198,
220,
220,
220,
299,
37,
2114,
36,
23047,
7,
64,
3712,
36484,
3876,
2433,
8,
198,
198,
13615,
299,
37,
2114,
11,
299,
18,
357,
16,
287,
362,
35,
1339,
26,
1875,
16,
4306,
8,
198,
37811,
198,
8818,
299,
37,
2114,
36,
23047,
7,
64,
3712,
36484,
3876,
2433,
8,
198,
220,
299,
37,
2114,
28,
13664,
7,
64,
13,
69,
15732,
8,
198,
220,
299,
67,
12078,
7,
64,
13,
69,
8,
29,
16,
5633,
299,
18,
28,
7857,
7,
64,
13,
69,
11,
17,
8,
1058,
299,
18,
28,
16,
198,
220,
299,
67,
12078,
7,
64,
13,
69,
8,
29,
17,
5633,
299,
19,
28,
7857,
7,
64,
13,
69,
11,
18,
8,
1058,
299,
19,
28,
16,
198,
220,
1441,
299,
37,
2114,
11,
299,
18,
11,
299,
19,
198,
437,
198
] | 2.064807 | 3,765 |
module Variance
using ValidatedNumerics;
using Distributions;
using Dierckx;
abstract BaseEstimator
function estimate(values, method::BaseEstimator)
error("Unsupported method $method")
end
immutable byConfidenceProbability <: BaseEstimator
confidence_probability :: Real
end
function estimate(values, method :: byConfidenceProbability)
average = mean(values)
count = length(values)
gamma_down, gamma_up = getGammas(method.confidence_probability)
quantile_down = getChiSquareQuantile(gamma_down, count)
quantile_up = getChiSquareQuantile(gamma_up, count)
reduced = mapreduce((x) -> (x - average)^2, +, values)
@interval(reduced/quantile_down, reduced/quantile_up)
end
immutable byMeanAbsoluteDeviation <: BaseEstimator
confidence_probability :: Real
end
function estimate(values, method :: byMeanAbsoluteDeviation)
average = mean(values)
count = length(values)
quantile_down, quantile_up = getMeanAbsDeviationQuantiles(method.confidence_probability, count)
mean_abs_deviation = mapreduce((x) -> abs(x - average), +, values)/count
@interval(mean_abs_deviation/quantile_down, mean_abs_deviation/quantile_up)^2
end
immutable byPointVariance <: BaseEstimator
confidence_probability :: Real
variance :: Real
end
function estimate(values, method::byPointVariance)
count = length(values)
gamma_down, gamma_up = getGammas(method.confidence_probability)
quantile_down = getChiSquareQuantile(gamma_down, count)
quantile_up = getChiSquareQuantile(gamma_up, count)
fixed_variance = method.variance * (1 + 0.254 / (count - 1))^2
term = (count - 1) * fixed_variance
@interval(term / quantile_down, term / quantile_up)
end
function getGammas(confidence_probability)
(1 + confidence_probability) * 0.5, (1 - confidence_probability) * 0.5
end
function getChiSquareQuantile(value, count)
d = Chisq(count - 1)
quantile(d, value)
end
function getMeanAbsDeviationQuantiles(confidence_probability, count)
if confidence_probability == 0.90
const knots = [
2 1.386 0.044;
3 1.276 0.166;
4 1.224 0.254;
5 1.187 0.305;
6 1.158 0.360;
7 1.135 0.394;
8 1.116 0.422;
9 1.100 0.445;
10 1.086 0.464;
]
elseif confidence_probability == 0.95
const knots = [
2 1.585 0.022;
3 1.417 0.116;
4 1.344 0.199;
5 1.292 0.260;
6 1.253 0.306;
7 1.222 0.342;
8 1.196 0.372;
9 1.175 0.396;
10 1.156 0.417;
]
elseif confidence_probability == 0.99
const knots = [
2 1.985 0.004;
3 1.703 0.073;
4 1.590 0.145;
5 1.507 0.203;
6 1.445 0.250;
7 1.397 0.287;
8 1.358 0.318;
9 1.326 0.344;
10 1.299 0.366;
]
else
error("Value=$confidence_probability is not allowed")
end
x_knots = knots[:, 1]
if count > last(x_knots)
error("Error $count too high")
end
y_down_knots = knots[:, 2]
down_itp = Spline1D(x_knots, y_down_knots, k=1, bc="extrapolate")
y_up_knots = knots[:, 3]
up_itp = Spline1D(x_knots, y_up_knots, k=1, bc="extrapolate")
evaluate(down_itp, count), evaluate(up_itp, count)
end
end
| [
21412,
15965,
590,
198,
3500,
3254,
41475,
45,
6975,
873,
26,
198,
3500,
46567,
507,
26,
198,
3500,
360,
959,
694,
87,
26,
198,
198,
397,
8709,
7308,
22362,
320,
1352,
198,
198,
8818,
8636,
7,
27160,
11,
2446,
3712,
14881,
22362,
320,
1352,
8,
198,
220,
220,
220,
4049,
7203,
3118,
15999,
2446,
720,
24396,
4943,
198,
437,
198,
198,
8608,
18187,
416,
18546,
1704,
2964,
65,
1799,
1279,
25,
7308,
22362,
320,
1352,
198,
220,
220,
220,
6628,
62,
1676,
65,
1799,
7904,
6416,
198,
437,
198,
198,
8818,
8636,
7,
27160,
11,
2446,
7904,
416,
18546,
1704,
2964,
65,
1799,
8,
198,
220,
220,
220,
2811,
796,
1612,
7,
27160,
8,
198,
220,
220,
220,
954,
796,
4129,
7,
27160,
8,
198,
220,
220,
220,
34236,
62,
2902,
11,
34236,
62,
929,
796,
651,
34777,
5356,
7,
24396,
13,
39745,
62,
1676,
65,
1799,
8,
198,
220,
220,
220,
5554,
576,
62,
2902,
796,
651,
1925,
72,
48011,
24915,
576,
7,
28483,
2611,
62,
2902,
11,
954,
8,
198,
220,
220,
220,
5554,
576,
62,
929,
796,
651,
1925,
72,
48011,
24915,
576,
7,
28483,
2611,
62,
929,
11,
954,
8,
628,
220,
220,
220,
5322,
796,
3975,
445,
7234,
19510,
87,
8,
4613,
357,
87,
532,
2811,
8,
61,
17,
11,
1343,
11,
3815,
8,
628,
220,
220,
220,
2488,
3849,
2100,
7,
445,
19513,
14,
40972,
576,
62,
2902,
11,
5322,
14,
40972,
576,
62,
929,
8,
198,
437,
198,
198,
8608,
18187,
416,
5308,
272,
24849,
3552,
13603,
3920,
1279,
25,
7308,
22362,
320,
1352,
198,
220,
220,
220,
6628,
62,
1676,
65,
1799,
7904,
6416,
198,
437,
198,
198,
8818,
8636,
7,
27160,
11,
2446,
7904,
416,
5308,
272,
24849,
3552,
13603,
3920,
8,
198,
220,
220,
220,
2811,
796,
1612,
7,
27160,
8,
198,
220,
220,
220,
954,
796,
4129,
7,
27160,
8,
198,
220,
220,
220,
5554,
576,
62,
2902,
11,
5554,
576,
62,
929,
796,
651,
5308,
272,
24849,
13603,
3920,
24915,
2915,
7,
24396,
13,
39745,
62,
1676,
65,
1799,
11,
954,
8,
628,
220,
220,
220,
1612,
62,
8937,
62,
7959,
3920,
796,
3975,
445,
7234,
19510,
87,
8,
4613,
2352,
7,
87,
532,
2811,
828,
1343,
11,
3815,
20679,
9127,
628,
220,
220,
220,
2488,
3849,
2100,
7,
32604,
62,
8937,
62,
7959,
3920,
14,
40972,
576,
62,
2902,
11,
1612,
62,
8937,
62,
7959,
3920,
14,
40972,
576,
62,
929,
8,
61,
17,
198,
437,
198,
198,
8608,
18187,
416,
12727,
23907,
590,
1279,
25,
7308,
22362,
320,
1352,
198,
220,
220,
220,
6628,
62,
1676,
65,
1799,
7904,
6416,
198,
220,
220,
220,
24198,
7904,
6416,
198,
437,
198,
198,
8818,
8636,
7,
27160,
11,
2446,
3712,
1525,
12727,
23907,
590,
8,
198,
220,
220,
220,
954,
796,
4129,
7,
27160,
8,
198,
220,
220,
220,
34236,
62,
2902,
11,
34236,
62,
929,
796,
651,
34777,
5356,
7,
24396,
13,
39745,
62,
1676,
65,
1799,
8,
198,
220,
220,
220,
5554,
576,
62,
2902,
796,
651,
1925,
72,
48011,
24915,
576,
7,
28483,
2611,
62,
2902,
11,
954,
8,
198,
220,
220,
220,
5554,
576,
62,
929,
796,
651,
1925,
72,
48011,
24915,
576,
7,
28483,
2611,
62,
929,
11,
954,
8,
628,
220,
220,
220,
5969,
62,
25641,
590,
796,
2446,
13,
25641,
590,
1635,
357,
16,
1343,
657,
13,
24970,
1220,
357,
9127,
532,
352,
4008,
61,
17,
198,
220,
220,
220,
3381,
796,
357,
9127,
532,
352,
8,
1635,
5969,
62,
25641,
590,
628,
220,
220,
220,
2488,
3849,
2100,
7,
4354,
1220,
5554,
576,
62,
2902,
11,
3381,
1220,
5554,
576,
62,
929,
8,
198,
437,
198,
198,
8818,
651,
34777,
5356,
7,
39745,
62,
1676,
65,
1799,
8,
198,
220,
220,
220,
357,
16,
1343,
6628,
62,
1676,
65,
1799,
8,
1635,
657,
13,
20,
11,
357,
16,
532,
6628,
62,
1676,
65,
1799,
8,
1635,
657,
13,
20,
198,
437,
198,
198,
8818,
651,
1925,
72,
48011,
24915,
576,
7,
8367,
11,
954,
8,
198,
220,
220,
220,
288,
796,
609,
271,
80,
7,
9127,
532,
352,
8,
198,
220,
220,
220,
5554,
576,
7,
67,
11,
1988,
8,
198,
437,
198,
198,
8818,
651,
5308,
272,
24849,
13603,
3920,
24915,
2915,
7,
39745,
62,
1676,
65,
1799,
11,
954,
8,
198,
220,
220,
220,
611,
6628,
62,
1676,
65,
1799,
6624,
657,
13,
3829,
198,
220,
220,
220,
220,
220,
220,
220,
1500,
33620,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
362,
352,
13,
21734,
657,
13,
43977,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
352,
13,
27988,
657,
13,
23055,
26,
198,
220,
220,
220,
220,
220,
220,
220,
604,
352,
13,
24137,
657,
13,
24970,
26,
198,
220,
220,
220,
220,
220,
220,
220,
642,
352,
13,
23451,
657,
13,
22515,
26,
198,
220,
220,
220,
220,
220,
220,
220,
718,
352,
13,
21273,
657,
13,
15277,
26,
198,
220,
220,
220,
220,
220,
220,
220,
767,
352,
13,
17059,
657,
13,
34626,
26,
198,
220,
220,
220,
220,
220,
220,
220,
807,
352,
13,
18298,
657,
13,
44361,
26,
198,
220,
220,
220,
220,
220,
220,
220,
860,
352,
13,
3064,
657,
13,
43489,
26,
198,
220,
220,
220,
220,
220,
220,
220,
838,
352,
13,
2919,
21,
657,
13,
44578,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
2073,
361,
6628,
62,
1676,
65,
1799,
6624,
657,
13,
3865,
198,
220,
220,
220,
220,
220,
220,
220,
1500,
33620,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
362,
352,
13,
38905,
657,
13,
44087,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
352,
13,
38547,
657,
13,
18298,
26,
198,
220,
220,
220,
220,
220,
220,
220,
604,
352,
13,
33535,
657,
13,
19104,
26,
198,
220,
220,
220,
220,
220,
220,
220,
642,
352,
13,
32759,
657,
13,
21719,
26,
198,
220,
220,
220,
220,
220,
220,
220,
718,
352,
13,
28592,
657,
13,
20548,
26,
198,
220,
220,
220,
220,
220,
220,
220,
767,
352,
13,
23148,
657,
13,
31575,
26,
198,
220,
220,
220,
220,
220,
220,
220,
807,
352,
13,
25272,
657,
13,
36720,
26,
198,
220,
220,
220,
220,
220,
220,
220,
860,
352,
13,
17430,
657,
13,
34107,
26,
198,
220,
220,
220,
220,
220,
220,
220,
838,
352,
13,
21599,
657,
13,
38547,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
2073,
361,
6628,
62,
1676,
65,
1799,
6624,
657,
13,
2079,
198,
220,
220,
220,
220,
220,
220,
220,
1500,
33620,
796,
685,
198,
220,
220,
220,
220,
220,
220,
220,
362,
352,
13,
42250,
657,
13,
22914,
26,
198,
220,
220,
220,
220,
220,
220,
220,
513,
352,
13,
36809,
657,
13,
2998,
18,
26,
198,
220,
220,
220,
220,
220,
220,
220,
604,
352,
13,
36993,
657,
13,
18781,
26,
198,
220,
220,
220,
220,
220,
220,
220,
642,
352,
13,
35378,
657,
13,
22416,
26,
198,
220,
220,
220,
220,
220,
220,
220,
718,
352,
13,
43489,
657,
13,
9031,
26,
198,
220,
220,
220,
220,
220,
220,
220,
767,
352,
13,
33372,
657,
13,
27800,
26,
198,
220,
220,
220,
220,
220,
220,
220,
807,
352,
13,
31128,
657,
13,
36042,
26,
198,
220,
220,
220,
220,
220,
220,
220,
860,
352,
13,
39195,
657,
13,
33535,
26,
198,
220,
220,
220,
220,
220,
220,
220,
838,
352,
13,
22579,
657,
13,
32459,
26,
198,
220,
220,
220,
220,
220,
220,
220,
2361,
198,
220,
220,
220,
2073,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
11395,
43641,
39745,
62,
1676,
65,
1799,
318,
407,
3142,
4943,
198,
220,
220,
220,
886,
198,
220,
220,
220,
2124,
62,
74,
1662,
82,
796,
33620,
58,
45299,
352,
60,
198,
220,
220,
220,
611,
954,
1875,
938,
7,
87,
62,
74,
1662,
82,
8,
198,
220,
220,
220,
220,
220,
220,
220,
4049,
7203,
12331,
720,
9127,
1165,
1029,
4943,
198,
220,
220,
220,
886,
628,
220,
220,
220,
331,
62,
2902,
62,
74,
1662,
82,
796,
33620,
58,
45299,
362,
60,
198,
220,
220,
220,
866,
62,
270,
79,
796,
13341,
500,
16,
35,
7,
87,
62,
74,
1662,
82,
11,
331,
62,
2902,
62,
74,
1662,
82,
11,
479,
28,
16,
11,
47125,
2625,
2302,
2416,
27976,
4943,
628,
220,
220,
220,
331,
62,
929,
62,
74,
1662,
82,
796,
33620,
58,
45299,
513,
60,
198,
220,
220,
220,
510,
62,
270,
79,
796,
13341,
500,
16,
35,
7,
87,
62,
74,
1662,
82,
11,
331,
62,
929,
62,
74,
1662,
82,
11,
479,
28,
16,
11,
47125,
2625,
2302,
2416,
27976,
4943,
198,
220,
220,
220,
13446,
7,
2902,
62,
270,
79,
11,
954,
828,
13446,
7,
929,
62,
270,
79,
11,
954,
8,
198,
437,
198,
198,
437,
198
] | 2.238968 | 1,473 |