Skip to content

Instantly share code, notes, and snippets.

View explore_saddlepoint.jl
### A Pluto.jl notebook ###
# v0.12.21
using Markdown
using InteractiveUtils
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local el = $(esc(element))
@matthieubulte
matthieubulte / main.jl
Created Apr 24, 2021
Symbolic expression from a string
View main.jl
using MacroTools
using Symbolics
function parse(strexpr)
expr = Meta.parse(strexpr)
freevars = Set()
expr = MacroTools.postwalk(x -> begin
if isa(x, Symbol) && !isdefined(Base, x)
push!(freevars, Variable(x))
Expr(:call, Variable, QuoteNode(x))
@matthieubulte
matthieubulte / main.jl
Created Apr 2, 2021
Using Symbolics.jl to compile sparse matrix operations
View main.jl
using LinearAlgebra, BenchmarkTools, SparseArrays, SymbolicUtils, Symbolics
## Problem setup
const z = zeros;
wx = Float64[ 0 -1 0;
1 0 0;
0 0 0;];
Ak_1 = [ wx -I zeros(3,12);
@matthieubulte
matthieubulte / main.jl
Created Mar 26, 2021
Compiling sparse matrix multiplication
View main.jl
using LinearAlgebra
using BenchmarkTools
using SparseArrays
# To exploit the sparsity of the matrix as much as possible, pre-compile the multiplication operation
# to skip the matrix entries look-up. Since the matrix is sparse this might generate only a few operations
# which are all inlined.
# Note that this only works with small matrices since otherwise the size of the function will just be to
# large.
# Note that this could also be avoided, but this is another topic.
View benchmark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Removing collinearity via SVD-QR.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View BBVI vs MLE for Logistic Regression.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthieubulte
matthieubulte / Estimating a covariance.ipynb
Last active Jun 4, 2019
Automatic MLE of a covariance matrix via Cholesky factorization
View Estimating a covariance.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthieubulte
matthieubulte / RandomRDD with custom PRNG.ipynb
Last active Jun 1, 2019
RandomRDD with custom PRNG.ipynb
View RandomRDD with custom PRNG.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthieubulte
matthieubulte / Removing collinearity via SVD.ipynb
Last active May 26, 2019
Removing collinearity via SVD (maybe?)
View Removing collinearity via SVD.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.