Skip to content

Instantly share code, notes, and snippets.

View simeonschaub's full-sized avatar

Simeon David Schaub simeonschaub

  • KIT
  • Karlsruhe, Germany
  • 13:20 (UTC +02:00)
View GitHub Profile
@simeonschaub
simeonschaub / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../paper-ripple/paper-ripple.html">
<polymer-element name="name-card" attributes="first, name, color, href">
<template>
<style>
#core_card {
position: absolute;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
@simeonschaub
simeonschaub / designer.html
Created November 12, 2014 21:12
designer
<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">
<template>
<style>
:host {
position: absolute;
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)
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))))
@scalar_rule(
(rows, cols) = (2, 2)
BenchmarkTools.Trial:
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)
--------------
@simeonschaub
simeonschaub / notebook.jl
Created October 18, 2021 17:32
Pluto cyclic reference
### 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)