-
-
Notifications
You must be signed in to change notification settings - Fork 70
Base.similar and Base.fill! for VectorOfArray #24
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
Conversation
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.
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)]) |
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
1 similar comment
|
Thanks! |
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.