diff --git a/src/difference.jl b/src/difference.jl index 4c5ee160c..1d741afcb 100644 --- a/src/difference.jl +++ b/src/difference.jl @@ -38,4 +38,4 @@ Base.nameof(::Difference) = :Difference function Base.:(==)(D1::Difference, D2::Difference) return isequal(D1.t, D2.t) && isequal(D1.dt, D2.dt) && isequal(D1.update, D2.update) end -Base.hash(D::Difference, u::UInt) = hash(D.dt, hash(D.t, xor(u, 0x055640d6d952f101))) +Base.hash(D::Difference, u::UInt) = hash(D.dt, hash(D.t, xor(u, 0x055640d6d952f101 % UInt))) diff --git a/src/utils/utils.jl b/src/utils/utils.jl index 10a684407..52d898ec0 100644 --- a/src/utils/utils.jl +++ b/src/utils/utils.jl @@ -3,7 +3,7 @@ # Values is 4/sqrt(3)", http://arxiv.org/abs/1305.5870 # Code taken from https://github.com/erichson/optht -function optimal_svht(m::Int64, n::Int64; known_noise::Bool = false) +function optimal_svht(m::Integer, n::Integer; known_noise::Bool = false) @assert m / n > 0 @assert m / n <= 1 diff --git a/test/Core/implicit_basis.jl b/test/Core/implicit_basis.jl index 09c301b00..64911a2a8 100644 --- a/test/Core/implicit_basis.jl +++ b/test/Core/implicit_basis.jl @@ -56,6 +56,8 @@ end discrete_prob = DiscreteDataDrivenProblem(x) d = Difference(get_iv(basis), dt = 1.0) + # hash(::Difference, ::UInt) must return the platform native UInt. + @test typeof(hash(d, UInt(1))) === UInt @test Symbolics.symtype(d(first(states(basis)))) === Real @test isempty(Symbolics.shape(d(first(states(basis))))) ∂ = Differential(get_iv(basis)) diff --git a/test/Core/utils.jl b/test/Core/utils.jl index b22600f8a..b6b81c117 100644 --- a/test/Core/utils.jl +++ b/test/Core/utils.jl @@ -18,6 +18,8 @@ using LinearAlgebra end @testset "Optimal Shrinkage" begin + # Callers pass size(...) extents; Int32 must be accepted on every platform. + @test DataDrivenDiffEq.optimal_svht(Int32(10), Int32(20)) isa Real t = collect(-2:0.01:2) U = [cos.(t) .* exp.(-t .^ 2) sin.(2 * t)] S = Diagonal([2.0; 3.0])