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
const BRAILLE = split("⠀⠁⠂⠄⡀⠈⠐⠠⢀", "") .|> s -> Int(s[1]) | |
function show_any_nonzero(S::SparseMatrixCSC; maxw = displaysize(stdout)[2], maxh = displaysize(stdout)[1]-3) | |
h,w = size(S) | |
h > 4maxh && (w = max(1, (w*4maxh+h÷2)÷h); h = 4maxh) | |
w > 2maxw && (h = max(1, (h*2maxw+w÷2)÷w); w = 2maxw) | |
P = fill(BRAILLE[1], (w+3)÷2, (h+3)÷4) | |
P[end, :].=10 | |
@inbounds for c = 0:w-1, r = 0:h-1 | |
_anynz(S, r*S.m÷h+1, c*S.n÷w+1, (r+1)*S.m÷h, (c+1)*S.n÷w) && |
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
# Matrix-vector multiplication benchmarks (Julia 0.7 version) | |
using LinearAlgebra | |
using Statistics | |
using Printf | |
f(a, b) = a * b # Matrix-vector multiplication | |
#f(a, b) = log(1 + a^b) # Slow operation | |
function mul_broadcast!(M, v) |