Skip to content

Preserve ShapedAxis components during vcat #301

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

Merged
merged 3 commits into from
May 3, 2025

Conversation

dingraha
Copy link
Contributor

@dingraha dingraha commented Apr 1, 2025

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

Currently when calling vcat with two ComponentVectors, all multi-dimensional components of the second argument are flattened:

julia> x = ComponentVector(a=rand(Float64, 2, 3, 4), b=rand(Float64, 4, 3, 2))
julia> y = ComponentVector(c=rand(Float64, 3, 4, 2), d=rand(Float64, 3, 2, 4))
julia> xy = vcat(x, y)

julia> size(xy.a)
(2, 3, 4)

julia> size(xy.b)
(4, 3, 2)

julia> size(xy.c)
(24,)

julia> size(xy.d)
(24,)

julia> 

This PR fixes that.

@dingraha
Copy link
Contributor Author

dingraha commented May 2, 2025

@ChrisRackauckas Could I get a review of this PR?

@ChrisRackauckas ChrisRackauckas merged commit 8492444 into SciML:main May 3, 2025
5 checks passed
@ChrisRackauckas
Copy link
Member

Sorry I had missed this one!

@dingraha
Copy link
Contributor Author

dingraha commented May 5, 2025

@ChrisRackauckas No problem, and thank you!

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.

None yet

2 participants