text:
### A Pluto.jl notebook ###
# v0.18.1

using Markdown
using InteractiveUtils

# ╔═╡ 521890de-ab23-11ec-0c2f-2dcaee6dc1bc
using Plots, Distributions, PlutoUI

# ╔═╡ dbf8cdd6-7815-49f8-9dd6-5987000792ce
md"""
# 3월24일 강의영상
"""

# ╔═╡ 20697867-c74a-4485-bb97-c6a31060669a
html"""

"""

# ╔═╡ 64e29d20-aaf5-4fa0-ad03-b283dac52dce
md"""
# 3월24일 강의노트
"""

# ╔═╡ 3f43a098-0653-4cb3-a48e-673e342ae48b
Plots.plotly()

# ╔═╡ ddae88bf-0b17-40f4-ae33-5cd70aa8a0de
md"""
### 포아송분포 ($X \sim Poi(\lambda)$)
"""

# ╔═╡ c0e571b7-580a-4b25-ba5b-6cb729ec36b9
md"""
`-` 포아송분포의 요약
- X의의미: 발생횟수의 평균이 λ인 분포에서 실제 발생횟수를 X라고 한다.
- X의범위: 발생안할수도 있으므로 X=0이 가능. 따라서 X=0,1,2,3,...
- 파라메터의 의미와 범위: λ = 평균적인 발생횟수; λ>0.
- pdf:
- mgf:
- E(X): λ
- V(X): λ
"""

# ╔═╡ 7807af0d-012a-432a-9a64-5df4a633333b
md"""
`-` [포아송분포의 예시](https://www.statology.org/poisson-distribution-real-life-examples/#:~:text=Example%201%3A%20Calls%20per%20Hour,receives%2010%20calls%20per%20hour.)
- Calls per Hour at a Call Center
- Number of Arrivals at a Restaurant
- Number of Website Visitors per Hour
- Number of Bankruptcies Filed per Month
- Number of Network Failures per Week
"""

# ╔═╡ 713fc6aa-3cdb-49ad-903c-9127452e69b9
md"""
`-` 평균이 3인 포아송분포에서 100개의 샘플을 뽑는 방법
"""

# ╔═╡ 443fc984-8109-45c3-a6e5-e6e565dd0491
md"""
(방법1)
"""

# ╔═╡ 6d30adc5-4da9-4e85-bd47-e128de6fffb2
rand(Poisson(3),100)

# ╔═╡ 9a9ed77b-903e-4587-967c-518343a62e54
md"""
(방법2) 이항분포의 포아송근사를 이용
- 이론: 이항분포에서 (1) $n\to \infty$ (2) $p\to 0$ (3) $np=\lambda$ 이면 이것은 평균이 $\lambda$인 포아송분포로 근사함.
- 평균이 $\lambda$인 포아송분포는 $B(n,\frac{\lambda}{n})$로 근사할 수 있다. 이때 $n$이 커질수록 더 정확해짐.
"""

# ╔═╡ b0ca1c8f-272d-4a2f-ac4b-10bd659fceda
let
	samplesize_of_poisson = 10000
	λ=3
	n=10000
	p=λ/n
	X = rand(Binomial(n,p),samplesize_of_poisson)
	Y = rand(Poisson(λ),samplesize_of_poisson)
	p1= histogram(X)
	p2= histogram(Y)
	plot(p1,p2,layout=(2,1))
end

# ╔═╡ 1e943933-7266-4696-9388-6060d0d173e8
md"""
-  $n=10000$ 정도이면 꽤 비슷함.
- 방법2는 근사방법이므로 엄밀히 말하면 분포를 뽑는 기법이라고 볼 수는 없음.
"""

# ╔═╡ 4520bf81-0491-4a47-99c4-45680964654c
let
	λ=3
	n=600
	p=λ/n
	Δt = (60/n) # 단위가 60초니까 60

	poi_samplesize = 10000
	X = [(rand(n) .
 sum for k in 1:poi_samplesize]
	p1= histogram(X)
	p2= rand(Poisson(λ),poi_samplesize) |> histogram
	_p = plot(p1,p2,layout=(2,1))

	md"""
	(방법3) 균등분포 -> 베르누이 -> 이항분포 -> 포아송근사
	- 1분동안 맥도날드에 평균 3명이 온다고 생각하자.
	- 이건 사실 1초에 성공확률이 0.05인 베르누이 시행을 1번 시행하여 1분동안 총 60회 반복한 것으로 이해할 수 있음.
	- 아니야, 이건 사실 $(Δt) 초에 성공확률이 $p 인 베르누이 시행을 1번 시행하여 1분동안 총 $n 회 반복한 것으로 이해할 수 있음.
	- 아니야 아냐야, 이건 사실.... (무한반복)
	- 느낌: 하여튼 엄청 작은 시간에 엄청 작은 확률의 베르누이 시행이 독립적으로 엄청 많이 반복되는 느낌을 기억하세요!
	$(_p)
	- 위: 유니폼 -> 베르누이 -> 이항분포 -> 포아송
	- 아래: 포아송
	"""
end

# ╔═╡ ea7e4bb9-5eca-4046-8209-51489614c636
md"""
(방법4) 균등분포 -> inverse cdf method를 이용해서 생성할 수 있음.
"""

# ╔═╡ 8352dd50-1f7d-4e3d-9365-5af24d43547c
md"""
`-` 포아송분포의 합은 다시 포아송분포가 된다.
- 이론: $X \sim Poi(\lambda_1), Y\sim Poi(\lambda_2),~ X \perp Y \Rightarrow X + Y \sim P(\lambda_1 + \lambda_2)$
- 의미? (1) 1분동안 맥도날드 매장에 들어오는 남자의 수는 평균이 5인 포아송 분포를 따름 (2) 1분동안 맥도날드 매장에 들어오는 여자의 수는 평균이 4.5인 포아송분포를 따름 (3) 남자와 여자가 매장에 오는 사건은 독립 => 1분동안 맥도날드 매장에 오는 사람은 평균이 9.5인 포아송 분포를 따른다는 의미.
"""

# ╔═╡ af1c928e-ab6c-4212-88df-e3109503a157
md"""
(실습)
"""

# ╔═╡ 5d376188-fad1-48fb-86a2-7dcc908c337f
let
	n= 1000
	X = rand(Poisson(5),n)
	Y = rand(Poisson(4.5),n)
	p1 = X.+Y |> histogram
	p2 = rand(Poisson(9.5),n) |> histogram
	plot(p1,p2,layout=(2,1))
end

# ╔═╡ 0ab7a2d2-0d17-4523-8e91-b28624303524
let
	n=1000
	λ=5
	X = rand(Poisson(λ),n)
	md"""
	`-` 평균과 분산의 추정
	- 평균: $λ
	- 평균의 추정치: $(mean(X))
	- 분산: $λ
	- 분산의 추정치: $(var(X))
	"""
end

# ╔═╡ f140fb8e-308f-40e4-a199-b0e0d20dc7da
md"""
- 생각해보니까 왜 평균추정값과 분산추정값이 달라야하나?
"""

# ╔═╡ a222e7a1-dd18-4416-92eb-320f926d1d77
let
	n = 10000
	λ = 5
	p1=[mean(rand(Poisson(λ),n)) for k in 1:100] |> histogram
	p2=[var(rand(Poisson(λ),n)) for k in 1:100] |> histogram
	#p3=[(mean(rand(Poisson(λ),n))+var(rand(Poisson(λ),n)))/2  for k in 1:100] |> histogram
	_p=plot(p1,p2,layout=(2,1))
	md"""
	mean(X),var(X)로 λ를 추정
	$(_p)
	- 위: mean(X)
	- 아래: var(X)
	"""
end

# ╔═╡ ebe47018-7a6d-42a4-a61a-0079b5c077f8
md"""
- 히스토그램을 그려보니까 누가봐도 mean(X)로 λ를 추정하는것이 var(X)로 λ를 추정하는것 보다 좋아 보인다.
- 그냥 mean(X)=평균추정량=분산추정량 이라고 주장하면 안되나? => 됩니다! 이게 바로 MLE에요!
"""

# ╔═╡ 29a2e115-37a7-4f67-a040-a4c1648fdfa6
md"""
### 지수분포 ($X \sim Exp(1/\lambda)$)
"""

# ╔═╡ a185e773-f51e-449b-8d40-de819bd4badf
md"""
`-` 지수분포의 요약
- X의의미: 시간1에 평균적으로 λ번 발생하는 시건이 있을때 첫 번째 이벤트가 발생할때 까지 걸리는 시간.
- X의범위: 시간은 양수이므로 X ≥ 0
- 파라메터의 의미와 범위: (1) λ = 시간1에 평균적으로 발생하는 이벤트의 수 (2) 1/λ = 한번의 이벤트가 발생할때까지 평균적으로 걸리는 시간; λ>0
- pdf: $f(x)=\lambda e^{-\lambda x}$
- mgf:
- cdf: $F(x)=1-e^{-\lambda x}$
- E(X): $\frac{1}{\lambda}$
- V(S): $\frac{1}{\lambda^2}$
"""

# ╔═╡ 885941da-8604-4af0-8b69-6d564348f116
md"""
`-` 평균이 10인 지수분포에서 100개의 샘플을 뽑는 방법
"""

# ╔═╡ 2134273b-fca8-4238-b906-f05948fae7d2
md"""
(방법1)
"""

# ╔═╡ 1da1e41d-73a6-43f4-9d69-3e28b83da8e0
rand(Exponential(10),100)

# ╔═╡ caa4ea34-e2ae-455a-88a7-6324ff2cc8ef
md"""
(방법2) 포아송프로세스 -> 지수분포
- 맥도날드에 시간1당 0.1명씩 평균적으로 방문한다. 1명 방문하는데에는 평균적으로 시간이 10이 걸린다고 볼 수 있음.
- 따라서 언뜻생각하면 포아송과 지수분포는 역의 관계라서 포아송분포를 만들고 역수를 취하면 지수분포를 쉽게 만들 수 있을 것 같다.
"""

# ╔═╡ eb7572bd-63eb-4792-b982-9f320358a99c
rand(Poisson(0.1),100) # 0이 나오네?

# ╔═╡ 1c902aac-d633-4cde-95e1-62e42e0ffe87
md"""
- 0이 나온다?
- 생각해보니까 0이 없다고 쳐도 나올 수 있는 값은 1, 1/2, 1/3, 1/4, ... 따위임 (애초에 틀린 접근)
- 아이디어: 극한의 베르누이로 포아송을 만들때, 몇번 성공했는지 관심을 가지고 카운팅 했음 => 조금 응용해서 첫 성공까지 몇번의 시도를 해야하는지 카운팅을 한다고 생각하면 시간계산이 가능할것 같다.
- 결국 포아송프로세스 -> 지수분포로 가야함
"""

# ╔═╡ 09a0f94b-e90c-4233-933c-7c1237f11658
md"""
(예비학습)
"""

# ╔═╡ 8a1a0dd9-a5fc-4ea1-b026-c47490db1bc3
rand() # 유니폼에서 1개의 샘플 추출

# ╔═╡ 011a3508-939b-47b6-a062-9d61c6ea9eec
let
	i=0
	while i <= 5
		i=i+1
	end
	i
end

# ╔═╡ aef02ab9-4e12-4030-b428-f4aa36f65ba6
md"""
(풀이시작)
"""

# ╔═╡ e5ac4d16-20ed-4c35-832f-b6fd5cfad2dd
function try_until_you_succeed(p) # 성공할때까지 시도하는 함수
	n_of_try=0
	u=0
	while u < (1-p) # p=0이면 무한반복
		u = rand()
		n_of_try = n_of_try + 1
	end
	return n_of_try
end

# ╔═╡ b0d76b5d-cefa-489e-9963-830d6fb710a0
[try_until_you_succeed(0.1) for k in 1:10000] |> histogram

# ╔═╡ a27efaae-2793-4d8a-8dd6-4900caa80a4a
let
	exp_samplesize = 10000
	λ=0.1
	n=10000
	p=λ/n
	Δt = (1/n) # 단위가 시간1이니까
	X = [try_until_you_succeed(p) for k in 1:exp_samplesize] .* Δt
	p1 = X|> histogram
	p2 = rand(Exponential(10),exp_samplesize) |> histogram
	plot(p1,p2,layout=(2,1))
end

# ╔═╡ 829ad68b-7352-4d18-bcfd-90919b18648c
md"""
- 불평: 샘플하나뽑는데 시간이 오래걸림. (정확도를 올릴수록 더 오래걸림)
"""

# ╔═╡ fc1acb74-f856-47c7-b9e1-8d635f0e35ca
md"""
(방법3) inverse cdf method
- 이론적인 pdf를 알고 있다는 전제가 필요함.
- 자세하게 살펴보자.
"""

# ╔═╡ c2c198a7-4597-49e2-98d7-8776603db7fa
md"""
##### Inverse cdf method를 활용하여 지수분포에서 샘플추출
"""

# ╔═╡ cf6a955e-d684-4a16-bc0f-14409f83536a
md"""
`-` 아래와 같은 2개의 지수분포의 pdf를 고려하자.

$$f(x)=e^{-x}$$

$$g(x)=\frac{1}{5}e^{-\frac{1}{5}x}$$
"""

# ╔═╡ ed777a37-6351-41a1-aed3-86412c9edaac
md"""
`-` 각각의 pdf를 그려보면 아래와 같다.
"""

# ╔═╡ db26ed1c-b01a-4f06-886d-4079cf2c139f
let
	p1= plot(x-> exp(-x), 0, 20)
	p2= plot(x-> 1/5* exp(-x/5),0,20)
	plot(p1,p2,layout=(2,1))
end

# ╔═╡ 7889eeaa-a7b5-4cdd-8b26-c0de2d2981e0
md"""
`-` 이번에는 각각의 cdf를 그려보자.

$$F(x)=\int_0^x f(\tau)d\tau=\int_0^x e^{-\tau} d\tau = \left[-e^{-\tau}\right]_0^x=1-e^{-x}$$

$$G(x)=\int_0^x g(\tau)d\tau=\int_0^x \frac{1}{5}e^{-\tau/5} d\tau = \left[-e^{-\tau/5}\right]_0^x=1-e^{-x/5}$$

"""

# ╔═╡ 23abf65d-276d-4a5d-ae70-b41255b35b48
let
	p1= plot(x -> 1-exp(-x), 0, 20)
	p2= plot(x -> 1-exp(-x/5), 0, 20)
	plot(p1,p2,layout=(2,1))
end

# ╔═╡ ac1c2222-04b5-4af0-a55c-723b1ad57dec
md"""
`-` cdf 해석
- 위(평균이1인지수분포) = 5정도면 거의 cdf의 값이 1에 가까워짐
- 아래(평균이5인지수분포) = 5정도에서 값이 거의 0.63정도임 => 100번뽑으면 5보다 작은게 63개정도..

`-` cdf의 y축에서 랜덤변수를 발생시킨다음 $\rightarrow \downarrow$ 와 같이 이동하여 $x$축에 내린다고 생각해보자.
- 위: 대부분 5이하에 떨어짐
- 아래: 약 63% 정도만 5이하에 떨어짐.
"""

# ╔═╡ 9c2f4080-9dd5-4f85-83f7-42bf3c719e6e
# F(x) = 1-exp(-x)
# F: x-> *(-1) -> exp -> *(-1) -> +1
# Finv: y-> -1 -> *(-1) -> log -> *(-1)
Finv(x) = -log(-(x-1))
 Ginv(x) =-5*log(-(x-1))

# ╔═╡ 23118be8-96de-4df1-8b01-297f6ac3d1be
 Ginv(x) =-5*log(-(x-1))

# ╔═╡ 7520499e-e499-4873-b96a-acbdb777ca80

# ╔═╡ 2a78805b-6f73-4a44-b862-8fa15be1a20a

# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"

[compat]
Distributions = "~0.25.52"
Plots = "~1.27.2"
PlutoUI = "~0.7.37"
"""

# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised

julia_version = "1.7.2"
manifest_format = "2.0"

[[deps.AbstractPlutoDingetjes]]
deps = ["Pkg"]
git-tree-sha1 = "8eaf9f1b4921132a4cff3f36a1d9ba923b14a481"
uuid = "6e696c72-6542-2067-7265-42206c756150"
version = "1.1.4"

[[deps.Adapt]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "af92965fb30777147966f58acb05da51c5616b5f"
uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
version = "3.3.3"

[[deps.ArgTools]]
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

[[deps.Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+0"

[[deps.Cairo_jll]]
deps = ["Artifacts", "Bzip2_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "4b859a208b2397a7a623a03449e4636bdb17bcf2"
uuid = "83423d85-b0ee-5818-9007-b63ccbeb887a"
version = "1.16.1+1"

[[deps.Calculus]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "f641eb0a4f00c343bbc32346e1217b86f3ce9dad"
uuid = "49dc2e85-a5d0-5ad3-a950-438e2897f1b9"
version = "0.5.1"

[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra", "SparseArrays"]
git-tree-sha1 = "9950387274246d08af38f6eef8cb5480862a435f"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
version = "1.14.0"

[[deps.ChangesOfVariables]]
deps = ["ChainRulesCore", "LinearAlgebra", "Test"]
git-tree-sha1 = "bf98fa45a0a4cee295de98d4c1462be26345b9a1"
uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0"
version = "0.1.2"

[[deps.ColorSchemes]]
deps = ["ColorTypes", "Colors", "FixedPointNumbers", "Random"]
git-tree-sha1 = "12fc73e5e0af68ad3137b886e3f7c1eacfca2640"
uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
version = "3.17.1"

[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "024fe24d83e4a5bf5fc80501a314ce0d1aa35597"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.11.0"

[[deps.Colors]]
deps = ["ColorTypes", "FixedPointNumbers", "Reexport"]
git-tree-sha1 = "417b0ed7b8b838aa6ca0a87aadf1bb9eb111ce40"
uuid = "5ae59095-9a9b-59fe-a467-6f913c188581"
version = "0.12.8"

[[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"

[[deps.Contour]]
deps = ["StaticArrays"]
git-tree-sha1 = "9f02045d934dc030edad45944ea80dbd1f0ebea7"
uuid = "d38c429a-6771-53c6-b99e-75d170b6e991"
version = "0.5.7"

[[deps.DataAPI]]
git-tree-sha1 = "cc70b17275652eb47bc9e5f81635981f13cea5c8"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.9.0"

[[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.DensityInterface]]
deps = ["InverseFunctions", "Test"]
git-tree-sha1 = "80c3e8639e3353e5d2912fb3a1916b8455e2494b"
uuid = "b429d917-457f-4dbc-8f4c-0cc954292b1d"
version = "0.4.0"

[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.Distributions]]
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
git-tree-sha1 = "c43e992f186abaf9965cc45e372f4693b7754b22"
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
version = "0.25.52"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "b19534d1895d702889b219c382a6e18010797f0b"
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
version = "0.8.6"

[[deps.Downloads]]
deps = ["ArgTools", "LibCURL", "NetworkOptions"]
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"

[[deps.DualNumbers]]
deps = ["Calculus", "NaNMath", "SpecialFunctions"]
git-tree-sha1 = "5837a837389fccf076445fce071c8ddaea35a566"
uuid = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
version = "0.6.8"

[[deps.EarCut_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "3f3a2501fa7236e9b911e0f7a588c657e822bb6d"
uuid = "5ae413db-bbd1-5e63-b57d-d24a61df00f5"
version = "2.2.3+0"

[[deps.Expat_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "ae13fcbc7ab8f16b0856729b050ef0c446aa3492"
uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
version = "2.4.4+0"

[[deps.FFMPEG]]
deps = ["FFMPEG_jll"]
git-tree-sha1 = "b57e3acbe22f8484b4b5ff66a7499717fe1a9cc8"
uuid = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
version = "0.4.1"

[[deps.FFMPEG_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "JLLWrappers", "LAME_jll", "Libdl", "Ogg_jll", "OpenSSL_jll", "Opus_jll", "Pkg", "Zlib_jll", "libass_jll", "libfdk_aac_jll", "libvorbis_jll", "x264_jll", "x265_jll"]
git-tree-sha1 = "d8a578692e3077ac998b50c0217dfd67f21d1e5f"
uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5"
version = "4.4.0+0"

[[deps.FillArrays]]
deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"]
git-tree-sha1 = "246621d23d1f43e3b9c368bf3b72b2331a27c286"
uuid = "1a297f60-69ca-5386-bcde-b61e274b549b"
version = "0.13.2"

[[deps.FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"

[[deps.Fontconfig_jll]]
deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "21efd19106a55620a188615da6d3d06cd7f6ee03"
uuid = "a3f928ae-7b40-5064-980b-68af3947d34b"
version = "2.13.93+0"

[[deps.Formatting]]
deps = ["Printf"]
git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8"
uuid = "59287772-0a20-5a39-b81b-1366585eb4c0"
version = "0.4.2"

[[deps.FreeType2_jll]]
deps = ["Artifacts", "Bzip2_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "87eb71354d8ec1a96d4a7636bd57a7347dde3ef9"
uuid = "d7e528f0-a631-5988-bf34-fe36492bcfd7"
version = "2.10.4+0"

[[deps.FriBidi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "aa31987c2ba8704e23c6c8ba8a4f769d5d7e4f91"
uuid = "559328eb-81f9-559d-9380-de523a88c83c"
version = "1.0.10+0"

[[deps.GLFW_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libglvnd_jll", "Pkg", "Xorg_libXcursor_jll", "Xorg_libXi_jll", "Xorg_libXinerama_jll", "Xorg_libXrandr_jll"]
git-tree-sha1 = "51d2dfe8e590fbd74e7a842cf6d13d8a2f45dc01"
uuid = "0656b61e-2033-5cc2-a64a-77c0f6c09b89"
version = "3.3.6+0"

[[deps.GR]]
deps = ["Base64", "DelimitedFiles", "GR_jll", "HTTP", "JSON", "Libdl", "LinearAlgebra", "Pkg", "Printf", "Random", "RelocatableFolders", "Serialization", "Sockets", "Test", "UUIDs"]
git-tree-sha1 = "9f836fb62492f4b0f0d3b06f55983f2704ed0883"
uuid = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
version = "0.64.0"

[[deps.GR_jll]]
deps = ["Artifacts", "Bzip2_jll", "Cairo_jll", "FFMPEG_jll", "Fontconfig_jll", "GLFW_jll", "JLLWrappers", "JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pixman_jll", "Pkg", "Qt5Base_jll", "Zlib_jll", "libpng_jll"]
git-tree-sha1 = "a6c850d77ad5118ad3be4bd188919ce97fffac47"
uuid = "d2c73de3-f751-5644-a686-071e5b155ba9"
version = "0.64.0+0"

[[deps.GeometryBasics]]
deps = ["EarCut_jll", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"]
git-tree-sha1 = "83ea630384a13fc4f002b77690bc0afeb4255ac9"
uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
version = "0.4.2"

[[deps.Gettext_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"]
git-tree-sha1 = "9b02998aba7bf074d14de89f9d37ca24a1a0b046"
uuid = "78b55507-aeef-58d4-861c-77aaff3498b1"
version = "0.21.0+0"

[[deps.Glib_jll]]
deps = ["Artifacts", "Gettext_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Libiconv_jll", "Libmount_jll", "PCRE_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "a32d672ac2c967f3deb8a81d828afc739c838a06"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
version = "2.68.3+2"

[[deps.Graphite2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011"
uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472"
version = "1.3.14+0"

[[deps.Grisu]]
git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2"
uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe"
version = "1.0.2"

[[deps.HTTP]]
deps = ["Base64", "Dates", "IniFile", "Logging", "MbedTLS", "NetworkOptions", "Sockets", "URIs"]
git-tree-sha1 = "0fa77022fe4b511826b39c894c90daf5fce3334a"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.9.17"

[[deps.HarfBuzz_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"]
git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3"
uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566"
version = "2.8.1+1"

[[deps.HypergeometricFunctions]]
deps = ["DualNumbers", "LinearAlgebra", "SpecialFunctions", "Test"]
git-tree-sha1 = "65e4589030ef3c44d3b90bdc5aac462b4bb05567"
uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
version = "0.3.8"

[[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.IniFile]]
git-tree-sha1 = "f550e6e32074c939295eb5ea6de31849ac2c9625"
uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f"
version = "0.5.1"

[[deps.InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[deps.InverseFunctions]]
deps = ["Test"]
git-tree-sha1 = "91b5dcf362c5add98049e6c29ee756910b03051d"
uuid = "3587e190-3f89-42d0-90ee-14403ec27112"
version = "0.1.3"

[[deps.IrrationalConstants]]
git-tree-sha1 = "7fd44fd4ff43fc60815f8e764c0f352b83c49151"
uuid = "92d709cd-6900-40b7-9082-c6be49f344b6"
version = "0.1.1"

[[deps.IterTools]]
git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5"
uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
version = "1.4.0"

[[deps.IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"

[[deps.JLLWrappers]]
deps = ["Preferences"]
git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1"
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
version = "1.4.1"

[[deps.JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.3"

[[deps.JpegTurbo_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "b53380851c6e6664204efb2e62cd24fa5c47e4ba"
uuid = "aacddb02-875f-59d6-b918-886e6ef4fbf8"
version = "2.1.2+0"

[[deps.LAME_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "f6250b16881adf048549549fba48b1161acdac8c"
uuid = "c1c5ebd0-6772-5130-a774-d5fcae4a789d"
version = "3.100.1+0"

[[deps.LERC_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434"
uuid = "88015f11-f218-50d7-93a8-a6af411a945d"
version = "3.0.0+1"

[[deps.LZO_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e5b909bcf985c5e2605737d2ce278ed791b89be6"
uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac"
version = "2.10.1+0"

[[deps.LaTeXStrings]]
git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996"
uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
version = "1.3.0"

[[deps.Latexify]]
deps = ["Formatting", "InteractiveUtils", "LaTeXStrings", "MacroTools", "Markdown", "Printf", "Requires"]
git-tree-sha1 = "4f00cc36fede3c04b8acf9b2e2763decfdcecfa6"
uuid = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
version = "0.15.13"

[[deps.LibCURL]]
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"

[[deps.LibCURL_jll]]
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"

[[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"

[[deps.Libdl]]
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

[[deps.Libffi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "0b4a5d71f3e5200a7dff793393e09dfc2d874290"
uuid = "e9f186c6-92d2-5b65-8a66-fee21dc1b490"
version = "3.2.2+1"

[[deps.Libgcrypt_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgpg_error_jll", "Pkg"]
git-tree-sha1 = "64613c82a59c120435c067c2b809fc61cf5166ae"
uuid = "d4300ac3-e22c-5743-9152-c294e39db1e4"
version = "1.8.7+0"

[[deps.Libglvnd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll", "Xorg_libXext_jll"]
git-tree-sha1 = "7739f837d6447403596a75d19ed01fd08d6f56bf"
uuid = "7e76a0d4-f3c7-5321-8279-8d96eeed0f29"
version = "1.3.0+3"

[[deps.Libgpg_error_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "c333716e46366857753e273ce6a69ee0945a6db9"
uuid = "7add5ba3-2f88-524e-9cd5-f83b8a55f7b8"
version = "1.42.0+0"

[[deps.Libiconv_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "42b62845d70a619f063a7da093d995ec8e15e778"
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
version = "1.16.1+1"

[[deps.Libmount_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "9c30530bf0effd46e15e0fdcf2b8636e78cbbd73"
uuid = "4b2f31a3-9ecc-558c-b454-b3730dcb73e9"
version = "2.35.0+0"

[[deps.Libtiff_jll]]
deps = ["Artifacts", "JLLWrappers", "JpegTurbo_jll", "LERC_jll", "Libdl", "Pkg", "Zlib_jll", "Zstd_jll"]
git-tree-sha1 = "c9551dd26e31ab17b86cbd00c2ede019c08758eb"
uuid = "89763e89-9b03-5906-acba-b20f662cd828"
version = "4.3.0+1"

[[deps.Libuuid_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "7f3efec06033682db852f8b3bc3c1d2b0a0ab066"
uuid = "38a345b3-de98-5d2b-a5d3-14cd9215e700"
version = "2.36.0+0"

[[deps.LinearAlgebra]]
deps = ["Libdl", "libblastrampoline_jll"]
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[[deps.LogExpFunctions]]
deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"]
git-tree-sha1 = "58f25e56b706f95125dcb796f39e1fb01d913a71"
uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
version = "0.3.10"

[[deps.Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[deps.MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "3d3e902b31198a27340d0bf00d6ac452866021cf"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.9"

[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[deps.MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
git-tree-sha1 = "1c38e51c3d08ef2278062ebceade0e46cefc96fe"
uuid = "739be429-bea8-5141-9913-cc70e7f3736d"
version = "1.0.3"

[[deps.MbedTLS_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"

[[deps.Measures]]
git-tree-sha1 = "e498ddeee6f9fdb4551ce855a46f54dbd900245f"
uuid = "442fdcdd-2543-5da2-b0f3-8c86c306513e"
version = "0.3.1"

[[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"

[[deps.NaNMath]]
git-tree-sha1 = "737a5957f387b17e74d4ad2f440eb330b39a62c5"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "1.0.0"

[[deps.NetworkOptions]]
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"

[[deps.Ogg_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "887579a3eb005446d514ab7aeac5d1d027658b8f"
uuid = "e7412a2a-1a6e-54c0-be00-318e2571c051"
version = "1.3.5+1"

[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"

[[deps.OpenLibm_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "05823500-19ac-5b8b-9628-191a04bc5112"

[[deps.OpenSSL_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "ab05aa4cc89736e95915b01e7279e61b1bfe33b8"
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
version = "1.1.14+0"

[[deps.OpenSpecFun_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "13652491f6856acfd2db29360e1bbcd4565d04f1"
uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e"
version = "0.5.5+0"

[[deps.Opus_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "51a08fb14ec28da2ec7a927c4337e4332c2a4720"
uuid = "91d4177d-7536-5919-b921-800302f37372"
version = "1.3.2+0"

[[deps.OrderedCollections]]
git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.4.1"

[[deps.PCRE_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "b2a7af664e098055a7529ad1a900ded962bca488"
uuid = "2f80f16e-611a-54ab-bc61-aa92de5b98fc"
version = "8.44.0+0"

[[deps.PDMats]]
deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"]
git-tree-sha1 = "e8185b83b9fc56eb6456200e873ce598ebc7f262"
uuid = "90014a1f-27ba-587c-ab20-58faa44d9150"
version = "0.11.7"

[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "85b5da0fa43588c75bb1ff986493443f821c70b7"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.2.3"

[[deps.Pixman_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "b4f5d02549a10e20780a24fce72bea96b6329e29"
uuid = "30392449-352a-5448-841d-b1acce4e97dc"
version = "0.40.1+0"

[[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"

[[deps.PlotThemes]]
deps = ["PlotUtils", "Requires", "Statistics"]
git-tree-sha1 = "a3a964ce9dc7898193536002a6dd892b1b5a6f1d"
uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
version = "2.0.1"

[[deps.PlotUtils]]
deps = ["ColorSchemes", "Colors", "Dates", "Printf", "Random", "Reexport", "Statistics"]
git-tree-sha1 = "bb16469fd5224100e422f0b027d26c5a25de1200"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.2.0"

[[deps.Plots]]
deps = ["Base64", "Contour", "Dates", "Downloads", "FFMPEG", "FixedPointNumbers", "GR", "GeometryBasics", "JSON", "Latexify", "LinearAlgebra", "Measures", "NaNMath", "Pkg", "PlotThemes", "PlotUtils", "Printf", "REPL", "Random", "RecipesBase", "RecipesPipeline", "Reexport", "Requires", "Scratch", "Showoff", "SparseArrays", "Statistics", "StatsBase", "UUIDs", "UnicodeFun", "Unzip"]
git-tree-sha1 = "90021b03a38f1ae9dbd7bf4dc5e3dcb7676d302c"
uuid = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
version = "1.27.2"

[[deps.PlutoUI]]
deps = ["AbstractPlutoDingetjes", "Base64", "ColorTypes", "Dates", "Hyperscript", "HypertextLiteral", "IOCapture", "InteractiveUtils", "JSON", "Logging", "Markdown", "Random", "Reexport", "UUIDs"]
git-tree-sha1 = "bf0a1121af131d9974241ba53f601211e9303a9e"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
version = "0.7.37"

[[deps.Preferences]]
deps = ["TOML"]
git-tree-sha1 = "d3538e7f8a790dc8903519090857ef8e1283eecd"
uuid = "21216c6a-2e73-6563-6e65-726566657250"
version = "1.2.5"

[[deps.Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[deps.Qt5Base_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Fontconfig_jll", "Glib_jll", "JLLWrappers", "Libdl", "Libglvnd_jll", "OpenSSL_jll", "Pkg", "Xorg_libXext_jll", "Xorg_libxcb_jll", "Xorg_xcb_util_image_jll", "Xorg_xcb_util_keysyms_jll", "Xorg_xcb_util_renderutil_jll", "Xorg_xcb_util_wm_jll", "Zlib_jll", "xkbcommon_jll"]
git-tree-sha1 = "ad368663a5e20dbb8d6dc2fddeefe4dae0781ae8"
uuid = "ea2cea3b-5b76-57ae-a6ef-0a8af62496e1"
version = "5.15.3+0"

[[deps.QuadGK]]
deps = ["DataStructures", "LinearAlgebra"]
git-tree-sha1 = "78aadffb3efd2155af139781b8a8df1ef279ea39"
uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
version = "2.4.2"

[[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.RecipesBase]]
git-tree-sha1 = "6bf3f380ff52ce0832ddd3a2a7b9538ed1bcca7d"
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
version = "1.2.1"

[[deps.RecipesPipeline]]
deps = ["Dates", "NaNMath", "PlotUtils", "RecipesBase"]
git-tree-sha1 = "dc1e451e15d90347a7decc4221842a022b011714"
uuid = "01d81517-befc-4cb6-b9ec-a95719d0359c"
version = "0.5.2"

[[deps.Reexport]]
git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.2.2"

[[deps.RelocatableFolders]]
deps = ["SHA", "Scratch"]
git-tree-sha1 = "cdbd3b1338c72ce29d9584fdbe9e9b70eeb5adca"
uuid = "05181044-ff0b-4ac5-8273-598c1e38db00"
version = "0.1.3"

[[deps.Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "838a3a4188e2ded87a4f9f184b4b0d78a1e91cb7"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "1.3.0"

[[deps.Rmath]]
deps = ["Random", "Rmath_jll"]
git-tree-sha1 = "bf3188feca147ce108c76ad82c2792c57abe7b1f"
uuid = "79098fc4-a85e-5d69-aa6a-4863f24498fa"
version = "0.7.0"

[[deps.Rmath_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "68db32dff12bb6127bac73c209881191bf0efbb7"
uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f"
version = "0.3.0+0"

[[deps.SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[[deps.Scratch]]
deps = ["Dates"]
git-tree-sha1 = "0b4b7f1393cff97c33891da2a0bf69c6ed241fda"
uuid = "6c6a2e73-6563-6170-7368-637461726353"
version = "1.1.0"

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[deps.SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"

[[deps.Showoff]]
deps = ["Dates", "Grisu"]
git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de"
uuid = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
version = "1.0.3"

[[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.SpecialFunctions]]
deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"]
git-tree-sha1 = "5ba658aeecaaf96923dce0da9e703bd1fe7666f9"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "2.1.4"

[[deps.StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "6976fab022fea2ffea3d945159317556e5dad87c"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.4.2"

[[deps.Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[[deps.StatsAPI]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "c3d8ba7f3fa0625b062b82853a7d5229cb728b6b"
uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0"
version = "1.2.1"

[[deps.StatsBase]]
deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"]
git-tree-sha1 = "8977b17906b0a1cc74ab2e3a05faa16cf08a8291"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.33.16"

[[deps.StatsFuns]]
deps = ["ChainRulesCore", "HypergeometricFunctions", "InverseFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"]
git-tree-sha1 = "25405d7016a47cf2bd6cd91e66f4de437fd54a07"
uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c"
version = "0.9.16"

[[deps.StructArrays]]
deps = ["Adapt", "DataAPI", "StaticArrays", "Tables"]
git-tree-sha1 = "57617b34fa34f91d536eb265df67c2d4519b8b98"
uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
version = "0.6.5"

[[deps.SuiteSparse]]
deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"]
uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"

[[deps.TOML]]
deps = ["Dates"]
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"

[[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"

[[deps.Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[[deps.URIs]]
git-tree-sha1 = "97bbe755a53fe859669cd907f2d96aee8d2c1355"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.3.0"

[[deps.UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[deps.Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[deps.UnicodeFun]]
deps = ["REPL"]
git-tree-sha1 = "53915e50200959667e78a92a418594b428dffddf"
uuid = "1cfade01-22cf-5700-b092-accc4b62d6e1"
version = "0.4.1"

[[deps.Unzip]]
git-tree-sha1 = "34db80951901073501137bdbc3d5a8e7bbd06670"
uuid = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
version = "0.1.2"

[[deps.Wayland_jll]]
deps = ["Artifacts", "Expat_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg", "XML2_jll"]
git-tree-sha1 = "3e61f0b86f90dacb0bc0e73a0c5a83f6a8636e23"
uuid = "a2964d1f-97da-50d4-b82a-358c7fce9d89"
version = "1.19.0+0"

[[deps.Wayland_protocols_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4528479aa01ee1b3b4cd0e6faef0e04cf16466da"
uuid = "2381bf8a-dfd0-557d-9999-79630e7b1b91"
version = "1.25.0+0"

[[deps.XML2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "Zlib_jll"]
git-tree-sha1 = "1acf5bdf07aa0907e0a37d3718bb88d4b687b74a"
uuid = "02c8fc9c-b97f-50b9-bbe4-9be30ff0a78a"
version = "2.9.12+0"

[[deps.XSLT_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Libgcrypt_jll", "Libgpg_error_jll", "Libiconv_jll", "Pkg", "XML2_jll", "Zlib_jll"]
git-tree-sha1 = "91844873c4085240b95e795f692c4cec4d805f8a"
uuid = "aed1982a-8fda-507f-9586-7b0439959a61"
version = "1.1.34+0"

[[deps.Xorg_libX11_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxcb_jll", "Xorg_xtrans_jll"]
git-tree-sha1 = "5be649d550f3f4b95308bf0183b82e2582876527"
uuid = "4f6342f7-b3d2-589e-9d20-edeb45f2b2bc"
version = "1.6.9+4"

[[deps.Xorg_libXau_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4e490d5c960c314f33885790ed410ff3a94ce67e"
uuid = "0c0b7dd1-d40b-584c-a123-a41640f87eec"
version = "1.0.9+4"

[[deps.Xorg_libXcursor_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXfixes_jll", "Xorg_libXrender_jll"]
git-tree-sha1 = "12e0eb3bc634fa2080c1c37fccf56f7c22989afd"
uuid = "935fb764-8cf2-53bf-bb30-45bb1f8bf724"
version = "1.2.0+4"

[[deps.Xorg_libXdmcp_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4fe47bd2247248125c428978740e18a681372dd4"
uuid = "a3789734-cfe1-5b06-b2d0-1dd0d9d62d05"
version = "1.1.3+4"

[[deps.Xorg_libXext_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "b7c0aa8c376b31e4852b360222848637f481f8c3"
uuid = "1082639a-0dae-5f34-9b06-72781eeb8cb3"
version = "1.3.4+4"

[[deps.Xorg_libXfixes_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "0e0dc7431e7a0587559f9294aeec269471c991a4"
uuid = "d091e8ba-531a-589c-9de9-94069b037ed8"
version = "5.0.3+4"

[[deps.Xorg_libXi_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll", "Xorg_libXfixes_jll"]
git-tree-sha1 = "89b52bc2160aadc84d707093930ef0bffa641246"
uuid = "a51aa0fd-4e3c-5386-b890-e753decda492"
version = "1.7.10+4"

[[deps.Xorg_libXinerama_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll"]
git-tree-sha1 = "26be8b1c342929259317d8b9f7b53bf2bb73b123"
uuid = "d1454406-59df-5ea1-beac-c340f2130bc3"
version = "1.1.4+4"

[[deps.Xorg_libXrandr_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libXext_jll", "Xorg_libXrender_jll"]
git-tree-sha1 = "34cea83cb726fb58f325887bf0612c6b3fb17631"
uuid = "ec84b674-ba8e-5d96-8ba1-2a689ba10484"
version = "1.5.2+4"

[[deps.Xorg_libXrender_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "19560f30fd49f4d4efbe7002a1037f8c43d43b96"
uuid = "ea2f1a96-1ddc-540d-b46f-429655e07cfa"
version = "0.9.10+4"

[[deps.Xorg_libpthread_stubs_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "6783737e45d3c59a4a4c4091f5f88cdcf0908cbb"
uuid = "14d82f49-176c-5ed1-bb49-ad3f5cbd8c74"
version = "0.1.0+3"

[[deps.Xorg_libxcb_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "XSLT_jll", "Xorg_libXau_jll", "Xorg_libXdmcp_jll", "Xorg_libpthread_stubs_jll"]
git-tree-sha1 = "daf17f441228e7a3833846cd048892861cff16d6"
uuid = "c7cfdc94-dc32-55de-ac96-5a1b8d977c5b"
version = "1.13.0+3"

[[deps.Xorg_libxkbfile_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libX11_jll"]
git-tree-sha1 = "926af861744212db0eb001d9e40b5d16292080b2"
uuid = "cc61e674-0454-545c-8b26-ed2c68acab7a"
version = "1.1.0+4"

[[deps.Xorg_xcb_util_image_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "0fab0a40349ba1cba2c1da699243396ff8e94b97"
uuid = "12413925-8142-5f55-bb0e-6d7ca50bb09b"
version = "0.4.0+1"

[[deps.Xorg_xcb_util_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxcb_jll"]
git-tree-sha1 = "e7fd7b2881fa2eaa72717420894d3938177862d1"
uuid = "2def613f-5ad1-5310-b15b-b15d46f528f5"
version = "0.4.0+1"

[[deps.Xorg_xcb_util_keysyms_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "d1151e2c45a544f32441a567d1690e701ec89b00"
uuid = "975044d2-76e6-5fbe-bf08-97ce7c6574c7"
version = "0.4.0+1"

[[deps.Xorg_xcb_util_renderutil_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "dfd7a8f38d4613b6a575253b3174dd991ca6183e"
uuid = "0d47668e-0667-5a69-a72c-f761630bfb7e"
version = "0.3.9+1"

[[deps.Xorg_xcb_util_wm_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xcb_util_jll"]
git-tree-sha1 = "e78d10aab01a4a154142c5006ed44fd9e8e31b67"
uuid = "c22f9ab0-d5fe-5066-847c-f4bb1cd4e361"
version = "0.4.1+1"

[[deps.Xorg_xkbcomp_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_libxkbfile_jll"]
git-tree-sha1 = "4bcbf660f6c2e714f87e960a171b119d06ee163b"
uuid = "35661453-b289-5fab-8a00-3d9160c6a3a4"
version = "1.4.2+4"

[[deps.Xorg_xkeyboard_config_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Xorg_xkbcomp_jll"]
git-tree-sha1 = "5c8424f8a67c3f2209646d4425f3d415fee5931d"
uuid = "33bec58e-1273-512f-9401-5d533626f822"
version = "2.27.0+4"

[[deps.Xorg_xtrans_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "79c31e7844f6ecf779705fbc12146eb190b7d845"
uuid = "c5fb5394-a638-5e4d-96e5-b29de1b5cf10"
version = "1.4.0+3"

[[deps.Zlib_jll]]
deps = ["Libdl"]
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"

[[deps.Zstd_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "e45044cd873ded54b6a5bac0eb5c971392cf1927"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.2+0"

[[deps.libass_jll]]
deps = ["Artifacts", "Bzip2_jll", "FreeType2_jll", "FriBidi_jll", "HarfBuzz_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "5982a94fcba20f02f42ace44b9894ee2b140fe47"
uuid = "0ac62f75-1d6f-5e53-bd7c-93b484bb37c0"
version = "0.15.1+0"

[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl", "OpenBLAS_jll"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"

[[deps.libfdk_aac_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "daacc84a041563f965be61859a36e17c4e4fcd55"
uuid = "f638f0a6-7fb0-5443-88ba-1cc74229b280"
version = "2.0.2+0"

[[deps.libpng_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"]
git-tree-sha1 = "94d180a6d2b5e55e447e2d27a29ed04fe79eb30c"
uuid = "b53b4c65-9356-5827-b1ea-8c7a1a84506f"
version = "1.6.38+0"

[[deps.libvorbis_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Ogg_jll", "Pkg"]
git-tree-sha1 = "b910cb81ef3fe6e78bf6acee440bda86fd6ae00c"
uuid = "f27f6e37-5d2b-51aa-960f-b287f2bc3b7a"
version = "1.3.7+1"

[[deps.nghttp2_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"

[[deps.p7zip_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"

[[deps.x264_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "4fea590b89e6ec504593146bf8b988b2c00922b2"
uuid = "1270edf5-f2f9-52d2-97e9-ab00b5d0237a"
version = "2021.5.5+0"

[[deps.x265_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "ee567a171cce03570d77ad3a43e90218e38937a9"
uuid = "dfaa095f-4041-5dcd-9319-2fabd8486b76"
version = "3.5.0+0"

[[deps.xkbcommon_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Wayland_jll", "Wayland_protocols_jll", "Xorg_libxcb_jll", "Xorg_xkeyboard_config_jll"]
git-tree-sha1 = "ece2350174195bb31de1a63bea3a41ae1aa593b6"
uuid = "d8fb68d0-12a3-5cfd-a85a-d49703b185fd"
version = "0.9.1+5"
"""

# ╔═╡ Cell order:
# ╟─dbf8cdd6-7815-49f8-9dd6-5987000792ce
# ╟─20697867-c74a-4485-bb97-c6a31060669a
# ╟─64e29d20-aaf5-4fa0-ad03-b283dac52dce
# ╠═521890de-ab23-11ec-0c2f-2dcaee6dc1bc
# ╠═3f43a098-0653-4cb3-a48e-673e342ae48b
# ╟─ddae88bf-0b17-40f4-ae33-5cd70aa8a0de
# ╠═c0e571b7-580a-4b25-ba5b-6cb729ec36b9
# ╟─7807af0d-012a-432a-9a64-5df4a633333b
# ╟─713fc6aa-3cdb-49ad-903c-9127452e69b9
# ╟─443fc984-8109-45c3-a6e5-e6e565dd0491
# ╠═6d30adc5-4da9-4e85-bd47-e128de6fffb2
# ╟─9a9ed77b-903e-4587-967c-518343a62e54
# ╠═b0ca1c8f-272d-4a2f-ac4b-10bd659fceda
# ╟─1e943933-7266-4696-9388-6060d0d173e8
# ╠═4520bf81-0491-4a47-99c4-45680964654c
# ╟─ea7e4bb9-5eca-4046-8209-51489614c636
# ╟─8352dd50-1f7d-4e3d-9365-5af24d43547c
# ╟─af1c928e-ab6c-4212-88df-e3109503a157
# ╠═5d376188-fad1-48fb-86a2-7dcc908c337f
# ╠═0ab7a2d2-0d17-4523-8e91-b28624303524
# ╠═f140fb8e-308f-40e4-a199-b0e0d20dc7da
# ╠═a222e7a1-dd18-4416-92eb-320f926d1d77
# ╟─ebe47018-7a6d-42a4-a61a-0079b5c077f8
# ╟─29a2e115-37a7-4f67-a040-a4c1648fdfa6
# ╟─a185e773-f51e-449b-8d40-de819bd4badf
# ╟─885941da-8604-4af0-8b69-6d564348f116
# ╟─2134273b-fca8-4238-b906-f05948fae7d2
# ╠═1da1e41d-73a6-43f4-9d69-3e28b83da8e0
# ╟─caa4ea34-e2ae-455a-88a7-6324ff2cc8ef
# ╠═eb7572bd-63eb-4792-b982-9f320358a99c
# ╟─1c902aac-d633-4cde-95e1-62e42e0ffe87
# ╟─09a0f94b-e90c-4233-933c-7c1237f11658
# ╠═8a1a0dd9-a5fc-4ea1-b026-c47490db1bc3
# ╠═011a3508-939b-47b6-a062-9d61c6ea9eec
# ╟─aef02ab9-4e12-4030-b428-f4aa36f65ba6
# ╠═e5ac4d16-20ed-4c35-832f-b6fd5cfad2dd
# ╠═b0d76b5d-cefa-489e-9963-830d6fb710a0
# ╠═a27efaae-2793-4d8a-8dd6-4900caa80a4a
# ╟─829ad68b-7352-4d18-bcfd-90919b18648c
# ╟─fc1acb74-f856-47c7-b9e1-8d635f0e35ca
# ╟─c2c198a7-4597-49e2-98d7-8776603db7fa
# ╟─cf6a955e-d684-4a16-bc0f-14409f83536a
# ╟─ed777a37-6351-41a1-aed3-86412c9edaac
# ╠═db26ed1c-b01a-4f06-886d-4079cf2c139f
# ╟─7889eeaa-a7b5-4cdd-8b26-c0de2d2981e0
# ╠═23abf65d-276d-4a5d-ae70-b41255b35b48
# ╟─ac1c2222-04b5-4af0-a55c-723b1ad57dec
# ╠═9c2f4080-9dd5-4f85-83f7-42bf3c719e6e
# ╠═23118be8-96de-4df1-8b01-297f6ac3d1be
# ╠═7520499e-e499-4873-b96a-acbdb777ca80
# ╠═2a78805b-6f73-4a44-b862-8fa15be1a20a
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002


text:
"""

    plt = plotsgaugewaveform(gauge::VisClaw.Gauge; kwargs...)

	plt = plotsgaugewaveform(gauges::Vector{VisClaw.Gauge}; kwargs...)

    plotsgaugewaveform!(plt::Plots.Plot, gauge::VisClaw.Gauge; kwargs...)

    plotsgaugewaveform!(plt::Plots.Plot, gauges::Vector{VisClaw.Gauge}; kwargs...)

Function: plot waveforms of gauges
"""
function plotsgaugewaveform!(plt, gauge::VisClaw.Gauge; kwargs...)
    # keyword args
    d = KWARG(kwargs)
    # plot
    plt = Plots.plot!(plt, gauge.time, gauge.eta; label=gauge.label, d...)
    # return
    return plt
end
###########################################
"""
$(@doc plotsgaugewaveform!)
"""
plotsgaugewaveform(gauge::VisClaw.Gauge; kwargs...) =
plotsgaugewaveform!(Plots.plot(), gauge; kwargs...)
###########################################

###########################################
function plotsgaugewaveform!(plt, gauges::Vector{VisClaw.Gauge}; kwargs...)
    # keyword args
    d = KWARG(kwargs)
    # get values in all gauges
    time_all = getfield.(gauges, :time)
    eta_all = getfield.(gauges, :eta)
    label_all = getfield.(gauges, :label)
	# number of gauges
	ngauge = length(gauges)

	for i = 1:ngauge
        # plot
        plt = Plots.plot!(plt, time_all[i], eta_all[i]; label=label_all[i], d...)
	end

    # return
    return plt
end
###########################################
plotsgaugewaveform(gauges::Vector{VisClaw.Gauge}; kwargs...) =
plotsgaugewaveform!(Plots.plot(), gauges; kwargs...)
###########################################

ext: jl


text:
using BinaryBuilder

name = "Chafa"
version = v"1.4.1"

sources = [
    ArchiveSource("https://hpjansson.org/chafa/releases/chafa-$(version).tar.xz",
                  "46d34034f4c96d120e0639f87a26590427cc29e95fe5489e903a48ec96402ba3"),
]

script = raw"""
cd ${WORKSPACE}/srcdir/chafa-*/

if [[ "${target}" == *darwin* ]]; then
    # For some reason building with Clang for macOS doesn't work
    export CC=gcc
fi
if [[ "${proc_family}" == intel ]]; then
    BUILTIN_FUNCS=yes
else
    BUILTIN_FUNCS=no
fi
./autogen.sh \
    --prefix=${prefix} \
    --build=${MACHTYPE} \
    --host=${target} \
    ax_cv_gcc_check_x86_cpu_init="${BUILTIN_FUNCS}" \
    ax_cv_gcc_check_x86_cpu_supports="${BUILTIN_FUNCS}"
make -j${nproc}
make install
"""

# Chafa itself does not support Windows
platforms = filter!(!Sys.iswindows, supported_platforms())

products = [
    LibraryProduct("libchafa", :libchafa),
    ExecutableProduct("chafa", :chafa),
]

dependencies = [
    Dependency("FreeType2_jll"),
    Dependency("Glib_jll", v"2.59.0"; compat="2.59.0"),
    Dependency("ImageMagick_jll"),
]

# Build the tarballs.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

max_stars_repo_name: jameskermode/Yggdrasil

max_issues_repo_name: jameskermode/Yggdrasil

max_forks_repo_name: jameskermode/Yggdrasil


text:
using Documenter, Iterators

makedocs(
    modules = [Iterators],
    format = :html,
    sitename = "Iterators",
    pages = Any[
        "Introduction" => "index.md",
        "Function index" => "functionindex.md"
        ])

deploydocs(
    repo = "github.com/JuliaCollections/Iterators.jl.git",
    target = "build",
    julia  = "0.5",
    osname = "osx",
    deps = nothing,
    make = nothing
)


text:
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/FEMBase.jl/blob/master/LICENSE

using FEMBase
using Base.Test

mutable struct Dummy <: FieldProblem end

@testset "no unknown field name or assemble!-function defined" begin
    el = Element(Quad4, [1, 2, 3, 4])
    pr = Problem(Dummy, "problem", 2)
    add_elements!(pr, [el])
    assemble!(pr)
    @test true
end


text:
# have Petsc report errors to Julia

function error_handler(comm::comm_type, line::Int32, func::Ptr{UInt8}, file::Ptr{UInt8}, n::PetscErrorCode, p::PetscErrorType, mess::Ptr{UInt8}, ctx::Ptr{Void})
# receives the error call from Petsc

func_string = bytestring(func)
file_string = bytestring(file)

if p == PETSC_ERROR_INITIAL
  p_string = "Initial Petsc Error"
elseif p == PETSC_ERROR_REPEAT
  p_string = "Repeat Petsc Error"
elseif  p == PETSC_ERROR_IN_CXX
  p_string == "CXX Petsc Error"
else
  pstring = "Unknown PetscErrorType"
end

mess_string = bytestring(mess)
print_with_color(:red, STDERR, string("\n### ERROR: PETSc Internal Error ###\n"))
print_with_color(:red, STDERR, string("Error in function ", func_string, ", file ", file_string, "\n"))
print_with_color(:red, STDERR, string("Error number: ", n, ", Error type: ", p_string, "\n"))
print_with_color(:red, STDERR, string("Error message: \n", mess_string, "\n"))
print_with_color(:red, STDERR, string("### Error Message Finished ###\n"))

bt = backtrace()
s = sprint(io->Base.show_backtrace(io, bt))
print_with_color(:red, STDERR, string("backtrace: ", s))
print(STDERR, "\n\n")

return PetscErrorCode(0)

end

# tell Petsc abut the Error handler
cfunc = cfunction(error_handler, PetscErrorCode, (comm_type, Int32, Ptr{UInt8}, Ptr{UInt8}, PetscErrorCode, PetscErrorType, Ptr{UInt8}, Ptr{Void}) )
ctx = C_NULL
#ierr = ccall( (:PetscPushErrorHandler, petsc), PetscErrorCode, (Ptr{Void}, Ptr{Void}), cfunc, ctx)

function chkerrq(i::PetscErrorCode)
  if i != 0
    error("Petsc Error Code: $i")
  end

  return nothing
end


text:
module RuntimeContext

const DEVENV_DIRNAME = "devenvmgr"
const DEPOT_DEVENV = Ref("")
const BUILD_DEVENV = Ref("")

installpath() = dirname(Sys.BINDIR)

depotuser_path() = joinpath(homedir(), ".julia")
depotlocal_path() = joinpath(installpath(), "local", "share", "julia")
depotglobal_path() = joinpath(installpath(), "share", "julia")

julia_executable() = joinpath(Sys.BINDIR, Sys.iswindows() ? "julia.exe" : "julia")

function depotdevenv_path()
    DEPOT_DEVENV[] != "" && return DEPOT_DEVENV[]

    path = joinpath(depotuser_path(), DEVENV_DIRNAME, "depot")
    path_gen = joinpath(depotuser_path(), "registries", "General")
    path_reg = joinpath(path, "registries")
    link_gen = joinpath(path_reg, "General")
    mkpath(path)
    mkpath(path_reg)
    # avoid cloning General - Windows: should do a Junction, no special rights
    ispath(link_gen) || symlink(path_gen, link_gen; dir_target=true)
    DEPOT_DEVENV[] = path
    return path
end

function builddevenv_path()
    BUILD_DEVENV[] != "" && return BUILD_DEVENV[]
    # Note: For julia <= 1.7 CPU_NAME resolve to the LLVM target name.
    # We build sysimage with the "native" target, which is CPU_NAME.
    ver = Base.VERSION
    sys = "v$(ver.major).$(ver.minor)"
    arch = Sys.MACHINE # x86_64-w64-mingw32
    target = Sys.CPU_NAME # haswell
    path = joinpath(depotuser_path(), DEVENV_DIRNAME, "$sys-$arch-$target")
    mkpath(path)
    BUILD_DEVENV[] = path
    return path
end

depotdevenv() = [depotdevenv_path(); depotlocal_path(); depotglobal_path()]

depotstandard() = [depotuser_path(); depotlocal_path(); depotglobal_path()]

isdepotstandard() = DEPOT_PATH == depotstandard()

# function ensure_init()
#     # Helper for Revise dev cycle
#     DEPOT_DEVENV[] = ""
#     BUILD_DEVENV[] = ""
#     depotdevenv_path()
#     builddevenv_path()
# end

end # module RuntimeContext


text:
### A Pluto.jl notebook ###
# v0.12.20

using Markdown
using InteractiveUtils

# ╔═╡ 265ed188-5bf6-11eb-0d29-51ea74e6c7d1
using Pkg, DrWatson

# ╔═╡ ac6f2dfc-5bf6-11eb-3dc0-b5368b466ff7
begin
	using Distributions
	using StatsPlots
	using StatsBase
	using LaTeXStrings
	using CSV
	using DataFrames
	using LinearAlgebra
	using Random
	using ParetoSmoothedImportanceSampling
	using StanQuap
	using StatisticalRethinking
	using StatisticalRethinkingPlots
end

# ╔═╡ a4042486-5bf5-11eb-0183-33fd00d868e4
md" ## Clip-07-16-18.2s.jl"

# ╔═╡ 5f749200-6757-11eb-0345-6b094802c649
function logprob(post_df::DataFrame, x::Matrix, y::Vector, k=k)
	b = Matrix(hcat(post_df[:, [Symbol("b.$i") for i in 1:k]]))
	mu = post_df.a .+ b * x[:, 1:k]'
    logpdf.(Normal.(mu , post_df.sigma),  y')
end

# ╔═╡ ac8227b2-5bf6-11eb-27dd-09924b99e6c2
stan7_9 = "
data {
    int<lower=1> K;
    int<lower=0> N;
    matrix[N, K] x;
    vector[N] y;
}
parameters {
    real a;
    vector[K] b;
    real<lower=0> sigma;
}
transformed parameters {
    vector[N] mu;
    mu = a + x * b;
}
model {
	a ~ normal(0, 100);
	b ~ normal(0, 10);
	sigma ~ exponential(1);
    y ~ normal(mu, sigma);          // observed model
}
generated quantities {
	vector[N] log_lik;
	for (i in 1:N)
		log_lik[i] = normal_lpdf(y[i] | mu[i], sigma);
}
";

# ╔═╡ 00ee9dc0-5c23-11eb-10c3-1dfb4f486e6f
begin
	tmpdir = joinpath(projectdir(), "tmp")
	m7_9s = SampleModel("m7.9s", stan7_9; tmpdir)
end;

# ╔═╡ 5d5b8982-64b2-11eb-0ca9-b94e3197ff31
begin
	Ns = [20, 100] 				# Number of observations
	rho = [0.15, -0.4]			# Covariance between x1 and x2
	L = 100 					    # Number of simulations
	K = 5 						# Number of slopes
	dev_is = zeros(L, K)
	dev_os = zeros(L, K)
	res = Vector{NamedTuple}(undef, length(Ns))
end;

# ╔═╡ f253787c-64c3-11eb-2cd4-9322707100b7
begin
	for (ind, N) in enumerate(Ns)
		for i in 1:L
			for j = 1:K
				println("N = $(Ns[ind]), run = $i, no of b parms = $j")
				y, x_train, x_test = sim_train_test(;N, K, rho)
				data = (N = size(x_train, 1), K = size(x_train, 2),
					y = y, x = x_train,
					N_new = size(x_test, 1), x_new = x_test)
				rc7_9s = stan_sample(m7_9s; data)
				if success(rc7_9s)

					# use `logprob()`

					post7_9s_df = read_samples(m7_9s, :dataframe)
					lp_train = logprob(post7_9s_df, x_train, y, j)
					loo_lp_is, _, _ = psisloo(lp_train)
					dev_is[i, j] = -2loo_lp_is
					lp_test = logprob(post7_9s_df, x_test, y, j)
					loo_lp_is, _, _ = psisloo(lp_test)
					dev_os[i, j] = -2loo_lp_is

				end
			end
		end
		res[ind] = (
			mean_dev_is = mean(dev_is, dims=1),
			std_dev_is = std(dev_is, dims=1),
			mean_dev_os = mean(dev_os, dims=1),
			std_dev_os =std(dev_os, dims=1)
		)
	end
end;

# ╔═╡ 7eb8b028-657f-11eb-0abf-37c3819aea78
begin
	fig = Vector{Plots.Plot{Plots.GRBackend}}(undef, 2)
	for i in 1:2
		xcoord = collect(1:K) .- 0.05
		ycoord = res[i].mean_dev_is[1,:]
		ylims = i == 1 ? (0,170) : (200, 400)
		fig[i] = scatter(xcoord, ycoord, xlab = "No of b parameters",
			ylab = "Deviance", ylims = ylims, leg=:bottomleft,
			lab = "In sample", markersize=2)
		for j in 1:K
			plot!([xcoord[j], xcoord[j]],
				[ycoord[j]-res[i].std_dev_is[j], ycoord[j]+res[i].std_dev_is[j]],
				lab=false, color=:darkblue)
		end
		title!("N = $(Ns[i])")
		xcoord = collect(1:K) .+ 0.05
		ycoord = res[i].mean_dev_os[1,:]
		scatter!(xcoord, ycoord, lab = "Out of sample", markersize=2)
		for j in 1:K
			plot!([xcoord[j], xcoord[j]],
				[ycoord[j]-res[i].std_dev_os[j], ycoord[j]+res[i].std_dev_os[j]],
				lab=false, color=:red)
		end
		title!("N = $(Ns[i])")
	end
	plot(fig..., layout=(1,2))
end

# ╔═╡ 67d8698e-6faf-11eb-18f7-318ec55c1c7a
begin
	devs = Vector{Float64}(undef, 2)
	y, x_train, x_test = sim_train_test(;N=100, K=5, rho)
	data = (N = size(x_train, 1), K = size(x_train, 2),
		y = y, x = x_train,
		N_new = size(x_test, 1), x_new = x_test)
	rc7_9s = stan_sample(m7_9s; data)
	if success(rc7_9s)

		# use `logprob()`

		post7_9s_df = read_samples(m7_9s, :dataframe)
		lp_train = logprob(post7_9s_df, x_train, y, 2)
		devs[1] = -2sum(lppd(lp_train))
		lp_test = logprob(post7_9s_df, x_test, y, 2)
		devs[2] = -2sum(lppd(lp_test))
	end
end;

# ╔═╡ 08703112-6fb0-11eb-28d7-83dcab6b1998
md"
!!! note
	In some runs, out-of-sample deviance can be much larger than PSIS and WAIC estimates. In-sample deviance is always lower than PSIS and WAIC estimates. Re-run above cell several times to see this.
"

# ╔═╡ 8ffcd37a-6faf-11eb-329f-fb9ddfe5247c
Text("In-sample deviance = $(devs[1]), out-of-sample deviance = $(devs[2])")

# ╔═╡ 8ffd04ee-6faf-11eb-1e4b-f13d4d3bfe9c
if success(rc7_9s)
	waic(m7_9s)
end

# ╔═╡ 8ffdaed0-6faf-11eb-36fc-47790fcae672
if success(rc7_9s)
	loo7_9s, loos7_9s, pk7_9s = psisloo(m7_9s)
	-2loo7_9s
end

# ╔═╡ 74d4016e-6563-11eb-0c3b-b7c4f81baca6
md" ## End of clip-07-16-18.2s.jl"

# ╔═╡ Cell order:
# ╟─a4042486-5bf5-11eb-0183-33fd00d868e4
# ╠═265ed188-5bf6-11eb-0d29-51ea74e6c7d1
# ╠═ac6f2dfc-5bf6-11eb-3dc0-b5368b466ff7
# ╠═5f749200-6757-11eb-0345-6b094802c649
# ╠═ac8227b2-5bf6-11eb-27dd-09924b99e6c2
# ╠═00ee9dc0-5c23-11eb-10c3-1dfb4f486e6f
# ╠═5d5b8982-64b2-11eb-0ca9-b94e3197ff31
# ╠═f253787c-64c3-11eb-2cd4-9322707100b7
# ╠═7eb8b028-657f-11eb-0abf-37c3819aea78
# ╠═67d8698e-6faf-11eb-18f7-318ec55c1c7a
# ╟─08703112-6fb0-11eb-28d7-83dcab6b1998
# ╠═8ffcd37a-6faf-11eb-329f-fb9ddfe5247c
# ╠═8ffd04ee-6faf-11eb-1e4b-f13d4d3bfe9c
# ╠═8ffdaed0-6faf-11eb-36fc-47790fcae672
# ╟─74d4016e-6563-11eb-0c3b-b7c4f81baca6


text:
module BadUtils

using DataStructures

nested_dict(K::DataType=Any, V::DataType=Any) = DefaultDict{K, V}(nested_dict)

function reversekv(dict::AbstractDict{K,V}) where {K,V}
    Base.typename(typeof(dict)).wrapper{V,K}(v => k for (k, v) in dict)
end

collectkeys(args) = keys(args) |> collect
collectvals(args) = values(args) |> collect

"""
    Path(s::String)

Create a path from a `String`. Paths may be concatenated with `*`
"""
struct Path
    x::String
end

Base.convert(::Type{String}, p::Path) = p.x
Base.String(p::Path) = convert(String, p)
Base.open(x::Path, m::String) = open(convert(String, x), m)

# Necessary to specify Function due to ambiguity errors
Base.open(f::Function, x::Path) = open(f, convert(String, x))
Base.:*(x::Path, y::Union{Path, String}) = Path(joinpath(String(x), String(y)))
Base.split(x::Path) = splitpath(x.x)

for f in [:(Base.open), :(Base.splitpath)]
    @eval $f(x::Path) = $f(String(x))
end

for f in [:(Base.basename), :(Base.isdir), :(Base.ispath), :(Base.isfile)]
    @eval $f(x::Path) = Path($f(String(x)))
end

"""
    @indir directory expression

Move to `directory`, execute expression, then move back.
"""
macro indir(directory, ex)
    quote
        local dir = pwd()
        cd($(directory))
        local val = $(esc(ex))
        cd(dir)
        val
    end
end

function tryint(number)
    return (try
        Int64(number)
    catch
        number
    end)
end
function tryfloat(number)
    return (try
        Float64(number)
    catch
        number
    end)
end
function tryfloat32(number)
    return (try
        Float32(number)
    catch
        number
    end)
end
function unitrange(arr::AbstractVector{T}) where {T<:Int}
    start_value = arr[1]
    end_value = arr[end]
    end_value == start_value && error("the start and end points are the same value")
	end_value < start_value && error("the last value is lower than the first")
    for i in 2:size(arr,1)
        if arr[i]-arr[i-1] != 1
            error("inconsistent step for unit range")
        end
    end
    return UnitRange(start_value,end_value)
end
function steprange(arr::AbstractVector{T}) where {T<:Real}
    start_value = arr[1]
    end_value = arr[end]
	start_value == end_value && error("the start and end points are the same value")
    step = 1
    for i in 2:size(arr,1)
        if i == 2
            step = arr[i]-arr[i-1]
        end
        if arr[i]-arr[i-1] != step
            error("inconsistent step for step range")
        end
    end
    return StepRangeLen(start_value,step,length(arr))
end
function varcall(name::String, body::Any)
    name=Symbol(name)
    @eval (($name) = ($body))
	return Symbol(name)
end

end # module

max_stars_repo_name: jakobnissen/BadBio


text:
#!/bin/bash
#=
exec julia --color=yes --startup-file=no "${BASH_SOURCE[0]}" "$@"
=#

using Pkg
#Pkg.activate(".")
#include("srg/MockFBA.jl")
import MockFBA

using YAML

function main(ARGS)
    #load the config file
    config=YAML.load_file(ARGS[1])
    tracer=ARGS[2]
    #1 to preprocess focalp plan
    focal_plane=parse(Int32,ARGS[3])

    #get the needed info from config
    fname=config["target"][tracer]["FITSfile"]
    priority_list=config["target"][tracer]["Priorities"]
    priority_frac_list=config["target"][tracer]["Priority_fraction"]
    outfile=config["target"][tracer]["JLDfile"]
    tile_file=config["TILES"]["tile_file"]
    tile_radius_indeg=config["TILES"]["tile_radius"]
    npass=config["TILES"]["NumPass"]
    program=config["TILES"]["PROGRAM"]

    #pre-process the tracer
    MockFBA.preprocess_tracer(fname,priority_list,priority_frac_list,outfile,
        tile_file,tile_radius_indeg,npass,program)

    #pre-process the focal plane
    if(focal_plane==1)
        fp_dic,exc_dic=MockFBA.load_hw_full_FocalPlane!(config["focal_plane"];date=config["focal_plane"]["date"])
    end

end

@show ARGS
main(ARGS)

max_stars_repo_name: shadaba/MockFBA

max_issues_repo_name: shadaba/MockFBA

max_forks_repo_name: shadaba/MockFBA


text:
using Rubin
using Tests
using Elliptic
using HypergeometricFunctions
using Polylogarithms
using SpecialFunctions

@test integrate((a+a*x^2)^-1*exp(arccot(x)), x) == :(-1*a^-1*exp(arccot(x)))
@test integrate((a+a*x^2)^-2*exp(arccot(x)), x) == :(-2//5*a^-2*exp(arccot(x))+-1//5*a^-2*(1+x^2)^-1*(1+-2x)*exp(arccot(x)))
@test integrate((a+a*x^2)^-3*exp(arccot(x)), x) == :(-24//85*a^-3*exp(arccot(x))+-12//85*a^-3*(1+x^2)^-1*(1+-2x)*exp(arccot(x))+-1//17*a^-3*(1+x^2)^-2*(1+-4x)*exp(arccot(x)))
@test integrate((a+a*x^2)^-3//2*exp(arccot(x)), x) == :(-1//2*a^-1*(a+a*x^2)^-1//2*(1+-1x)*exp(arccot(x)))
@test integrate((a+a*x^2)^-5//2*exp(arccot(x)), x) == :(-3//10*a^-2*(a+a*x^2)^-1//2*(1+-1x)*exp(arccot(x))+-1//10*a^-1*(a+a*x^2)^-3//2*(1+-3x)*exp(arccot(x)))
@test integrate((a+a*x^2)^-7//2*exp(arccot(x)), x) == :(-3//13*a^-3*(a+a*x^2)^-1//2*(1+-1x)*exp(arccot(x))+-1//13*a^-2*(a+a*x^2)^-3//2*(1+-3x)*exp(arccot(x))+-1//26*a^-1*(a+a*x^2)^-5//2*(1+-5x)*exp(arccot(x)))

max_stars_repo_path: test/5 Inverse trig functions/5.4 Inverse cotangent/5.4.2 Exponentials of inverse cotangent.jl


text:
using Base.Test

@testset "utils" begin
    include("utils/import_datasets.jl")
    include("utils/import_example_nets.jl")
end


text:
export DataAccessor
export create_matrix, set_user_attribute, set_item_attribute

struct DataAccessor
    events::Array{Event,1}
    R::AbstractMatrix
    user_attributes::Dict{Int,Any} # user => attributes e.g. vector
    item_attributes::Dict{Int,Any} # item => attributes

    function DataAccessor(events::Array{Event,1}, n_user::Int, n_item::Int)
        R = create_matrix(events, n_user, n_item)
        new(events, R, Dict(), Dict())
    end

    function DataAccessor(R::AbstractMatrix)
        n_user, n_item = size(R)
        events = Array{Event,1}()

        for user in 1:n_user
            for item in 1:n_item
                r = R[user, item]
                if !isnan(r) && r != 0
                    append!(events, [Event(user, item, r)])
                end
            end
        end

        new(events, R, Dict(), Dict())
    end
end

function create_matrix(events::Array{Event,1}, n_user::Int, n_item::Int)
    R = ones(n_user, n_item) * NaN
    for event in events
        if isnan(R[event.user, event.item])
            R[event.user, event.item] = 0
        end

        # accumulate for implicit feedback events
        R[event.user, event.item] += event.value
    end
    R
end

function set_user_attribute(data::DataAccessor, user::Int, attribute::AbstractVector)
    data.user_attributes[user] = attribute
end

function set_item_attribute(data::DataAccessor, item::Int, attribute::AbstractVector)
    data.item_attributes[item] = attribute
end


text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

mutable struct TrustedIdProviderListResult <: SwaggerModel
    value::Any # spec type: Union{ Nothing, Vector{TrustedIdProvider} } # spec name: value
    nextLink::Any # spec type: Union{ Nothing, String } # spec name: nextLink

    function TrustedIdProviderListResult(;value=nothing, nextLink=nothing)
        o = new()
        validate_property(TrustedIdProviderListResult, Symbol("value"), value)
        setfield!(o, Symbol("value"), value)
        validate_property(TrustedIdProviderListResult, Symbol("nextLink"), nextLink)
        setfield!(o, Symbol("nextLink"), nextLink)
        o
    end
end # type TrustedIdProviderListResult

const _property_map_TrustedIdProviderListResult = Dict{Symbol,Symbol}(Symbol("value")=>Symbol("value"), Symbol("nextLink")=>Symbol("nextLink"))
const _property_types_TrustedIdProviderListResult = Dict{Symbol,String}(Symbol("value")=>"Vector{TrustedIdProvider}", Symbol("nextLink")=>"String")
Base.propertynames(::Type{ TrustedIdProviderListResult }) = collect(keys(_property_map_TrustedIdProviderListResult))
Swagger.property_type(::Type{ TrustedIdProviderListResult }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_TrustedIdProviderListResult[name]))}
Swagger.field_name(::Type{ TrustedIdProviderListResult }, property_name::Symbol) =  _property_map_TrustedIdProviderListResult[property_name]

function check_required(o::TrustedIdProviderListResult)
    true
end

function validate_property(::Type{ TrustedIdProviderListResult }, name::Symbol, val)
end


text:
using Documenter
using TrajectoryOptimization

makedocs(
    sitename = "TrajectoryOptimization",
    format = Documenter.HTML(prettyurls = false),
    pages = [
        "Introduction" => "index.md",
        "Getting Started" => [
            "model.md",
            "costfunctions.md",
            "constraints.md",
            "creating_problems.md"
        ],
        "Interfaces" => [
            "costfunction_interface.md",
            "constraint_interface.md"
        ],
        "API" => [
            "cost_api.md",
            "constraint_api.md",
            "problem.md",
            "nlp.md"
        ],
        "Examples" => "examples.md"
    ]
)

# Documenter can also automatically deploy documentation to gh-pages.
# See "Hosting Documentation" and deploydocs() in the Documenter manual
# for more information.
deploydocs(
    repo = "github.com/RoboticExplorationLab/TrajectoryOptimization.jl.git",
)


text:
#__precompile__()

module VBMatrixFactorization

import Base.copy
using Base
using JLD

export load_log, extract_params
export vbmf_parameters, vbmf, vbmf_init
export vbmf_sparse_parameters, vbmf_sparse, vbmf_sparse_init
export vbmf_dual_parameters, vbmf_dual, vbmf_dual_init

include("util.jl")
include("data_manip.jl")
include("vbmf.jl")
include("vbmf_sparse.jl")
include("vbmf_dual.jl")
include("vbmf_trial.jl")

end # module


text:
# test durationstring output at borders
@test ProgressMeter.durationstring(0.9) == "0:00:00"
@test ProgressMeter.durationstring(1.0) == "0:00:01"
@test ProgressMeter.durationstring(59.9) == "0:00:59"
@test ProgressMeter.durationstring(60.0) == "0:01:00"
@test ProgressMeter.durationstring(60*60 - 0.1) == "0:59:59"
@test ProgressMeter.durationstring(60*60) == "1:00:00"
@test ProgressMeter.durationstring(60*60*24 - 0.1) == "23:59:59"
@test ProgressMeter.durationstring(60*60*24) == "1 days, 0:00:00"
@test ProgressMeter.durationstring(60*60*24*10 - 0.1) == "9 days, 23:59:59"
@test ProgressMeter.durationstring(60*60*24*10) == "10.00 days"

@test ProgressMeter.Progress(5, "Progress:", Int16(5)).offset == 5
@test ProgressMeter.ProgressThresh(0.2, "Progress:", Int16(5)).offset == 5

# Performance test (from #171)
function prog_perf(n)
    prog = Progress(n)
    x = 0.0
    for i in 1:n
        x += rand()
        next!(prog)
    end
    return x
end

function noprog_perf(n)
    x = 0.0
    for i in 1:n
        x += rand()
    end
    return x
end

prog_perf(1)
noprog_perf(1)
@test @elapsed(prog_perf(10^7)) < 40*@elapsed(noprog_perf(10^7))


text:
@testset "Test assert_op" begin
    a = 2
    b = 2
    IS.@assert_op a == b
    IS.@assert_op a + 2 == b + 2
    IS.@assert_op isequal(a + 2, b + 2)

    @test_throws AssertionError IS.@assert_op a + 3 == b + 2
    @test_throws AssertionError IS.@assert_op isequal(a + 3, b + 2)
end


text:
using LinearAlgebra
include("../src/ExactDiagonalization.jl")
using .ExactDiagonalization
using Test
#-------------------------------------------------------------------------------------------------------------------------
# XY Model
#-------------------------------------------------------------------------------------------------------------------------
L = 4
println("------------------------------")
println("XY Model with L = $L")
println("------------------------------")
println("Basis Vector:")

basis = translationalbasis(x->sum(x)==3, 0, L)

for i=1:length(basis.I)
    change!(basis, i)
    println("$i : |$(basis.dgt...)⟩")
end

H = begin
    X = [0 1; 1 0]
    Y = [0 -1; 1 0] * 1im
    mat = div.(real(kron(X, X) + kron(Y, Y)), 2)
    trans_inv_operator(mat, 2, basis)
end

Hmat = Array(H)
println("\nMatrix:")
display(Hmat)
println("\n")

#-------------------------------------------------------------------------------------------------------------------------
# PXP Model
#-------------------------------------------------------------------------------------------------------------------------
L = 26
println("------------------------------")
println("PXP Model with L = $L")
println("------------------------------")
println("Basis Vector:")

pxpf(v::Vector{Int}) = all(v[i]==0 || v[mod(i, length(v))+1]==0 for i=1:length(v))
basis = translationalbasis(pxpf, 0, L)

#for i=1:length(basis.I)
#    change!(basis, i)
#    println("$i : |$(basis.dgt...)⟩")
#end

H = begin
    P = Diagonal([1, 1, 1, 0, 1, 1, 0, 0])
    X = [0 1; 1 0]
    mat = P * kron(I(2), X, I(2)) * P
    trans_inv_operator(mat, 3, basis)
end

Hmat = Array(H)
println("\nMatrix:")
println(size(Hmat))
print("\n")


text:
include("CenterOfMass.jl")

np = 5
thetas = 2*pi * (1/np:1/np:1)
circle_ps = map(theta->[cos(theta);sin(theta);0], thetas)

na = 5
thetas = 2*pi * (1/na:1/na:1)
r_attach = 0.8
attachment_ps = map(theta->r_attach*[cos(theta);sin(theta);0], thetas)

get_com() = r_attach * rand_in_circle()

com = get_com()

lin_prog, lin_fs = critical_force_from_points(circle_ps, com, attachment_ps[1], 1)
iterative, it_fs = critical_force_from_points(circle_ps, com, attachment_ps[1], 1, critical_force_iterative)

println("Lin prog solution: $(lin_prog), iterative solution $(iterative)")

max_stars_repo_name: mcorah/CenterOfMass

max_issues_repo_name: mcorah/CenterOfMass

max_forks_repo_name: mcorah/CenterOfMass


text:
n = rand(1:10)
Z = Companion(randn(n))

#Special properties
@test Matrix(inv(Z)) ≈ inv(Matrix(Z))

#Matvec product
b = randn(n)
@test Z*b ≈ Matrix(Z)*b

m = rand(1:10)
A = randn(m, n)
@test A*Z ≈ A*Matrix(Z)

# Polynomial construction
using Polynomials
p = Polynomial([-1,0,1])
p_c = Companion(p)
v1 = [1,1]
v2 = [-1,1]
@test p_c*v1 == v1
@test p_c*v2 == -v2


text:
const DEFAULT_BUF_SIZE = UInt64(1024 * 1024 * 30)

@inline megabytes(n::T) where {T<:Unsigned} = (T(1024) * T(1024)) * n
@inline megabytes(n::Signed) = megabytes(unsigned(n))

@inline gigabytes(n::T) where {T<:Unsigned} = (T(1024) * T(1024) * T(1024)) * n
@inline gigabytes(n::Signed) = gigabytes(unsigned(n))

mutable struct DatastoreBuffer{T<:ReadDatastore}
    data_store::T
    bufferdata::Vector{UInt8}
    buffer_position::Int
end

function DatastoreBuffer(ds::T, buffer_size = DEFAULT_BUF_SIZE) where {T<:ReadDatastore}
    return DatastoreBuffer{T}(ds, Vector{UInt8}(undef, buffer_size), typemax(Int))
end

function DatastoreBuffer(ds::ShortReads, buffer_size = DEFAULT_BUF_SIZE)
    if _bytes_per_read(ds) > buffer_size
        error("Desired buffer size is too small")
    end
    return DatastoreBuffer{typeof(ds)}(ds, Vector{UInt8}(undef, buffer_size), typemax(Int))
end

@inline buffer_len(sb::DatastoreBuffer) = length(buffer_array(sb))
@inline buffer_position(sb::DatastoreBuffer) = sb.buffer_position
@inline bufferpos!(sb::DatastoreBuffer, pos) = sb.buffer_position = pos
@inline datastore(sb::DatastoreBuffer) = sb.data_store
@inline stream(sb::DatastoreBuffer) = stream(datastore(sb))
@inline buffer_array(sb::DatastoreBuffer) = sb.bufferdata

@inline Base.eltype(sb::DatastoreBuffer) = Base.eltype(datastore(sb))
@inline Base.firstindex(sb::DatastoreBuffer) = firstindex(datastore(sb))
@inline Base.lastindex(sb::DatastoreBuffer) = lastindex(datastore(sb))
@inline Base.length(sb::DatastoreBuffer) = length(datastore(sb))
@inline Base.eachindex(sb::DatastoreBuffer) = eachindex(datastore(sb))
@inline Base.IteratorSize(sb::DatastoreBuffer) = Base.IteratorSize(datastore(sb))
@inline Base.IteratorEltype(sb::DatastoreBuffer) = Base.IteratorEltype(datastore(sb))
@inline Base.checkbounds(sb::DatastoreBuffer, i) = Base.checkbounds(datastore(sb), i)

@inline function _load_sequence_data!(seq::LongSequence{A}, sb::DatastoreBuffer, offset::Integer) where {A<:DNAAlphabet}
    bufdata = buffer_array(sb)
    seqdata = BioSequences.encoded_data(seq)
    GC.@preserve bufdata begin
        for i in eachindex(seqdata)
            seqdata[i] = unsafe_load(convert(Ptr{UInt64}, pointer(bufdata, offset + 1)))
            offset = offset + sizeof(UInt64)
        end
    end
    return seq
end

# Short Reads specific buffering.

@inline function _check_for_buffer_refresh!(sb::DatastoreBuffer{<:ShortReads{<:DNAAlphabet}}, file_offset::Integer)
    # IF the desired data is contained in the buffer, there's no need to refresh.
    # Otherwise, there is!
    buf_start = buffer_position(sb)
    buf_size = buffer_len(sb)
    file_end = file_offset + _bytes_per_read(datastore(sb))
    if file_offset < buf_start || file_end > buf_start + buf_size
        bufferpos!(sb, file_offset)
        seek(stream(sb), file_offset)
        readbytes!(stream(sb), buffer_array(sb), buf_size)
    end
end

@inline function Base.getindex(sb::DatastoreBuffer{<:ShortReads{<:DNAAlphabet}}, idx::Integer)
    @boundscheck checkbounds(sb, idx)
    file_offset = _offset_of_sequence(datastore(sb), idx)
    _check_for_buffer_refresh!(sb, file_offset)

    buffer_offset = file_offset - buffer_position(sb)
    sequence_length = unsafe_load(convert(Ptr{UInt64}, pointer(buffer_array(sb), buffer_offset + 1)))
    buffer_offset = buffer_offset + sizeof(UInt64)
    seq = eltype(sb)(sequence_length)

    return _load_sequence_data!(seq, sb, buffer_offset)
end

@inline function inbounds_load_sequence!(sb::DatastoreBuffer{<:ShortReads{A}}, i::Integer, seq::LongSequence{A}) where {A<:DNAAlphabet}
    file_offset = _offset_of_sequence(datastore(sb), i)
    _check_for_buffer_refresh!(sb, file_offset)

    buffer_offset = file_offset - buffer_position(sb)
    sequence_length = unsafe_load(convert(Ptr{UInt64}, pointer(buffer_array(sb), buffer_offset + 1)))
    buffer_offset = buffer_offset + sizeof(UInt64)
    resize!(seq, sequence_length)

    return _load_sequence_data!(seq, sb, buffer_offset)
end

# Long reads specific buffering

@inline function _check_for_buffer_refresh!(sb::DatastoreBuffer{LongReads{A}}, filepos::ReadPosSize) where {A<:DNAAlphabet}
    # If the buffer is too small to even fit the sequence. It will need to be
    # resized to be made bigger.
    n_bytes_req = cld(filepos.sequence_size, div(8, BioSequences.bits_per_symbol(A())))
    buf_start = buffer_position(sb)
    buf_size = buffer_len(sb)
    if buf_size < n_bytes_req
        @info "Resizing buffer!"
        resize!(sb.bufferdata, n_bytes_req)
        buf_size = n_bytes_req
    end
    file_start = filepos.offset
    file_end = file_start + n_bytes_req
    if file_start < buf_start || file_end > buf_start + buf_size
        bufferpos!(sb, file_start)
        seek(stream(sb), file_start)
        readbytes!(stream(sb), buffer_array(sb), buf_size)
    end
end

@inline function inbounds_load_sequence!(sb::DatastoreBuffer{LongReads{A}}, i::Integer, seq::LongSequence{A}) where {A<:DNAAlphabet}
    file_index = _inbounds_index_of_sequence(datastore(sb), i)
    _check_for_buffer_refresh!(sb, file_index)
    resize!(seq, file_index.sequence_size)
    buffer_offset = file_index.offset - buffer_position(sb)
    return _load_sequence_data!(seq, sb, buffer_offset)
end

@inline function Base.getindex(sb::DatastoreBuffer{LongReads{A}}, idx::Integer) where {A<:DNAAlphabet}
    @boundscheck checkbounds(sb, idx)
    file_index = _inbounds_index_of_sequence(datastore(sb), idx)
    _check_for_buffer_refresh!(sb, file_index)
    seq = eltype(sb)(file_index.sequence_size)
    buffer_offset = file_index.offset - buffer_position(sb)
    return _load_sequence_data!(seq, sb, buffer_offset)
end

@inline function load_sequence!(sb::DatastoreBuffer{DS}, i::Integer, seq::T) where {T<:LongSequence,DS<:ReadDatastore{T}}
    checkbounds(sb, i)
    return inbounds_load_sequence!(sb, i, seq)
end

@inline function Base.iterate(sb::DatastoreBuffer, state = 1)
    @inbounds if firstindex(sb) ≤ state ≤ lastindex(sb)
        return sb[state], state + 1
    else
        return nothing
    end
end

@inline Base.summary(io::IO, sb::DatastoreBuffer) = print(io, "Buffered ", summary(datastore(sb)))

@inline Base.show(io::IO, sb::DatastoreBuffer) = summary(io, sb)


text:
## A General Type that represents a wrapper around an Interator.
# The inner iterator must be in the `content` field

abstract type AnnotatedIterator{T} end
function Base.iteratoreltype(::Type{<:AnnotatedIterator{T}}) where T
     Base.iteratoreltype(T)
 end
function Base.iteratorsize(::Type{AnnotatedIterator{T}}) where T
    Base.iteratorsize(T)
end
function Base.IndexStyle(::Type{AnnotatedIterator{T}}) where T
    Base.IndexStyle(T)
end

Base.start(aiter::AnnotatedIterator)=Base.start(aiter.content)
Base.next(aiter::AnnotatedIterator, state)=Base.next(aiter.content, state)
Base.done(aiter::AnnotatedIterator, state)=Base.done(aiter.content, state)

Base.length(aiter::AnnotatedIterator) = length(aiter.content)
Base.endof(aiter::AnnotatedIterator) = endof(aiter.content)

Base.getindex(aiter::AnnotatedIterator, args...) = getindex(aiter.content, args...)
Base.setindex!(aiter::AnnotatedIterator, args...) = setindex!(aiter.content, args...)

####

struct Document{T, S} <: AnnotatedIterator{T}
    title::S
    #topics::Vector{String}
    content::T
end

Document(content)=Document(nothing,content)
title(doc::Document) = doc.title

#### Making nice with MultiResolutionIterators

@generated function _call_on_content(ff, aiter::T) where T<:AnnotatedIterator
    constructor = T.name.name # Toss away the type params
    args =  map(fieldnames(T)) do fn
        fieldval = :(getfield(aiter, $(Meta.quot(fn))))
        if fn == :content
            # work  only on the content
            Expr(:call, :ff, fieldval)
        else
             # keep everything else as is
            fieldval
        end
    end
    Expr(:call, constructor, args...)
end

function MultiResolutionIterators.apply(ff, aiter::T)::AnnotatedIterator where T<:AnnotatedIterator
    _call_on_content(aiter) do content
        MultiResolutionIterators.apply(ff, content)
    end
end

########################

abstract type TaggedWord end

struct SenseAnnotatedWord <: TaggedWord
    pos::String
    lemma::String
    wnsn::Int
    lexsn::String
    word::String
    function SenseAnnotatedWord(pos, lemma, wnsn, lexsn, word)
          new(intern(pos), intern(lemma), wnsn, intern(lexsn), intern(word))
    end
end

struct PosTaggedWord <: TaggedWord
    pos::String
    word::String
    function PosTaggedWord(pos, word)
          new(intern(pos), intern(word))
    end
end

const TaggedSentence = Vector{TaggedWord}

word(tword::TaggedWord) = tword.word
word(str::AbstractString) = str
sensekey(saword::SenseAnnotatedWord) = saword.lemma * "%" * saword.lexsn

#######################

macro NestedVector(T::Symbol, N::Int)
    code=Expr(:curly)
    cur_code = code
    for lvl in 1:N-1
        new_cur_code=Expr(:curly)
        push!(cur_code.args,:Vector)
        push!(cur_code.args, new_cur_code)
        cur_code = new_cur_code
    end
    push!(cur_code.args,:Vector)
    push!(cur_code.args, Symbol(T))
    esc(code)
end