Skip to content

Add reshape back #295

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

Closed
wants to merge 1 commit into from
Closed

Add reshape back #295

wants to merge 1 commit into from

Conversation

visr
Copy link

@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
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