SciML / SciML/ComponentArrays.jl
Use map-do block for constructor
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
The standard constructor goes through the NamedTuple and pushes values to the data array one at a time. There are two problems with this:
-
It’s really slow. Now that there is a constructor for creating new
ComponentArrays with additional fields from old ones, it is reasonable to expect to use this in a hot loop. With adoblock, it should be a lot faster. -
Zygote doesn’t allow array mutation, so the standard
ComponentArrayconstructor is not differentiable (theComponentArray(data, axes)one is, though).
Both of these are related to issue #22
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the standard ComponentArray constructor and compare it with the ComponentArray(data, axes) constructor, then review related issue #22. The change is done when construction avoids the described array mutation, improves hot-loop performance, and remains differentiable with Zygote.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100