This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import jax | |
from jax import numpy as jnp | |
import numpy as np | |
N=4096 | |
flops_ish = N*N*2*N | |
for i in range(5): | |
A = np.random.rand(N,N).astype(np.float64) | |
B = np.random.rand(N,N).astype(np.float64) | |
t1 = time.monotonic() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gadfly | |
import Cairo, Fontconfig | |
using Printf | |
using FFMPEG | |
#################################### This is pretty much the same code as in https://github.com/JuliaPlots/Plots.jl/blob/master/src/animation.jl | |
struct Animation | |
dir::String | |
frames::Vector{String} | |
kwargs::Iterators.Pairs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder