This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AdvancedMH | |
using Distributions | |
using Random | |
using MCMCChains | |
using StructArrays | |
struct MvWiener{Tu0,Ttrange} <: ContinuousMatrixDistribution | |
u0::Tu0 | |
trange::Ttrange | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using LinearAlgebra, Test, Random, Statistics | |
outer(x) = x*x' | |
lchol(x) = cholesky(Symmetric(x)).L | |
Random.seed!(1) | |
# dimensions | |
n = 10 # observed | |
p = 5 # latent | |
# parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StaticArrays | |
struct EulerMaruyama! | |
end | |
""" | |
tangent!(du, u, dz, P) | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using GitHub, JSON | |
#myauth = GitHub.authenticate(ENV["GITHUB_AUTH"]) | |
gist_json(fn; description="$fn", public=true) = JSON.parse( | |
""" | |
{ | |
"description": "$description", | |
"public": $public, | |
"files": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mappairreduce(r, f, itr, dec) | |
ϕ = iterate(itr) | |
if ϕ === nothing | |
return dec | |
end | |
xlast, state = ϕ | |
while true | |
ϕ = iterate(itr, state) | |
if ϕ === nothing | |
return dec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Makie | |
using Colors | |
n = 100 | |
f(x) = 0.5 .*reim(((x[1] + x[2]*im)/33)^2) | |
function f2(x) | |
0.5.*abs(2*(x[1] + x[2]*im)/1089) | |
end | |
#f(x) = (x[1],x[2]) | |
#f2(x) = 1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> | |
shell> cd example/phylo3/ | |
/Users/smoritz/.julia/dev/MitosisStochasticDiffEq/example/phylo3 | |
julia> include("phylo_autobffg3.jl") | |
Activating environment at `~/.julia/dev/MitosisStochasticDiffEq/example/phylo3/Project.toml` | |
Internal error: encountered unexpected error in runtime: | |
BoundsError(a=Array{Int64, (30,)}[0, 0, 2, 2, 2, 1, 0, 0, 0, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 0, 0, 0, 1, 0, 0, 0], i=(66,)) | |
jl_bounds_error_ints at /Applications/Julia-1.6.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.6.dylib (unknown line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ZigZagBoomerang | |
using SparseArrays | |
using ForwardDiff | |
using ForwardDiff: Dual, value, partials | |
const D1 = Dual{Nothing, Float64, 1} | |
const D𝕏 = typeof(D1.(zero(𝕏))) | |
function partiali(F, z, i) | |
z[i] = Dual(z[i], 1.0) | |
r = partials(F(z))[] | |
z[i] = Dual(z[i], 0.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d = 100 | |
ts_ = range(0, 1, length=d+1)[2:end] | |
Γ = SymTridiagonal([2.0ones(d-1); 1.0], -ones(d-1))/ts_[1] | |
# Note the covariance matrix of B.M is | |
ts = range(0, 1, length=d+1)[2:end] | |
Γ0 = inv([min(i,j) for i in ts_, j in ts_]) | |
@test norm(Γ0 - Γ) < 1e-7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ZigZagBoomerang | |
using StaticArrays | |
using LinearAlgebra | |
using SparseArrays | |
using Random | |
using Test | |
using Statistics | |
Random.seed!(2) | |
using StaticArrays |