Skip to content

Instantly share code, notes, and snippets.

View mschauer's full-sized avatar

Moritz Schauer mschauer

View GitHub Profile
@mschauer
mschauer / wiener.jl
Last active September 21, 2017 07:18
randn!
function W!(y, t)
n = length(y)
dt = t/n
y[1] .= 0.0
for i in 2:n-1
y[i] .= y[i-1] + sqrt(dt)*randn!(y[i])
end
y
end
@mschauer
mschauer / svd.txt
Created December 5, 2017 13:12
Improper rotation in SVD
julia> U, D, V = svd([0.359981 0.154162 0.169217; 0.154162 0.462971 0.159141; 0.169217 0.159141 0.492675])
([-0.49062 -1.23189e-5 0.871374; -0.58683 -0.739224 -0.330421; -0.644144 0.673459 -0.362671], [0.766542, 0.31799, 0.231094], [-0.49062 -1.23189e-5 0.871374; -0.58683 -0.739224 -0.330421; -0.644144 0.673459 -0.362671])
julia> det(U)
-0.9999999999999994
@mschauer
mschauer / NEWS.md
Created December 10, 2017 17:44
Release 0.7

Releases

Release v0.6.0

This release contains a much improved implementation of guided proposals, which adopt a new interface. The corresponding improvements for partial guided bridges are postponed for the next release, so they still use the old interface.

  • New scripts hypo.jl and elliptic.jl in the example directory to verify the correctness of the implementation.
  • Fix: The llikelihood function is missing a factor -1/2 from the former likeliXcirc in SDE.jl, discovered by the method.
  • Add a README.md file describing the examples
  • Better test coverage
@mschauer
mschauer / Interop.ipynb
Last active December 12, 2017 10:46
Bridge-Makie-interoperability - Look, mama, no glue!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mschauer
mschauer / SIR.ipynb
Last active April 11, 2020 05:51
SIR
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mschauer
mschauer / AR1.ipynb
Created March 5, 2018 16:44
Coefficients of AR1 process
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mschauer
mschauer / distortdelaunay.jl
Created May 29, 2018 13:59
Plot picture with distorted delaunay mesh in Makie
using VoronoiDelaunay
using StaticArrays
using Makie, GeometryTypes, GLVisualize#, GLWindow
srand(10)
const Point = SArray{Tuple{2},Float64,1,2} # point in 2
q0 = rand(Point, 20)
qT = q0 + 0.2 .*rand(Point, 20)
module IdPoints
@mschauer
mschauer / plain.jl
Created September 12, 2018 10:19
Q: How do you write a (large) matrix to a file like it prints in the REPL, but without the `...`?
#Q: How do you write a (large) matrix to a file like it prints in the REPL, but without the `...`?
#A: @pfitzseb
x = rand(100,100)
open(expanduser("~/test"), "w") do io
ctx = IOContext(io, :size => (100000,100000))
show(ctx, "text/plain", x)
end
@mschauer
mschauer / broadcast.jl
Last active September 18, 2018 15:46
Minimal broadcast example
struct MyType
x
end
Base.broadcastable(x::MyType) = x
Broadcast.BroadcastStyle(::Type{<:MyType}) = Broadcast.Style{MyType}()
x = rand(5)
Base.size(x::MyType) = size(x.x)
@mschauer
mschauer / moebius.jl
Last active September 20, 2018 09:14
Makie Moebius band
using Makie
t = 0:0.1:2pi+0.1
function band_connect(n)
ns = 1:n-1
ns2 = n+1:2n-1
[ns ns .+ 1 ns2;
ns .+ 1 ns2 .+ 1 ns2 ]
end
mesh([sin.(t); sin.(t)], [0.5 .- cos.(-0.5*t .+ pi)*0.5; 0.5 .+ cos.(0.5*t .+ pi)*0.5],