Skip to content

Conversation

@DhairyaLGandhi
Copy link
Member

@DhairyaLGandhi DhairyaLGandhi changed the title feat: preserve indices when copying tracked arrays feat: Preserve Indices When Copying Tracked Arrays Jun 26, 2024
@DhairyaLGandhi
Copy link
Member Author

Bumping :)

return T1.(x)
end
function Base.convert(::Type{ComponentArray{T,N,A1,Ax1}}, x::ComponentArray{T,N,A2,Ax2}) where {T,N,A1,A2,Ax1,Ax2}
return x
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't we want the axes to be from the type we're converting to? I think part of the contract of convert is that the output needs to be of the type you're converting to.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in those dispatches we'd want to just have Ax instead of Ax1 and Ax2 too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! I do not know if there are downstream packages relying on that behaviour, so I will not touch those dispatches in this PR. For now, I have matched the axes for this dispatch

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I definitely need to change those, then. But that doesn't block this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also had to add another trivial dispatch to avoid ambiguities.

@jonniedie
Copy link
Collaborator

Sorry, I commented this morning but forgot to hit "Submit Review"

@DhairyaLGandhi
Copy link
Member Author

Bump :)

@jonniedie jonniedie merged commit 5aaf060 into SciML:main Jun 28, 2024
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.

3 participants