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

Promote tspan for discrete probs #928

Merged

Conversation

isaacsas
Copy link
Member

Closes #927

@isaacsas
Copy link
Member Author

I don't think any of these failures are related, but it is quite a large list of packages with test issues right now it seems.

@ChrisRackauckas
Copy link
Member

There's lots of little things to do.

u0, tspan::Tuple, p = NullParameters();
u0, tspan, p = NullParameters();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this give an ambiguity?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With which method?

Aqua reports:

julia> Aqua.test_ambiguities(SciMLBase)
8 ambiguities found. To get a list, set `broken = false`.
Ambiguity #1
(L::SciMLBase.AffineDiffEqOperator)(du, u, p, t::Number) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/diffeq_operator.jl:49
(L::SciMLOperators.AbstractSciMLOperator)(du::Number, u::Number, p, t, args...; kwargs...) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:122

Possible fix, define
  (::SciMLBase.AffineDiffEqOperator)(::Number, ::Number, ::Any, ::Number)

Ambiguity #2
(L::SciMLBase.DiffEqArrayOperator)(du, u, p, t) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:205
(L::SciMLOperators.AbstractSciMLOperator)(du::Number, u::Number, p, t, args...; kwargs...) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:122

Possible fix, define
  (::SciMLBase.DiffEqArrayOperator)(::Number, ::Number, ::Any, ::Any)

Ambiguity #3
(L::SciMLBase.DiffEqIdentity)(du, u, p, t) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:205
(L::SciMLOperators.AbstractSciMLOperator)(du::Number, u::Number, p, t, args...; kwargs...) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:122

Possible fix, define
  (::SciMLBase.DiffEqIdentity)(::Number, ::Number, ::Any, ::Any)

Ambiguity #4
(L::SciMLBase.DiffEqScalar)(du, u, p, t) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:205
(L::SciMLOperators.AbstractSciMLOperator)(du::Number, u::Number, p, t, args...; kwargs...) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:122

Possible fix, define
  (::SciMLBase.DiffEqScalar)(::Number, ::Number, ::Any, ::Any)

Ambiguity #5
(L::SciMLBase.FactorizedDiffEqArrayOperator)(du, u, p, t) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:205
(L::SciMLOperators.AbstractSciMLOperator)(du::Number, u::Number, p, t, args...; kwargs...) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:122

Possible fix, define
  (::SciMLBase.FactorizedDiffEqArrayOperator)(::Number, ::Number, ::Any, ::Any)

Ambiguity #6
mul!(Y::AbstractArray, α::SciMLBase.DiffEqScalar, B::AbstractArray) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:76
mul!(Y::AbstractVecOrMat, L::SciMLBase.AbstractDiffEqLinearOperator, B::AbstractVecOrMat) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/common_defaults.jl:43

Possible fix, define
  mul!(::AbstractVecOrMat, ::SciMLBase.DiffEqScalar, ::AbstractVecOrMat)

Ambiguity #7
size(L::SciMLBase.FactorizedDiffEqArrayOperator, args...) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:188
size(A::SciMLOperators.AbstractSciMLOperator, d::Integer) @ SciMLOperators ~/.julia/packages/SciMLOperators/KVzmP/src/interface.jl:178

Possible fix, define
  size(::SciMLBase.FactorizedDiffEqArrayOperator, ::Integer)

Ambiguity #8
size(L::SciMLBase.FactorizedDiffEqArrayOperator, args...) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/basic_operators.jl:188
size(L::SciMLBase.AbstractDiffEqLinearOperator, i::Integer) @ SciMLBase ~/.julia/dev/SciMLBase/src/operators/common_defaults.jl:7

Possible fix, define
  size(::SciMLBase.FactorizedDiffEqArrayOperator, ::Integer)

Test Failed at /Users/isaacsas/.julia/packages/Aqua/epbUr/src/ambiguities.jl:78
  Expression: iszero(num_ambiguities)

ERROR: There was an error during testing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the second and third constructors when passing three arguments with the first two being nothing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I make tspan a union of vectors, tuples, and numbers? tspan::T where {T <: Union{Vector,Tuple,Number}?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so. I don't think the no function or f = identity dispatch is compatible with getting rid of the tspan::Tuple or some form of a type marker, since otherwise you cannot distinguish it from p.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the old version have the same ambiguity though. I don't see how changing the first constructor, the only one I modified, impacts that. The ambiguity is between the second and third constructors isn't it?

I also don't get any messages about ambiguities locally on 1.11.3 when calling

p = (0.1 / 1000, 0.01)
dprob4 = DiscreteProblem{true}(nothing, nothing, p)

@isaacsas
Copy link
Member Author

@ChrisRackauckas I've added more constructor instances. At least locally none of these result in errors about ambiguities. I don't know if this covers the particular case you are worried about though.

@ChrisRackauckas
Copy link
Member

Your test does cover the cases I was worried about, so I'm happy to merge it and see. I have so much clean up to do from the v1.11 memory changes still 😅

@ChrisRackauckas ChrisRackauckas merged commit 575392e into SciML:master Feb 12, 2025
25 of 51 checks passed
@isaacsas isaacsas deleted the promote_tspan_for_discrete_probs branch February 12, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create DiscreteProblem for tend only
2 participants