Skip to content

fix: make Base method dispatches more abstract #333

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

Merged
merged 1 commit into from
Jan 15, 2024
Merged
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
12 changes: 7 additions & 5 deletions src/vector_of_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,18 +474,20 @@ function Base.copy(VA::AbstractDiffEqArray)
end
Base.copy(VA::AbstractVectorOfArray) = typeof(VA)(copy(VA.u))

Base.zero(VA::VectorOfArray) = VectorOfArray(Base.zero.(VA.u))
Base.zero(VA::AbstractVectorOfArray) = VectorOfArray(Base.zero.(VA.u))

function Base.zero(VA::DiffEqArray)
function Base.zero(VA::AbstractDiffEqArray)
u = Base.zero.(VA.u)
DiffEqArray(u, VA.t, VA.p, VA.sys)
DiffEqArray(u, VA.t, parameter_values(VA), symbolic_container(VA))
end

Base.sizehint!(VA::AbstractVectorOfArray{T, N}, i) where {T, N} = sizehint!(VA.u, i)

Base.reverse!(VA::AbstractVectorOfArray) = reverse!(VA.u)
Base.reverse(VA::VectorOfArray) = VectorOfArray(reverse(VA.u))
Base.reverse(VA::DiffEqArray) = DiffEqArray(reverse(VA.u), VA.t, VA.p, VA.sys)
Base.reverse(VA::AbstractVectorOfArray) = VectorOfArray(reverse(VA.u))
function Base.reverse(VA::AbstractDiffEqArray)
DiffEqArray(reverse(VA.u), VA.t, parameter_values(VA), symbolic_container(VA))
end

function Base.resize!(VA::AbstractVectorOfArray, i::Integer)
if Base.hasproperty(VA, :sys) && VA.sys !== nothing
Expand Down