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
trait Interp { | |
type Repr<T>; | |
fn lit(i: i32) -> Self::Repr<i32>; | |
fn add(a: Self::Repr<i32>, b: Self::Repr<i32>) -> Self::Repr<i32>; | |
} | |
struct Eval; | |
impl Interp for Eval { |
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
n = 1000 | |
x = range(0, 1, length=n) | |
ς = 1.5 # noise level | |
μ = 3*x.*sin.(2pi*x) # periodic signal in time domain | |
#μ = 6*sqrt.(abs.(x .- 0.5)) # this one is difficult to estimate | |
# Model: Signal distorted by white noise | |
y = μ + ς*randn(n) |
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 |
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
JuliaActuary/MortalityTables.jl | |
JuliaActuary/DynamicPolynomials.jl | |
JuliaActuary/FixedPolynomials.jl | |
JuliaActuary/MultivariateBases.jl | |
JuliaActuary/MultivariateMoments.jl | |
JuliaActuary/MultivariatePolynomials.jl | |
JuliaActuary/SemialgebraicSets.jl | |
JuliaActuary/StaticPolynomials.jl | |
JuliaActuary/TypedPolynomials.jl |
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
struct StoProMeasure | |
θ::Float64 | |
end | |
struct WienerMeasure | |
end | |
function logdensity(P::StoProMeasure, tr, ::WienerMeasure) | |
som = 0.0 | |
t, x = tr |
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
import PyCall,SymPy | |
using MLStyle | |
stats = PyCall.pyimport_conda("sympy.stats", "sympy"); | |
SymPy.import_from(stats) | |
sym(x) = SymPy.symbols(x); | |
macro ℓ(expr) | |
args = @match expr begin |
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 Dates: now | |
using DataFrames | |
import Base: *, push! | |
mutable struct AAUpdate{Tu,Tv} # Matrix-free representation of the H matrix | |
m::Int #:: Size of the AA subspace | |
u::Vector{Tu} #:: The quantities s-Hỹ (note typo in paper) | |
v::Vector{Tv} #:: The quantities (H'ŝ)/(ŝ'Hŷ) | |
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
function sample_poisson(T, λ, λmax) | |
t = 0.0 | |
tt = zeros(0) | |
while t <= T | |
t = t - log(rand())/λmax | |
if rand() ≤ λ(t)/λmax | |
push!(tt, t) | |
end | |
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 LightGraphs | |
using LightGraphs.SimpleGraphs: fadj | |
using BenchmarkTools | |
using Test | |
macro twice(body) | |
quote $(esc(body));$(esc(body)) end | |
end | |
struct Done | |
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 Distributions | |
K = 10^5 | |
μ1 = 1.0 | |
μ2 = -1.0 | |
σ1 = σ2 = 0.3 | |
args = (μ1 = μ1, σ1 = σ1, μ2 = μ2, σ2 = σ2) | |
lp(x, args) = log(pdf(Normal(args.μ1, args.σ2), x) + pdf(Normal(args.μ2, args.σ2), x)) |
NewerOlder