Skip to content

Preserve ShapedAxis components during vcat#301

Merged
ChrisRackauckas merged 3 commits intoSciML:mainfrom
dingraha:vcat_shaped_axis
May 3, 2025
Merged

Preserve ShapedAxis components during vcat#301
ChrisRackauckas merged 3 commits intoSciML:mainfrom
dingraha:vcat_shaped_axis

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.

2 participants