Skip to content

Commit

Permalink
fix type parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Mar 2, 2024
1 parent d912ce4 commit f5e36a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
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,
# the piracy of `sort` should be resolved in the future
piracies=(broken=true,))

Expand Down
4 changes: 4 additions & 0 deletions test/maps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ end
@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 @@ -196,6 +198,8 @@ end
@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

0 comments on commit f5e36a7

Please sign in to comment.