Skip to content
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

Easily unpack components to static arrays #219

Merged
merged 6 commits into from
Sep 9, 2023
Merged

Easily unpack components to static arrays #219

merged 6 commits into from
Sep 9, 2023

Conversation

jonniedie
Copy link
Owner

@jonniedie jonniedie commented Sep 8, 2023

julia> using ComponentArrays

julia> ca = ComponentArray(a=5, b=[4, 1], c = [1 2; 3 4], d=(a=2, b=[6, 30.0]))
ComponentVector{Float64}(a = 5.0, b = [4.0, 1.0], c = [1.0 2.0; 3.0 4.0], d = (a = 2.0, b = [6.0, 30.0]))

julia> @static_unpack a, b, c, d = ca
ComponentVector{Float64,SubArray...}(a = 2.0, b = [6.0, 30.0])

julia> a
5.0

julia> b
2-element SVector{2, Float64} with indices SOneTo(2):
 4.0
 1.0

julia> c
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
 1.0  2.0
 3.0  4.0

julia> d
ComponentVector{Float64,SubArray...}(a = 2.0, b = [6.0, 30.0])

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Merging #219 (dc0103a) into main (18632e7) will increase coverage by 0.93%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
+ Coverage   72.51%   73.44%   +0.93%     
==========================================
  Files          21       21              
  Lines         684      708      +24     
==========================================
+ Hits          496      520      +24     
  Misses        188      188              
Files Changed Coverage Δ
src/ComponentArrays.jl 100.00% <ø> (ø)
src/compat/static_arrays.jl 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jonniediegelman
Copy link
Collaborator

FYI @jondavis847

@jonniedie jonniedie merged commit c1af644 into main Sep 9, 2023
6 checks passed
@jonniedie jonniedie deleted the static-unpack branch September 9, 2023 01:05
@ChrisRackauckas
Copy link
Contributor

What in this is breaking? This is the only change in the breaking v0.15 release but I don't quite see how it breaks previous behavior.

@jonniedie
Copy link
Owner Author

Oh geez you're right. Actually nothing. I was kinda just on autopilot from working on things that are in versions >1.0 and forgot that 0.x changes are breaking for versions <1.0. I don't think I can revert it at this point, though, right?

@ChrisRackauckas
Copy link
Contributor

yeah no reason to revert, I was just confused.

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.

4 participants