Skip to content

Commit 9ecb0ca

Browse files
authored
Merge pull request #1795 from JuliaRobotics/23Q4/fix/1763
fix cmember on AMD.jl ccolamd
2 parents d1a105a + a1a7d20 commit 9ecb0ca

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

ext/IncrInfrApproxMinDegreeExt.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ function _ccolamd!(
4040
for i in eachindex(p)
4141
p[i] -= 1
4242
end
43-
err = AMD.ccolamd_l( # ccolamd_l
43+
# BSD-3 clause, (c) Davis, Rajamanickam, Larimore
44+
# https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/f98e0f5a69acb6a3fb19703ff266100d43491935/LICENSE.txt#L153
45+
err = AMD.ccolamd_l(
4446
n_row,
4547
n_col,
4648
Alen,
@@ -69,7 +71,7 @@ function _ccolamd!(
6971
A::AbstractVector{T1}, #SuiteSparse_long},
7072
p::AbstractVector{<:Real}, # {SuiteSparse_long},
7173
cmember::Union{Ptr{Nothing}, <:AbstractVector{T}}, # SuiteSparse_long
72-
) where {T1<:Real, T}
74+
) where {T1<:Real, T<:Integer}
7375
n_col = length(p) - 1
7476

7577
if length(cmember) != n_col

src/services/BayesNet.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ function getEliminationOrder(
4343
q, r, p = qr(A, (v"1.7" <= VERSION ? ColumnNorm() : Val(true)))
4444
p .= p |> reverse
4545
elseif ordering == :ccolamd
46-
cons = zeros(length(adjMat.colptr) - 1)
46+
cons = zeros(Int, length(adjMat.colptr) - 1)
4747
cons[findall(x -> x in constraints, permuteds)] .= 1
4848
p = _ccolamd(adjMat, cons)
4949
# cons = zeros(SuiteSparse_long, length(adjMat.colptr) - 1)
5050
# cons[findall(x -> x in constraints, permuteds)] .= 1
5151
# p = Ccolamd.ccolamd(adjMat, cons)
52-
@warn "Integration via AMD.ccolamd under development and replaces pre-Julia 1.9 direct ccall approach."
52+
@warn "Integration via AMD.ccolamd under development and replaces pre-Julia 1.9 direct ccall approach." maxlog=5
5353
else
5454
@error("getEliminationOrder -- cannot do the requested ordering $(ordering)")
5555
end

test/testCcolamdOrdering.jl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,24 @@ using Test
88

99
fg = generateGraph_Kaess(graphinit=false)
1010

11+
vo = getEliminationOrder(fg, constraints=[:x3], ordering=:ccolamd)
1112

12-
try
13-
vo = getEliminationOrder(fg, constraints=[:x3], ordering=:ccolamd)
13+
@test vo[end] == :x3
14+
@test length(vo) == length(ls(fg))
1415

15-
@test vo[end] == :x3
16-
@test length(vo) == length(ls(fg))
16+
vo = getEliminationOrder(fg, constraints=[:l2], ordering=:ccolamd)
1717

18-
vo = getEliminationOrder(fg, constraints=[:l2], ordering=:ccolamd)
18+
@test vo[end] == :l2
1919

20-
@test vo[end] == :l2
2120

21+
vo = getEliminationOrder(fg, constraints=[:x3;:l2], ordering=:ccolamd)
2222

23-
vo = getEliminationOrder(fg, constraints=[:x3;:l2], ordering=:ccolamd)
23+
@test intersect(vo[end-1:end], [:x3;:l2]) |> length == 2
2424

25-
@test intersect(vo[end-1:end], [:x3;:l2]) |> length == 2
26-
catch
27-
@error "IncrInfrApproxMinDegreeExt test issue, work needed for Julia 1.10 compat via AMD.jl"
28-
@test_broken false
29-
end
25+
# catch
26+
# @error "IncrInfrApproxMinDegreeExt test issue, work needed for Julia 1.10 compat via AMD.jl"
27+
# @test_broken false
28+
# end
3029

3130
##
3231
end

0 commit comments

Comments
 (0)