Skip to content

feat: add ability to set VectorOfArray with Array using broadcast - #309

Merged
ChrisRackauckas merged 6 commits into
SciML:masterfrom
AayushSabharwal:as/broadcast-from-array
Dec 22, 2023
Merged

ChrisRackauckas merged 6 commits into
SciML:masterfrom
AayushSabharwal:as/broadcast-from-array

Conversation

@AayushSabharwal

Copy link
Copy Markdown
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Add any other context about the problem here.

Comment thread src/vector_of_array.jl

@inline function Base.copyto!(dest::AbstractVectorOfArray,
bc::Broadcast.Broadcasted{<:Broadcast.DefaultArrayStyle})
bc = Broadcast.flatten(bc)

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.

won't this allocate?

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.

guess not, I'm adding a test for that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Which part? unpack_voa creates views, so it won't if the target array is mutable. If the target isn't, then it has to allocate

Comment thread test/interface_tests.jl
Comment thread test/interface_tests.jl Outdated
@ChrisRackauckas
ChrisRackauckas merged commit 8c87d85 into SciML:master Dec 22, 2023
@AayushSabharwal
AayushSabharwal deleted the as/broadcast-from-array branch December 22, 2023 07:12
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.

2 participants