Skip to content

Instantly share code, notes, and snippets.

View Gnimuc's full-sized avatar
🍤

Yupei Qi Gnimuc

🍤
  • Tokyo
  • 17:56 (UTC +09:00)
  • X @Gnimuc
View GitHub Profile
In file included from /Cxx.h:1:
In file included from /Users/gnimuc/.julia/dev/Cxx/src/CxxREPL/replpane.jl:68:
In file included from /Users/gnimuc/.julia/dev/Cxx/src/CxxREPL/../../deps/src/clang-6.0.0/include/clang/Parse/Parser.h:25:
In file included from /Users/gnimuc/.julia/dev/Cxx/src/CxxREPL/../../deps/src/clang-6.0.0/include/clang/Sema/Sema.h:43:
/Users/gnimuc/.julia/dev/Cxx/src/CxxREPL/../../deps/src/clang-6.0.0/include/clang/Sema/ExternalSemaSource.h:87:55: error: too few template arguments for class template 'MapVector'
virtual void ReadMismatchingDeleteExpressions(llvm::MapVector<
^
/Users/gnimuc/Codes/julia/usr/bin/../include/llvm/ADT/MapVector.h:38:7: note: template is declared here
class MapVector {
^
using Luxor
function juliacn(radius=100; outercircleratio=0.75, innercircleratio=0.65)
points = ngon(O, radius, 3, pi/6, vertices=true)
fontsize(150)
fontface("TamilMN-Bold")
setcolor(Luxor.reds[1]...)
translate(-63.25, 51.25)
text("C", points[1], halign="center", valign="bottom")
translate(7, 0)
A = sprand(65535, 65500, 1e-5)
v = rand(65500)
function foo(A, v)
b = zeros(size(A,1))
rows = rowvals(A)
vals = nonzeros(A)
m, n = size(A)
for i = 1:n
@inbounds @simd for j in nzrange(A, i)
@Gnimuc
Gnimuc / Munkres.jl,mem
Created February 12, 2018 10:05
Updated
- """
- munkres(costMat) -> Zs
-
- Find an optimal solution of the assignment problem represented by the square
- matrix `costMat`. Return an sparse matrix illustrating the optimal matching.
-
- # Examples
-
- ```julia
- julia> costMat = ones(3, 3) - eye(3, 3)
@Gnimuc
Gnimuc / Hungarian.jl.mem
Last active February 12, 2018 03:38
memory allocation
- module Hungarian
-
-
- # Zero markers used in hungarian algorithm
- # 0 => NON => Non-zero
- # 1 => Z => ordinary zero
- # 2 => STAR => starred zero
- # 3 => PRIME => primed zero
- const NON = Int8(0)
- const Z = Int8(1)
@Gnimuc
Gnimuc / toy-conv.jl
Last active September 27, 2017 11:40
# this is actually cross-correlation
function toyconv(x::AbstractArray{T,3}, w::AbstractArray{T,4}, pad::Integer, _stride::Integer) where T<:Real
xSpatialDims = size(x, 1, 2)
kernelSpatialDims = size(w, 1, 2)
channelNum, kernelNum = size(w, 3, 4)
ySpatialDims = 1 .+ (xSpatialDims .+ 2pad .- kernelSpatialDims) .÷ _stride
δ = kernelSpatialDims[1] ÷ 2
padSpatialDims = xSpatialDims .+ 2pad
xOffset = OffsetArray(x, pad, pad, 0)
xPadded = PaddedView(zero(T), xOffset, (padSpatialDims..., channelNum))
@Gnimuc
Gnimuc / cxx-cygwin.md
Last active February 18, 2017 09:14
Cxx-win
_       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-dev.2842 (2017-02-17 17:00 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit ded2d87* (0 days old master)
|__/                   |  x86_64-w64-mingw32

julia&gt; Pkg.build("Cxx")

Yum

shell> cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core) 

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Linux (x86_64-pc-linux-gnu)
@Gnimuc
Gnimuc / toy_topology_preservation.jl
Created June 3, 2016 08:59
[NRIRHOPM] Topology Preservation Dilemma
function topology(s1::Tuple{Int64,Int64}, s2::Tuple{Int64,Int64}, s3::Tuple{Int64,Int64}, a::Tuple{Int64,Int64}, b::Tuple{Int64,Int64}, c::Tuple{Int64,Int64})
ks1 = (s1[1]+a[1], s1[2]+a[2])
ks2 = (s2[1]+b[1], s2[2]+b[2])
ks3 = (s3[1]+c[1], s3[2]+c[2])
dφ1 = ks2[1] - ks1[1]
dr1 = s2[1] - s1[1]
dφ2 = ks2[2] - ks3[2]
dr2 = s2[2] - s3[2]
dφ3 = ks2[2] - ks1[2]
# dr3 = dr1
@Gnimuc
Gnimuc / test.jl
Created January 13, 2016 14:16
[SO]Julia vs MATLAB: Why is my Julia code so slow?
using Dierckx
function foo()
x = [0., 1., 2., 3., 4.]
y = [-1., 0., 7., 26., 63.]
spl = Spline1D(x, y)
a = evaluate(spl, ones(10000))
reshape(a,100,100)
end
function bar()