Skip to content

Commit

Permalink
Condition use of Clong and Clonglong
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira authored and dpo committed Aug 17, 2018
1 parent f19595a commit 87b7494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/AMD.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ function print(io :: IO, meta :: Amd)
print(io, s)
end

for (validfn, typ) in ((:_amd_valid, Cint), (:_amd_l_valid, Clong))
_Clong = Base.Sys.WORD_SIZE == 32 ? Clong : Clonglong

for (validfn, typ) in ((:_amd_valid, Cint), (:_amd_l_valid, _Clong))

@eval begin

Expand All @@ -123,7 +125,7 @@ for (validfn, typ) in ((:_amd_valid, Cint), (:_amd_l_valid, Clong))
end


for (orderfn, typ) in ((:_amd_order, Cint), (:_amd_l_order, Clong))
for (orderfn, typ) in ((:_amd_order, Cint), (:_amd_l_order, _Clong))

@eval begin

Expand All @@ -145,7 +147,7 @@ for (orderfn, typ) in ((:_amd_order, Cint), (:_amd_l_order, Clong))
end
end

function amd{F,T<:Union{Cint,Clong}}(A :: SparseMatrixCSC{F,T})
function amd{F,T<:Union{Cint,_Clong}}(A :: SparseMatrixCSC{F,T})
meta = Amd()
amd(A, meta)
end
Expand Down
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using AMD
using Base.Test

_Clong = Base.Sys.WORD_SIZE == 32 ? Clong : Clonglong
for n in [10, 20, 30]
for density in [.25, .75, 1.0]
for T in [Cint, Clong]
for T in [Cint, _Clong]
A = convert(SparseMatrixCSC{Float64,T}, sprand(n, n, density))
@assert amd_valid(A)

Expand All @@ -21,7 +22,7 @@ end

# For coverage.
meta = Amd()
A = convert(SparseMatrixCSC{Float64,Clong}, sprand(10, 10, .5))
A = convert(SparseMatrixCSC{Float64,_Clong}, sprand(10, 10, .5))
p = amd(A, meta)
show(meta)
print(meta)

0 comments on commit 87b7494

Please sign in to comment.