Skip to content
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

Handle Transpose and PermuteDimsArray #5

Closed
rafaqz opened this issue Oct 3, 2019 · 4 comments
Closed

Handle Transpose and PermuteDimsArray #5

rafaqz opened this issue Oct 3, 2019 · 4 comments

Comments

@rafaqz
Copy link
Owner

rafaqz commented Oct 3, 2019

solutions:

  • define dims for them and reorder the dims tuple of the contained array to match the transpose.
  • add a constructor for Transpose(a::AbstractDimensionalArray) that rewraps the Transpose in the dim array, as with SubArray in view.

As discussed in
JuliaCollections/AxisArraysFuture#1

@mcabbott
Copy link

mcabbott commented Oct 3, 2019

Corresponding discussion about PermuteDimsArray in NamedDims, perhaps of interest: invenia/NamedDims.jl#64 (review)

tl;dr is that people find it weird that a constructor not return something of its own type, but transpose is obviously no problem.

@rafaqz
Copy link
Owner Author

rafaqz commented Oct 3, 2019

That pretty much sums it up. It's also good to keep wrapping the type with the dimensional type on the outside for any other methods people want to put on the array type and for dispatch.

How do you compare the two approaches after playing with the implementation in NamedPlus?

@rafaqz rafaqz closed this as completed Oct 17, 2019
@mcabbott
Copy link

mcabbott commented Nov 2, 2019

Sorry I never replied. I think my answer is that it seems possible to make quite a long list of wrappers around your type work transparently, but it may be more hassle than it’s worth!

My current attempt is AxisRanges.jl, which only tries to commute with NamedDims, which is much easier.

@rafaqz
Copy link
Owner Author

rafaqz commented Nov 2, 2019

Yeah wrappers are a no go. I decided DimensionalArrays are "dominant" types and just always re-wrap things, which is much less work.

@rafaqz rafaqz reopened this Nov 2, 2019
@rafaqz rafaqz closed this as completed Nov 2, 2019
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

No branches or pull requests

2 participants