Skip to content

Instantly share code, notes, and snippets.


Simeon Schaub simeonschaub

  • Cambridge, MA
View GitHub Profile
simeonschaub / notebook.jl
Created Oct 18, 2021
Pluto cyclic reference
View notebook.jl
### A Pluto.jl notebook ###
# v0.16.1
using Markdown
using InteractiveUtils
# ╔═╡ d00d6ce7-6cb2-4a8e-a119-aafe2d372a77
function stencil(kernel_f!, N)
A = reshape(BandedMatrix(Zeros(N^2, N^2), (N+1, N+1)), N, N, N, N)
_A = PaddedArray(A, 0)
View gist:fb6eff0d212f8514ecec186a69712a82
(rows, cols) = (2, 2)
memory estimate: 0 bytes
allocs estimate: 0
minimum time: 16.041 ns (0.00% GC)
median time: 16.074 ns (0.00% GC)
mean time: 16.189 ns (0.00% GC)
maximum time: 104.773 ns (0.00% GC)
View abs_to_pow.jl
using ChainRulesCore
import ChainRulesCore: wirtinger_primal, wirtinger_conjugate
using ChainRulesCore: AbstractDifferential
using FiniteDifferences
using Test
abs_to_pow(x, p) = abs(x)^p
@scalar_rule(abs_to_pow(x::Real, p),
(p == 0 ? Zero() : p * abs_to_pow(x, p-1) * sign(x), Ω * log(abs(x))))
View toy_chainrules_cassette_ad.jl
using Cassette, Test
using Cassette: @context, enabletagging, @overdub, overdub, recurse,
hasmetadata, metadata, tag, untag
using ChainRules: frule, Zero, extern
@context DiffCtx
Cassette.metadatatype(::Type{<:DiffCtx}, ::Type{T}) where {T<:Real} = T
function D(f, x)
View designer.html
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
:host {
position: absolute;
View designer.html
<link rel="import" href="../paper-ripple/paper-ripple.html">
<polymer-element name="name-card" attributes="first, name, color, href">
#core_card {
position: absolute;
border-top-left-radius: 2px;
border-top-right-radius: 2px;