Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unbound args #288

Merged
merged 2 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ islinear(::ResetMap) = false
isaffine(::ResetMap) = true

# convenience constructor for a list of pairs instead of a dictionary
ResetMap(dim::Int, args::Pair{Int,<:N}...) where {N} = ResetMap(dim, Dict{Int,N}(args))
ResetMap(dim::Int, args::Pair{Int}...) = ResetMap(dim, Dict(args))

"""
ConstrainedResetMap
Expand Down Expand Up @@ -362,8 +362,8 @@ islinear(::ConstrainedResetMap) = false
isaffine(::ConstrainedResetMap) = true

# convenience constructor for a list of pairs instead of a dictionary
function ConstrainedResetMap(dim::Int, X, args::Pair{Int,<:N}...) where {N}
return ConstrainedResetMap(dim, X, Dict{Int,N}(args))
function ConstrainedResetMap(dim::Int, X, args::Pair{Int}...)
return ConstrainedResetMap(dim, X, Dict(args))
end

function apply(m::Union{ResetMap,ConstrainedResetMap}, x)
Expand Down
9 changes: 1 addition & 8 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@ using MathematicalSystems, Test
import Aqua

@testset "Aqua tests" begin
@static if VERSION < v"1.6"
unbound_args = true
else
# the unbound args should be resolved in the future
unbound_args = (broken=true,)
end

Aqua.test_all(MathematicalSystems;
ambiguities=false, unbound_args=unbound_args)
ambiguities=false)

@static if VERSION < v"1.6"
# do not warn about ambiguities in dependencies
Expand Down
16 changes: 14 additions & 2 deletions test/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,16 @@ end
@test statedim(m) == 10
@test inputdim(m) == 0
@test outputdim(m) == 10
# alternative constructor from pairs
@test m.dict == ResetMap(10, 9 => 0.0).dict

m = ResetMap(10, 2 => -1.0, 5 => 1.0)
m = ResetMap(10, Dict(2 => -1.0, 5 => 1.0))
@test outputdim(m) == 10
@test !islinear(m) && isaffine(m)
# alternative constructor from pairs
@test m.dict == ResetMap(10, 2 => -1.0, 5 => 1.0).dict
# alternative constructor from pairs with mixed numeric types
@test ResetMap(10, 2 => -1.0, 5 => 1).dict == Dict(2 => -1.0, 5 => 1)

# applying the affine map on a vector
x = zeros(10)
Expand All @@ -183,11 +189,17 @@ end
@test inputdim(m) == 0
@test outputdim(m) == 10
@test stateset(m) == X
# alternative constructor from pairs
@test m.dict == ConstrainedResetMap(10, X, 9 => 0.0).dict

m = ConstrainedResetMap(10, X, 2 => -1.0, 5 => 1.0)
m = ConstrainedResetMap(10, X, Dict(2 => -1.0, 5 => 1.0))
@test outputdim(m) == 10
@test stateset(m) == X
@test !islinear(m) && isaffine(m)
# alternative constructor from pairs
@test m.dict == ConstrainedResetMap(10, X, 2 => -1.0, 5 => 1.0).dict
# alternative constructor from pairs with mixed numeric types
@test ConstrainedResetMap(10, X, 2 => -1.0, 5 => 1).dict == Dict(2 => -1.0, 5 => 1)

# applying the affine map on a vector
x = zeros(10)
Expand Down
Loading