Skip to content

Commit

Permalink
Merge e47a426 into ce5f15f
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijithanilkumar committed May 21, 2017
2 parents ce5f15f + e47a426 commit 3ed0831
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -4,12 +4,12 @@ os:
- linux
- osx
julia:
- 0.5
- 0.6
notifications:
email: false
# uncomment the following lines to override the default test script
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("NetworkLayout"); Pkg.clone("LightGraphs"); Pkg.test("NetworkLayout"; coverage=true)'
- julia -e 'Pkg.clone(pwd()); Pkg.build("NetworkLayout"); Pkg.checkout("GeometryTypes"); Pkg.clone("LightGraphs"); Pkg.test("NetworkLayout"; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("NetworkLayout")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder()); Codecov.submit(process_folder())'
4 changes: 2 additions & 2 deletions REQUIRE
@@ -1,4 +1,4 @@
julia 0.5
julia 0.6-
GeometryTypes
Compat 0.8.6
FixedSizeArrays
StaticArrays
6 changes: 3 additions & 3 deletions appveyor.yml
@@ -1,7 +1,7 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
#- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
#- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down Expand Up @@ -29,7 +29,7 @@ build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"NetworkLayout\"); Pkg.build(\"NetworkLayout\")"
Pkg.clone(pwd(), \"NetworkLayout\"); Pkg.build(\"NetworkLayout\"); Pkg.checkout(\"GeometryTypes\")"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"NetworkLayout\")"
2 changes: 1 addition & 1 deletion src/shell.jl
Expand Up @@ -29,7 +29,7 @@ function layout!{M<:AbstractMatrix}(adj_matrix::M, nlist::Union{Void, Vector{Vec
return Point{2,Float64}[Point(0.0,0.0)]
end
if nlist == nothing
nlist = Array(Vector{Int}, 1)
nlist = Array{Vector{Int}}(1)
nlist[1] = collect(1:size(adj_matrix,1))
end
radius = 0.0
Expand Down
2 changes: 1 addition & 1 deletion src/spectral.jl
Expand Up @@ -27,7 +27,7 @@ function compute_laplacian{M<:AbstractMatrix}(adj_matrix::M, node_weights)

# scale the edge values by the product of node_weights, so that "heavier" nodes also form
# stronger connections
adj_matrix = adj_matrix .* sqrt(node_weights * node_weights')
adj_matrix = adj_matrix .* sqrt.(node_weights * node_weights')

# D is a diagonal matrix with the degrees (total weights for that node) on the diagonal
deg = vec(sum(adj_matrix,1)) - diag(adj_matrix)
Expand Down
16 changes: 8 additions & 8 deletions src/stress.jl
Expand Up @@ -50,35 +50,35 @@ Reference:
"""
module Stress

using GeometryTypes, Compat, FixedSizeArrays
using GeometryTypes, Compat, StaticArrays
import Base: start, next, done, *

function (*){T<:LinAlg.BlasFloat,S<:FixedArray}(A::StridedMatrix{T}, x::StridedVector{S})
function (*){T<:LinAlg.BlasFloat,S<:StaticArray}(A::StridedMatrix{T}, x::StridedVector{S})
A_mul_B!(similar(x, S, size(A,1)), A, x)
end

immutable Layout{M1<:AbstractMatrix, M2<:AbstractMatrix, VP<:AbstractVector,FT<:AbstractFloat}
immutable Layout{M1<:AbstractMatrix, M2<:AbstractMatrix, VP<:AbstractVector, FT<:AbstractFloat}
δ::M1
weights::M2
positions::VP
pinvLw::Matrix{FT}
pinvLw::Matrix{Float64}
iterations::Int
abstols::FT
reltols::FT
abstolx::FT
end


function initialweights(D, T=eltype(D))
function initialweights(D)
map(D) do d
x = T(d^(-2.0))
isfinite(x) ? x : zero(T)
x = Float64(d^(-2.0))
isfinite(x) ? x : zero(Float64)
end
end

function Layout{N, T}(
δ, PT::Type{Point{N, T}}=Point{2, Float64};
startpositions=rand(PT, size(δ,1)), weights=initialweights, T),
startpositions=rand(PT, size(δ,1)), weights=initialweights(δ),
iterations=400*size(δ,1)^2, abstols=(eps(T)),
reltols=(eps(T)), abstolx=(eps(T))
)
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Expand Up @@ -12,7 +12,7 @@ using GeometryTypes

function jagmesh()
jagmesh_path = joinpath(dirname(@__FILE__), "jagmesh1.mtx")
array = round(Int, open(readdlm, jagmesh_path))
array = round.(Int, open(readdlm, jagmesh_path))
row = array[:,1]
col = array[:,2]
entry = [(1:3600)...]
Expand Down Expand Up @@ -151,8 +151,8 @@ jagmesh_adj = jagmesh()
for i in 1:size(a,1)
p = Int32[]
for e in collect(edges(g))
if e[1] == i
push!(p,e[2])
if src(e) == i
push!(p,dst(e))
end
end
push!(n,p)
Expand Down

0 comments on commit 3ed0831

Please sign in to comment.