Skip to content

Base.similar and Base.fill! for VectorOfArray - #24

Merged
ChrisRackauckas merged 4 commits into
SciML:masterfrom
Gregstrq:master
Nov 28, 2017
Merged

ChrisRackauckas merged 4 commits into
SciML:masterfrom
Gregstrq:master

Conversation

@Gregstrq

Copy link
Copy Markdown
Contributor

This PR is addressing #23.
I've added dispatch on VectorOfArray for Base.similar

I didn't do it for DiffEqArray. As I understand, DiffEqArray is used to store the results, so do we really need to use similar with it?

I've added dispatch on AbstractVectorOfArray for Base.fill!
For DiffEqArray it ignores ts and just fills u.
Now we can use zeros and ones with VectorOfArray.

I also fixed any(f, itr) for AbstractVectorOfArray. Now ODE_DEFAULT_UNSTABLE_CHECK from DiffEqBase works properly with AbstractVectorOfArray.
I suppose I should have done separate PR for it, but the change is small.

Added dispatch on AbstractVectorOfArray for Base.fill! Now we can use
ones and zeros with VectorOfArray

Fixed any(f, itr) for AbstractVectorOfArray. Without it
ODE_DEFAULT_UNSTABLE_CHECK from DiffEqBase doesn't work properly for
VectorOfArray.
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.2%) to 63.85% when pulling f442388 on Gregstrq:master into b1b147c on JuliaDiffEq:master.

Comment thread src/vector_of_array.jl Outdated

# Tools for creating similar objects
@inline Base.similar(VA::VectorOfArray{T}) where {T} = similar(VA, T)
@inline Base.similar(VA::VectorOfArray, ::Type{T}) where {T} = VectorOfArray([similar(VA[i], T) for i in eachindex(VA)])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can put these two together with `Base.similar(VA::VectorOfArray, ::Type{T} = eltype(VA))

@codecov

codecov Bot commented Nov 28, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #24 into master will increase coverage by 2.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #24      +/-   ##
==========================================
+ Coverage   65.07%   67.12%   +2.05%     
==========================================
  Files           3        3              
  Lines         209      216       +7     
==========================================
+ Hits          136      145       +9     
+ Misses         73       71       -2
Impacted Files Coverage Δ
src/vector_of_array.jl 63.82% <100%> (+8.82%) ⬆️
src/utils.jl 52.85% <0%> (+1.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1b147c...2b51e08. Read the comment docs.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-2.8%) to 62.273% when pulling 2e259a1 on Gregstrq:master into b1b147c on JuliaDiffEq:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-2.8%) to 62.273% when pulling 2e259a1 on Gregstrq:master into b1b147c on JuliaDiffEq:master.

@ChrisRackauckas
ChrisRackauckas merged commit 82e76d7 into SciML:master Nov 28, 2017
@ChrisRackauckas

Copy link
Copy Markdown
Member

Thanks!

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.4%) to 63.721% when pulling 2e259a1 on Gregstrq:master into b1b147c on JuliaDiffEq:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.06%) to 67.13% when pulling 2b51e08 on Gregstrq:master into b1b147c on JuliaDiffEq:master.

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.

3 participants