Skip to content

Add reshape back#295

Closed
visr wants to merge 1 commit intoSciML:mainfrom
visr:reshape
Closed

Add reshape back#295
visr wants to merge 1 commit intoSciML:mainfrom
visr:reshape

Conversation

@visr
Copy link
Contributor

@visr visr commented Feb 20, 2025

In b81c7bc a reshape method very similar to this got added. This was piracy for the case that axs was an empty tuple. This was reported in #193, and this PR implements the original suggestion. Instead in #194 the reshape method was removed entirely since it seemed to serve no purpose other that avoiding issues with OffsetArrays.

Now I am running into

MethodError: no method matching reshape(::Vector{Int64}, ::Tuple{ComponentArrays.CombinedAxis{ComponentArrays.Axis{…}, Base.OneTo{…}}})

Being triggered from: https://github.com/JuliaDiff/FiniteDiff.jl/blob/a7eca2d4b73c4de12140d89df7621fcc90d29190/src/jacobians.jl#L422

So now we can reshape onto our own axes:

using ComponentArrays
cv = ComponentVector(; a = [1, 2], b = [3, 4, 5])
reshape(cv, axes(cv))  # -> ComponentVector{Int64}(a = [1, 2], b = [3, 4, 5])

@visr
Copy link
Contributor Author

visr commented Mar 11, 2025

I see this has since been fixed by #297.

@visr visr closed this Mar 11, 2025
@visr visr mentioned this pull request Mar 11, 2025
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.

1 participant