Skip to content

Commit 37987ff

Browse files
authored
Merge pull request #59 from JuliaConstraints/fix_types
Fix types
2 parents a5d6371 + bc86042 commit 37987ff

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "Constraints"
22
uuid = "30f324ab-b02d-43f0-b619-e131c61659f7"
33
authors = ["Jean-François Baffier"]
4-
version = "0.5.9"
4+
version = "0.5.10"
55

66
[deps]
77
CompositionalNetworks = "4b67e4b5-442d-4ef5-b760-3f5df3a57537"

src/constraints/all_equal.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ c([1, 2, 3, 4]; op=*, val=1, pair_vars=[1, 2, 3, 4])
3636
"""
3737
xcsp_all_equal(; list) = concept_all_equal(list; val = first(list))
3838

39-
@usual function concept_all_equal(x; val = nothing, pair_vars = zero(x), op = +)
39+
@usual function concept_all_equal(
40+
x; val = nothing, pair_vars = zeros(eltype(x), length(x)), op = +)
4041
if iszero(pair_vars)
4142
return concept_all_equal(x, val)
4243
else

src/constraints/channel.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ end
5757
function xcsp_channel(; list)
5858
xcsp_channel(values(list))
5959
end
60-
function concept_channel(x, ::Val{2})
60+
function concept_channel(x::AbstractVector, ::Val{2})
6161
mid = length(x) ÷ 2
6262
return xcsp_channel(list = (@view(x[1:mid]), @view(x[(mid + 1):end])))
6363
end
6464

65+
concept_channel(x, ::Val{2}) = concept_channel(collect(x), Val(2))
66+
6567
concept_channel(x, ::Val) = xcsp_channel(list = x)
6668

6769
concept_channel(x, id) = count(!iszero, x) == 1 == x[id]

src/constraints/no_overlap.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ end
8787
function concept_no_overlap(x, pair_vars, dim, bool, _)
8888
l = Int(length(x) ÷ dim)
8989
# @info l x dim
90-
origins = reinterpret(reshape, NTuple{dim, eltype(x)}, reshape(x, (dim, l)))
90+
origins = reinterpret(reshape, NTuple{dim, eltype(x)}, reshape(collect(x), (dim, l)))
9191
lengths = reinterpret(
9292
reshape, NTuple{dim, eltype(x)}, reshape(pair_vars[:, 1], (dim, l)))
9393
return xcsp_no_overlap(; origins, lengths, zero_ignored = bool)

0 commit comments

Comments
 (0)