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)
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
type Chain | |
value :: Int | |
right :: Chain | |
left :: Chain | |
#Make the last link in the chain point to itself | |
#so as to spare us from the julia workaround for nulls | |
Chain(value::Int) = (chain = new(); chain.value = value; chain.right = chain; chain.left = chain; chain) | |
end | |
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
# load dependency packages | |
using GLFW, ModernGL | |
# set up OpenGL context version | |
@osx_only const VERSION_MAJOR = 4 # it seems OSX will stuck on OpenGL 4.1. | |
@osx_only const VERSION_MINOR = 1 | |
# initialize GLFW library, error check is already wrapped. | |
GLFW.Init() |
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
function foo(genconv, I, J) | |
genconv[sub2ind(size(genconv),I,J)] | |
end | |
function bar(genconv, I, J) | |
diag(sub(genconv, I, J)) | |
end | |
function baz(genconv, I, J) | |
[genconv[i,j] for (i,j) in zip(I, J)] | |
end |
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 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() |
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
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 |
_ _ _(_)_ | 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> Pkg.build("Cxx")
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
# 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)) |
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
- 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) |
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
- """ | |
- 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) |
OlderNewer