Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Leo GiggleLiu

🎯
Focusing
View GitHub Profile
View tropicalblas.jl
using TropicalNumbers, VectorizationBase
using Test
using LoopVectorization, Octavian
using VectorizationBase: OffsetPrecalc, StaticBool, Bit, static, NativeTypes, Index, gep_quote, VectorIndex
function distance(a::AbstractArray{<:Tropical}, b::AbstractArray{<:Tropical})
sum(abs.(content.(a) .- content.(b)))
end
LoopVectorization.check_args(::Type{T}, ::Type{T}) where T<:Tropical = true
@GiggleLiu
GiggleLiu / yaotutorial.jl
Created Dec 29, 2020
Yao tutorial, a draft
View yaotutorial.jl
# v0.12.17
using Markdown
using InteractiveUtils
# ╔═╡ f178d9fe-49f4-11eb-0863-21e2e3934592
using Yao, YaoPlots
# ╔═╡ d59b39ec-49f5-11eb-3d4a-fb69f2505d3c
using SymEngine
@GiggleLiu
GiggleLiu / copyA.jl
Last active Nov 2, 2020
The copy A mma kernel
View copyA.jl
using CUDA
using CUDA.WMMA
using CUDA.WMMA: ColMajor, load_a, load_b, load_c, mma, store_d
using StaticArrays
a = rand(Float16, 16, 16)
b = rand(Float16, 16, 16)
c = zeros(Float16, 16, 16)
d = zeros(Float16, 16, 16)
a_dev = CuArray(a)
View config.yaml
optimizer:
ip: 127.0.0.1
port: 2000
method: spsa
initial-params: specified
initial-params.random:
seed: 2
p: 5
initial-params.specified:
-
View Atoms20.dat
2 3
3 1
3 2
4 4
2 2
5 4
1 2
5 2
2 1
View yaoqasm.jl
using Yao
using YaoBlocks
using YaoBlocks.ConstGate: TGate, SGate, TdagGate, SdagGate
function Base.show(io::IO, ::MIME"qasm/open", blk::AbstractBlock)
qcode = qasm(blk)
println(io, "OPENQASM 2.0")
maincode = pop!(qcode, "main")
for k in keys
println(io, qcode)
View pluto_racecondition.jl
### A Pluto.jl notebook ###
# v0.11.14
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))
@GiggleLiu
GiggleLiu / stateful_pluto.jl
Last active Oct 30, 2020
Pluto as a state machine
View stateful_pluto.jl
### A Pluto.jl notebook ###
# v0.11.14
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))
View nilang_diffeq_test.jl
using NiLang, NiLang.AD
function f!(du, u, p, t)
y₁, y₂, y₃ = u
k₁, k₂, k₃ = p
du[1] = -k₁*y₁ + k₃*y₂*y₃
du[2] = k₁*y₁ - k₃*y₂*y₃ - k₂*y₂^2
du[3] = y₁ + y₂ + y₃ - 1
return nothing
end
@GiggleLiu
GiggleLiu / plutouitips.jl
Last active Feb 17, 2021
Make pluto UI feel real!
View plutouitips.jl
### A Pluto.jl notebook ###
# v0.11.14
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))