Skip to content

Commit

Permalink
Fix the issue on 32-bits platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 2, 2023
1 parent 8f2b37f commit 4a1af46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/amd_julia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ end

print(io::IO, meta::Amd) = show(io, meta)

for (validfn, typ) in ((:amd_valid, :Cint), (:amd_l_valid, :SS_Int))
for (validfn, typ) in ((:amd_valid, :Cint ),
(:amd_l_valid, :SS_Int))

Base.Sys.WORD_SIZE == 32 && validfn == :amd_l_valid && continue
@eval begin
function amd_valid(A::SparseMatrixCSC{F, $typ}) where {F}
nrow, ncol = size(A)
Expand All @@ -87,7 +90,10 @@ for (validfn, typ) in ((:amd_valid, :Cint), (:amd_l_valid, :SS_Int))
end
end

for (orderfn, typ) in ((:amd_order, :Cint), (:amd_l_order, :SS_Int))
for (orderfn, typ) in ((:amd_order , :Cint ),
(:amd_l_order, :SS_Int))

Base.Sys.WORD_SIZE == 32 && orderfn == :amd_l_order && continue
@eval begin
function amd(A::SparseMatrixCSC{F, $typ}, meta::Amd) where {F}
nrow, ncol = size(A)
Expand Down
12 changes: 9 additions & 3 deletions src/colamd_julia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ end

print(io::IO, meta::Colamd) = show(io, meta)

for (orderfn, typ) in ((:colamd, :Cint), (:colamd_l, :SS_Int))
for (fn, typ) in ((:colamd , :Cint ),
(:colamd_l, :SS_Int))

Base.Sys.WORD_SIZE == 32 && fn == :colamd_l && continue
@eval begin
function colamd(A::SparseMatrixCSC{F, $typ}, meta::Colamd{$typ}) where {F}
nrow, ncol = size(A)
Expand All @@ -67,7 +70,7 @@ for (orderfn, typ) in ((:colamd, :Cint), (:colamd_l, :SS_Int))
len = colamd_recommended($typ(nnz), $typ(nrow), $typ(ncol))
workspace = zeros($typ, len)
workspace[1:length(A.rowval)] .= A.rowval .- $typ(1)
valid = $orderfn(nrow, ncol, len, workspace, p, meta.knobs, meta.stats)
valid = $fn(nrow, ncol, len, workspace, p, meta.knobs, meta.stats)
Bool(valid) || throw("colamd status: $(colamd_statuses[meta.stats[COLAMD_STATUS]])")
pop!(p) # remove the number of nnz
p .+= $typ(1) # 1-based indexing
Expand All @@ -89,7 +92,10 @@ for (orderfn, typ) in ((:colamd, :Cint), (:colamd_l, :SS_Int))
end
end

for (fn, typ) in ((:symamd, :Cint), (:symamd_l, :SS_Int))
for (fn, typ) in ((:symamd , :Cint ),
(:symamd_l, :SS_Int))

Base.Sys.WORD_SIZE == 32 && fn == :symamd_l && continue
@eval begin
function symamd(A::SparseMatrixCSC{F, $typ}, meta::Colamd{$typ}) where {F}
nrow, ncol = size(A)
Expand Down

0 comments on commit 4a1af46

Please sign in to comment.